#include "Options.h"
#include "Client.h"

auto Hooks::Options::callback_getviewperspective(uintptr_t* a1) -> int {
	int perspective = option_getviewperspective(a1);
	
	for (Mod* mod : Client::modlist) {
		if (!mod->enabled && mod->onlyenabled) continue;

		mod->onViewPerspectiveBefore(&perspective);
	}

	for (Mod* mod : Client::modlist) {
		if (!mod->enabled && mod->onlyenabled) continue;

		mod->onViewPerspectiveAfter(&perspective);
	}

	return perspective;
}

auto Hooks::Options::callback_getgamma(void* a2, void* a3) -> float {
	float gamma = option_getgamma(a2, a3);
	for (Mod* mod : Client::modlist) {
		if (!mod->enabled && mod->onlyenabled) continue;

		mod->onGetGamma(&gamma);
	}
	
	return gamma;
}


auto Hooks::Options::callback_getfov(void* a1, float a2, void* a3, void* a4) -> float {
	float fov = option_getfov(a1, a2, a3, a4);

	for (Mod* mod : Client::modlist) {
		if (!mod->enabled && mod->onlyenabled) continue;

		mod->onGetFov(&fov);
	}

	return fov;
}