mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-23 20:33:05 +00:00
qcvm: add stov builtin #16
This commit is contained in:
parent
3f5305af58
commit
eb2d478770
2 changed files with 16 additions and 1 deletions
16
exec.cpp
16
exec.cpp
|
@ -668,6 +668,19 @@ static int qc_stof(qc_program_t *prog) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int qc_stov(qc_program_t *prog) {
|
||||
qcany_t *str;
|
||||
qcany_t num;
|
||||
CheckArgs(1);
|
||||
str = GetArg(0);
|
||||
(void)util_sscanf(prog_getstring(prog, str->string), " ' %f %f %f ' ",
|
||||
&num.vector[0],
|
||||
&num.vector[1],
|
||||
&num.vector[2]);
|
||||
Return(num);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qc_vtos(qc_program_t *prog) {
|
||||
char buffer[512];
|
||||
qcany_t *num;
|
||||
|
@ -833,7 +846,8 @@ static prog_builtin_t qc_builtins[] = {
|
|||
&qc_normalize, /* 12 */
|
||||
&qc_sqrt, /* 13 */
|
||||
&qc_floor, /* 14 */
|
||||
&qc_pow /* 15 */
|
||||
&qc_pow, /* 15 */
|
||||
&qc_stov /* 16 */
|
||||
};
|
||||
|
||||
static const char *arg0 = nullptr;
|
||||
|
|
|
@ -18,3 +18,4 @@ vector (vector vec) normalize = #12;
|
|||
float (float val) sqrt = #13;
|
||||
float (float val) floor = #14;
|
||||
float (float val1, float val2) pow = #15;
|
||||
vector (string str) stov = #16;
|
||||
|
|
Loading…
Reference in a new issue