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(0x20286AD)
p2maxmeter = rb(0x20286e1)


local p1health = 0x2068D0B
local p2health = 0x20691A3

local p1meter = 0x20695BE
local p2meter = 0x20695EB

local p1direction = 0x2068C76 
local p2direction = 0x2068C77

local p1combocounter = 0x20696C5
local p2combocounter = 0x206961D

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=179,
		combotexty=42,
		comboenabled=true,
		p1healthx=9,
		p1healthy=17,
		p1healthenabled=true,
		p2healthx=364,
		p2healthy=17,
		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(0x2011377, 0x63)
end

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