/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
--- HISTORICAL COMMENTS FOLLOW ---
* $Logfile: /DescentIII/main/idmfc.h $
* $Revision: 1.1.1.1 $
* $Date: 2003/08/26 03:56:29 $
* $Author: kevinb $
*
* DMFC COM Interface header
*
* $Log: idmfc.h,v $
* Revision 1.1.1.1 2003/08/26 03:56:29 kevinb
* initial 1.5 import
*
*
* 33 11/10/99 3:03p Jeff
* fixed c interface for register packet receiver
*
* 32 8/15/99 4:36p Jeff
* finished exporting all inventory class functions. export object_info
* array. added check for -nooutragelogo to display Outrage logo display.
*
* 31 8/11/99 1:46p Jeff
* interface functions
*
* 30 8/11/99 1:22p Jeff
* exported needed functions for camera windows
*
* 29 7/16/99 2:43p Jeff
* changed CreateMenuItemWArgs function
*
* 28 7/13/99 5:38p Jeff
* fixes for Linux compile
*
* 27 7/13/99 10:03a Jeff
* text taunt token decoding
*
* 26 7/11/99 3:32p Jeff
* exported game arguments, made command line option to specify
* autoexec.dmfc
*
* 25 7/09/99 7:02p Jeff
* put in countdown timer for when a level is about to end
*
* 24 7/09/99 2:53p Jeff
* handle gametime better (pause it when needed) if the server is 'waiting
* for players'
*
* 23 7/08/99 9:56p Jeff
* added event handler for weapon fired event
*
* 22 7/08/99 6:25p Jeff
* remote admin in and working
*
* 21 7/07/99 5:00p Jeff
* removed vararg functions from interface functions, just made different
* versions of them
*
* 20 7/07/99 12:16p Jeff
* all mangles symbol names fixed. Finished making interface functions.
*
* 19 7/06/99 7:37p Jeff
* added IDMFC 1.0 interface functions
*
* 18 6/10/99 11:10a Jeff
* don't display the Outrage logo for non-Outrage games
*
* 17 5/22/99 1:12a Jeff
* correctly handle Viewer_object
*
* 16 5/12/99 11:04p Jeff
* dmfc and multiplayer games now have endian friendly packets (*whew*)
*
* 15 5/09/99 6:20a Jeff
* improved Entropy (added sounds, max virii per room). Fixed rendering
* bugs for other multiplayer dlls.
*
* 14 5/08/99 11:06a Jeff
*
* 13 5/07/99 12:52p Jeff
* audio taunt icon is ppic if available. coop has hard max team set of 4
*
* 12 5/02/99 8:40a Jeff
* fixed syntax error
*
* 11 4/30/99 10:52p Jeff
* added $warp command
*
* 10 4/30/99 7:36p Jeff
* exported vis_effects to dmfc
*
* 9 4/14/99 3:56a Jeff
* fixed case mismatch in #includes
*
* 8 4/04/99 4:55p Jeff
* added functionality to call osiris functions from multiplayer d3ms
*
* 7 3/30/99 9:01p Jeff
* exported polymodels
*
* 6 3/30/99 7:42p Jeff
* fixed a misspelling on a function name
*
* 5 3/22/99 6:21p Jeff
* added 2 more audio taunts. a mulitplayer event when someone plays an
* audio taunt. option to disable audio taunts.
*
* 4 3/22/99 5:51p Matt
* Removed some includes from one file and added some to other files, to
* reduce the amount of rebuilding when headers change.
*
* 3 3/22/99 1:55p Jeff
* make sure initialization happens (possible crashing)
*
* 2 3/17/99 12:23p Jeff
* converted DMFC to be COM interface
*
* 1 3/17/99 11:54a Jeff
*
* $NoKeywords: $
*/
#ifndef __IDMFC_H_
#define __IDMFC_H_
#include
#include
#include
#include "gamedll_header.h"
#include "DMFC.h"
#include "controls.h"
#include "Mission.h"
#include "weapon.h"
#include "player.h"
#include "ship.h"
#include "vclip.h"
#ifdef __cplusplus
// C++ compiler, should we use classes?
#define USECLASSES
#endif
#ifdef USECLASSES
class IDMFC;
class IMenuItem;
class IDmfcStats;
#else
typedef void IDMFC;
typedef void IMenuItem;
typedef void IDmfcStats;
#endif
#ifdef USECLASSES
/*
IObject
This is the base class that all DMFC classes are derived from.
*/
class IObject {
public:
virtual ~IObject() = default;
virtual void Delete(void) = 0;
virtual void *Dynamic_Cast(const char *pszType) = 0;
virtual void DuplicatePointer(void) = 0;
virtual void DestroyPointer(void) = 0;
};
//===========================================================================================
/*
IDMFC
The interface class to Version 1.0 of DMFC
*/
class IDMFC : public IObject {
public:
// DMGFBase::LoadFunctions
//
// Initializes all the functions for a multiplayer game...must be first thing called
virtual void LoadFunctions(int *api_func) = 0;
// DMFCBase::GameInit
//
// Sets up all the DLL functions and pointers and preps the class for use. This ABSOLUTLY must be
// called, so if you override DMFCApp::GameInit, make sure that you put a call to this somewhere in
// the override.
virtual void GameInit(int teams) = 0;
// DMFCBase::GameClose
//
// Closes up any needed DLL and DMFC tasks. This ABSOLUTLY must be called, so if you override
// DMFCApp::GameClose, make sure that you put a call to this somewhere in the override
virtual void GameClose(void) = 0;
// ###################Server Only functions################################
// DMFCBase::OnServerPlayerKilled
//
// Event handler for when a player gets killed, either by another player or some other way
// killer_obj = object pointer to the object that killed the player
// victim_pnum = player number of the player that got killed
virtual void OnServerPlayerKilled(object *killer_obj, int victim_pnum) = 0;
// DMFCBase::OnServerPlayerExploded
//
// Event handler for when a player explodes. Gets called after a EVT_GAMEPLAYERKILLED event.
// player_num = player number of the player exploding
virtual void OnServerPlayerExploded(int player_num) = 0;
// DMFCBase::OnServerCollide
//
// Event handler for when two objects collide. At least one of the two objects is a player or a robot.
// Be aware that this event will be called twice per collision, the second time it is called the me and
// it objects will be flipped.
// me_obj = object pointer to the me object
// it_obj = object pointer to the it object
virtual void OnServerCollide(object *me_obj, object *it_obj) = 0;
virtual void OnServerCollide(object *me_obj, object *it_obj, vector *point, vector *normal) = 0;
// DMFCBase::OnServerPlayerChangeSegment
//
// Event handler for when a player changes rooms or a "large" terrain cell
// (8x8 Terrain block).
// player_num = player number of the player who just changed the room/segment
// newseg = New room/cell location
// oldseg = Old room/cell location
virtual void OnServerPlayerChangeSegment(int player_num, int newseg, int oldseg) = 0;
// DMFCBase::OnServerObjectChangeSegment (Only called if server tells client to execute)
//
// Event handler for when a player changes rooms or a "large" terrain cell
// (8x8 Terrain block).
// obj = Object pointer of the object who just changed the room/segment
// newseg = New room/cell location
// oldseg = Old room/cell location
virtual void OnServerObjectChangeSegment(object *obj, int newseg, int oldseg) = 0;
// DMFCBase::OnServerPlayerEntersGame
//
// Event handler for when a player enters the game. This will only get called once per
// player, it usually gets called right after they connect to the server to start playing.
// player_num = player number of the player entering the game
virtual void OnServerPlayerEntersGame(int player_num) = 0;
// DMFCBase::OnServerPlayerDisconnect
//
// Event handler for when a player disconnects from the server.
// player_num = player number of the player that just disconnected
virtual void OnServerPlayerDisconnect(int player_num) = 0;
// DMFCBase::OnServerGameCreated
//
// Event handler when the server's game first gets started. This will only be called once
// while the server is running, and that is when the server first starts up.
virtual void OnServerGameCreated(void) = 0;
// DMFCBase::OnServerLevelChange
//
// Event handler when the server changes levels. This will get called after a level ends and a server
// is starting a new level.
virtual void OnServerLevelChange(void) = 0;
// DMFCBase::OnServerLevelStart
//
// Event handler for when a multiplayer level is starting up. This will get called right before the level
// starts.
virtual void OnServerLevelStart(void) = 0;
// DMFCBase::OnServerLevelEnd
//
// Event handler for when a multiplayer level is ending.
virtual void OnServerLevelEnd(void) = 0;
// DMFCBase::OnServerObjectShieldsChanged
//
// Event handler for when an objects shield's change
virtual void OnServerObjectShieldsChanged(object *obj, float amount) = 0;
// DMFCBase::OnServerIsAddressBanned
//
// Called by the game to determine if the given network address is banned from the game
virtual bool OnServerIsAddressBanned(network_address *addr, const char *tracker_id) = 0;
// DMFCBase::OnServerWallCollide
//
// Called by the game when their is a collision between an object and a wall
virtual void OnServerWallCollide(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt,
vector *wall_normal, float hit_dot) = 0;
// DMFCBase::OnServerObjectKilled
//
// Called when an object is being killed
// Not automatically sent to clients (OnClientObjectKilled)
// killer might not be valid (NULL)
virtual void OnServerObjectKilled(object *obj, object *killer) = 0;
// DMFCBase::OnServerObjectDestroyed
//
// Called when an object is about to be deleted
// Not automatically sent to clients
virtual void OnServerObjectDestroyed(object *obj) = 0;
// ######################### Client allowed event handlers############################
// DMFCBase::OnClientPlayerKilled (Only called if server tells client to execute)
//
// Event handler for when a player gets killed, either by another player or some other way.
// killer_obj = object pointer to the object that killed the player
// victim_pnum = player number of the player that got killed
virtual void OnClientPlayerKilled(object *killer_obj, int victim_pnum) = 0;
// DMFCBase::OnClientPlayerExploded (Only called if server tells client to execute)
//
// Event handler for when a player explodes. Gets called after a EVT_GAMEPLAYERKILLED event.
// player_num = player number of the player exploding
virtual void OnClientPlayerExploded(int player_num) = 0;
// DMFCBase::OnClientCollide (Only called if server tells client to execute)
//
// Event handler for when two objects collide. At least one of the two objects is a player or a robot.
// Be aware that this event will be called twice per collision, the second time it is called the me and
// it objects will be flipped.
// ALSO NOTE: In order for the OnClientCollide() that passes the point and normal to have valid values
// the server must pass true to the parameter to send arguments in CallClientEvent().
// me_obj = object pointer to the me object
// it_obj = object pointer to the it object
virtual void OnClientCollide(object *me_obj, object *it_obj) = 0;
virtual void OnClientCollide(object *me_obj, object *it_obj, vector *point, vector *normal) = 0;
// DMFCBase::OnClientPlayerChangeSegment (Only called if server tells client to execute)
//
// Event handler for when a player changes rooms or a "large" terrain cell
// (8x8 Terrain block).
// player_num = player number of the player who just changed the room/segment
// newseg = New room/cell location
// oldseg = Old room/cell location
virtual void OnClientPlayerChangeSegment(int player_num, int newseg, int oldseg) = 0;
// DMFCBase::OnClientObjectChangeSegment (Only called if server tells client to execute)
//
// Event handler for when a player changes rooms or a "large" terrain cell
// (8x8 Terrain block).
// obj = Object pointer of the object who just changed the room/segment
// newseg = New room/cell location
// oldseg = Old room/cell location
virtual void OnClientObjectChangeSegment(object *obj, int newseg, int oldseg) = 0;
// DMFCBase::OnClientPlayerEntersGame (Only called if server tells client to execute)
//
// Event handler for when a player enters the game. This will only get called once per
// player, it usually gets called right after they connect to the server to start playing.
// player_num = player number of the player entering the game
virtual void OnClientPlayerEntersGame(int player_num) = 0;
// DMFCBase::OnClientPlayerDisconnect (Only called if server tells client to execute)
//
// Event handler for when a player disconnects from the server.
// player_num = player number of the player that just disconnected
virtual void OnClientPlayerDisconnect(int player_num) = 0;
// DMFCBase::OnMeDisconnectFromServer
//
// Event handler that gets called if we disconnect from the server for some reason (not purposesly quit)
virtual void OnMeDisconnectFromServer(void) = 0;
// DMFCBase::OnClientGameCreated (Only called if server tells client to execute)
//
// Event handler when the server's game first gets started. This will only be called once
// while the server is running, and that is when the server first starts up.
virtual void OnClientGameCreated(void) = 0;
// DMFCBase::OnClientObjectShieldsChanged
//
// Event handler for when an objects shield's change
virtual void OnClientObjectShieldsChanged(object *obj, float amount) = 0;
// DMFCBase::OnWeaponFired
//
// Event handler for when an object fires a weapon
virtual void OnWeaponFired(object *weapon_obj, object *shooter) = 0;
// DMFCBase::OnClientLevelChange (Only called if server tells client to execute)
//
// Event handler when the server changes levels. This will get called after a level ends and a server
// is starting a new level.
virtual void OnClientLevelChange(void) = 0;
// DMFCBase::OnClientLevelStart (Only called if server tells client to execute)
//
// Event handler for when a multiplayer level is starting up. This will get called right before the level
// starts.
virtual void OnClientLevelStart(void) = 0;
// DMFCBase::OnClientLevelEnd (Only called if server tells client to execute)
//
// Event handler for when a multiplayer level is ending.
virtual void OnClientLevelEnd(void) = 0;
// DMFCBase::OnClientWallCollide
//
// Called by the game when their is a collision between an object and a wall
virtual void OnClientWallCollide(object *obj, float hitspeed, int hitseg, int hitwall, vector *hitpt,
vector *wall_normal, float hit_dot) = 0;
// DMFCBase::OnClientObjectKilled
//
// Called when an object is being killed
// Not automatically sent to clients (OnClientObjectKilled)
// killer might not be valid (NULL)
virtual void OnClientObjectKilled(object *obj, object *killer) = 0;
// DMFCBase::OnClientObjectDestroyed
//
// Called when an object is about to be deleted
// Not automatically sent to clients
virtual void OnClientObjectDestroyed(object *obj) = 0;
// DMFCBase::OnPlayerEntersObserver
//
// Event handler when a player becomes an observer mode
// If they are piggybacking another player than piggy is the object pointer, else it's NULL
virtual void OnPlayerEntersObserver(int pnum, object *piggy) = 0;
// DMFCBase::OnPlayerExitsObserver
//
// Event handler when a player is leaving observer mode
virtual void OnPlayerExitsObserver(int pnum) = 0;
// DMFCBase::OnCanChangeTeam
//
// Called to determine if a player can change teams, you can override this so the server won't
// let a player change teams if it is not desired (for that player)
virtual bool OnCanChangeTeam(int pnum, int newteam) = 0;
// DMFCBase::OnSpecialPacket
//
// Event handler for when a special packet arrives and needs to be processed.
// Both the server and client can get this event, although it is more common for the
// client to recieve these.
virtual void OnSpecialPacket(void) = 0;
// DMFCBase::OnInterval
//
// Event handler that gets called once a frame
virtual void OnInterval(void) = 0;
// DMFCBase::OnHUDInterval
//
// Event handler that gets called once a frame when it's time to render the HUD images
virtual void OnHUDInterval(void) = 0;
// DMFCBase::OnPLRInterval
//
// Event handler that gets called once a frame when the Post Level Results screen is being display
virtual void OnPLRInterval(void) = 0;
// DMFCBase::OnPLRInit
//
// Event handler that gets called the first frame of the PLR screen for each level
virtual void OnPLRInit(void) = 0;
// DMFCBase::OnKeypress
//
// Event handler for when a user presses a key while in the game
// key = Key code of the key being pressed
virtual void OnKeypress(int key) = 0;
// DMFCBase::OnInputString
//
// Event handler for when the user types a message at the console (F8) that begins with a $
// input_string = string that was typed
virtual void OnInputString(char *input_string) = 0;
// DMFCBase::OnPlayerChangeTeam
//
// Called when a player changes team
// if announce is true than it is a change in the middle of the game, else it's an initial assignment change
virtual void OnPlayerChangeTeam(int player_num, int newteam, bool announce, bool spew_everything) = 0;
// DMFCBase::OnGameStateRequest
//
// Server only. Override this to listen for Game state requests from the clients
// When this function is called a client (who's player number is passed in) is requesting
// game state information. Do what you need to do to send game state information to that player
virtual void OnGameStateRequest(int pnum) = 0;
// DMFCBase::OnSaveStatsToFile
//
//
// The user is requesting the game stats to be saved to file, you must handle this completly on
// the game's side, nothing is done in DMFC
virtual void OnSaveStatsToFile(void) = 0;
// DMFCBase::OnPlayerReconnect
//
//
// This player is reconnecting to the game
virtual void OnPlayerReconnect(int player_num) = 0;
// DMFCBase::OnPlayerConnect
//
//
// This player is connecting to the game for the first time
virtual void OnPlayerConnect(int player_num) = 0;
// DMFCBase::OnControlMessage
//
//
// There is a control message sent from someone
virtual void OnControlMessage(uint8_t msg, int from_pnum) = 0;
// DMFCBase::OnAllowObserverChange
//
//
// returns true if the requested change for observer mode should go through
virtual bool OnAllowObserverChange(bool turnonobserver) = 0;
// DMFCBase::OnClientShowUI
//
//
// The game is saying it's ok to do any UI. Only handle the id's that belong to you and pass the rest
// to DMFCBase::OnClientShowUI().
virtual void OnClientShowUI(int id, void *user_data) = 0;
// DMFCBase::OnPrintScores
//
//
// The user is requesting that the scores be printed out (For Dedicated Server use). Use DPrintf
// level: -1 Requesting all the available scores
// n Print only the top n scores
// Override this to how you see fit, but it should conform to the above.
virtual void OnPrintScores(int level) = 0;
// DMFCBase::OnDisconnectSaveStatsToFile
//
//
// The game should save the stats because the player (only ourself as the client in the game),
// has disconnected.
virtual void OnDisconnectSaveStatsToFile(void) = 0;
// DMFCBase::OnLevelEndSaveStatsToFile
//
//
// The game should save the "End of Level" stats to file. You must handle this completly on
// the game's side, nothing is done in DMFC
virtual void OnLevelEndSaveStatsToFile(void) = 0;
// DMFCBase::OnGetHudCallSignColor
//
// This is an event sent in by the game requesting what color it should draw the HUD callsign
// of the passed in playernum. Using GR_RGB return the color from the function. This function
// gets called every frame that the player is on the clients HUD.
virtual ddgr_color OnGetHudCallSignColor(int playernum) = 0;
// DMFCBase::TranslateEvent
//
// Translates the event passed in to handle, calls the appropriate handler function. If a function isn't
// created to handle the event, then it calls the default handler. Handler functions should call the default
// handler unless it absolutly shouldn't
virtual void TranslateEvent(int eventnum, dllinfo *data) = 0;
// DMFCBase::OnTeamChangeName
//
// This event occurs on the client when a team's name has just changed
virtual void OnTeamChangeName(int team, char *oldname, char *newname) = 0;
// DMFCBase::OnDoControls
//
// This event occurs when there is a new back of game controls data
virtual void OnDoControls(game_controls *controls) = 0;
// DMFCBase::OnPlayAudioTaunt
//
// This event occurs when a player plays an audio taunt
virtual void OnPlayAudioTaunt(int pnum) = 0;
// DMFCBase::OnGetTokenString
//
// This event occurs when a text macro is being used that has tokens
// in it, if you have a specific token, override this event to handle it.
virtual void OnGetTokenString(char *src, char *dest, int dest_size) = 0;
virtual void DrawMenu(void) = 0;
virtual void DisplayPlayerInfo(int background_bmp = -1, bool dedicated_server = false) = 0;
// DMFCBase::SwitchPlayerInfoDisplay
//
// Switches on/off displaying a Playerinfo
virtual void SwitchPlayerInfoDisplay(int pnum) = 0;
// DMFCBase::DisplayingPlayerInfo
//
// Returns the pnum of who you are currently displaying, -1 if noone
virtual int DisplayingPlayerInfo(void) = 0;
// DMFCBase::GetTeamFromString
//
// Returns the int value of a team based on a string, -1 if not a team
virtual int GetTeamFromString(char *str) = 0;
// DMFCBase::GetPlayerNum
//
// Returns your playernum, useful when finding out if an event is referring to you (by looking at
// the playernum passed to the event handler, compared to your playernum
virtual int GetPlayerNum(void) = 0;
// DMFCBase::GetLocalRole
//
// Returns your role in the multiplayer game. The result returned will be either LR_SERVER or LR_CLIENT
virtual int GetLocalRole(void) = 0;
// DMFCBase::CheckPlayerNum
//
// Returns true if the player number passed in is a valid player number (the player is connected)
virtual bool CheckPlayerNum(int player_num) = 0;
// DMFCBase::PacketCheckPlayerNum
//
// Returns true if it's ok to send a packet to this player
virtual bool PacketCheckPlayerNum(int player_num) = 0;
// DMFCBase::CallClientEvent
//
// Server Only. This will send an event to a client for it to execute.
// event = An EVT_CLIENT_*
// me_objnum,it_objnum = Object numbers of the objects to be me and it for the event
// destination = Player number of the client to send to, or -1 if to send to all
virtual void CallClientEvent(int event, int me_objnum, int it_objnum, int destination, bool parms = false) = 0;
// DMFCBase::GetTimeLeft
//
// Server Only. This will fill in the float pointer passed to it with how much time is
// left in the multiplayer game. The value placed in the float is only valid if GetTimeLeft
// returns true. If it returns false it was because either it is not a game with a time limit
// or it is being called on a client.
virtual bool GetTimeLeft(float *time) = 0;
// DMFCBase::EndLevel
//
// Server Only. This will end the current multiplayer level, and will go on to the next level.
virtual void EndLevel(void) = 0;
// DMFCBase::WarpToLevel
//
// Warps to another level in the mission. Pass a level number (1 to Current_mission.num_levels)
// It will end the level and go to that level.
virtual void WarpToLevel(int lev) = 0;
// DMFCBase::GetScoreLimit
//
// Server Only. This will fill in the int pointer passed to it with what the scoring limit
// is, set in in the multiplayer options. The value point into the int is only valid if
// GetScoreLimit returns true. If it returns false it is because you are either not the
// server or this option wasn't set in the multiplayer options
virtual bool GetScoreLimit(int *limit) = 0;
// DMFCBase::AutoTimeLimit
//
// Server Only. This turns off or on the automatic level ending by DMFC of a timed multiplayer game.
// If you turn it off, it is your responsibility to end a time multiplayer game when it's time
// is up. If it is turned on, DMFC will automatically handle ending the game. By default it is on.
virtual void AutoTimeLimit(bool turnon) = 0;
// DMFCBase::AutoDeathMessage
//
// This turns on or off DMFC's automatic handling of death messages. If it is turned on (Default)
// then when a player dies it will display a random death message from the list added by you using
// AddDeathMessage. If it is turned off, then it is your responsibility to handle the messages, you
// can use DoRandomDeathMessage to display one when appropriate.
virtual void AutoDeathMessage(bool turnon) = 0;
// DMFCBase::AddDeathMessage
//
// This will add a death message to DMFC.
// format = string in a "printf" type format (using %s for player callsigns) of the message
// victim_first = Set this to true if the victim is listed first in the format
virtual void AddDeathMessage(const char *string, bool victim_first = true) = 0;
// DMFCBase::AddSuicideMessage
//
// This will add a death message to DMFC.
// format = string in a "printf" type format (using %s for player callsigns) of the message
virtual void AddSuicideMessage(const char *string) = 0;
// DMFCBase::DoRandomDeathMessage
//
// DMFC will display a death message (or suicide message if killer and victim are the same) when
// this function is called, based on the strings added with AddDeathMessage or AddSuicideMessage.
// killernum = object number of the killer
// victimnum = object number of the victim
// hash = hash index of the weapon killer, -1 if none
virtual void DoRandomDeathMessage(int killernum, int victimnum, uint32_t hash = -1) = 0;
// DMFCBase::GetItObjNum
//
// Returns the it object number of the current event for use.
virtual int GetItObjNum(void) = 0;
// DMFCBase::GetMeObjNum
//
// Returns the me object number of the current event for use.
virtual int GetMeObjNum(void) = 0;
// DMFCBase::RegisterPacketReceiver
//
// Sets up a handler for a Special Packet ID. When a special packet is recieved it's ID is compared
// to the ID's given to this function. If any match than it calls the handler given to process
// the packet.
// id = ID of the packet
// func = Function handler to handle the packet. Must be declared like void MyFunction(uint8_t *data);
virtual void RegisterPacketReceiver(uint8_t id, void (*func)(uint8_t *)) = 0;
//@@@@virtual void RegisterPacketReceiver(uint8_t id,void (DMFCBase::*func)(uint8_t *)) = 0;
// DMFCBase::StartPacket
//
// Initializes a packet so it is ready to be sent out.
// data = pointer to buffer of data for packet. This buffer should be MAX_GAME_DATA_SIZE in size, even
// if you don't plan on using all that data, there is header information that is added
// in this function.
// id = ID of the Special packet. When the packet is recieved by whomever, this is the ID that determines which
// handler to
// call.
// count = pointer to your packet index pointer
virtual void StartPacket(uint8_t *data, uint8_t id, int *count) = 0;
// DMFCBase::SendPacket
//
// Ships a Special Packet away to the destination. This call must be preceeded by a StartPacket call
// data = buffer of data to be sent out (same buffer that was passed to StartPacket
// size = size (in bytes) of the packet
// destination = either a player number, SP_ALL for all the players or SP_SERVER to send to the server (if you are a
// client)
virtual void SendPacket(uint8_t *data, int size, int destination) = 0;
// DMFCBase::GetTeamForNewPlayer
//
// A Helper function (Server only), which will give you the optimum team assignment (whoever has the
// lowest amount of players on their team, for a new player.
// player_num = player number of the new player
// num_teams = The number of teams in your game
virtual int GetTeamForNewPlayer(int player_num, int num_teams) = 0;
// DMFCBase::SetNumberOfTeams
//
// Sets the number of teams to be used in the game. By default there is 1 team (everyone against everyone).
// You can set up to a maximum of 4 teams. Call this function as soon as possible.
// teams = number of teams
virtual void SetNumberOfTeams(int teams) = 0;
// DMFCBase::AutoTeamSelect
//
// Turns on or off DMFC's auto team assignment. If it is on, then when a new player joins, they will
// be placed on the team with fewest players. If it is off, then you must handle that. Defualt on.
virtual void AutoTeamSelect(bool turnon) = 0;
// DMFCBase::SendTeamAssignment
//
// A DMFC Special Packet function, this sends a team assignment packet to all the players. Server only.
// playernum = player to change teams
// team = new team
virtual void SendTeamAssignment(int playernum, int team, bool spew_on_respawn) = 0;
// DMFCBase::GetTeamAssignmentPacket
//
// Reciever for the team assignment packet.
virtual void GetTeamAssignmentPacket(uint8_t *data) = 0;
// DMFCBase::GetChangeTeamPacket
//
// Reciever for the change team packet.(Server Only)
virtual void GetChangeTeamPacket(uint8_t *data) = 0;
// DMFCBase::GetGameStateRequest
//
// Receiver for the server from a client asking for the state of the game
virtual void GetGameStateRequest(uint8_t *data) = 0;
// DMFCBase::SendChangeTeamRequest
//
// Sends a request to the server to change teams (Client Only)
// spew_onchange should be true if you want the client the spew his inventory on the change
virtual void SendChangeTeamRequest(int newteam, bool spew_onchange) = 0;
// DMFCBase::GetDMFCGameInfo
//
// Receives information about the DMFC game
virtual void GetDMFCGameInfo(uint8_t *data) = 0;
// DMFCBase::SendDMFCGameInfo
//
// Sends information about the DMFC game
virtual void SendDMFCGameInfo(int player) = 0;
// DMFCBase::ChangeTeams
//
// If you are the server it will make the player change teams. If you
// are a client then it sends a request to the server to change teams
// spew_on_repsawn is true if the player should spew his inventory before he respawns
virtual void RequestTeamChange(int team, int pnum, bool spew_on_respawn) = 0;
// DMFCBase::RequestGameState
//
// Sends a request to the server for the game state
virtual void RequestGameState(void) = 0;
// DMFCBase::AddHudItemCallback
//
// Adds an item to the hud. Everytime the hud needs to be updated, it will call the
// handler passed in. The handler must be declared as:
// void func(struct tHudItem *item);
// type = HI_BITMAP for bitmap, HI_TEXT for a text item
// func = function callback
virtual void AddHUDItemCallback(int type, void (*func)(struct tHUDItem *)) = 0;
// DMFCBase::GetMyTeam
//
// Returns the int value of the team you are on...only useful in a team game.
virtual int GetMyTeam(void) = 0;
// DMFCBase::GetTeamString
//
// Returns a pointer to a string name of a team
// team = integer value of the team
virtual const char *GetTeamString(int team) = 0;
// DMFCBase::GetTeamColor
//
// Returns the color components of a team
// team = integer value of the team
virtual ddgr_color GetTeamColor(int team) = 0;
// DMFCBase::GetNumTeams
//
// Returns the number of teams in the game
virtual int GetNumTeams(void) = 0;
// DMFCBase::AllowTeamChange
//
// Returns true if team changing is allowed
virtual bool AllowTeamChange(void) = 0;
// DMFCBase::SwitchAllowTeamChange
//
// Turns on/off allowing of team changing
virtual void SwitchAllowTeamChange(bool turnon) = 0;
// DMFCBase::GetSortedPlayerSlots
//
// Fills in the passed array (of size maxsize) with the playernums sorted by (kills-suicides)
virtual void GetSortedPlayerSlots(int *sortedindex, int maxsize) = 0;
// DMFCBase::GetSortedPlayerSlotsByEfficiency
//
// Fills in the passed array (of size maxsize) with the playernums sorted by kills/(kills+deaths+suicides)
virtual void GetSortedPlayerSlotsByEfficiency(int *sortedindex, int maxsize) = 0;
// DMFCBase::IsMenuUp
//
// Returns true if the on screen menu is being shown
virtual bool IsMenuUp(void) = 0;
// DMFCBase::ConvertHUDAlpha
//
// Returns a converted alpha based on what you give, it will be a more transparent if the onscreen menu is up
virtual float ConvertHUDAlpha(float normal) = 0;
virtual uint8_t ConvertHUDAlpha(uint8_t normal) = 0;
// DMFCBase::ClipString
//
// Given a width, the string will be clipped to that width. If you pass true for arrow, then an arrow will be
// appended if the string has been clipped. Based off current font
virtual void ClipString(int width, char *string, bool arrow) = 0;
// DMFCBase::DisplayOutrageLogo(void)
//
// Displays the Outrage Logo for 5 seconds (call repeatedly, after 5 seconds it will just short circuit)
// Does nothing for non-Outrage releases
virtual void DisplayOutrageLogo(void) = 0;
// DMFCBase::KillAllTimers
//
// Kills all running timers
virtual void KillAllTimers(void) = 0;
// DMFCBase::SetTimerInterval
//
// Starts a timer event running
virtual int SetTimerInterval(void (*func)(void), float intval, float longevity, void (*onkill)(void) = NULL) = 0;
// DMFCBase::KillTimer
//
// Kills a timer
virtual void KillTimer(int handle) = 0;
// DMFCBase::SwitchShowHudCallsignLevel
//
//
// Sets the level for displaying of Player's Callsigns on the HUD
virtual void SwitchShowHudCallsignLevel(uint8_t level, bool announce = true) = 0;
// DMFCBase::SwitchServerHudCallsignLevel
//
//
// Sets the max level of HUD callsign displayage...determined by the server
virtual void SwitchServerHudCallsignLevel(uint8_t level) = 0;
// DMFCBase::GetCounterMeasureOwner
//
//
// Given a counter measure it will determine the pnum of it's owner...if it can't find it, it returns -1
virtual int GetCounterMeasureOwner(object *robot) = 0;
// DMFCBase::CFGOpen
//
// Opens the registry/cfg information for the DMFC game, see error codes for return values
virtual int CFGOpen(char *filename) = 0;
// DMFCBase::CFGClose
//
// Closes the registry information for the game.
virtual void CFGClose(void) = 0;
// DMFCBase::CFGFlush
//
// Flushes out the registry information to fall
virtual int CFGFlush(void) = 0;
// DMFCBase::CFGCreateKey
//
// Creates a key in the registry
virtual int CFGCreateKey(char *name) = 0;
// DMFCBase::CFGLookupKey
//
// Sets the active key in the registry
virtual int CFGLookupKey(char *name) = 0;
// DMFCBase::CFGLookupRecord
//
// Looks up a record in the active key
virtual int CFGLookupRecord(char *record, void *data) = 0;
// DMFCBase::CFGCreateRecord
//
// Create/overwrites a record in the active key. Type is either REGT_DWORD or REGT_STRING
virtual int CFGCreateRecord(char *name, char type, void *data) = 0;
// DMFCBase::DecryptData
//
// Decrypts a buffer of data
virtual void DecryptData(uint8_t *data, int size) = 0;
// DMFCBase::EncryptData
//
// Encrypts (weak) a buffer of data
virtual void EncryptData(uint8_t *data, int size) = 0;
// DMFCBase::VersionCheck
//
// Makes sure Client has same DMFC version
virtual void VersionCheck(int pnum) = 0;
// DMFCBase::UpdatePInfo
//
//
// Updates a victim's pinfo stat
virtual void UpdatePInfo(int victim, int killer, int amount) = 0;
// DMFCBase::ResetPInfo
//
//
// Resets all the PInfo stats (and frees memory)
virtual void ResetPInfo(void) = 0;
// DMFCBase::WriteDMFCStatsToFile
//
//
// This function will write out DMFC's stats to the file given (it must be opened for writing)
virtual void WriteDMFCStatsToFile(CFILE *file) = 0;
// DMFCBase::SetWeaponDeathMessage
//
// Sets a death message for a weapon kill (you only need to pass in one version of the weapon if it
// consists of multiple weapons...make sure AddWeaponHash has been called before this for this weapon)
virtual bool SetWeaponDeathMessage(const char *weapon_name, const char *message, bool victim_first) = 0;
// DMFCBase::GetWeaponDeathMessage
//
// Returns the format string for a weapon death message, NULL if it doesn't exist
virtual char *GetWeaponDeathMessage(int index, bool *victim_first) = 0;
// DMFCBase::AddWeaponHash
//
// Since one weapon may actually consist of many weapons, in order to save space you can create
// one weapon where all those other weapon id's will be mapped to it...use WeaponHash[id] to
// get the actual weapon. End list of children with a NULL
virtual void AddWeaponHash(const char *parent, ...) = 0;
// DMFCBase::AddWeaponHashArray
//
// Since one weapon may actually consist of many weapons, in order to save space you can create
// one weapon where all those other weapon id's will be mapped to it...use WeaponHash[id] to
// get the actual weapon.
virtual void AddWeaponHashArray(const char *parent, int count, char **array) = 0;
// DMFCBase::SetupPlayerRecord
//
// Sets up memory for multiplayer mod user defined data in the Player Records. Pass in the size (in bytes)
// of 1 struct (each player will get one). Use GetPlayerRecordData to retrieve a pointer to the data.
//
// pack_callback : callback function called when data from the struct needs to be packed
// into a packet. It is SUPER important that this function packs the data
// in little endian format. This function gets a pointer to the struct that
// needs to be packed (user_info), and a buffer in which to pack it to. This
// function is to return the number of bytes it has packed.
// unpack_callback : callback function called when data from the struct needs to be unpacket
// from a packet. This data will be in little endian format. Returns the number of
// bytes unpacked.
// returns: 1 if size given was <=0 (if so all previous user stats will be removed)
// 0 all went ok
// -1 out of memory (all user stats memory will be freed)
virtual int SetupPlayerRecord(int sizeof_individual_data, int (*pack_callback)(void *user_info, uint8_t *data),
int (*unpack_callback)(void *user_info, uint8_t *data)) = 0;
// DMFCBase::GetPlayerRecordData
//
// Returns a pointer to the memory set aside for a particular player (NULL on error)
virtual void *GetPlayerRecordData(int pnum) = 0;
// DMFCBase::GetPlayerRecord
//
// Returns a pointer to the player record at the given slot (passed in slot must be in the range
// 0<=slot