OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
beam.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// beam.h: Beam
24
25#pragma once
26
27#include "g_local.h"
28#include "scriptslave.h"
29
30extern Event EV_FuncBeam_Activate;
31extern Event EV_FuncBeam_Deactivate;
32extern Event EV_FuncBeam_Diameter;
33extern Event EV_FuncBeam_Maxoffset;
34extern Event EV_FuncBeam_Minoffset;
35extern Event EV_FuncBeam_Overlap;
36extern Event EV_FuncBeam_Color;
37extern Event EV_FuncBeam_SetTarget;
38extern Event EV_FuncBeam_SetAngle;
39extern Event EV_FuncBeam_SetEndPoint;
40extern Event EV_FuncBeam_SetLife;
41extern Event EV_FuncBeam_Shader;
42extern Event EV_FuncBeam_Segments;
43extern Event EV_FuncBeam_Delay;
44extern Event EV_FuncBeam_NumSphereBeams;
45extern Event EV_FuncBeam_SphereRadius;
46extern Event EV_FuncBeam_ToggleDelay;
47extern Event EV_FuncBeam_FindEndpoint;
48extern Event EV_FuncBeam_EndAlpha;
49
50class FuncBeam : public ScriptSlave
51{
52protected:
53 SimpleEntityPtr end, origin_target;
54 float damage;
55 float life;
56 Vector end_point;
57 qboolean use_angles;
58 float shootradius;
59 str shader;
60
61 bool m_bIgnoreWalls;
62
63public:
64 CLASS_PROTOTYPE( FuncBeam );
65
66 FuncBeam();
67
68 void SetAngle( Event *ev );
69 void SetAngles( Event *ev );
70 void SetEndPoint( Event *ev );
71 void SetModel( Event *ev );
72 void SetDamage( Event *ev );
73 void SetOverlap( Event *ev );
74 void SetBeamStyle( Event *ev );
75 void SetLife( Event *ev );
76 void Activate( Event *ev );
77 void Deactivate( Event *ev );
78 void SetDiameter( Event *ev );
79 void SetMaxoffset( Event *ev );
80 void SetMinoffset( Event *ev );
81 void SetColor( Event *ev );
82 void SetSegments( Event *ev );
83 void SetBeamShader( str shader );
84 void SetBeamShader( Event *ev );
85 void SetBeamTileShader( Event *ev );
86 void SetDelay( Event *ev );
87 void SetToggleDelay( Event *ev );
88 void SetSphereRadius( Event *ev );
89 void SetNumSphereBeams( Event *ev );
90 void SetEndAlpha( Event *ev );
91 void SetShootRadius( Event *ev );
92 void SetPersist( Event *ev );
93 void FindEndpoint( Event *ev );
94 void UpdateEndpoint( Event *ev );
95 void UpdateOrigin( Event *ev );
96 void Shoot( Event *ev );
97 void SetIgnoreWalls( Event *ev );
98
99 void setAngles( Vector ang ) override;
100 void Archive( Archiver &arc ) override;
101
102 FuncBeam* CreateBeam(const char* model, const char* shader, Vector start, Vector end, int numsegments = 4, float scale = 1.0f, float life = 1.0f, float damage = 0.0f, Entity* origin_target = NULL);
103 friend FuncBeam* CreateBeam(const char* model, const char* shader, Vector start, Vector end, int numsegments, float scale, float life, float damage, Entity* origin_target);
104};
105
106inline void FuncBeam::Archive
107 (
108 Archiver &arc
109 )
110 {
111 ScriptSlave::Archive( arc );
112 arc.ArchiveSafePointer( &end );
113 arc.ArchiveSafePointer( &origin_target );
114 arc.ArchiveFloat( &damage );
115 arc.ArchiveFloat( &life );
116 arc.ArchiveVector( &end_point );
117 arc.ArchiveBoolean( &use_angles );
118 arc.ArchiveFloat( &shootradius );
119 arc.ArchiveString( &shader );
120 if ( arc.Loading() )
121 {
122 SetBeamShader( shader );
123 }
124 }
Definition archive.h:86
Definition entity.h:203
Definition listener.h:246
Definition vector.h:61
Definition str.h:77