QUOTE(Wormer @ Jan 16 2006, 06:03 AM)
I would like to know what are .sdp files and how my plugin would interact with ScmDraft. Where can I get this information?
[right][snapback]407379[/snapback][/right]
There's a download of the SCMD2 plugin SDK at Stormcoast Fortress, at the private beta site. If you look on one of the pinned topics of this forum, there's a
thread with a link to the download. You'll need to register to be able to download it, though.
Once you get it, the .zip file should contain a folder "Scmdraft Plugin" and a solution file. Use the solution file if you have Visual Studio .Net (or 2003) or later. I have no clue what to do afterwards since I don't have VS.net. Neither do I have anything besides VS.
However, if you use VC++ 6.0, you can just import all the files (excluding ReadMe.txt and Scmdraft Plugin.vcproj) and import the definitions. The code is commented, but
here's the brief overview of each function:
DllMain: part of every dll, look on MSDN when it's called.
GetPluginVersion: as the comment says, leave it alone. It makes sure whether the plugin version and the SCMD2 version are compatible.
InitPlugin: called when the plugin is initialized, usually at SCMD2 startup. That messagebox you see when the sample plugin runs on SCMD2 startup is called on from here. Here is also where you set which sections of the map you request SCMD2 to give your plugin. SCMD2 will pretty much only give you TRIG and MBRF, which are the sections you need for a trigger editor. This is due to SCMD2 not being designed to have plugins altering other sections (which could cause crashes). However, if you have a good enough reason, you could convince SI to add support for other sections to be given.
HWND MainWindow: Handle to the SCMD2 main window. Useful to be assigned to a global handle so that you can disable it when your plugin runs.
HINSTANCE MainInstance: Handle to the instance of SCMD2.
AllocRam AllocMem
DeAllocRam DeleteMem
ReAllocRam ResizeMem: Memory allocation stuff, I don't know when these could be used. I once asked SI about it and he said TrigEdit could use them.
DWORD* RequestedSections: Pointer to an array of 8 (or maybe 9) DWORDs that are names of sections that your plugin requests SCMD2 to give.
PluginGetMenuString: this function will be called several times, for each section that you requested. It asks you to provide the menu item string under the "plugins" menu.
DWORD Section: The current section for which the function is asking the menu item string of.
CHAR* MenuStr: The string to which you copy the menu item string.
WORD StrLen: The maximum length of the menu item string. Check against this value before doing strcpy to MenuStr.
RunPlugin: this is when the user clicks on a menu item of your plugin. So, here is where the "meat" of your plugin goes. The datachunks contain everything you need for a trigger editing plugin.
TEngineData* EngineData: A pointer to the engine data structure (see SCMDPlugin.h).
DWORD CurSection: The section for which the plugin is being run. Either triggers or mission briefings.
CChunkData* Triggers: Pointer to the trigger datachunk (see SCMDPlugin.h). A datachunk is just the size of a section (DWORD) and the section data (array of BYTE).
CChunkData* MissionBriefing: Pointer to the mission briefing (MBRF) datachunk.
CChunkData* SwitchRenaming: Pointer to the switch renaming (SWNM) datachunk.
CChunkData* UnitProperties: Pointer to the unit properties (UPRP) datachunk.
CChunkData* UnitPropUsage: Pointer to the unit properties usage (UPUS) datachunk.
Here are the various structure notes from SCMDPlugin.h:
SCLocation/LocationNode: SCLocation contains the various location data, LocationNode is a node containing SCLocation and whether the data is used or not.
CChunkData: Datachunk structure, see above.
TEngineData: Engine data structure:
MapLocations: Always 256 of these, regardless of whether the map is SC or BW. (MRGN)
WavStringIndexii: Always 512 of these (map .wav string numbers). (WAV )
ActionLog: Null, see below.
ActionLogLevel: SCMD2 Output log data... SI never got around to giving the format to this.
DataInterface: Null, "until virtual class is implemented." Interpret this however you want.
CurSelLocation: Having the currently selected location display on the minimap of SCMD2 (feature that's not implemented yet).
UnitCustomNames: Don't use; use UnitNames instead (see below). String numbers: "0" indicates none, everything else is off by one (1-based). 228 entries.
ForceNames: String Numbers: "0" indicates none, everything else is off by one (1-based). 4 entries.
UnitNames: "char*[228] with non identical unit names."
TPluginInfo: Have no idea where this is used. It doesn't seem to be used anywhere else in the plugin, but TrigEdit might use it (or might have used it) for some odd reason.
UnitProp: Unit properties data chunk member. (UPRP)
Here's the answer to your question: .sdp files are simply renamed .dll files. Go ahead and click "Compile", copy the .dll that was just created to the "plugins" folder of SCMD2, and rename the extension to .sdp. Run SCMD2 and you'll see the plugin running.