<commit_before>
#include "visuals/defaulthud.h"
#include "renderer.h"
#include "colorpalette.h"

void DefaultHud::render(Renderer &renderer, Gamestate &state, Player &myself)
{
    HUD_Y_BASELINE = renderer.WINDOW_HEIGHT * 9.0/10.0;

    // TODO: Draw gamemode hud

    renderkillfeed(renderer, state, myself);

    if (state.exists(myself.character))
    {
        Character &character = myself.getcharacter(state);
        if (myself.heroclass == MCCREE)
        {
            mccreehud(renderer, state, static_cast<Mccree&>(character));
        }
        else if (myself.heroclass == REINHARDT)
        {
            reinhardthud(renderer, state, static_cast<Reinhardt&>(character));
        }
        else if (myself.heroclass == LUCIO)
        {
            luciohud(renderer, state, static_cast<Lucio&>(character));
        }

        renderhealthbar(renderer, state, character);

        // Ult button
        double total_width = 100 * renderer.zoom;
        double mid_x = renderer.WINDOW_WIDTH / 2.0;
        double mid_y = HUD_Y_BASELINE;
        double alpha = 0.6;

        if (myself.ultcharge.active)
        {
            // Inner orange circle
            al_draw_circle(mid_x, mid_y, total_width / 4.0, al_map_rgb(239, 179, 89), total_width / 30.0);
            // Thick gray mid circle
            al_draw_circle(mid_x, mid_y, total_width / 3.0,
                           al_map_rgba(255 * alpha, 255 * alpha, 255 * alpha,255 * alpha), total_width / 14.0);
            // Outer gray circle
            al_draw_circle(mid_x, mid_y, total_width / 2.0,
                           al_map_rgba(255 * alpha, 255 * alpha, 255 * alpha, 255 * alpha), total_width / 30.0);
            // Charging arc
            al_draw_arc(mid_x, mid_y, total_width / 3.0, -PI/2.0, 2*PI * myself.ultcharge.timer/100.0,
                        al_map_rgb(255, 230, 125), total_width / 14.0);
        }
        else
        {
            // Ult symbol
            std::string mainsprite = "ui/ingame/"+character.herofolder()+"ultready";
            ALLEGRO_BITMAP *sprite = renderer.spriteloader.requestsprite(mainsprite);
            double spriteoffset_x = renderer.spriteloader.get_spriteoffset_x(mainsprite)*renderer.zoom;
            double spriteoffset_y = renderer.spriteloader.get_spriteoffset_y(mainsprite)*renderer.zoom;
            al_draw_bitmap(sprite, mid_x - spriteoffset_x, mid_y - spriteoffset_y, 0);
            // Inner gray circle
            al_draw_circle(mid_x, mid_y, total_width / 4.0,
                           al_map_rgba(255 * alpha, 255 * alpha, 255 * alpha, 255 * alpha), total_width / 25.0);
            // Neon blue mid circle
            al_draw_circle(mid_x, mid_y, total_width / 3.0, al_map_rgb(110, 253, 251), total_width / 30.0);
            // Outer gray circle
            al_draw_circle(mid_x, mid_y, total_width / 2.0,
                           al_map_rgba(255 * alpha, 255 * alpha, 255 * alpha, 255 * alpha), total_width / 30.0);
        }
    }
}
<commit_msg>Replaced some magic numbers with ColorPalette.<commit_after>
#include "visuals/defaulthud.h"
#include "renderer.h"
#include "colorpalette.h"

void DefaultHud::render(Renderer &renderer, Gamestate &state, Player &myself)
{
    HUD_Y_BASELINE = renderer.WINDOW_HEIGHT * 9.0/10.0;

    // TODO: Draw gamemode hud

    renderkillfeed(renderer, state, myself);

    if (state.exists(myself.character))
    {
        Character &character = myself.getcharacter(state);
        if (myself.heroclass == MCCREE)
        {
            mccreehud(renderer, state, static_cast<Mccree&>(character));
        }
        else if (myself.heroclass == REINHARDT)
        {
            reinhardthud(renderer, state, static_cast<Reinhardt&>(character));
        }
        else if (myself.heroclass == LUCIO)
        {
            luciohud(renderer, state, static_cast<Lucio&>(character));
        }

        renderhealthbar(renderer, state, character);

        // Ult button
        double total_width = 100 * renderer.zoom;
        double mid_x = renderer.WINDOW_WIDTH / 2.0;
        double mid_y = HUD_Y_BASELINE;
        double alpha = 0.6;

        if (myself.ultcharge.active)
        {
            // Inner orange circle
            al_draw_circle(mid_x, mid_y, total_width / 4.0, al_map_rgb(239, 179, 89), total_width / 30.0);
            // Thick gray mid circle
            al_draw_circle(mid_x, mid_y, total_width / 3.0, ColorPalette::premul(Color::WHITE, 255*alpha),
                           total_width / 14.0);
            // Outer gray circle
            al_draw_circle(mid_x, mid_y, total_width / 2.0, ColorPalette::premul(Color::WHITE, 255*alpha),
                           total_width / 30.0);
            // Charging arc
            al_draw_arc(mid_x, mid_y, total_width / 3.0, -PI/2.0, 2*PI * myself.ultcharge.timer/100.0,
                        al_map_rgb(255, 230, 125), total_width / 14.0);
        }
        else
        {
            // Ult symbol
            std::string mainsprite = "ui/ingame/"+character.herofolder()+"ultready";
            ALLEGRO_BITMAP *sprite = renderer.spriteloader.requestsprite(mainsprite);
            double spriteoffset_x = renderer.spriteloader.get_spriteoffset_x(mainsprite)*renderer.zoom;
            double spriteoffset_y = renderer.spriteloader.get_spriteoffset_y(mainsprite)*renderer.zoom;
            al_draw_bitmap(sprite, mid_x - spriteoffset_x, mid_y - spriteoffset_y, 0);
            // Inner gray circle
            al_draw_circle(mid_x, mid_y, total_width / 4.0, ColorPalette::premul(Color::WHITE, alpha*255),
                           total_width / 25.0);
            // Neon blue mid circle
            al_draw_circle(mid_x, mid_y, total_width / 3.0, al_map_rgb(110, 253, 251), total_width / 30.0);
            // Outer gray circle
            al_draw_circle(mid_x, mid_y, total_width / 2.0, ColorPalette::premul(Color::WHITE, alpha*255),
                           total_width / 30.0);
        }
    }
}

{'fraction_non_alphanumeric': 0.11165211551376764, 'fraction_numerical': 0.03727333781061115, 'mean_word_length': 2.105839416058394, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2943994', 'n_tokens_mistral': 2127, 'n_tokens_neox': 1954, 'n_words': 378}