This repository has been archived by the owner on Sep 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
deadbody.cpp
135 lines (120 loc) · 3.64 KB
/
deadbody.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/deadbody.cpp $
// $Revision:: 13 $
// $Author:: Jimdose $
// $Date:: 11/19/98 9:28p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/deadbody.cpp $
//
// 13 11/19/98 9:28p Jimdose
// made deadbodies copy the gravaxis
//
// 12 11/11/98 11:11p Aldie
// Make deadbodies do blood and gib properly
//
// 11 11/10/98 7:20p Aldie
// Fix for deadbodies not displaying death properly
//
// 10 10/17/98 9:40p Markd
// dead body queue won't initialize unless in deathmatch or coop
//
// 9 10/10/98 1:26a Jimdose
// InitializeBodyQueue is disabled while loading savegames
//
// 8 9/22/98 5:19p Markd
// Put in new consolidated gib function
//
// 7 9/22/98 3:21p Markd
// put in parentmode lockout for blood and gibs
//
// 6 9/19/98 6:09p Markd
// changed linkentity to link() call
//
// 5 8/29/98 9:40p Jimdose
// Moved bodyque to deadbody
//
// 4 7/29/98 2:31p Aldie
// Changed health to a float
//
// 3 7/23/98 6:17p Aldie
// Updated damage system and fixed some damage related bugs. Also put tracers
// back to the way they were, and added gib event to funcscriptmodels
//
// 2 7/13/98 4:59p Aldie
// Added dead player bodies with gibbing
//
// DESCRIPTION:
// Dead body
#include "deadbody.h"
#include "gibs.h"
CLASS_DECLARATION( Sentient, Deadbody, "deadbody" );
ResponseDef Deadbody::Responses[] =
{
{ &EV_Gib, ( Response )Deadbody::GibEvent },
{ NULL, NULL }
};
void Deadbody::GibEvent
(
Event *ev
)
{
takedamage = DAMAGE_NO;
if ( sv_gibs->value && !parentmode->value )
{
setSolidType( SOLID_NOT );
hideModel();
CreateGibs( this, health, 1.0f, 3 );
}
}
void CopyToBodyQueue
(
edict_t *ent
)
{
edict_t *body;
// grab a body from the queue and cycle to the next one
body = &g_edicts[ ( int )maxclients->value + level.body_queue + 1 ];
level.body_queue = ( level.body_queue + 1 ) % BODY_QUEUE_SIZE;
gi.unlinkentity( ent );
gi.unlinkentity( body );
body->s = ent->s;
body->s.number = body - g_edicts;
body->svflags = ent->svflags;
body->solid = ent->solid;
body->clipmask = ent->clipmask;
body->owner = ent->owner;
body->entity->movetype = ent->entity->movetype;
body->entity->takedamage = DAMAGE_YES;
body->entity->deadflag = DEAD_DEAD;
body->s.renderfx &= ~RF_DONTDRAW;
body->entity->origin = ent->entity->worldorigin;
body->entity->setSize(ent->mins,ent->maxs);
body->entity->link();
body->entity->SetGravityAxis( ent->entity->gravaxis );
}
void InitializeBodyQueue
(
void
)
{
int i;
Deadbody *body;
if ( ( !LoadingSavegame ) && ( deathmatch->value || coop->value ) )
{
level.body_queue = 0;
for ( i=0; i<BODY_QUEUE_SIZE ; i++ )
{
body = new Deadbody;
body->edict->owner = NULL;
body->edict->s.skinnum = -1;
body->flags |= (FL_DIE_GIBS|FL_BLOOD);
}
}
}