summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-12-09 15:33:33 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-12-09 15:33:33 -0500
commitf8af94cca134ce91d51b64189ba6223185f946f5 (patch)
treec0e052f78f8caf44aeddfd390c5594a4f56446e8
parent9ca2a24de737b18d681a016557e4a037751e32bf (diff)
oops fix rotate speed editor
-rw-r--r--sim.cpp10
-rw-r--r--sim.hpp2
2 files changed, 8 insertions, 4 deletions
diff --git a/sim.cpp b/sim.cpp
index 395951c..824a7c5 100644
--- a/sim.cpp
+++ b/sim.cpp
@@ -685,9 +685,13 @@ void sim_frame(Frame *frame) {
if (keys_pressed[KEY_R]) {
// toggle rotating platform
- platform_building->rotates = !platform_building->rotates;
- if (platform_building->rotate_speed == 0) {
- platform_building->rotate_speed = 1;
+ bool rotates = platform_building->rotates = !platform_building->rotates;
+ if (rotates) {
+ if (platform_building->rotate_speed == 0) {
+ platform_building->rotate_speed = 1;
+ }
+ } else {
+ platform_building->rotate_speed = 0;
}
}
diff --git a/sim.hpp b/sim.hpp
index 2a83412..a8a739a 100644
--- a/sim.hpp
+++ b/sim.hpp
@@ -139,7 +139,7 @@ typedef struct {
v2 move_p1;
v2 move_p2;
- float rotate_speed;
+ float rotate_speed; // rotation speed. if this isn't a rotating platform, this should be 0
u32 color;
} Platform;