]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - svvm_cmds.c
added DP_QC_TOKENIZEBYSEPARATOR extension
[xonotic/darkplaces.git] / svvm_cmds.c
index f139e6f3021d4abae8a3e202f265784fdedcfecc..bbe14a7734eb2ccea85d487feada55d67ccbfac5 100644 (file)
@@ -3,7 +3,7 @@
 //============================================================================
 // Server
 
-cvar_t sv_aim = {CVAR_SAVE, "sv_aim", "2", "maximum cosine angle for quake's vertical autoaim, a value above 1 completely disables the autoaim, quake used 0.93"}; //"0.93"}; // LordHavoc: disabled autoaim by default
+cvar_t sv_aim = {CVAR_SAVE, "sv_aim", "2", "maximum cosine angle for quake's vertical autoaim, a value above 1 completely disables the autoaim, quake used 0.93"};
 
 
 char *vm_sv_extensions =
@@ -70,6 +70,7 @@ char *vm_sv_extensions =
 "DP_QC_STRFTIME "
 "DP_QC_STRINGBUFFERS "
 "DP_QC_STRINGCOLORFUNCTIONS "
+"DP_QC_TOKENIZEBYSEPARATOR "
 "DP_QC_TRACEBOX "
 "DP_QC_TRACETOSS "
 "DP_QC_TRACE_MOVETYPE_HITMODEL "
@@ -275,9 +276,17 @@ static void VM_SV_sprint (void)
        int                     entnum;
        char string[VM_STRINGTEMP_LENGTH];
 
+       VM_VarString(1, string, sizeof(string));
+
        VM_SAFEPARMCOUNTRANGE(2, 8, VM_SV_sprint);
 
        entnum = PRVM_G_EDICTNUM(OFS_PARM0);
+       // LordHavoc: div0 requested that sprintto world  operate like print
+       if (entnum == 0)
+       {
+               Con_Print(string);
+               return;
+       }
 
        if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
        {
@@ -289,7 +298,6 @@ static void VM_SV_sprint (void)
        if (!client->netconnection)
                return;
 
-       VM_VarString(1, string, sizeof(string));
        MSG_WriteChar(&client->netconnection->message,svc_print);
        MSG_WriteString(&client->netconnection->message, string);
 }
@@ -963,7 +971,7 @@ VM_SV_checkbottom
 */
 static void VM_SV_checkbottom (void)
 {
-       VM_SAFEPARMCOUNT(0, VM_SV_checkbottom);
+       VM_SAFEPARMCOUNT(1, VM_SV_checkbottom);
        PRVM_G_FLOAT(OFS_RETURN) = SV_CheckBottom (PRVM_G_EDICT(OFS_PARM0));
 }
 
@@ -1192,9 +1200,14 @@ static void VM_SV_makestatic (void)
        prvm_edict_t *ent;
        int i, large;
 
-       VM_SAFEPARMCOUNT(1, VM_SV_makestatic);
+       // allow 0 parameters due to an id1 qc bug in which this function is used
+       // with no parameters (but directly after setmodel with self in OFS_PARM0)
+       VM_SAFEPARMCOUNTRANGE(0, 1, VM_SV_makestatic);
 
-       ent = PRVM_G_EDICT(OFS_PARM0);
+       if (prog->argc >= 1)
+               ent = PRVM_G_EDICT(OFS_PARM0);
+       else
+               ent = PRVM_PROG_TO_EDICT(prog->globals.server->self);
        if (ent == prog->edicts)
        {
                VM_Warning("makestatic: can not modify world entity\n");
@@ -1248,7 +1261,7 @@ static void VM_SV_setspawnparms (void)
        int             i;
        client_t        *client;
 
-       VM_SAFEPARMCOUNT(0, VM_SV_setspawnparms);
+       VM_SAFEPARMCOUNT(1, VM_SV_setspawnparms);
 
        ent = PRVM_G_EDICT(OFS_PARM0);
        i = PRVM_NUM_FOR_EDICT(ent);
@@ -1397,7 +1410,7 @@ void VM_SV_WriteAutoSentStats (client_t *client, prvm_edict_t *ent, sizebuf_t *m
        }
 }
 
-// void(float index, float type, .void field) SV_AddStat = #470;
+// void(float index, float type, .void field) SV_AddStat = #232;
 // Set up an auto-sent player stat.
 // Client's get thier own fields sent to them. Index may not be less than 32.
 // Type is a value equating to the ev_ values found in qcc to dictate types. Valid ones are:
@@ -1409,7 +1422,7 @@ static void VM_SV_AddStat (void)
        int             off, i;
        unsigned char   type;
 
-       VM_SAFEPARMCOUNT(2, VM_SV_AddStat);
+       VM_SAFEPARMCOUNT(3, VM_SV_AddStat);
 
        if(!vm_autosentstats)
        {
@@ -3141,7 +3154,7 @@ VM_tan,                                                   // #475 float(float a) VM_tan (DP_QC_ASINACOSATANATAN2TAN)
 VM_strlennocol,                                        // #476 float(string s) : DRESK - String Length (not counting color codes) (DP_QC_STRINGCOLORFUNCTIONS)
 VM_strdecolorize,                              // #477 string(string s) : DRESK - Decolorized String (DP_SV_STRINGCOLORFUNCTIONS)
 VM_strftime,                                   // #478 string(float uselocaltime, string format, ...) (DP_QC_STRFTIME)
-NULL,                                                  // #479
+VM_tokenizebyseparator,                        // #479 float(string s) tokenizebyseparator (DP_QC_TOKENIZEBYSEPARATOR)
 NULL,                                                  // #480
 NULL,                                                  // #481
 NULL,                                                  // #482