X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fscreens.c;h=a5bc5ac1b7009f31f46d5831681f9705d7eb8d2e;hp=b13890a1c380161681c9c8f1a387035a83cfd94f;hb=f6d6f94c5738467ae3f3ba639f01244581d8ea1f;hpb=e02c111162d5d8a13715de71d93494120380ec9b diff --git a/src/screens.c b/src/screens.c index b13890a1..a5bc5ac1 100644 --- a/src/screens.c +++ b/src/screens.c @@ -6522,7 +6522,6 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) static boolean bitmaps_initialized = FALSE; boolean screen_initialized = FALSE; static Bitmap *controller, *button, *axis_x, *axis_y; - Bitmap *marker; char *name; boolean success = TRUE; boolean done = FALSE, next = FALSE; @@ -6602,6 +6601,8 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) /* loop through all steps (buttons and axes), getting joystick events */ for (i = 0; i < SDL_arraysize(steps) && !done;) { + Bitmap *marker = button; /* initialize with reliable default value */ + step = &steps[i]; strcpy(step->mapping, mapping); step->axis = -1; @@ -6777,14 +6778,19 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) if (event.key.keysym.sym == KSYM_BackSpace || event.key.keysym.sym == KSYM_Back) { - /* undo this step */ - if (i > 0) + if (i == 0) { - prev_step = &steps[--i]; - strcpy(mapping, prev_step->mapping); - next = TRUE; + /* leave screen */ + success = FALSE; + done = TRUE; } + /* undo this step */ + prev_step = &steps[i - 1]; + strcpy(mapping, prev_step->mapping); + i--; + next = TRUE; + break; } @@ -6801,6 +6807,7 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) if (event.key.keysym.sym == KSYM_Escape) { + /* leave screen */ success = FALSE; done = TRUE; }