-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBouncer.es
More file actions
80 lines (67 loc) · 2.55 KB
/
Bouncer.es
File metadata and controls
80 lines (67 loc) · 2.55 KB
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
/* Copyright (c) 2002-2012 Croteam Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
105
%{
#include "StdH.h"
%}
%{
extern DECL_DLL void JumpFromBouncer(CEntity *penToBounce, CEntity *penBouncer)
{
CEntity *pen = penToBounce;
CBouncer *pbo = (CBouncer *)penBouncer;
// if it is a movable model and some time has passed from the last jump
if ( (pen->GetRenderType()==CEntity::RT_MODEL) &&
(pen->GetPhysicsFlags()&EPF_MOVABLE) ) {
CMovableEntity *pmen = (CMovableEntity *)pen;
if (pmen->en_penReference==NULL) {
return;
}
// give it speed
FLOAT3D vDir;
AnglesToDirectionVector(pbo->m_aDirection, vDir);
pmen->FakeJump(pmen->en_vIntendedTranslation, vDir, pbo->m_fSpeed,
-pbo->m_fParallelComponentMultiplier, pbo->m_fNormalComponentMultiplier, pbo->m_fMaxExitSpeed, pbo->m_tmControl);
}
}
%}
class CBouncer : CRationalEntity {
name "Bouncer";
thumbnail "Thumbnails\\Bouncer.tbn";
features "HasName";
properties:
1 CTString m_strName "Name" 'N' = "Bouncer",
2 CTString m_strDescription = "",
4 FLOAT m_fSpeed "Speed [m/s]" 'S' = 20.0f,
5 ANGLE3D m_aDirection "Direction" 'D' = ANGLE3D(0,90,0),
6 FLOAT m_tmControl "Control time" 'T' = 5.0f,
7 BOOL m_bEntrySpeed = TRUE,
10 FLOAT m_fMaxExitSpeed "Max exit speed" 'M' = 200.0f,
12 FLOAT m_fNormalComponentMultiplier "Normal component multiplier" 'O' = 1.0f,
13 FLOAT m_fParallelComponentMultiplier "Parallel component multiplier" 'P' = 0.0f,
components:
functions:
procedures:
Main() {
// declare yourself as a brush
InitAsBrush();
SetPhysicsFlags(EPF_BRUSH_FIXED|EPF_NOIMPACT);
SetCollisionFlags(ECF_BRUSH);
// if old flag "entry speed" has been reset
if (!m_bEntrySpeed)
{
// kill normal component by default (same behaviour by default)
m_fNormalComponentMultiplier = 0.0f;
m_bEntrySpeed = TRUE;
}
return;
}
};