Descent3/lib/game2dll.h

99 lines
3.0 KiB
C
Raw Normal View History

2024-04-16 03:43:29 +00:00
#ifndef GAME2DLL_H
#define GAME2DLL_H
#include "pstypes.h"
#include "multi.h"
#include "d3events.h"
#include "vecmat.h"
typedef struct
{
bool is_banned;
int team;
} tPreJoinData;
typedef struct
{
vector point,normal;
float hitspeed, hit_dot;
int hitseg, hitwall;
}game_collide_info;
typedef struct
{
int me_handle;
int it_handle;
ubyte *special_data;
char *input_string;
int input_key;
union{
int iRet;
float fRet;
};
float fParam;
int iParam;
game_collide_info collide_info;
int newseg,oldseg;
} dllinfo;
#define MAX_GAMENAME_LEN 32
#define MAX_REQUIREMENT_LEN 384
#define DOF_MAXTEAMS 0x0001 //max_teams member is valid
#define DOF_MINTEAMS 0x0002
//this struct is used to return game specific information to Descent 3
typedef struct
{
//general flags, also specifies what members of the structure are valid
int flags;
//0 or 1 for non-team games...maximum value is 4. If not specified, than it is assumed 0
int max_teams;
//must be less then or equal to max_teams. If not specified, then it is assumed 0 for
//non-team games, 2 for team games. (max_teams will always tell you if it's a team game)
int min_teams;
//gives the full name of the game (must be set)
char game_name[MAX_GAMENAME_LEN];
//this is an array of semicolor seperated 'string identifiers' that serve as requirements
//the mission needs to support in order for it to be playable with the game.
//this parameter must be set (even it is just a '\0' for the first character..aka no requirements)
char requirements[MAX_REQUIREMENT_LEN];
} tDLLOptions;
extern dllinfo DLLInfo;
// The chokepoint function to call the dll function
void CallGameDLL (int eventnum,dllinfo *data);
// Frees the dll if its in memory
void FreeGameDLL ();
// Loads the game dll. Returns 1 on success, else 0 on failure
int LoadGameDLL (char *name,int num_teams_to_use=-1);
// If this function is called than the DLL is to be closed, because there was an error running it
// if reason is not NULL than that is the reason why
void DLLFatalError(char *reason=NULL);
// Call this function right after a player connects to the game to see if a player is banned
bool GameDLLIsAddressBanned(network_address *addr,char *tracker_id);
// Call this function to get information/options from a unloaded mod
bool GetDLLGameInfo(char *name,tDLLOptions *options);
// Call this function to get information about the number of teams for the game
// Returns true if it's a team game...false if it's a non-team game.
// If it returns true, then min is filled in with the minumum number of teams needed for the game
// and max is filled in with the maximum number of teams for the game...if they are the same
// value, then it is the only number of teams supported.
bool GetDLLNumTeamInfo(char *name,int *mint,int *maxt);
// Call this function to get the list of requirements that the given module needs in order
// to be playable. Returns the number of requirements it needs...-1 on error.
int GetDLLRequirements(char *name,char *requirements,int buflen);
#endif