Descent3/lib/game2dll.h

95 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"
2024-04-16 18:56:40 +00:00
typedef struct {
bool is_banned;
int team;
2024-04-16 03:43:29 +00:00
} tPreJoinData;
2024-04-16 18:56:40 +00:00
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;
2024-04-16 03:43:29 +00:00
} dllinfo;
2024-04-16 18:56:40 +00:00
#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];
2024-04-16 03:43:29 +00:00
} tDLLOptions;
extern dllinfo DLLInfo;
// The chokepoint function to call the dll function
2024-04-16 18:56:40 +00:00
void CallGameDLL(int eventnum, dllinfo *data);
2024-04-16 03:43:29 +00:00
// Frees the dll if its in memory
2024-04-16 18:56:40 +00:00
void FreeGameDLL();
2024-04-16 03:43:29 +00:00
// Loads the game dll. Returns 1 on success, else 0 on failure
2024-04-16 18:56:40 +00:00
int LoadGameDLL(char *name, int num_teams_to_use = -1);
2024-04-16 03:43:29 +00:00
// 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
2024-04-16 18:56:40 +00:00
void DLLFatalError(char *reason = NULL);
2024-04-16 03:43:29 +00:00
// Call this function right after a player connects to the game to see if a player is banned
2024-04-16 18:56:40 +00:00
bool GameDLLIsAddressBanned(network_address *addr, char *tracker_id);
2024-04-16 03:43:29 +00:00
// Call this function to get information/options from a unloaded mod
2024-04-16 18:56:40 +00:00
bool GetDLLGameInfo(char *name, tDLLOptions *options);
2024-04-16 03:43:29 +00:00
// 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.
2024-04-16 18:56:40 +00:00
bool GetDLLNumTeamInfo(char *name, int *mint, int *maxt);
2024-04-16 03:43:29 +00:00
// 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.
2024-04-16 18:56:40 +00:00
int GetDLLRequirements(char *name, char *requirements, int buflen);
2024-04-16 03:43:29 +00:00
#endif