We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 667ad64 commit 13cb82aCopy full SHA for 13cb82a
cheat.cc
@@ -742,6 +742,46 @@ void Cheat::move_selected(int dx, int dy, int dz) {
742
}
743
744
745
+/*
746
+ * Cycle the frame of the selected objects.
747
+ */
748
+void Cheat::cycle_selected_frame(int direction) {
749
+ if (selected.empty()) {
750
+ return;
751
+ }
752
+ for (auto& it : selected) {
753
+ Game_object* obj = it.get();
754
+ int maxFrames = obj->get_num_frames();
755
+ int currentFrame = obj->get_framenum();
756
+ int newFrame = currentFrame + direction;
757
+
758
+ if (newFrame >= maxFrames) {
759
+ newFrame = 0;
760
+ } else if (newFrame < 0) {
761
+ newFrame = maxFrames - 1;
762
763
764
+ obj->change_frame(newFrame);
765
+ gwin->add_dirty(obj);
766
767
+ gwin->set_all_dirty();
768
+}
769
770
771
+ * Rotate the frame of the selected objects.
772
773
+void Cheat::rotate_selected_frame() {
774
775
776
777
778
779
+ obj->change_frame(obj->get_rotated_frame(1));
780
781
782
783
784
785
bool Cheat::is_selected(Game_object* o) {
786
for (auto& it : selected) {
787
if (o == it.get()) {
cheat.h
@@ -205,6 +205,8 @@ class Cheat : public Game_singletons {
205
void delete_selected();
206
void move_selected_objs(int dx, int dy, int dz);
207
void move_selected(int dx, int dy, int dz);
208
+ void cycle_selected_frame(int direction);
209
+ void rotate_selected_frame();
210
211
const std::vector<Game_object_shared>& get_selected() const {
212
return selected;
data/bg/defaultkeys.txt
@@ -50,6 +50,9 @@ Ctrl-pagedown move_selected 0 0 -1
50
Ctrl-C copy
51
Ctrl-x cut
52
Ctrl-v paste
53
+Ctrl-KP+ cycle_frames_next 1
54
+Ctrl-KP- cycle_frames_prev -1
55
+CTRL-KP* rotate_frames
56
57
F2 cheat_screen
58
F3 map_teleport
data/si/defaultkeys.txt
keyactions.cc
@@ -692,6 +692,15 @@ void ActionMoveSelected(const int* params) {
692
cheat.move_selected(params[0], params[1], params[2]);
693
694
695
+void ActionCycleFrames(const int* params) {
696
+ cheat.cycle_selected_frame(params[0]);
697
698
699
+void ActionRotateFrames(const int* params) {
700
+ ignore_unused_variable_warning(params);
701
+ cheat.rotate_selected_frame();
702
703
704
// { ActionToggleEggs, 0, "Toggle egg display", cheat_keys, NONE },
705
void ActionToggleEggs(const int* params) {
706
ignore_unused_variable_warning(params);
keyactions.h
@@ -75,6 +75,8 @@ void ActionCreateShape(const int* params);
75
void ActionDeleteObject(const int* params);
76
void ActionDeleteSelected(const int* params);
77
void ActionMoveSelected(const int* params);
78
+void ActionCycleFrames(const int* params);
79
+void ActionRotateFrames(const int* params);
80
void ActionToggleEggs(const int* params);
81
void ActionGodMode(const int* params);
82
void ActionGender(const int* params);
keys.cc
@@ -263,6 +263,12 @@ const struct Action {
263
Action::mapedit_keys, NONE, true, true, true, false},
264
{ "MOVE_SELECTED", ActionMoveSelected, nullptr, "Move selected",
265
266
+ { "CYCLE_FRAMES_NEXT", ActionCycleFrames, nullptr, "Cycle frames next",
267
+ Action::mapedit_keys, NONE, true, true, true, false},
268
+ { "CYCLE_FRAMES_PREV", ActionCycleFrames, nullptr, "Cycle frames previus",
269
270
+ { "ROTATE_FRAMES", ActionRotateFrames, nullptr, "Rotate frames",
271
272
{ "WRITE_MINIMAP", ActionWriteMiniMap, nullptr, "Write minimap",
273
Action::mapedit_keys, NONE, false, true, true, false},
274
{ "REPAINT", ActionRepaint, nullptr, "Repaint screen", Action::dont_show,
0 commit comments