/* * 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 . */ #ifndef __DMFC_APP_H_ #define __DMFC_APP_H_ // DMFCApp Class // This is the class you actually make an instance of. // It will handle processing of events, calling defaults where needed, or calling your overrides // To create an event handler override, add it's prototype to this class, and then define the function // in your multiplayer source file. See examples to do this. The prototype must be exactly the same // as it is in DMFCBase class. class DMFCApp : public DMFCBase { public: //Setup and processing functions void GameInit(int teams); void GameClose(void); //!!!!!!!ADD YOUR EVENT HANDLER OVERRIDES HERE!!!!!!!!!!! bool OnCanChangeTeam(int pnum,int newteam); void OnClientPlayerDisconnect(int player_num); void OnPlayerEntersObserver(int pnum,object *piggy); void HandlePowerballLoss(int pnum,bool spew_shields); //void OnServerWeaponCollide(object *pobj,object *wobj,vector *point,vector *normal,bool is_electrical); void OnGameStateRequest(int pnum); void OnClientPlayerKilled(object *killer_obj,int victim_pnum); void OnServerGameCreated(void); void OnClientLevelStart(void); void OnClientLevelEnd(void); void OnPlayerConnect(int player_num); void OnInterval(void); void OnHUDInterval(void); void OnKeypress(int key); void OnServerCollide(object *me_obj,object *it_obj); void OnClientCollide(object *me_obj,object *it_obj); void OnServerPlayerChangeSegment(int player_num,int newseg,int oldseg); void OnClientPlayerChangeSegment(int player_num,int newseg,int oldseg); void OnSaveStatsToFile(void); void OnPLRInterval(void); void OnPLRInit(void); private: }; /* ======================================================================================================== DMFCApp Members */ /* * If you need to do some specific initialization when the DLL loads, put that in DMFCApp::GameInit, * likewise, special deallocation/deinitialization should go in DMFCApp::GameClose. Most of the time * you won't need to add anything here. */ // DMFCApp::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. void DMFCApp::GameInit(int teams) { DMFCBase::GameInit(teams); } // 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 void DMFCApp::GameClose(void) { DMFCBase::GameClose(); } //Declare the instance of the multiplayer game DMFCApp PBall; /************************************************************************************************* *The following functions and declaration are needed to connect the DLL to the game. These must * *stay here and must call the functions that are in them. You can not delete from here, but you * *can add to it no problem * ************************************************************************************************* */ // These next two function prototypes MUST appear in the extern "C" block if called // from a CPP file. extern "C" { DLLEXPORT void DLLFUNCCALL DLLGameInit (int *api_func,ubyte *all_ok); DLLEXPORT void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data); DLLEXPORT void DLLFUNCCALL DLLGameClose (); DLLEXPORT void DLLFUNCCALL DLLGetGameInfo (tDLLOptions *options); DLLEXPORT int DLLFUNCCALL GetGOScriptID(char *name,ubyte isdoor); DLLEXPORT void DLLFUNCCALLPTR CreateInstance(int id); DLLEXPORT void DLLFUNCCALL DestroyInstance(int id,void *ptr); DLLEXPORT short DLLFUNCCALL CallInstanceEvent(int id,void *ptr,int event,tOSIRISEventInfo *data); DLLEXPORT int DLLFUNCCALL SaveRestoreState( void *file_ptr, ubyte saving_state ); } // The main entry point where the game calls the dll void DLLFUNCCALL DLLGameCall (int eventnum,dllinfo *data) { if((eventnum