Skip to content

Commit

Permalink
Merge pull request #92 from Peter0x44/betties_controller_glyph
Browse files Browse the repository at this point in the history
CLIENT: Draw controller glyphs properly for bouncing betties prompt
  • Loading branch information
MotoLegacy authored Nov 30, 2024
2 parents a9cc266 + 10f32b4 commit 4f94067
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions source/client/hud.qc
Original file line number Diff line number Diff line change
Expand Up @@ -1198,17 +1198,27 @@ void(float width, float height) HUD_Weaponstring =
void(float width, float height) HUD_BouncingBetty =
{
float top_x, bot_x, but_x;
string betty_key;
string betty_key = "";
string betty_space = "";
string activate_string, activate_string2;

tokenize(findkeysforcommandex("impulse 33"));
betty_key = strtoupper(argv(0));
float argc = tokenize(findkeysforcommandex("impulse 33"));

for (int i = 0; i < argc; ++i)
{
betty_key = strtoupper(argv(i));
float bind_is_gamepad = Key_IsControllerGlyph(betty_key);

if (bind_is_gamepad && last_input_was_gamepad)
break;
else if (!bind_is_gamepad && !last_input_was_gamepad)
break;
}

// If this is a gamepad button, the space we want to reserve
// in the betty string should be a fixed width.
if (Key_IsControllerGlyph(betty_key)) {
betty_space = " ";
betty_space = " ";
}
// Scale the space in the betty string for the bind according to
// the bind's name.
Expand All @@ -1231,7 +1241,7 @@ void(float width, float height) HUD_BouncingBetty =
but_x = top_x + getTextWidth("Press ", 12);

if (Key_IsControllerGlyph(betty_key))
Key_DrawControllerGlyph([but_x - 5, g_height - 308], betty_key, [22, 22]);
Key_DrawControllerGlyph([but_x - 5, g_height - 308], betty_key, [18, 18]);
else
Draw_String([but_x, g_height - 303], betty_key, [12, 12], [1, 1, 0], 1, 0);
}
Expand Down Expand Up @@ -1948,4 +1958,4 @@ void(float width, float height) HUD_Draw =

if (screenflash_duration > time)
HUD_Screenflash();
}
}

0 comments on commit 4f94067

Please sign in to comment.