void teleport_usa(void)
{
static u32 indoor_X[3] = { 0 };
static u32 indoor_Y[3] = { 0 };
static u32 outdoor_X[3] = { 0 };
static u32 outdoor_Y[3] = { 0 };
static int loc = 0;
if (is_pressed(BUTTON_B)) //Pointer to define whether player is indoors or not
{
loc = READU32(0x17321644);
}
if (is_pressed(BUTTON_B + BUTTON_DU))
{
if (loc == -1)
{
if (is_pressed(BUTTON_L)) //If L is pressed then save in slot3
{
outdoor_X[2] = READU32(0x17321510);
outdoor_Y[2] = READU32(0x17321518);
}
else if (is_pressed(BUTTON_R)) //If R is pressed then save in slot2
{
outdoor_X[1] = READU32(0x17321510);
outdoor_Y[1] = READU32(0x17321518);
}
else //If noting is pressed then save in slot0
{
outdoor_X[0] = READU32(0x17321510);
outdoor_Y[0] = READU32(0x17321518);
}
}
else
{
if (is_pressed(BUTTON_L)) //If L is pressed then save in slot3
{
indoor_X[2] = READU32(0x1732163c);
indoor_Y[2] = READU32(0x17321644);
}
else if (is_pressed(BUTTON_R)) //If R is pressed then save in slot2
{
indoor_X[1] = READU32(0x1732163c);
indoor_Y[1] = READU32(0x17321644);
}
else //If noting is pressed then save in slot0
{
indoor_X[0] = READU32(0x1732163c);
indoor_Y[0] = READU32(0x17321644);
}
}
}
if (is_pressed(BUTTON_B + BUTTON_DD))
{
if (loc == -1)
{
if (is_pressed(BUTTON_L)) //If L is pressed then restore slot3
{
WRITEU32(0x17321510, outdoor_X[2]);
WRITEU32(0x17321518, outdoor_Y[2]);
}
else if (is_pressed(BUTTON_R)) //If R is pressed then restore slot2
{
WRITEU32(0x17321510, outdoor_X[1]);
WRITEU32(0x17321518, outdoor_Y[1]);
}
else //If noting is pressed then restore slot0
{
WRITEU32(0x17321510, outdoor_X[0]);
WRITEU32(0x17321518, outdoor_Y[0]);
}
}
else
{
if (is_pressed(BUTTON_L)) //If L is pressed then restore slot3
{
WRITEU32(0x1732163c, indoor_X[2]);
WRITEU32(0x17321644, indoor_Y[2]);
}
else if (is_pressed(BUTTON_R)) //If R is pressed then restore slot2
{
WRITEU32(0x1732163c, indoor_X[1]);
WRITEU32(0x17321644, indoor_Y[1]);
}
else //If noting is pressed then restore slot0
{
WRITEU32(0x1732163c, indoor_X[0]);
WRITEU32(0x17321644, indoor_Y[0]);
}
}
}
}