fix: bots at difficulty 0 unable to do anything useful

fix: lang configs unable to parse last translated line (fixes #340)
fix: last enemy isn't  cleared instantly with dead entity anymore
fix: bot weakness in pistol rounds
analyzer: improved optimization of useless nodes
linkage: make inability to call gamedll player( non-fatal
linkage: fixed bot boot  on WON engines pre 2000 builds (support for beta 6.5 restored)
cvars: added suupport to revert all cvars to defaults via 'yb cvars defaults'
cvars: added cv_preferred_personality  to select bot default personality
refactor: use single function to send hud messages over the bot code
bot: added random original podbot welcome message to preserve origins of this bot
conf: shuffle bot names and chatter items on conflig load
conf: simplified a bit chatter.cfg syntax (old syntax  still works
build: added support for building with CMake (thanks @Velaron)
refactor: rall the memory hooks moved into their one cpp file
This commit is contained in:
jeefo 2024-01-19 00:03:45 +03:00
commit bf91ef2831
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
35 changed files with 1256 additions and 734 deletions

150
CMakeLists.txt Normal file
View file

@ -0,0 +1,150 @@
#
# YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
# Copyright © 2023-2024 Velaron.
#
# SPDX-License-Identifier: MIT
#
cmake_minimum_required(VERSION 3.15)
project(yapb VERSION 4.4 LANGUAGES CXX)
if(NOT ANDROID)
set(CMAKE_SHARED_MODULE_PREFIX "")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(YAPB_SRC
"src/analyze.cpp"
"src/botlib.cpp"
"src/chatlib.cpp"
"src/combat.cpp"
"src/config.cpp"
"src/control.cpp"
"src/engine.cpp"
"src/graph.cpp"
"src/hooks.cpp"
"src/linkage.cpp"
"src/manager.cpp"
"src/module.cpp"
"src/message.cpp"
"src/navigate.cpp"
"src/planner.cpp"
"src/practice.cpp"
"src/sounds.cpp"
"src/storage.cpp"
"src/support.cpp"
"src/tasks.cpp"
"src/vision.cpp"
"src/vistable.cpp"
)
add_library(yapb MODULE ${YAPB_SRC})
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(COMMAND hostname OUTPUT_VARIABLE BUILD_MACHINE OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE BUILD_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
execute_process(COMMAND git rev-list --count HEAD OUTPUT_VARIABLE BUILD_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
execute_process(COMMAND git log --pretty="%ae" -1 OUTPUT_VARIABLE BUILD_AUTHOR OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
set(BUILD_COMPILER ${CMAKE_CXX_COMPILER_ID}\ ${CMAKE_CXX_COMPILER_VERSION})
set(BUILD_VERSION ${CMAKE_PROJECT_VERSION})
string(REPLACE . , BUILD_WINVER ${CMAKE_PROJECT_VERSION})
configure_file(inc/version.h.in version.build.h @ONLY)
target_compile_definitions(yapb PRIVATE VERSION_GENERATED)
endif()
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND NOT MSVC)
target_compile_options(yapb PRIVATE -flto=auto -fno-exceptions -fno-rtti -fno-threadsafe-statics -pthread)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
target_compile_options(yapb PRIVATE -march=armv8-a+fp+simd)
elseif(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc")
target_compile_options(yapb PRIVATE -mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse)
endif()
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_options(yapb PRIVATE -funroll-loops -fomit-frame-pointer -fno-stack-protector -fvisibility=hidden -fvisibility-inlines-hidden)
if(NOT WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc")
target_compile_options(yapb PRIVATE -fdata-sections -ffunction-sections -fcf-protection=none)
target_link_options(yapb PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/ext/ldscripts/version.lds -Wl,--gc-sections)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(yapb PRIVATE -fgraphite-identity -floop-nest-optimize)
target_link_options(yapb PRIVATE -fgraphite-identity -floop-nest-optimize)
endif()
endif()
if(NOT WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_link_options(yapb PRIVATE -flto-partition=none)
endif()
else()
target_compile_options(yapb PRIVATE -g3 -ggdb -DDEBUG -D_FORTIFY_SOURCE=2)
endif()
if(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_link_options(yapb PRIVATE -Wl,--kill-at)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12")
target_link_options(yapb PRIVATE -Xlinker --script -Xlinker ${CMAKE_CURRENT_SOURCE_DIR}/ext/ldscripts/i386pe.lds)
endif()
endif()
if(WIN32 AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_link_options(yapb PRIVATE -static-libgcc)
endif()
if(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_property(TARGET yapb PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8 OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc")
target_compile_options(yapb PRIVATE -fPIC)
target_link_options(yapb PRIVATE -fPIC)
endif()
elseif(WIN32 AND MSVC)
set_property(TARGET yapb PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_options(yapb PRIVATE /Zc:threadSafeInit- /GS- /Ob2 /Oy /Oi /Ot /fp:precise /GF /Gw /arch:SSE2 /Zi /guard:ehcont- /guard:cf- /DEBUG)
target_link_options(yapb PRIVATE /OPT:REF,ICF /GUARD:NO /LTCG delayimp.lib /DELAYLOAD:user32.dll /DELAYLOAD:ws2_32.dll)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(yapb PRIVATE /GL)
endif()
endif()
endif()
if(WIN32 OR MINGW)
target_link_libraries(yapb PRIVATE user32 ws2_32)
target_sources(yapb PRIVATE "vc/yapb.rc")
elseif(ANDROID)
target_link_libraries(yapb PRIVATE m dl log)
else()
target_link_libraries(yapb PRIVATE m dl pthread)
endif()
target_include_directories(yapb PRIVATE
${PROJECT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
"inc"
"ext"
"ext/crlib"
"ext/linkage"
)
install(TARGETS yapb
DESTINATION "${GAME_DIR}/${SERVER_INSTALL_DIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
if(MSVC)
install(FILES $<TARGET_PDB_FILE:yapb>
DESTINATION "${GAME_DIR}/${SERVER_INSTALL_DIR}/" OPTIONAL)
endif()