MGS Sources and Coding page


This page deals more with writing plugins for Radiant than MGS coding. The source release contains source code for the MgsPlugin.dll file. In the sources/common/ directory you will find headers for MGS, and headers for QERadiant. QERadiant plugins should include the files qertypes.h and qerplugin.h

If you are using VC, the most straightforward way to build a minimal plugin for QERadiant is a regular DLL with MFC. Here are the exports Radiant is looking for :

LPCSTR WINAPI QERPlug_Init(HMODULE hApp, HWND hwndMain)
is the first export to be called. The string you return is a version information that will appear in Radiant message window.

LPCSTR WINAPI QERPlug_GetName()
is called to retrieve the plugin name that should appear in the menu.

LPCSTR WINAPI QERPlug_GetCommandList()
Here you return the command list of the plugin. For example, "Feature1;Feature2" will add two commands to the menu. You can also use "Feature1;-;Feature2" to add an horizontal line.

LPVOID WINAPI QERPlug_GetFuncTable()
Your code must have a _QERFuncTable_1 QERFuncTable; member, which is a big function table to the routines provided by Radiant. When Radiant calls QERPlug_GetFuncTable, you must return a pointer to your QERFuncTable, and Radiant will take care of filling it.

void WINAPI QERPlug_Dispatch(LPCSTR p, vec3_t vMin, vec3_t vMax, BOOL bSingleBrush)
Last but not least, QERPlug_Dispatch is called each time the user requests a plugin feature. p contains the script requested, and other parameters are info on the currently selected brushes.

Radiant allows you to request brushes, and point lists using Radiant GUI routines. You should have a look to the plugin source code to get more info about it.