ScummVM API documentation
AttackHandler.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of Penumbra Overture.
26 */
27
28#ifndef GAME_ATTACK_HANDLER_H
29#define GAME_ATTACK_HANDLER_H
30
31#include "hpl1/engine/engine.h"
32
33#include "hpl1/penumbra-overture/GameTypes.h"
34
35using namespace hpl;
36
37class cInit;
38class cMapHandler;
39class cGameSwingDoor;
40
41//---------------------------
42
43#define eAttackTargetFlag_None 0
44#define eAttackTargetFlag_Player (1 << 0)
45#define eAttackTargetFlag_Enemy (1 << 1)
46#define eAttackTargetFlag_Bodies (1 << 2)
47
48typedef tFlag eAttackTargetFlag;
49
50//---------------------------
51
53public:
55
56 void Reset();
57 bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
58
59 eAttackTargetFlag mTarget;
60 iPhysicsBody *mpSkipBody;
61 iPhysicsBody *mpClosestBody;
62 float mfShortestDist;
63 cVector3f mvPosition;
64 bool mbSkipCharacter;
65};
66
67//---------------------------
68
70public:
72
73 bool CheckBlock(const cVector3f &avStart, const cVector3f &avEnd);
74
75 bool BeforeIntersect(iPhysicsBody *pBody);
76 bool OnIntersect(iPhysicsBody *pBody, cPhysicsRayParams *apParams);
77
78private:
79 cInit *mpInit;
80 bool mbIntersected;
81};
82
83//---------------------------
84
86public:
87 cAttackHandler(cInit *apInit);
89
90 bool CreateLineAttack(const cVector3f &avStart, const cVector3f &avEnd, float afDamage,
91 eAttackTargetFlag aTarget, iPhysicsBody *apSkipBody,
92 iPhysicsBody **apPickedBody = NULL);
93
94 bool CreateShapeAttack(iCollideShape *apShape, const cMatrixf &a_mtxOffset,
95 const cVector3f &avOrigin, float afDamage,
96 float afMinMass, float afMaxMass, float afMinImpulse, float afMaxImpulse,
97 int alStrength,
98 eAttackTargetFlag aTarget, iPhysicsBody *apSkipBody);
99
100 bool CreateLineDestroyBody(const cVector3f &avStart, const cVector3f &avEnd, float afStrength,
101 float afForce, iPhysicsBody *apSkipBody, iPhysicsBody **apPickedBody = NULL);
102
103 void CreateSplashDamage(const cVector3f &avCenter, float afRadius, float afMinDamage,
104 float afMaxDamge, float afMinForce, float afMaxForce,
105 float afMaxImpulse,
106 unsigned int aTarget, float afMinMass,
107 int alStrength);
108
109 cGameSwingDoor *GetLastSwingDoor() { return mpLastSwingDoor; }
110
111 void OnStart();
112 void Update(float afTimeStep);
113 void Reset();
114
115private:
116 cInit *mpInit;
117 cMapHandler *mpMapHandler;
118
119 cGameSwingDoor *mpLastSwingDoor;
120
121 cAttackRayCallback mRayCallback;
122 cSplashDamageBlockCheck *mpSplashBlockCheck;
123};
124
125#endif // GAME_ATTACK_HANDLER_H
Definition: AttackHandler.h:85
Definition: AttackHandler.h:52
Definition: GameSwingDoor.h:60
Definition: Init.h:70
Definition: MapHandler.h:155
Definition: AttackHandler.h:69
Definition: CollideShape.h:50
Definition: PhysicsBody.h:117
Definition: PhysicsWorld.h:100
Definition: Updateable.h:35
Definition: PhysicsWorld.h:92