Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

Gplayer.h

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  GPlayer.h                                                                           */
00003 /*                                                                                      */
00004 /*  Author: John Pollard                                                                */
00005 /*  Description:                                                                        */
00006 /*                                                                                      */
00007 /*  Copyright (c) 1997, 1999, Eclipse Entertainment; All rights reserved.               */
00008 /*                                                                                      */
00009 /*  See the accompanying file LICENSE.TXT for terms on the use of this library.         */
00010 /*  This library is distributed in the hope that it will be useful but WITHOUT          */
00011 /*  ANY WARRANTY OF ANY KIND and without any implied warranty of MERCHANTABILITY        */
00012 /*  or FITNESS FOR ANY PURPOSE.  Refer to LICENSE.TXT for more details.                 */
00013 /*                                                                                      */
00014 /****************************************************************************************/
00015 #ifndef GPLAYER_H
00016 #define GPLAYER_H
00017 
00018 #include "Genesis.h"
00019 
00020 #include "GenVSI.h"
00021 
00022 #define MAX_CLASS_NAME_SIZE                     32
00023 #define MAX_PLAYER_ITEMS                        32
00024 
00025 #define CONTROL_INDEX_NONE                      0xffff
00026 #define TRIGGER_INDEX_NONE                      0xffff
00027 #define VIEW_INDEX_NONE                         0xffff
00028 #define MOTION_INDEX_NONE                       0xff
00029 
00030 #define DAMMAGE_TYPE_NONE                       (0<<0)
00031 #define DAMMAGE_TYPE_NORMAL                     (1<<0)
00032 #define DAMMAGE_TYPE_RADIUS                     (1<<1)
00033 //===========================================================================
00034 //===========================================================================
00035 typedef enum
00036 {
00037         MODE_Authoritive,
00038         MODE_Proxy,
00039         MODE_Dumb
00040 } GPlayer_Mode;
00041 
00042 // NOTE - You cannot go over 255 enums, cause network code converts this to a byte when sending...
00043 typedef enum
00044 {
00045         // For clients, etc...
00046         PSTATE_Normal = 0,
00047         PSTATE_InAir,
00048         PSTATE_InLava,
00049         PSTATE_InWater,
00050         PSTATE_Running,
00051         PSTATE_Dead,
00052         PSTATE_DeadOnGround,
00053 
00054         // For Doors, etc...
00055         PSTATE_Closed,
00056         PSTATE_Opened,
00057 
00058         // Turret
00059         PSTATE_LookLeft,
00060         PSTATE_LookRight,
00061         PSTATE_LookUp,
00062         PSTATE_LookDown,
00063 
00064 } GPlayer_PState;
00065 
00066 #define NULL_BONE_INDEX                         255
00067 #define GPLAYER_MAX_XFORM_DATA          5
00068 
00069 typedef struct
00070 {
00071         geXForm3d       XForm;
00072         uint8           BoneIndex;                                      // 255 = NULL bone index (root)
00073 } GPlayer_XFormData;
00074 
00075 #define GPLAYER_MAX_MOTION_DATA         5
00076 
00077 typedef struct
00078 {
00079         float           MotionTime;
00080         uint8           MotionIndex;
00081 } GPlayer_MotionData;
00082 
00083 //===========================================================================
00084 //===========================================================================
00085 typedef struct GPlayer                  GPlayer;
00086 
00087 typedef geBoolean       GPlayer_Control(GenVSI *VSI, void *PlayerData, float TimeElapsed);
00088 typedef geBoolean       GPlayer_Trigger(GenVSI *VSI, void *PlayerData, GPlayer *Target, void* data);
00089 typedef geBoolean       GPlayer_Blocked(GenVSI *VSI, void *PlayerData, GPlayer *Target);
00090 
00091 //===========================================================================
00092 //===========================================================================
00093 typedef struct GPlayer
00094 {
00095         geBoolean                       Active;
00096         geBoolean                       JustSpawned;                            // only true until first update.
00097 
00098         GPlayer_Mode            Mode;                                           // Role on this machine
00099         GPlayer_Mode            RemoteMode;                                     // If on the server, the roll of the same player on the clients
00100                                                                                                         // If on the clients, the role of this same player on the server
00101 
00102         char                            ClassName[MAX_CLASS_NAME_SIZE];
00103 
00104         float                           Time;
00105         float                           UpdateTime;                                     // Clients use this to mark what players have been updated...
00106         
00107         // Callback functions
00108         GPlayer_Control         *Control;
00109         GPlayer_Trigger         *Trigger;
00110         GPlayer_Trigger         *StandOn;
00111         GPlayer_Blocked         *Blocked;
00112 
00113         struct GPlayer          *Owner;                                         // Player that spawned this player
00114 
00115         float                           PingTime;
00116 
00117         int32                           Score;
00118         int32                           Health;
00119 
00120         // Special old flags used on client side only to see what changed on his end...
00121         uint16                          OldViewIndex2;                          // *Index of what mesh/model to use in client/server mesh list
00122         uint16                          OldViewFlags2;                          // *View flags
00123         float                           OldScale2;                                      // *
00124 
00125 //=============================================
00126         // ** DO NOT USE (Internal use only) **
00127 
00128         float                           OldSpawnTime;                           // When client spawned this player
00129         uint16                          OldViewFlags;                           // *View flags
00130         uint16                          OldViewIndex;                           // *Index of what mesh/model to use in client/server mesh list
00131         uint8                           OldMotionIndex;                         // *
00132         uint16                          OldFxFlags;                                     //
00133         uint16                          OldDammageFlags;                        //
00134         geVec3d                         OldPos;
00135         geVec3d                         OldAngles;                                      // *Euler angles for passing across network
00136         float                           OldFrameTime;                           // *Frame number
00137         float                           OldScale;                                       // *
00138         geVec3d                         OldVelocity;                            // Movement Velocity
00139         GPlayer_PState          OldState;
00140         uint16                          OldControlIndex;
00141         uint16                          OldTriggerIndex;
00142 
00143         geVec3d                         OldMins;                                        // Mins of player
00144         geVec3d                         OldMaxs;                                        // Maxs of player
00145 
00146         geVec3d                         Pos;
00147         geVec3d                         Angles; 
00148 //=============================================
00149         // ** Data sent across network **
00150         float                           SpawnTime;                                      // When client spawned this player
00151         uint16                          ViewFlags;                                      // View flags
00152         uint16                          ViewIndex;                                      // Index of what mesh/model to use in client/server mesh list
00153         uint8                           MotionIndex;                            //
00154         uint16                          FxFlags;                                        //
00155         uint16                          DammageFlags;                           //
00156 
00157         geXForm3d                       XForm;                                          
00158 
00159         float                           FrameTime;                                      // Frame number
00160         float                           Scale;          
00161         geVec3d                         Velocity;                                       // Movement Velocity
00162         GPlayer_PState          State;
00163         uint16                          ControlIndex;
00164         uint16                          TriggerIndex;
00165 
00166         geVec3d                         Mins;                                           // Mins of player
00167         geVec3d                         Maxs;                                           // Maxs of player
00168 //=============================================
00169 
00170         // Data used for local AI/etc only 
00171         geVec3d                         LastGoodPos;
00172 
00173         float                           NextThinkTime;
00174         float                           Roll;
00175 
00176         uint32                          Mask;                                                   // For GenVSI_GetNextPlayer.. functions
00177 
00178         // Inventory
00179         uint8                           InventoryHas[MAX_PLAYER_ITEMS]; // If player has item
00180         int32                           Inventory[MAX_PLAYER_ITEMS];    // Amount of item
00181 
00182         // Weapon data 
00183         int16                           CurrentWeapon;                                  // Offset into inventory slot
00184         float                           NextWeaponTime;
00185 
00186         // Gun offset (Note - This variable is hacked and NOT sent accross network.
00187         // Both the client and the server just set it to the same number (FIXTHIS!!!!)
00188         geVec3d                         GunOffset;
00189 
00190         // Server side ONLY.  Used for determining the vis pos of the player (for vis culling while sending data across network)
00191         geVec3d                         VPos;
00192 
00193         struct GPlayer          *Weapon;                                        // Current Weapon, Hack till we find a better way to do auto firing weapons
00194 
00195         GenVSI_CHandle          ClientHandle;                           // == -1 if does not belong to a client
00196 
00197         void                            *ClassData;
00198         void                            *userData;
00199 
00200         //==
00201 
00202         // For client rendering, etc...
00203         geMesh                          *Mesh;
00204         geActor                         *Actor;
00205         geActor_Def                     *ActorDef;
00206         geLight                         *Light;
00207         geWorld_Model           *Model;
00208         gePoly                          *Poly;
00209         
00210         GenVSI_DestroyFunc      *DFunc;
00211 
00212         // Hack for now, till we get a better way to add stuff to the net traffic dynamically...
00213         int32                           NumXFormData;
00214         GPlayer_XFormData       XFormData[GPLAYER_MAX_XFORM_DATA];
00215 
00216         int32                           NumMotionData;
00217         GPlayer_MotionData      MotionData[GPLAYER_MAX_MOTION_DATA];
00218 
00219 } GPlayer;
00220 
00221 #endif

Generated on Tue Sep 30 12:35:54 2003 for GTestAndEngine by doxygen 1.3.2