Подведи собственные итоги года совместно с YOUGAME и забери ценные призы! Перейти

Вопрос Damage marker рисует только один маркер

  • Автор темы Автор темы Pexi1337
  • Дата начала Дата начала
who are you dot idk
Пользователь
Пользователь
Статус
Оффлайн
Регистрация
24 Ноя 2019
Сообщения
390
Реакции
119
Хз вообще че за хуйня. На одном челе рисует только 1 маркер

damage marker :
C++:
Expand Collapse Copy
void otheresp::damage_marker_paint()
{
    for (auto i = 0; i < m_globals()->m_maxclients; i++) //-V807
    {
        if (damage_marker[i].hurt_time + 1.0f > m_globals()->m_curtime)
        {
            Vector screen;

            if (!math::world_to_screen(damage_marker[i].position, screen))
                continue;
            auto alpha = (int)((damage_marker[i].hurt_time + 2.0f - m_globals()->m_curtime) * 127.5);
            damage_marker[i].hurt_color.SetAlpha(alpha);

            render::get().text(fonts[DAMAGE_MARKER], screen.x, screen.y -= 0.5 * (127.5 - alpha), damage_marker[i].hurt_color, HFONT_CENTERED_X | HFONT_CENTERED_Y, "- %i", damage_marker[i].damage);
        }
    }
}

Damage_marker struct
C++:
Expand Collapse Copy
    struct Damage_marker
    {
        Vector position = ZERO;
        float hurt_time = FLT_MIN;
        Color hurt_color = Color::White;
        int damage = -1;
        int hitgroup = -1;

        void reset()
        {
            hurt_time = FLT_MIN;
            hurt_color = Color::White;
            damage = -1;
            hitgroup = -1;
        }
    } damage_marker[65];

хукнут в painttraverse

Видео :
Пожалуйста, авторизуйтесь для просмотра ссылки.
(noad)
 
Хз вообще че за хуйня. На одном челе рисует только 1 маркер

damage marker :
C++:
Expand Collapse Copy
void otheresp::damage_marker_paint()
{
    for (auto i = 0; i < m_globals()->m_maxclients; i++) //-V807
    {
        if (damage_marker[i].hurt_time + 1.0f > m_globals()->m_curtime)
        {
            Vector screen;

            if (!math::world_to_screen(damage_marker[i].position, screen))
                continue;
            auto alpha = (int)((damage_marker[i].hurt_time + 2.0f - m_globals()->m_curtime) * 127.5);
            damage_marker[i].hurt_color.SetAlpha(alpha);

            render::get().text(fonts[DAMAGE_MARKER], screen.x, screen.y -= 0.5 * (127.5 - alpha), damage_marker[i].hurt_color, HFONT_CENTERED_X | HFONT_CENTERED_Y, "- %i", damage_marker[i].damage);
        }
    }
}

Damage_marker struct
C++:
Expand Collapse Copy
    struct Damage_marker
    {
        Vector position = ZERO;
        float hurt_time = FLT_MIN;
        Color hurt_color = Color::White;
        int damage = -1;
        int hitgroup = -1;

        void reset()
        {
            hurt_time = FLT_MIN;
            hurt_color = Color::White;
            damage = -1;
            hitgroup = -1;
        }
    } damage_marker[65];

хукнут в painttraverse

Видео :
Пожалуйста, авторизуйтесь для просмотра ссылки.
(noad)
Дай хит маркер ) пожалуйста
 
C++:
Expand Collapse Copy
void Hitmarker::DamageMarker(hitmarker_t& hit, const Vector& screen_pos, Color col)
{
    if (!vars.esp.damage_marker)
        return;
    static auto line_size = 6;

    const auto step = 255.f / 1.0f * m_globals()->m_frametime;
    const auto step_move = 30.f / 1.5f * m_globals()->m_frametime;
    const auto multiplicator = 0.3f;

    hit.moved -= step_move / 10;

    if (hit.time + 2.0f <= m_globals()->m_curtime)
        hit.alpha -= step;

    const auto int_alpha = static_cast<int>(hit.alpha);

    if (int_alpha > 0)
    {
        //auto col = Color(255, 255, 255, int_alpha);
        std::stringstream dmg;
        dmg << "-" << std::to_string(hit.damage);
        //col = Color(255, 0, 0, int_alpha);
        auto s = render::get().text_width(fonts[DAMAGE_MARKER], dmg.str().c_str());
        render::get().text(fonts[DAMAGE_MARKER], screen_pos.x - s / 2, screen_pos.y - 12 + hit.moved, Color(col.r(), col.g(), col.b(), int_alpha), false, dmg.str().c_str());
    }
}
 
C++:
Expand Collapse Copy
void Hitmarker::DamageMarker(hitmarker_t& hit, const Vector& screen_pos, Color col)
{
    if (!vars.esp.damage_marker)
        return;
    static auto line_size = 6;

    const auto step = 255.f / 1.0f * m_globals()->m_frametime;
    const auto step_move = 30.f / 1.5f * m_globals()->m_frametime;
    const auto multiplicator = 0.3f;

    hit.moved -= step_move / 10;

    if (hit.time + 2.0f <= m_globals()->m_curtime)
        hit.alpha -= step;

    const auto int_alpha = static_cast<int>(hit.alpha);

    if (int_alpha > 0)
    {
        //auto col = Color(255, 255, 255, int_alpha);
        std::stringstream dmg;
        dmg << "-" << std::to_string(hit.damage);
        //col = Color(255, 0, 0, int_alpha);
        auto s = render::get().text_width(fonts[DAMAGE_MARKER], dmg.str().c_str());
        render::get().text(fonts[DAMAGE_MARKER], screen_pos.x - s / 2, screen_pos.y - 12 + hit.moved, Color(col.r(), col.g(), col.b(), int_alpha), false, dmg.str().c_str());
    }
}
бл походу кое кому предстоит перечитать c++ хд
 
C++:
Expand Collapse Copy
void Hitmarker::DamageMarker(hitmarker_t& hit, const Vector& screen_pos, Color col)
{
    if (!vars.esp.damage_marker)
        return;
    static auto line_size = 6;

    const auto step = 255.f / 1.0f * m_globals()->m_frametime;
    const auto step_move = 30.f / 1.5f * m_globals()->m_frametime;
    const auto multiplicator = 0.3f;

    hit.moved -= step_move / 10;

    if (hit.time + 2.0f <= m_globals()->m_curtime)
        hit.alpha -= step;

    const auto int_alpha = static_cast<int>(hit.alpha);

    if (int_alpha > 0)
    {
        //auto col = Color(255, 255, 255, int_alpha);
        std::stringstream dmg;
        dmg << "-" << std::to_string(hit.damage);
        //col = Color(255, 0, 0, int_alpha);
        auto s = render::get().text_width(fonts[DAMAGE_MARKER], dmg.str().c_str());
        render::get().text(fonts[DAMAGE_MARKER], screen_pos.x - s / 2, screen_pos.y - 12 + hit.moved, Color(col.r(), col.g(), col.b(), int_alpha), false, dmg.str().c_str());
    }
}
дай пж для hitmarker_t - moved
 
дай пж для hitmarker_t - moved
C++:
Expand Collapse Copy
struct hitmarker_t
{
    hitmarker_t( const float& time, const int& index, const int& damage, const int& hitgroup, const Vector& pos )
    {
        this->time = time;
        this->index = index;
        this->damage = damage;
        this->hitgroup = hitgroup;
        this->pos = pos;
        moved = 0.f;
        alpha = 255.f;
    }
    float time;
    int index;
    int damage;
    int hitgroup;
    float moved;
    float alpha;
    Color col;
    Vector pos;
};
 
У тебя на каждую сущность создан свой маркер, но всего один, т.е. макс колво игроков (64) + 1.
Поэтому код переписывает единственный маркер для игрока.
Вероятно это было сделано для быстрого поиска сущность -> маркер, можно поправить и храня список маркеров дамага, будет даже быстрее.
 
C++:
Expand Collapse Copy
struct hitmarker_t
{
    hitmarker_t( const float& time, const int& index, const int& damage, const int& hitgroup, const Vector& pos )
    {
        this->time = time;
        this->index = index;
        this->damage = damage;
        this->hitgroup = hitgroup;
        this->pos = pos;
        moved = 0.f;
        alpha = 255.f;
    }
    float time;
    int index;
    int damage;
    int hitgroup;
    float moved;
    float alpha;
    Color col;
    Vector pos;
};
я конечно не это имел ввиду, но спс. А так я про это хотел узнать
(не ошибки имею ввиду)
1618845573510.png
 
Назад
Сверху Снизу