179 lines
3.6 KiB
C
179 lines
3.6 KiB
C
|
#ifndef __GAMEINITEXIT
|
||
|
#define __GAMEINITEXIT
|
||
|
|
||
|
#include "vectors.h"
|
||
|
#include "entities.h"
|
||
|
#include "fileio.h"
|
||
|
|
||
|
#define kMaxPlayers 12
|
||
|
#define kMaxLaps 100
|
||
|
#define kNumCheckPoints 64
|
||
|
#define kMaxCornerSigns 64
|
||
|
|
||
|
typedef struct{
|
||
|
tFileRef model;
|
||
|
int color;
|
||
|
int envFlags;
|
||
|
int untouchable;
|
||
|
tVector3 pos,dir;
|
||
|
}tMapObjectDef;
|
||
|
|
||
|
typedef struct{
|
||
|
float time;
|
||
|
tGameEntity *setBy;
|
||
|
int hit;
|
||
|
}tPassTimeRec;
|
||
|
|
||
|
typedef struct{
|
||
|
float index;
|
||
|
tPassTimeRec passTimes[kMaxLaps+2];
|
||
|
}tCheckPoint;
|
||
|
|
||
|
typedef struct{
|
||
|
float pos;
|
||
|
float accel;
|
||
|
}tCornerSign;
|
||
|
|
||
|
typedef struct{
|
||
|
tVector3 a,b,c;
|
||
|
}tVisWall;
|
||
|
|
||
|
typedef struct{
|
||
|
int envFlags;
|
||
|
int lightEnable;
|
||
|
float fogBegin,fogEnd;
|
||
|
float fogOscillation,fogOscillationSpeed;
|
||
|
tVector3 fogColor;
|
||
|
tVector3 lightDir,flareDir;
|
||
|
tFileRef sky0,sky90,sky180,sky270,skytop,skybot;
|
||
|
tFileRef spheremap;
|
||
|
tFileRef lightMap;
|
||
|
tVector2 lightMapTopLeft,lightMapBotRight,lightMapSpeed;
|
||
|
tFileRef lightMap2;
|
||
|
tVector2 lightMap2TopLeft,lightMap2BotRight,lightMap2Speed;
|
||
|
}tMapEnv;
|
||
|
|
||
|
typedef struct{
|
||
|
tFileRef road;
|
||
|
tFileRef image;
|
||
|
int loop,dirtEnable;
|
||
|
int hideMap;
|
||
|
int dontDrawRoad;
|
||
|
int builtIn;
|
||
|
int demoAvailable;
|
||
|
int needsToStop;
|
||
|
int useAltEnv;
|
||
|
tFileRef dirtMap;
|
||
|
int maxPlayers;
|
||
|
int hasOverview;
|
||
|
tFileRef overview;
|
||
|
tVector2 overviewTopLeft,overviewBotRight;
|
||
|
|
||
|
char name[256];
|
||
|
int playerPos;
|
||
|
int reverse;
|
||
|
float startLineOffset,startCenterOffset,carOffset;
|
||
|
float speedFactor;
|
||
|
float dirtIntensity;
|
||
|
tVector3 startPos;
|
||
|
tVector3 finishPos;
|
||
|
tFileRef roadTypes;
|
||
|
int numObjs;
|
||
|
tMapObjectDef *obj;
|
||
|
int numVisWalls;
|
||
|
int baseSurfaceType;
|
||
|
tVisWall *visWalls;
|
||
|
int numMapEnvs;
|
||
|
tMapEnv* mapEnv;
|
||
|
}tMapInfo;
|
||
|
|
||
|
enum {
|
||
|
kGameInfoNetworkEnable=1<<0,
|
||
|
kGameInfoNetworkForcePlayerCar=1<<1,
|
||
|
kGameInfoNetworkCantGoBackwards=1<<2
|
||
|
};
|
||
|
|
||
|
#define kMaxNameLength 64
|
||
|
|
||
|
enum {
|
||
|
kGameModeSim=0,
|
||
|
kGameModeArcade,
|
||
|
kGameModeTurbo,
|
||
|
kGameModeStrict
|
||
|
};
|
||
|
|
||
|
typedef struct{
|
||
|
UInt8 inited;
|
||
|
UInt8 numNetPlayers;
|
||
|
UInt8 numPlayers;
|
||
|
UInt8 reverse;
|
||
|
SInt8 numLaps;
|
||
|
UInt8 network;
|
||
|
UInt8 playerID;
|
||
|
SInt8 arcade;
|
||
|
UInt8 carsOnSpeed;
|
||
|
UInt8 demolition;
|
||
|
UInt8 unused1;
|
||
|
UInt8 unused2;
|
||
|
float maxTime,silverTime,goldTime;
|
||
|
UInt32 version;
|
||
|
tFileRef map;
|
||
|
tFileRef environment;
|
||
|
char environmentName[kMaxFileNameLength];
|
||
|
char mapName[kMaxFileNameLength];
|
||
|
UInt8 playerColors[kMaxPlayers];
|
||
|
SInt8 netID[kMaxPlayers];
|
||
|
tFileRef playerCars[kMaxPlayers];
|
||
|
int playerAddOns[kMaxPlayers];
|
||
|
float ping[kMaxPlayers];
|
||
|
UInt8 playerInited[kMaxPlayers];
|
||
|
int playerVersions[kMaxPlayers];
|
||
|
char playerCarNames[kMaxPlayers][kMaxFileNameLength];
|
||
|
char playerNames[kMaxPlayers][kMaxNameLength];
|
||
|
}tGameInfo;
|
||
|
|
||
|
typedef struct{
|
||
|
UInt8 inited;
|
||
|
UInt8 numNetPlayers;
|
||
|
UInt8 numPlayers;
|
||
|
UInt8 reverse;
|
||
|
SInt8 numLaps;
|
||
|
UInt8 network;
|
||
|
SInt8 arcade;
|
||
|
UInt8 carsOnSpeed;
|
||
|
UInt8 demolition;
|
||
|
UInt32 version;
|
||
|
char environmentName[kMaxFileNameLength];
|
||
|
char mapName[kMaxFileNameLength];
|
||
|
UInt8 playerColors[kMaxPlayers];
|
||
|
SInt8 netID[kMaxPlayers];
|
||
|
int playerAddOns[kMaxPlayers];
|
||
|
float ping[kMaxPlayers];
|
||
|
UInt8 playerInited[kMaxPlayers];
|
||
|
int playerVersions[kMaxPlayers];
|
||
|
char playerCarNames[kMaxPlayers][kMaxFileNameLength];
|
||
|
char playerNames[kMaxPlayers][kMaxNameLength];
|
||
|
}tNetGameInfo;
|
||
|
|
||
|
extern tMapInfo *gMapInfo;
|
||
|
extern tMapEnv *gMapEnv;
|
||
|
extern tGameInfo *gGameInfo;
|
||
|
extern int gReplay;
|
||
|
extern int gBackgroundReplay;
|
||
|
extern int gReplayAutoCam;
|
||
|
extern int gReplayViewedEntityID;
|
||
|
extern tGameEntity *gCarEntities[kMaxPlayers];
|
||
|
extern tGameEntity *gGhostEntity;
|
||
|
extern tCheckPoint gCheckPoints[kNumCheckPoints];
|
||
|
extern int gNumCornerSigns;
|
||
|
extern tCornerSign gCornerSigns[kMaxCornerSigns];
|
||
|
extern int gReplayOldFrameCount;
|
||
|
|
||
|
void InitGInfo(tGameInfo *gInfo);
|
||
|
int RunGame(tGameInfo *gInfo);
|
||
|
|
||
|
void StartReplay();
|
||
|
void RunReplay();
|
||
|
int ReplayFrame();
|
||
|
|
||
|
#endif
|