assert(rb,"Run fbneo-training-mode.lua") -- make sure the main script is being run

REPLAY_SAVESTATE_INTERVAL = 300

p1maxhealth = 0xA0
p2maxhealth = 0xA0
p1maxmeter = rb(0x200D951)
p2maxmeter = rb(0x200D971)


local p1health = 0x200D22B
local p2health = 0x200D603

local p1meter = 0x200D953
local p2meter = 0x200D973

local p1direction = 0x200D196 
local p2direction = 0x200D197

local p1combocounter = 0x200DA4D
local p2combocounter = 0x200D6CD

translationtable = {
	"left",
	"right",
	"up",
	"down",
	"button1",
	"button2",
	"button3",
	"button4",
	"button5",
	"button6",
	"coin",
	"start",
	["Left"] = 1,
	["Right"] = 2,
	["Up"] = 3,
	["Down"] = 4,
	["Weak Punch"] = 5,
	["Medium Punch"] = 6,
	["Strong Punch"] = 7,
	["Weak Kick"] = 8,
	["Medium Kick"] = 9,
	["Strong Kick"] = 10,
	["Coin"] = 11,
	["Start"] = 12,
}

gamedefaultconfig = {
	hud = {
		combotextx=176,
		combotexty=42,
		comboenabled=true,
		p1healthx=9,
		p1healthy=16,
		p1healthenabled=true,
		p2healthx=364,
		p2healthy=16,
		p2healthenabled=true,
	},
}

function playerOneFacingLeft()
	return rb(p1direction)==0
end

function playerTwoFacingLeft()
	return rb(p2direction)==1
end

function playerOneInHitstun()
	return rb(p2combocounter)~=0
end

function playerTwoInHitstun()
	return rb(p1combocounter)~=0
end

function readPlayerOneHealth()
	return rb(p1health)
end

function writePlayerOneHealth(health)
	wb(p1health, health)
end

function readPlayerTwoHealth()
	return rb(p2health)
end

function writePlayerTwoHealth(health)
	wb(p2health, health)
end

function readPlayerOneMeter()
	return rb(p1meter)
end

function writePlayerOneMeter(meter)
	wb(p1meter, meter)
end

function readPlayerTwoMeter()
	return rb(p2meter)
end

function writePlayerTwoMeter(meter)
	wb(p2meter, meter)
end

local infiniteTime = function()
	wb(0x200EB33, 0x64)
end

function Run() -- runs every frame
	infiniteTime()
end
