X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=067f630aa2be16bc287964e6039def923020b006;hb=b3be19debfe6a782dced04fe3ee4406b7d8a2135;hp=89b9d3d48c515478dc2894924fd96ef9de463004;hpb=a21695563e089926d8e859e1ee0f3b077c8a7ed0;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 89b9d3d4..067f630a 100644 --- a/src/screens.c +++ b/src/screens.c @@ -8251,7 +8251,9 @@ static void HandleScreenGadgets(struct GadgetInfo *gi) { int id = gi->custom_id; int button = gi->event.button; - int step = (button == 1 ? 1 : button == 2 ? 5 : 10); + int step = (button == MB_LEFTBUTTON ? 1 : + button == MB_MIDDLEBUTTON ? 5 : + button == MB_RIGHTBUTTON ? 10 : 1); switch (id) { @@ -8308,3 +8310,50 @@ static void HandleScreenGadgets(struct GadgetInfo *gi) break; } } + +void DumpScreenIdentifiers() +{ + int i; + + Print("Active screen elements on current screen:\n"); + + for (i = 0; main_controls[i].nr != -1; i++) + { + struct MainControlInfo *mci = &main_controls[i]; + + if (mci->button_graphic != -1) + { + char *token = getTokenFromImageID(mci->button_graphic); + + Print("- '%s'\n", token); + } + } + + Print("Done.\n"); +} + +boolean DoScreenAction(int image_id) +{ + int i; + + if (game_status != GAME_MODE_MAIN) + return FALSE; + + for (i = 0; main_controls[i].nr != -1; i++) + { + struct MainControlInfo *mci = &main_controls[i]; + struct MenuPosInfo *pos = mci->pos_button; + + if (mci->button_graphic == image_id) + { + int x = mSX + pos->x; + int y = mSY + pos->y; + + HandleMainMenu(x, y, 0, 0, MB_MENU_CHOICE); + + return TRUE; + } + } + + return FALSE; +}