#include "GameMode.h"

#include "Datas/PointerDatas.h"

auto GameMode::startDestroyBlock(glm::ivec3 pos, unsigned char a2, bool& a3) -> bool {
	return (reinterpret_cast<bool(__thiscall*)(void*, glm::ivec3, unsigned char, bool&)>((*reinterpret_cast<void***>(this))[1]))(this, pos, a2, a3);
}

auto GameMode::destroyBlock(glm::ivec3 pos, unsigned char a2) -> bool {
	return (reinterpret_cast<bool(__thiscall*)(void*, glm::ivec3, unsigned char)>((*reinterpret_cast<void***>(this))[2]))(this, pos, a2);
}

auto GameMode::stopDestroyBlock(glm::ivec3 pos, unsigned char a2) -> void {
	(reinterpret_cast<void(__thiscall*)(void*, glm::ivec3, unsigned char)>((*reinterpret_cast<void***>(this))[4]))(this, pos, a2);
}

auto GameMode::buildBlock(glm::ivec3 pos, unsigned char a2, bool a3) -> bool {
	return (reinterpret_cast<bool(__thiscall*)(void*, glm::ivec3, unsigned char, bool)>((*reinterpret_cast<void***>(this))[6]))(this, pos, a2, a3);
}

auto GameMode::attack(Actor& actor) -> bool {
	return (reinterpret_cast<bool(__thiscall*)(void*, Actor&)>((*reinterpret_cast<void***>(this))[14]))(this, actor);
}

auto GameMode::releaseUsingItem() -> void {
	return (reinterpret_cast<void(__thiscall*)(void*)>((*reinterpret_cast<void***>(this))[15]))(this);
}

auto GameMode::getDestroyProgress() -> float {
	return *reinterpret_cast<float*>((uintptr_t)this + 0x20);
}

auto GameMode::baseuseitem(ItemStack& stack) -> void {
	static auto func = (void(*)(GameMode*, ItemStack&))Datas::Pointer::gamemode_baseuseitem;
	return func(this, stack);
}

auto GameMode::getDestroyRate(Block& block) -> float {
	static auto func = reinterpret_cast<float(__fastcall*)(GameMode*, Block&)>(Datas::Pointer::gamemode_getdestroyrate);
	return func(this, block);
}
