tics left of each power */ public array $powers = [0, 0, 0, 0, 0, 0]; /** @var array */ public array $cards = [false, false, false, false, false, false]; public bool $backpack = false; public int $readyWeapon = self::WP_PISTOL; public int $pendingWeapon = self::WP_NOCHANGE; /** @var array */ public array $weaponOwned = [true, true, false, false, false, false, false, false, false]; /** @var array */ public array $ammo = [50, 0, 0, 0]; /** @var array */ public array $maxAmmo = self::MAXAMMO; public bool $attackDown = false; public bool $useDown = false; public int $cheats = 0; public int $refire = 0; public int $killCount = 0; public int $itemCount = 0; public int $secretCount = 0; public ?string $message = null; public int $damageCount = 0; public int $bonusCount = 0; public ?Mobj $attacker = null; public int $extraLight = 0; public int $fixedColormap = 0; /** @var array weapon and flash */ public array $psprites = []; /** the camera is this player's eyes: his own sprite is not drawn */ public bool $isViewer = true; public function __construct() { $this->cmd = new TicCmd(); $this->psprites = [new PSprite(), new PSprite()]; } /** G_PlayerReborn: back to the start of the level with a pistol. */ public function reborn(): void { $kills = $this->killCount; $items = $this->itemCount; $secrets = $this->secretCount; $fresh = new self(); foreach (get_object_vars($fresh) as $k => $v) { $this->$k = $v; } $this->killCount = $kills; $this->itemCount = $items; $this->secretCount = $secrets; $this->useDown = $this->attackDown = true; // do not fire or use at once $this->playerState = self::LIVE; } /** G_PlayerFinishLevel: powers, keys and screen flashes do not carry over. */ public function finishLevel(): void { $this->powers = [0, 0, 0, 0, 0, 0]; $this->cards = [false, false, false, false, false, false]; if ($this->mo !== null) { $this->mo->flags &= ~Info::MF_SHADOW; } $this->extraLight = 0; $this->fixedColormap = 0; $this->damageCount = 0; $this->bonusCount = 0; } }