HoverRace  2.0
ShapeCollisions.h
Go to the documentation of this file.
1 
2 // ShapeCollisions.h
3 //
4 // Copyright (c) 1995-1998 - Richard Langlois and Grokksoft Inc.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 //
22 
23 #pragma once
24 
25 #include "Shapes.h"
26 
27 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
28 # ifdef MR_ENGINE
29 # define MR_DllDeclare __declspec( dllexport )
30 # else
31 # define MR_DllDeclare __declspec( dllimport )
32 # endif
33 #else
34 # define MR_DllDeclare
35 #endif
36 
37 namespace HoverRace {
38 namespace Model {
39 
40 // Collisions vs Movement
41 //
42 // Collisions and movement are relatively linked together, that is why
43 // the movement algorithm will be described here.
44 //
45 // Actors can enter in collision with 3 Kind of thing:
46 // Other actors (Each actor component is seperatly evaluated)
47 // Feature (The feature is evaluated as a whole)
48 // Room limits (Each wall, ceiling and floor are individually evaluated)
49 //
50 // It also exist two kind of contact(or collision) (Big simplification)
51 // Horizontal
52 // On the horizontal plan (with an horizontal orientation)
53 // Vertical
54 // On the vertical plan with a direction, either up or down
55 //
56 // To be revisted.. I have an idea
57 //
58 
59 // Collisions description
60 
62 {
65 };
66 
68 {
69  enum { eMaxWallContact = 6 };
70 
72 
73  MR_Int32 mDistanceFromFloor; // Can be negative
74  MR_Int32 mDistanceFromCeiling; // Can be negative
75 
76  int mNbWallContact; // 0 mean no collision
77  int mWallContact[eMaxWallContact];
78 };
79 
80 BOOL MR_DllDeclare GetPolygonInclusion(const PolygonShape &pPolygon, const MR_2DCoordinate &pPosition);
81 
82 // High level oontact function
83 BOOL MR_DllDeclare DetectActorContact(const ShapeInterface *pActor, const ShapeInterface *pObstacle, ContactSpec &pAnswer);
84 BOOL MR_DllDeclare DetectFeatureContact(const ShapeInterface *pActor, const PolygonShape *pFeature, ContactSpec &pAnswer);
85 void MR_DllDeclare DetectRoomContact(const ShapeInterface *pActor, const PolygonShape *pRoom, RoomContactSpec &pAnswer);
86 
87 BOOL MR_DllDeclare GetActorForceLongitude(const ShapeInterface *pActor, const ShapeInterface *pObstacle, MR_Angle &pLongitude);
88 BOOL MR_DllDeclare GetFeatureForceLongitude(const ShapeInterface *pActor, const PolygonShape *pFeature, MR_Angle &pLongitude);
89 BOOL MR_DllDeclare GetWallForceLongitude(const ShapeInterface *pActor, const PolygonShape *pRoom, int pWallIndex, MR_Angle &pLongitude);
90 
91 } // namespace Model
92 } // namespace HoverRace
93 
94 #undef MR_DllDeclare
BOOL GetActorForceLongitude(const ShapeInterface *pActor, const ShapeInterface *pObstacle, MR_Angle &pLongitude)
Definition: ShapeCollisions.cpp:156
Definition: ShapeCollisions.h:61
MR_Int32 mZMax
Definition: ShapeCollisions.h:64
MR_Int32 mDistanceFromCeiling
Definition: ShapeCollisions.h:74
Definition: WorldCoordinates.h:46
BOOL GetWallForceLongitude(const ShapeInterface *, const PolygonShape *pRoom, int pWallIndex, MR_Angle &pLongitude)
Definition: ShapeCollisions.cpp:228
Definition: Shapes.h:50
MR_Int16 MR_Angle
Definition: WorldCoordinates.h:96
MR_Int32 mDistanceFromFloor
Definition: ShapeCollisions.h:73
void DetectRoomContact(const ShapeInterface *pActor, const PolygonShape *pRoom, RoomContactSpec &pAnswer)
Definition: ShapeCollisions.cpp:123
BOOL DetectFeatureContact(const ShapeInterface *pActor, const PolygonShape *pFeature, ContactSpec &pAnswer)
Definition: ShapeCollisions.cpp:118
int32_t MR_Int32
Definition: MR_Types.h:43
BOOL DetectActorContact(const ShapeInterface *pActor, const ShapeInterface *pObstacle, ContactSpec &pAnswer)
Definition: ShapeCollisions.cpp:113
Definition: Shapes.h:120
int mNbWallContact
Definition: ShapeCollisions.h:76
BOOL mTouchingRoom
Definition: ShapeCollisions.h:71
BOOL GetFeatureForceLongitude(const ShapeInterface *pActor, const PolygonShape *pFeature, MR_Angle &pLongitude)
Definition: ShapeCollisions.cpp:168
Definition: Announcement.h:24
Definition: ShapeCollisions.h:67
MR_Int32 mZMin
Definition: ShapeCollisions.h:63
BOOL GetPolygonInclusion(const PolygonShape &pPolygon, const MR_2DCoordinate &pPosition)
Definition: ShapeCollisions.cpp:77
#define MR_DllDeclare
Definition: ShapeCollisions.h:34