Skip to content

Commit

Permalink
Merge branch 'stable' into protobreak
Browse files Browse the repository at this point in the history
# Conflicts:
#	CMakeLists.txt
#	README
#	Xbox/README.Xbox
#	ag-odalaunch/res/Info.plist
#	common/g_mapinfo.cpp
#	common/version.h
#	config-samples/coop-doom.cfg
#	config-samples/coop-masterlevels.cfg
#	config-samples/coop-modern.cfg
#	config-samples/coop-zdoom.cfg
#	config-samples/ctf-attackdefend.cfg
#	config-samples/ctf-doom.cfg
#	config-samples/ctf-pub.cfg
#	config-samples/ctf-wdl.cfg
#	config-samples/dm-doom.cfg
#	config-samples/dm-modern.cfg
#	config-samples/dm-zdoom.cfg
#	config-samples/duel-altdeath.cfg
#	config-samples/duel-ddl.cfg
#	config-samples/duel-doom.cfg
#	config-samples/duel-zddl.cfg
#	config-samples/duel-zdoom.cfg
#	config-samples/horde-doom.cfg
#	config-samples/horde-modern.cfg
#	config-samples/horde-zdoom.cfg
#	config-samples/lms-2team.cfg
#	config-samples/lms-3team.cfg
#	config-samples/lms-ffa.cfg
#	config-samples/survival-modern.cfg
#	config-samples/tdm-doom.cfg
#	config-samples/tdm-modern.cfg
#	config-samples/tdm-zdoom.cfg
#	installer/windows/build_release.ps1
#	odalaunch/res/Info.plist
#	odalpapi/net_packet.h
#	switch.cmake
#	tools/upversion/upversion.ini
  • Loading branch information
AlexMax committed Apr 21, 2024
2 parents 2192e53 + 3c5df8c commit af45655
Show file tree
Hide file tree
Showing 49 changed files with 536 additions and 255 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/windows.yml
Expand Up @@ -29,6 +29,7 @@ jobs:
with:
packages: |
b2sdk
PyNaCl
- name: Prepare build
run: .\ci\win-buildgen.ps1
- name: Turn on problem matcher
Expand All @@ -37,6 +38,32 @@ jobs:
run: cmake --build .\build\ --config RelWithDebInfo --parallel
- name: Prepare artifact
run: .\ci\win-artifact.ps1
- name: Stage artifacts for testing
run: .\ci\win-prepare-demotest.ps1
- name: Download OdaTests and Testing Resources
run: .\ci\win-get-demotester.ps1
env:
DEMOTESTER_URL: ${{ vars.DEMOTESTER_DOWNLOAD_URL }}
DEMORESOURCES_URL: ${{ vars.DEMORESOURCES_DOWNLOAD_URL }}
continue-on-error: true
- name: Decrypt IWADs
run: |
python .\secret.py decrypt plutonia
python .\secret.py decrypt tnt
python .\secret.py decrypt doom
python .\secret.py decrypt doom1
python .\secret.py decrypt doom2
python .\secret.py decrypt hacx
env:
SECRET_KEY: ${{ secrets.DEMOTESTER_IWAD_KEY }}
working-directory: .\build\demotester
continue-on-error: true
- name: Run OdaTests
run: python .\odatestcases.py
env:
ODAMEX_BIN: ..\demotest\odamex.exe
working-directory: .\build\demotester
continue-on-error: true
- name: Upload artifact to B2
run: python .\ci\upload-b2.py .\build\archive Win-x64
env:
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Expand Up @@ -26,6 +26,11 @@ include(GNUInstallDirs OPTIONAL)
add_definitions(-DINSTALL_BINDIR="${CMAKE_INSTALL_BINDIR}")
add_definitions(-DINSTALL_DATADIR="${CMAKE_INSTALL_DATADIR}")

# Set up FHS installation path
if(NOT APPLE AND NOT WIN32)
add_definitions(-DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
endif()

if(WIN32)
set(USE_INTERNAL_LIBS 1)
else()
Expand All @@ -49,7 +54,7 @@ cmake_dependent_option( ENABLE_PORTMIDI "Enable portmidi support" 1 BUILD_CLIENT
cmake_dependent_option( USE_MINIUPNP "Build with UPnP support" 1 BUILD_SERVER 0 )
cmake_dependent_option( USE_INTERNAL_MINIUPNP "Use internal MiniUPnP" 1 USE_MINIUPNP 0 )

set(PROJECT_COPYRIGHT "2006-2022")
set(PROJECT_COPYRIGHT "2006-2023")
set(PROJECT_RC_VERSION "11,0,0,0")
set(PROJECT_COMPANY "The Odamex Team")

Expand Down
17 changes: 17 additions & 0 deletions README.md
Expand Up @@ -77,6 +77,23 @@ Before submitting a pull request, please make sure it follows [our coding standa

[3]: https://odamex.net/wiki/Coding_standard

**Note**: This project contains a demo testing utility that ensures vanilla compatibility by
running a specific set of demos after each commit. When forking this project to prepare a pull request,
this functionality will be unavailable by default to protect sensitive files.
You can restore this functionality by:

1. Forking [OdaTest-Resources](https://github.com/odamex/odatests-resources) to get the PWADs.
2. Downloading [OdaTests](https://github.com/odamex/odatests) to get the encryption module.
3. Replacing the encrypted IWADs with your own set of encrypted IWADs.
Encrypt using `python .\secret.py encrypt doom2` with the environment variable
`SECRET_KEY` defined to encrypt the IWADs with. The following IWADs (latest version) are needed to run all tests:
`doom, doom1, doom2, tnt, plutonia, hacx`
4. Create a release for your forked OdaTest-Resources repo.
5. Enter the following Secrets / Repository Variables in GitHub:
- `secrets.DEMOTESTER_IWAD_KEY` - Encryption key for the IWADs
- `vars.DEMOTESTER_DOWNLOAD_URL` - Full URL to download the latest OdaTests release.
- `vars.DEMORESOURCES_DOWNLOAD_URL` - Full URL to download your personal demo resources

External Links
--------------

Expand Down
4 changes: 2 additions & 2 deletions ag-odalaunch/res/Info.plist
Expand Up @@ -23,11 +23,11 @@
<key>CFBundleShortVersionString</key>
<string>11.0.0</string>
<key>CFBundleGetInfoString</key>
<string>Copyright © 2006-2022 The Odamex Team</string>
<string>Copyright © 2006-2023 The Odamex Team</string>
<key>CFBundleLongVersionString</key>
<string>11.0.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2006-2022 The Odamex Team</string>
<string>Copyright © 2006-2023 The Odamex Team</string>
<key>LSRequiresCarbon</key>
<true/>
</dict>
Expand Down
25 changes: 25 additions & 0 deletions ci/win-get-demotester.ps1
@@ -0,0 +1,25 @@
Set-PSDebug -Trace 1

if (!([String]::IsNullOrWhiteSpace($env:DEMOTESTER_URL)) -and !([String]::IsNullOrWhiteSpace($env:DEMORESOURCES_URL)))
{
Write-Output "OdaTests Download URL: $env:DEMOTESTER_URL"
Write-Output "OdaTests WAD Resources Download URL: $env:DEMORESOURCES_URL"

$DemoTesterPath = $env:DEMOTESTER_URL
$DemoResourcePath = $env:DEMORESOURCES_URL

Set-Location "build"
New-Item -Name "demotester" -ItemType "directory" | Out-Null

Invoke-WebRequest -Uri $DemoTesterPath -OutFile .\odatests.zip
Invoke-WebRequest -Uri $DemoResourcePath -OutFile .\odatests-resources.zip

7z.exe x odatests.zip -odemotester -y
7z.exe x odatests-resources.zip -odemotester -y

Set-Location ..
}
else
{
Write-Output "OdaTests URL or OdaTests Resources URL missing, skipping..."
}
22 changes: 22 additions & 0 deletions ci/win-prepare-demotest.ps1
@@ -0,0 +1,22 @@
Set-PSDebug -Trace 1

Set-Location "build"
New-Item -Name "demotest" -ItemType "directory" | Out-Null

# Copy all built files into artifact directory
Copy-Item -Path `
".\client\RelWithDebInfo\odamex.exe", `
".\client\RelWithDebInfo\odamex.pdb", `
".\client\RelWithDebInfo\*.dll", `
".\server\RelWithDebInfo\odasrv.exe", `
".\server\RelWithDebInfo\odasrv.pdb", `
".\odalaunch\RelWithDebInfo\odalaunch.exe", `
".\odalaunch\RelWithDebInfo\odalaunch.pdb", `
".\odalaunch\RelWithDebInfo\*.dll", `
".\wad\odamex.wad", `
"C:\Windows\System32\msvcp140.dll", `
"C:\Windows\System32\vcruntime140.dll", `
"C:\Windows\System32\vcruntime140_1.dll" `
-Destination "demotest"

Set-Location ..
16 changes: 7 additions & 9 deletions client/CMakeLists.txt
Expand Up @@ -128,11 +128,6 @@ if(APPLE)
${AUDIOUNIT_LIBRARY})
endif()

# Set up FHS installation path
if(NOT APPLE AND NOT WIN32)
add_definitions(-DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
endif()

# Client target
if(TARGET SDL2::SDL2 OR TARGET SDL::SDL)

Expand Down Expand Up @@ -168,14 +163,17 @@ if(TARGET SDL2::SDL2 OR TARGET SDL::SDL)
message(STATUS "Default SIMD flags not touched for AMD64")
elseif(ODAMEX_TARGET_ARCH STREQUAL "i386")
if(NOT MSVC)
# Pentium M has SSE2.
target_compile_definitions(odamex PRIVATE -march=pentium-m)
target_compile_options(odamex PRIVATE -msse2)
else()
target_compile_definitions(odamex PRIVATE /arch:SSE2)
target_compile_options(odamex PRIVATE /arch:SSE2)
endif()
message(STATUS "Default SIMD flags set to SSE2")
elseif(ODAMEX_TARGET_ARCH MATCHES "ppc")
target_compile_definitions(odamex PRIVATE -faltivec)
if(APPLE)
target_compile_options(odamex PRIVATE -faltivec)
else()
target_compile_options(odamex PRIVATE -maltivec)
endif()
message(STATUS "Default SIMD flags set to AltiVec")
endif()
else()
Expand Down
42 changes: 40 additions & 2 deletions client/gui/gui_boot.cpp
Expand Up @@ -98,7 +98,7 @@ static void EraseSelected(scannedPWADPtrs_t& mut, scannedPWAD_t* pwad)
const scannedIWAD_t* g_SelectedIWAD;
scannedWADs_t g_SelectedWADs;

const int WINDOW_WIDTH = 320;
const int WINDOW_WIDTH = 425;
const int WINDOW_HEIGHT = 240;

class BootWindow : public Fl_Window
Expand All @@ -112,13 +112,20 @@ class BootWindow : public Fl_Window
Fl_Hold_Browser* m_IWADBrowser;
Fl_Check_Browser* m_PWADSelectBrowser;
Fl_Hold_Browser* m_PWADOrderBrowser;
Fl_Check_Browser* m_gameOptionsBrowser;
StringTokens m_WADDirs;
Fl_Hold_Browser* m_WADDirList;
// display strings for options tab and their corresponding command line arguments
std::vector<std::pair<std::string, std::string> > OPTIONS_LIST;

public:
BootWindow(int X, int Y, int W, int H, const char* L)
: Fl_Window(X, Y, W, H, L), m_IWADs()
{
OPTIONS_LIST.push_back(std::make_pair("No Monsters", "-nomonsters"));
OPTIONS_LIST.push_back(std::make_pair("Fast Monsters", "-fast"));
OPTIONS_LIST.push_back(std::make_pair("Respawn Monsters", "-respawn"));
OPTIONS_LIST.push_back(std::make_pair("Pistol Start", "-pistolstart"));
{
Fl_Tabs* tabs = new Fl_Tabs(0, 0, 425, 200);
{
Expand All @@ -132,6 +139,8 @@ class BootWindow : public Fl_Window
} // Fl_Box* logo
{
m_IWADBrowser = new Fl_Hold_Browser(135, 35, 280, 155);
m_IWADBrowser->callback(BootWindow::doPlayCB, static_cast<void*>(this));
m_IWADBrowser->when(FL_WHEN_ENTER_KEY);
} // Fl_Browser* m_IWADBrowser
m_tabIWAD->end();
} // Fl_Group* tabIWAD
Expand Down Expand Up @@ -165,6 +174,26 @@ class BootWindow : public Fl_Window
} // Fl_Button* doWADRemove
m_tabPWADs->end();
} // Fl_Group* tabPWADs
{
Fl_Group* tabGameOptions =
new Fl_Group(0, 25, 425, 175, "Game Options");
{
Fl_Box* o = new Fl_Box(
10, 35, 405, 20,
"Set gameplay options to modify your experience.");
o->align(Fl_Align(132 | FL_ALIGN_INSIDE));
} // Fl_Box* o
{
m_gameOptionsBrowser = new Fl_Check_Browser(10, 65, 405, 125);
for (std::vector<std::pair<std::string, std::string> >::const_iterator it = OPTIONS_LIST.begin();
it != OPTIONS_LIST.end(); ++it)
{
m_gameOptionsBrowser->add((*it).first.c_str());
}
}
tabGameOptions->end();

} // Fl_Group* tabGameOptions
{
Fl_Group* tabWADDirs =
new Fl_Group(0, 25, 425, 175, "Resource Locations");
Expand Down Expand Up @@ -272,6 +301,7 @@ class BootWindow : public Fl_Window
}

boot->selectedWADs();
boot->setOptions();
Fl::delete_widget(boot);
}

Expand Down Expand Up @@ -497,6 +527,14 @@ class BootWindow : public Fl_Window
}
}

void setOptions()
{
for (int i = 1; i <= m_gameOptionsBrowser->nitems(); i++) {
if (m_gameOptionsBrowser->checked(i))
g_SelectedWADs.options.push_back(OPTIONS_LIST[i - 1].second);
}
}

/**
* @brief Update the WAD dir browser widget from the vector.
*/
Expand Down Expand Up @@ -527,7 +565,7 @@ class BootWindow : public Fl_Window
*/
static BootWindow* MakeBootWindow()
{
return new BootWindow(0, 0, 425, 240, "Odamex " DOTVERSIONSTR);
return new BootWindow(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, "Odamex " DOTVERSIONSTR);
}

/**
Expand Down
1 change: 1 addition & 0 deletions client/gui/gui_boot.h
Expand Up @@ -27,6 +27,7 @@ struct scannedWADs_t
{
std::string iwad;
StringTokens pwads;
StringTokens options;
};

scannedWADs_t GUI_BootWindow();
53 changes: 47 additions & 6 deletions client/sdl/i_input_sdl20.cpp
Expand Up @@ -726,23 +726,56 @@ void ISDL20JoystickInputDevice::gatherEvents()
}
else
{
float deadzone = (joy_deadzone * 32767);
event_t motion_event(ev_joystick);
motion_event.type = ev_joystick;
motion_event.data2 = sdl_ev.caxis.axis;
if ((sdl_ev.caxis.value >= deadzone) ||
(sdl_ev.caxis.value <= -deadzone)){
motion_event.data3 = sdl_ev.caxis.value;
}

motion_event.data3 = calcAxisValue(sdl_ev.caxis.value);
mEvents.push(motion_event);
}

}
}
}

// Flush all remaining joystick and game controller events.
SDL_FlushEvents(SDL_JOYAXISMOTION, SDL_CONTROLLERDEVICEREMAPPED);
}

int ISDL20JoystickInputDevice::calcAxisValue(int raw_value)
{
float value;

// Normalize.
if (raw_value > 0)
{
value = (float)raw_value / (float)SDL_JOYSTICK_AXIS_MAX;
}
else if (raw_value < 0)
{
value = (float)raw_value / (float)abs(SDL_JOYSTICK_AXIS_MIN);
}
else
{
value = 0.0f;
}

// Apply deadzone.
if (value > joy_deadzone)
{
value = (value - joy_deadzone) / (1.0f - joy_deadzone);
}
else if (value < -joy_deadzone)
{
value = (value + joy_deadzone) / (1.0f - joy_deadzone);
}
else
{
value = 0.0f;
}

// Scale value to the range used for calculations in G_BuildTiccmd().
return lroundf(value * 32767.0f);
}

//
// ISDL20JoystickInputDevice::getEvent
Expand Down Expand Up @@ -788,6 +821,14 @@ ISDL20InputSubsystem::ISDL20InputSubsystem() :
SDL_EventState(SDL_CONTROLLERBUTTONDOWN, SDL_IGNORE);
SDL_EventState(SDL_CONTROLLERBUTTONUP, SDL_IGNORE);

// Ignore unsupported game controller events.
#if (SDL_MINOR_VERSION > 0 || SDL_PATCHLEVEL >= 14)
SDL_EventState(SDL_CONTROLLERTOUCHPADDOWN, SDL_IGNORE);
SDL_EventState(SDL_CONTROLLERTOUCHPADMOTION, SDL_IGNORE);
SDL_EventState(SDL_CONTROLLERTOUCHPADUP, SDL_IGNORE);
SDL_EventState(SDL_CONTROLLERSENSORUPDATE, SDL_IGNORE);
#endif

grabInput();
}

Expand Down
2 changes: 2 additions & 0 deletions client/sdl/i_input_sdl20.h
Expand Up @@ -139,6 +139,8 @@ class ISDL20JoystickInputDevice : public IInputDevice
virtual void flushEvents();

private:
int calcAxisValue(int raw_value);

static const int JOY_DEADZONE = 6000;

bool mActive;
Expand Down

0 comments on commit af45655

Please sign in to comment.