X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=ce99012e898e22f73df30f4ced385cf35b490d33;hb=fab52dc04709ef9eb5110d860f02f5ccf7719c2c;hp=0a63c2e40cb9575d5c65eecd94b3d75092cc2d06;hpb=3d1fd980cdc61187c7f163f69adff7ad814f83a9;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 0a63c2e4..ce99012e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -23,6 +23,10 @@ #include "init.h" #include "config.h" + +#define DEBUG_JOYSTICKS 0 + + /* screens on the info screen */ #define INFO_MODE_MAIN 0 #define INFO_MODE_TITLE 1 @@ -6522,7 +6526,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; @@ -6581,19 +6584,19 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) axis_x = LoadCustomImage("joystick/axis_x.png"); axis_y = LoadCustomImage("joystick/axis_y.png"); - marker = button; /* initialize with reliable default value */ - bitmaps_initialized = TRUE; } name = getFormattedJoystickName(SDL_JoystickName(joystick)); +#if DEBUG_JOYSTICKS /* print info about the joystick we are watching */ Error(ERR_DEBUG, "watching joystick %d: (%s)\n", SDL_JoystickInstanceID(joystick), name); Error(ERR_DEBUG, "joystick has %d axes, %d hats, %d balls, and %d buttons\n", SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick), SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick)); +#endif /* initialize mapping with GUID and name */ SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), temp, sizeof(temp)); @@ -6604,6 +6607,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; @@ -6832,7 +6837,9 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) if (success) { +#if DEBUG_JOYSTICKS Error(ERR_DEBUG, "New game controller mapping:\n\n%s\n\n", mapping); +#endif // activate mapping for this game SDL_GameControllerAddMapping(mapping);