#pragma once
// ── CS2 External C++ WebRadar — Player (local player) ───────────────────────
// Matches C# Player.cs: extends EntityBase with local-specific fields:
// view angles, aim punch, yaw, aim direction.
// Also determines the local player's pawn entry index for bomb carrier tracking.

#include "game/entity_base.h"
#include <windows.h>

class Player : public EntityBase {
public:
    Player() = default;

    // ── Public state ──────────────────────────────────────────────────────
    Vec3 view_angles() const { return m_view_angles; }
    Vec3 aim_punch() const { return m_aim_punch; }
    float yaw() const { return m_yaw; }
    int pawn_entry_idx() const { return m_pawn_entry_idx; }

    // ── Update ────────────────────────────────────────────────────────────
    // Reads local player from dwLocalPlayerController and dwLocalPlayerPawn.
    // client_base = base address of client.dll module.
    bool update(HANDLE proc, std::uintptr_t client_base);

    // ── Base overrides ────────────────────────────────────────────────────
    std::uintptr_t read_controller_base(HANDLE proc) override;
    std::uintptr_t read_address_base(HANDLE proc) override;

private:
    Vec3 m_view_angles{};
    Vec3 m_aim_punch{};
    float m_yaw = 0;
    int m_pawn_entry_idx = -1;
    std::uintptr_t m_client_base = 0;

    void read_view_angles(HANDLE proc);
};
