JA
games/alis / src / Alis / ImageVars.php · commit 9c722cf
<?phpnamespace App\Alis;/** File-scope variables of alis/src/image.c (see docs/porting.md). Call ImageVars::init() once at VM start. */final class ImageVars{    /** C: u16 moduly */    public static int $moduly = 0;    /** C: u16 modumap16 */    public static int $modumap16 = 0;    /** C: u16 xdeschart */    public static int $xdeschart = 0;    /** C: u16 ydeschart */    public static int $ydeschart = 0;    /** C: u8 (*chartproc)(u32 a5): a first-class callable (chartpalti16(...), chartpbyte(...), ...) */    public static ?\Closure $chartproc = null;    /** C: u16 chartvncol */    public static int $chartvncol = 0;    /** C: u8 chartvcol0 */    public static int $chartvcol0 = 0;    /** C: u8 cga_palette[16] (R, G, B, 0 per entry) */    public static array $cga_palette = [        0x00, 0x00, 0x00, 0x00,        0x55, 0xff, 0xff, 0x00,        0xff, 0x55, 0xff, 0x00,        0xff, 0xff, 0xff, 0x00,    ];    /** C: u8 ega_palette[64] */    public static array $ega_palette = [        0x00, 0x00, 0x00, 0x00,        0x00, 0x00, 0xaa, 0x00,        0x00, 0xaa, 0x00, 0x00,        0x00, 0xaa, 0xaa, 0x00,        0xaa, 0x00, 0x00, 0x00,        0xaa, 0x00, 0xaa, 0x00,        0xaa, 0x55, 0x00, 0x00,        0xaa, 0xaa, 0xaa, 0x00,        0x55, 0x55, 0x55, 0x00,        0x55, 0x55, 0xff, 0x00,        0x55, 0xff, 0x55, 0x00,        0x55, 0xff, 0xff, 0x00,        0xff, 0x55, 0x55, 0x00,        0xff, 0x55, 0xff, 0x00,        0xff, 0xff, 0x55, 0x00,        0xff, 0xff, 0xff, 0x00,    ];    /** C: u8 masks[4] */    public static array $masks = [0b11000000, 0b00110000, 0b00001100, 0b00000011];    /** C: u8 rots[4] */    public static array $rots = [6, 4, 2, 0];    /** C: u32 image_buf_cap: allocated bytes of physic_alloc / logic_alloc (not saved) */    public static int $image_buf_cap = 0;    // C: static struct { u8 tpal[768], mpal[768], sav1[768], sav2[768]; u8 step, reload, skip; s8 counter;    //    volatile u8 ftopal, lock; u32 acc; } dpal;   (DOS palette model)    public static array $dpal_tpal = [];    public static array $dpal_mpal = [];    public static array $dpal_sav1 = [];    public static array $dpal_sav2 = [];    public static int $dpal_step = 0;    public static int $dpal_reload = 0;    public static int $dpal_skip = 0;    /** s8 */    public static int $dpal_counter = 0;    public static int $dpal_ftopal = 0;    public static int $dpal_lock = 0;    /** u32 */    public static int $dpal_acc = 0;    /** C: u32 tprintd0[] */    public static array $tprintd0 = [0x3b9aca00, 0x05f5e100, 0x00989680, 0x000f4240, 0x000186a0, 0x00002710, 0x000003e8, 0x00000064, 0x0000000a, 0x00000001];    /** C: u8 v6xdirty = 1 (v6 only; kept because alis.c and resize_screen() write it) */    public static int $v6xdirty = 1;    /** C: u32 v6ips_warm (v6 only; referenced by opcodes.c) */    public static int $v6ips_warm = 0;    public static function init(): void    {        self::$dpal_tpal = array_fill(0, 768, 0);        self::$dpal_mpal = array_fill(0, 768, 0);        self::$dpal_sav1 = array_fill(0, 768, 0);        self::$dpal_sav2 = array_fill(0, 768, 0);        self::$dpal_step = 0;        self::$dpal_reload = 0;        self::$dpal_skip = 0;        self::$dpal_counter = 0;        self::$dpal_ftopal = 0;        self::$dpal_lock = 0;        self::$dpal_acc = 0;        self::$chartproc = null;    }}