- else
- Con_Printf("unsupported model %i \"%s\"\n", i, com_token);
- }
- else if (!strcmp(com_token, "sv.sound_precache"))
- {
- COM_ParseToken_Simple(&t, false, false);
- i = atoi(com_token);
- COM_ParseToken_Simple(&t, false, false);
- if (i >= 0 && i < MAX_SOUNDS)
- strlcpy(sv.sound_precache[i], com_token, sizeof(sv.sound_precache[i]));
- else
- Con_Printf("unsupported sound %i \"%s\"\n", i, com_token);
+ else if (!strcmp(com_token, "sv.model_precache"))
+ {
+ COM_ParseToken_Simple(&t, false, false, true);
+ i = atoi(com_token);
+ COM_ParseToken_Simple(&t, false, false, true);
+ if (i >= 0 && i < MAX_MODELS)
+ {
+ strlcpy(sv.model_precache[i], com_token, sizeof(sv.model_precache[i]));
+ sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, sv.model_precache[i][0] == '*' ? sv.worldname : NULL);
+ }
+ else
+ Con_Printf("unsupported model %i \"%s\"\n", i, com_token);
+ }
+ else if (!strcmp(com_token, "sv.sound_precache"))
+ {
+ COM_ParseToken_Simple(&t, false, false, true);
+ i = atoi(com_token);
+ COM_ParseToken_Simple(&t, false, false, true);
+ if (i >= 0 && i < MAX_SOUNDS)
+ strlcpy(sv.sound_precache[i], com_token, sizeof(sv.sound_precache[i]));
+ else
+ Con_Printf("unsupported sound %i \"%s\"\n", i, com_token);
+ }
+ else if (!strcmp(com_token, "sv.buffer"))
+ {
+ if (COM_ParseToken_Simple(&t, false, false, true))
+ {
+ i = atoi(com_token);
+ if (i >= 0)
+ {
+ k = STRINGBUFFER_SAVED;
+ if (COM_ParseToken_Simple(&t, false, false, true))
+ k |= atoi(com_token);
+ if (!BufStr_FindCreateReplace(prog, i, k, "string"))
+ Con_Printf("failed to create stringbuffer %i\n", i);
+ }
+ else
+ Con_Printf("unsupported stringbuffer index %i \"%s\"\n", i, com_token);
+ }
+ else
+ Con_Printf("unexpected end of line when parsing sv.buffer (expected buffer index)\n");
+ }
+ else if (!strcmp(com_token, "sv.bufstr"))
+ {
+ if (!COM_ParseToken_Simple(&t, false, false, true))
+ Con_Printf("unexpected end of line when parsing sv.bufstr\n");
+ else
+ {
+ i = atoi(com_token);
+ stringbuffer = BufStr_FindCreateReplace(prog, i, STRINGBUFFER_SAVED, "string");
+ if (stringbuffer)
+ {
+ if (COM_ParseToken_Simple(&t, false, false, true))
+ {
+ k = atoi(com_token);
+ if (COM_ParseToken_Simple(&t, false, false, true))
+ BufStr_Set(prog, stringbuffer, k, com_token);
+ else
+ Con_Printf("unexpected end of line when parsing sv.bufstr (expected string)\n");
+ }
+ else
+ Con_Printf("unexpected end of line when parsing sv.bufstr (expected strindex)\n");
+ }
+ else
+ Con_Printf("failed to create stringbuffer %i \"%s\"\n", i, com_token);
+ }
+ }
+ // skip any trailing text or unrecognized commands
+ while (COM_ParseToken_Simple(&t, true, false, true) && strcmp(com_token, "\n"))
+ ;