summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 73397e8)
raw | patch | inline | side by side (parent: 73397e8)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Mon, 5 Feb 2018 17:06:32 +0000 (20:06 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Mon, 5 Feb 2018 17:06:32 +0000 (20:06 +0300) |
README | patch | blob | history | |
src/game/Doom2DF.lpr | patch | blob | history | |
src/game/g_net.pas | patch | blob | history | |
src/lib/miniupnpc/miniupnpc.pas | patch | blob | history |
index 744360afb9edf41f143da6f98773217f56e45249..d9d63a867bbeb06978a425965994a1d8461c8bdb 100644 (file)
--- a/README
+++ b/README
fpc -O3 -Fi../lib/vampimg -Fi../lib/vampimg/JpegLib -Fi../lib/vampimg/ZLib -Fu../lib/vampimg -Fu../lib/vampimg/JpegLib -Fu../lib/vampimg/ZLib -FE../../bin -FU../../tmp Doom2DF.lpr
If you want SDL_mixer instead of FMOD, add -dUSE_MIXER.
+If you want the server to be able to forward ports via UPNP, add -dUSE_MINIUPNPC.
To build a headless (no video/audio, for dedicated servers) executable, add -dHEADLESS.
Replace -O3 with -g -gl to enable debugging features. Run the game with --gdb when using a debugger to
prevent it from eating exceptions.
-Windows binaries will require the appropriate DLLs (SDL2.dll, SDL2_mixer.dll or FMODEx.dll, ENet.dll).
+Windows binaries will require the appropriate DLLs (SDL2.dll, SDL2_mixer.dll or FMODEx.dll, ENet.dll, miniupnpc.dll),
+unless you choose to static link them (see below).
Static Linking
First, you need to clone ( http://repo.or.cz/d2df-binlib.git ) (repo with prebuilt windoze libs).
Then, you can use:
- -dLIBJIT_WINDOZE_STATIC -- static LibJIT
- -dLIBENET_WINDOZE_STATIC -- static ENet
+ -dLIBJIT_WINDOZE_STATIC -- static LibJIT
+ -dLIBENET_WINDOZE_STATIC -- static ENet
+ -dLIBMINIUPNPC_WINDOZE_STATIC -- static MiniUPNPC
Don't forget to specify lib*.a location with -Fi<...>
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 429c5f0cedc70f4af59855200e987197363db4bc..5f707e0d06c7d6a5bd47dd79721715d629367ab4 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
math,
GL,
GLExt,
+{$IFDEF USE_MINIUPNPC}
miniupnpc in '../lib/miniupnpc/miniupnpc.pas',
+{$ENDIF}
SDL2 in '../lib/sdl2/sdl2.pas',
{$IFDEF USE_SDLMIXER}
SDL2_mixer in '../lib/sdl2/SDL2_mixer.pas',
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 93525c990b7913d41175c6f7ee67d724f713ce7a..4e2ed9a09f94f868abff12ccccba327c435a3b6d 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
interface
uses
- e_log, e_msg, ENet, miniupnpc, Classes, MAPDEF;
+ e_log, e_msg, ENet, Classes, MAPDEF{$IFDEF USE_MINIUPNPC}, miniupnpc;{$ELSE};{$ENDIF}
const
NET_PROTOCOL_VER = 173;
NetGotEverything: Boolean = False;
NetGotKeys: Boolean = False;
+{$IFDEF USE_MINIUPNPC}
NetPortForwarded: Word = 0;
NetPongForwarded: Boolean = False;
NetIGDControl: AnsiString;
NetIGDService: TURLStr;
+{$ENDIF}
NetDumpFile: TStream;
end;
function g_Net_ForwardPorts(ForwardPongPort: Boolean = True): Boolean;
+{$IFDEF USE_MINIUPNPC}
var
DevList: PUPNPDev;
Urls: TUPNPUrls;
FreeUPNPUrls(@Urls);
Result := True;
end;
+{$ELSE}
+begin
+ Result := False;
+end;
+{$ENDIF}
procedure g_Net_UnforwardPorts();
+{$IFDEF USE_MINIUPNPC}
var
I: Integer;
StrPort: AnsiString;
NetPortForwarded := 0;
end;
+{$ELSE}
+begin
+end;
+{$ENDIF}
initialization
index 3e453b1bab7c1a0b2a2a3a9b91714434b19542ea..37ced0cec0b51278e0733b8e12e56b98cc2fb8f0 100644 (file)
-{$DEFINE LIBMINIUPNPC_WINDOZE_STATIC}
+{.$DEFINE LIBMINIUPNPC_WINDOZE_STATIC}
{$MODE OBJFPC}
{$PACKRECORDS C}