From: Holger Schemel Date: Fri, 8 Jun 2018 21:35:07 +0000 (+0200) Subject: added key shortcut to dump identifiers for all gadgets on current screen X-Git-Tag: 4.1.1.0~142 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d0a7080670f9a2fa96138cf1c06708016a42d615;p=rocksndiamonds.git added key shortcut to dump identifiers for all gadgets on current screen --- diff --git a/src/events.c b/src/events.c index 000744c9..22cfdcd1 100644 --- a/src/events.c +++ b/src/events.c @@ -1760,6 +1760,14 @@ static void HandleKeysSpecial(Key key) DumpBrush_Small(); } } + + /* special key shortcuts for all game modes */ + if (is_string_suffix(cheat_input, ":dump-gadget-ids") || + is_string_suffix(cheat_input, ":dgi") || + is_string_suffix(cheat_input, ":DGI")) + { + DumpGadgetIdentifiers(); + } } void HandleKeysDebug(Key key) diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index cba655f8..c793ce13 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -13,6 +13,7 @@ #include #include "gadgets.h" +#include "image.h" #include "text.h" #include "misc.h" @@ -2272,3 +2273,16 @@ boolean HandleGadgetsKeyInput(Key key) return TRUE; } + +void DumpGadgetIdentifiers() +{ + struct GadgetInfo *gi; + + printf("Gadgets on current screen (any prefix 'gfx.' can be omitted):\n"); + + for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next) + if (gi->mapped && gi->image_id != -1) + printf("- '%s'\n", getTokenFromImageID(gi->image_id)); + + printf("Done.\n"); +} diff --git a/src/libgame/gadgets.h b/src/libgame/gadgets.h index 0fec5b68..5e196192 100644 --- a/src/libgame/gadgets.h +++ b/src/libgame/gadgets.h @@ -291,4 +291,6 @@ void ClickOnGadget(struct GadgetInfo *, int); boolean HandleGadgets(int, int, int); boolean HandleGadgetsKeyInput(Key); +void DumpGadgetIdentifiers(void); + #endif /* GADGETS_H */