summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/input_default.cpp6
-rw-r--r--main/main.cpp9
-rw-r--r--main/tests/test_gdscript.cpp19
-rw-r--r--main/tests/test_io.cpp2
-rw-r--r--main/tests/test_math.cpp4
-rw-r--r--main/tests/test_physics.cpp4
6 files changed, 18 insertions, 26 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 29d30110e3..4363fc1c88 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -684,7 +684,7 @@ void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {
return;
};
- Map<int, JoyEvent>::Element *el = map_db[joy.mapping].buttons.find(p_button);
+ const Map<int, JoyEvent>::Element *el = map_db[joy.mapping].buttons.find(p_button);
if (!el) {
//don't process un-mapped events for now, it could mess things up badly for devices with additional buttons/axis
//return _button_event(p_last_id, p_device, p_button, p_pressed);
@@ -755,7 +755,7 @@ void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
return;
};
- Map<int, JoyEvent>::Element *el = map_db[joy.mapping].axis.find(p_axis);
+ const Map<int, JoyEvent>::Element *el = map_db[joy.mapping].axis.find(p_axis);
if (!el) {
//return _axis_event(p_last_id, p_device, p_axis, p_value);
return;
@@ -831,7 +831,7 @@ void InputDefault::joy_hat(int p_device, int p_val) {
_THREAD_SAFE_METHOD_;
const Joypad &joy = joy_names[p_device];
- JoyEvent *map;
+ const JoyEvent *map;
if (joy.mapping == -1) {
map = hat_map_default;
diff --git a/main/main.cpp b/main/main.cpp
index 56dd5f73e7..5beeb95a11 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1734,8 +1734,11 @@ bool Main::iteration() {
int physics_fps = Engine::get_singleton()->get_iterations_per_second();
float frame_slice = 1.0 / physics_fps;
+ float time_scale = Engine::get_singleton()->get_time_scale();
+
MainFrameTime advance = main_timer_sync.advance(frame_slice, physics_fps);
double step = advance.idle_step;
+ double scaled_step = step * time_scale;
Engine::get_singleton()->_frame_step = step;
@@ -1757,8 +1760,6 @@ bool Main::iteration() {
advance.physics_steps = max_physics_steps;
}
- float time_scale = Engine::get_singleton()->get_time_scale();
-
bool exit = false;
Engine::get_singleton()->_in_physics = true;
@@ -1805,11 +1806,11 @@ bool Main::iteration() {
if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) {
if (VisualServer::get_singleton()->has_changed()) {
- VisualServer::get_singleton()->draw(); // flush visual commands
+ VisualServer::get_singleton()->draw(true, scaled_step); // flush visual commands
Engine::get_singleton()->frames_drawn++;
}
} else {
- VisualServer::get_singleton()->draw(); // flush visual commands
+ VisualServer::get_singleton()->draw(true, scaled_step); // flush visual commands
Engine::get_singleton()->frames_drawn++;
force_redraw_requested = false;
}
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 5c7633a0cf..0a9d03c1b7 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -193,14 +193,6 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
case GDScriptParser::OperatorNode::OP_BIT_INVERT: {
txt = "~" + _parser_expr(c_node->arguments[0]);
} break;
- case GDScriptParser::OperatorNode::OP_PREINC: {
- } break;
- case GDScriptParser::OperatorNode::OP_PREDEC: {
- } break;
- case GDScriptParser::OperatorNode::OP_INC: {
- } break;
- case GDScriptParser::OperatorNode::OP_DEC: {
- } break;
case GDScriptParser::OperatorNode::OP_IN: {
txt = _parser_expr(c_node->arguments[0]) + " in " + _parser_expr(c_node->arguments[1]);
} break;
@@ -455,10 +447,9 @@ static void _parser_show_class(const GDScriptParser::ClassNode *p_class, int p_i
print_line("\n");
}
- for (int i = 0; i < p_class->constant_expressions.size(); i++) {
-
- const GDScriptParser::ClassNode::Constant &constant = p_class->constant_expressions[i];
- _print_indent(p_indent, "const " + String(constant.identifier) + "=" + _parser_expr(constant.expression));
+ for (Map<StringName, GDScriptParser::ClassNode::Constant>::Element *E = p_class->constant_expressions.front(); E; E = E->next()) {
+ const GDScriptParser::ClassNode::Constant &constant = E->get();
+ _print_indent(p_indent, "const " + String(E->key()) + "=" + _parser_expr(constant.expression));
}
for (int i = 0; i < p_class->variables.size(); i++) {
@@ -933,8 +924,8 @@ MainLoop *test(TestType p_type) {
Vector<uint8_t> buf;
int flen = fa->get_len();
buf.resize(fa->get_len() + 1);
- fa->get_buffer(&buf[0], flen);
- buf[flen] = 0;
+ fa->get_buffer(buf.ptrw(), flen);
+ buf.write[flen] = 0;
String code;
code.parse_utf8((const char *)&buf[0]);
diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp
index 08dc374ed1..4f98955995 100644
--- a/main/tests/test_io.cpp
+++ b/main/tests/test_io.cpp
@@ -103,7 +103,7 @@ MainLoop *test() {
int len = z->get_len();
Vector<uint8_t> zip;
zip.resize(len);
- z->get_buffer(&zip[0], len);
+ z->get_buffer(zip.ptrw(), len);
z->close();
memdelete(z);
diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp
index 8b71c5dc70..1a72416d6a 100644
--- a/main/tests/test_math.cpp
+++ b/main/tests/test_math.cpp
@@ -503,8 +503,8 @@ MainLoop *test() {
Vector<uint8_t> buf;
int flen = fa->get_len();
buf.resize(fa->get_len() + 1);
- fa->get_buffer(&buf[0], flen);
- buf[flen] = 0;
+ fa->get_buffer(buf.ptrw(), flen);
+ buf.write[flen] = 0;
String code;
code.parse_utf8((const char *)&buf[0]);
diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp
index 475663dabe..99c8fce70e 100644
--- a/main/tests/test_physics.cpp
+++ b/main/tests/test_physics.cpp
@@ -228,11 +228,11 @@ protected:
for (int i = 0; i < p_width; i++) {
- grid[i].resize(p_height);
+ grid.write[i].resize(p_height);
for (int j = 0; j < p_height; j++) {
- grid[i][j] = 1.0 + Math::random(-p_cellheight, p_cellheight);
+ grid.write[i].write[j] = 1.0 + Math::random(-p_cellheight, p_cellheight);
}
}