function p.on_start(wid)
    --Nothing to do.
end

function p.on_end(wid)
    --Nothing to do.
end

function p.render(wid)
    ga_win_set_background(wid, std.vec(0.0, 0.0, 0.0), 0.95)

    ga_win_set_char_size(wid, 0.03, 0.06)
    ga_win_txt_center(wid, 0.9, "RESPAWN?")

    ga_win_set_char_size(wid, 0.02, 0.04)
    ga_win_txt_center(wid, 0.8, "WANT TO RESPAWN TO YOUR RESPAWN POINT?")

    ga_win_set_char_size(wid, 0.015, 0.03)
    ga_win_set_front_color(wid, std.vec(1.0, 1.0, 0.0))
    if( ga_genesis() ) then
        ga_win_txt_center(wid, 0.7, "YOU WILL LOSE 30 GOLD")
    else
        ga_win_txt_center(wid, 0.7, "YOU WILL LOSE HEALTH ABOVE 100%, ARMOR, AMMO, AND 30 GOLD")
    end

    ga_win_set_front_color_default(wid)
    ga_win_set_char_size(wid, 0.02, 0.04)
    ga_win_txt_center(wid, 0.6, "Y / N")

    ga_win_line(wid, 0.0,0.5, 1.0,0.5, std.vec(1.0, 1.0, 1.0))

    local respawn_cost = game_respawn.get_keepammo_cost()
    ga_win_txt_center(wid, 0.37,
        "OR PRESS P TO PAY ^xff0000" .. tostring(respawn_cost) .. "^! GOLD")
    ga_win_txt_center(wid, 0.3, "TO RESPAWN BUT KEEPING")
    ga_win_txt_center(wid, 0.23, "YOUR HEALTH, AMMO, AND ARMOR")

    ga_win_set_char_size(wid, 0.02, 0.04)
    ga_win_txt_center(wid, 0.06, "Go Back (ESC)")
end

function p.process_input(wid)
    if ga_win_key_pressed(wid, "Y") then
        ga_set_i("xar.player.health.amount", -100)
        ga_play_sound("player_death")
        ga_main_menu_pop_all(true)
        --
        --Actually respawning.
        ga_command("respawn force")
        return
    end
    if ga_win_key_pressed(wid, "P") then
        if ga_get_b("xar.player.arcade.inside") then
            ga_main_menu_push("win_main_menu_respawn_arcade_error")
            return
        end
        ga_play_sound("buy")
        ga_main_menu_pop_all(true)
        --Actually respawning.
        ga_command("respawn force keepammo")
        return
    end
    if ga_win_key_pressed(wid, "N") then
        ga_play_sound("menu_back")
        ga_main_menu_pop()
        return
    end
    if ga_win_key_pressed(wid, "ESC") then
        ga_play_sound("menu_back")
        ga_main_menu_pop()
        return
    end
end
