diff options
| author | Alfred Eriksson <somerunce@gmail.com> | 2009-01-24 10:43:27 +0000 |
|---|---|---|
| committer | Alfred Eriksson <somerunce@gmail.com> | 2009-01-24 10:43:27 +0000 |
| commit | affb99fd2b7973146a92626144026baf50990136 (patch) | |
| tree | fcee916cfd9417c30f8a78d294eedbd95c5fc393 /src/game | |
| parent | 97eb28afaede309432c5f6f5c25589b00d993cb6 (diff) | |
| download | zcatch-affb99fd2b7973146a92626144026baf50990136.tar.gz zcatch-affb99fd2b7973146a92626144026baf50990136.zip | |
added animation speed controllers to the editor
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/editor/ed_editor.cpp | 26 | ||||
| -rw-r--r-- | src/game/editor/ed_editor.hpp | 2 | ||||
| -rw-r--r-- | src/game/editor/ed_layer_quads.cpp | 1 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index cd6d99a4..19727490 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -613,7 +613,7 @@ static void do_toolbar(RECT toolbar) if(inp_key_down('s') && (inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL))) editor.invoke_file_dialog(LISTDIRTYPE_SAVE, "Save Map", "Save", "maps/", "", callback_save_map); - // animate button + // detail button ui_vsplit_l(&toolbar, 30.0f, &button, &toolbar); static int hq_button = 0; if(do_editor_button(&hq_button, "Detail", editor.show_detail, &button, draw_editor_button, 0, "[ctrl+h] Toggle High Detail") || @@ -624,6 +624,7 @@ static void do_toolbar(RECT toolbar) ui_vsplit_l(&toolbar, 5.0f, 0, &toolbar); + // animation button ui_vsplit_l(&toolbar, 30.0f, &button, &toolbar); static int animate_button = 0; if(do_editor_button(&animate_button, "Anim", editor.animate, &button, draw_editor_button, 0, "[ctrl+m] Toggle animation") || @@ -665,7 +666,28 @@ static void do_toolbar(RECT toolbar) static int zoom_in_button = 0; if(do_editor_button(&zoom_in_button, "ZI", 0, &button, draw_editor_button_r, 0, "[NumPad+] Zoom in") || inp_key_down(KEY_KP_PLUS)) editor.zoom_level -= 50; - + + ui_vsplit_l(&toolbar, 15.0f, 0, &toolbar); + + // animation speed + ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); + static int anim_faster_button = 0; + if(do_editor_button(&anim_faster_button, "A+", 0, &button, draw_editor_button_l, 0, "Increase animation speed")) + editor.animate_speed += 0.5f; + + ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); + static int anim_normal_button = 0; + if(do_editor_button(&anim_normal_button, "1", 0, &button, draw_editor_button_m, 0, "Normal animation speed")) + editor.animate_speed = 1.0f; + + ui_vsplit_l(&toolbar, 16.0f, &button, &toolbar); + static int anim_slower_button = 0; + if(do_editor_button(&anim_slower_button, "A-", 0, &button, draw_editor_button_r, 0, "Decrease animation speed")) + { + if(editor.animate_speed > 0.5f) + editor.animate_speed -= 0.5f; + } + if(inp_key_presses(KEY_MOUSE_WHEEL_UP) && editor.dialog == DIALOG_NONE) editor.zoom_level -= 20; diff --git a/src/game/editor/ed_editor.hpp b/src/game/editor/ed_editor.hpp index 4f48406e..313a381f 100644 --- a/src/game/editor/ed_editor.hpp +++ b/src/game/editor/ed_editor.hpp @@ -363,6 +363,7 @@ public: animate = false; animate_start = 0; animate_time = 0; + animate_speed = 1; show_envelope_editor = 0; } @@ -407,6 +408,7 @@ public: bool animate; int64 animate_start; float animate_time; + float animate_speed; int show_envelope_editor; diff --git a/src/game/editor/ed_layer_quads.cpp b/src/game/editor/ed_layer_quads.cpp index bfdacbfd..bbe5fb6d 100644 --- a/src/game/editor/ed_layer_quads.cpp +++ b/src/game/editor/ed_layer_quads.cpp @@ -28,6 +28,7 @@ static void envelope_eval(float time_offset, int env, float *channels) ENVELOPE *e = editor.map.envelopes[env]; float t = editor.animate_time+time_offset; + t *= editor.animate_speed; e->eval(t, channels); } |