| | 1 | #ifndef _dynamics_h_ /* KJL 17:23:01 11/05/96 - is this your first time? */ |
| | 2 | #define _dynamics_h_ 1 |
| | 3 | |
| | 4 | #include "particle.h" |
| | 5 | |
| | 6 | /*KJL************************************************************************ |
| | 7 | * DYNAMICS.H * |
| | 8 | * - this file contains prototypes for the functions in dynamics.c * |
| | 9 | * which can be called externally. * |
| | 10 | ************************************************************************KJL*/ |
| | 11 | |
| | 12 | struct ColPolyTag |
| | 13 | { |
| | 14 | int NumberOfVertices; |
| | 15 | VECTORCH PolyPoint[4]; |
| | 16 | VECTORCH PolyNormal; |
| | 17 | DISPLAYBLOCK *ParentObject; |
| | 18 | }; |
| | 19 | |
| | 20 | #define GRAVITY_STRENGTH 25000 |
| | 21 | #define TIME_BEFORE_GRAVITY_KICKS_IN 16384 |
| | 22 | #define MAXIMUM_STEP_HEIGHT 450 |
| | 23 | |
| | 24 | extern int **ItemArrayPtr; |
| | 25 | extern POLYHEADER *PolyheaderPtr; |
| | 26 | extern VECTORCH *ShapePointsPtr; |
| | 27 | extern char ShapeIsMorphed; |
| | 28 | extern int *ShapeNormalsPtr; |
| | 29 | extern int *Shape2NormalsPtr; |
| | 30 | extern MORPHDISPLAY MorphDisplay; |
| | 31 | |
| | 32 | int SetupPolygonAccessFromShapeIndex(int shapeIndex); |
| | 33 | extern void InitialiseDynamicsBlocks(); |
| | 34 | extern void ObjectDynamics(); |
| | 35 | extern void DynamicallyRotateObject(DYNAMICSBLOCK *dynPtr); |
| | 36 | extern int ParticleDynamics(PARTICLE *particlePtr, VECTORCH *obstacleNormalPtr, int *moduleIndexPtr); |
| | 37 | extern void AddEffectsOfForceGenerators(VECTORCH *positionPtr, VECTORCH *impulsePtr, int mass); |
| | 38 | extern void MovePlatformLift(STRATEGYBLOCK *sbPtr); |
| | 39 | |
| | 40 | #define GetPolygonVertices(polyPtr)\ |
| | 41 | {\ |
| | 42 | int *vertexNumberPtr = &PolyheaderPtr->Poly1stPt;\ |
| | 43 | \ |
| | 44 | (polyPtr)->PolyPoint[0] = *(ShapePointsPtr + *vertexNumberPtr++);\ |
| | 45 | (polyPtr)->PolyPoint[1] = *(ShapePointsPtr + *vertexNumberPtr++);\ |
| | 46 | (polyPtr)->PolyPoint[2] = *(ShapePointsPtr + *vertexNumberPtr++);\ |
| | 47 | \ |
| | 48 | if (*vertexNumberPtr != -1)\ |
| | 49 | {\ |
| | 50 | (polyPtr)->PolyPoint[3] = *(ShapePointsPtr + *vertexNumberPtr);\ |
| | 51 | (polyPtr)->NumberOfVertices=4; \ |
| | 52 | }\ |
| | 53 | else\ |
| | 54 | {\ |
| | 55 | (polyPtr)->NumberOfVertices=3; \ |
| | 56 | }\ |
| | 57 | } |
| | 58 | #define GetPolygonNormal(polyPtr)\ |
| | 59 | { \ |
| | 60 | if (ShapeIsMorphed)\ |
| | 61 | {\ |
| | 62 | VECTORCH n1Ptr = *(VECTORCH*)(ShapeNormalsPtr + PolyheaderPtr->PolyNormalIndex);\ |
| | 63 | VECTORCH n2Ptr = *(VECTORCH*)(Shape2NormalsPtr + PolyheaderPtr->PolyNormalIndex);\ |
| | 64 | \ |
| | 65 | if( ((n1Ptr.vx == n2Ptr.vx)\ |
| | 66 | && (n1Ptr.vy == n2Ptr.vy)\ |
| | 67 | && (n1Ptr.vz == n2Ptr.vz))\ |
| | 68 | || (MorphDisplay.md_lerp == 0) )\ |
| | 69 | {\ |
| | 70 | (polyPtr)->PolyNormal = n1Ptr;\ |
| | 71 | }\ |
| | 72 | else if(MorphDisplay.md_lerp == 0xffff)\ |
| | 73 | {\ |
| | 74 | (polyPtr)->PolyNormal = n2Ptr;\ |
| | 75 | }\ |
| | 76 | else\ |
| | 77 | {\ |
| | 78 | VECTORCH *pointPtr[3];\ |
| | 79 | int *vertexNumPtr = &PolyheaderPtr->Poly1stPt;\ |
| | 80 | \ |
| | 81 | pointPtr[0] = (ShapePointsPtr + *vertexNumPtr++);\ |
| | 82 | pointPtr[1] = (ShapePointsPtr + *vertexNumPtr++);\ |
| | 83 | pointPtr[2] = (ShapePointsPtr + *vertexNumPtr);\ |
| | 84 | \ |
| | 85 | MakeNormal\ |
| | 86 | (\ |
| | 87 | pointPtr[0],\ |
| | 88 | pointPtr[1],\ |
| | 89 | pointPtr[2],\ |
| | 90 | &(polyPtr)->PolyNormal\ |
| | 91 | );\ |
| | 92 | }\ |
| | 93 | }\ |
| | 94 | else /* not morphed */\ |
| | 95 | {\ |
| | 96 | (polyPtr)->PolyNormal = *(VECTORCH*)(ShapeNormalsPtr + PolyheaderPtr->PolyNormalIndex);\ |
| | 97 | }\ |
| | 98 | } |
| | 99 | #endif |