OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
VehicleSlot.h
1/*
2===========================================================================
3Copyright (C) 2024 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// VehicleSlot.h
24//
25
26#pragma once
27
28#include "g_local.h"
29#include "class.h"
30#include "entity.h"
31
32#define SLOT_FREE 1
33#define SLOT_BUSY 2
34#define SLOT_UNUSED 4
35
36class cVehicleSlot : public Class
37{
38public:
40 int flags;
41 int boneindex;
42 int enter_boneindex;
43
44protected:
45 damage_t prev_takedamage;
46 solid_t prev_solid;
47 int prev_contents;
48
49 //
50 // Added in OPM
51 // Used for properly saving and restoring children solidity
52 Entity *prev_children_ent[MAX_MODEL_CHILDREN];
53 solid_t prev_children_solid[MAX_MODEL_CHILDREN];
54 int prev_num_children;
55
56public:
57 cVehicleSlot();
58
59 virtual void NotSolid(void);
60 virtual void Solid(void);
61 void Archive(Archiver& arc) override;
62};
63
64inline void cVehicleSlot::Archive(Archiver& arc)
65{
66 Class::Archive(arc);
67
68 arc.ArchiveSafePointer(&ent);
69 arc.ArchiveInteger(&flags);
70 arc.ArchiveInteger(&boneindex);
71 arc.ArchiveInteger(&enter_boneindex);
72 ArchiveEnum(prev_takedamage, damage_t);
73 ArchiveEnum(prev_solid, solid_t);
74 arc.ArchiveInteger(&prev_contents);
75}
76
77class cTurretSlot : public cVehicleSlot
78{
79 damage_t owner_prev_takedamage;
80 solid_t owner_prev_solid;
81 int owner_prev_contents;
82
83public:
84 cTurretSlot();
85
86 void NotSolid(void) override;
87 void Solid(void) override;
88 void Archive(Archiver& arc) override;
89};
90
91inline void cTurretSlot::Archive(Archiver& arc)
92{
93 cVehicleSlot::Archive(arc);
94
95 ArchiveEnum(owner_prev_takedamage, damage_t);
96 ArchiveEnum(owner_prev_solid, solid_t);
97 arc.ArchiveInteger(&owner_prev_contents);
98}
Definition archive.h:86
Definition entity.h:203
Definition safeptr.h:160