| 75 | | // This is the first function that is called by both the client and the server after they have loaded this DLL. |
| 76 | | // Its purpose is to point us to the shared implementation of the relevant interfaces (the MatSys etc.), |
| 77 | | // so that we can access the same implementation of the interfaces as the engine. |
| 78 | | // |
| 79 | | // The fact that DLLs that are loaded multiple times cause only a reference counter to be increased rather than separate copies |
| 80 | | // of the DLL to be created (the global state exists only once), and the way how clients and servers change worlds (client deletes |
| 81 | | // the old world first, then loads the new, server loads new world first and only then deletes the old one), and the fact that in |
| 82 | | // a single Cafu.exe instance, the client only, the server only, or both can be running, means that a *single* instance of this |
| 83 | | // DLL may live over several world changes of a client and server, because at least one of them keeps referring to it at all times. |
| 84 | | // |
| 85 | | // Therefore, it may happen that GetGame() is called *many* times, namely on each world change once by the server and once |
| 86 | | // by the client. The parameters to this function however are always non-volatile, they don't change over multiple calls. |
| 87 | | // In future implementations I'll possibly change this and load and init the DLL only once, even before the client or server gets instantiated. |
| 88 | | |
| 91 | | cf::GuiSys::GuiManI* cf::GuiSys::GuiMan=NULL; // Define the global GuiMan pointer instance -- see GuiMan.hpp for more details. |
| 92 | | MaterialManagerI* MaterialManager =NULL; |
| 93 | | cf::ConsoleI* Console=NULL; |
| 94 | | ConsoleInterpreterI* ConsoleInterpreter=NULL; |
| 95 | | cf::FileSys::FileManI* cf::FileSys::FileMan=NULL; |
| | 78 | cf::GuiSys::GuiManI* cf::GuiSys::GuiMan =NULL; |
| | 79 | MaterialManagerI* MaterialManager =NULL; |
| | 80 | cf::ConsoleI* Console =NULL; |
| | 81 | ConsoleInterpreterI* ConsoleInterpreter =NULL; |
| | 82 | cf::FileSys::FileManI* cf::FileSys::FileMan =NULL; |
| 102 | | // WARNING: When the signature of GetGame() is changed here (e.g. by adding more interface pointer parameters), |
| 103 | | // grep all C++ source code files for "GetGame@", because the number of parameter bytes must be updated there! |
| 104 | | DLL_EXPORT cf::GameSys::GameI* __stdcall GetGame(MatSys::RendererI* Renderer, MatSys::TextureMapManagerI* TexMapMan, MaterialManagerI* MatMan, cf::GuiSys::GuiManI* GuiMan_, cf::ConsoleI* Console_, ConsoleInterpreterI* ConInterpreter_, cf::ClipSys::CollModelManI* CollModelMan_, SoundSysI* SoundSystem_, SoundShaderManagerI* SoundShaderManager_) |
| | 89 | /// This is the first function that is called by the core engine (both the client and the server) |
| | 90 | /// after it has loaded this game DLL. |
| | 91 | /// |
| | 92 | /// Its purpose is to exchange pointers to various interfaces: |
| | 93 | /// - The engine points us to all the relevant interfaces (the MatSys, SoundSys, etc.) |
| | 94 | /// that are implemented in the core engine and can be used by our code in the game DLL. |
| | 95 | /// - In return we provide the core engine with our implementation of the cf::GameSys::GameI interface, |
| | 96 | /// that the client and/or the server will in turn use as the sole means to communicate with and run the game. |
| | 97 | /// |
| | 98 | /// The fact that DLLs that are loaded multiple times cause only a reference counter to be increased rather than separate copies |
| | 99 | /// of the DLL to be created (the global state exists only once), and the way how clients and servers change worlds (client deletes |
| | 100 | /// the old world first, then loads the new, server loads new world first and only then deletes the old one), and the fact that in |
| | 101 | /// a single Cafu.exe instance, the client only, the server only, or both can be running, means that a *single* instance of this |
| | 102 | /// DLL may live over several world changes of a client and server, because at least one of them keeps referring to it at all times. |
| | 103 | /// |
| | 104 | /// Therefore, it may happen that GetGame() is called *many* times, namely on each world change once by the server and once |
| | 105 | /// by the client. The parameters to this function however are always non-volatile, they don't change over multiple calls. |
| | 106 | /// In future implementations we'll possibly change this and load and init the DLL only once, even before the client or server gets instantiated. |
| | 107 | /// |
| | 108 | /// WARNING: When the signature of GetGame() is changed here (e.g. by adding more interface pointer parameters), |
| | 109 | /// grep all C++ source code files for "GetGame@", because the number of parameter bytes must be updated there! |
| | 110 | DLL_EXPORT cf::GameSys::GameI* __stdcall GetGame( |
| | 111 | MatSys::RendererI* Renderer, |
| | 112 | MatSys::TextureMapManagerI* TexMapMan, |
| | 113 | MaterialManagerI* MatMan, |
| | 114 | cf::GuiSys::GuiManI* GuiMan_, |
| | 115 | cf::ConsoleI* Console_, |
| | 116 | ConsoleInterpreterI* ConInterpreter_, |
| | 117 | cf::ClipSys::CollModelManI* CollModelMan_, |
| | 118 | SoundSysI* SoundSystem_, |
| | 119 | SoundShaderManagerI* SoundShaderManager_) |