#pragma once

// -----------------------------------------------------------------------------
// noflash.h
// -----------------------------------------------------------------------------
// NoFlashFeature: suppresses flashbang blindness. While enabled, the local
// player's m_flFlashMaxAlpha is kept at 0; when disabled it is restored to
// 255 (full flash effect). Runs on its own thread.
// -----------------------------------------------------------------------------

#include "../core/memory.h"
#include "../core/offsets.h"
#include "../sdk/localplayer.h"

namespace features {

// Flash suppression running on its own thread.
class NoFlash
{
public:
	// Binds the memory reader, offsets and local player.
	void Initialize(const core::ProcessMemory* memory, const core::GameOffsets* offsets,
		const sdk::LocalPlayer* player);

	// Starts the no-flash thread.
	void Start();

	// Thread entry point.
	static unsigned long __stdcall ThreadProc(void* param);

private:
	const core::ProcessMemory* m_memory = nullptr;
	const core::GameOffsets* m_offsets = nullptr;
	const sdk::LocalPlayer* m_player = nullptr;

	// Previous toggle state; used to restore the flash alpha exactly once
	// when the feature is switched off.
	bool m_lastEnabled = false;
};

} // namespace features