OpenMoHAA 0.82.0
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 {
32 public:
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
50 (
51 Archiver &arc
52 )
53
54 {
55 Listener::Archive( arc );
56
57 arc.ArchiveSafePointer( &current_viewthing );
58 }
59
60extern ViewMaster Viewmodel;
61
62class Viewthing : public Animate
63 {
64 public:
65 CLASS_PROTOTYPE( Viewthing );
66
67 int animstate;
68 int frame;
69 int lastframe;
70 Vector baseorigin;
71 byte origSurfaces[MAX_MODEL_SURFACES];
72
73 Viewthing();
74 void UpdateCvars( qboolean quiet = false );
75 void PrintTime( Event *ev );
76 void ThinkEvent( Event *ev );
77 void LastFrameEvent( Event *ev );
78 void ToggleAnimateEvent( Event *ev );
79 void SetModelEvent( Event *ev );
80 void NextFrameEvent( Event *ev );
81 void PrevFrameEvent( Event *ev );
82 void NextAnimEvent( Event *ev );
83 void PrevAnimEvent( Event *ev );
84 void ScaleUpEvent( Event *ev );
85 void ScaleDownEvent( Event *ev );
86 void SetScaleEvent( Event *ev );
87 void SetYawEvent( Event *ev );
88 void SetPitchEvent( Event *ev );
89 void SetRollEvent( Event *ev );
90 void SetAnglesEvent( Event *ev );
91 void AttachModel( Event *ev );
92 void Delete( Event *ev );
93 void DetachAll( Event *ev );
94 void ChangeOrigin( Event *ev );
95 void SaveSurfaces( Event *ev );
96 void SetAnim( Event *ev );
97
98 void Archive( Archiver &arc ) override;
99 };
100
101inline void Viewthing::Archive
102 (
103 Archiver &arc
104 )
105
106 {
107 Animate::Archive( arc );
108
109 arc.ArchiveInteger( &animstate );
110 arc.ArchiveInteger( &frame );
111 arc.ArchiveInteger( &lastframe );
112 arc.ArchiveVector( &baseorigin );
113 arc.ArchiveRaw( origSurfaces, sizeof( origSurfaces ) );
114 }
Definition archive.h:86
Definition listener.h:246
Definition vector.h:61
Definition viewthing.h:31