vrheights
diff src/game.cc @ 11:537db3079134
- setting a variable from the console now sets the same variable in libgoatvr too
- set_gvar_parse now returns the inferred type
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 03 Oct 2014 23:11:23 +0300 |
parents | 3e6757655fe2 |
children | 0168104ec568 |
line diff
1.1 --- a/src/game.cc Fri Oct 03 21:27:58 2014 +0300 1.2 +++ b/src/game.cc Fri Oct 03 23:11:23 2014 +0300 1.3 @@ -473,7 +473,18 @@ 1.4 } else { 1.5 con.printf("%s->%s\n", argv[1], argv[2]); 1.6 } 1.7 - set_gvar_parse(argv[1], argv[2]); 1.8 + 1.9 + int type = set_gvar_parse(argv[1], argv[2]); 1.10 + if(type == GameVariable::NUMBER) { 1.11 + vr_setf(argv[1], atof(argv[2])); 1.12 + } else if(type == GameVariable::BOOL) { 1.13 + vr_seti(argv[1], get_gvar_bool(argv[1]) ? 1 : 0); 1.14 + } 1.15 + 1.16 + // update state vars 1.17 + cam_pos[0] = get_gvar_num("cam-pos-x"); 1.18 + cam_pos[1] = get_gvar_num("cam-pos-y"); 1.19 + cam_pos[2] = get_gvar_num("cam-pos-z"); 1.20 1.21 } else if(strcmp(argv[0], "get") == 0) { 1.22 if(argv.size() < 2) {