OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
gibs.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// gibs.h: Gibs - nuff said
24
25#pragma once
26
27#include "g_local.h"
28#include "mover.h"
29
30#define NO_FINAL_PITCH -1000
31
32class Gib : public Mover
33 {
34 private:
35 int sprayed;
36 float scale;
37 Mover *blood;
38 str blood_splat_name;
39 float blood_splat_size;
40 str blood_spurt_name;
41 float final_pitch;
42 float next_bleed_time;
43 public:
44 CLASS_PROTOTYPE( Gib );
45
46 qboolean fadesplat;
47 Gib();
48 ~Gib();
49 Gib( str name, qboolean blood_trail, str bloodtrailname="", str bloodspurtname="", str bloodsplatname="",
50 float blood_splat_size = 8, float pitch=NO_FINAL_PITCH );
51 void SetVelocity( float health );
52 void SprayBlood( Vector start );
53 void Throw( Event *ev );
54 void Splat( Event *ev );
55 void Stop( Event *ev );
56 void Damage( Event *ev );
57 void ClipGibVelocity( void );
58 void Archive( Archiver &arc ) override;
59 };
60
61inline void Gib::Archive
62 (
63 Archiver &arc
64 )
65 {
66 Entity::Archive( arc );
67
68 arc.ArchiveBoolean( &sprayed );
69 arc.ArchiveFloat( &scale );
70 arc.ArchiveObjectPointer( ( Class ** )&blood );
71 arc.ArchiveString( &blood_splat_name );
72 arc.ArchiveFloat( &blood_splat_size );
73 arc.ArchiveString( &blood_spurt_name );
74 arc.ArchiveFloat( &final_pitch );
75 arc.ArchiveBoolean( &fadesplat );
76 arc.ArchiveFloat( &next_bleed_time );
77 }
78
79
80void CreateGibs
81 (
82 Entity * ent,
83 float damage = -50,
84 float scale = 1.0f,
85 int num = 1,
86 const char * modelname = NULL
87 );
88
89extern Event EV_ThrowGib;
Definition archive.h:86
Definition class.h:276
Definition entity.h:203
Definition listener.h:246
Definition vector.h:61
Definition str.h:77