OpenMoHAA 0.82.1
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{
34private:
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
44public:
45 CLASS_PROTOTYPE(Gib);
46
47 qboolean fadesplat;
48 Gib();
49 ~Gib();
50 Gib(str name,
51 qboolean blood_trail,
52 str bloodtrailname = "",
53 str bloodspurtname = "",
54 str bloodsplatname = "",
55 float blood_splat_size = 8,
56 float pitch = NO_FINAL_PITCH);
57 void SetVelocity(float health);
58 void SprayBlood(Vector start);
59 void Throw(Event *ev);
60 void Splat(Event *ev);
61 void Stop(Event *ev);
62 void Damage(Event *ev);
63 void ClipGibVelocity(void);
64 void Archive(Archiver& arc) override;
65};
66
67inline void Gib::Archive(Archiver& arc)
68{
69 Entity::Archive(arc);
70
71 arc.ArchiveBoolean(&sprayed);
72 arc.ArchiveFloat(&scale);
73 arc.ArchiveObjectPointer((Class **)&blood);
74 arc.ArchiveString(&blood_splat_name);
75 arc.ArchiveFloat(&blood_splat_size);
76 arc.ArchiveString(&blood_spurt_name);
77 arc.ArchiveFloat(&final_pitch);
78 arc.ArchiveBoolean(&fadesplat);
79 arc.ArchiveFloat(&next_bleed_time);
80}
81
82void CreateGibs(Entity *ent, float damage = -50, float scale = 1.0f, int num = 1, const char *modelname = NULL);
83
84extern 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