Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: beyond-all-reason/spring
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: BAR105
Choose a base ref
...
head repository: pemgithub/spring
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: BAR105
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 3 commits
  • 23 files changed
  • 2 contributors

Commits on Jun 3, 2023

  1. Experimental changes to Spin/Turn animation code. It's mostly here to…

    … test if rotation related desync are affected. Should be reverted if they do not.
    lhog committed Jun 3, 2023
    Copy the full SHA
    50816af View commit details
  2. Log #836 and crash on it explicitly

    lhog committed Jun 3, 2023
    Copy the full SHA
    92a5b9d View commit details

Commits on Jun 4, 2023

  1. cmake improvements

    * reference vclibs64 as a git submodule
    * fix warning file names with no extension
    * exclude projects that don't build from vs2022 build solution default
    * default to NATIVE (instead of ALL) AI to avoid default java dependency
    * default startup project engine-legacy (tested with vs2022)
    * find package use correct case for names (fix cmake warning)
    * more cmake fixes pending in BARb, CircuitAI, tracy (separate git submodule)
    pemgithub committed Jun 4, 2023
    Copy the full SHA
    49316d5 View commit details
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -21,3 +21,6 @@
[submodule "rts/lib/tracy"]
path = rts/lib/tracy
url = https://github.com/wolfpld/tracy.git
[submodule "vclibs64"]
path = vclibs64
url = https://github.com/beyond-all-reason/vclibs64
20 changes: 10 additions & 10 deletions AI/Wrappers/LegacyCpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -44,16 +44,16 @@ if (BUILD_${myName}_AIWRAPPER)

# Assemble the Legacy C++ AI sources
set(mySources
"${mySourceDir}/AIAI"
"${mySourceDir}/AIAICallback"
"${mySourceDir}/AIAICheats"
"${mySourceDir}/AIGlobalAICallback"
"${mySourceDir}/DamageArray"
"${mySourceDir}/MoveData"
"${mySourceDir}/UnitDef"
"${rts}/ExternalAI/AISCommands"
"${rts}/Sim/Units/CommandAI/Command"
"${rts}/System/float3"
"${mySourceDir}/AIAI.cpp"
"${mySourceDir}/AIAICallback.cpp"
"${mySourceDir}/AIAICheats.cpp"
"${mySourceDir}/AIGlobalAICallback.cpp"
"${mySourceDir}/DamageArray.cpp"
"${mySourceDir}/MoveData.cpp"
"${mySourceDir}/UnitDef.cpp"
"${rts}/ExternalAI/AISCommands.cpp"
"${rts}/Sim/Units/CommandAI/Command.cpp"
"${rts}/System/float3.cpp"
${ai_common_SRC}
)

7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ option(WITH_MAPCOMPILER "Include map compiler" TRUE)
# dummy so that qtcreator shows all files (even those of windows)
if(CMAKE_VERSION VERSION_GREATER 3.1.2)
add_library(platform_sources EXCLUDE_FROM_ALL "")
set_property(TARGET platform_sources PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
endif()

# includes rts/build/cmake/Util.cmake & rts/build/cmake/PreferStaticLibs.cmake
@@ -184,7 +185,9 @@ endif (UNIX AND NOT MINGW)
# (next two are relative to CMAKE_INSTALL_PREFIX)
set(AI_LIBS_DIR "${DATADIR}" CACHE STRING "Where to install Skirmish AI libraries")
set(AI_DATA_DIR "${AI_LIBS_DIR}" CACHE STRING "Where to install Skirmish AI additional files (eg. configuration)")
set(AI_TYPES "ALL" CACHE STRING "Which AI Interfaces (and Skirmish AIs using them) to build [ALL|NATIVE|JAVA|NONE]")

# NATIVE to avoid Java dependency by default (to avoid cmake config Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT JVM)
set(AI_TYPES "NATIVE" CACHE STRING "Which AI Interfaces (and Skirmish AIs using them) to build [ALL|NATIVE|JAVA|NONE]")

## DataDirs
set(BUILTIN_DATADIRS "")
@@ -657,3 +660,5 @@ if (INSTALL_PORTABLE)
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/springsettings_portable.cfg) # empty settings file for portable install
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/springsettings_portable.cfg DESTINATION . RENAME springsettings.cfg)
endif (INSTALL_PORTABLE)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT engine-legacy)
11 changes: 4 additions & 7 deletions rts/Sim/Units/Scripts/UnitScript.cpp
Original file line number Diff line number Diff line change
@@ -127,14 +127,10 @@ bool CUnitScript::MoveToward(float& cur, float dest, float speed)
*/
bool CUnitScript::TurnToward(float& cur, float dest, float speed)
{
float delta = dest - cur;
assert(dest < math::TWOPI);
assert(cur < math::TWOPI);

// clamp: -pi .. 0 .. +pi (fmod(x,TWOPI) would do the same but is slower due to streflop)
if (delta > math::PI) {
delta -= math::TWOPI;
} else if (delta <= -math::PI) {
delta += math::TWOPI;
}
float delta = math::fmodf(dest - cur + math::THREEPI, math::TWOPI) - math::PI;

if (math::fabsf(delta) <= speed) {
cur = dest;
@@ -410,6 +406,7 @@ void CUnitScript::TurnNow(int piece, int axis, float destination)
ShowUnitScriptError("[US::TurnNow] invalid script piece index");
return;
}
destination = math::fmodf(destination, math::TWOPI);

LocalModelPiece* p = pieces[piece];

4 changes: 2 additions & 2 deletions rts/Sim/Units/Scripts/UnitScript.h
Original file line number Diff line number Diff line change
@@ -109,8 +109,8 @@ class CUnitScript
bool Tick(int tickRate);
// note: must copy-and-set here (LMP dirty flag, etc)
bool TickMoveAnim(int tickRate, LocalModelPiece& lmp, AnimInfo& ai) { float3 pos = lmp.GetPosition(); const bool ret = MoveToward(pos[ai.axis], ai.dest, ai.speed / tickRate); lmp.SetPosition(pos); return ret; }
bool TickTurnAnim(int tickRate, LocalModelPiece& lmp, AnimInfo& ai) { float3 rot = lmp.GetRotation(); const bool ret = TurnToward(rot[ai.axis], ai.dest, ai.speed / tickRate); lmp.SetRotation(rot); return ret; }
bool TickSpinAnim(int tickRate, LocalModelPiece& lmp, AnimInfo& ai) { float3 rot = lmp.GetRotation(); const bool ret = DoSpin(rot[ai.axis], ai.dest, ai.speed, ai.accel, tickRate); lmp.SetRotation(rot); return ret; }
bool TickTurnAnim(int tickRate, LocalModelPiece& lmp, AnimInfo& ai) { float3 rot = lmp.GetRotation(); rot[ai.axis] = math::fmodf(rot[ai.axis], math::TWOPI); const bool ret = TurnToward(rot[ai.axis], ai.dest, ai.speed / tickRate ); lmp.SetRotation(rot); return ret; }
bool TickSpinAnim(int tickRate, LocalModelPiece& lmp, AnimInfo& ai) { float3 rot = lmp.GetRotation(); rot[ai.axis] = math::fmodf(rot[ai.axis], math::TWOPI); const bool ret = DoSpin(rot[ai.axis], ai.dest, ai.speed, ai.accel, tickRate); lmp.SetRotation(rot); return ret; }
void TickAnims(int tickRate, const TickAnimFunc& tickAnimFunc, AnimContainerType& liveAnims, AnimContainerType& doneAnims);

// animation, used by CCobThread
7 changes: 6 additions & 1 deletion rts/System/LoadSave/DemoRecorder.cpp
Original file line number Diff line number Diff line change
@@ -106,10 +106,15 @@ void CDemoRecorder::WriteDemoFile()
void CDemoRecorder::WriteSetupText(const std::string& text)
{
int length = text.length();
while (text[length - 1] == '\0') {
while (length > 0 && text[length - 1] == '\0') {
--length;
}

if (length <= 0) {
LOG_L(L_ERROR, "[CDemoRecorder::%s] Invalid game setup text (len %d):\n%s", __func__, static_cast<int32_t>(text.length()), text.c_str());
throw std::runtime_error("Invalid game setup text");
}

fileHeader.scriptSize = length;
demoStreams[isServerDemo].append(text.c_str(), length);
}
17 changes: 9 additions & 8 deletions rts/System/MathConstants.h
Original file line number Diff line number Diff line change
@@ -8,14 +8,15 @@
#endif

namespace math {
static constexpr float PI = 3.14159265358979323846f;
static constexpr float INVPI = 0.3183098861837907f; // sic ( 1.0f / PI is not a constexpr)
static constexpr float INVPI2 = 0.15915494309189535f; // sic ( 1.0f / (PI * 2) is not a constexpr)
static constexpr float TWOPI = PI * 2.0f;
static constexpr float SQRPI = 9.869604401089358f; // sic ( PI * PI is not a constexpr)

static constexpr float PIU4 = 1.2732395447351628f; // sic ( 4.0f / PI is not a constexpr)
static constexpr float PISUN4 = -0.4052847345693511f; // sic (-4.0f / (PI * PI) is not a constexpr)
static constexpr float PI = 3.14159265358979323846f;
static constexpr float INVPI = 0.3183098861837907f; // sic ( 1.0f / PI is not a constexpr)
static constexpr float INVPI2 = 0.15915494309189535f; // sic ( 1.0f / (PI * 2) is not a constexpr)
static constexpr float TWOPI = PI * 2.0f;
static constexpr float THREEPI = PI * 3.0f;
static constexpr float SQRPI = 9.869604401089358f; // sic ( PI * PI is not a constexpr)

static constexpr float PIU4 = 1.2732395447351628f; // sic ( 4.0f / PI is not a constexpr)
static constexpr float PISUN4 = -0.4052847345693511f; // sic (-4.0f / (PI * PI) is not a constexpr)

static constexpr float HALFPI = PI * 0.5f;
static constexpr float QUARTERPI = PI * 0.25f;
2 changes: 1 addition & 1 deletion rts/System/SpringMath.inl
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@ inline int2 IdxToCoord(unsigned x, unsigned array_width)

inline float ClampRad(float f)
{
f = math::fmod(f, math::TWOPI);
f = math::fmodf(f, math::TWOPI);
f += (math::TWOPI * (f < 0.0f));
return f;
}
1 change: 1 addition & 0 deletions rts/System/Sync/DumpState.cpp
Original file line number Diff line number Diff line change
@@ -189,6 +189,7 @@ void DumpState(int newMinFrameNum, int newMaxFrameNum, int newFramePeriod, std::
TAP_MATH_CONST(INVPI);
TAP_MATH_CONST(INVPI2);
TAP_MATH_CONST(TWOPI);
TAP_MATH_CONST(THREEPI);
TAP_MATH_CONST(SQRPI);
TAP_MATH_CONST(PIU4);
TAP_MATH_CONST(PISUN4);
2 changes: 1 addition & 1 deletion rts/build/cmake/FindFontConfig.cmake
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ Find_Library(FONTCONFIG_LIBRARY NAMES ${FONTCONFIG_NAMES})

# handle the QUIETLY and REQUIRED arguments and set FONTCONFIG_FOUND to TRUE if
# all listed variables are TRUE
Find_Package_Handle_Standard_Args(FONTCONFIG DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)
Find_Package_Handle_Standard_Args(FontConfig DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)

If (FONTCONFIG_FOUND)
Set(FONTCONFIG_LIBRARIES ${FONTCONFIG_LIBRARY})
2 changes: 1 addition & 1 deletion rts/build/cmake/FindMiniZip.cmake
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ Find_Library(MINIZIP_LIBRARY NAMES ${MINIZIP_NAMES})

# handle the QUIETLY and REQUIRED arguments and set MINIZIP_FOUND to TRUE if
# all listed variables are TRUE
Find_Package_Handle_Standard_Args(MiniZip DEFAULT_MSG MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR)
Find_Package_Handle_Standard_Args(minizip DEFAULT_MSG MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR)

If (MINIZIP_FOUND)
Set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY})
3 changes: 2 additions & 1 deletion rts/builds/dedicated/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -160,14 +160,15 @@ add_executable(engine-dedicated
${sources_engine_System_Log_sinkFile}
${sources_engine_System_Log_sinkOutputDebugString}
${ENGINE_ICON}
main
main.cpp
)
target_link_libraries(engine-dedicated ${engineDedicatedLibraries})
if (MINGW)
target_link_libraries(engine-dedicated ${WS2_32_LIBRARY} ${IMAGEHLP_LIBRARY} ${IPHLPAPI_LIBRARY} ${WINMM_LIBRARY})
endif (MINGW)
if (MSVC)
target_link_libraries(engine-dedicated ${DBGHELP_LIBRARY})
set_property(TARGET engine-dedicated PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
endif (MSVC)
add_dependencies(engine-dedicated generateVersionFiles)

1 change: 1 addition & 0 deletions rts/builds/headless/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ include_directories(${ENGINE_SRC_ROOT_DIR}/lib/slimsig/include)
### Build the executable
add_executable(engine-headless ${engineSources} ${ENGINE_ICON})
target_link_libraries(engine-headless no-sound ${engineHeadlessLibraries} no-sound)
set_property(TARGET engine-headless PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)

if (MINGW)
# To enable console output/force a console window to open
6 changes: 6 additions & 0 deletions rts/builds/legacy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
# which makes testing spring in the builddir easier, eg. like this:
# cd build-dir
# SPRING_DATADIR=$(pwd) ./spring
cmake_minimum_required(VERSION 3.6)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")

@@ -82,8 +83,13 @@ include_directories(${engineIncludes})
add_executable(engine-legacy ${EXE_FLAGS} ${engineSources} ${ENGINE_ICON} ${engineHeaders})
target_link_libraries(engine-legacy ${engineLibraries})

if (MSVC)
add_custom_command(TARGET engine-legacy PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${PROJECT_SOURCE_DIR}/vclibs64/dll/" ${PROJECT_BINARY_DIR}/$(Configuration))
endif (MSVC)

### Install the executable
install(TARGETS engine-legacy DESTINATION ${BINDIR})

create_engine_build_and_install_target(legacy)

set_property(TARGET install-spring-legacy PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
3 changes: 1 addition & 2 deletions rts/lib/assimp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -33,8 +33,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#----------------------------------------------------------------------
SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
CMAKE_MINIMUM_REQUIRED(VERSION 3.26.3)
PROJECT( Assimp )

# All supported options ###############################################
2 changes: 1 addition & 1 deletion rts/lib/assimp/code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
# 3) Add libassimp using the file lists (eliminates duplication of file names between
# source groups and library command)
#
cmake_minimum_required( VERSION 2.6 )
cmake_minimum_required(VERSION 3.26.3)
SET( HEADER_PATH ../include/assimp )

SET( COMPILER_HEADERS
8 changes: 4 additions & 4 deletions rts/lib/headlessStubs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SET(headlessStubsSources
"glewstub"
"glstub"
"glustub"
"sdlstub"
"glewstub.c"
"glstub.c"
"glustub.c"
"sdlstub.c"
)

FIND_PACKAGE(SDL2 REQUIRED)
8 changes: 4 additions & 4 deletions rts/lib/minizip/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Spring supplied CMake build file

set(MINIZIP_FIND_QUIETLY TRUE)
FIND_PACKAGE_STATIC(MiniZip)
FIND_PACKAGE_STATIC(minizip)

if (MINIZIP_FOUND)
# Use the system supplied MiniZip library
@@ -13,9 +13,9 @@ else (MINIZIP_FOUND)
# Build our own minizip library

set(miniZipSources
"unzip"
"zip"
"ioapi"
"unzip.c"
"zip.c"
"ioapi.c"
)

add_definitions(-DNOCRYPT -DNOUNCRYPT)
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@ macro (add_spring_test target sources libraries flags)
target_link_libraries(test_${target} ${libraries} ${test_common_libraries})
set_target_properties(test_${target} PROPERTIES COMPILE_FLAGS "${flags}")
#install(TARGETS test_${target} DESTINATION ${BINDIR})
set_property(TARGET test_${target} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
endmacro()

################################################################################
@@ -244,6 +245,7 @@ endif()
# positive tests (should compile fine)
add_spring_test(${test_name} "${test_src}" "${test_libs}" "")
add_dependencies(tests test_BitwiseEnum)
set_property(TARGET test_BitwiseEnum PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)

# negative tests (must not compile)
spring_test_compile_fail(testBitwiseEnum_fail1 ${test_src} "-DTEST1")
3 changes: 2 additions & 1 deletion tools/DemoTool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ set(demoToolSpringSources
${ENGINE_SRC_ROOT_DIR}/System/SafeCStrings.c
)

add_executable(demotool EXCLUDE_FROM_ALL DemoTool ${demoToolSpringSources})
add_executable(demotool EXCLUDE_FROM_ALL DemoTool.cpp ${demoToolSpringSources})
if (MINGW)
# To enable console output/force a console window to open
set_target_properties(demotool PROPERTIES LINK_FLAGS "-Wl,-subsystem,console")
@@ -48,3 +48,4 @@ target_link_libraries(demotool
gflags
)
add_dependencies(demotool generateVersionFiles)
set_property(TARGET demotool PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
2 changes: 1 addition & 1 deletion tools/dirchange/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")

add_executable(dirchange EXCLUDE_FROM_ALL dirchange)
add_executable(dirchange EXCLUDE_FROM_ALL dirchange.cpp)
set_target_properties(dirchange PROPERTIES OUTPUT_NAME "dch")
1 change: 1 addition & 0 deletions tools/unitsync/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -19,3 +19,4 @@ add_executable(unitsyncTest EXCLUDE_FROM_ALL test.cpp)
target_link_libraries(unitsyncTest unitsync ${CMAKE_DL_LIBS})
add_dependencies(unitsyncTest unitsync)
#INSTALL(TARGETS unitsyncTest DESTINATION ${BINDIR})
set_property(TARGET unitsyncTest PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
1 change: 1 addition & 0 deletions vclibs64
Submodule vclibs64 added at a00f66