RU
games/alis / src / Alis / ImageV6Vars.php · commit 9c722cf
<?phpnamespace App\Alis;/** * File-scope variables of the v6 / 3DO parts of alis/src/image.c (see docs/porting.md and fn/image_v6.php). * (v6xdirty and v6ips_warm stay in ImageVars: older files already use them.) */final class ImageV6Vars{    /** C: sV6Put v6put */    public static ?sV6Put $v6put = null;    /** C: static sV6Dirty v6dirty[V6_DIRTY_MAX]: each ['x1','y1','x2','y2','area','id','scene'] */    public static array $v6dirty = [];    /** C: static s16 v6dirty_tail */    public static int $v6dirty_tail = 0;    /** C: static s16 v6win_x1, v6win_y1, v6win_x2, v6win_y2 */    public static int $v6win_x1 = 0;    public static int $v6win_y1 = 0;    public static int $v6win_x2 = 0;    public static int $v6win_y2 = 0;    /** C: static s16 v6clip_valid, v6clip_x1, v6clip_y1, v6clip_x2, v6clip_y2, v6clip_w, v6clip_h */    public static int $v6clip_valid = 0;    public static int $v6clip_x1 = 0;    public static int $v6clip_y1 = 0;    public static int $v6clip_x2 = 0;    public static int $v6clip_y2 = 0;    public static int $v6clip_w = 0;    public static int $v6clip_h = 0;    /** C: static u32 v6ips_ring[8], v6ips_slot */    public static array $v6ips_ring = [0, 0, 0, 0, 0, 0, 0, 0];    public static int $v6ips_slot = 0;    /** C: static u8 v6xdrawinv */    public static int $v6xdrawinv = 0;    /** C: s16 v6xclipx1, v6xclipy1, v6xclipx2, v6xclipy2 (the v6 clip set, also used by deus3d) */    public static int $v6xclipx1 = 0;    public static int $v6xclipy1 = 0;    public static int $v6xclipx2 = 0;    public static int $v6xclipy2 = 0;    /** C: static u16 *rb; static s32 rbw (cel_blit row buffer): not needed in PHP (local array) */    /** C: static sV6Box v6x_cur = {0, 0, -1, -1}, v6x_newcur: [x1, y1, x2, y2] */    public static array $v6x_cur = [0, 0, -1, -1];    public static array $v6x_newcur = [0, 0, -1, -1];    /** C: static u8 v6x_curhit */    public static int $v6x_curhit = 0;    /** C: u16 v6x_mousegen (bumped when the v6 cursor changes) */    public static int $v6x_mousegen = 0;    /** C: static u16 v6x_curgen */    public static int $v6x_curgen = 0;    /** C: u8 v6x_mousebuf[0x400] (8-bit cursor, 32 x 32) */    public static array $v6x_mousebuf = [];    /** C: u16 v6x_mousew, v6x_mouseh */    public static int $v6x_mousew = 0;    public static int $v6x_mouseh = 0;    /** C: u16 v6x_mousergb[0x400] (3DO cursor, rgb555 | 0x8000) */    public static array $v6x_mousergb = [];    /** C: v6x_affiscr() static u32 lastscr; static u8 lastempty */    public static int $affiscr_lastscr = 0;    public static int $affiscr_lastempty = 0;    /** C: v6x_draw() static int frame */    public static int $draw_frame = 0;    public static function init(): void    {        self::$v6put = new sV6Put();        self::$v6dirty = [];        for ($i = 0; $i < ImageV6Const::V6_DIRTY_MAX; $i++) {            self::$v6dirty[$i] = ['x1' => 0, 'y1' => 0, 'x2' => 0, 'y2' => 0, 'area' => 0, 'id' => 0, 'scene' => 0];        }        self::$v6dirty_tail = 0;        self::$v6ips_ring = array_fill(0, 8, 0);        self::$v6ips_slot = 0;        self::$v6x_cur = [0, 0, -1, -1];        self::$v6x_newcur = [0, 0, -1, -1];        self::$v6x_mousebuf = array_fill(0, 0x400, 0);        self::$v6x_mousergb = array_fill(0, 0x400, 0);    }}// C globals are zero / statically initialised at program start: initialise on class load// (alis_init() may also call ImageV6Vars::init()).ImageV6Vars::init();