OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
portableturret.h
1/*
2===========================================================================
3Copyright (C) 2023 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23#pragma once
24
25#include "inventoryitem.h"
26#include "weapturret.h"
27
28class CarryableTurret : public InventoryItem
29{
30private:
31 str turretModel;
32 qboolean isPickable;
33
34public:
35 CLASS_PROTOTYPE(CarryableTurret);
36
37 CarryableTurret();
38
39 void EventPickup(Event *ev);
40
41 qboolean Removable(void) override;
42 void DetachFromOwner(void) override;
43 void AttachToHolster(weaponhand_t hand) override;
44 void DropTurret(Event *ev);
45 qboolean Drop(void) override;
46 void EventTurretTik(Event *ev);
47 void EventPlaceTurret(Event *ev);
48 void EventEnablePickup(Event *ev);
49
50 bool IsCarryableTurret() const override;
51
52 void Archive(Archiver& arc) override;
53};
54
55class PortableTurret : public TurretGun
56{
57private:
58 EntityPtr baseEntity;
59 float groundPitch;
60 Vector ownerPosition;
61 float nextUsableTime;
62 qboolean packingUp;
63 qboolean mustDetach;
64 str currentModel;
65 str setupModel;
66 Vector cameraOrigin;
67 float endReloadTime;
68
69public:
70 CLASS_PROTOTYPE(PortableTurret);
71
72public:
73 PortableTurret();
74 ~PortableTurret();
75
76 void SetGroundPitch(float pitch);
77 void SetOwnerPosition(const Vector& pos);
78 void PortablePlaceTurret(Event *ev);
79 void MakeBaseEntity();
80 void EventSetClipSize(Event *ev);
81 void AbortTurretSetup();
82
83 void P_UserAim(usercmd_t *cmd) override;
84 void P_TurretEndUsed() override;
85 void P_TurretBeginUsed(Player *pEnt) override;
86 void P_ThinkActive() override;
87 void P_TurretUsed(Player *player) override;
88
89 float GetGroundPitch() const;
90 float GetStartYaw() const;
91 bool IsReloading() const;
92 bool IsSettingUp() const;
93 bool IsPackingUp() const;
94
95 void Archive(Archiver& arc) override;
96};
Definition archive.h:86
Definition listener.h:246
Definition vector.h:61
Definition str.h:77