Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Megaton Edition compatibility layer
- // put this into game.c inside CommandLine function right after debughelp
- // TODO:
- // 1) replace hardcoded names of files and indexes with
- // ini\cfg configurable stuff. My original AutoIt wrapper code for reference
- /*
- Global $Ini = "duke3d.ini"
- Global $Global = "Global"
- Global $Filter = "-addon"
- Global $AddonIndex = 0
- Global $Title = "Duke Nukem 3D"
- Global $Exe = "eduke32.exe"
- Global $Args
- Global $WinState = 1
- GetIniSettings(1)
- GetCmdLine()
- GetIniSettings(2)
- RunDuke3D()
- Exit
- Func GetCmdLine()
- If $CmdLine[0] > 0 Then
- If $CmdLine[1] = $Filter Then
- ;MsgBox(4096, $Title, $CmdLine[1])
- If $CmdLine[2] = True Then
- Global $AddonIndex = $CmdLine[2]
- EndIf
- EndIf
- EndIf
- EndFunc ;==>GetCmdLine
- Func GetIniSettings($Mode)
- If FileExists($Ini) Then
- If $Mode = 1 Then
- Global $ModeSettings = IniReadSection($Ini, $Global)
- For $m = 1 To $ModeSettings[0][0]
- If $ModeSettings[$m][0] = "Filter" Then
- If $ModeSettings[$m][1] = True Then
- Global $Filter = $ModeSettings[$m][1]
- EndIf
- EndIf
- Next
- ElseIf $Mode = 2 Then
- Global $ModeSettings = IniReadSection($Ini, $AddonIndex)
- For $m = 1 To $ModeSettings[0][0]
- If $ModeSettings[$m][0] = "Title" Then
- If $ModeSettings[$m][1] = True Then
- Global $Title = $ModeSettings[$m][1]
- EndIf
- ElseIf $ModeSettings[$m][0] = "Exe" Then
- If $ModeSettings[$m][1] = True Then
- Global $Exe = $ModeSettings[$m][1]
- EndIf
- ElseIf $ModeSettings[$m][0] = "Args" Then
- If $ModeSettings[$m][1] = True Then
- Global $Args = $ModeSettings[$m][1]
- EndIf
- ElseIf $ModeSettings[$m][0] = "WinState" Then
- If $ModeSettings[$m][1] = True Then
- Global $WinState = $ModeSettings[$m][1]
- EndIf
- EndIf
- Next
- EndIf
- EndIf
- ;MsgBox(4096, $Title, $Exe & ' ' & $Args)
- EndFunc ;==>GetIniSettings
- Func RunDuke3D()
- RunWait($Exe & ' ' & $Args, @WorkingDir, $WinState)
- EndFunc ;==>RunDuke3D
- */
- // 2) rename saves name pattern and ext for compatibility with Steam Cloud
- // to do so probably g_addonIndex should be used to differ names of saves according to addon index
- // give original duke3d 0 index, backward compatibility with old save names and ext should be added,
- // we dont want to frustrate people by making their old saves invisible, dont we?
- // also steam cloud storage size per D3DME could be limited.
- // i have idea to make dirty trick that will rename Megaton edition compatible saves to eduke32 format
- // on start, and on exit will rename them back to megaton format to let steam hook these saves.
- // from Russia with love, v00d00m4n
- // sorry for some garbage comments, im total n00b here, remove if you will annoy you
- if (!Bstrcasecmp(c+1,"addon"))
- {
- if (argc > i+1)
- {
- switch (argv[i+1])
- {
- // better to do it with for loop for ulimited number of addons but for now 3 will do
- case "1":
- // settings should be equal to
- // -jAddons -gDUKEDC.GRP -xGAME.CON
- // not sure if last con needed, added it just in case to be sure that con loaded from addon grp and not default one
- // def added just in case for mod compatibility and separation of addon def files!
- // Will missing def interrupt eduke loading?
- G_AddPath("Addons")
- G_AddGroup("DUKEDC.GRP")
- clearScriptNamePtr();
- g_scriptNamePtr = dup_filename("GAME.CON");
- initprintf("Using CON file \"%s\".\n",g_scriptNamePtr);
- clearDefNamePtr();
- g_defNamePtr = dup_filename("dukedc.def");
- initprintf("Using DEF file \"%s\".\n",g_defNamePtr);
- i++;
- break;
- case "2":
- // settings should be equal to
- // -jAddons -gNWINTER.GRP -xNWINTER.CON
- // this case is different due of non standard con name
- G_AddPath("Addons")
- G_AddGroup("NWINTER.GRP")
- clearScriptNamePtr();
- g_scriptNamePtr = dup_filename("NWINTER.CON");
- initprintf("Using CON file \"%s\".\n",g_scriptNamePtr);
- clearDefNamePtr();
- g_defNamePtr = dup_filename("nwinter.def");
- initprintf("Using DEF file \"%s\".\n",g_defNamePtr);
- i++;
- break;
- case "3":
- // settings should be equal to
- // -jAddons -gVACATION.GRP -xGAME.CON
- // same as with DC
- G_AddPath("Addons")
- G_AddGroup("VACATION.GRP")
- clearScriptNamePtr();
- g_scriptNamePtr = dup_filename("GAME.CON");
- initprintf("Using CON file \"%s\".\n",g_scriptNamePtr);
- clearDefNamePtr();
- g_defNamePtr = dup_filename("vacation.def");
- initprintf("Using DEF file \"%s\".\n",g_defNamePtr);
- i++;
- break;
- }
- //i++;
- }
- i++;
- continue;
- }
- // compat layer end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement