#![allow(dead_code)]
#![allow(long_running_const_eval)]
#![allow(unused_imports)]

use crate::character::Character::{self, *};
use crate::condition::Condition::{self, *};
use crate::entity::Entity;
use crate::item::Item::{self, *};
use crate::location::Location::{self, *};
use crate::save_point::SavePoint::{self, *};
use crate::script::Token::{self, *};
use crate::script::script;
use crate::snippet::Snippet::{self, *};
use crate::sound::Sound::{self, *};
use crate::style::Style::{self, *};

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[repr(u32)]
pub enum Label {
    Label087FAE,
    Label087FB6,
    Label087FBE,
    Label087FC6,
    Label087FD0,
    Label087FD7,
    Label087FE2,
    Label087FEA,
}

use self::Label::*;

const fn find_label(script: &'static [Token<Label>], label: Label) -> usize {
    let mut i = 0;
    while i < script.len() {
        match script[i] {
            Token::Label(l) if l as u8 == label as u8 => return i,
            _ => i += 1,
        };
    }
    unreachable!();
}

pub fn dialog_for_label(index: usize) -> &'static [Token<'static, Label>] {
    &SCRIPTS[INDEXED[index]..]
}

pub fn dialog(index: usize) -> &'static [Token<'static, Label>] {
    &SCRIPTS[INDEXED[index]..]
}

const SCRIPTS: &[Token<Label>] = script![

Label(Label087FAE)
    "エスタハーン" End

Label(Label087FB6)
    "ラパダーナ" End

Label(Label087FBE)
    "��の�" End

Label(Label087FC6)
    "ハンデラ火山" End

Label(Label087FD0)
    "�の神�" End

Label(Label087FD7)
    "�のピラミッド" End

Label(Label087FE2)
    "天空の�" End

Label(Label087FEA)
    "��の����" End
    ];

pub const INDEXED: &[usize] = &[
    find_label(SCRIPTS, Label087FAE),
    find_label(SCRIPTS, Label087FB6),
    find_label(SCRIPTS, Label087FBE),
    find_label(SCRIPTS, Label087FC6),
    find_label(SCRIPTS, Label087FD0),
    find_label(SCRIPTS, Label087FD7),
    find_label(SCRIPTS, Label087FE2),
    find_label(SCRIPTS, Label087FEA),
];
