diff --git a/CMakeLists.txt b/CMakeLists.txt index ffd2b88..e27fee1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ option(COPY_PSC "Copies any script sources to the MO2 directory (if specified). # -------- Project ---------- project( PerkAdjuster - VERSION 2.0.1 + VERSION 2.0.2 LANGUAGES CXX ) @@ -36,6 +36,7 @@ add_compile_definitions(SKYRIM_AE) add_compile_definitions(SKYRIM_SUPPORT_AE) set(SKSE_COMMONLIBSSE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/External/CommonLibSSE") +set(SKSE_NO_INSTALL ON) if (GOG) add_compile_definitions(SKYRIM_GOG) @@ -71,6 +72,36 @@ target_include_directories( ${CLIB_UTIL_INCLUDE_DIRS} ) +if (MSVC) + target_compile_options( + ${PROJECT_NAME} + PRIVATE + /sdl # Enable Additional Security Checks + /utf-8 # Set Source and Executable character sets to UTF-8 + /Zi # Debug Information Format + + /permissive- # Standards conformance + /Zc:preprocessor # Enable preprocessor conformance mode + /Zc:__cplusplus + + /wd4200 # nonstandard extension used : zero-sized array in struct/union + /W4 # More warnings + /WX # Treat all warnings as errors + /external:anglebrackets # Ignore warnings for external resources. + /external:W0 # Same as above + + "$<$:>" + "$<$:/Zc:inline;/JMC-;/Ob3>" + ) + + target_link_options( + ${PROJECT_NAME} + PRIVATE + "$<$:/INCREMENTAL;/OPT:NOREF;/OPT:NOICF>" + "$<$:/INCREMENTAL:NO;/OPT:REF;/OPT:ICF;/DEBUG:FULL>" + ) +endif () + set(DATA_DIR "${PROJECT_SOURCE_DIR}/data") include(components.cmake) @@ -86,6 +117,40 @@ if(DEFINED ENV{SKYRIM_MODS_FOLDER} AND IS_DIRECTORY "$ENV{SKYRIM_MODS_FOLDER}") endif() endif() +# ---- Compile Papyrus Scripts and Pack Into Archive ---- +include(Papyrus) +include(BSArchive) + +if( + NOT SKIP_ARTIFACTS + AND Skyrim64Path + AND IS_DIRECTORY "${Skyrim64Path}/tools" + AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Data/Source/Scripts" +) + file(GLOB ${PROJECT_NAME}_SOURCES + LIST_DIRECTORIES false + CONFIGURE_DEPENDS + "Data/Source/Scripts/*.psc" + ) + + Papyrus_Add( + "Papyrus" + GAME ${Skyrim64Path} + IMPORTS ${CMAKE_CURRENT_SOURCE_DIR}/Data/Source/Scripts + SOURCES ${${PROJECT_NAME}_SOURCES} + OPTIMIZE ANONYMIZE + ) + + BSArchive_Add( + "BSA" + OUTPUT "${PROJECT_NAME}.bsa" + FORMAT SSE + FILES ${Papyrus_OUTPUT} + ) +else() + message(STATUS "No scripts to compile found, won't compress into BSA.") +endif() + # ---- Automatically copy artifacts to MO2 ---- if(DEFINED OUTPUT_FOLDER AND NOT SKIP_ARTIFACTS) set(DLL_FOLDER "${OUTPUT_FOLDER}/SKSE/Plugins") @@ -102,12 +167,65 @@ if(DEFINED OUTPUT_FOLDER AND NOT SKIP_ARTIFACTS) -DPROJECT_NAME="${PROJECT_NAME}" -P "${PROJECT_SOURCE_DIR}/CMake/Scripts/CMake-Copy-Artifacts.cmake" ) + + if(COPY_BSA) + add_custom_command( + TARGET "${PROJECT_NAME}" + POST_BUILD + COMMAND "${CMAKE_COMMAND}" + -DSRC_DIR="${PROJECT_SOURCE_DIR}/Data" + -DDST_DIR=${OUTPUT_FOLDER} + -DPROJECT_NAME=${PROJECT_NAME} + -DBINARY_DIR=${CMAKE_BINARY_DIR} + -P "${PROJECT_SOURCE_DIR}/CMake/Scripts/CMake-Copy-Archive.cmake" + VERBATIM + ) + endif() + + if(COPY_PEX) + add_custom_command( + TARGET "${PROJECT_NAME}" + POST_BUILD + COMMAND "${CMAKE_COMMAND}" + -DCOMPILED_SCRIPTS="${CMAKE_BINARY_DIR}/Scripts" + -DOUTPUT_FOLDER="${OUTPUT_FOLDER}" + -P "${PROJECT_SOURCE_DIR}/CMake/Scripts/CMake-Copy-Scripts.cmake" + VERBATIM + ) + endif() + + if(COPY_PSC) + add_custom_command( + TARGET "${PROJECT_NAME}" + POST_BUILD + COMMAND "${CMAKE_COMMAND}" + -DSOURCE_SCRIPTS="${PROJECT_SOURCE_DIR}/Data/Source/Scripts" + -DOUTPUT_FOLDER="${OUTPUT_FOLDER}" + -P "${PROJECT_SOURCE_DIR}/CMake/Scripts/CMake-Copy-Sources.cmake" + VERBATIM + ) + endif() endif() # ---- Github Release Stuff ---- install( FILES - "${DATA_DIR}/SKSE/Plugins/${PROJECT_NAME}.ini" + "$" + "$" DESTINATION "SKSE/Plugins" COMPONENT components +) + +install( + FILES + "${DATA_DIR}/Source/Scripts/SEA_PerkFunctions.psc" + DESTINATION "Source/Scripts" + COMPONENT components +) + +install( + FILES + "${DATA_DIR}/Scripts/SEA_PerkFunctions.pex" + DESTINATION "Scripts" + COMPONENT components ) \ No newline at end of file diff --git a/Data/Scripts/SEA_PerkFunctions.pex b/Data/Scripts/SEA_PerkFunctions.pex new file mode 100644 index 0000000..ce50ab1 Binary files /dev/null and b/Data/Scripts/SEA_PerkFunctions.pex differ diff --git a/Data/Source/Scripts/SEA_PerkFunctions.psc b/Data/Source/Scripts/SEA_PerkFunctions.psc new file mode 100644 index 0000000..f058796 --- /dev/null +++ b/Data/Source/Scripts/SEA_PerkFunctions.psc @@ -0,0 +1,6 @@ +Scriptname SEA_PerkFunctions Hidden +{Script for Perk Adjuster's API. To use, in your own script.} + +Int[] Function GetVersion() Global Native +Bool Function AddPerkToTree(Perk a_kPerk, ActorValueInfo a_kAV, Float a_x, Float a_y, Perk[] a_parents = NONE, Perk[] a_children = NONE) Global Native +Bool Function RemoveFromPerkTree(Perk a_kPerk, ActorValueInfo a_kAV) Global Native \ No newline at end of file diff --git a/External/CommonLibSSE b/External/CommonLibSSE index 2415cc9..227bcef 160000 --- a/External/CommonLibSSE +++ b/External/CommonLibSSE @@ -1 +1 @@ -Subproject commit 2415cc998b611d3f0ac15fcfeadca9c83b1bf7f8 +Subproject commit 227bcef2a474612753b401645a99609cc690f4a8 diff --git a/External/CommonLibSSE_1.6 b/External/CommonLibSSE_1.6 index 8a0a7af..227bcef 160000 --- a/External/CommonLibSSE_1.6 +++ b/External/CommonLibSSE_1.6 @@ -1 +1 @@ -Subproject commit 8a0a7af75496b9d89e3d4785871a0daa2ba011c5 +Subproject commit 227bcef2a474612753b401645a99609cc690f4a8 diff --git a/src/perkManipulator.cpp b/src/perkManipulator.cpp index f0e283d..20081da 100644 --- a/src/perkManipulator.cpp +++ b/src/perkManipulator.cpp @@ -73,7 +73,7 @@ namespace PerkManipulation { auto x = a_x + a_targetValue->perkTreeWidth * 0.5; newNode->perkGridX = (std::max)(static_cast(x + 0.58), 0); newNode->perkGridY = (std::min)((std::max)(static_cast(a_y - 0.12 * (xMax + 1)), 0), 4); - newNode->horizontalPosition = x - newNode->perkGridX; + newNode->horizontalPosition = static_cast(x) - static_cast(newNode->perkGridX); newNode->verticalPosition = a_y - newNode->perkGridY; newLinks[newNode] = std::make_pair(a_parents, a_children); diff --git a/vcpkg.json b/vcpkg.json index ed46b85..ddb8d23 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "perk-adjuster", - "version-string": "2.0.1", + "version-string": "2.0.2", "description": "Dynamically replaces perk descriptions.", "homepage": "https://github.com/SeaSparrowOG/PerkAdjuster", "license": "GPL-3.0",