diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..508746db6 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,23 @@ +version: "{build}" + +os: Visual Studio 2015 + +platform: + - Win32 + - x64 + +configuration: + - Debug + - Release + +before_build: + - cmd: md build + - cmd: cd build + - cmd: if "%platform%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 + - cmd: if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015 Win64 + - cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% .. + +build: + project: build\GZDoom.sln + parallel: true + verbosity: minimal diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..61a770769 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,73 @@ +language: c++ +dist: trusty +sudo: required + +matrix: + include: + - os: osx + osx_image: xcode8.2 + env: + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7" + + - os: osx + osx_image: xcode8.2 + env: + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DFORCE_INTERNAL_ZLIB=YES -DFORCE_INTERNAL_JPEG=YES -DFORCE_INTERNAL_BZIP2=YES -DFORCE_INTERNAL_GME=YES" + + - os: linux + compiler: gcc + env: + - GCC_VERSION=5 + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - kubuntu-backports + packages: + - g++-5 + - libsdl2-dev + - libgme-dev + - libopenal-dev + - libmpg123-dev + - libsndfile-dev + - libfluidsynth-dev + - libgtk-3-dev + + - os: linux + compiler: clang + env: + - CLANG_VERSION=3.9 + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=RelWithDebInfo -DDYN_OPENAL=NO -DDYN_FLUIDSYNTH=NO" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-3.9 + - kubuntu-backports + packages: + - clang-3.9 + - libstdc++-5-dev + - libsdl2-dev + - libgme-dev + - libopenal-dev + - libmpg123-dev + - libsndfile-dev + - libfluidsynth-dev + - libgtk-3-dev + +before_install: + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install mpg123 libsndfile fluidsynth; fi + - if [ -n "$GCC_VERSION" ]; then export CC="gcc-${GCC_VERSION}" CXX="g++-${GCC_VERSION}"; fi + - if [ -n "$CLANG_VERSION" ]; then export CC="clang-${CLANG_VERSION}" CXX="clang++-${CLANG_VERSION}"; fi + - $CC --version + - $CXX --version + +script: + - mkdir build + - cd build + - cmake ${CMAKE_OPTIONS} .. + - make -j2 + +notifications: + email: false diff --git a/src/d_net.cpp b/src/d_net.cpp index 6ba77bc2a..f9bd55d88 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2676,7 +2676,8 @@ void Net_DoCommand (int type, BYTE **stream, int player) int arg[3] = { 0, 0, 0 }; for (int i = 0; i < 3; i++) arg[i] = ReadLong(stream); - E_Console(player, s, arg[0], arg[1], arg[2]); + bool manual = ReadByte(stream); + E_Console(player, s, arg[0], arg[1], arg[2], manual); } break; @@ -2727,7 +2728,7 @@ void Net_SkipCommand (int type, BYTE **stream) break; case DEM_NETEVENT: - skip = strlen((char *)(*stream)) + 14; + skip = strlen((char *)(*stream)) + 15; break; case DEM_SUMMON2: diff --git a/src/events.cpp b/src/events.cpp index 9946a1059..08e4b328d 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -117,7 +117,7 @@ bool E_UnregisterHandler(DStaticEventHandler* handler) return true; } -bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3) +bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3, bool manual) { if (gamestate != GS_LEVEL) return false; @@ -128,6 +128,7 @@ bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3) Net_WriteLong(arg1); Net_WriteLong(arg2); Net_WriteLong(arg3); + Net_WriteByte(manual); return true; } @@ -433,10 +434,10 @@ bool E_Responder(event_t* ev) return false; } -void E_Console(int player, FString name, int arg1, int arg2, int arg3) +void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manual) { for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) - handler->ConsoleProcess(player, name, arg1, arg2, arg3); + handler->ConsoleProcess(player, name, arg1, arg2, arg3, manual); } bool E_CheckUiProcessors() @@ -523,6 +524,7 @@ DEFINE_FIELD_X(InputEvent, DInputEvent, MouseY); DEFINE_FIELD_X(ConsoleEvent, DConsoleEvent, Player) DEFINE_FIELD_X(ConsoleEvent, DConsoleEvent, Name) DEFINE_FIELD_X(ConsoleEvent, DConsoleEvent, Args) +DEFINE_FIELD_X(ConsoleEvent, DConsoleEvent, IsManual) DEFINE_ACTION_FUNCTION(DStaticEventHandler, SetOrder) { @@ -545,7 +547,7 @@ DEFINE_ACTION_FUNCTION(DEventHandler, SendNetworkEvent) PARAM_INT(arg3); // - ACTION_RETURN_BOOL(E_SendNetworkEvent(name, arg1, arg2, arg3)); + ACTION_RETURN_BOOL(E_SendNetworkEvent(name, arg1, arg2, arg3, false)); } DEFINE_ACTION_FUNCTION(DEventHandler, Create) @@ -1091,10 +1093,11 @@ static DConsoleEvent* E_SetupConsoleEvent() e->Name = ""; for (size_t i = 0; i < countof(e->Args); i++) e->Args[i] = 0; + e->IsManual = false; return e; } -void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3) +void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual) { if (player < 0) { @@ -1111,6 +1114,7 @@ void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int e->Args[0] = arg1; e->Args[1] = arg2; e->Args[2] = arg3; + e->IsManual = manual; VMValue params[2] = { (DStaticEventHandler*)this, e }; GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr); @@ -1131,6 +1135,7 @@ void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int e->Args[0] = arg1; e->Args[1] = arg2; e->Args[2] = arg3; + e->IsManual = manual; VMValue params[2] = { (DStaticEventHandler*)this, e }; GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr); @@ -1162,7 +1167,7 @@ CCMD(event) for (int i = 0; i < argn; i++) arg[i] = atoi(argv[2 + i]); // call locally - E_Console(-1, argv[1], arg[0], arg[1], arg[2]); + E_Console(-1, argv[1], arg[0], arg[1], arg[2], true); } } @@ -1187,6 +1192,6 @@ CCMD(netevent) for (int i = 0; i < argn; i++) arg[i] = atoi(argv[2 + i]); // call networked - E_SendNetworkEvent(argv[1], arg[0], arg[1], arg[2]); + E_SendNetworkEvent(argv[1], arg[0], arg[1], arg[2], true); } } diff --git a/src/events.h b/src/events.h index b83890223..d41c2e26d 100755 --- a/src/events.h +++ b/src/events.h @@ -58,10 +58,10 @@ void E_PlayerDisconnected(int num); // this executes on events. bool E_Responder(event_t* ev); // splits events into InputProcess and UiProcess // this executes on console/net events. -void E_Console(int player, FString name, int arg1, int arg2, int arg3); +void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manual); // send networked event. unified function. -bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3); +bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3, bool manual); // check if there is anything that should receive GUI events bool E_CheckUiProcessors(); @@ -152,7 +152,7 @@ public: bool UiProcess(event_t* ev); // - void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3); + void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual); }; class DEventHandler : public DStaticEventHandler { @@ -300,10 +300,13 @@ public: // FString Name; int Args[3]; + // + bool IsManual; DConsoleEvent() { Player = -1; + IsManual = false; } }; diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 06f8757c3..49aba7ec5 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8516,7 +8516,6 @@ bool FxVMFunctionCall::CheckAccessibility(const VersionInfo &ver) if ((Function->Variants[0].Flags & VARF_Deprecated) && Function->mVersion >= ver) { ScriptPosition.Message(MSG_WARNING, "Accessing deprecated function %s - deprecated since %d.%d.%d", Function->SymbolName.GetChars(), Function->mVersion.major, Function->mVersion.minor, Function->mVersion.revision); - return false; } return true; } @@ -8565,7 +8564,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) if (!CheckAccessibility(ctx.Version)) { delete this; - return false; + return nullptr; } // This should never happen. if (Self == nullptr && (Function->Variants[0].Flags & VARF_Method)) diff --git a/src/sound/mpg123_decoder.h b/src/sound/mpg123_decoder.h index 051473abb..59e1df2ca 100644 --- a/src/sound/mpg123_decoder.h +++ b/src/sound/mpg123_decoder.h @@ -6,7 +6,8 @@ #ifdef HAVE_MPG123 #ifdef _MSC_VER -typedef int ssize_t; +#include +typedef ptrdiff_t ssize_t; #endif #include "mpg123.h" diff --git a/wadsrc/static/zscript/events.txt b/wadsrc/static/zscript/events.txt index e1c2b485a..d7e39e1c0 100755 --- a/wadsrc/static/zscript/events.txt +++ b/wadsrc/static/zscript/events.txt @@ -275,8 +275,11 @@ class ConsoleEvent : BaseEvent native version("2.4") // for net events, this will be the activator. // for UI events, this is always -1, and you need to check if level is loaded and use players[consoleplayer]. native readonly int Player; + // this is the name and args as specified in SendNetworkEvent or event/netevent CCMDs native readonly String Name; native readonly int Args[3]; + // this will be true if the event is fired from the console by event/netevent CCMD + native readonly bool IsManual; } class StaticEventHandler : Object native play version("2.4") @@ -318,7 +321,7 @@ class StaticEventHandler : Object native play version("2.4") // virtual native ui bool UiProcess(UiEvent e); - virtual native bool InputProcess(InputEvent e); + virtual native ui bool InputProcess(InputEvent e); // virtual native ui void ConsoleProcess(ConsoleEvent e);