#include "GlobalExtern.h"

void DrawCheatMenu() {
	int y = MenuPosY;
	DWORD color;
	int start = 0;
	if(CheatSelected > 7 && (FbaCheats.size() > 15)) {
		start += (CheatSelected  - 7);
	}
	if((CheatSelected > ((FbaCheats.size()-1) - 7)) && (FbaCheats.size() > 15)) {
		start = (FbaCheats.size() - 15);
	}
	for(int i = start; i <  start +15; i++) {
		if(i == FbaCheats.size()) return;
		if(FbaCheats[i].enabled) color = 0x00ff00; else color = 0xffffff; 
		if(i ==CheatSelected) color = 0xffff00; 
		WCHAR msg[1024]={0};
		std::string t = FbaCheats[i].name;
		for(int r = 0; r < 1024; r++) {
			if((t.c_str())[r] == '\0') {
				msg[r] = '\0';
				break;
			}
			msg[r] = (t.c_str())[r];
		}
		FontSetColour(color);
		FontCenteredText(msg,MenuPosX, y, 600);
		y+=vSpace;
	}
}

void DrawArcadeSettingsMenu() {
	int y = MenuPosY;
	DWORD color;
	int start = 0;
	if(ArcadeSettingSelected > 7 && (arcadeSettings.size() > 15)) {
		start += (ArcadeSettingSelected  - 7);
	}
	if((ArcadeSettingSelected > ((arcadeSettings.size()-1) - 7)) && (arcadeSettings.size() > 15)) {
		start = (arcadeSettings.size() - 15);
	}
	for(int i = start; i <  start + 15; i++) {
		if(i == arcadeSettings.size()) return;
		color = 0xffffff;
		if(i ==ArcadeSettingSelected) color = 0xffff00; 
		WCHAR msg[1024]={0};
		std::string t = arcadeSettings[i].name;
		for(int r = 0; r < 1024; r++) {
			if((t.c_str())[r] == '\0') {
				msg[r] = '\0';
				break;
			}
			msg[r] = (t.c_str())[r];
		}
		FontSetColour(color);
		FontCenteredText(msg,MenuPosX, y, 600);
		y+=vSpace;
	}
}

void DrawCheatDetailMenu() {
	int y = MenuPosY;
	DWORD color;
	int start = 0;
	if(CheatValueSelected > 7 && (FbaCheats[CheatSelected].value.size() > 15)) {
		start += (CheatValueSelected  - 7);
	}
	if((CheatValueSelected > ((FbaCheats[CheatSelected].value.size()-1) - 7)) && (FbaCheats[CheatSelected].value.size() > 15)) {
		start = (FbaCheats[CheatSelected].value.size() - 15);
	}
	for(int i = start; i <  start +15; i++) {
		if(i == FbaCheats[CheatSelected].value.size()) return;
		if(i ==CheatValueSelected) color = 0xffff00; else color = 0xffffff; 
		WCHAR msg[1024]={0};
		std::string t = FbaCheats[CheatSelected].value[i];
		for(int r = 0; r < 1024; r++) {
			if((t.c_str())[r] == '\0') {
				msg[r] = '\0';
				break;
			}
			msg[r] = (t.c_str())[r];
		}
		FontSetColour(color);
		FontCenteredText(msg, MenuPosX, y, 600);
		y+=vSpace;
	}
}

