OpenMoHAA 0.82.1
Loading...
Searching...
No Matches
viewthing.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// viewthing.h: Actor code for the viewthing.
24//
25
26#pragma once
27
28#include "animate.h"
29
30class ViewMaster : public Listener
31{
32public:
33 CLASS_PROTOTYPE(ViewMaster);
34
35 EntityPtr current_viewthing;
36
37 ViewMaster();
38 void Init(void);
39 void Next(Event *ev);
40 void Prev(Event *ev);
41 void DeleteAll(Event *ev);
42 void Spawn(Event *ev);
43 void SetModelEvent(Event *ev);
44 void PassEvent(Event *ev);
45
46 void Archive(Archiver& arc) override;
47};
48
49inline void ViewMaster::Archive(Archiver& arc)
50{
51 Listener::Archive(arc);
52
53 arc.ArchiveSafePointer(&current_viewthing);
54}
55
56extern ViewMaster Viewmodel;
57
58class Viewthing : public Animate
59{
60public:
61 CLASS_PROTOTYPE(Viewthing);
62
63 int animstate;
64 int frame;
65 int lastframe;
66 Vector baseorigin;
67 byte origSurfaces[MAX_MODEL_SURFACES];
68
69 Viewthing();
70 void UpdateCvars(qboolean quiet = false);
71 void PrintTime(Event *ev);
72 void ThinkEvent(Event *ev);
73 void LastFrameEvent(Event *ev);
74 void ToggleAnimateEvent(Event *ev);
75 void SetModelEvent(Event *ev);
76 void NextFrameEvent(Event *ev);
77 void PrevFrameEvent(Event *ev);
78 void NextAnimEvent(Event *ev);
79 void PrevAnimEvent(Event *ev);
80 void ScaleUpEvent(Event *ev);
81 void ScaleDownEvent(Event *ev);
82 void SetScaleEvent(Event *ev);
83 void SetYawEvent(Event *ev);
84 void SetPitchEvent(Event *ev);
85 void SetRollEvent(Event *ev);
86 void SetAnglesEvent(Event *ev);
87 void AttachModel(Event *ev);
88 void Delete(Event *ev);
89 void DetachAll(Event *ev);
90 void ChangeOrigin(Event *ev);
91 void SaveSurfaces(Event *ev);
92 void SetAnim(Event *ev);
93
94 void Archive(Archiver& arc) override;
95};
96
97inline void Viewthing::Archive(Archiver& arc)
98{
99 Animate::Archive(arc);
100
101 arc.ArchiveInteger(&animstate);
102 arc.ArchiveInteger(&frame);
103 arc.ArchiveInteger(&lastframe);
104 arc.ArchiveVector(&baseorigin);
105 arc.ArchiveRaw(origSurfaces, sizeof(origSurfaces));
106}
Definition archive.h:86
Definition listener.h:246
Definition vector.h:61
Definition viewthing.h:31