TR
games/doom-jumphp / src / Game / Weapons.php · commit 8e1cb9f
<?phpnamespace App\Game;/** The five weapons and the states of the weapon in the hands (p_pspr.c's psprites). */final class Weapons{    public const LIST = [        1 => ['name' => 'WRENCH', 'sprite' => 'WRCH', 'ammo' => null, 'per' => 0, 'fire' => 'WRCH_F1'],        2 => ['name' => 'SIDEARM', 'sprite' => 'SIDE', 'ammo' => 'bullets', 'per' => 1, 'fire' => 'SIDE_F1'],        3 => ['name' => 'SCATTERGUN', 'sprite' => 'SCAT', 'ammo' => 'shells', 'per' => 1, 'fire' => 'SCAT_F1'],        4 => ['name' => 'RIVETER', 'sprite' => 'RIVT', 'ammo' => 'bullets', 'per' => 1, 'fire' => 'RIVT_F1'],        5 => ['name' => 'ION LAUNCHER', 'sprite' => 'IONG', 'ammo' => 'cells', 'per' => 1, 'fire' => 'IONG_F1'],    ];    /** state => [frame, tics, action|null, next] (the sprite is the weapon's) */    public const STATES = [        'READY' => ['A', 1, 'weaponReady', 'READY'],        'DOWN' => ['A', 1, 'lower', 'DOWN'],        'UP' => ['A', 1, 'raise', 'UP'],        'WRCH_F1' => ['B', 4, null, 'WRCH_F2'], 'WRCH_F2' => ['C', 4, 'punch', 'WRCH_F3'], 'WRCH_F3' => ['D', 5, null, 'WRCH_F4'],        'WRCH_F4' => ['C', 4, null, 'WRCH_F5'], 'WRCH_F5' => ['B', 5, 'reFire', 'READY'],        'SIDE_F1' => ['A', 4, null, 'SIDE_F2'], 'SIDE_F2' => ['B', 6, 'fireSidearm', 'SIDE_F3'], 'SIDE_F3' => ['C', 4, null, 'SIDE_F4'],        'SIDE_F4' => ['A', 5, 'reFire', 'READY'],        'SCAT_F1' => ['A', 3, null, 'SCAT_F2'], 'SCAT_F2' => ['B', 7, 'fireScatter', 'SCAT_F3'], 'SCAT_F3' => ['C', 5, null, 'SCAT_F4'],        'SCAT_F4' => ['D', 5, 'pump', 'SCAT_F5'], 'SCAT_F5' => ['C', 5, null, 'SCAT_F6'], 'SCAT_F6' => ['A', 3, null, 'SCAT_F7'],        'SCAT_F7' => ['A', 7, 'reFire', 'READY'],        'RIVT_F1' => ['B', 4, 'fireRivet', 'RIVT_F2'], 'RIVT_F2' => ['C', 4, 'fireRivet', 'RIVT_F3'], 'RIVT_F3' => ['A', 0, 'reFire', 'READY'],        'IONG_F1' => ['B', 3, 'fireIon', 'IONG_F2'], 'IONG_F2' => ['A', 20, 'reFire', 'READY'],    ];    public const LOWERED = 96.0;     // the weapon's offset when down    public const SPEED = 6.0;        // raise / lower speed per tic}