mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-11 12:21:31 +00:00
Starting from scratch. SRB2 v2.1.15
This commit is contained in:
parent
0c3386f727
commit
e4a970f894
222 changed files with 11512 additions and 26693 deletions
18
.gitattributes
vendored
18
.gitattributes
vendored
|
@ -13,20 +13,6 @@
|
||||||
*.manifest -crlf -whitespace
|
*.manifest -crlf -whitespace
|
||||||
# Patches
|
# Patches
|
||||||
/tools/SDL-1.2.14-gc/SDL-1.2.14-gc.patch -whitespace
|
/tools/SDL-1.2.14-gc/SDL-1.2.14-gc.patch -whitespace
|
||||||
# LibPNG
|
#Appveyor
|
||||||
/libs/libpng-src/CMakeLists.txt -whitespace
|
/appveyor.yml -crlf -whitespace
|
||||||
/libs/libpng-src/libpng-1.2.*.txt -whitespace
|
|
||||||
/libs/libpng-src/libpng.3 -whitespace
|
|
||||||
/libs/libpng-src/*.c -whitespace
|
|
||||||
# Zlib
|
|
||||||
/libs/zlib/contrib/amd64/amd64-match.S -whitespace
|
|
||||||
/libs/zlib/contrib/delphi/zlibd32.mak -crlf -whitespace
|
|
||||||
/libs/zlib/contrib/gcc_gvmat64/gvmat64.S -whitespace
|
|
||||||
/libs/zlib/contrib/minizip/MiniZip64_Changes.txt -whitespace
|
|
||||||
/libs/zlib/contrib/minizip/MiniZip64_info.txt -whitespace
|
|
||||||
/libs/zlib/contrib/pascal/zlibd32.mak -whitespace
|
|
||||||
/libs/zlib/nintendods/Makefile -whitespace
|
|
||||||
/libs/zlib/nintendods/README -whitespace
|
|
||||||
/libs/zlib/watcom/watcom_f.mak -crlf -whitespace
|
|
||||||
/libs/zlib/watcom/watcom_l.mak -crlf -whitespace
|
|
||||||
# Other
|
# Other
|
||||||
|
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -13,3 +13,8 @@ Win32_LIB_ASM_Release
|
||||||
*.dgb
|
*.dgb
|
||||||
*.debug
|
*.debug
|
||||||
*.debug.txt
|
*.debug.txt
|
||||||
|
/bin/VC10/
|
||||||
|
/objs/VC10/
|
||||||
|
*.user
|
||||||
|
*.db
|
||||||
|
*.opendb
|
||||||
|
|
280
CMakeLists.txt
280
CMakeLists.txt
|
@ -1,173 +1,127 @@
|
||||||
#
|
cmake_minimum_required(VERSION 3.0)
|
||||||
# Simple CMakeLists for Sonic Robo Blast 2
|
project(SRB2
|
||||||
#
|
VERSION 2.1.14
|
||||||
PROJECT(SRB2)
|
LANGUAGES C)
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
|
||||||
|
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.")
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
# Set up CMAKE path
|
||||||
# Dependencies
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||||
#
|
|
||||||
FIND_PACKAGE(SDL)
|
|
||||||
FIND_PACKAGE(SDL_mixer)
|
|
||||||
FIND_PACKAGE(PNG)
|
|
||||||
|
|
||||||
#
|
### Useful functions
|
||||||
# Common stuff
|
|
||||||
#
|
|
||||||
|
|
||||||
# not added defines:
|
# Prepend sources with current source directory
|
||||||
# -DHAVE_PNG - does not build (incorrect use of PNG_EXPORT etc.)
|
function(prepend_sources SOURCE_FILES)
|
||||||
ADD_DEFINITIONS(-DDIRECTFULLSCREEN -DSDL -DHAVE_MIXER -DNOHW -DHW3SOUND -DHAVE_BLUA -DNOASM)
|
foreach(SOURCE_FILE ${${SOURCE_FILES}})
|
||||||
|
set(MODIFIED ${MODIFIED} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
|
||||||
|
endforeach()
|
||||||
|
set(${SOURCE_FILES} ${MODIFIED} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
SET(SDL_DIR sdl) # may be set to SDL2 optionally
|
# Macro to add OSX framework
|
||||||
|
macro(add_framework fwname appname)
|
||||||
|
find_library(FRAMEWORK_${fwname}
|
||||||
|
NAMES ${fwname}
|
||||||
|
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
|
||||||
|
${CMAKE_OSX_SYSROOT}/Library
|
||||||
|
/System/Library
|
||||||
|
/Library
|
||||||
|
ATH_SUFFIXES Frameworks
|
||||||
|
NO_DEFAULT_PATH)
|
||||||
|
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
|
||||||
|
MESSAGE(ERROR ": Framework ${fwname} not found")
|
||||||
|
else()
|
||||||
|
TARGET_LINK_LIBRARIES(${appname} PRIVATE "${FRAMEWORK_${fwname}}/${fwname}")
|
||||||
|
MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
SET(COMMON_SRCS
|
# Macro to copy Windows DLLs to Debug/Release folder for easy debugging
|
||||||
src/${SDL_DIR}/dosstr.c
|
# Note: this is general purpose, we could copy anything. Just using for DLLs on MSVC though
|
||||||
src/${SDL_DIR}/endtxt.c
|
macro(copy_files_to_build_dir target dlllist_var)
|
||||||
src/${SDL_DIR}/hwsym_sdl.c
|
if(MSVC)
|
||||||
src/${SDL_DIR}/i_cdmus.c
|
# http://stackoverflow.com/a/26983405/3064195
|
||||||
src/${SDL_DIR}/i_main.c
|
foreach(dlllist_item ${${dlllist_var}})
|
||||||
src/${SDL_DIR}/i_net.c
|
get_filename_component(dllname ${dlllist_item} NAME)
|
||||||
src/${SDL_DIR}/i_system.c
|
add_custom_command(TARGET ${target} POST_BUILD
|
||||||
src/${SDL_DIR}/i_video.c
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
src/${SDL_DIR}/mixer_sound.c
|
${dlllist_item}
|
||||||
src/am_map.c
|
$<TARGET_FILE_DIR:${target}>/${dllname}
|
||||||
src/b_bot.c
|
)
|
||||||
src/blua/lapi.c
|
endforeach()
|
||||||
src/blua/lauxlib.c
|
endif()
|
||||||
src/blua/lbaselib.c
|
endmacro()
|
||||||
src/blua/lcode.c
|
|
||||||
src/blua/ldebug.c
|
|
||||||
src/blua/ldo.c
|
|
||||||
src/blua/ldump.c
|
|
||||||
src/blua/lfunc.c
|
|
||||||
src/blua/lgc.c
|
|
||||||
src/blua/linit.c
|
|
||||||
src/blua/llex.c
|
|
||||||
src/blua/lmem.c
|
|
||||||
src/blua/lobject.c
|
|
||||||
src/blua/lopcodes.c
|
|
||||||
src/blua/lparser.c
|
|
||||||
src/blua/lstate.c
|
|
||||||
src/blua/lstring.c
|
|
||||||
src/blua/lstrlib.c
|
|
||||||
src/blua/ltable.c
|
|
||||||
src/blua/ltablib.c
|
|
||||||
src/blua/ltm.c
|
|
||||||
src/blua/lundump.c
|
|
||||||
src/blua/lvm.c
|
|
||||||
src/blua/lzio.c
|
|
||||||
src/command.c
|
|
||||||
src/comptime.c
|
|
||||||
src/console.c
|
|
||||||
src/d_clisrv.c
|
|
||||||
src/d_main.c
|
|
||||||
src/d_net.c
|
|
||||||
src/d_netcmd.c
|
|
||||||
src/d_netfil.c
|
|
||||||
src/dehacked.c
|
|
||||||
src/f_finale.c
|
|
||||||
src/f_wipe.c
|
|
||||||
src/filesrch.c
|
|
||||||
src/g_game.c
|
|
||||||
src/g_input.c
|
|
||||||
src/hardware/hw3sound.c
|
|
||||||
src/hu_stuff.c
|
|
||||||
src/i_tcp.c
|
|
||||||
src/info.c
|
|
||||||
src/lua_baselib.c
|
|
||||||
src/lua_consolelib.c
|
|
||||||
src/lua_hooklib.c
|
|
||||||
src/lua_hudlib.c
|
|
||||||
src/lua_infolib.c
|
|
||||||
src/lua_maplib.c
|
|
||||||
src/lua_mathlib.c
|
|
||||||
src/lua_mobjlib.c
|
|
||||||
src/lua_playerlib.c
|
|
||||||
src/lua_script.c
|
|
||||||
src/lua_skinlib.c
|
|
||||||
src/lua_thinkerlib.c
|
|
||||||
src/lzf.c
|
|
||||||
src/m_anigif.c
|
|
||||||
src/m_argv.c
|
|
||||||
src/m_bbox.c
|
|
||||||
src/m_cheat.c
|
|
||||||
src/m_cond.c
|
|
||||||
src/m_fixed.c
|
|
||||||
src/m_menu.c
|
|
||||||
src/m_misc.c
|
|
||||||
src/m_queue.c
|
|
||||||
src/m_random.c
|
|
||||||
src/md5.c
|
|
||||||
src/mserv.c
|
|
||||||
src/p_ceilng.c
|
|
||||||
src/p_enemy.c
|
|
||||||
src/p_fab.c
|
|
||||||
src/p_floor.c
|
|
||||||
src/p_inter.c
|
|
||||||
src/p_lights.c
|
|
||||||
src/p_map.c
|
|
||||||
src/p_maputl.c
|
|
||||||
src/p_mobj.c
|
|
||||||
src/p_polyobj.c
|
|
||||||
src/p_saveg.c
|
|
||||||
src/p_setup.c
|
|
||||||
src/p_sight.c
|
|
||||||
src/p_spec.c
|
|
||||||
src/p_telept.c
|
|
||||||
src/p_tick.c
|
|
||||||
src/p_user.c
|
|
||||||
src/r_bsp.c
|
|
||||||
src/r_data.c
|
|
||||||
src/r_draw.c
|
|
||||||
src/r_main.c
|
|
||||||
src/r_plane.c
|
|
||||||
src/r_segs.c
|
|
||||||
src/r_sky.c
|
|
||||||
src/r_splats.c
|
|
||||||
src/r_things.c
|
|
||||||
src/s_sound.c
|
|
||||||
src/screen.c
|
|
||||||
src/sounds.c
|
|
||||||
src/st_stuff.c
|
|
||||||
src/string.c
|
|
||||||
src/tables.c
|
|
||||||
src/v_video.c
|
|
||||||
src/w_wad.c
|
|
||||||
src/y_inter.c
|
|
||||||
src/z_zone.c
|
|
||||||
)
|
|
||||||
|
|
||||||
#
|
# 64-bit check
|
||||||
# Platform-specific stuff
|
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||||
#
|
message(STATUS "Target is 64-bit")
|
||||||
|
set(SRB2_SYSTEM_BITS 64)
|
||||||
|
else()
|
||||||
|
set(SRB2_SYSTEM_BITS 32)
|
||||||
|
endif()
|
||||||
|
|
||||||
MACRO(EXTRALIB NAME)
|
# OS macros
|
||||||
FIND_LIBRARY(${NAME}_LIBRARY NAMES ${NAME})
|
if (UNIX)
|
||||||
IF(${NAME}_LIBRARY)
|
add_definitions(-DUNIXCOMMON)
|
||||||
MESSAGE(STATUS "Found lib${NAME}: ${${NAME}_LIBRARY}")
|
endif()
|
||||||
SET(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} ${${NAME}_LIBRARY})
|
|
||||||
ELSE(${NAME}_LIBRARY)
|
|
||||||
MESSAGE(FATAL_ERROR "Could not find lib${NAME}!")
|
|
||||||
ENDIF(${NAME}_LIBRARY)
|
|
||||||
ENDMACRO(EXTRALIB)
|
|
||||||
|
|
||||||
IF(${CMAKE_SYSTEM} MATCHES "FreeBSD")
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX -DFREEBSD)
|
find_program(OBJCOPY objcopy)
|
||||||
EXTRALIB(kvm)
|
endif()
|
||||||
ELSEIF(${CMAKE_SYSTEM} MATCHES "Linux")
|
|
||||||
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX)
|
|
||||||
EXTRALIB(m)
|
|
||||||
EXTRALIB(rt)
|
|
||||||
ELSE(${CMAKE_SYSTEM} MATCHES "FreeBSD")
|
|
||||||
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX)
|
|
||||||
MESSAGE(WARNING "No specific settings for you system, it may be not supported!")
|
|
||||||
ENDIF(${CMAKE_SYSTEM} MATCHES "FreeBSD")
|
|
||||||
|
|
||||||
#
|
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||||
# Targets
|
add_definitions(-DLINUX)
|
||||||
#
|
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||||
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIRS} ${SDL_INCLUDE_DIR} ${SDL_MIXER_INCLUDE_DIRS})
|
add_definitions(-DLINUX64)
|
||||||
ADD_EXECUTABLE(SRB2 ${COMMON_SRCS})
|
endif()
|
||||||
TARGET_LINK_LIBRARIES(SRB2 ${SDL_LIBRARY} ${SDL_MIXER_LIBRARIES} ${EXTRA_LIBRARIES})
|
endif()
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||||
|
add_definitions(-DMACOSX)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||||
|
set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||||
|
|
||||||
|
# Set EXE names so the assets CMakeLists can refer to its target
|
||||||
|
set(SRB2_SDL2_EXE_NAME srb2)
|
||||||
|
set(SRB2_WIN_EXE_NAME srb2dd)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(assets)
|
||||||
|
|
||||||
|
|
||||||
|
## config.h generation
|
||||||
|
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
||||||
|
include(GitUtilities)
|
||||||
|
git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}")
|
||||||
|
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
|
||||||
|
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
|
||||||
|
set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}")
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
||||||
|
|
||||||
|
##### PACKAGE CONFIGURATION #####
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM} MATCHES "Windows")
|
||||||
|
set(CPACK_GENERATOR "ZIP")
|
||||||
|
endif()
|
||||||
|
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||||
|
set(CPACK_GENERATOR "TGZ")
|
||||||
|
endif()
|
||||||
|
if(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||||
|
set(CPACK_GENERATOR "DragNDrop")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2")
|
||||||
|
set(CPACK_PACKAGE_VENDOR "Sonic Team Jr.")
|
||||||
|
#set(CPACK_PACKAGE_DESCRIPTION_FILE )
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
|
||||||
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
|
||||||
|
include(CPack)
|
||||||
|
|
450
SRB2.cbp
450
SRB2.cbp
|
@ -154,8 +154,8 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add directory="libs/gme/include" />
|
<Add directory="libs/gme/include" />
|
||||||
</Compiler>
|
</Compiler>
|
||||||
<Linker>
|
<Linker>
|
||||||
<Add library="SDL" />
|
<Add library="SDL2" />
|
||||||
<Add library="SDL_mixer" />
|
<Add library="SDL2_mixer" />
|
||||||
<Add library="advapi32" />
|
<Add library="advapi32" />
|
||||||
<Add library="kernel32" />
|
<Add library="kernel32" />
|
||||||
<Add library="msvcrt" />
|
<Add library="msvcrt" />
|
||||||
|
@ -200,8 +200,8 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Add directory="libs/gme/include" />
|
<Add directory="libs/gme/include" />
|
||||||
</Compiler>
|
</Compiler>
|
||||||
<Linker>
|
<Linker>
|
||||||
<Add library="SDL" />
|
<Add library="SDL2" />
|
||||||
<Add library="SDL_mixer" />
|
<Add library="SDL2_mixer" />
|
||||||
<Add library="advapi32" />
|
<Add library="advapi32" />
|
||||||
<Add library="kernel32" />
|
<Add library="kernel32" />
|
||||||
<Add library="msvcrt" />
|
<Add library="msvcrt" />
|
||||||
|
@ -3293,23 +3293,6 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Option target="Debug Mingw64/DirectX" />
|
<Option target="Debug Mingw64/DirectX" />
|
||||||
<Option target="Release Mingw64/DirectX" />
|
<Option target="Release Mingw64/DirectX" />
|
||||||
</Unit>
|
</Unit>
|
||||||
<Unit filename="src/p_fab.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Mingw/DirectX" />
|
|
||||||
<Option target="Release Mingw/DirectX" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
<Option target="Debug Mingw64/DirectX" />
|
|
||||||
<Option target="Release Mingw64/DirectX" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/p_floor.c">
|
<Unit filename="src/p_floor.c">
|
||||||
<Option compilerVar="CC" />
|
<Option compilerVar="CC" />
|
||||||
<Option target="Debug Native/SDL" />
|
<Option target="Debug Native/SDL" />
|
||||||
|
@ -4141,283 +4124,170 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Option target="Debug Mingw64/DirectX" />
|
<Option target="Debug Mingw64/DirectX" />
|
||||||
<Option target="Release Mingw64/DirectX" />
|
<Option target="Release Mingw64/DirectX" />
|
||||||
</Unit>
|
</Unit>
|
||||||
<Unit filename="src/sdl/IMG_xpm.c">
|
<Unit filename="src/sdl2/IMG_xpm.c">
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option compile="0" />
|
|
||||||
<Option link="0" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/dosstr.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/endtxt.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/endtxt.h">
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/filter/filters.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/filter/filters.h">
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/filter/hq2x.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/filter/hq2x.h">
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/filter/interp.h">
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/filter/lq2x.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/filter/lq2x.h">
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/filter/main.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option compile="0" />
|
|
||||||
<Option link="0" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/hwsym_sdl.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/hwsym_sdl.h">
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/i_cdmus.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/i_main.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/i_net.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/i_system.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/i_video.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/mixer_sound.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/ogl_sdl.c">
|
|
||||||
<Option compilerVar="CC" />
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/ogl_sdl.h">
|
|
||||||
<Option target="Debug Native/SDL" />
|
|
||||||
<Option target="Release Native/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
|
||||||
<Option target="Release Linux/SDL" />
|
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
</Unit>
|
|
||||||
<Unit filename="src/sdl/sdl_sound.c">
|
|
||||||
<Option compilerVar="CC" />
|
<Option compilerVar="CC" />
|
||||||
<Option target="Debug Native/SDL" />
|
<Option target="Debug Native/SDL" />
|
||||||
<Option target="Release Native/SDL" />
|
<Option target="Release Native/SDL" />
|
||||||
<Option target="Debug Linux/SDL" />
|
<Option target="Debug Linux/SDL" />
|
||||||
<Option target="Release Linux/SDL" />
|
<Option target="Release Linux/SDL" />
|
||||||
<Option target="Debug Mingw64/SDL" />
|
|
||||||
<Option target="Release Mingw64/SDL" />
|
|
||||||
<Option target="Debug Mingw/SDL" />
|
<Option target="Debug Mingw/SDL" />
|
||||||
<Option target="Release Mingw/SDL" />
|
<Option target="Release Mingw/SDL" />
|
||||||
</Unit>
|
</Unit>
|
||||||
<Unit filename="src/sdl/sdlmain.h">
|
<Unit filename="src/sdl2/SDL_icon.xpm">
|
||||||
<Option target="Debug Native/SDL" />
|
<Option target="Debug Native/SDL" />
|
||||||
<Option target="Release Native/SDL" />
|
<Option target="Release Native/SDL" />
|
||||||
<Option target="Debug Mingw/SDL" />
|
|
||||||
<Option target="Release Mingw/SDL" />
|
|
||||||
<Option target="Debug Any/Dummy" />
|
|
||||||
<Option target="Release Any/Dummy" />
|
|
||||||
<Option target="Debug Linux/SDL" />
|
<Option target="Debug Linux/SDL" />
|
||||||
<Option target="Release Linux/SDL" />
|
<Option target="Release Linux/SDL" />
|
||||||
<Option target="Debug Mingw64/SDL" />
|
<Option target="Debug Mingw/SDL" />
|
||||||
<Option target="Release Mingw64/SDL" />
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/dosstr.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/endtxt.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/endtxt.h">
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/hwsym_sdl.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/hwsym_sdl.h">
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/i_cdmus.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/i_main.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/i_net.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/i_system.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/i_ttf.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/i_ttf.h">
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/i_video.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/mixer_sound.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/ogl_sdl.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/ogl_sdl.h">
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/sdl_sound.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/sdl2/sdlmain.h">
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
</Unit>
|
</Unit>
|
||||||
<Unit filename="src/sounds.c">
|
<Unit filename="src/sounds.c">
|
||||||
<Option compilerVar="CC" />
|
<Option compilerVar="CC" />
|
||||||
|
@ -4590,13 +4460,13 @@ HW3SOUND for 3D hardware sound support
|
||||||
</Unit>
|
</Unit>
|
||||||
<Unit filename="src/vid_copy.s">
|
<Unit filename="src/vid_copy.s">
|
||||||
<Option compilerVar="CC" />
|
<Option compilerVar="CC" />
|
||||||
<Option compiler="avrgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
<Option compiler="gcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||||
|
<Option compiler="ppcgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||||
<Option compiler="gnu_gcc_compiler_for_mingw32" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
<Option compiler="gnu_gcc_compiler_for_mingw32" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||||
<Option compiler="gnu_gcc_compiler_for_mingw64" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
|
||||||
<Option compiler="armelfgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
<Option compiler="armelfgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||||
<Option compiler="tricoregcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
<Option compiler="tricoregcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||||
<Option compiler="ppcgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
<Option compiler="avrgcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||||
<Option compiler="gcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
<Option compiler="gnu_gcc_compiler_for_mingw64" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||||
<Option target="Debug Native/SDL" />
|
<Option target="Debug Native/SDL" />
|
||||||
<Option target="Release Native/SDL" />
|
<Option target="Release Native/SDL" />
|
||||||
<Option target="Debug Linux/SDL" />
|
<Option target="Debug Linux/SDL" />
|
||||||
|
|
38
comptime.bat
38
comptime.bat
|
@ -1,10 +1,32 @@
|
||||||
@ECHO OFF
|
@echo off
|
||||||
set REV=Unknown
|
set BRA=Unknown
|
||||||
|
set REV=illegal
|
||||||
|
|
||||||
copy nul: /b +%1\comptime.c tmp.$$$ > nul
|
copy nul: /b +%1\comptime.c tmp.$$$ > nul
|
||||||
move tmp.$$$ %1\comptime.c > nul
|
move tmp.$$$ %1\comptime.c > nul
|
||||||
SET REV=illegal
|
|
||||||
FOR /F "usebackq" %%s IN (`svnversion %1`) DO @SET REV=%%s
|
if exist .git goto gitrev
|
||||||
ECHO // Do not edit! This file was autogenerated > %1\comptime.h
|
if exist ..\.git goto gitrev
|
||||||
ECHO // by the %0 batch file >> %1\comptime.h
|
if exist .svn goto svnrev
|
||||||
ECHO // >> %1\comptime.h
|
goto filwri
|
||||||
ECHO const char* comprevision = "r%REV%"; >> %1\comptime.h
|
|
||||||
|
:gitrev
|
||||||
|
set GIT=%2
|
||||||
|
if "%GIT%"=="" set GIT=git
|
||||||
|
for /f "usebackq" %%s in (`%GIT% rev-parse --abbrev-ref HEAD`) do @set BRA=%%s
|
||||||
|
for /f "usebackq" %%s in (`%GIT% rev-parse HEAD`) do @set REV=%%s
|
||||||
|
set REV=%REV:~0,8%
|
||||||
|
goto filwri
|
||||||
|
|
||||||
|
:svnrev
|
||||||
|
set BRA=Subversion
|
||||||
|
for /f "usebackq" %%s in (`svnversion .`) do @set REV=%%s
|
||||||
|
set REV=r%REV%
|
||||||
|
goto filwri
|
||||||
|
|
||||||
|
:filwri
|
||||||
|
echo // Do not edit! This file was autogenerated > %1\comptime.h
|
||||||
|
echo // by the %0 batch file >> %1\comptime.h
|
||||||
|
echo // >> %1\comptime.h
|
||||||
|
echo const char* compbranch = "%BRA%"; >> %1\comptime.h
|
||||||
|
echo const char* comprevision = "%REV%"; >> %1\comptime.h
|
||||||
|
|
12
comptime.sh
12
comptime.sh
|
@ -1,17 +1,19 @@
|
||||||
#!/bin/sh -e
|
#!/bin/bash -e
|
||||||
path="."
|
path="."
|
||||||
if [ x"$1" != x ]; then
|
if [ x"$1" != x ]; then
|
||||||
path="$1"
|
path="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
versiongit() {
|
versiongit() {
|
||||||
gitversion=`git describe`
|
gitbranch=`git rev-parse --abbrev-ref HEAD`
|
||||||
|
gitversion=`git rev-parse HEAD`
|
||||||
cat <<EOF > $path/comptime.h
|
cat <<EOF > $path/comptime.h
|
||||||
|
|
||||||
// Do not edit! This file was autogenerated
|
// Do not edit! This file was autogenerated
|
||||||
// by the $0 script with git svn
|
// by the $0 script with git
|
||||||
//
|
//
|
||||||
const char* comprevision = "$gitversion";
|
const char* compbranch = "$gitbranch";
|
||||||
|
const char* comprevision = "${gitversion:0:8}";
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -23,6 +25,7 @@ versionsvn() {
|
||||||
// Do not edit! This file was autogenerated
|
// Do not edit! This file was autogenerated
|
||||||
// by the $0 script with subversion
|
// by the $0 script with subversion
|
||||||
//
|
//
|
||||||
|
const char* compbranch = "Subversion";
|
||||||
const char* comprevision = "r$svnrevision";
|
const char* comprevision = "r$svnrevision";
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -34,6 +37,7 @@ versionfake() {
|
||||||
// Do not edit! This file was autogenerated
|
// Do not edit! This file was autogenerated
|
||||||
// by the $0 script with an unknown or nonexist SCM
|
// by the $0 script with an unknown or nonexist SCM
|
||||||
//
|
//
|
||||||
|
const char* compbranch = "Unknown";
|
||||||
const char* comprevision = "illegal";
|
const char* comprevision = "illegal";
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
14
debian/control
vendored
14
debian/control
vendored
|
@ -4,13 +4,19 @@ Source: srb2
|
||||||
Section: games
|
Section: games
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: Callum Dickinson <gcfreak_ag20@hotmail.com>
|
Maintainer: Callum Dickinson <gcfreak_ag20@hotmail.com>
|
||||||
Build-Depends: debhelper (>= 7.0.50~), libsdl1.2-dev (>= 1.2.7), libsdl-mixer1.2-dev (>= 1.2.7), libpng12-dev (>= 1.2.7), libglu1-dev | libglu-dev, libosmesa6-dev | libgl-dev, nasm [i386]
|
Build-Depends: debhelper (>= 7.0.50~),
|
||||||
|
libsdl2-dev,
|
||||||
|
libsdl2-mixer-dev,
|
||||||
|
libpng12-dev (>= 1.2.7),
|
||||||
|
libglu1-dev | libglu-dev,
|
||||||
|
libosmesa6-dev | libgl-dev,
|
||||||
|
nasm [i386]
|
||||||
Standards-Version: 3.8.4
|
Standards-Version: 3.8.4
|
||||||
Homepage: http://www.srb2.org
|
Homepage: http://www.srb2.org
|
||||||
|
|
||||||
Package: srb2
|
Package: srb2
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.0.6)
|
Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14)
|
||||||
Description: A cross-platform 3D Sonic fangame
|
Description: A cross-platform 3D Sonic fangame
|
||||||
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
|
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
|
||||||
fangame built using a modified version of the Doom Legacy
|
fangame built using a modified version of the Doom Legacy
|
||||||
|
@ -22,8 +28,8 @@ Description: A cross-platform 3D Sonic fangame
|
||||||
|
|
||||||
Package: srb2-dbg
|
Package: srb2-dbg
|
||||||
Architecture: any
|
Architecture: any
|
||||||
# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.0.6), srb2 but dh_shlibdeps is being an asshat
|
# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat
|
||||||
Depends: libc6, ${misc:Depends}, srb2-data (= 2.0.6), srb2
|
Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14), srb2
|
||||||
Description: A cross-platform 3D Sonic fangame
|
Description: A cross-platform 3D Sonic fangame
|
||||||
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
|
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
|
||||||
fangame built using a modified version of the Doom Legacy
|
fangame built using a modified version of the Doom Legacy
|
||||||
|
|
17
debian/rules
vendored
17
debian/rules
vendored
|
@ -59,16 +59,18 @@ DBGNAME = debug/$(EXENAME)
|
||||||
|
|
||||||
PKGDIR = usr/games
|
PKGDIR = usr/games
|
||||||
DBGDIR = usr/lib/debug/$(PKGDIR)
|
DBGDIR = usr/lib/debug/$(PKGDIR)
|
||||||
|
PIXMAPS_DIR = usr/share/pixmaps
|
||||||
|
DESKTOP_DIR = usr/share/applications
|
||||||
PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)")
|
PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)")
|
||||||
OS = LINUX=1
|
OS = LINUX=1
|
||||||
NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1")
|
NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1")
|
||||||
MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl PNG_PKGCONFIG=libpng NOOBJDUMP=1
|
MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng NOOBJDUMP=1
|
||||||
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
|
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
|
||||||
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
|
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
|
||||||
# FIXME pkg-config dir hacks
|
# FIXME pkg-config dir hacks
|
||||||
export PKG_CONFIG_LIBDIR = /usr/$(CROSS_COMPILE_HOST)/lib/pkgconfig
|
export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig
|
||||||
BINDIR := $(DIR)/bin/Linux/Release
|
BINDIR := $(DIR)/bin/Linux/Release
|
||||||
LDFLAGS += "-Wl,-rpath=/usr/$(CROSS_COMPILE_HOST)/lib/"
|
LDFLAGS += "-Wl,-rpath=/usr/lib/$(CROSS_COMPILE_HOST)"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MKDIR) $(BINDIR)/debug
|
$(MKDIR) $(BINDIR)/debug
|
||||||
|
@ -80,14 +82,23 @@ binary-indep:
|
||||||
echo "no need to do any arch-independent stuff"
|
echo "no need to do any arch-independent stuff"
|
||||||
|
|
||||||
binary-arch:
|
binary-arch:
|
||||||
|
# create ddirs
|
||||||
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DBGDIR)
|
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DBGDIR)
|
||||||
|
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DESKTOP_DIR)
|
||||||
|
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(PIXMAPS_DIR)
|
||||||
|
# install main binaries
|
||||||
$(INSTALL) $(BINDIR)/$(EXENAME) $(DIR)/debian/tmp/$(PKGDIR)/$(PACKAGE)
|
$(INSTALL) $(BINDIR)/$(EXENAME) $(DIR)/debian/tmp/$(PKGDIR)/$(PACKAGE)
|
||||||
$(INSTALL) $(BINDIR)/$(DBGNAME) $(DIR)/debian/tmp/$(DBGDIR)/$(PACKAGE)
|
$(INSTALL) $(BINDIR)/$(DBGNAME) $(DIR)/debian/tmp/$(DBGDIR)/$(PACKAGE)
|
||||||
|
# Install desktop file and banner image
|
||||||
|
$(INSTALL) $(DIR)/srb2.png $(DIR)/debian/tmp/usr/share/pixmaps
|
||||||
|
$(INSTALL) $(DIR)/debian/srb2.desktop $(DIR)/debian/tmp/usr/share/applications
|
||||||
# add compiled binaries to include-binaries
|
# add compiled binaries to include-binaries
|
||||||
echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries
|
echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries
|
||||||
echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries
|
echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries
|
||||||
# Generate install folder files
|
# Generate install folder files
|
||||||
echo $(PKGDIR) > $(DIR)/debian/$(PACKAGE).install
|
echo $(PKGDIR) > $(DIR)/debian/$(PACKAGE).install
|
||||||
|
echo $(DESKTOP_DIR) >> $(DIR)/debian/$(PACKAGE).install
|
||||||
|
echo $(PIXMAPS_DIR) >> $(DIR)/debian/$(PACKAGE).install
|
||||||
echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install
|
echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install
|
||||||
|
|
||||||
binary: binary-arch
|
binary: binary-arch
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
|
@ -21,27 +21,28 @@
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{72B01ACA-7A1A-4F7B-ACEF-2607299CF052}</ProjectGuid>
|
<ProjectGuid>{72B01ACA-7A1A-4F7B-ACEF-2607299CF052}</ProjectGuid>
|
||||||
<RootNamespace>libpng</RootNamespace>
|
<RootNamespace>libpng</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -81,7 +82,7 @@
|
||||||
<AdditionalIncludeDirectories>..\..;..\..\..\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..;..\..\..\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
||||||
|
@ -116,7 +117,7 @@
|
||||||
<AdditionalIncludeDirectories>..\..;..\..\..\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..;..\..\..\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
||||||
|
@ -149,7 +150,7 @@
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
||||||
<ProgramDataBaseFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
|
<ProgramDataBaseFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
|
||||||
|
@ -183,7 +184,7 @@
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
||||||
<ProgramDataBaseFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
|
<ProgramDataBaseFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
|
@ -21,27 +21,28 @@
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{73A5729C-7323-41D4-AB48-8A03C9F81603}</ProjectGuid>
|
<ProjectGuid>{73A5729C-7323-41D4-AB48-8A03C9F81603}</ProjectGuid>
|
||||||
<RootNamespace>zlib</RootNamespace>
|
<RootNamespace>zlib</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -80,8 +81,8 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;ASMV;ASMINF;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;ASMV;ASMINF;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
||||||
<ProgramDataBaseFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
|
<ProgramDataBaseFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
|
||||||
|
@ -114,7 +115,7 @@
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
||||||
<ProgramDataBaseFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
|
<ProgramDataBaseFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ProgramDataBaseFileName>
|
||||||
|
@ -144,7 +145,7 @@
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;ASMV;ASMINF;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;ASMV;ASMINF;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
||||||
|
@ -177,7 +178,7 @@
|
||||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
<AssemblerListingLocation>$(ProjectDir)$(Platform)\$(Configuration)\</AssemblerListingLocation>
|
||||||
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
<ObjectFileName>$(ProjectDir)$(Platform)\$(Configuration)\</ObjectFileName>
|
||||||
|
|
157
readme.txt
157
readme.txt
|
@ -1,8 +1,155 @@
|
||||||
Here is the beginning of SRB2kart's 2.1 code.
|
Here it is! SRB2 v2.1.14 source code!
|
||||||
|
(why do we keep the version number up to date
|
||||||
|
when everything else in this file is hilariously old?
|
||||||
|
- Inuyasha)
|
||||||
|
|
||||||
Current version is undefined, we could use either date or legit formatting, I guess.
|
|
||||||
Date formatting is probably better for a beta work environment, until we consider it really "done".
|
|
||||||
|
|
||||||
Date format would be yyyy.mm.dd , ie 2016.01.24
|
Win32 with Visual C (6SP6+Processor Pack OR 7)
|
||||||
|
~~~
|
||||||
|
|
||||||
I don't know what else to type here right now.
|
2 VC++ 6.0 project files are included:
|
||||||
|
|
||||||
|
Win32/DirectX/FMOD
|
||||||
|
src\win32\wLegacy.dsw
|
||||||
|
You'll need FMOD to compile this version (www.fmod.org)
|
||||||
|
or
|
||||||
|
Win32/SDL/SDL_mixer
|
||||||
|
src\sdl\Win32SDL.dsp
|
||||||
|
You'll need SDL and SDL_mixer for this version (www.libsdl.org)
|
||||||
|
|
||||||
|
Both needs NASM (http://sourceforge.net/projects/nasm)
|
||||||
|
For PNG screenshot, libPNG, and Zlib (from http://gnuwin32.sourceforge.net/)
|
||||||
|
|
||||||
|
No warranty, support, etc. of any kind is offered,
|
||||||
|
just plain old as is.
|
||||||
|
Some bits of code are still really scary.
|
||||||
|
Go nuts!
|
||||||
|
|
||||||
|
|
||||||
|
Win32 with Dev-C++ (http://bloodshed.net/ free!)
|
||||||
|
~~~
|
||||||
|
2 Dev-C++ project files are included:
|
||||||
|
|
||||||
|
Win32/DirectX/FMOD
|
||||||
|
src\win32\SRB2.dev
|
||||||
|
or
|
||||||
|
Win32/SDL/SDL_mixer
|
||||||
|
src\sdl\Win32SDL.dev
|
||||||
|
You'll need SDL and SDL_mixer for this version (www.libsdl.org)
|
||||||
|
libPNG and Zlib (from http://gnuwin32.sourceforge.net/)
|
||||||
|
Note there are precompiled libpng.a and libz.a for Mingw
|
||||||
|
|
||||||
|
you will need NASM for both SDL/SDL_mixer and DirectX/FMOD
|
||||||
|
and you need DirectX 6 (or up) Dev-Paks to compile DirectX version
|
||||||
|
|
||||||
|
GNU/Linux
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
SDL 1.2.7 or better (from libsdl.org)
|
||||||
|
SDL_Mixer 1.2.2(.7 for file-less music playback) (from libsdl.org)
|
||||||
|
Nasm (use NOASM=1 if you don't have it or have an non-i386 system, I think)
|
||||||
|
libPNG 1.2.7
|
||||||
|
Zlib 1.2.3
|
||||||
|
The Xiph.org libogg and libvorbis libraries
|
||||||
|
The OpenGL headers (from Mesa, usually shipped with your X.org or XFree
|
||||||
|
installation, so you needn't worry, most likely)
|
||||||
|
GCC 3.x toolchain and binutils
|
||||||
|
GNU Make
|
||||||
|
|
||||||
|
Build instructions:
|
||||||
|
|
||||||
|
make -C src LINUX=1
|
||||||
|
|
||||||
|
Build instructions (64 bit):
|
||||||
|
|
||||||
|
make -C src LINUX64=1
|
||||||
|
|
||||||
|
Build instructions to build for Wii Linux/SRB2Wii on a PowerPC system,
|
||||||
|
follow cross-compiling instructions for cross-compiling on a x86 system:
|
||||||
|
|
||||||
|
make -C src LINUX=1 WIILINUX=1
|
||||||
|
|
||||||
|
Build instructions to build for Pandora (Linux) on a ARM system,
|
||||||
|
follow cross-compiling instructions for cross-compiling on a x86 system:
|
||||||
|
|
||||||
|
make -C src PANDORA=1
|
||||||
|
|
||||||
|
Solaris
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
SDL 1.2.5 or better (from libsdl.org)
|
||||||
|
SDL_Mixer 1.2.2(.7 for file-less music playback) (from libsdl.org)
|
||||||
|
libPNG 1.2.7
|
||||||
|
Zlib 1.2.3
|
||||||
|
The Xiph.org libogg and libvorbis libraries
|
||||||
|
The OpenGL headers (from Mesa, usually shipped with your X.org or XFree
|
||||||
|
installation, so you needn't worry, most likely)
|
||||||
|
GCC 3.x toolchain and binutils
|
||||||
|
GNU Make
|
||||||
|
|
||||||
|
You can get all these programs/libraries from the Companion CD (except SDL_mixer and OpenGL)
|
||||||
|
|
||||||
|
Build instructions:
|
||||||
|
|
||||||
|
gmake -C src SOLARIS=1
|
||||||
|
|
||||||
|
FreeBSD
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
SDL 1.2.7 or better (from libsdl.org)
|
||||||
|
SDL_Mixer 1.2.2(.7 for file-less music playback) (from libsdl.org)
|
||||||
|
Nasm (use NOASM=1 if you don't have it or have an non-i386 system, I think)
|
||||||
|
libPNG 1.2.7
|
||||||
|
Zlib 1.2.3
|
||||||
|
The Xiph.org libogg and libvorbis libraries
|
||||||
|
The OpenGL headers (from Mesa, usually shipped with your X.org or XFree
|
||||||
|
installation, so you needn't worry, most likely)
|
||||||
|
GCC 3.x toolchain and binutils
|
||||||
|
GNU Make
|
||||||
|
|
||||||
|
Build instructions:
|
||||||
|
|
||||||
|
gmake -C src FREEBSD=1
|
||||||
|
|
||||||
|
DJGPP/DOS
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
Allegro 3.12 game programming library, (from
|
||||||
|
http://alleg.sourceforge.net/index.html)
|
||||||
|
Nasm (use NOASM=1 if you don't have it)
|
||||||
|
libsocket (from http://homepages.nildram.co.uk/~phekda/richdawe/lsck/) or
|
||||||
|
Watt-32 (from http://www.bgnett.no/~giva/)
|
||||||
|
GCC 3.x toolchain and binutils
|
||||||
|
GNU Make
|
||||||
|
|
||||||
|
Build instructions:
|
||||||
|
|
||||||
|
make -C src # to link with Watt-32, add WATTCP=1
|
||||||
|
# for remote debugging over the COM port, add RDB=1
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
use tools\djgpp\all313.diff to update Allegro to a "more usable" version ;)
|
||||||
|
Example: E:\djgpp\allegro>patch -p# < D:\SRB2Code\1.1\srb2\tools\djgpp\all313.diff
|
||||||
|
|
||||||
|
Windows CE
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
SDL 1.27
|
||||||
|
|
||||||
|
Build instructions:
|
||||||
|
|
||||||
|
use src\SDL\WinCE\SRB2CE.vcw
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
binaries will turn in up in bin/
|
||||||
|
|
||||||
|
note: read the src/makefile for more options
|
||||||
|
|
||||||
|
- Sonic Team Junior
|
||||||
|
http://www.srb2.org
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual C++ Express 2010
|
# Visual Studio 14
|
||||||
|
VisualStudioVersion = 14.0.25123.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Srb2win", "src\win32\Srb2win-vc10.vcxproj", "{0F554F1D-ED49-4D65-A9A7-F63C57F277BE}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Srb2win", "src\win32\Srb2win-vc10.vcxproj", "{0F554F1D-ED49-4D65-A9A7-F63C57F277BE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libs\libpng-src\projects\visualc10\libpng.vcxproj", "{72B01ACA-7A1A-4F7B-ACEF-2607299CF052}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libs\libpng-src\projects\visualc10\libpng.vcxproj", "{72B01ACA-7A1A-4F7B-ACEF-2607299CF052}"
|
||||||
|
|
26
src/Makefile
26
src/Makefile
|
@ -262,9 +262,7 @@ else
|
||||||
OBJS+=$(OBJDIR)/hw3sound.o
|
OBJS+=$(OBJDIR)/hw3sound.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NOVERSION
|
|
||||||
OPTS += -DCOMPVERSION
|
OPTS += -DCOMPVERSION
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NONX86
|
ifndef NONX86
|
||||||
ifndef GCC29
|
ifndef GCC29
|
||||||
|
@ -305,6 +303,10 @@ PNG_LDFLAGS?=$(shell $(PNG_CONFIG) --ldflags)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef LINUX
|
||||||
|
PNG_CFLAGS+=-D_LARGEFILE64_SOURCE
|
||||||
|
endif
|
||||||
|
|
||||||
LIBS+=$(PNG_LDFLAGS)
|
LIBS+=$(PNG_LDFLAGS)
|
||||||
CFLAGS+=$(PNG_CFLAGS)
|
CFLAGS+=$(PNG_CFLAGS)
|
||||||
endif
|
endif
|
||||||
|
@ -364,13 +366,18 @@ ifdef DEBUGMODE
|
||||||
|
|
||||||
# build with debugging information
|
# build with debugging information
|
||||||
WINDRESFLAGS = -D_DEBUG
|
WINDRESFLAGS = -D_DEBUG
|
||||||
CFLAGS+=-O0 -Wall -DPARANOIA -DRANGECHECK
|
ifdef GCC48
|
||||||
|
CFLAGS+=-Og
|
||||||
|
else
|
||||||
|
CFLAGS+=-O0
|
||||||
|
endif
|
||||||
|
CFLAGS+= -Wall -DPARANOIA -DRANGECHECK
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
||||||
# build a normal optimised version
|
# build a normal optimised version
|
||||||
WINDRESFLAGS = -DNDEBUG
|
WINDRESFLAGS = -DNDEBUG
|
||||||
CFLAGS+=-O2
|
CFLAGS+=-O3
|
||||||
endif
|
endif
|
||||||
CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS)
|
CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS)
|
||||||
|
|
||||||
|
@ -435,7 +442,6 @@ OBJS:=$(i_main_o) \
|
||||||
$(OBJDIR)/info.o \
|
$(OBJDIR)/info.o \
|
||||||
$(OBJDIR)/p_ceilng.o \
|
$(OBJDIR)/p_ceilng.o \
|
||||||
$(OBJDIR)/p_enemy.o \
|
$(OBJDIR)/p_enemy.o \
|
||||||
$(OBJDIR)/p_fab.o \
|
|
||||||
$(OBJDIR)/p_floor.o \
|
$(OBJDIR)/p_floor.o \
|
||||||
$(OBJDIR)/p_inter.o \
|
$(OBJDIR)/p_inter.o \
|
||||||
$(OBJDIR)/p_lights.o \
|
$(OBJDIR)/p_lights.o \
|
||||||
|
@ -450,6 +456,7 @@ OBJS:=$(i_main_o) \
|
||||||
$(OBJDIR)/p_telept.o \
|
$(OBJDIR)/p_telept.o \
|
||||||
$(OBJDIR)/p_tick.o \
|
$(OBJDIR)/p_tick.o \
|
||||||
$(OBJDIR)/p_user.o \
|
$(OBJDIR)/p_user.o \
|
||||||
|
$(OBJDIR)/p_slopes.o \
|
||||||
$(OBJDIR)/tables.o \
|
$(OBJDIR)/tables.o \
|
||||||
$(OBJDIR)/r_bsp.o \
|
$(OBJDIR)/r_bsp.o \
|
||||||
$(OBJDIR)/r_data.o \
|
$(OBJDIR)/r_data.o \
|
||||||
|
@ -546,15 +553,11 @@ cleandep:
|
||||||
$(REMOVE) comptime.h
|
$(REMOVE) comptime.h
|
||||||
|
|
||||||
pre-build:
|
pre-build:
|
||||||
ifdef NOVERSION
|
|
||||||
-@touch comptime.c
|
|
||||||
else
|
|
||||||
ifdef WINDOWSHELL
|
ifdef WINDOWSHELL
|
||||||
-..\comptime.bat .
|
-..\comptime.bat .
|
||||||
else
|
else
|
||||||
-@../comptime.sh .
|
-@../comptime.sh .
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(REMOVE) *~ *.flc
|
$(REMOVE) *~ *.flc
|
||||||
|
@ -625,7 +628,10 @@ opengl_dll: $(BIN)/r_opengl.dll
|
||||||
$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
|
$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
|
||||||
-$(MKDIR) $(BIN)
|
-$(MKDIR) $(BIN)
|
||||||
@echo Linking R_OpenGL.dll...
|
@echo Linking R_OpenGL.dll...
|
||||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32
|
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32 -static-libgcc
|
||||||
|
ifndef NOUPX
|
||||||
|
-$(UPX) $(UPX_OPTS) $@
|
||||||
|
endif
|
||||||
|
|
||||||
minigl_dll: $(BIN)/r_minigl.dll
|
minigl_dll: $(BIN)/r_minigl.dll
|
||||||
$(BIN)/r_minigl.dll: $(OBJDIR)/r_minigl.o
|
$(BIN)/r_minigl.dll: $(OBJDIR)/r_minigl.o
|
||||||
|
|
|
@ -7,6 +7,22 @@
|
||||||
# and other things
|
# and other things
|
||||||
#
|
#
|
||||||
|
|
||||||
|
ifdef GCC53
|
||||||
|
GCC52=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef GCC52
|
||||||
|
GCC51=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef GCC51
|
||||||
|
GCC49=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef GCC49
|
||||||
|
GCC48=1
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef GCC48
|
ifdef GCC48
|
||||||
GCC47=1
|
GCC47=1
|
||||||
endif
|
endif
|
||||||
|
@ -139,6 +155,10 @@ WFLAGS+=-Wformat-security
|
||||||
ifndef GCC29
|
ifndef GCC29
|
||||||
#WFLAGS+=-Winit-self
|
#WFLAGS+=-Winit-self
|
||||||
endif
|
endif
|
||||||
|
ifdef GCC46
|
||||||
|
WFLAGS+=-Wno-suggest-attribute=noreturn
|
||||||
|
endif
|
||||||
|
|
||||||
ifndef MINGW
|
ifndef MINGW
|
||||||
ifdef GCC45
|
ifdef GCC45
|
||||||
WFLAGS+=-Wunsuffixed-float-constants
|
WFLAGS+=-Wunsuffixed-float-constants
|
||||||
|
@ -153,8 +173,12 @@ endif
|
||||||
ifdef GCC43
|
ifdef GCC43
|
||||||
#WFLAGS+=-Wno-error=clobbered
|
#WFLAGS+=-Wno-error=clobbered
|
||||||
endif
|
endif
|
||||||
|
ifdef GCC46
|
||||||
|
WFLAGS+=-Wno-error=suggest-attribute=noreturn
|
||||||
|
endif
|
||||||
WFLAGS+=$(OLDWFLAGS)
|
WFLAGS+=$(OLDWFLAGS)
|
||||||
|
|
||||||
|
|
||||||
#indicate platform and what interface use with
|
#indicate platform and what interface use with
|
||||||
ifndef WINCE
|
ifndef WINCE
|
||||||
ifndef XBOX
|
ifndef XBOX
|
||||||
|
|
82
src/am_map.c
82
src/am_map.c
|
@ -2,19 +2,20 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
// See the 'LICENSE' file for more details.
|
// See the 'LICENSE' file for more details.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file am_map.c
|
/// \file am_map.c
|
||||||
/// \brief the automap code
|
/// \brief Code for the 'automap', former Doom feature used for DEVMODE testing
|
||||||
|
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "am_map.h"
|
#include "am_map.h"
|
||||||
#include "g_input.h"
|
#include "g_input.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
|
#include "p_slopes.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
|
@ -30,9 +31,7 @@ static const UINT8 REDRANGE = 16;
|
||||||
static const UINT8 GRAYS = (1*16);
|
static const UINT8 GRAYS = (1*16);
|
||||||
static const UINT8 GRAYSRANGE = 16;
|
static const UINT8 GRAYSRANGE = 16;
|
||||||
static const UINT8 BROWNS = (3*16);
|
static const UINT8 BROWNS = (3*16);
|
||||||
static const UINT8 BROWNRANGE = 16;
|
|
||||||
static const UINT8 YELLOWS = (7*16);
|
static const UINT8 YELLOWS = (7*16);
|
||||||
static const UINT8 YELLOWRANGE = 8;
|
|
||||||
static const UINT8 GREENS = (10*16);
|
static const UINT8 GREENS = (10*16);
|
||||||
static const UINT8 GREENRANGE = 16;
|
static const UINT8 GREENRANGE = 16;
|
||||||
static const UINT8 DBLACK = 31;
|
static const UINT8 DBLACK = 31;
|
||||||
|
@ -41,11 +40,8 @@ static const UINT8 DWHITE = 0;
|
||||||
static const UINT8 NOCLIMBREDS = 248;
|
static const UINT8 NOCLIMBREDS = 248;
|
||||||
static const UINT8 NOCLIMBREDRANGE = 8;
|
static const UINT8 NOCLIMBREDRANGE = 8;
|
||||||
static const UINT8 NOCLIMBGRAYS = 204;
|
static const UINT8 NOCLIMBGRAYS = 204;
|
||||||
static const UINT8 NOCLIMBGRAYSRANGE = 4;
|
|
||||||
static const UINT8 NOCLIMBBROWNS = (2*16);
|
static const UINT8 NOCLIMBBROWNS = (2*16);
|
||||||
static const UINT8 NOCLIMBBROWNRANGE = 16;
|
|
||||||
static const UINT8 NOCLIMBYELLOWS = (11*16);
|
static const UINT8 NOCLIMBYELLOWS = (11*16);
|
||||||
static const UINT8 NOCLIMBYELLOWRANGE = 8;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _NDS
|
#ifdef _NDS
|
||||||
|
@ -67,15 +63,10 @@ static const UINT8 NOCLIMBYELLOWRANGE = 8;
|
||||||
#define TSWALLCOLORS GRAYS
|
#define TSWALLCOLORS GRAYS
|
||||||
#define TSWALLRANGE GRAYSRANGE
|
#define TSWALLRANGE GRAYSRANGE
|
||||||
#define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS
|
#define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS
|
||||||
#define NOCLIMBTSWALLRANGE NOCLIMBGRAYSRANGE
|
|
||||||
#define FDWALLCOLORS BROWNS
|
#define FDWALLCOLORS BROWNS
|
||||||
#define FDWALLRANGE BROWNRANGE
|
|
||||||
#define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS
|
#define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS
|
||||||
#define NOCLIMBFDWALLRANGE NOCLIMBBROWNRANGE
|
|
||||||
#define CDWALLCOLORS YELLOWS
|
#define CDWALLCOLORS YELLOWS
|
||||||
#define CDWALLRANGE YELLOWRANGE
|
|
||||||
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
|
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
|
||||||
#define NOCLIMBCDWALLRANGE NOCLIMBYELLOWRANGE
|
|
||||||
#define THINGCOLORS GREENS
|
#define THINGCOLORS GREENS
|
||||||
#define THINGRANGE GREENRANGE
|
#define THINGRANGE GREENRANGE
|
||||||
#define SECRETWALLCOLORS WALLCOLORS
|
#define SECRETWALLCOLORS WALLCOLORS
|
||||||
|
@ -255,29 +246,6 @@ static AMDRAWFLINEFUNC AM_drawFline;
|
||||||
|
|
||||||
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
|
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
|
||||||
|
|
||||||
/** Calculates the slope and slope according to the x-axis of a line
|
|
||||||
* segment in map coordinates (with the upright y-axis and all) so
|
|
||||||
* that it can be used with the braindead drawing stuff.
|
|
||||||
*
|
|
||||||
* \param ml The line segment.
|
|
||||||
* \param is Holds the result.
|
|
||||||
*/
|
|
||||||
static inline void AM_getIslope(const mline_t *ml, islope_t *is)
|
|
||||||
{
|
|
||||||
INT32 dx, dy;
|
|
||||||
|
|
||||||
dy = ml->a.y - ml->b.y;
|
|
||||||
dx = ml->b.x - ml->a.x;
|
|
||||||
if (!dy)
|
|
||||||
is->islp = (dx < 0 ? -INT32_MAX : INT32_MAX);
|
|
||||||
else
|
|
||||||
is->islp = FixedDiv(dx, dy);
|
|
||||||
if (!dx)
|
|
||||||
is->slp = (dy < 0 ? -INT32_MAX : INT32_MAX);
|
|
||||||
else
|
|
||||||
is->slp = FixedDiv(dy, dx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void AM_activateNewScale(void)
|
static void AM_activateNewScale(void)
|
||||||
{
|
{
|
||||||
m_x += m_w/2;
|
m_x += m_w/2;
|
||||||
|
@ -1029,6 +997,10 @@ static inline void AM_drawWalls(void)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
static mline_t l;
|
static mline_t l;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||||
|
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
{
|
{
|
||||||
|
@ -1036,6 +1008,22 @@ static inline void AM_drawWalls(void)
|
||||||
l.a.y = lines[i].v1->y;
|
l.a.y = lines[i].v1->y;
|
||||||
l.b.x = lines[i].v2->x;
|
l.b.x = lines[i].v2->x;
|
||||||
l.b.y = lines[i].v2->y;
|
l.b.y = lines[i].v2->y;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||||
|
if (slope) { \
|
||||||
|
end1 = P_GetZAt(slope, l.a.x, l.a.y); \
|
||||||
|
end2 = P_GetZAt(slope, l.b.x, l.b.y); \
|
||||||
|
} else \
|
||||||
|
end1 = end2 = normalheight;
|
||||||
|
|
||||||
|
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
|
||||||
|
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
|
||||||
|
if (lines[i].backsector) {
|
||||||
|
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
|
||||||
|
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||||
|
}
|
||||||
|
#undef SLOPEPARAMS
|
||||||
|
#endif
|
||||||
|
|
||||||
// AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap
|
// AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap
|
||||||
if (!lines[i].backsector) // 1-sided
|
if (!lines[i].backsector) // 1-sided
|
||||||
|
@ -1049,11 +1037,19 @@ static inline void AM_drawWalls(void)
|
||||||
AM_drawMline(&l, WALLCOLORS+lightlev);
|
AM_drawMline(&l, WALLCOLORS+lightlev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef ESLOPE
|
||||||
|
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||||
|
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
|
||||||
|
{
|
||||||
|
if (backf1 == backc1 && backf2 == backc2
|
||||||
|
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
|
||||||
|
#else
|
||||||
else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier
|
else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier
|
||||||
|| lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier
|
|| lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier
|
||||||
{
|
{
|
||||||
if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight
|
if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight
|
||||||
&& lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers
|
&& lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (lines[i].flags & ML_NOCLIMB)
|
if (lines[i].flags & ML_NOCLIMB)
|
||||||
{
|
{
|
||||||
|
@ -1079,12 +1075,20 @@ static inline void AM_drawWalls(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lines[i].flags & ML_NOCLIMB) {
|
if (lines[i].flags & ML_NOCLIMB) {
|
||||||
|
#ifdef ESLOPE
|
||||||
|
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||||
|
#else
|
||||||
if (lines[i].backsector->floorheight
|
if (lines[i].backsector->floorheight
|
||||||
!= lines[i].frontsector->floorheight) {
|
!= lines[i].frontsector->floorheight) {
|
||||||
|
#endif
|
||||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change
|
AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change
|
||||||
}
|
}
|
||||||
|
#ifdef ESLOPE
|
||||||
|
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||||
|
#else
|
||||||
else if (lines[i].backsector->ceilingheight
|
else if (lines[i].backsector->ceilingheight
|
||||||
!= lines[i].frontsector->ceilingheight) {
|
!= lines[i].frontsector->ceilingheight) {
|
||||||
|
#endif
|
||||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change
|
AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1093,12 +1097,20 @@ static inline void AM_drawWalls(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef ESLOPE
|
||||||
|
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||||
|
#else
|
||||||
if (lines[i].backsector->floorheight
|
if (lines[i].backsector->floorheight
|
||||||
!= lines[i].frontsector->floorheight) {
|
!= lines[i].frontsector->floorheight) {
|
||||||
|
#endif
|
||||||
AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change
|
AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change
|
||||||
}
|
}
|
||||||
|
#ifdef ESLOPE
|
||||||
|
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||||
|
#else
|
||||||
else if (lines[i].backsector->ceilingheight
|
else if (lines[i].backsector->ceilingheight
|
||||||
!= lines[i].frontsector->ceilingheight) {
|
!= lines[i].frontsector->ceilingheight) {
|
||||||
|
#endif
|
||||||
AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change
|
AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
// See the 'LICENSE' file for more details.
|
// See the 'LICENSE' file for more details.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file am_map.h
|
/// \file am_map.h
|
||||||
/// \brief AutoMap module
|
/// \brief Code for the 'automap', former Doom feature used for DEVMODE testing
|
||||||
|
|
||||||
#ifndef __AMMAP_H__
|
#ifndef __AMMAP_H__
|
||||||
#define __AMMAP_H__
|
#define __AMMAP_H__
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2007-2014 by John "JTE" Muniz.
|
// Copyright (C) 2007-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2011-2014 by Sonic Team Junior.
|
// Copyright (C) 2011-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -49,7 +49,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
|
||||||
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
||||||
{
|
{
|
||||||
cmd->forwardmove = sonic->player->cmd.forwardmove;
|
cmd->forwardmove = sonic->player->cmd.forwardmove;
|
||||||
cmd->angleturn = abs(tails->angle - sonic->angle)>>16;
|
cmd->angleturn = abs((signed)(tails->angle - sonic->angle))>>16;
|
||||||
if (sonic->angle < tails->angle)
|
if (sonic->angle < tails->angle)
|
||||||
cmd->angleturn = -cmd->angleturn;
|
cmd->angleturn = -cmd->angleturn;
|
||||||
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))
|
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2007-2014 by John "JTE" Muniz.
|
// Copyright (C) 2007-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -270,6 +270,7 @@ static int boolK (FuncState *fs, int b) {
|
||||||
|
|
||||||
static int nilK (FuncState *fs) {
|
static int nilK (FuncState *fs) {
|
||||||
TValue k, v;
|
TValue k, v;
|
||||||
|
setbvalue(&v, 0);
|
||||||
setnilvalue(&v);
|
setnilvalue(&v);
|
||||||
/* cannot use nil as key; instead use table itself to represent nil */
|
/* cannot use nil as key; instead use table itself to represent nil */
|
||||||
sethvalue(fs->L, &k, fs->h);
|
sethvalue(fs->L, &k, fs->h);
|
||||||
|
|
|
@ -137,7 +137,7 @@ static void addfield (lua_State *L, luaL_Buffer *b, int i) {
|
||||||
if (!lua_isstring(L, -1))
|
if (!lua_isstring(L, -1))
|
||||||
luaL_error(L, "invalid value (%s) at index %d in table for "
|
luaL_error(L, "invalid value (%s) at index %d in table for "
|
||||||
LUA_QL("concat"), luaL_typename(L, -1), i);
|
LUA_QL("concat"), luaL_typename(L, -1), i);
|
||||||
luaL_addvalue(b);
|
luaL_addvalue(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,13 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define INT32 __int32
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
|
#define INT32 int32_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** ==================================================================
|
** ==================================================================
|
||||||
|
@ -140,7 +147,7 @@
|
||||||
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
|
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
|
||||||
** machines, ptrdiff_t gives a good choice between int or long.)
|
** machines, ptrdiff_t gives a good choice between int or long.)
|
||||||
*/
|
*/
|
||||||
#define LUA_INTEGER ptrdiff_t
|
#define LUA_INTEGER INT32
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -502,13 +509,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define LUA_NUMBER_DOUBLE
|
//#define LUA_NUMBER_DOUBLE
|
||||||
#define LUA_NUMBER ptrdiff_t
|
#define LUA_NUMBER INT32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
|
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
|
||||||
@* over a number.
|
@* over a number.
|
||||||
*/
|
*/
|
||||||
#define LUAI_UACNUMBER ptrdiff_t
|
#define LUAI_UACNUMBER INT32
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -519,14 +526,14 @@
|
||||||
@@ lua_str2number converts a string to a number.
|
@@ lua_str2number converts a string to a number.
|
||||||
*/
|
*/
|
||||||
#ifdef LUA_WIN
|
#ifdef LUA_WIN
|
||||||
#define LUA_NUMBER_SCAN "%Ii"
|
#define LUA_NUMBER_SCAN "%d"
|
||||||
#define LUA_NUMBER_FMT "%Ii"
|
#define LUA_NUMBER_FMT "%d"
|
||||||
#else
|
#else
|
||||||
#define LUA_NUMBER_SCAN "%ti"
|
#define LUA_NUMBER_SCAN "%d"
|
||||||
#define LUA_NUMBER_FMT "%ti"
|
#define LUA_NUMBER_FMT "%d"
|
||||||
#endif
|
#endif
|
||||||
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
|
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
|
||||||
#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
|
#define LUAI_MAXNUMBER2STR 12 /* 10 digits, sign, and \0 */
|
||||||
#define lua_str2number(s,p) strtol((s), (p), 10)
|
#define lua_str2number(s,p) strtol((s), (p), 10)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -7,10 +7,18 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef COMPVERSION
|
#if (defined(CMAKECONFIG))
|
||||||
|
#include "config.h"
|
||||||
|
const char *compbranch = SRB2_COMP_BRANCH;
|
||||||
|
const char *comprevision = SRB2_COMP_REVISION;
|
||||||
|
|
||||||
|
#elif (defined(COMPVERSION))
|
||||||
#include "comptime.h"
|
#include "comptime.h"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
const char *compbranch = "Unknown";
|
||||||
const char *comprevision = "illegal";
|
const char *comprevision = "illegal";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *compdate = __DATE__;
|
const char *compdate = __DATE__;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -202,7 +202,7 @@ static void CONS_Bind_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
key = G_KeyStringtoNum(COM_Argv(1));
|
key = G_KeyStringtoNum(COM_Argv(1));
|
||||||
if (!key)
|
if (key <= 0 || key >= NUMINPUTS)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
|
CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n"));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -517,9 +517,9 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||||
rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t
|
rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t
|
||||||
rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t
|
rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t
|
||||||
rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t
|
rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t
|
||||||
rsp->actionspd = LONG(players[i].actionspd);
|
rsp->actionspd = (fixed_t)LONG(players[i].actionspd);
|
||||||
rsp->mindash = LONG(players[i].mindash);
|
rsp->mindash = (fixed_t)LONG(players[i].mindash);
|
||||||
rsp->maxdash = LONG(players[i].maxdash);
|
rsp->maxdash = (fixed_t)LONG(players[i].maxdash);
|
||||||
rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor);
|
rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor);
|
||||||
|
|
||||||
rsp->speed = (fixed_t)LONG(players[i].speed);
|
rsp->speed = (fixed_t)LONG(players[i].speed);
|
||||||
|
@ -531,6 +531,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||||
rsp->deadtimer = players[i].deadtimer;
|
rsp->deadtimer = players[i].deadtimer;
|
||||||
rsp->exiting = (tic_t)LONG(players[i].exiting);
|
rsp->exiting = (tic_t)LONG(players[i].exiting);
|
||||||
rsp->homing = players[i].homing;
|
rsp->homing = players[i].homing;
|
||||||
|
rsp->skidtime = (tic_t)LONG(players[i].skidtime);
|
||||||
rsp->cmomx = (fixed_t)LONG(players[i].cmomx);
|
rsp->cmomx = (fixed_t)LONG(players[i].cmomx);
|
||||||
rsp->cmomy = (fixed_t)LONG(players[i].cmomy);
|
rsp->cmomy = (fixed_t)LONG(players[i].cmomy);
|
||||||
rsp->rmomx = (fixed_t)LONG(players[i].rmomx);
|
rsp->rmomx = (fixed_t)LONG(players[i].rmomx);
|
||||||
|
@ -568,18 +569,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||||
rsp->losstime = (tic_t)LONG(players[i].losstime);
|
rsp->losstime = (tic_t)LONG(players[i].losstime);
|
||||||
rsp->timeshit = players[i].timeshit;
|
rsp->timeshit = players[i].timeshit;
|
||||||
rsp->onconveyor = LONG(players[i].onconveyor);
|
rsp->onconveyor = LONG(players[i].onconveyor);
|
||||||
|
|
||||||
rsp->starpostwp = LONG(players[i].starpostwp); // SRB2kart 16/02/21
|
|
||||||
rsp->position = LONG(players[i].position);
|
|
||||||
rsp->heldDir = LONG(players[i].heldDir);
|
|
||||||
rsp->turning = LONG(players[i].turning);
|
|
||||||
rsp->newfloorz = LONG(players[i].newfloorz);
|
|
||||||
rsp->lakitu = LONG(players[i].lakitu);
|
|
||||||
|
|
||||||
rsp->spinout = LONG(players[i].spinout);
|
|
||||||
rsp->spinouttype = players[i].spinouttype;
|
|
||||||
|
|
||||||
rsp->boosting = players[i].boosting;
|
|
||||||
|
|
||||||
rsp->hasmo = false;
|
rsp->hasmo = false;
|
||||||
//Transfer important mo information if the player has a body.
|
//Transfer important mo information if the player has a body.
|
||||||
|
@ -602,7 +591,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||||
|
|
||||||
rsp->tics = LONG(players[i].mo->tics);
|
rsp->tics = LONG(players[i].mo->tics);
|
||||||
rsp->statenum = (statenum_t)LONG(players[i].mo->state-states); // :(
|
rsp->statenum = (statenum_t)LONG(players[i].mo->state-states); // :(
|
||||||
rsp->eflags = (UINT32)LONG(players[i].mo->eflags);
|
rsp->eflags = (UINT16)SHORT(players[i].mo->eflags);
|
||||||
rsp->flags = LONG(players[i].mo->flags);
|
rsp->flags = LONG(players[i].mo->flags);
|
||||||
rsp->flags2 = LONG(players[i].mo->flags2);
|
rsp->flags2 = LONG(players[i].mo->flags2);
|
||||||
|
|
||||||
|
@ -654,9 +643,9 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||||
players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t
|
players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t
|
||||||
players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t
|
players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t
|
||||||
players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t
|
players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t
|
||||||
players[i].actionspd = LONG(rsp->actionspd);
|
players[i].actionspd = (fixed_t)LONG(rsp->actionspd);
|
||||||
players[i].mindash = LONG(rsp->mindash);
|
players[i].mindash = (fixed_t)LONG(rsp->mindash);
|
||||||
players[i].maxdash = LONG(rsp->maxdash);
|
players[i].maxdash = (fixed_t)LONG(rsp->maxdash);
|
||||||
players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor);
|
players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor);
|
||||||
|
|
||||||
players[i].speed = (fixed_t)LONG(rsp->speed);
|
players[i].speed = (fixed_t)LONG(rsp->speed);
|
||||||
|
@ -668,6 +657,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||||
players[i].deadtimer = rsp->deadtimer;
|
players[i].deadtimer = rsp->deadtimer;
|
||||||
players[i].exiting = (tic_t)LONG(rsp->exiting);
|
players[i].exiting = (tic_t)LONG(rsp->exiting);
|
||||||
players[i].homing = rsp->homing;
|
players[i].homing = rsp->homing;
|
||||||
|
players[i].skidtime = (tic_t)LONG(rsp->skidtime);
|
||||||
players[i].cmomx = (fixed_t)LONG(rsp->cmomx);
|
players[i].cmomx = (fixed_t)LONG(rsp->cmomx);
|
||||||
players[i].cmomy = (fixed_t)LONG(rsp->cmomy);
|
players[i].cmomy = (fixed_t)LONG(rsp->cmomy);
|
||||||
players[i].rmomx = (fixed_t)LONG(rsp->rmomx);
|
players[i].rmomx = (fixed_t)LONG(rsp->rmomx);
|
||||||
|
@ -725,7 +715,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||||
//At this point, the player should have a body, whether they were respawned or not.
|
//At this point, the player should have a body, whether they were respawned or not.
|
||||||
P_UnsetThingPosition(players[i].mo);
|
P_UnsetThingPosition(players[i].mo);
|
||||||
players[i].mo->angle = (angle_t)LONG(rsp->angle);
|
players[i].mo->angle = (angle_t)LONG(rsp->angle);
|
||||||
players[i].mo->eflags = (UINT32)LONG(rsp->eflags);
|
players[i].mo->eflags = (UINT16)SHORT(rsp->eflags);
|
||||||
players[i].mo->flags = LONG(rsp->flags);
|
players[i].mo->flags = LONG(rsp->flags);
|
||||||
players[i].mo->flags2 = LONG(rsp->flags2);
|
players[i].mo->flags2 = LONG(rsp->flags2);
|
||||||
players[i].mo->friction = LONG(rsp->friction);
|
players[i].mo->friction = LONG(rsp->friction);
|
||||||
|
@ -2947,9 +2937,9 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||||
if (botingame)
|
if (botingame)
|
||||||
players[newplayernum].bot = 1;
|
players[newplayernum].bot = 1;
|
||||||
// Same goes for player 2 when relevant
|
// Same goes for player 2 when relevant
|
||||||
players[newplayernum].pflags &= ~(/*PF_FLIPCAM|*/PF_ANALOGMODE);
|
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
|
||||||
//if (cv_flipcam2.value)
|
if (cv_flipcam2.value)
|
||||||
//players[newplayernum].pflags |= PF_FLIPCAM;
|
players[newplayernum].pflags |= PF_FLIPCAM;
|
||||||
if (cv_analog2.value)
|
if (cv_analog2.value)
|
||||||
players[newplayernum].pflags |= PF_ANALOGMODE;
|
players[newplayernum].pflags |= PF_ANALOGMODE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -177,9 +177,9 @@ typedef struct
|
||||||
UINT32 thokitem; //mobjtype_t
|
UINT32 thokitem; //mobjtype_t
|
||||||
UINT32 spinitem; //mobjtype_t
|
UINT32 spinitem; //mobjtype_t
|
||||||
UINT32 revitem; //mobjtype_t
|
UINT32 revitem; //mobjtype_t
|
||||||
INT32 actionspd;
|
fixed_t actionspd;
|
||||||
INT32 mindash;
|
fixed_t mindash;
|
||||||
INT32 maxdash;
|
fixed_t maxdash;
|
||||||
fixed_t jumpfactor;
|
fixed_t jumpfactor;
|
||||||
|
|
||||||
fixed_t speed;
|
fixed_t speed;
|
||||||
|
@ -191,6 +191,7 @@ typedef struct
|
||||||
INT32 deadtimer;
|
INT32 deadtimer;
|
||||||
tic_t exiting;
|
tic_t exiting;
|
||||||
UINT8 homing;
|
UINT8 homing;
|
||||||
|
tic_t skidtime;
|
||||||
fixed_t cmomx;
|
fixed_t cmomx;
|
||||||
fixed_t cmomy;
|
fixed_t cmomy;
|
||||||
fixed_t rmomx;
|
fixed_t rmomx;
|
||||||
|
@ -228,18 +229,6 @@ typedef struct
|
||||||
UINT8 timeshit;
|
UINT8 timeshit;
|
||||||
INT32 onconveyor;
|
INT32 onconveyor;
|
||||||
|
|
||||||
INT32 starpostwp; // SRB2kart 16/02/21
|
|
||||||
INT32 position;
|
|
||||||
INT32 heldDir;
|
|
||||||
INT32 turning;
|
|
||||||
INT32 newfloorz;
|
|
||||||
INT32 lakitu;
|
|
||||||
|
|
||||||
INT32 spinout;
|
|
||||||
UINT8 spinouttype;
|
|
||||||
|
|
||||||
UINT8 boosting;
|
|
||||||
|
|
||||||
//player->mo stuff
|
//player->mo stuff
|
||||||
UINT8 hasmo; //boolean
|
UINT8 hasmo; //boolean
|
||||||
|
|
||||||
|
@ -253,11 +242,11 @@ typedef struct
|
||||||
fixed_t friction;
|
fixed_t friction;
|
||||||
fixed_t movefactor;
|
fixed_t movefactor;
|
||||||
|
|
||||||
INT16 tics;
|
INT32 tics;
|
||||||
statenum_t statenum;
|
statenum_t statenum;
|
||||||
UINT32 flags;
|
UINT32 flags;
|
||||||
UINT32 flags2;
|
UINT32 flags2;
|
||||||
UINT8 eflags;
|
UINT16 eflags;
|
||||||
|
|
||||||
fixed_t radius;
|
fixed_t radius;
|
||||||
fixed_t height;
|
fixed_t height;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
130
src/d_main.c
130
src/d_main.c
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -74,6 +74,12 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||||
#include "m_cond.h" // condition initialization
|
#include "m_cond.h" // condition initialization
|
||||||
#include "fastcmp.h"
|
#include "fastcmp.h"
|
||||||
|
|
||||||
|
#ifdef CMAKECONFIG
|
||||||
|
#include "config.h"
|
||||||
|
#else
|
||||||
|
#include "config.h.in"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
#include "sdl/SRB2XBOX/xboxhelp.h"
|
#include "sdl/SRB2XBOX/xboxhelp.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,6 +96,10 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||||
#include "hardware/hw3sound.h"
|
#include "hardware/hw3sound.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
#include "lua_script.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// platform independant focus loss
|
// platform independant focus loss
|
||||||
UINT8 window_notinfocus = false;
|
UINT8 window_notinfocus = false;
|
||||||
|
|
||||||
|
@ -211,10 +221,7 @@ gamestate_t wipegamestate = GS_LEVEL;
|
||||||
|
|
||||||
static void D_Display(void)
|
static void D_Display(void)
|
||||||
{
|
{
|
||||||
static boolean menuactivestate = false;
|
boolean forcerefresh = false;
|
||||||
static gamestate_t oldgamestate = -1;
|
|
||||||
boolean redrawsbar = false;
|
|
||||||
|
|
||||||
static boolean wipe = false;
|
static boolean wipe = false;
|
||||||
INT32 wipedefindex = 0;
|
INT32 wipedefindex = 0;
|
||||||
|
|
||||||
|
@ -235,23 +242,15 @@ static void D_Display(void)
|
||||||
if (setsizeneeded)
|
if (setsizeneeded)
|
||||||
{
|
{
|
||||||
R_ExecuteSetViewSize();
|
R_ExecuteSetViewSize();
|
||||||
oldgamestate = -1; // force background redraw
|
forcerefresh = true; // force background redraw
|
||||||
redrawsbar = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the current screen if about to wipe
|
|
||||||
if (gamestate != wipegamestate)
|
|
||||||
{
|
|
||||||
wipe = true;
|
|
||||||
F_WipeStartScreen();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
wipe = false;
|
|
||||||
|
|
||||||
// draw buffered stuff to screen
|
// draw buffered stuff to screen
|
||||||
// Used only by linux GGI version
|
// Used only by linux GGI version
|
||||||
I_UpdateNoBlit();
|
I_UpdateNoBlit();
|
||||||
|
|
||||||
|
// save the current screen if about to wipe
|
||||||
|
wipe = (gamestate != wipegamestate);
|
||||||
if (wipe)
|
if (wipe)
|
||||||
{
|
{
|
||||||
// set for all later
|
// set for all later
|
||||||
|
@ -270,6 +269,7 @@ static void D_Display(void)
|
||||||
if (gamestate != GS_LEVEL // fades to black on its own timing, always
|
if (gamestate != GS_LEVEL // fades to black on its own timing, always
|
||||||
&& wipedefs[wipedefindex] != UINT8_MAX)
|
&& wipedefs[wipedefindex] != UINT8_MAX)
|
||||||
{
|
{
|
||||||
|
F_WipeStartScreen();
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
||||||
|
@ -288,8 +288,6 @@ static void D_Display(void)
|
||||||
HU_Erase();
|
HU_Erase();
|
||||||
if (automapactive)
|
if (automapactive)
|
||||||
AM_Drawer();
|
AM_Drawer();
|
||||||
if (wipe || menuactivestate || (rendermode != render_soft && rendermode != render_none) || vid.recalc)
|
|
||||||
redrawsbar = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_INTERMISSION:
|
case GS_INTERMISSION:
|
||||||
|
@ -347,11 +345,6 @@ static void D_Display(void)
|
||||||
// see if the border needs to be initially drawn
|
// see if the border needs to be initially drawn
|
||||||
if (gamestate == GS_LEVEL)
|
if (gamestate == GS_LEVEL)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if (oldgamestate != GS_LEVEL)
|
|
||||||
R_FillBackScreen(); // draw the pattern into the back screen
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// draw the view directly
|
// draw the view directly
|
||||||
if (!automapactive && !dedicated && cv_renderview.value)
|
if (!automapactive && !dedicated && cv_renderview.value)
|
||||||
{
|
{
|
||||||
|
@ -407,17 +400,17 @@ static void D_Display(void)
|
||||||
lastdraw = false;
|
lastdraw = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ST_Drawer(redrawsbar);
|
ST_Drawer();
|
||||||
|
|
||||||
HU_Drawer();
|
HU_Drawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// change gamma if needed
|
// change gamma if needed
|
||||||
if (gamestate != oldgamestate && gamestate != GS_LEVEL)
|
// (GS_LEVEL handles this already due to level-specific palettes)
|
||||||
|
if (forcerefresh && gamestate != GS_LEVEL)
|
||||||
V_SetPalette(0);
|
V_SetPalette(0);
|
||||||
|
|
||||||
menuactivestate = menuactive;
|
wipegamestate = gamestate;
|
||||||
oldgamestate = wipegamestate = gamestate;
|
|
||||||
|
|
||||||
// draw pause pic
|
// draw pause pic
|
||||||
if (paused && cv_showhud.value && (!menuactive || netgame))
|
if (paused && cv_showhud.value && (!menuactive || netgame))
|
||||||
|
@ -440,15 +433,22 @@ static void D_Display(void)
|
||||||
CON_Drawer();
|
CON_Drawer();
|
||||||
|
|
||||||
M_Drawer(); // menu is drawn even on top of everything
|
M_Drawer(); // menu is drawn even on top of everything
|
||||||
|
// focus lost moved to M_Drawer
|
||||||
|
|
||||||
// focus lost notification goes on top of everything, even the former everything
|
//
|
||||||
if (window_notinfocus)
|
// wipe update
|
||||||
|
//
|
||||||
|
if (wipe)
|
||||||
{
|
{
|
||||||
M_DrawTextBox((BASEVIDWIDTH/2) - (60), (BASEVIDHEIGHT/2) - (16), 13, 2);
|
// note: moved up here because NetUpdate does input changes
|
||||||
if (gamestate == GS_LEVEL && (P_AutoPause() || paused))
|
// and input during wipe tends to mess things up
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), V_YELLOWMAP, "Game Paused");
|
wipedefindex += WIPEFINALSHIFT;
|
||||||
else
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, (BASEVIDHEIGHT/2) - (4), V_YELLOWMAP, "Focus Lost");
|
if (rendermode != render_none)
|
||||||
|
{
|
||||||
|
F_WipeEndScreen();
|
||||||
|
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetUpdate(); // send out any new accumulation
|
NetUpdate(); // send out any new accumulation
|
||||||
|
@ -483,18 +483,6 @@ static void D_Display(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
I_FinishUpdate(); // page flip or blit buffer
|
I_FinishUpdate(); // page flip or blit buffer
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// wipe update
|
|
||||||
//
|
|
||||||
wipedefindex += WIPEFINALSHIFT;
|
|
||||||
|
|
||||||
if (rendermode != render_none)
|
|
||||||
{
|
|
||||||
F_WipeEndScreen();
|
|
||||||
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +491,6 @@ static void D_Display(void)
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
tic_t rendergametic;
|
tic_t rendergametic;
|
||||||
boolean supdate;
|
|
||||||
|
|
||||||
void D_SRB2Loop(void)
|
void D_SRB2Loop(void)
|
||||||
{
|
{
|
||||||
|
@ -594,7 +581,6 @@ void D_SRB2Loop(void)
|
||||||
|
|
||||||
// Update display, next frame, with current state.
|
// Update display, next frame, with current state.
|
||||||
D_Display();
|
D_Display();
|
||||||
supdate = false;
|
|
||||||
|
|
||||||
if (moviemode)
|
if (moviemode)
|
||||||
M_SaveFrame();
|
M_SaveFrame();
|
||||||
|
@ -628,6 +614,10 @@ void D_SRB2Loop(void)
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
HW3S_EndFrameUpdate();
|
HW3S_EndFrameUpdate();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUA_Step();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,8 +817,10 @@ static void IdentifyVersion(void)
|
||||||
// Add the weapons
|
// Add the weapons
|
||||||
D_AddFile(va(pandf,srb2waddir,"rings.dta"));
|
D_AddFile(va(pandf,srb2waddir,"rings.dta"));
|
||||||
|
|
||||||
|
#ifdef USE_PATCH_DTA
|
||||||
// Add our crappy patches to fix our bugs
|
// Add our crappy patches to fix our bugs
|
||||||
// D_AddFile(va(pandf,srb2waddir,"patch.dta"));
|
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||||
{
|
{
|
||||||
|
@ -937,9 +929,9 @@ void D_SRB2Main(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X)
|
#if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X)
|
||||||
devparm = !M_CheckParm("-nodebug");
|
devparm = M_CheckParm("-nodebug") == 0;
|
||||||
#else
|
#else
|
||||||
devparm = M_CheckParm("-debug");
|
devparm = M_CheckParm("-debug") != 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for dedicated server
|
// for dedicated server
|
||||||
|
@ -947,8 +939,8 @@ void D_SRB2Main(void)
|
||||||
dedicated = M_CheckParm("-dedicated") != 0;
|
dedicated = M_CheckParm("-dedicated") != 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strcpy(title, "SRB2 Kart"); // SRB2kart 16/02/25
|
strcpy(title, "Sonic Robo Blast 2");
|
||||||
strcpy(srb2, "SRB2 Kart");
|
strcpy(srb2, "Sonic Robo Blast 2");
|
||||||
D_MakeTitleString(srb2);
|
D_MakeTitleString(srb2);
|
||||||
|
|
||||||
#ifdef PC_DOS
|
#ifdef PC_DOS
|
||||||
|
@ -958,7 +950,7 @@ void D_SRB2Main(void)
|
||||||
#if defined (__OS2__) && !defined (HAVE_SDL)
|
#if defined (__OS2__) && !defined (HAVE_SDL)
|
||||||
// set PM window title
|
// set PM window title
|
||||||
snprintf(pmData->title, sizeof (pmData->title),
|
snprintf(pmData->title, sizeof (pmData->title),
|
||||||
"SRB2 Kart" VERSIONSTRING ": %s",
|
"Sonic Robo Blast 2" VERSIONSTRING ": %s",
|
||||||
title);
|
title);
|
||||||
pmData->title[sizeof (pmData->title) - 1] = '\0';
|
pmData->title[sizeof (pmData->title) - 1] = '\0';
|
||||||
#endif
|
#endif
|
||||||
|
@ -1112,19 +1104,25 @@ void D_SRB2Main(void)
|
||||||
#endif
|
#endif
|
||||||
D_CleanFile();
|
D_CleanFile();
|
||||||
|
|
||||||
#if 1 // SRB2kart md5s last updated 00/00/00
|
#ifndef DEVELOP // md5s last updated 12/14/14
|
||||||
|
|
||||||
// Check MD5s of autoloaded files
|
// Check MD5s of autoloaded files
|
||||||
W_VerifyFileMD5(0, "c1b9577687f8a795104aef4600720ea7"); // srb2.srb/srb2.wad
|
W_VerifyFileMD5(0, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad
|
||||||
W_VerifyFileMD5(1, "303838c6c534d9540288360fa49cca60"); // zones.dta
|
W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta
|
||||||
W_VerifyFileMD5(2, "cfca0f1c73023cbbd8f844f45480f799"); // player.dta
|
W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta
|
||||||
W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta
|
W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta
|
||||||
//W_VerifyFileMD5(4, "0c66790502e648bfce90fdc5bb15722e"); // patch.dta
|
#ifdef USE_PATCH_DTA
|
||||||
// don't check music.dta because people like to modify it, and it doesn't matter if they do
|
W_VerifyFileMD5(4, ASSET_HASH_PATCH_DTA); // patch.dta
|
||||||
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mainwads = 4; // there are 5 wads not to unload
|
// don't check music.dta because people like to modify it, and it doesn't matter if they do
|
||||||
|
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
|
||||||
|
#endif //ifndef DEVELOP
|
||||||
|
|
||||||
|
mainwads = 4; // there are 4 wads not to unload
|
||||||
|
#ifdef USE_PATCH_DTA
|
||||||
|
++mainwads; // patch.dta adds one more
|
||||||
|
#endif
|
||||||
|
|
||||||
cht_Init();
|
cht_Init();
|
||||||
|
|
||||||
|
@ -1241,7 +1239,7 @@ void D_SRB2Main(void)
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
COM_ImmedExecute(va("exec \"%s"PATHSEP"adedserv.cfg\"\n", srb2home));
|
COM_ImmedExecute(va("exec \"%s"PATHSEP"adedserv.cfg\"\n", srb2home));
|
||||||
else
|
else
|
||||||
COM_ImmedExecute(va("exec \"%s"PATHSEP"kartexec.cfg\" -noerror\n", srb2home));
|
COM_ImmedExecute(va("exec \"%s"PATHSEP"autoexec.cfg\" -noerror\n", srb2home));
|
||||||
|
|
||||||
if (!autostart)
|
if (!autostart)
|
||||||
M_PushSpecialParameters(); // push all "+" parameters at the command buffer
|
M_PushSpecialParameters(); // push all "+" parameters at the command buffer
|
||||||
|
@ -1282,13 +1280,11 @@ void D_SRB2Main(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (M_CheckParm("-ultimatemode"))
|
||||||
if (M_CheckParm("-ultimatemode")) // SRB2kart 16/02/21 - I don't think we need Ultimate mode
|
|
||||||
{
|
{
|
||||||
autostart = true;
|
autostart = true;
|
||||||
ultimatemode = true;
|
ultimatemode = true;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
if (autostart || netgame || M_CheckParm("+connect") || M_CheckParm("-connect"))
|
if (autostart || netgame || M_CheckParm("+connect") || M_CheckParm("-connect"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -17,7 +17,6 @@
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "w_wad.h" // for MAX_WADFILES
|
#include "w_wad.h" // for MAX_WADFILES
|
||||||
|
|
||||||
extern boolean supdate;
|
|
||||||
extern boolean advancedemo;
|
extern boolean advancedemo;
|
||||||
|
|
||||||
// make sure not to write back the config until it's been correctly loaded
|
// make sure not to write back the config until it's been correctly loaded
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
224
src/d_netcmd.c
224
src/d_netcmd.c
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -290,51 +290,6 @@ consvar_t cv_bombshield = {"tv_bombshield", "5", CV_NETVAR|CV_CHEAT, chanc
|
||||||
consvar_t cv_1up = {"tv_1up", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_1up = {"tv_1up", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_eggmanbox = {"tv_eggman", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_eggmanbox = {"tv_eggman", "5", CV_NETVAR|CV_CHEAT, chances_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// SRB2kart specific settings // SRB2kart 16/02/27
|
|
||||||
// SRB2kart Retro
|
|
||||||
consvar_t cv_r_magnet = {"retro_magnet", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_boo = {"retro_boo", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_mushroom = {"retro_mushroom", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_triplemushroom = {"retro_triplemushroom", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_megashroom = {"retro_megashroom", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_goldshroom = {"retro_goldshroom", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_star = {"retro_star", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_triplebanana = {"retro_triplebanana", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_fakeitem = {"retro_fakeitem", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_banana = {"retro_banana", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_greenshell = {"retro_greenshell", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_redshell = {"retro_redshell", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_triplegreenshell = {"retro_triplegreenshell", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_bobomb = {"retro_bobomb", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_blueshell = {"retro_blueshell", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_tossfeather = {"retro_tossfeather", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_fireflower = {"retro_fireflower", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_tripleredshell = {"retro_tripleredshell", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_bowsershell = {"retro_bowsershell", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_r_lightning = {"retro_lightning", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
// SRB2kart Neo
|
|
||||||
consvar_t cv_n_magnet = {"neo_magnet", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_ghost = {"neo_ghost", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_speedshoe = {"neo_speedshoe", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_tripleshoe = {"neo_tripleshoe", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_sizeup = {"neo_sizeup", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_rocketshoe = {"neo_rocketshoe", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_invincibility = {"neo_invincibility", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_triplebanana = {"neo_triplebanana", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_fakemonitor = {"neo_fakemonitor", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_banana = {"neo_banana", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_orbitspike = {"neo_orbitspike", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_jaws = {"neo_jaws", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_laserwisp = {"neo_laserwisp", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_tripleorbitspike = {"neo_tripleorbitspike", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_mine = {"neo_mine", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_deton = {"neo_deton", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_doublejaws = {"neo_doublejaws", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_spring = {"neo_spring", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_ghzwrecker = {"neo_ghzwrecker", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_n_lightning = {"neo_lightning", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
//
|
|
||||||
|
|
||||||
consvar_t cv_ringslinger = {"ringslinger", "No", CV_NETVAR|CV_NOSHOWHELP|CV_CALL|CV_CHEAT, CV_YesNo,
|
consvar_t cv_ringslinger = {"ringslinger", "No", CV_NETVAR|CV_NOSHOWHELP|CV_CALL|CV_CHEAT, CV_YesNo,
|
||||||
Ringslinger_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
Ringslinger_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_gravity = {"gravity", "0.5", CV_RESTRICT|CV_FLOAT|CV_CALL, NULL, Gravity_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_gravity = {"gravity", "0.5", CV_RESTRICT|CV_FLOAT|CV_CALL, NULL, Gravity_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -541,51 +496,6 @@ void D_RegisterServerCommands(void)
|
||||||
CV_RegisterVar(&cv_1up);
|
CV_RegisterVar(&cv_1up);
|
||||||
CV_RegisterVar(&cv_eggmanbox);
|
CV_RegisterVar(&cv_eggmanbox);
|
||||||
|
|
||||||
// SRB2kart specific settings // SRB2kart 16/02/27
|
|
||||||
// SRB2kart Retro
|
|
||||||
CV_RegisterVar(&cv_r_magnet);
|
|
||||||
CV_RegisterVar(&cv_r_boo);
|
|
||||||
CV_RegisterVar(&cv_r_mushroom);
|
|
||||||
CV_RegisterVar(&cv_r_triplemushroom);
|
|
||||||
CV_RegisterVar(&cv_r_megashroom);
|
|
||||||
CV_RegisterVar(&cv_r_goldshroom);
|
|
||||||
CV_RegisterVar(&cv_r_star);
|
|
||||||
CV_RegisterVar(&cv_r_triplebanana);
|
|
||||||
CV_RegisterVar(&cv_r_fakeitem);
|
|
||||||
CV_RegisterVar(&cv_r_banana);
|
|
||||||
CV_RegisterVar(&cv_r_greenshell);
|
|
||||||
CV_RegisterVar(&cv_r_redshell);
|
|
||||||
CV_RegisterVar(&cv_r_triplegreenshell);
|
|
||||||
CV_RegisterVar(&cv_r_bobomb);
|
|
||||||
CV_RegisterVar(&cv_r_blueshell);
|
|
||||||
CV_RegisterVar(&cv_r_tossfeather);
|
|
||||||
CV_RegisterVar(&cv_r_fireflower);
|
|
||||||
CV_RegisterVar(&cv_r_tripleredshell);
|
|
||||||
CV_RegisterVar(&cv_r_bowsershell);
|
|
||||||
CV_RegisterVar(&cv_r_lightning);
|
|
||||||
// SRB2kart Neo
|
|
||||||
CV_RegisterVar(&cv_n_magnet);
|
|
||||||
CV_RegisterVar(&cv_n_ghost);
|
|
||||||
CV_RegisterVar(&cv_n_speedshoe);
|
|
||||||
CV_RegisterVar(&cv_n_tripleshoe);
|
|
||||||
CV_RegisterVar(&cv_n_sizeup);
|
|
||||||
CV_RegisterVar(&cv_n_rocketshoe);
|
|
||||||
CV_RegisterVar(&cv_n_invincibility);
|
|
||||||
CV_RegisterVar(&cv_n_triplebanana);
|
|
||||||
CV_RegisterVar(&cv_n_fakemonitor);
|
|
||||||
CV_RegisterVar(&cv_n_banana);
|
|
||||||
CV_RegisterVar(&cv_n_orbitspike);
|
|
||||||
CV_RegisterVar(&cv_n_jaws);
|
|
||||||
CV_RegisterVar(&cv_n_laserwisp);
|
|
||||||
CV_RegisterVar(&cv_n_tripleorbitspike);
|
|
||||||
CV_RegisterVar(&cv_n_mine);
|
|
||||||
CV_RegisterVar(&cv_n_deton);
|
|
||||||
CV_RegisterVar(&cv_n_doublejaws);
|
|
||||||
CV_RegisterVar(&cv_n_spring);
|
|
||||||
CV_RegisterVar(&cv_n_ghzwrecker);
|
|
||||||
CV_RegisterVar(&cv_n_lightning);
|
|
||||||
//
|
|
||||||
|
|
||||||
CV_RegisterVar(&cv_ringslinger);
|
CV_RegisterVar(&cv_ringslinger);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_startinglives);
|
CV_RegisterVar(&cv_startinglives);
|
||||||
|
@ -687,7 +597,9 @@ void D_RegisterClientCommands(void)
|
||||||
CV_RegisterVar(&cv_gif_optimize);
|
CV_RegisterVar(&cv_gif_optimize);
|
||||||
CV_RegisterVar(&cv_gif_downscale);
|
CV_RegisterVar(&cv_gif_downscale);
|
||||||
|
|
||||||
|
#ifdef WALLSPLATS
|
||||||
CV_RegisterVar(&cv_splats);
|
CV_RegisterVar(&cv_splats);
|
||||||
|
#endif
|
||||||
|
|
||||||
// register these so it is saved to config
|
// register these so it is saved to config
|
||||||
if ((username = I_GetUserName()))
|
if ((username = I_GetUserName()))
|
||||||
|
@ -898,7 +810,7 @@ static boolean IsNameGood(char *name, INT32 playernum)
|
||||||
else if (len == 1) // Agh!
|
else if (len == 1) // Agh!
|
||||||
{
|
{
|
||||||
// Last ditch effort...
|
// Last ditch effort...
|
||||||
sprintf(name, "%d", M_Random() & 7);
|
sprintf(name, "%d", M_RandomKey(10));
|
||||||
if (!IsNameGood (name, playernum))
|
if (!IsNameGood (name, playernum))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1022,7 +934,7 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
|
||||||
* kicked with a consistency failure.
|
* kicked with a consistency failure.
|
||||||
*
|
*
|
||||||
* This function prints a message indicating the name change, unless the game
|
* This function prints a message indicating the name change, unless the game
|
||||||
* is currently showing the intro, e.g. when processing kartexec.cfg.
|
* is currently showing the intro, e.g. when processing autoexec.cfg.
|
||||||
*
|
*
|
||||||
* \param playernum Player number who has requested a name change.
|
* \param playernum Player number who has requested a name change.
|
||||||
* \param newname New name for that player. Should be good, but won't
|
* \param newname New name for that player. Should be good, but won't
|
||||||
|
@ -1201,6 +1113,13 @@ static void SendNameAndColor(void)
|
||||||
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor;
|
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cv_skin.value = players[consoleplayer].skin;
|
||||||
|
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||||
|
// will always be same as current
|
||||||
|
SetPlayerSkin(consoleplayer, cv_skin.string);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1318,6 +1237,13 @@ static void SendNameAndColor2(void)
|
||||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cv_skin2.value = players[secondplaya].skin;
|
||||||
|
CV_StealthSet(&cv_skin2, skins[players[secondplaya].skin].name);
|
||||||
|
// will always be same as current
|
||||||
|
SetPlayerSkin(secondplaya, cv_skin2.string);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1944,10 +1870,10 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
||||||
if (paused)
|
if (paused)
|
||||||
{
|
{
|
||||||
if (!menuactive || netgame)
|
if (!menuactive || netgame)
|
||||||
S_PauseSound();
|
S_PauseAudio();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
S_ResumeSound();
|
S_ResumeAudio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2672,11 +2598,13 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt,
|
||||||
memset(dest, 0, 16);
|
memset(dest, 0, 16);
|
||||||
#else
|
#else
|
||||||
XBOXSTATIC char tmpbuf[256];
|
XBOXSTATIC char tmpbuf[256];
|
||||||
|
const size_t sl = strlen(salt);
|
||||||
|
|
||||||
if (len > 256-strlen(salt))
|
if (len > 256-sl)
|
||||||
len = 256-strlen(salt);
|
len = 256-sl;
|
||||||
memcpy(tmpbuf, buffer, len);
|
memcpy(tmpbuf, buffer, len);
|
||||||
strcpy(&tmpbuf[len], salt);
|
memmove(&tmpbuf[len], salt, sl);
|
||||||
|
//strcpy(&tmpbuf[len], salt);
|
||||||
len += strlen(salt);
|
len += strlen(salt);
|
||||||
if (len < 256)
|
if (len < 256)
|
||||||
memset(&tmpbuf[len],0,256-len);
|
memset(&tmpbuf[len],0,256-len);
|
||||||
|
@ -3269,7 +3197,11 @@ static void Command_ListWADS_f(void)
|
||||||
*/
|
*/
|
||||||
static void Command_Version_f(void)
|
static void Command_Version_f(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DEVELOP
|
||||||
|
CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s)\n", compbranch, comprevision, compdate, comptime);
|
||||||
|
#else
|
||||||
CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision);
|
CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UPDATE_ALERT
|
#ifdef UPDATE_ALERT
|
||||||
|
@ -3283,7 +3215,27 @@ static void Command_ModDetails_f(void)
|
||||||
//
|
//
|
||||||
static void Command_ShowGametype_f(void)
|
static void Command_ShowGametype_f(void)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Current gametype is %d\n"), gametype);
|
INT32 j;
|
||||||
|
const char *gametypestr = NULL;
|
||||||
|
|
||||||
|
if (!(netgame || multiplayer)) // print "Single player" instead of "Co-op"
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("Current gametype is %s\n"), M_GetText("Single player"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// find name string for current gametype
|
||||||
|
for (j = 0; gametype_cons_t[j].strvalue; j++)
|
||||||
|
{
|
||||||
|
if (gametype_cons_t[j].value == gametype)
|
||||||
|
{
|
||||||
|
gametypestr = gametype_cons_t[j].strvalue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gametypestr)
|
||||||
|
CONS_Printf(M_GetText("Current gametype is %s\n"), gametypestr);
|
||||||
|
else // string for current gametype was not found above (should never happen)
|
||||||
|
CONS_Printf(M_GetText("Unknown gametype set (%d)\n"), gametype);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Plays the intro.
|
/** Plays the intro.
|
||||||
|
@ -3649,7 +3601,7 @@ retryscramble:
|
||||||
for (i = 0; i < playercount; i++)
|
for (i = 0; i < playercount; i++)
|
||||||
{
|
{
|
||||||
if (repick)
|
if (repick)
|
||||||
newteam = (INT16)((M_Random() % 2) + 1);
|
newteam = (INT16)((M_RandomByte() % 2) + 1);
|
||||||
|
|
||||||
// One team has the most players they can get, assign the rest to the other team.
|
// One team has the most players they can get, assign the rest to the other team.
|
||||||
if (red == maxcomposition || blue == maxcomposition)
|
if (red == maxcomposition || blue == maxcomposition)
|
||||||
|
@ -3694,7 +3646,7 @@ retryscramble:
|
||||||
{
|
{
|
||||||
if (repick)
|
if (repick)
|
||||||
{
|
{
|
||||||
newteam = (INT16)((M_Random() % 2) + 1);
|
newteam = (INT16)((M_RandomByte() % 2) + 1);
|
||||||
repick = false;
|
repick = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3827,50 +3779,66 @@ static void Command_Displayplayer_f(void)
|
||||||
static void Command_Tunes_f(void)
|
static void Command_Tunes_f(void)
|
||||||
{
|
{
|
||||||
const char *tunearg;
|
const char *tunearg;
|
||||||
UINT16 tune, track = 0;
|
UINT16 tunenum, track = 0;
|
||||||
const size_t argc = COM_Argc();
|
const size_t argc = COM_Argc();
|
||||||
|
|
||||||
if (argc < 2) //tunes slot ...
|
if (argc < 2) //tunes slot ...
|
||||||
{
|
{
|
||||||
CONS_Printf("tunes <slot #/map name/\"default\"> <speed> <track>:\n");
|
CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
|
||||||
CONS_Printf(M_GetText("Play a music slot at a set speed (\"1\" being normal speed).\n"));
|
CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
|
||||||
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n"));
|
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
|
||||||
CONS_Printf(M_GetText("The current tune is: %d\nThe current track is: %d\n"),
|
CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
|
||||||
(mapmusic & MUSIC_SONGMASK), ((mapmusic & MUSIC_TRACKMASK) >> MUSIC_TRACKSHIFT));
|
CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n"));
|
||||||
|
CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tunearg = COM_Argv(1);
|
tunearg = COM_Argv(1);
|
||||||
tune = (UINT16)atoi(tunearg);
|
tunenum = (UINT16)atoi(tunearg);
|
||||||
track = 0;
|
track = 0;
|
||||||
|
|
||||||
if (!strcasecmp(tunearg, "default"))
|
if (!strcasecmp(tunearg, "-show"))
|
||||||
{
|
{
|
||||||
tune = mapheaderinfo[gamemap-1]->musicslot;
|
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
|
||||||
track = mapheaderinfo[gamemap-1]->musicslottrack;
|
mapmusname, (mapmusflags & MUSIC_TRACKMASK));
|
||||||
}
|
|
||||||
else if (toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
|
|
||||||
tune = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
|
|
||||||
|
|
||||||
if (tune >= NUMMUSIC)
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Valid slots are 1 to %d, or 0 to stop music\n"), NUMMUSIC - 1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!strcasecmp(tunearg, "-none"))
|
||||||
if (argc > 3)
|
{
|
||||||
track = (UINT16)atoi(COM_Argv(3))-1;
|
|
||||||
|
|
||||||
mapmusic = tune | (track << MUSIC_TRACKSHIFT);
|
|
||||||
|
|
||||||
if (tune == mus_None)
|
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
else
|
return;
|
||||||
S_ChangeMusic(mapmusic, true);
|
}
|
||||||
|
else if (!strcasecmp(tunearg, "-default"))
|
||||||
|
{
|
||||||
|
tunearg = mapheaderinfo[gamemap-1]->musname;
|
||||||
|
track = mapheaderinfo[gamemap-1]->mustrack;
|
||||||
|
}
|
||||||
|
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
|
||||||
|
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
|
||||||
|
|
||||||
|
if (tunenum && tunenum >= 1036)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
||||||
|
|
||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
|
track = (UINT16)atoi(COM_Argv(2))-1;
|
||||||
|
|
||||||
|
if (tunenum)
|
||||||
|
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
|
||||||
|
else
|
||||||
|
strncpy(mapmusname, tunearg, 7);
|
||||||
|
mapmusname[6] = 0;
|
||||||
|
mapmusflags = (track & MUSIC_TRACKMASK);
|
||||||
|
|
||||||
|
S_ChangeMusic(mapmusname, mapmusflags, true);
|
||||||
|
|
||||||
|
if (argc > 3)
|
||||||
{
|
{
|
||||||
float speed = (float)atof(COM_Argv(2));
|
float speed = (float)atof(COM_Argv(3));
|
||||||
if (speed > 0.0f)
|
if (speed > 0.0f)
|
||||||
S_SpeedMusic(speed);
|
S_SpeedMusic(speed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -81,7 +81,9 @@ extern consvar_t cv_useranalog, cv_useranalog2;
|
||||||
extern consvar_t cv_analog, cv_analog2;
|
extern consvar_t cv_analog, cv_analog2;
|
||||||
|
|
||||||
extern consvar_t cv_netstat;
|
extern consvar_t cv_netstat;
|
||||||
|
#ifdef WALLSPLATS
|
||||||
extern consvar_t cv_splats;
|
extern consvar_t cv_splats;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern consvar_t cv_countdowntime;
|
extern consvar_t cv_countdowntime;
|
||||||
extern consvar_t cv_runscripts;
|
extern consvar_t cv_runscripts;
|
||||||
|
@ -96,19 +98,6 @@ extern consvar_t cv_jumpshield, cv_watershield, cv_ringshield, cv_forceshield, c
|
||||||
extern consvar_t cv_1up, cv_eggmanbox;
|
extern consvar_t cv_1up, cv_eggmanbox;
|
||||||
extern consvar_t cv_recycler;
|
extern consvar_t cv_recycler;
|
||||||
|
|
||||||
// SRB2kart specific settings // SRB2kart 16/02/27
|
|
||||||
// SRB2kart Retro
|
|
||||||
extern consvar_t cv_r_magnet, cv_r_boo, cv_r_mushroom, cv_r_triplemushroom, cv_r_megashroom;
|
|
||||||
extern consvar_t cv_r_goldshroom, cv_r_star, cv_r_triplebanana, cv_r_fakeitem, cv_r_banana;
|
|
||||||
extern consvar_t cv_r_greenshell, cv_r_redshell, cv_r_triplegreenshell, cv_r_bobomb, cv_r_blueshell;
|
|
||||||
extern consvar_t cv_r_tossfeather, cv_r_fireflower, cv_r_tripleredshell, cv_r_bowsershell, cv_r_lightning;
|
|
||||||
// SRB2kart Neo
|
|
||||||
extern consvar_t cv_n_magnet, cv_n_ghost, cv_n_speedshoe, cv_n_tripleshoe, cv_n_sizeup;
|
|
||||||
extern consvar_t cv_n_rocketshoe, cv_n_invincibility, cv_n_triplebanana, cv_n_fakemonitor, cv_n_banana;
|
|
||||||
extern consvar_t cv_n_orbitspike, cv_n_jaws, cv_n_laserwisp, cv_n_tripleorbitspike, cv_n_mine;
|
|
||||||
extern consvar_t cv_n_deton, cv_n_doublejaws, cv_n_spring, cv_n_ghzwrecker, cv_n_lightning;
|
|
||||||
//
|
|
||||||
|
|
||||||
extern consvar_t cv_itemfinder;
|
extern consvar_t cv_itemfinder;
|
||||||
|
|
||||||
extern consvar_t cv_inttime, cv_advancemap, cv_playersforexit;
|
extern consvar_t cv_inttime, cv_advancemap, cv_playersforexit;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -227,69 +227,6 @@ typedef enum
|
||||||
pw_nocontrol,
|
pw_nocontrol,
|
||||||
pw_ingoop, // In goop
|
pw_ingoop, // In goop
|
||||||
|
|
||||||
// /////////////// //
|
|
||||||
// SRB2kart Powers // // SRB2kart 16/02/15
|
|
||||||
// /////////////// //
|
|
||||||
|
|
||||||
// Basic gameplay things
|
|
||||||
|
|
||||||
pw_waypoint, // Waypoints.
|
|
||||||
pw_introcam, // Early joiners need this, or a new joiner's camera will randomly rotate
|
|
||||||
pw_sounds, // Used this to avoid sounds being played every tic
|
|
||||||
pw_pcd, // Past Checkpoint Distance
|
|
||||||
pw_ncd, // Next Chekpoint Distance
|
|
||||||
pw_drift, // Drifting Left or Right, plus a bigger counter = sharper turn
|
|
||||||
pw_driftspeed, // (Do we still need this?) (was 'pw_exspeed')
|
|
||||||
pw_driftcharge, // Charge your drift so you can release a burst of speed
|
|
||||||
pw_jmp, // In Mario Kart, letting go of the jump button stops the drift
|
|
||||||
pw_fishing, // Lakitu is fishing you out of the pit and you have to wait to be dropped
|
|
||||||
pw_kartitem, // Used for the roulette when deciding what item to give you
|
|
||||||
pw_itemslot, // If you have X item, and kartitem chose X too, save it
|
|
||||||
pw_itemclose, // Used to animate the item window closing (was 'pw_psychic')
|
|
||||||
|
|
||||||
// Some Items use timers for their duration or relative effects
|
|
||||||
|
|
||||||
pw_magnettimer, // Duration of Magnet's item-break and item box pull
|
|
||||||
pw_bootaketimer, // You are stealing an item, this is your timer
|
|
||||||
pw_boostolentimer, // You are being stolen from, this is your timer
|
|
||||||
pw_mushroomtimer, // Duration of the Mushroom Boost itself
|
|
||||||
pw_growshrinktimer, // > 0 = Big, < 0 = small
|
|
||||||
pw_squishedtimer, // Squished frame timer
|
|
||||||
pw_goldshroomtimer, // Gold Mushroom duration timer
|
|
||||||
pw_startimer, // Invincibility timer
|
|
||||||
pw_spinouttimer, // Wipe-out from a banana peel or oil slick
|
|
||||||
pw_laserwisptimer, // The duration and relative angle of the laser
|
|
||||||
pw_fireflowertimer, // Duration of Fire Flower
|
|
||||||
|
|
||||||
// Each item needs its own power slot, for the HUD and held use
|
|
||||||
|
|
||||||
pw_magnet, // 0x1 = Magnet in inventory
|
|
||||||
pw_boo, // 0x1 = Boo in inventory
|
|
||||||
pw_mushroom, // 0x1 = 1 Mushroom in inventory, 0x2 = 2 Mushrooms in inventory
|
|
||||||
// 0x4 = 3 Mushrooms in inventory
|
|
||||||
pw_megashroom, // 0x1 = Mega Mushroom in inventory
|
|
||||||
pw_goldshroom, // 0x1 = Gold Mushroom in inventory
|
|
||||||
pw_star, // 0x1 = Star in inventory
|
|
||||||
pw_triplebanana, // 0x1 = 1 Banana following, 0x2 = 2 Bananas following
|
|
||||||
// 0x4 = 3 Bananas following, 0x8 = Triple Banana in inventory
|
|
||||||
pw_fakeitem, // 0x1 = Fake Item being held, 0x2 = Fake Item in inventory
|
|
||||||
pw_banana, // 0x1 = Banana being held, 0x2 = Banana in inventory
|
|
||||||
pw_greenshell, // 0x1 = Green Shell being held, 0x2 = Green Shell in inventory
|
|
||||||
pw_redshell, // 0x1 = Red Shell being held, 0x2 = Red Shell in inventory
|
|
||||||
pw_laserwisp, // 0x1 = Laser Wisp in inventory
|
|
||||||
pw_triplegreenshell, // 0x1 = 1 Green Shell orbiting, 0x2 = 2 Green Shells orbiting
|
|
||||||
// 0x4 = 3 Green Shells orbiting, 0x8 = Triple Green Shell in inventory
|
|
||||||
pw_bobomb, // 0x1 = Bob-omb being held, 0x2 = Bob-omb in inventory
|
|
||||||
pw_blueshell, // 0x1 = Blue Shell in inventory
|
|
||||||
pw_jaws, // 0x1 = 1 Jaws orbiting, 0x2 = 2 Jaws orbiting,
|
|
||||||
// 0x8 = 2x Jaws in inventory
|
|
||||||
pw_tossfeather, // 0x1 = Feather in inventory
|
|
||||||
pw_fireflower, // 0x1 = Fire Flower in inventory
|
|
||||||
pw_tripleredshell, // 0x1 = 1 Red Shell orbiting, 0x2 = 2 Red Shells orbiting
|
|
||||||
// 0x4 = 3 Red Shells orbiting, 0x8 = Triple Red Shell in inventory
|
|
||||||
pw_bowsershell, // 0x1 = Bowser Shell in inventory
|
|
||||||
pw_lightning, // 0x1 = Lightning in inventory
|
|
||||||
|
|
||||||
NUMPOWERS
|
NUMPOWERS
|
||||||
} powertype_t;
|
} powertype_t;
|
||||||
|
|
||||||
|
@ -429,9 +366,6 @@ typedef struct player_s
|
||||||
tic_t realtime; // integer replacement for leveltime
|
tic_t realtime; // integer replacement for leveltime
|
||||||
UINT8 laps; // Number of laps (optional)
|
UINT8 laps; // Number of laps (optional)
|
||||||
|
|
||||||
tic_t checkpointtimes[256]; // Checkpoints for race mode, etc // SRB2kart 16/02/15
|
|
||||||
INT32 playerahead; // is someone ahead of me or not? // "
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// CTF Mode Stuff //
|
// CTF Mode Stuff //
|
||||||
////////////////////
|
////////////////////
|
||||||
|
@ -500,21 +434,6 @@ typedef struct player_s
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
fixed_t fovadd; // adjust FOV for hw rendering
|
fixed_t fovadd; // adjust FOV for hw rendering
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
INT32 chargei; // SRB2kart 16/02/15 ++ All lines below until end of enum
|
|
||||||
|
|
||||||
INT32 starpostwp;
|
|
||||||
INT32 position;
|
|
||||||
INT32 heldDir; // Held dir of controls; 1 = forward, 0 = none, -1 = backward
|
|
||||||
INT32 turning;
|
|
||||||
INT32 newfloorz;
|
|
||||||
INT32 lakitu;
|
|
||||||
|
|
||||||
INT32 spinout; // Seperate timer from pw_bananacam so that you can't get stuck spinning
|
|
||||||
UINT8 spinouttype; // The type of spinout you are currently suffering, 0 = slipping forwards, 1 = completely still
|
|
||||||
|
|
||||||
UINT8 boosting; // if you're currently shroomboosting
|
|
||||||
|
|
||||||
} player_t;
|
} player_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -41,8 +41,6 @@ typedef enum
|
||||||
BT_CUSTOM1 = 1<<13,
|
BT_CUSTOM1 = 1<<13,
|
||||||
BT_CUSTOM2 = 1<<14,
|
BT_CUSTOM2 = 1<<14,
|
||||||
BT_CUSTOM3 = 1<<15,
|
BT_CUSTOM3 = 1<<15,
|
||||||
BT_FORWARD = 1<<16, // SRB2kart 16/02/15
|
|
||||||
BT_BACKWARD = 1<<17
|
|
||||||
} buttoncode_t;
|
} buttoncode_t;
|
||||||
|
|
||||||
// The data sampled per tick (single player)
|
// The data sampled per tick (single player)
|
||||||
|
|
914
src/dehacked.c
914
src/dehacked.c
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -101,6 +101,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef GETTEXT
|
#ifdef GETTEXT
|
||||||
|
@ -138,18 +139,27 @@
|
||||||
extern FILE *logstream;
|
extern FILE *logstream;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
|
||||||
|
#ifdef DEVELOP
|
||||||
#define VERSION 0 // Game version
|
#define VERSION 0 // Game version
|
||||||
#define SUBVERSION 0 // more precise version number
|
#define SUBVERSION 0 // more precise version number
|
||||||
#define VERSIONSTRING "Trunk"
|
#define VERSIONSTRING "Development EXE"
|
||||||
|
#define VERSIONSTRINGW L"Development EXE"
|
||||||
|
// most interface strings are ignored in development mode.
|
||||||
|
// we use comprevision and compbranch instead.
|
||||||
#else
|
#else
|
||||||
#define VERSION 1602 // Game version // SRB2kart 16/02/15
|
#define VERSION 201 // Game version
|
||||||
#define SUBVERSION 15 // more precise version number
|
#define SUBVERSION 15 // more precise version number
|
||||||
#define VERSIONSTRING "v16.02.15"
|
#define VERSIONSTRING "v2.1.15"
|
||||||
|
#define VERSIONSTRINGW L"v2.1.15"
|
||||||
// Hey! If you change this, add 1 to the MODVERSION below!
|
// Hey! If you change this, add 1 to the MODVERSION below!
|
||||||
// Otherwise we can't force updates!
|
// Otherwise we can't force updates!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Does this version require an added patch file?
|
||||||
|
// Comment or uncomment this as necessary.
|
||||||
|
#define USE_PATCH_DTA
|
||||||
|
|
||||||
// Modification options
|
// Modification options
|
||||||
// If you want to take advantage of the Master Server's ability to force clients to update
|
// If you want to take advantage of the Master Server's ability to force clients to update
|
||||||
// to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave
|
// to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave
|
||||||
|
@ -160,9 +170,8 @@ extern FILE *logstream;
|
||||||
|
|
||||||
// The string used in the alert that pops up in the event of an update being available.
|
// The string used in the alert that pops up in the event of an update being available.
|
||||||
// Please change to apply to your modification (we don't want everyone asking where your mod is on SRB2.org!).
|
// Please change to apply to your modification (we don't want everyone asking where your mod is on SRB2.org!).
|
||||||
// SRB2kart 16/02/15 (TODO: Put mod URL here)
|
|
||||||
#define UPDATE_ALERT_STRING \
|
#define UPDATE_ALERT_STRING \
|
||||||
"A new update is available for SRB2Kart.\n"\
|
"A new update is available for SRB2.\n"\
|
||||||
"Please visit SRB2.org to download it.\n"\
|
"Please visit SRB2.org to download it.\n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"You are using version: %s\n"\
|
"You are using version: %s\n"\
|
||||||
|
@ -178,9 +187,8 @@ extern FILE *logstream;
|
||||||
|
|
||||||
// The string used in the I_Error alert upon trying to host through command line parameters.
|
// The string used in the I_Error alert upon trying to host through command line parameters.
|
||||||
// Generally less filled with newlines, since Windows gives you lots more room to work with.
|
// Generally less filled with newlines, since Windows gives you lots more room to work with.
|
||||||
// SRB2kart 16/02/15 (TODO: Put mod URL here)
|
|
||||||
#define UPDATE_ALERT_STRING_CONSOLE \
|
#define UPDATE_ALERT_STRING_CONSOLE \
|
||||||
"A new update is available for SRB2Kart.\n"\
|
"A new update is available for SRB2.\n"\
|
||||||
"Please visit SRB2.org to download it.\n"\
|
"Please visit SRB2.org to download it.\n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"You are using version: %s\n"\
|
"You are using version: %s\n"\
|
||||||
|
@ -199,20 +207,13 @@ extern FILE *logstream;
|
||||||
// The Modification ID; must be obtained from Inuyasha ( http://mb.srb2.org/private.php?do=newpm&u=2604 ).
|
// The Modification ID; must be obtained from Inuyasha ( http://mb.srb2.org/private.php?do=newpm&u=2604 ).
|
||||||
// DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server.
|
// DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server.
|
||||||
// "12" is the default mod ID for version 2.1
|
// "12" is the default mod ID for version 2.1
|
||||||
#define MODID 9 // SRB2kart 16/02/15 (TODO: Check if this needs to be updated)
|
#define MODID 12
|
||||||
|
|
||||||
// The Modification Version, starting from 1. Do not follow your version string for this,
|
// The Modification Version, starting from 1. Do not follow your version string for this,
|
||||||
// it's only for detection of the version the player is using so the MS can alert them of an update.
|
// it's only for detection of the version the player is using so the MS can alert them of an update.
|
||||||
// Only set it higher, not lower, obviously.
|
// Only set it higher, not lower, obviously.
|
||||||
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
|
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
|
||||||
#define MODVERSION 7
|
#define MODVERSION 20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// some tests, enable or disable it if it run or not
|
|
||||||
#define SPLITSCREEN
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
|
@ -349,11 +350,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...) FUNCDEBUG;
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
|
|
||||||
// Things that used to be in dstrings.h
|
// Things that used to be in dstrings.h
|
||||||
#define DEVMAPS "devmaps"
|
#define SAVEGAMENAME "srb2sav"
|
||||||
#define DEVDATA "devdata"
|
|
||||||
|
|
||||||
#define SAVEGAMENAME "srb2kartsav" // SRB2kart 16/02/15
|
|
||||||
|
|
||||||
char savegamename[256];
|
char savegamename[256];
|
||||||
|
|
||||||
// m_misc.h
|
// m_misc.h
|
||||||
|
@ -425,18 +422,14 @@ INT32 I_GetKey(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Compile date and time and revision.
|
// Compile date and time and revision.
|
||||||
extern const char *compdate, *comptime, *comprevision;
|
extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||||
|
|
||||||
// Disabled code and code under testing
|
// Disabled code and code under testing
|
||||||
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
||||||
// Compile them at your own risk!
|
// Compile them at your own risk!
|
||||||
|
|
||||||
/// Max recursive portal renders
|
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
|
||||||
/// \note obsoleted by cv_maxportals
|
#define ESLOPE
|
||||||
//#define PORTAL_LIMIT 8
|
|
||||||
|
|
||||||
/// Fun experimental slope stuff!
|
|
||||||
//#define SLOPENESS
|
|
||||||
|
|
||||||
/// Delete file while the game is running.
|
/// Delete file while the game is running.
|
||||||
/// \note EXTREMELY buggy, tends to crash game.
|
/// \note EXTREMELY buggy, tends to crash game.
|
||||||
|
@ -454,10 +447,6 @@ extern const char *compdate, *comptime, *comprevision;
|
||||||
/// Polyobject fake flat code
|
/// Polyobject fake flat code
|
||||||
#define POLYOBJECTS_PLANES
|
#define POLYOBJECTS_PLANES
|
||||||
|
|
||||||
/// Blue spheres for future use.
|
|
||||||
/// \todo Remove this define.
|
|
||||||
#define BLUE_SPHERES // Blue spheres for future use.
|
|
||||||
|
|
||||||
/// Improved way of dealing with ping values and a ping limit.
|
/// Improved way of dealing with ping values and a ping limit.
|
||||||
#define NEWPING
|
#define NEWPING
|
||||||
|
|
||||||
|
@ -495,4 +484,8 @@ extern const char *compdate, *comptime, *comprevision;
|
||||||
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
|
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
|
||||||
//#define REDSANALOG
|
//#define REDSANALOG
|
||||||
|
|
||||||
|
/// Backwards compatibility with musicslots.
|
||||||
|
/// \note You should leave this enabled unless you're working with a future SRB2 version.
|
||||||
|
#define MUSICSLOT_COMPATIBILITY
|
||||||
|
|
||||||
#endif // __DOOMDEF__
|
#endif // __DOOMDEF__
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -31,15 +31,11 @@
|
||||||
|
|
||||||
// Selected by user.
|
// Selected by user.
|
||||||
extern INT16 gamemap;
|
extern INT16 gamemap;
|
||||||
|
extern char mapmusname[7];
|
||||||
// ----------------xxxxxxxxxxxxxxxx = music slot
|
extern UINT16 mapmusflags;
|
||||||
// -xxxxxxxxxxxxxxx---------------- = track slot
|
#define MUSIC_TRACKMASK 0x0FFF // ----************
|
||||||
// x------------------------------- = reset music bit
|
#define MUSIC_RELOADRESET 0x8000 // *---------------
|
||||||
extern UINT32 mapmusic;
|
// Use other bits if necessary.
|
||||||
#define MUSIC_TRACKSHIFT 16
|
|
||||||
#define MUSIC_SONGMASK 0x0000FFFF
|
|
||||||
#define MUSIC_TRACKMASK 0x7FFF0000
|
|
||||||
#define MUSIC_RELOADRESET 0x80000000
|
|
||||||
|
|
||||||
extern INT16 maptol;
|
extern INT16 maptol;
|
||||||
extern UINT8 globalweather;
|
extern UINT8 globalweather;
|
||||||
|
@ -146,11 +142,13 @@ typedef struct
|
||||||
UINT16 xcoord[8];
|
UINT16 xcoord[8];
|
||||||
UINT16 ycoord[8];
|
UINT16 ycoord[8];
|
||||||
UINT16 picduration[8];
|
UINT16 picduration[8];
|
||||||
UINT16 musicslot;
|
|
||||||
UINT8 musicloop;
|
UINT8 musicloop;
|
||||||
UINT16 textxpos;
|
UINT16 textxpos;
|
||||||
UINT16 textypos;
|
UINT16 textypos;
|
||||||
|
|
||||||
|
char musswitch[7];
|
||||||
|
UINT16 musswitchflags;
|
||||||
|
|
||||||
UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade
|
UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade
|
||||||
UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0
|
UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0
|
||||||
UINT8 fadeoutid; // ID of the second fade, to the new screen
|
UINT8 fadeoutid; // ID of the second fade, to the new screen
|
||||||
|
@ -218,8 +216,8 @@ typedef struct
|
||||||
UINT8 actnum; ///< Act number or 0 for none.
|
UINT8 actnum; ///< Act number or 0 for none.
|
||||||
UINT16 typeoflevel; ///< Combination of typeoflevel flags.
|
UINT16 typeoflevel; ///< Combination of typeoflevel flags.
|
||||||
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
|
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
|
||||||
UINT16 musicslot; ///< Music slot number to play. 0 for no music.
|
char musname[7]; ///< Music track to play. "" for no music.
|
||||||
UINT16 musicslottrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
||||||
char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
|
char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
|
||||||
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
|
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
|
||||||
INT16 skynum; ///< Sky number to use.
|
INT16 skynum; ///< Sky number to use.
|
||||||
|
@ -235,7 +233,6 @@ typedef struct
|
||||||
UINT8 cutscenenum; ///< Cutscene number to use, 0 for none.
|
UINT8 cutscenenum; ///< Cutscene number to use, 0 for none.
|
||||||
INT16 countdown; ///< Countdown until level end?
|
INT16 countdown; ///< Countdown until level end?
|
||||||
UINT16 palette; ///< PAL lump to use on this map
|
UINT16 palette; ///< PAL lump to use on this map
|
||||||
boolean automap; ///< Displays a level's white map outline in modified games // SRB2kart 16/02/15
|
|
||||||
UINT8 numlaps; ///< Number of laps in circuit mode, unless overridden.
|
UINT8 numlaps; ///< Number of laps in circuit mode, unless overridden.
|
||||||
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
|
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
|
||||||
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
||||||
|
@ -290,10 +287,7 @@ enum TypeOfLevel
|
||||||
TOL_MARIO = 0x0200, ///< Mario
|
TOL_MARIO = 0x0200, ///< Mario
|
||||||
TOL_NIGHTS = 0x0400, ///< NiGHTS
|
TOL_NIGHTS = 0x0400, ///< NiGHTS
|
||||||
TOL_ERZ3 = 0x0800, ///< ERZ3
|
TOL_ERZ3 = 0x0800, ///< ERZ3
|
||||||
TOL_XMAS = 0x1000, ///< Christmas NiGHTS
|
TOL_XMAS = 0x1000 ///< Christmas NiGHTS
|
||||||
|
|
||||||
TOL_RETROKART = 0x2000, ///< SRB2kart 'Retro' mode // SRB2kart 16/02/15
|
|
||||||
TOL_NEOKART = 0x4000 ///< SRB2kart 'Neo' mode
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Gametypes
|
// Gametypes
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -94,17 +94,18 @@ typedef long ssize_t;
|
||||||
#ifdef __APPLE_CC__
|
#ifdef __APPLE_CC__
|
||||||
#define DIRECTFULLSCREEN
|
#define DIRECTFULLSCREEN
|
||||||
#define DEBUG_LOG
|
#define DEBUG_LOG
|
||||||
#define HWRENDER
|
|
||||||
#define NOIPX
|
#define NOIPX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (_MSC_VER) || defined (__OS2__)
|
#if defined (_MSC_VER) || defined (__OS2__)
|
||||||
// Microsoft VisualC++
|
// Microsoft VisualC++
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
#if (_MSC_VER <= 1800) // MSVC 2013 and back
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#if (_MSC_VER <= 1200)
|
#if (_MSC_VER <= 1200) // MSVC 2012 and back
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define strncasecmp strnicmp
|
#define strncasecmp strnicmp
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
|
@ -177,11 +178,15 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
// not the number of bytes in the buffer.
|
// not the number of bytes in the buffer.
|
||||||
#define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst)
|
#define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst)
|
||||||
|
|
||||||
|
// \note __BYTEBOOL__ used to be set above if "macintosh" was defined,
|
||||||
|
// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now?
|
||||||
#ifndef __BYTEBOOL__
|
#ifndef __BYTEBOOL__
|
||||||
#define __BYTEBOOL__
|
#define __BYTEBOOL__
|
||||||
|
|
||||||
//faB: clean that up !!
|
//faB: clean that up !!
|
||||||
#if (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
|
#if defined( _MSC_VER) && (_MSC_VER >= 1800) // MSVC 2013 and forward
|
||||||
|
#include "stdbool.h"
|
||||||
|
#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
|
||||||
#define false FALSE // use windows types
|
#define false FALSE // use windows types
|
||||||
#define true TRUE
|
#define true TRUE
|
||||||
#define boolean BOOL
|
#define boolean BOOL
|
||||||
|
@ -193,7 +198,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
#else
|
#else
|
||||||
typedef enum {false, true} boolean;
|
typedef enum {false, true} boolean;
|
||||||
#endif
|
#endif
|
||||||
//#endif // __cplusplus
|
|
||||||
#endif // __BYTEBOOL__
|
#endif // __BYTEBOOL__
|
||||||
|
|
||||||
/* 7.18.2.1 Limits of exact-width integer types */
|
/* 7.18.2.1 Limits of exact-width integer types */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2014 by Sonic Team Junior.
|
// Copyright (C) 2014-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -559,7 +559,7 @@ static void F_IntroDrawScene(void)
|
||||||
if (finalecount < 4)
|
if (finalecount < 4)
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
if (finalecount == 4)
|
if (finalecount == 4)
|
||||||
S_ChangeMusic(mus_stjr, false);
|
S_ChangeMusicInternal("stjr", false);
|
||||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
|
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
|
||||||
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
|
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
|
||||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect);
|
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect);
|
||||||
|
@ -603,7 +603,7 @@ static void F_IntroDrawScene(void)
|
||||||
|
|
||||||
if (finalecount-84 < 58) { // Pure Fat is driving up!
|
if (finalecount-84 < 58) { // Pure Fat is driving up!
|
||||||
int ftime = (finalecount-84);
|
int ftime = (finalecount-84);
|
||||||
x = (-189<<FRACBITS) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
|
x = (-189*FRACUNIT) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
|
||||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
||||||
// Draw the body
|
// Draw the body
|
||||||
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);
|
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);
|
||||||
|
@ -771,7 +771,7 @@ void F_IntroDrawer(void)
|
||||||
F_RunWipe(99,true);
|
F_RunWipe(99,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
S_ChangeMusic(mus_read_m, false);
|
S_ChangeMusicInternal("read_m", false);
|
||||||
}
|
}
|
||||||
else if (intro_scenenum == 3)
|
else if (intro_scenenum == 3)
|
||||||
roidtics = BASEVIDWIDTH - 64;
|
roidtics = BASEVIDWIDTH - 64;
|
||||||
|
@ -977,11 +977,13 @@ static const char *credits[] = {
|
||||||
"\"Monster\" Iestyn Jealous",
|
"\"Monster\" Iestyn Jealous",
|
||||||
"Ronald \"Furyhunter\" Kinard", // The SDL2 port
|
"Ronald \"Furyhunter\" Kinard", // The SDL2 port
|
||||||
"John \"JTE\" Muniz",
|
"John \"JTE\" Muniz",
|
||||||
|
"Ehab \"Wolfy\" Saeed",
|
||||||
"\"SSNTails\"",
|
"\"SSNTails\"",
|
||||||
"Matthew \"Inuyasha\" Walsh",
|
"Matthew \"Inuyasha\" Walsh",
|
||||||
"",
|
"",
|
||||||
"\1Programming",
|
"\1Programming",
|
||||||
"\1Assistance",
|
"\1Assistance",
|
||||||
|
"\"chi.miru\"", // Red's secret weapon, the REAL reason slopes exist (also helped port drawing code from ZDoom)
|
||||||
"Andrew \"orospakr\" Clunis",
|
"Andrew \"orospakr\" Clunis",
|
||||||
"Gregor \"Oogaland\" Dick",
|
"Gregor \"Oogaland\" Dick",
|
||||||
"Julio \"Chaos Zero 64\" Guir",
|
"Julio \"Chaos Zero 64\" Guir",
|
||||||
|
@ -995,7 +997,7 @@ static const char *credits[] = {
|
||||||
"",
|
"",
|
||||||
"\1Sprite Artists",
|
"\1Sprite Artists",
|
||||||
"Odi \"Iceman404\" Atunzu",
|
"Odi \"Iceman404\" Atunzu",
|
||||||
"Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D:
|
"Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D:
|
||||||
"Jim \"MotorRoach\" DeMello",
|
"Jim \"MotorRoach\" DeMello",
|
||||||
"Desmond \"Blade\" DesJardins",
|
"Desmond \"Blade\" DesJardins",
|
||||||
"Sherman \"CoatRack\" DesJardins",
|
"Sherman \"CoatRack\" DesJardins",
|
||||||
|
@ -1006,6 +1008,7 @@ static const char *credits[] = {
|
||||||
"\1Texture Artists",
|
"\1Texture Artists",
|
||||||
"Ryan \"Blaze Hedgehog\" Bloom",
|
"Ryan \"Blaze Hedgehog\" Bloom",
|
||||||
"Buddy \"KinkaJoy\" Fischer",
|
"Buddy \"KinkaJoy\" Fischer",
|
||||||
|
"Vivian \"toaster\" Grannell",
|
||||||
"Kepa \"Nev3r\" Iceta",
|
"Kepa \"Nev3r\" Iceta",
|
||||||
"Jarrett \"JEV3\" Voight",
|
"Jarrett \"JEV3\" Voight",
|
||||||
"",
|
"",
|
||||||
|
@ -1019,7 +1022,7 @@ static const char *credits[] = {
|
||||||
"\"Monster\" Iestyn Jealous",
|
"\"Monster\" Iestyn Jealous",
|
||||||
"Jarel \"Arrow\" Jones",
|
"Jarel \"Arrow\" Jones",
|
||||||
"Stefan \"Stuf\" Rimalia",
|
"Stefan \"Stuf\" Rimalia",
|
||||||
"Shane Strife",
|
"Shane Mychal Sexton",
|
||||||
"\"Spazzo\"",
|
"\"Spazzo\"",
|
||||||
"David \"Big Wave Dave\" Spencer Sr.",
|
"David \"Big Wave Dave\" Spencer Sr.",
|
||||||
"David \"Instant Sonic\" Spencer Jr.",
|
"David \"Instant Sonic\" Spencer Jr.",
|
||||||
|
@ -1068,7 +1071,7 @@ static const char *credits[] = {
|
||||||
"iD Software",
|
"iD Software",
|
||||||
"Alex \"MistaED\" Fuller",
|
"Alex \"MistaED\" Fuller",
|
||||||
"FreeDoom Project", // Used some of the mancubus and rocket launcher sprites for Brak
|
"FreeDoom Project", // Used some of the mancubus and rocket launcher sprites for Brak
|
||||||
"Randy Heit (<!>)", // For his MSPaint <!> sprite that we nicked
|
"Randi Heit (<!>)", // For their MSPaint <!> sprite that we nicked
|
||||||
"",
|
"",
|
||||||
"\1Produced By",
|
"\1Produced By",
|
||||||
"Sonic Team Junior",
|
"Sonic Team Junior",
|
||||||
|
@ -1124,7 +1127,7 @@ void F_StartCredits(void)
|
||||||
CON_ClearHUD();
|
CON_ClearHUD();
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
|
|
||||||
S_ChangeMusic(mus_credit, false);
|
S_ChangeMusicInternal("credit", false);
|
||||||
|
|
||||||
finalecount = 0;
|
finalecount = 0;
|
||||||
animtimer = 0;
|
animtimer = 0;
|
||||||
|
@ -1317,10 +1320,10 @@ void F_GameEvaluationDrawer(void)
|
||||||
|
|
||||||
if (ALL7EMERALDS(emeralds))
|
if (ALL7EMERALDS(emeralds))
|
||||||
++timesBeatenWithEmeralds;
|
++timesBeatenWithEmeralds;
|
||||||
/*
|
|
||||||
if (ultimatemode) // SRB2kart 16/02/21 - I don't think we need Ultimate mode
|
if (ultimatemode)
|
||||||
++timesBeatenUltimate;
|
++timesBeatenUltimate;
|
||||||
*/
|
|
||||||
if (M_UpdateUnlockablesAndExtraEmblems())
|
if (M_UpdateUnlockablesAndExtraEmblems())
|
||||||
S_StartSound(NULL, sfx_ncitem);
|
S_StartSound(NULL, sfx_ncitem);
|
||||||
|
|
||||||
|
@ -1421,7 +1424,7 @@ void F_StartTitleScreen(void)
|
||||||
|
|
||||||
// IWAD dependent stuff.
|
// IWAD dependent stuff.
|
||||||
|
|
||||||
S_ChangeMusic(mus_titles, looptitle);
|
S_ChangeMusicInternal("titles", looptitle);
|
||||||
|
|
||||||
animtimer = 0;
|
animtimer = 0;
|
||||||
|
|
||||||
|
@ -1587,7 +1590,7 @@ void F_StartContinue(void)
|
||||||
// In case menus are still up?!!
|
// In case menus are still up?!!
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
|
|
||||||
S_ChangeMusic(mus_contsc, false);
|
S_ChangeMusicInternal("contsc", false);
|
||||||
S_StopSounds();
|
S_StopSounds();
|
||||||
|
|
||||||
timetonext = TICRATE*11;
|
timetonext = TICRATE*11;
|
||||||
|
@ -1701,8 +1704,10 @@ static void F_AdvanceToNextScene(void)
|
||||||
picxpos = cutscenes[cutnum]->scene[scenenum].xcoord[picnum];
|
picxpos = cutscenes[cutnum]->scene[scenenum].xcoord[picnum];
|
||||||
picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum];
|
picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum];
|
||||||
|
|
||||||
if (cutscenes[cutnum]->scene[scenenum].musicslot != 0)
|
if (cutscenes[cutnum]->scene[scenenum].musswitch[0])
|
||||||
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop);
|
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musswitch,
|
||||||
|
cutscenes[cutnum]->scene[scenenum].musswitchflags,
|
||||||
|
cutscenes[cutnum]->scene[scenenum].musicloop);
|
||||||
|
|
||||||
// Fade to the next
|
// Fade to the next
|
||||||
dofadenow = true;
|
dofadenow = true;
|
||||||
|
@ -1773,8 +1778,10 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
|
||||||
animtimer = cutscenes[cutnum]->scene[0].picduration[0]; // Picture duration
|
animtimer = cutscenes[cutnum]->scene[0].picduration[0]; // Picture duration
|
||||||
stoptimer = 0;
|
stoptimer = 0;
|
||||||
|
|
||||||
if (cutscenes[cutnum]->scene[scenenum].musicslot != 0)
|
if (cutscenes[cutnum]->scene[0].musswitch[0])
|
||||||
S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop);
|
S_ChangeMusic(cutscenes[cutnum]->scene[0].musswitch,
|
||||||
|
cutscenes[cutnum]->scene[0].musswitchflags,
|
||||||
|
cutscenes[cutnum]->scene[0].musicloop);
|
||||||
else
|
else
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -90,6 +90,7 @@ enum
|
||||||
// custom intermissions
|
// custom intermissions
|
||||||
wipe_specinter_toblack,
|
wipe_specinter_toblack,
|
||||||
wipe_multinter_toblack,
|
wipe_multinter_toblack,
|
||||||
|
wipe_speclevel_towhite,
|
||||||
|
|
||||||
wipe_level_final,
|
wipe_level_final,
|
||||||
wipe_intermission_final,
|
wipe_intermission_final,
|
||||||
|
@ -108,7 +109,7 @@ enum
|
||||||
|
|
||||||
NUMWIPEDEFS
|
NUMWIPEDEFS
|
||||||
};
|
};
|
||||||
#define WIPEFINALSHIFT 12
|
#define WIPEFINALSHIFT 13
|
||||||
extern UINT8 wipedefs[NUMWIPEDEFS];
|
extern UINT8 wipedefs[NUMWIPEDEFS];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
64
src/f_wipe.c
64
src/f_wipe.c
|
@ -2,8 +2,8 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 2013-2014 by Matthew "Inuyasha" Walsh.
|
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -58,6 +58,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
|
||||||
|
|
||||||
0, // wipe_specinter_toblack
|
0, // wipe_specinter_toblack
|
||||||
0, // wipe_multinter_toblack
|
0, // wipe_multinter_toblack
|
||||||
|
0, // wipe_speclevel_towhite
|
||||||
|
|
||||||
0, // wipe_level_final
|
0, // wipe_level_final
|
||||||
0, // wipe_intermission_final
|
0, // wipe_intermission_final
|
||||||
|
@ -210,8 +211,8 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
UINT32 draw_linestogo, draw_rowstogo;
|
UINT32 draw_linestogo, draw_rowstogo;
|
||||||
|
|
||||||
// rectangle coordinates, etc.
|
// rectangle coordinates, etc.
|
||||||
UINT16 scrxpos[fademask->width + 1];
|
UINT16* scrxpos = (UINT16*)malloc((fademask->width + 1) * sizeof(UINT16));
|
||||||
UINT16 scrypos[fademask->height + 1];
|
UINT16* scrypos = (UINT16*)malloc((fademask->height + 1) * sizeof(UINT16));
|
||||||
UINT16 maskx, masky;
|
UINT16 maskx, masky;
|
||||||
UINT32 relativepos;
|
UINT32 relativepos;
|
||||||
|
|
||||||
|
@ -231,38 +232,59 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
maskx = masky = 0;
|
maskx = masky = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// pointer to transtable that this mask would use
|
|
||||||
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
|
||||||
// (ignore that it goes out of bounds if *mask is 0 or 10 --
|
|
||||||
// it wouldn't be used in those cases anyway)
|
|
||||||
|
|
||||||
draw_rowstart = scrxpos[maskx];
|
draw_rowstart = scrxpos[maskx];
|
||||||
draw_rowend = scrxpos[maskx + 1];
|
draw_rowend = scrxpos[maskx + 1];
|
||||||
draw_linestart = scrypos[masky];
|
draw_linestart = scrypos[masky];
|
||||||
draw_lineend = scrypos[masky + 1];
|
draw_lineend = scrypos[masky + 1];
|
||||||
|
|
||||||
// DRAWING LOOP
|
|
||||||
relativepos = (draw_linestart * vid.width) + draw_rowstart;
|
relativepos = (draw_linestart * vid.width) + draw_rowstart;
|
||||||
draw_linestogo = draw_lineend - draw_linestart;
|
draw_linestogo = draw_lineend - draw_linestart;
|
||||||
while (draw_linestogo--)
|
|
||||||
|
if (*mask == 0)
|
||||||
{
|
{
|
||||||
w = w_base + relativepos;
|
// shortcut - memcpy source to work
|
||||||
s = s_base + relativepos;
|
while (draw_linestogo--)
|
||||||
e = e_base + relativepos;
|
|
||||||
draw_rowstogo = draw_rowend - draw_rowstart;
|
|
||||||
while (draw_rowstogo--)
|
|
||||||
{
|
{
|
||||||
if (*s != *e)
|
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
|
||||||
*w = ((*mask == 0) ? *s : (*mask == 10) ? *e : transtbl[(*e<<8) + *s]);
|
relativepos += vid.width;
|
||||||
++w, ++s, ++e;
|
|
||||||
}
|
}
|
||||||
relativepos += vid.width;
|
|
||||||
}
|
}
|
||||||
// END DRAWING LOOP
|
else if (*mask == 10)
|
||||||
|
{
|
||||||
|
// shortcut - memcpy target to work
|
||||||
|
while (draw_linestogo--)
|
||||||
|
{
|
||||||
|
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
|
||||||
|
relativepos += vid.width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// pointer to transtable that this mask would use
|
||||||
|
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
||||||
|
|
||||||
|
// DRAWING LOOP
|
||||||
|
while (draw_linestogo--)
|
||||||
|
{
|
||||||
|
w = w_base + relativepos;
|
||||||
|
s = s_base + relativepos;
|
||||||
|
e = e_base + relativepos;
|
||||||
|
draw_rowstogo = draw_rowend - draw_rowstart;
|
||||||
|
|
||||||
|
while (draw_rowstogo--)
|
||||||
|
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
|
||||||
|
|
||||||
|
relativepos += vid.width;
|
||||||
|
}
|
||||||
|
// END DRAWING LOOP
|
||||||
|
}
|
||||||
|
|
||||||
if (++maskx >= fademask->width)
|
if (++maskx >= fademask->width)
|
||||||
++masky, maskx = 0;
|
++masky, maskx = 0;
|
||||||
} while (++mask < maskend);
|
} while (++mask < maskend);
|
||||||
|
|
||||||
|
free(scrxpos);
|
||||||
|
free(scrypos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
222
src/g_game.c
222
src/g_game.c
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -60,8 +60,8 @@ JoyType_t Joystick2;
|
||||||
// 1024 bytes is plenty for a savegame
|
// 1024 bytes is plenty for a savegame
|
||||||
#define SAVEGAMESIZE (1024)
|
#define SAVEGAMESIZE (1024)
|
||||||
|
|
||||||
char gamedatafilename[64] = "srb2kart.dat"; // SRB2kart 16/02/15
|
char gamedatafilename[64] = "gamedata.dat";
|
||||||
char timeattackfolder[64] = "kart";
|
char timeattackfolder[64] = "main";
|
||||||
char customversionstring[32] = "\0";
|
char customversionstring[32] = "\0";
|
||||||
|
|
||||||
static void G_DoCompleted(void);
|
static void G_DoCompleted(void);
|
||||||
|
@ -69,8 +69,10 @@ static void G_DoStartContinue(void);
|
||||||
static void G_DoContinued(void);
|
static void G_DoContinued(void);
|
||||||
static void G_DoWorldDone(void);
|
static void G_DoWorldDone(void);
|
||||||
|
|
||||||
|
char mapmusname[7]; // Music name
|
||||||
|
UINT16 mapmusflags; // Track and reset bit
|
||||||
|
|
||||||
INT16 gamemap = 1;
|
INT16 gamemap = 1;
|
||||||
UINT32 mapmusic; // music, track, and reset bit
|
|
||||||
INT16 maptol;
|
INT16 maptol;
|
||||||
UINT8 globalweather = 0;
|
UINT8 globalweather = 0;
|
||||||
INT32 curWeather = PRECIP_NONE;
|
INT32 curWeather = PRECIP_NONE;
|
||||||
|
@ -297,9 +299,6 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
|
||||||
#if JOYAXISSET > 3
|
#if JOYAXISSET > 3
|
||||||
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
|
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
|
||||||
#endif
|
#endif
|
||||||
#if JOYAXISSET > 3
|
|
||||||
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
|
|
||||||
#endif
|
|
||||||
#if JOYAXISSET > 4
|
#if JOYAXISSET > 4
|
||||||
{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"},
|
{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"},
|
||||||
#endif
|
#endif
|
||||||
|
@ -953,7 +952,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
{
|
{
|
||||||
boolean forcestrafe = false;
|
boolean forcestrafe = false;
|
||||||
INT32 tspeed, forward, side, axis, i;
|
INT32 tspeed, forward, side, axis, i;
|
||||||
INT32 turnspeed; // SRB2kart 16/02/28
|
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
||||||
|
@ -1011,10 +1009,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
}
|
}
|
||||||
if (cv_analog.value || twodlevel
|
if (cv_analog.value || twodlevel
|
||||||
|| (player->mo && (player->mo->flags2 & MF2_TWOD))
|
|| (player->mo && (player->mo->flags2 & MF2_TWOD))
|
||||||
|| player->climbing
|
|| (!demoplayback && (player->climbing
|
||||||
|| (player->pflags & PF_NIGHTSMODE)
|
|| (player->pflags & PF_NIGHTSMODE)
|
||||||
|| (player->pflags & PF_SLIDING)
|
|| (player->pflags & PF_SLIDING)
|
||||||
|| (player->pflags & PF_FORCESTRAFE)) // Analog
|
|| (player->pflags & PF_FORCESTRAFE)))) // Analog
|
||||||
forcestrafe = true;
|
forcestrafe = true;
|
||||||
if (forcestrafe) // Analog
|
if (forcestrafe) // Analog
|
||||||
{
|
{
|
||||||
|
@ -1186,8 +1184,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
if (!mouseaiming && cv_mousemove.value)
|
if (!mouseaiming && cv_mousemove.value)
|
||||||
forward += mousey;
|
forward += mousey;
|
||||||
|
|
||||||
if (cv_analog.value || player->climbing
|
if (cv_analog.value ||
|
||||||
|| (player->pflags & PF_SLIDING)) // Analog for mouse
|
(!demoplayback && (player->climbing
|
||||||
|
|| (player->pflags & PF_SLIDING)))) // Analog for mouse
|
||||||
side += mousex*2;
|
side += mousex*2;
|
||||||
else
|
else
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - (mousex*8));
|
cmd->angleturn = (INT16)(cmd->angleturn - (mousex*8));
|
||||||
|
@ -1221,54 +1220,20 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
|
|
||||||
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
|
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
|
||||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||||
|
|
||||||
// SRB2kart 16/02/28
|
|
||||||
// Hopefully they'll ALWAYS be in one of these modes, but semantics.
|
|
||||||
if (retrokart || neokart)
|
|
||||||
{
|
|
||||||
axis = JoyAxis(AXISTURN);
|
|
||||||
if (turnright || axis > 0)
|
|
||||||
cmd->buttons |= BT_WEAPONNEXT;
|
|
||||||
else
|
|
||||||
cmd->buttons &= ~BT_WEAPONNEXT;
|
|
||||||
|
|
||||||
if (turnleft || axis < 0)
|
|
||||||
cmd->buttons |= BT_WEAPONPREV;
|
|
||||||
else
|
|
||||||
cmd->buttons &= ~BT_WEAPONPREV;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the player can't turn when not moving. // SRB2kart 16/02/28
|
|
||||||
if (players[consoleplayer].mo
|
|
||||||
&& (players[consoleplayer].powers[pw_introcam] > 1 || players[consoleplayer].speed == 0))
|
|
||||||
turnspeed = 0;
|
|
||||||
else
|
|
||||||
turnspeed = 16;
|
|
||||||
|
|
||||||
// Sryder's turn-speed fix. // SRB2kart 16/02/28
|
|
||||||
cmd->angleturn = (FixedMul(cmd->angleturn,FixedDiv((80-players[consoleplayer].speed),80)));
|
|
||||||
|
|
||||||
if (players[consoleplayer].powers[pw_invulnerability]
|
|
||||||
|| players[consoleplayer].powers[pw_mushroom] || players[consoleplayer].powers[pw_shrink] < 0)
|
|
||||||
cmd->angleturn = FixedMul(cmd->angleturn, FixedDiv(5*FRACUNIT, 4*FRACUNIT));
|
|
||||||
//
|
|
||||||
|
|
||||||
if (cv_analog.value) {
|
if (cv_analog.value) {
|
||||||
//cmd->angleturn = (INT16)(thiscam->angle >> 16); // SRB2kart 16/02/28
|
cmd->angleturn = (INT16)(thiscam->angle >> 16);
|
||||||
cmd->angleturn = (INT16)(thiscam->angle >> turnspeed);
|
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics)
|
||||||
cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16);
|
cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//localangle += (cmd->angleturn<<16); // SRB2kart 16/02/28
|
localangle += (cmd->angleturn<<16);
|
||||||
localangle += (cmd->angleturn << turnspeed);
|
|
||||||
cmd->angleturn = (INT16)(localangle >> 16);
|
cmd->angleturn = (INT16)(localangle >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reset away view if a command is given.
|
//Reset away view if a command is given.
|
||||||
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
|
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
|
||||||
&& !players[consoleplayer].spectator // SRB2kart 16/02/28
|
|
||||||
&& displayplayer != consoleplayer)
|
&& displayplayer != consoleplayer)
|
||||||
displayplayer = consoleplayer;
|
displayplayer = consoleplayer;
|
||||||
}
|
}
|
||||||
|
@ -1278,7 +1243,6 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
{
|
{
|
||||||
boolean forcestrafe = false;
|
boolean forcestrafe = false;
|
||||||
INT32 tspeed, forward, side, axis, i;
|
INT32 tspeed, forward, side, axis, i;
|
||||||
INT32 turnspeed; // SRB2kart 16/02/28
|
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
||||||
|
@ -1544,37 +1508,6 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
|
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
|
||||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||||
|
|
||||||
// SRB2kart 16/02/28
|
|
||||||
// Hopefully they'll ALWAYS be in one of these modes, but semantics.
|
|
||||||
if (retrokart || neokart)
|
|
||||||
{
|
|
||||||
axis = JoyAxis(AXISTURN);
|
|
||||||
if (turnright || axis > 0)
|
|
||||||
cmd->buttons |= BT_WEAPONNEXT;
|
|
||||||
else
|
|
||||||
cmd->buttons &= ~BT_WEAPONNEXT;
|
|
||||||
|
|
||||||
if (turnleft || axis < 0)
|
|
||||||
cmd->buttons |= BT_WEAPONPREV;
|
|
||||||
else
|
|
||||||
cmd->buttons &= ~BT_WEAPONPREV;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the player can't turn when not moving. // SRB2kart 16/02/28
|
|
||||||
if (players[secondarydisplayplayer].mo
|
|
||||||
&& (players[secondarydisplayplayer].powers[pw_introcam] > 1 || players[secondarydisplayplayer].speed == 0))
|
|
||||||
turnspeed = 0;
|
|
||||||
else
|
|
||||||
turnspeed = 16;
|
|
||||||
|
|
||||||
// Sryder's turn-speed fix. // SRB2kart 16/02/28
|
|
||||||
cmd->angleturn = (FixedMul(cmd->angleturn,FixedDiv((80-players[secondarydisplayplayer].speed),80)));
|
|
||||||
|
|
||||||
if (players[secondarydisplayplayer].powers[pw_invulnerability]
|
|
||||||
|| players[secondarydisplayplayer].powers[pw_mushroom] || players[secondarydisplayplayer].powers[pw_shrink] < 0)
|
|
||||||
cmd->angleturn = FixedMul(cmd->angleturn, FixedDiv(5*FRACUNIT, 4*FRACUNIT));
|
|
||||||
//
|
|
||||||
|
|
||||||
if (player->bot == 1) {
|
if (player->bot == 1) {
|
||||||
if (!player->powers[pw_tailsfly] && (cmd->forwardmove || cmd->sidemove || cmd->buttons))
|
if (!player->powers[pw_tailsfly] && (cmd->forwardmove || cmd->sidemove || cmd->buttons))
|
||||||
{
|
{
|
||||||
|
@ -1589,15 +1522,13 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_analog2.value) {
|
if (cv_analog2.value) {
|
||||||
// cmd->angleturn = (INT16)(thiscam->angle >> 16); // SRB2kart 16/02/28
|
cmd->angleturn = (INT16)(thiscam->angle >> 16);
|
||||||
cmd->angleturn = (INT16)(thiscam->angle >> turnspeed);
|
|
||||||
if (player->awayviewtics)
|
if (player->awayviewtics)
|
||||||
cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16);
|
cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// localangle2 += (cmd->angleturn<<16); // SRB2kart 16/02/28
|
localangle2 += (cmd->angleturn<<16);
|
||||||
localangle2 += (cmd->angleturn << turnspeed);
|
|
||||||
cmd->angleturn = (INT16)(localangle2 >> 16);
|
cmd->angleturn = (INT16)(localangle2 >> 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1993,15 +1924,6 @@ void G_Ticker(boolean run)
|
||||||
{
|
{
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
|
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
|
||||||
|
|
||||||
// Save the dir the player is holding // SRB2kart 16/03/20
|
|
||||||
// to allow items to be thrown forward or backward.
|
|
||||||
if (cmd->forwardmove > 0)
|
|
||||||
players[i].heldDir = 1;
|
|
||||||
else if (cmd->forwardmove < 0)
|
|
||||||
players[i].heldDir = -1;
|
|
||||||
else
|
|
||||||
players[i].heldDir = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// do main actions
|
// do main actions
|
||||||
|
@ -2123,16 +2045,6 @@ void G_PlayerReborn(INT32 player)
|
||||||
INT32 continues;
|
INT32 continues;
|
||||||
UINT8 charability;
|
UINT8 charability;
|
||||||
UINT8 charability2;
|
UINT8 charability2;
|
||||||
// // SRB2kart 16/03/20
|
|
||||||
INT32 starpostwp;
|
|
||||||
INT32 newfloorz;
|
|
||||||
INT32 lakitu;
|
|
||||||
INT32 airtime;
|
|
||||||
INT32 x;
|
|
||||||
INT32 racescore;
|
|
||||||
tic_t checkpointtimes[256];
|
|
||||||
INT32 playerahead;
|
|
||||||
//
|
|
||||||
fixed_t normalspeed;
|
fixed_t normalspeed;
|
||||||
fixed_t runspeed;
|
fixed_t runspeed;
|
||||||
UINT8 thrustfactor;
|
UINT8 thrustfactor;
|
||||||
|
@ -2173,16 +2085,6 @@ void G_PlayerReborn(INT32 player)
|
||||||
exiting = players[player].exiting;
|
exiting = players[player].exiting;
|
||||||
jointime = players[player].jointime;
|
jointime = players[player].jointime;
|
||||||
spectator = players[player].spectator;
|
spectator = players[player].spectator;
|
||||||
// // SRB2kart 16/03/20
|
|
||||||
starpostwp = players[player].starpostwp;
|
|
||||||
newfloorz = players[player].newfloorz;
|
|
||||||
lakitu = players[player].lakitu;
|
|
||||||
airtime = players[player].airtime;
|
|
||||||
racescore = players[player].racescore;
|
|
||||||
for (x = 0; x < (256); x++) //...
|
|
||||||
checkpointtimes[x] = players[player].checkpointtimes[x];
|
|
||||||
playerahead = players[player].playerahead;
|
|
||||||
//
|
|
||||||
pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED|PF_ANALOGMODE));
|
pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED|PF_ANALOGMODE));
|
||||||
|
|
||||||
// As long as we're not in multiplayer, carry over cheatcodes from map to map
|
// As long as we're not in multiplayer, carry over cheatcodes from map to map
|
||||||
|
@ -2250,16 +2152,6 @@ void G_PlayerReborn(INT32 player)
|
||||||
p->actionspd = actionspd;
|
p->actionspd = actionspd;
|
||||||
p->mindash = mindash;
|
p->mindash = mindash;
|
||||||
p->maxdash = maxdash;
|
p->maxdash = maxdash;
|
||||||
// // SRB2kart 16/03/20
|
|
||||||
p->starpostwp = starpostwp;
|
|
||||||
p->newfloorz = newfloorz;
|
|
||||||
p->lakitu = lakitu;
|
|
||||||
p->airtime = airtime;
|
|
||||||
p->racescore = racescore;
|
|
||||||
for (x = 0; x < 256; x++) //!
|
|
||||||
players[player].checkpointtimes[x] = checkpointtimes[x];
|
|
||||||
p->playerahead = playerahead;
|
|
||||||
//
|
|
||||||
|
|
||||||
p->starposttime = starposttime;
|
p->starposttime = starposttime;
|
||||||
p->starpostx = starpostx;
|
p->starpostx = starpostx;
|
||||||
|
@ -2288,37 +2180,20 @@ void G_PlayerReborn(INT32 player)
|
||||||
p->health = 1; // 0 rings
|
p->health = 1; // 0 rings
|
||||||
p->panim = PA_IDLE; // standing animation
|
p->panim = PA_IDLE; // standing animation
|
||||||
|
|
||||||
if ((netgame || multiplayer) && !p->spectator
|
if ((netgame || multiplayer) && !p->spectator)
|
||||||
&& gametype != GT_RACE)
|
|
||||||
p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent
|
p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent
|
||||||
|
|
||||||
/* if (p-players == consoleplayer)
|
if (p-players == consoleplayer)
|
||||||
{
|
{
|
||||||
if (mapmusic & MUSIC_RELOADRESET) // TODO: Might not need this here
|
if (mapmusflags & MUSIC_RELOADRESET)
|
||||||
{
|
{
|
||||||
mapmusic = mapheaderinfo[gamemap-1]->musicslot
|
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
|
||||||
| (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT);
|
mapmusname[6] = 0;
|
||||||
|
mapmusflags = mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK;
|
||||||
}
|
}
|
||||||
S_ChangeMusic(mapmusic, true);
|
S_ChangeMusic(mapmusname, mapmusflags, true);
|
||||||
}*/
|
|
||||||
// // SRB2kart 16/03/20
|
|
||||||
if (kartmode && leveltime < 157 && p-players == consoleplayer) // TODO: Might not need 'kartmode' check
|
|
||||||
S_StopMusic();
|
|
||||||
|
|
||||||
if (kartmode && leveltime > 157 && p-players == consoleplayer)
|
|
||||||
{
|
|
||||||
if (mapmusic & MUSIC_RELOADRESET) // TODO: Might not need this here
|
|
||||||
{
|
|
||||||
mapmusic = mapheaderinfo[gamemap-1]->musicslot
|
|
||||||
| (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT);
|
|
||||||
}
|
|
||||||
S_ChangeMusic(mapmusic, true);
|
|
||||||
|
|
||||||
if (p->laps == (unsigned)(cv_numlaps.value - 1))
|
|
||||||
S_SpeedMusic(1.2f);
|
|
||||||
}
|
}
|
||||||
//
|
|
||||||
|
|
||||||
if (gametype == GT_COOP)
|
if (gametype == GT_COOP)
|
||||||
P_FindEmerald(); // scan for emeralds to hunt for
|
P_FindEmerald(); // scan for emeralds to hunt for
|
||||||
|
|
||||||
|
@ -2457,6 +2332,11 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
P_MovePlayerToSpawn(playernum, spawnpoint);
|
P_MovePlayerToSpawn(playernum, spawnpoint);
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mapthing_t *G_FindCTFStart(INT32 playernum)
|
mapthing_t *G_FindCTFStart(INT32 playernum)
|
||||||
|
@ -2470,7 +2350,7 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!players[playernum].ctfteam && numredctfstarts && (!numbluectfstarts || P_Random() & 1)) || players[playernum].ctfteam == 1) //red
|
if ((!players[playernum].ctfteam && numredctfstarts && (!numbluectfstarts || P_RandomChance(FRACUNIT/2))) || players[playernum].ctfteam == 1) //red
|
||||||
{
|
{
|
||||||
if (!numredctfstarts)
|
if (!numredctfstarts)
|
||||||
{
|
{
|
||||||
|
@ -2639,7 +2519,7 @@ void G_DoReborn(INT32 playernum)
|
||||||
// Do a wipe
|
// Do a wipe
|
||||||
wipegamestate = -1;
|
wipegamestate = -1;
|
||||||
|
|
||||||
if (player->starpostnum) // if (player->starposttime) // SRB2kart 16/03/20
|
if (player->starposttime)
|
||||||
starpost = true;
|
starpost = true;
|
||||||
|
|
||||||
if (camera.chase)
|
if (camera.chase)
|
||||||
|
@ -2684,7 +2564,7 @@ void G_DoReborn(INT32 playernum)
|
||||||
// respawn at the start
|
// respawn at the start
|
||||||
mobj_t *oldmo = NULL;
|
mobj_t *oldmo = NULL;
|
||||||
|
|
||||||
if (player->starpostnum) // if (player->starposttime) // SRB2kart 16/03/20
|
if (player->starposttime)
|
||||||
starpost = true;
|
starpost = true;
|
||||||
|
|
||||||
// first dissasociate the corpse
|
// first dissasociate the corpse
|
||||||
|
@ -2803,9 +2683,7 @@ boolean G_RingSlingerGametype(void)
|
||||||
//
|
//
|
||||||
boolean G_PlatformGametype(void)
|
boolean G_PlatformGametype(void)
|
||||||
{
|
{
|
||||||
return (gametype == GT_COOP
|
return (gametype == GT_COOP || gametype == GT_RACE || gametype == GT_COMPETITION);
|
||||||
//|| gametype == GT_RACE // SRB2kart 16/04/24 // Do we need this removed?
|
|
||||||
|| gametype == GT_COMPETITION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -3002,7 +2880,8 @@ static void G_DoCompleted(void)
|
||||||
|
|
||||||
// We are committed to this map now.
|
// We are committed to this map now.
|
||||||
// We may as well allocate its header if it doesn't exist
|
// We may as well allocate its header if it doesn't exist
|
||||||
if(!mapheaderinfo[nextmap])
|
// (That is, if it's a real map)
|
||||||
|
if (nextmap < NUMMAPS && !mapheaderinfo[nextmap])
|
||||||
P_AllocMapHeader(nextmap);
|
P_AllocMapHeader(nextmap);
|
||||||
|
|
||||||
if (skipstats)
|
if (skipstats)
|
||||||
|
@ -3652,7 +3531,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
if (paused)
|
if (paused)
|
||||||
{
|
{
|
||||||
paused = false;
|
paused = false;
|
||||||
S_ResumeSound();
|
S_ResumeAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netgame || multiplayer) // Nice try, haxor.
|
if (netgame || multiplayer) // Nice try, haxor.
|
||||||
|
@ -3687,11 +3566,6 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
{
|
{
|
||||||
players[i].lives = 3;
|
players[i].lives = 3;
|
||||||
players[i].continues = 1;
|
players[i].continues = 1;
|
||||||
// // SRB2kart 16/03/20
|
|
||||||
players[i].racescore = 0;
|
|
||||||
players[i].newfloorz = 0;
|
|
||||||
players[i].lakitu = 0;
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The latter two should clear by themselves, but just in case
|
// The latter two should clear by themselves, but just in case
|
||||||
|
@ -3731,9 +3605,9 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
globalweather = mapheaderinfo[gamemap-1]->weather;
|
globalweather = mapheaderinfo[gamemap-1]->weather;
|
||||||
|
|
||||||
// Don't carry over custom music change to another map.
|
// Don't carry over custom music change to another map.
|
||||||
mapmusic |= MUSIC_RELOADRESET;
|
mapmusflags |= MUSIC_RELOADRESET;
|
||||||
|
|
||||||
//ultimatemode = pultmode; // SRB2kart 16/02/21 - I don't think we need Ultimate mode
|
ultimatemode = pultmode;
|
||||||
playerdeadview = false;
|
playerdeadview = false;
|
||||||
automapactive = false;
|
automapactive = false;
|
||||||
imcontinuing = false;
|
imcontinuing = false;
|
||||||
|
@ -4462,20 +4336,8 @@ void G_GhostTicker(void)
|
||||||
switch(g->color)
|
switch(g->color)
|
||||||
{
|
{
|
||||||
case GHC_SUPER: // Super Sonic (P_DoSuperStuff)
|
case GHC_SUPER: // Super Sonic (P_DoSuperStuff)
|
||||||
// Yousa yellow now!
|
g->mo->color = SKINCOLOR_SUPER1;
|
||||||
g->mo->color = SKINCOLOR_SUPER1 + (leveltime/2) % 5;
|
g->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4);
|
||||||
if (g->mo->skin)
|
|
||||||
switch (((skin_t*)g->mo->skin)-skins)
|
|
||||||
{
|
|
||||||
case 1: // Golden orange supertails.
|
|
||||||
g->mo->color = SKINCOLOR_TSUPER1 + (leveltime/2) % 5;
|
|
||||||
break;
|
|
||||||
case 2: // Pink superknux.
|
|
||||||
g->mo->color = SKINCOLOR_KSUPER1 + (leveltime/2) % 5;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
|
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
|
||||||
g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS);
|
g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS);
|
||||||
|
@ -5626,7 +5488,7 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void)
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
||||||
for (i = 0; i < 16; i++, p++)
|
for (i = 0; i < 16; i++, p++)
|
||||||
*p = P_Random(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
*p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
||||||
#else
|
#else
|
||||||
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
||||||
md5_buffer((char *)p+16, demo_p - (p+16), (void *)p); // make a checksum of everything after the checksum in the file.
|
md5_buffer((char *)p+16, demo_p - (p+16), (void *)p); // make a checksum of everything after the checksum in the file.
|
||||||
|
@ -5708,7 +5570,7 @@ boolean G_CheckDemoStatus(void)
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
||||||
for (i = 0; i < 16; i++, p++)
|
for (i = 0; i < 16; i++, p++)
|
||||||
*p = P_Random(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
*p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
||||||
#else
|
#else
|
||||||
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
||||||
md5_buffer((char *)p+16, demo_p - (p+16), p); // make a checksum of everything after the checksum in the file.
|
md5_buffer((char *)p+16, demo_p - (p+16), p); // make a checksum of everything after the checksum in the file.
|
||||||
|
@ -5717,7 +5579,7 @@ boolean G_CheckDemoStatus(void)
|
||||||
free(demobuffer);
|
free(demobuffer);
|
||||||
demorecording = false;
|
demorecording = false;
|
||||||
|
|
||||||
if (!modeattacking == ATTACKING_RECORD)
|
if (modeattacking != ATTACKING_RECORD)
|
||||||
{
|
{
|
||||||
if (saved)
|
if (saved)
|
||||||
CONS_Printf(M_GetText("Demo %s recorded\n"), demoname);
|
CONS_Printf(M_GetText("Demo %s recorded\n"), demoname);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
#include "g_input.h"
|
#include "g_input.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
#include "hu_stuff.h" // need HUFONT start & end
|
#include "hu_stuff.h" // need HUFONT start & end
|
||||||
#include "keys.h"
|
|
||||||
#include "d_net.h"
|
#include "d_net.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
|
||||||
|
@ -1042,13 +1041,13 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
||||||
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
|
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
|
||||||
return keystr[0];
|
return keystr[0];
|
||||||
|
|
||||||
|
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
||||||
|
return atoi(&keystr[3]);
|
||||||
|
|
||||||
for (j = 0; j < NUMKEYNAMES; j++)
|
for (j = 0; j < NUMKEYNAMES; j++)
|
||||||
if (!stricmp(keynames[j].name, keystr))
|
if (!stricmp(keynames[j].name, keystr))
|
||||||
return keynames[j].keynum;
|
return keynames[j].keynum;
|
||||||
|
|
||||||
if (strlen(keystr) > 3)
|
|
||||||
return atoi(&keystr[3]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -51,7 +51,6 @@ typedef enum
|
||||||
|
|
||||||
extern gamestate_t gamestate;
|
extern gamestate_t gamestate;
|
||||||
extern UINT8 ultimatemode; // was sk_insane
|
extern UINT8 ultimatemode; // was sk_insane
|
||||||
extern boolean oncontinuescreen;
|
|
||||||
extern gameaction_t gameaction;
|
extern gameaction_t gameaction;
|
||||||
|
|
||||||
extern boolean botingame;
|
extern boolean botingame;
|
||||||
|
|
|
@ -384,12 +384,12 @@ INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, chan
|
||||||
/*if (gamemode != heretic)
|
/*if (gamemode != heretic)
|
||||||
{
|
{
|
||||||
if (sfx_id >= sfx_sawup && sfx_id <= sfx_sawhit)
|
if (sfx_id >= sfx_sawup && sfx_id <= sfx_sawhit)
|
||||||
pitch += 8 - (M_Random()&15);
|
pitch += 8 - (M_RandomByte()&15);
|
||||||
else if (sfx_id != sfx_itemup && sfx_id != sfx_tink)
|
else if (sfx_id != sfx_itemup && sfx_id != sfx_tink)
|
||||||
pitch += 16 - (M_Random()&31);
|
pitch += 16 - (M_RandomByte()&31);
|
||||||
}
|
}
|
||||||
else*/
|
else*/
|
||||||
pitch = 128 + (M_Random() & 7) - (M_Random() & 7);
|
pitch = 128 + (M_RandomByte() & 7) - (M_RandomByte() & 7);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -657,6 +657,9 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||||
FOutVector v[4];
|
FOutVector v[4];
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
|
|
||||||
|
if (w < 0 || h < 0)
|
||||||
|
return; // consistency w/ software
|
||||||
|
|
||||||
// 3--2
|
// 3--2
|
||||||
// | /|
|
// | /|
|
||||||
// |/ |
|
// |/ |
|
||||||
|
@ -726,7 +729,11 @@ static inline boolean saveTGA(const char *file_name, void *buffer,
|
||||||
tga_hdr.image_type = 2;
|
tga_hdr.image_type = 2;
|
||||||
tga_hdr.image_descriptor = 32;
|
tga_hdr.image_descriptor = 32;
|
||||||
|
|
||||||
write(fd, &tga_hdr, sizeof (TGAHeader));
|
if ( -1 == write(fd, &tga_hdr, sizeof (TGAHeader)))
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// format to 888 BGR
|
// format to 888 BGR
|
||||||
for (i = 0; i < width * height * 3; i+=3)
|
for (i = 0; i < width * height * 3; i+=3)
|
||||||
{
|
{
|
||||||
|
@ -734,7 +741,11 @@ static inline boolean saveTGA(const char *file_name, void *buffer,
|
||||||
buf8[i] = buf8[i+2];
|
buf8[i] = buf8[i+2];
|
||||||
buf8[i+2] = temp;
|
buf8[i+2] = temp;
|
||||||
}
|
}
|
||||||
write(fd, buffer, width * height * 3);
|
if ( -1 == write(fd, buffer, width * height * 3))
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
//#ifdef SLOPENESS
|
|
||||||
float z;
|
float z;
|
||||||
//#endif
|
|
||||||
} polyvertex_t;
|
} polyvertex_t;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -79,6 +77,7 @@ typedef struct gr_vissprite_s
|
||||||
boolean vflip;
|
boolean vflip;
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||||
UINT8 *colormap;
|
UINT8 *colormap;
|
||||||
|
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||||
} gr_vissprite_t;
|
} gr_vissprite_t;
|
||||||
|
|
||||||
// --------
|
// --------
|
||||||
|
|
|
@ -871,7 +871,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
|
||||||
size = p_lspr->corona_radius * ((outVerts[0].z+120.0f)/950.0f); // d'ou vienne ces constante ?
|
size = p_lspr->corona_radius * ((outVerts[0].z+120.0f)/950.0f); // d'ou vienne ces constante ?
|
||||||
break;
|
break;
|
||||||
case ROCKET_SPR:
|
case ROCKET_SPR:
|
||||||
p_lspr->corona_color = (((M_Random()>>1)&0xff)<<24)|0x0040ff;
|
p_lspr->corona_color = (((M_RandomByte()>>1)&0xff)<<24)|0x0040ff;
|
||||||
// don't need a break
|
// don't need a break
|
||||||
case CORONA_SPR:
|
case CORONA_SPR:
|
||||||
size = p_lspr->corona_radius * ((outVerts[0].z+60.0f)/100.0f); // d'ou vienne ces constante ?
|
size = p_lspr->corona_radius * ((outVerts[0].z+60.0f)/100.0f); // d'ou vienne ces constante ?
|
||||||
|
@ -974,7 +974,7 @@ void HWR_DrawCoronas(void)
|
||||||
size = p_lspr->corona_radius * ((cz+120.0f)/950.0f); // d'ou vienne ces constante ?
|
size = p_lspr->corona_radius * ((cz+120.0f)/950.0f); // d'ou vienne ces constante ?
|
||||||
break;
|
break;
|
||||||
case ROCKET_SPR:
|
case ROCKET_SPR:
|
||||||
Surf.FlatColor.s.alpha = (UINT8)((M_Random()>>1)&0xff);
|
Surf.FlatColor.s.alpha = (UINT8)((M_RandomByte()>>1)&0xff);
|
||||||
// don't need a break
|
// don't need a break
|
||||||
case CORONA_SPR:
|
case CORONA_SPR:
|
||||||
size = p_lspr->corona_radius * ((cz+60.0f)/100.0f); // d'ou vienne ces constante ?
|
size = p_lspr->corona_radius * ((cz+60.0f)/100.0f); // d'ou vienne ces constante ?
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -74,10 +74,12 @@ FUNCMATH UINT8 LightLevelToLum(INT32 l);
|
||||||
|
|
||||||
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
||||||
|
|
||||||
|
#ifdef ALAM_LIGHTING
|
||||||
extern consvar_t cv_grdynamiclighting;
|
extern consvar_t cv_grdynamiclighting;
|
||||||
extern consvar_t cv_grstaticlighting;
|
extern consvar_t cv_grstaticlighting;
|
||||||
extern consvar_t cv_grcoronas;
|
extern consvar_t cv_grcoronas;
|
||||||
extern consvar_t cv_grcoronasize;
|
extern consvar_t cv_grcoronasize;
|
||||||
|
#endif
|
||||||
extern consvar_t cv_grfov;
|
extern consvar_t cv_grfov;
|
||||||
extern consvar_t cv_grmd2;
|
extern consvar_t cv_grmd2;
|
||||||
extern consvar_t cv_grfog;
|
extern consvar_t cv_grfog;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "../r_things.h"
|
#include "../r_things.h"
|
||||||
|
|
||||||
#include "hw_main.h"
|
#include "hw_main.h"
|
||||||
|
#include "../v_video.h"
|
||||||
#ifdef HAVE_PNG
|
#ifdef HAVE_PNG
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
@ -405,191 +406,6 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* center model
|
|
||||||
*/
|
|
||||||
static inline void md2_getBoundingBox (md2_model_t *model, float *minmax)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
float minx, maxx;
|
|
||||||
float miny, maxy;
|
|
||||||
float minz, maxz;
|
|
||||||
|
|
||||||
minx = miny = minz = 999999.0f;
|
|
||||||
maxx = maxy = maxz = -999999.0f;
|
|
||||||
|
|
||||||
/* get bounding box */
|
|
||||||
for (i = 0; i < model->header.numVertices; i++)
|
|
||||||
{
|
|
||||||
md2_triangleVertex_t *v = &model->frames[0].vertices[i];
|
|
||||||
|
|
||||||
if (v->vertex[0] < minx)
|
|
||||||
minx = v->vertex[0];
|
|
||||||
else if (v->vertex[0] > maxx)
|
|
||||||
maxx = v->vertex[0];
|
|
||||||
|
|
||||||
if (v->vertex[1] < miny)
|
|
||||||
miny = v->vertex[1];
|
|
||||||
else if (v->vertex[1] > maxy)
|
|
||||||
maxy = v->vertex[1];
|
|
||||||
|
|
||||||
if (v->vertex[2] < minz)
|
|
||||||
minz = v->vertex[2];
|
|
||||||
else if (v->vertex[2] > maxz)
|
|
||||||
maxz = v->vertex[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
minmax[0] = minx;
|
|
||||||
minmax[1] = maxx;
|
|
||||||
minmax[2] = miny;
|
|
||||||
minmax[3] = maxy;
|
|
||||||
minmax[4] = minz;
|
|
||||||
minmax[5] = maxz;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline INT32 md2_getAnimationCount(md2_model_t *model)
|
|
||||||
{
|
|
||||||
size_t i, pos;
|
|
||||||
INT32 j = 0, count;
|
|
||||||
char name[16], last[16];
|
|
||||||
|
|
||||||
strcpy(last, model->frames[0].name);
|
|
||||||
pos = strlen(last) - 1;
|
|
||||||
while (last[pos] >= '0' && last[pos] <= '9' && j < 2)
|
|
||||||
{
|
|
||||||
pos--;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
last[pos + 1] = '\0';
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
|
|
||||||
for (i = 0; i <= model->header.numFrames; i++)
|
|
||||||
{
|
|
||||||
if (i == model->header.numFrames)
|
|
||||||
strcpy(name, ""); // some kind of a sentinel
|
|
||||||
else
|
|
||||||
strcpy(name, model->frames[i].name);
|
|
||||||
pos = strlen(name) - 1;
|
|
||||||
j = 0;
|
|
||||||
while (name[pos] >= '0' && name[pos] <= '9' && j < 2)
|
|
||||||
{
|
|
||||||
pos--;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
name[pos + 1] = '\0';
|
|
||||||
|
|
||||||
if (strcmp(last, name))
|
|
||||||
{
|
|
||||||
strcpy(last, name);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline const char * md2_getAnimationName (md2_model_t *model, INT32 animation)
|
|
||||||
{
|
|
||||||
size_t i, pos;
|
|
||||||
INT32 j = 0, count;
|
|
||||||
static char last[32];
|
|
||||||
char name[32];
|
|
||||||
|
|
||||||
strcpy(last, model->frames[0].name);
|
|
||||||
pos = strlen(last) - 1;
|
|
||||||
while (last[pos] >= '0' && last[pos] <= '9' && j < 2)
|
|
||||||
{
|
|
||||||
pos--;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
last[pos + 1] = '\0';
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
|
|
||||||
for (i = 0; i <= model->header.numFrames; i++)
|
|
||||||
{
|
|
||||||
if (i == model->header.numFrames)
|
|
||||||
strcpy(name, ""); // some kind of a sentinel
|
|
||||||
else
|
|
||||||
strcpy(name, model->frames[i].name);
|
|
||||||
pos = strlen(name) - 1;
|
|
||||||
j = 0;
|
|
||||||
while (name[pos] >= '0' && name[pos] <= '9' && j < 2)
|
|
||||||
{
|
|
||||||
pos--;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
name[pos + 1] = '\0';
|
|
||||||
|
|
||||||
if (strcmp(last, name))
|
|
||||||
{
|
|
||||||
if (count == animation)
|
|
||||||
return last;
|
|
||||||
|
|
||||||
strcpy(last, name);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void md2_getAnimationFrames(md2_model_t *model,
|
|
||||||
INT32 animation, INT32 *startFrame, INT32 *endFrame)
|
|
||||||
{
|
|
||||||
size_t i, pos;
|
|
||||||
INT32 j = 0, count, numFrames, frameCount;
|
|
||||||
char name[16], last[16];
|
|
||||||
|
|
||||||
strcpy(last, model->frames[0].name);
|
|
||||||
pos = strlen(last) - 1;
|
|
||||||
while (last[pos] >= '0' && last[pos] <= '9' && j < 2)
|
|
||||||
{
|
|
||||||
pos--;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
last[pos + 1] = '\0';
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
numFrames = 0;
|
|
||||||
frameCount = 0;
|
|
||||||
|
|
||||||
for (i = 0; i <= model->header.numFrames; i++)
|
|
||||||
{
|
|
||||||
if (i == model->header.numFrames)
|
|
||||||
strcpy(name, ""); // some kind of a sentinel
|
|
||||||
else
|
|
||||||
strcpy(name, model->frames[i].name);
|
|
||||||
pos = strlen(name) - 1;
|
|
||||||
j = 0;
|
|
||||||
while (name[pos] >= '0' && name[pos] <= '9' && j < 2)
|
|
||||||
{
|
|
||||||
pos--;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
name[pos + 1] = '\0';
|
|
||||||
|
|
||||||
if (strcmp(last, name))
|
|
||||||
{
|
|
||||||
strcpy(last, name);
|
|
||||||
|
|
||||||
if (count == animation)
|
|
||||||
{
|
|
||||||
*startFrame = frameCount - numFrames;
|
|
||||||
*endFrame = frameCount - 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
count++;
|
|
||||||
numFrames = 0;
|
|
||||||
}
|
|
||||||
frameCount++;
|
|
||||||
numFrames++;
|
|
||||||
}
|
|
||||||
*startFrame = *endFrame = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void md2_printModelInfo (md2_model_t *model)
|
static inline void md2_printModelInfo (md2_model_t *model)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -881,6 +697,59 @@ static void md2_loadTexture(md2_t *model)
|
||||||
HWR_UnlockCachedPatch(grpatch);
|
HWR_UnlockCachedPatch(grpatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------+
|
||||||
|
// md2_loadBlendTexture : Download a pcx or png texture for blending MD2 models
|
||||||
|
// -----------------+
|
||||||
|
static void md2_loadBlendTexture(md2_t *model)
|
||||||
|
{
|
||||||
|
GLPatch_t *grpatch;
|
||||||
|
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
|
||||||
|
strcpy(filename, model->filename);
|
||||||
|
|
||||||
|
FIL_ForceExtension(filename, "_blend.png");
|
||||||
|
|
||||||
|
if (model->blendgrpatch)
|
||||||
|
{
|
||||||
|
grpatch = model->blendgrpatch;
|
||||||
|
Z_Free(grpatch->mipmap.grInfo.data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||||
|
&(model->blendgrpatch));
|
||||||
|
|
||||||
|
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
|
||||||
|
{
|
||||||
|
int w = 0, h = 0;
|
||||||
|
#ifdef HAVE_PNG
|
||||||
|
grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||||
|
if (grpatch->mipmap.grInfo.format == 0)
|
||||||
|
#endif
|
||||||
|
grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||||
|
if (grpatch->mipmap.grInfo.format == 0)
|
||||||
|
{
|
||||||
|
Z_Free(filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
grpatch->mipmap.downloaded = 0;
|
||||||
|
grpatch->mipmap.flags = 0;
|
||||||
|
|
||||||
|
grpatch->width = (INT16)w;
|
||||||
|
grpatch->height = (INT16)h;
|
||||||
|
grpatch->mipmap.width = (UINT16)w;
|
||||||
|
grpatch->mipmap.height = (UINT16)h;
|
||||||
|
|
||||||
|
// not correct!
|
||||||
|
grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||||
|
grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||||
|
grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||||
|
}
|
||||||
|
HWD.pfnSetTexture(&grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||||
|
HWR_UnlockCachedPatch(grpatch);
|
||||||
|
|
||||||
|
Z_Free(filename);
|
||||||
|
}
|
||||||
|
|
||||||
// Don't spam the console, or the OS with fopen requests!
|
// Don't spam the console, or the OS with fopen requests!
|
||||||
static boolean nomd2s = false;
|
static boolean nomd2s = false;
|
||||||
|
|
||||||
|
@ -921,24 +790,25 @@ void HWR_InitMD2(void)
|
||||||
}
|
}
|
||||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||||
{
|
{
|
||||||
|
if (stricmp(name, "PLAY") == 0)
|
||||||
|
{
|
||||||
|
CONS_Printf("MD2 for sprite PLAY detected in md2.dat, use a player skin instead!\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUMSPRITES; i++)
|
for (i = 0; i < NUMSPRITES; i++)
|
||||||
{
|
{
|
||||||
if (stricmp(name, sprnames[i]) == 0)
|
if (stricmp(name, sprnames[i]) == 0)
|
||||||
{
|
{
|
||||||
if (stricmp(name, "PLAY") == 0)
|
//if (stricmp(name, "PLAY") == 0)
|
||||||
continue;
|
//continue;
|
||||||
|
|
||||||
//CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset);
|
//CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset);
|
||||||
md2_models[i].scale = scale;
|
md2_models[i].scale = scale;
|
||||||
md2_models[i].offset = offset;
|
md2_models[i].offset = offset;
|
||||||
md2_models[i].notfound = false;
|
md2_models[i].notfound = false;
|
||||||
strcpy(md2_models[i].filename, filename);
|
strcpy(md2_models[i].filename, filename);
|
||||||
break;
|
goto md2found;
|
||||||
}
|
|
||||||
if (i == NUMSPRITES)
|
|
||||||
{
|
|
||||||
CONS_Printf("MD2 for sprite %s not found\n", name);
|
|
||||||
md2_models[i].notfound = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,15 +822,14 @@ void HWR_InitMD2(void)
|
||||||
md2_playermodels[s].offset = offset;
|
md2_playermodels[s].offset = offset;
|
||||||
md2_playermodels[s].notfound = false;
|
md2_playermodels[s].notfound = false;
|
||||||
strcpy(md2_playermodels[s].filename, filename);
|
strcpy(md2_playermodels[s].filename, filename);
|
||||||
break;
|
goto md2found;
|
||||||
}
|
|
||||||
if (s == MAXSKINS-1)
|
|
||||||
{
|
|
||||||
CONS_Printf("MD2 for player skin %s not found\n", name);
|
|
||||||
md2_playermodels[s].notfound = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// no sprite/player skin name found?!?
|
||||||
|
CONS_Printf("Unknown sprite/player skin %s detected in md2.dat\n", name);
|
||||||
|
md2found:
|
||||||
|
// move on to next line...
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
@ -996,17 +865,14 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
|
||||||
md2_playermodels[skin].offset = offset;
|
md2_playermodels[skin].offset = offset;
|
||||||
md2_playermodels[skin].notfound = false;
|
md2_playermodels[skin].notfound = false;
|
||||||
strcpy(md2_playermodels[skin].filename, filename);
|
strcpy(md2_playermodels[skin].filename, filename);
|
||||||
break;
|
goto playermd2found;
|
||||||
}
|
|
||||||
if (skin == MAXSKINS-1)
|
|
||||||
{
|
|
||||||
CONS_Printf("MD2 for player skin %s not found\n", name);
|
|
||||||
md2_playermodels[skin].notfound = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//CONS_Printf("MD2 for player skin %s not found\n", skins[skin].name);
|
||||||
|
md2_playermodels[skin].notfound = true;
|
||||||
|
playermd2found:
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1021,6 +887,9 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
|
||||||
if (nomd2s)
|
if (nomd2s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (spritenum == SPR_PLAY) // Handled already NEWMD2: Per sprite, per-skin check
|
||||||
|
return;
|
||||||
|
|
||||||
// Read the md2.dat file
|
// Read the md2.dat file
|
||||||
f = fopen("md2.dat", "rt");
|
f = fopen("md2.dat", "rt");
|
||||||
|
|
||||||
|
@ -1034,28 +903,262 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
|
||||||
// Check for any MD2s that match the names of player skins!
|
// Check for any MD2s that match the names of player skins!
|
||||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||||
{
|
{
|
||||||
|
if (stricmp(name, sprnames[spritenum]) == 0)
|
||||||
{
|
{
|
||||||
if (stricmp(name, sprnames[spritenum]) == 0)
|
md2_models[spritenum].scale = scale;
|
||||||
{
|
md2_models[spritenum].offset = offset;
|
||||||
if (stricmp(name, "PLAY") == 0) // Handled already NEWMD2: Per sprite, per-skin check
|
md2_models[spritenum].notfound = false;
|
||||||
continue;
|
strcpy(md2_models[spritenum].filename, filename);
|
||||||
|
goto spritemd2found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
md2_models[spritenum].scale = scale;
|
//CONS_Printf("MD2 for sprite %s not found\n", sprnames[spritenum]);
|
||||||
md2_models[spritenum].offset = offset;
|
md2_models[spritenum].notfound = true;
|
||||||
md2_models[spritenum].notfound = false;
|
spritemd2found:
|
||||||
strcpy(md2_models[spritenum].filename, filename);
|
fclose(f);
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (spritenum == NUMSPRITES-1)
|
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color)
|
||||||
|
{
|
||||||
|
UINT16 w = gpatch->width, h = gpatch->height;
|
||||||
|
UINT32 size = w*h;
|
||||||
|
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||||
|
|
||||||
|
if (grmip->width == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
grmip->width = gpatch->width;
|
||||||
|
grmip->height = gpatch->height;
|
||||||
|
|
||||||
|
// no wrap around, no chroma key
|
||||||
|
grmip->flags = 0;
|
||||||
|
// setup the texture info
|
||||||
|
grmip->grInfo.format = GR_RGBA;
|
||||||
|
}
|
||||||
|
|
||||||
|
Z_Free(grmip->grInfo.data);
|
||||||
|
grmip->grInfo.data = NULL;
|
||||||
|
|
||||||
|
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
|
||||||
|
memset(cur, 0x00, size*4);
|
||||||
|
|
||||||
|
image = gpatch->mipmap.grInfo.data;
|
||||||
|
blendimage = blendgpatch->mipmap.grInfo.data;
|
||||||
|
|
||||||
|
switch (color)
|
||||||
|
{
|
||||||
|
case SKINCOLOR_WHITE:
|
||||||
|
blendcolor = V_GetColor(3);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_SILVER:
|
||||||
|
blendcolor = V_GetColor(10);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_GREY:
|
||||||
|
blendcolor = V_GetColor(15);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_BLACK:
|
||||||
|
blendcolor = V_GetColor(27);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_CYAN:
|
||||||
|
blendcolor = V_GetColor(215);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_TEAL:
|
||||||
|
blendcolor = V_GetColor(221);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_STEELBLUE:
|
||||||
|
blendcolor = V_GetColor(203);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_BLUE:
|
||||||
|
blendcolor = V_GetColor(232);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_PEACH:
|
||||||
|
blendcolor = V_GetColor(71);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_TAN:
|
||||||
|
blendcolor = V_GetColor(79);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_PINK:
|
||||||
|
blendcolor = V_GetColor(147);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_LAVENDER:
|
||||||
|
blendcolor = V_GetColor(251);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_PURPLE:
|
||||||
|
blendcolor = V_GetColor(195);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_ORANGE:
|
||||||
|
blendcolor = V_GetColor(87);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_ROSEWOOD:
|
||||||
|
blendcolor = V_GetColor(94);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_BEIGE:
|
||||||
|
blendcolor = V_GetColor(40);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_BROWN:
|
||||||
|
blendcolor = V_GetColor(57);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_RED:
|
||||||
|
blendcolor = V_GetColor(130);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_DARKRED:
|
||||||
|
blendcolor = V_GetColor(139);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_NEONGREEN:
|
||||||
|
blendcolor = V_GetColor(184);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_GREEN:
|
||||||
|
blendcolor = V_GetColor(166);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_ZIM:
|
||||||
|
blendcolor = V_GetColor(180);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_OLIVE:
|
||||||
|
blendcolor = V_GetColor(108);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_YELLOW:
|
||||||
|
blendcolor = V_GetColor(104);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_GOLD:
|
||||||
|
blendcolor = V_GetColor(115);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SKINCOLOR_SUPER1:
|
||||||
|
blendcolor = V_GetColor(97);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_SUPER2:
|
||||||
|
blendcolor = V_GetColor(100);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_SUPER3:
|
||||||
|
blendcolor = V_GetColor(103);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_SUPER4:
|
||||||
|
blendcolor = V_GetColor(113);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_SUPER5:
|
||||||
|
blendcolor = V_GetColor(116);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SKINCOLOR_TSUPER1:
|
||||||
|
blendcolor = V_GetColor(81);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_TSUPER2:
|
||||||
|
blendcolor = V_GetColor(82);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_TSUPER3:
|
||||||
|
blendcolor = V_GetColor(84);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_TSUPER4:
|
||||||
|
blendcolor = V_GetColor(85);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_TSUPER5:
|
||||||
|
blendcolor = V_GetColor(87);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SKINCOLOR_KSUPER1:
|
||||||
|
blendcolor = V_GetColor(122);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_KSUPER2:
|
||||||
|
blendcolor = V_GetColor(123);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_KSUPER3:
|
||||||
|
blendcolor = V_GetColor(124);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_KSUPER4:
|
||||||
|
blendcolor = V_GetColor(125);
|
||||||
|
break;
|
||||||
|
case SKINCOLOR_KSUPER5:
|
||||||
|
blendcolor = V_GetColor(126);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
blendcolor = V_GetColor(247);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (size--)
|
||||||
|
{
|
||||||
|
if (blendimage->s.alpha == 0)
|
||||||
|
{
|
||||||
|
// Don't bother with blending the pixel if the alpha of the blend pixel is 0
|
||||||
|
cur->rgba = image->rgba;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INT32 tempcolor;
|
||||||
|
INT16 tempmult, tempalpha;
|
||||||
|
tempalpha = -(abs(blendimage->s.red-127)-127)*2;
|
||||||
|
if (tempalpha > 255)
|
||||||
|
tempalpha = 255;
|
||||||
|
else if (tempalpha < 0)
|
||||||
|
tempalpha = 0;
|
||||||
|
|
||||||
|
tempmult = (blendimage->s.red-127)*2;
|
||||||
|
if (tempmult > 255)
|
||||||
|
tempmult = 255;
|
||||||
|
else if (tempmult < 0)
|
||||||
|
tempmult = 0;
|
||||||
|
|
||||||
|
tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255;
|
||||||
|
cur->s.red = (UINT8)tempcolor;
|
||||||
|
tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255;
|
||||||
|
cur->s.green = (UINT8)tempcolor;
|
||||||
|
tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255;
|
||||||
|
cur->s.blue = (UINT8)tempcolor;
|
||||||
|
cur->s.alpha = image->s.alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
cur++; image++; blendimage++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color)
|
||||||
|
{
|
||||||
|
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||||
|
GLMipmap_t *grmip, *newmip;
|
||||||
|
|
||||||
|
if (colormap == colormaps || colormap == NULL)
|
||||||
|
{
|
||||||
|
// Don't do any blending
|
||||||
|
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// search for the mimmap
|
||||||
|
// skip the first (no colormap translated)
|
||||||
|
for (grmip = &gpatch->mipmap; grmip->nextcolormap; )
|
||||||
|
{
|
||||||
|
grmip = grmip->nextcolormap;
|
||||||
|
if (grmip->colormap == colormap)
|
||||||
|
{
|
||||||
|
if (grmip->downloaded && grmip->grInfo.data)
|
||||||
{
|
{
|
||||||
CONS_Printf("MD2 for sprite %s not found\n", name);
|
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||||
md2_models[spritenum].notfound = true;
|
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
// If here, the blended texture has not been created
|
||||||
|
// So we create it
|
||||||
|
|
||||||
|
//BP: WARNING: don't free it manually without clearing the cache of harware renderer
|
||||||
|
// (it have a liste of mipmap)
|
||||||
|
// this malloc is cleared in HWR_FreeTextureCache
|
||||||
|
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||||
|
newmip = calloc(1, sizeof (*newmip));
|
||||||
|
if (newmip == NULL)
|
||||||
|
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||||
|
grmip->nextcolormap = newmip;
|
||||||
|
newmip->colormap = colormap;
|
||||||
|
|
||||||
|
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color);
|
||||||
|
|
||||||
|
HWD.pfnSetTexture(newmip);
|
||||||
|
Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1090,11 +1193,17 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
md2_t *md2;
|
md2_t *md2;
|
||||||
UINT8 color[4];
|
UINT8 color[4];
|
||||||
|
|
||||||
|
if (!cv_grmd2.value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (spr->precip)
|
||||||
|
return;
|
||||||
|
|
||||||
// MD2 colormap fix
|
// MD2 colormap fix
|
||||||
// colormap test
|
// colormap test
|
||||||
{
|
{
|
||||||
sector_t *sector = spr->mobj->subsector->sector;
|
sector_t *sector = spr->mobj->subsector->sector;
|
||||||
UINT8 lightlevel = sector->lightlevel;
|
UINT8 lightlevel = 255;
|
||||||
extracolormap_t *colormap = sector->extra_colormap;
|
extracolormap_t *colormap = sector->extra_colormap;
|
||||||
|
|
||||||
if (sector->numlights)
|
if (sector->numlights)
|
||||||
|
@ -1105,8 +1214,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
|
|
||||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = *sector->lightlist[light].lightlevel;
|
lightlevel = *sector->lightlist[light].lightlevel;
|
||||||
else
|
|
||||||
lightlevel = 255;
|
|
||||||
|
|
||||||
if (sector->lightlist[light].extra_colormap)
|
if (sector->lightlist[light].extra_colormap)
|
||||||
colormap = sector->lightlist[light].extra_colormap;
|
colormap = sector->lightlist[light].extra_colormap;
|
||||||
|
@ -1115,24 +1222,18 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
{
|
{
|
||||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||||
lightlevel = sector->lightlevel;
|
lightlevel = sector->lightlevel;
|
||||||
else
|
|
||||||
lightlevel = 255;
|
|
||||||
|
|
||||||
if (sector->extra_colormap)
|
if (sector->extra_colormap)
|
||||||
colormap = sector->extra_colormap;
|
colormap = sector->extra_colormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spr->mobj->frame & FF_FULLBRIGHT)
|
|
||||||
lightlevel = 255;
|
|
||||||
|
|
||||||
if (colormap)
|
if (colormap)
|
||||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
|
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
|
||||||
else
|
else
|
||||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
|
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look at HWR_ProjetctSprite for more
|
// Look at HWR_ProjectSprite for more
|
||||||
if (cv_grmd2.value && ((md2_models[spr->mobj->sprite].scale > 0.0f) || (md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale > 0.0f)) && !spr->precip)
|
|
||||||
{
|
{
|
||||||
GLPatch_t *gpatch;
|
GLPatch_t *gpatch;
|
||||||
INT32 *buff;
|
INT32 *buff;
|
||||||
|
@ -1149,15 +1250,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
//durs = tics;
|
//durs = tics;
|
||||||
|
|
||||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||||
{
|
|
||||||
Surf.FlatColor.s.alpha = 0x40;
|
Surf.FlatColor.s.alpha = 0x40;
|
||||||
}
|
|
||||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||||
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Surf.FlatColor.s.alpha = 0xFF;
|
Surf.FlatColor.s.alpha = 0xFF;
|
||||||
}
|
|
||||||
|
|
||||||
// dont forget to enabled the depth test because we can't do this like
|
// dont forget to enabled the depth test because we can't do this like
|
||||||
// before: polygons models are not sorted
|
// before: polygons models are not sorted
|
||||||
|
@ -1194,13 +1291,25 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
gpatch = md2->grpatch;
|
gpatch = md2->grpatch;
|
||||||
if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded)
|
if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded)
|
||||||
md2_loadTexture(md2);
|
md2_loadTexture(md2);
|
||||||
|
|
||||||
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||||
|
|
||||||
|
if ((gpatch && gpatch->mipmap.grInfo.format) // don't load the blend texture if the base texture isn't available
|
||||||
|
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap.downloaded))
|
||||||
|
md2_loadBlendTexture(md2);
|
||||||
|
|
||||||
if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||||
{
|
{
|
||||||
// This is safe, since we know the texture has been downloaded
|
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
|
||||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format
|
||||||
|
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
|
||||||
|
{
|
||||||
|
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This is safe, since we know the texture has been downloaded
|
||||||
|
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1209,16 +1318,37 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
HWR_GetMappedPatch(gpatch, spr->colormap);
|
HWR_GetMappedPatch(gpatch, spr->colormap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (spr->mobj->frame & FF_ANIMATE)
|
||||||
|
{
|
||||||
|
// set duration and tics to be the correct values for FF_ANIMATE states
|
||||||
|
durs = spr->mobj->state->var2;
|
||||||
|
tics = spr->mobj->anim_duration;
|
||||||
|
}
|
||||||
|
|
||||||
//FIXME: this is not yet correct
|
//FIXME: this is not yet correct
|
||||||
frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
|
frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
|
||||||
buff = md2->model->glCommandBuffer;
|
buff = md2->model->glCommandBuffer;
|
||||||
curr = &md2->model->frames[frame];
|
curr = &md2->model->frames[frame];
|
||||||
if (cv_grmd2.value == 1
|
if (cv_grmd2.value == 1)
|
||||||
&& spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
|
|
||||||
&& !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND]))
|
|
||||||
{
|
{
|
||||||
const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
|
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
|
||||||
next = &md2->model->frames[nextframe];
|
if (spr->mobj->frame & FF_ANIMATE)
|
||||||
|
{
|
||||||
|
UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1;
|
||||||
|
if (nextframe >= (UINT32)spr->mobj->state->var1)
|
||||||
|
nextframe = (spr->mobj->state->frame & FF_FRAMEMASK);
|
||||||
|
nextframe %= md2->model->header.numFrames;
|
||||||
|
next = &md2->model->frames[nextframe];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
|
||||||
|
&& !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND]))
|
||||||
|
{
|
||||||
|
const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
|
||||||
|
next = &md2->model->frames[nextframe];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Hurdler: it seems there is still a small problem with mobj angle
|
//Hurdler: it seems there is still a small problem with mobj angle
|
||||||
|
@ -1257,14 +1387,9 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
// SRB2CBTODO: MD2 scaling support
|
// SRB2CBTODO: MD2 scaling support
|
||||||
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
||||||
|
|
||||||
if (postimgtype == postimg_flip)
|
p.flip = atransform.flip;
|
||||||
p.flip = true;
|
|
||||||
else
|
|
||||||
p.flip = false;
|
|
||||||
|
|
||||||
HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color);
|
HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ typedef struct
|
||||||
float offset;
|
float offset;
|
||||||
md2_model_t *model;
|
md2_model_t *model;
|
||||||
void *grpatch;
|
void *grpatch;
|
||||||
|
void *blendgrpatch;
|
||||||
boolean notfound;
|
boolean notfound;
|
||||||
INT32 skin;
|
INT32 skin;
|
||||||
} md2_t;
|
} md2_t;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
|
@ -22,27 +22,28 @@
|
||||||
<ProjectName>r_opengl</ProjectName>
|
<ProjectName>r_opengl</ProjectName>
|
||||||
<ProjectGuid>{51137D5C-4E81-4955-AACF-EA3092006051}</ProjectGuid>
|
<ProjectGuid>{51137D5C-4E81-4955-AACF-EA3092006051}</ProjectGuid>
|
||||||
<RootNamespace>r_opengl</RootNamespace>
|
<RootNamespace>r_opengl</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -1470,6 +1470,26 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
||||||
else
|
else
|
||||||
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||||
}
|
}
|
||||||
|
else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8)
|
||||||
|
{
|
||||||
|
//pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||||
|
if (MipMap)
|
||||||
|
{
|
||||||
|
pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||||
|
#ifdef GL_TEXTURE_MIN_LOD
|
||||||
|
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
|
||||||
|
#endif
|
||||||
|
#ifdef GL_TEXTURE_MAX_LOD
|
||||||
|
if (pTexInfo->flags & TF_TRANSPARENT)
|
||||||
|
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
|
||||||
|
else
|
||||||
|
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
|
||||||
|
#endif
|
||||||
|
//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (MipMap)
|
if (MipMap)
|
||||||
|
@ -1910,6 +1930,13 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
|
||||||
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
|
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
|
||||||
//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
|
//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
|
||||||
|
|
||||||
|
// Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?!
|
||||||
|
if (color[3] < 255)
|
||||||
|
{
|
||||||
|
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
|
||||||
|
pglDepthMask(GL_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
val = *gl_cmd_buffer++;
|
val = *gl_cmd_buffer++;
|
||||||
|
|
||||||
while (val != 0)
|
while (val != 0)
|
||||||
|
@ -2143,7 +2170,7 @@ EXPORT void HWRAPI(StartScreenWipe) (void)
|
||||||
Clamp2D(GL_TEXTURE_WRAP_S);
|
Clamp2D(GL_TEXTURE_WRAP_S);
|
||||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||||
#ifndef KOS_GL_COMPATIBILITY
|
#ifndef KOS_GL_COMPATIBILITY
|
||||||
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0);
|
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
|
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
|
||||||
|
@ -2172,7 +2199,7 @@ EXPORT void HWRAPI(EndScreenWipe)(void)
|
||||||
Clamp2D(GL_TEXTURE_WRAP_S);
|
Clamp2D(GL_TEXTURE_WRAP_S);
|
||||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||||
#ifndef KOS_GL_COMPATIBILITY
|
#ifndef KOS_GL_COMPATIBILITY
|
||||||
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0);
|
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
|
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
|
||||||
|
@ -2287,22 +2314,22 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
|
||||||
|
|
||||||
// Bottom left
|
// Bottom left
|
||||||
pglMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);
|
pglMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);
|
||||||
pglMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f);
|
pglMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1.0f);
|
||||||
pglVertex3f(-1.0f, -1.0f, 1.0f);
|
pglVertex3f(-1.0f, -1.0f, 1.0f);
|
||||||
|
|
||||||
// Top left
|
// Top left
|
||||||
pglMultiTexCoord2f(GL_TEXTURE0, 0.0f, yfix);
|
pglMultiTexCoord2f(GL_TEXTURE0, 0.0f, yfix);
|
||||||
pglMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1.0f);
|
pglMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f);
|
||||||
pglVertex3f(-1.0f, 1.0f, 1.0f);
|
pglVertex3f(-1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
// Top right
|
// Top right
|
||||||
pglMultiTexCoord2f(GL_TEXTURE0, xfix, yfix);
|
pglMultiTexCoord2f(GL_TEXTURE0, xfix, yfix);
|
||||||
pglMultiTexCoord2f(GL_TEXTURE1, 1.0f, 1.0f);
|
pglMultiTexCoord2f(GL_TEXTURE1, 1.0f, 0.0f);
|
||||||
pglVertex3f(1.0f, 1.0f, 1.0f);
|
pglVertex3f(1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
// Bottom right
|
// Bottom right
|
||||||
pglMultiTexCoord2f(GL_TEXTURE0, xfix, 0.0f);
|
pglMultiTexCoord2f(GL_TEXTURE0, xfix, 0.0f);
|
||||||
pglMultiTexCoord2f(GL_TEXTURE1, 1.0f, 0.0f);
|
pglMultiTexCoord2f(GL_TEXTURE1, 1.0f, 1.0f);
|
||||||
pglVertex3f(1.0f, -1.0f, 1.0f);
|
pglVertex3f(1.0f, -1.0f, 1.0f);
|
||||||
pglEnd();
|
pglEnd();
|
||||||
|
|
||||||
|
@ -2364,7 +2391,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
|
||||||
Clamp2D(GL_TEXTURE_WRAP_S);
|
Clamp2D(GL_TEXTURE_WRAP_S);
|
||||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||||
#ifndef KOS_GL_COMPATIBILITY
|
#ifndef KOS_GL_COMPATIBILITY
|
||||||
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0);
|
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
|
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
|
||||||
|
@ -2392,7 +2419,7 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
|
||||||
Clamp2D(GL_TEXTURE_WRAP_S);
|
Clamp2D(GL_TEXTURE_WRAP_S);
|
||||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||||
#ifndef KOS_GL_COMPATIBILITY
|
#ifndef KOS_GL_COMPATIBILITY
|
||||||
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0);
|
pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
|
tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define _R_OPENGL_H_
|
#define _R_OPENGL_H_
|
||||||
|
|
||||||
#ifdef HAVE_SDL
|
#ifdef HAVE_SDL
|
||||||
|
#define _MATH_DEFINES_DEFINED
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable : 4214 4244)
|
#pragma warning(disable : 4214 4244)
|
||||||
|
@ -86,7 +87,7 @@ boolean SetupGLfunc(void);
|
||||||
boolean SetupGLFunc13(void);
|
boolean SetupGLFunc13(void);
|
||||||
void Flush(void);
|
void Flush(void);
|
||||||
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
||||||
boolean SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepthBits);
|
int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepthBits);
|
||||||
void SetModelView(GLint w, GLint h);
|
void SetModelView(GLint w, GLint h);
|
||||||
void SetStates(void);
|
void SetStates(void);
|
||||||
FUNCMATH float byteasfloat(UINT8 fbyte);
|
FUNCMATH float byteasfloat(UINT8 fbyte);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
|
@ -22,29 +22,30 @@
|
||||||
<ProjectName>s_openal</ProjectName>
|
<ProjectName>s_openal</ProjectName>
|
||||||
<ProjectGuid>{E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}</ProjectGuid>
|
<ProjectGuid>{E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}</ProjectGuid>
|
||||||
<RootNamespace>s_openal</RootNamespace>
|
<RootNamespace>s_openal</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseOfMfc>false</UseOfMfc>
|
<UseOfMfc>false</UseOfMfc>
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -186,7 +187,7 @@
|
||||||
</HeaderFileName>
|
</HeaderFileName>
|
||||||
</Midl>
|
</Midl>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/MP /SAFESEH:OFF %(AdditionalOptions)</AdditionalOptions>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;__WIN32__;__MSC__;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;__WIN32__;__MSC__;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>true</MinimalRebuild>
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
@ -244,6 +245,7 @@
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<CompileAs>CompileAsC</CompileAs>
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<AdditionalOptions>/MP /SAFESEH:OFF %(AdditionalOptions)</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
|
250
src/hu_stuff.c
250
src/hu_stuff.c
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -69,7 +69,6 @@ patch_t *nightsnum[10]; // 0-9
|
||||||
// Level title and credits fonts
|
// Level title and credits fonts
|
||||||
patch_t *lt_font[LT_FONTSIZE];
|
patch_t *lt_font[LT_FONTSIZE];
|
||||||
patch_t *cred_font[CRED_FONTSIZE];
|
patch_t *cred_font[CRED_FONTSIZE];
|
||||||
patch_t *kart_font[KART_FONTSIZE]; // SRB2kart 16/03/27
|
|
||||||
|
|
||||||
static player_t *plr;
|
static player_t *plr;
|
||||||
boolean chat_on; // entering a chat message?
|
boolean chat_on; // entering a chat message?
|
||||||
|
@ -107,7 +106,6 @@ static patch_t *crosshair[HU_CROSSHAIRS]; // 3 precached crosshair graphics
|
||||||
static void HU_DrawRankings(void);
|
static void HU_DrawRankings(void);
|
||||||
static void HU_DrawCoopOverlay(void);
|
static void HU_DrawCoopOverlay(void);
|
||||||
static void HU_DrawNetplayCoopOverlay(void);
|
static void HU_DrawNetplayCoopOverlay(void);
|
||||||
static void HU_DrawRaceRankings(void);
|
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// KEYBOARD LAYOUTS FOR ENTERING TEXT
|
// KEYBOARD LAYOUTS FOR ENTERING TEXT
|
||||||
|
@ -239,34 +237,6 @@ void HU_LoadGraphics(void)
|
||||||
else
|
else
|
||||||
cred_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
cred_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
// // SRB2kart 16/03/27
|
|
||||||
// cache the level title font for entire game execution
|
|
||||||
kart_font[0] = (patch_t *)W_CachePatchName("MKFNT034", PU_HUDGFX); /// \note fake start hack
|
|
||||||
kart_font[5] = (patch_t *)W_CachePatchName("MKFNT039", PU_HUDGFX); /// \note fake start hack
|
|
||||||
|
|
||||||
// Number support
|
|
||||||
kart_font[13] = (patch_t *)W_CachePatchName("MKFNT047", PU_HUDGFX);
|
|
||||||
kart_font[14] = (patch_t *)W_CachePatchName("MKFNT048", PU_HUDGFX);
|
|
||||||
kart_font[15] = (patch_t *)W_CachePatchName("MKFNT049", PU_HUDGFX);
|
|
||||||
kart_font[16] = (patch_t *)W_CachePatchName("MKFNT050", PU_HUDGFX);
|
|
||||||
kart_font[17] = (patch_t *)W_CachePatchName("MKFNT051", PU_HUDGFX);
|
|
||||||
kart_font[18] = (patch_t *)W_CachePatchName("MKFNT052", PU_HUDGFX);
|
|
||||||
kart_font[19] = (patch_t *)W_CachePatchName("MKFNT053", PU_HUDGFX);
|
|
||||||
kart_font[20] = (patch_t *)W_CachePatchName("MKFNT054", PU_HUDGFX);
|
|
||||||
kart_font[21] = (patch_t *)W_CachePatchName("MKFNT055", PU_HUDGFX);
|
|
||||||
kart_font[22] = (patch_t *)W_CachePatchName("MKFNT056", PU_HUDGFX);
|
|
||||||
kart_font[23] = (patch_t *)W_CachePatchName("MKFNT057", PU_HUDGFX);
|
|
||||||
kart_font[24] = (patch_t *)W_CachePatchName("MKFNT058", PU_HUDGFX);
|
|
||||||
|
|
||||||
j = KART_REALFONTSTART;
|
|
||||||
for (i = KART_REALFONTSTART - KART_FONTSTART; i < KART_FONTSIZE; i++)
|
|
||||||
{
|
|
||||||
sprintf(buffer, "MKFNT%.3d", j);
|
|
||||||
j++;
|
|
||||||
kart_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
//cache numbers too!
|
//cache numbers too!
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
|
@ -1080,88 +1050,10 @@ static void HU_DrawDemoInfo(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heads up displays drawer for the Automap, call each frame
|
|
||||||
//
|
|
||||||
void HU_AutomapDrawer(void) // SRB2kart 16/03/27
|
|
||||||
{
|
|
||||||
// Automap HUD.
|
|
||||||
INT32 amnumxpos;
|
|
||||||
INT32 amnumypos;
|
|
||||||
INT32 amxpos;
|
|
||||||
INT32 amypos;
|
|
||||||
INT32 lumpnum;
|
|
||||||
patch_t *AutomapPic;
|
|
||||||
INT32 i = 0;
|
|
||||||
|
|
||||||
// Draw the HUD only when playing in a level.
|
|
||||||
// hu_stuff needs this, unlike st_stuff.
|
|
||||||
if (Playing() && gamestate == GS_LEVEL)
|
|
||||||
{
|
|
||||||
INT32 x, y;
|
|
||||||
|
|
||||||
lumpnum = W_CheckNumForName(va("%sR", G_BuildAutoMapName(gamemap)));
|
|
||||||
|
|
||||||
if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1].automap)))
|
|
||||||
AutomapPic = W_CachePatchName(va("%sR", G_BuildAutoMapName(gamemap)), PU_CACHE);
|
|
||||||
else
|
|
||||||
AutomapPic = W_CachePatchName(va("NOMAPR"), PU_CACHE);
|
|
||||||
|
|
||||||
if (splitscreen)
|
|
||||||
{
|
|
||||||
x = 160 - (AutomapPic->width/4);
|
|
||||||
y = 100 - (AutomapPic->height/4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = 312 - (AutomapPic->width/2);
|
|
||||||
y = 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
V_DrawSmallScaledPatch(x, y, 0, AutomapPic);
|
|
||||||
|
|
||||||
// Player's tiny icons on the Automap.
|
|
||||||
if (lumpnum != -1 && (!modifiedgame || (modifiedgame && mapheaderinfo[gamemap-1].automap)))
|
|
||||||
{
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
|
||||||
if (players[i].mo && !players[i].spectator)
|
|
||||||
{
|
|
||||||
// amnum xpos & ypos are the icon's speed around the HUD.
|
|
||||||
// The number being divided by is for how fast it moves.
|
|
||||||
// The higher the number, the slower it moves.
|
|
||||||
|
|
||||||
// am xpos & ypos are the icon's starting position. Withouht
|
|
||||||
// it, they wouldn't 'spawn' on the top-right side of the HUD.
|
|
||||||
amnumxpos = (players[i].mo->x / 320) >> FRACBITS;
|
|
||||||
amnumypos = (-players[i].mo->y / 340) >> FRACBITS;
|
|
||||||
|
|
||||||
amxpos = (x + amnumxpos) - (iconprefix[players[i].skin]->width/4);
|
|
||||||
amypos = (y + amnumypos) - (iconprefix[players[i].skin]->height/4);
|
|
||||||
|
|
||||||
if (!players[i].skincolor) // 'default' color
|
|
||||||
{
|
|
||||||
V_DrawSmallScaledPatch(amxpos, amypos, 0, iconprefix[players[i].skin]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UINT8 *colormap = translationtables[players[i].skin] - 256 + (players[i].skincolor<<8);
|
|
||||||
V_DrawSmallMappedPatch(amxpos, amypos, 0,iconprefix[players[i].skin], colormap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!splitscreen && (maptol & TOL_RIDERS || maptol & TOL_KART) && !hu_showscores)
|
|
||||||
HU_DrawRaceRankings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Heads up displays drawer, call each frame
|
// Heads up displays drawer, call each frame
|
||||||
//
|
//
|
||||||
void HU_Drawer(void)
|
void HU_Drawer(void)
|
||||||
{
|
{
|
||||||
// SRB2kart 16/03/27
|
|
||||||
HU_AutomapDrawer();
|
|
||||||
|
|
||||||
// draw chat string plus cursor
|
// draw chat string plus cursor
|
||||||
if (chat_on)
|
if (chat_on)
|
||||||
HU_DrawChat();
|
HU_DrawChat();
|
||||||
|
@ -1286,114 +1178,6 @@ void HU_Erase(void)
|
||||||
// IN-LEVEL MULTIPLAYER RANKINGS
|
// IN-LEVEL MULTIPLAYER RANKINGS
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
||||||
//
|
|
||||||
// HU_DrawRaceRankings // SRB2kart 16/03/27
|
|
||||||
//
|
|
||||||
static void HU_DrawRaceRankings(void)
|
|
||||||
{
|
|
||||||
playersort_t tab[MAXPLAYERS];
|
|
||||||
INT32 i, j, scorelines;
|
|
||||||
boolean completed[MAXPLAYERS];
|
|
||||||
UINT32 whiteplayer;
|
|
||||||
INT32 y; // Let's move them closer to the center when there's less
|
|
||||||
|
|
||||||
scorelines = 0;
|
|
||||||
memset(completed, 0, sizeof (completed));
|
|
||||||
memset(tab, 0, sizeof (playersort_t)*MAXPLAYERS);
|
|
||||||
|
|
||||||
// When you play, you quickly see your score because your name is displayed in white.
|
|
||||||
// When playing back a demo, you quickly see who's the view.
|
|
||||||
whiteplayer = demoplayback ? displayplayer : consoleplayer;
|
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
|
||||||
tab[i].num = -1;
|
|
||||||
tab[i].name = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j = 0; j < MAXPLAYERS; j++)
|
|
||||||
{
|
|
||||||
if (!playeringame[j])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
|
||||||
{
|
|
||||||
if (playeringame[i])
|
|
||||||
{
|
|
||||||
//the counting formula I use for race is a slight bit complex, so put it out here for simplicity
|
|
||||||
int checkpointnum = ((players[i].starpostnum - 1) + (numstarposts+1)*players[i].laps) + 1;
|
|
||||||
|
|
||||||
if (completed[i] == false && ((unsigned)checkpointnum > tab[scorelines].count
|
|
||||||
|| ((unsigned)checkpointnum == tab[scorelines].count))
|
|
||||||
&& (tab[scorelines].num < 0 || players[i].position < players[tab[scorelines].num].position))
|
|
||||||
{
|
|
||||||
tab[scorelines].count = checkpointnum;
|
|
||||||
tab[scorelines].num = i;
|
|
||||||
tab[scorelines].color = players[i].skincolor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
completed[tab[scorelines].num] = true;
|
|
||||||
scorelines++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scorelines > 8) // Let's have 8 shall we
|
|
||||||
scorelines = 8; //dont draw past bottom of screen, show the best only
|
|
||||||
|
|
||||||
y = 84 - (8*scorelines);
|
|
||||||
|
|
||||||
HU_DrawRaceRanking(15, y, tab, scorelines, whiteplayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// HU_DrawRaceRanking // SRB2kart 16/03/27
|
|
||||||
//
|
|
||||||
void HU_DrawRaceRanking(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer)
|
|
||||||
{
|
|
||||||
INT32 i;
|
|
||||||
UINT8 *colormap;
|
|
||||||
|
|
||||||
//this function is designed for 8 or less score lines only
|
|
||||||
I_Assert(scorelines <= 8);
|
|
||||||
|
|
||||||
for (i = 0; i < scorelines; i++)
|
|
||||||
{
|
|
||||||
if (players[tab[i].num].spectator)
|
|
||||||
continue; //ignore them.
|
|
||||||
|
|
||||||
if (tab[i].color == 0)
|
|
||||||
{
|
|
||||||
colormap = colormaps;
|
|
||||||
if (players[tab[i].num].powers[pw_super])
|
|
||||||
V_DrawSmallScaledPatch (x, y-4, 0, superprefix[players[tab[i].num].skin]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (tab[i].num != whiteplayer)
|
|
||||||
V_DrawSmallTranslucentPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]);
|
|
||||||
else
|
|
||||||
V_DrawSmallScaledPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (players[tab[i].num].powers[pw_super])
|
|
||||||
{
|
|
||||||
colormap = (UINT8 *) translationtables[players[tab[i].num].skin] - 256 + (((players[tab[i].num].powers[pw_super]) ? 15 : players[tab[i].num].skincolor)<<8);
|
|
||||||
V_DrawSmallMappedPatch (x, y-4, 0, superprefix[players[tab[i].num].skin], colormap);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
colormap = (UINT8 *) translationtables[players[tab[i].num].skin] - 256 + (tab[i].color<<8);
|
|
||||||
if (tab[i].num != whiteplayer)
|
|
||||||
V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
|
|
||||||
else
|
|
||||||
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
y += 16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// HU_DrawTabRankings
|
// HU_DrawTabRankings
|
||||||
//
|
//
|
||||||
|
@ -1473,23 +1257,10 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
||||||
{
|
{
|
||||||
if (circuitmap)
|
if (circuitmap)
|
||||||
{
|
{
|
||||||
if (players[tab[i].num].exiting) // SRB2kart 16/03/27
|
if (players[tab[i].num].exiting)
|
||||||
V_DrawRightAlignedString(x+240, y, V_YELLOWMAP, va("%d:%02d.%02d",
|
V_DrawRightAlignedString(x+240, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
|
||||||
players[tab[i].num].realtime/(60*TICRATE),
|
|
||||||
players[tab[i].num].realtime/TICRATE % 60,
|
|
||||||
players[tab[i].num].realtime % TICRATE));
|
|
||||||
else
|
else
|
||||||
V_DrawRightAlignedString(x+240, y, 0, va("(CP%02d) %d:%02d.%02d",
|
V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count));
|
||||||
tab[i].count,
|
|
||||||
players[tab[i].num].starposttime/(60*TICRATE),
|
|
||||||
players[tab[i].num].starposttime/TICRATE % 60,
|
|
||||||
(int)((players[tab[i].num].starposttime % TICRATE) * (100.00f/TICRATE))));
|
|
||||||
/*
|
|
||||||
* if (players[tab[i].num].exiting)
|
|
||||||
* V_DrawRightAlignedString(x+240, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
|
|
||||||
* else
|
|
||||||
* V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count));
|
|
||||||
* */
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
|
V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
|
||||||
|
@ -1864,18 +1635,9 @@ static void HU_DrawRankings(void)
|
||||||
{
|
{
|
||||||
if (circuitmap)
|
if (circuitmap)
|
||||||
{
|
{
|
||||||
// SRB2kart 16/03/27
|
if ((unsigned)players[i].laps+1 >= tab[scorelines].count && completed[i] == false)
|
||||||
//the counting formula used for race is a slight bit complex, so it's out here for simplicity
|
|
||||||
int checkpointnum = ((players[i].starpostnum - 1) + (numstarposts+1)*players[i].laps) + 1;
|
|
||||||
|
|
||||||
if (completed[i] == false && ((unsigned)checkpointnum > tab[scorelines].count
|
|
||||||
|| ((unsigned)checkpointnum == tab[scorelines].count && (tab[scorelines].num < 0
|
|
||||||
|| players[i].starposttime < players[tab[scorelines].num].starposttime))))
|
|
||||||
{
|
{
|
||||||
tab[scorelines].count = checkpointnum;
|
tab[scorelines].count = players[i].laps+1;
|
||||||
//if ((unsigned)players[i].laps+1 >= tab[scorelines].count && completed[i] == false)
|
|
||||||
//{
|
|
||||||
// tab[scorelines].count = players[i].laps+1;
|
|
||||||
tab[scorelines].num = i;
|
tab[scorelines].num = i;
|
||||||
tab[scorelines].color = players[i].skincolor;
|
tab[scorelines].color = players[i].skincolor;
|
||||||
tab[scorelines].name = player_names[i];
|
tab[scorelines].name = player_names[i];
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -35,11 +35,6 @@
|
||||||
#define CRED_FONTEND 'Z' // the last font character
|
#define CRED_FONTEND 'Z' // the last font character
|
||||||
#define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1)
|
#define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1)
|
||||||
|
|
||||||
#define KART_FONTSTART '\"' // the first font characters // SRB2kart 16/03/27
|
|
||||||
#define KART_REALFONTSTART 'A'
|
|
||||||
#define KART_FONTEND 'Z' // the last font characters
|
|
||||||
#define KART_FONTSIZE (KART_FONTEND - KART_FONTSTART + 1)
|
|
||||||
|
|
||||||
#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init();
|
#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init();
|
||||||
|
|
||||||
extern char *shiftxform; // english translation shift table
|
extern char *shiftxform; // english translation shift table
|
||||||
|
@ -68,7 +63,6 @@ extern patch_t *tallnum[10];
|
||||||
extern patch_t *nightsnum[10];
|
extern patch_t *nightsnum[10];
|
||||||
extern patch_t *lt_font[LT_FONTSIZE];
|
extern patch_t *lt_font[LT_FONTSIZE];
|
||||||
extern patch_t *cred_font[CRED_FONTSIZE];
|
extern patch_t *cred_font[CRED_FONTSIZE];
|
||||||
extern patch_t *kart_font[KART_FONTSIZE]; // SRB2kart 16/03/27
|
|
||||||
extern patch_t *emeraldpics[7];
|
extern patch_t *emeraldpics[7];
|
||||||
extern patch_t *tinyemeraldpics[7];
|
extern patch_t *tinyemeraldpics[7];
|
||||||
extern patch_t *rflagico;
|
extern patch_t *rflagico;
|
||||||
|
@ -99,7 +93,6 @@ boolean HU_Responder(event_t *ev);
|
||||||
|
|
||||||
void HU_Ticker(void);
|
void HU_Ticker(void);
|
||||||
void HU_Drawer(void);
|
void HU_Drawer(void);
|
||||||
void HU_AutomapDrawer(void);
|
|
||||||
char HU_dequeueChatChar(void);
|
char HU_dequeueChatChar(void);
|
||||||
void HU_Erase(void);
|
void HU_Erase(void);
|
||||||
void HU_clearChatChars(void);
|
void HU_clearChatChars(void);
|
||||||
|
@ -107,7 +100,6 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
||||||
void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
||||||
void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
||||||
void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds);
|
void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds);
|
||||||
void HU_DrawRaceRanking(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
|
||||||
|
|
||||||
INT32 HU_CreateTeamScoresTbl(playersort_t *tab, UINT32 dmtotals[]);
|
INT32 HU_CreateTeamScoresTbl(playersort_t *tab, UINT32 dmtotals[]);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2011-2014 by Sonic Team Junior.
|
// Copyright (C) 2011-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
#ifndef I_getaddrinfo
|
#ifndef I_getaddrinfo
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#if !defined (_MSC_VER) || (_MSC_VER >= 1800) // MSVC 2013 and forward
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#else
|
#else
|
||||||
typedef char bool;
|
typedef char bool;
|
||||||
|
@ -105,7 +105,7 @@ static void WS_addrinfosetup(void)
|
||||||
return; // already have the functions
|
return; // already have the functions
|
||||||
// why not hold it into ipv6dll? becase we already link with ws2_32, silly!
|
// why not hold it into ipv6dll? becase we already link with ws2_32, silly!
|
||||||
if (WS_getfunctions(GetModuleHandleA("ws2_32.dll")) == NULL)
|
if (WS_getfunctions(GetModuleHandleA("ws2_32.dll")) == NULL)
|
||||||
ipv6dll = WS_getfunctions(LoadLibrary("wship6.dll"));
|
ipv6dll = WS_getfunctions(LoadLibraryA("wship6.dll"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WS_addrinfocleanup(void)
|
void WS_addrinfocleanup(void)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2011-2014 by Sonic Team Junior.
|
// Copyright (C) 2011-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -466,7 +466,7 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||||
UINT32 bitmask = INADDR_NONE;
|
UINT32 bitmask = INADDR_NONE;
|
||||||
|
|
||||||
if (mask && mask < 32)
|
if (mask && mask < 32)
|
||||||
bitmask = htonl(-1 << (32 - mask));
|
bitmask = htonl((UINT32)(-1) << (32 - mask));
|
||||||
|
|
||||||
if (b->any.sa_family == AF_INET)
|
if (b->any.sa_family == AF_INET)
|
||||||
return (a->ip4.sin_addr.s_addr & bitmask) == (b->ip4.sin_addr.s_addr & bitmask)
|
return (a->ip4.sin_addr.s_addr & bitmask) == (b->ip4.sin_addr.s_addr & bitmask)
|
||||||
|
@ -651,7 +651,7 @@ static void SOCK_Send(void)
|
||||||
if (broadcastaddress[i].any.sa_family == AF_INET)
|
if (broadcastaddress[i].any.sa_family == AF_INET)
|
||||||
d = d4;
|
d = d4;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
if (broadcastaddress[i].any.sa_family == AF_INET6)
|
else if (broadcastaddress[i].any.sa_family == AF_INET6)
|
||||||
d = d6;
|
d = d6;
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
|
@ -690,7 +690,7 @@ static void SOCK_Send(void)
|
||||||
if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET)
|
if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET)
|
||||||
d = d4;
|
d = d4;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6)
|
else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6)
|
||||||
d = d6;
|
d = d6;
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
814
src/info.c
814
src/info.c
File diff suppressed because it is too large
Load diff
1371
src/info.h
1371
src/info.h
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
// Copyright (C) 1999-2014 by Sonic Team Junior.
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -88,6 +88,7 @@ static int lib_print(lua_State *L)
|
||||||
static int lib_evalMath(lua_State *L)
|
static int lib_evalMath(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *word = luaL_checkstring(L, 1);
|
const char *word = luaL_checkstring(L, 1);
|
||||||
|
LUA_Deprecated(L, "EvalMath(string)", "_G[string]");
|
||||||
lua_pushinteger(L, LUA_EvalMath(word));
|
lua_pushinteger(L, LUA_EvalMath(word));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -95,17 +96,17 @@ static int lib_evalMath(lua_State *L)
|
||||||
// M_RANDOM
|
// M_RANDOM
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
static int lib_pRandom(lua_State *L)
|
static int lib_pRandomFixed(lua_State *L)
|
||||||
{
|
{
|
||||||
NOHUD
|
NOHUD
|
||||||
lua_pushinteger(L, P_Random());
|
lua_pushfixed(L, P_RandomFixed());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_pSignedRandom(lua_State *L)
|
static int lib_pRandomByte(lua_State *L)
|
||||||
{
|
{
|
||||||
NOHUD
|
NOHUD
|
||||||
lua_pushinteger(L, P_SignedRandom());
|
lua_pushinteger(L, P_RandomByte());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +115,8 @@ static int lib_pRandomKey(lua_State *L)
|
||||||
INT32 a = (INT32)luaL_checkinteger(L, 1);
|
INT32 a = (INT32)luaL_checkinteger(L, 1);
|
||||||
|
|
||||||
NOHUD
|
NOHUD
|
||||||
|
if (a > 65536)
|
||||||
|
LUA_UsageWarning(L, "P_RandomKey: range > 65536 is undefined behavior");
|
||||||
lua_pushinteger(L, P_RandomKey(a));
|
lua_pushinteger(L, P_RandomKey(a));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -129,34 +132,84 @@ static int lib_pRandomRange(lua_State *L)
|
||||||
a = b;
|
a = b;
|
||||||
b = c;
|
b = c;
|
||||||
}
|
}
|
||||||
|
if ((b-a+1) > 65536)
|
||||||
|
LUA_UsageWarning(L, "P_RandomRange: range > 65536 is undefined behavior");
|
||||||
lua_pushinteger(L, P_RandomRange(a, b));
|
lua_pushinteger(L, P_RandomRange(a, b));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated, macros, etc.
|
||||||
|
static int lib_pRandom(lua_State *L)
|
||||||
|
{
|
||||||
|
NOHUD
|
||||||
|
LUA_Deprecated(L, "P_Random", "P_RandomByte");
|
||||||
|
lua_pushinteger(L, P_RandomByte());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pSignedRandom(lua_State *L)
|
||||||
|
{
|
||||||
|
NOHUD
|
||||||
|
lua_pushinteger(L, P_SignedRandom());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pRandomChance(lua_State *L)
|
||||||
|
{
|
||||||
|
fixed_t p = luaL_checkfixed(L, 1);
|
||||||
|
NOHUD
|
||||||
|
lua_pushboolean(L, P_RandomChance(p));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// P_MAPUTIL
|
// P_MAPUTIL
|
||||||
///////////////
|
///////////////
|
||||||
|
|
||||||
static int lib_pAproxDistance(lua_State *L)
|
static int lib_pAproxDistance(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t dx = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t dx = luaL_checkfixed(L, 1);
|
||||||
fixed_t dy = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t dy = luaL_checkfixed(L, 2);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
lua_pushinteger(L, P_AproxDistance(dx, dy));
|
lua_pushfixed(L, P_AproxDistance(dx, dy));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_pClosestPointOnLine(lua_State *L)
|
static int lib_pClosestPointOnLine(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
int n = lua_gettop(L);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t x = luaL_checkfixed(L, 1);
|
||||||
line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE));
|
fixed_t y = luaL_checkfixed(L, 2);
|
||||||
vertex_t result;
|
vertex_t result;
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
if (!line)
|
if (lua_isuserdata(L, 3)) // use a real linedef to get our points
|
||||||
return LUA_ErrInvalid(L, "line_t");
|
{
|
||||||
P_ClosestPointOnLine(x, y, line, &result);
|
line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE));
|
||||||
lua_pushinteger(L, result.x);
|
if (!line)
|
||||||
lua_pushinteger(L, result.y);
|
return LUA_ErrInvalid(L, "line_t");
|
||||||
|
P_ClosestPointOnLine(x, y, line, &result);
|
||||||
|
}
|
||||||
|
else // use custom coordinates of our own!
|
||||||
|
{
|
||||||
|
vertex_t v1, v2; // fake vertexes
|
||||||
|
line_t junk; // fake linedef
|
||||||
|
|
||||||
|
if (n < 6)
|
||||||
|
return luaL_error(L, "arguments 3 to 6 not all given (expected 4 fixed-point integers)");
|
||||||
|
|
||||||
|
v1.x = luaL_checkfixed(L, 3);
|
||||||
|
v1.y = luaL_checkfixed(L, 4);
|
||||||
|
v2.x = luaL_checkfixed(L, 5);
|
||||||
|
v2.y = luaL_checkfixed(L, 6);
|
||||||
|
|
||||||
|
junk.v1 = &v1;
|
||||||
|
junk.v2 = &v2;
|
||||||
|
junk.dx = v2.x - v1.x;
|
||||||
|
junk.dy = v2.y - v1.y;
|
||||||
|
P_ClosestPointOnLine(x, y, &junk, &result);
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_pushfixed(L, result.x);
|
||||||
|
lua_pushfixed(L, result.y);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,13 +294,13 @@ static int lib_pLookForPlayers(lua_State *L)
|
||||||
|
|
||||||
static int lib_pSpawnMobj(lua_State *L)
|
static int lib_pSpawnMobj(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t x = luaL_checkfixed(L, 1);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t y = luaL_checkfixed(L, 2);
|
||||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t z = luaL_checkfixed(L, 3);
|
||||||
mobjtype_t type = luaL_checkinteger(L, 4);
|
mobjtype_t type = luaL_checkinteger(L, 4);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ);
|
LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -272,8 +325,8 @@ static int lib_pSpawnMissile(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source || !dest)
|
if (!source || !dest)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
LUA_PushUserdata(L, P_SpawnMissile(source, dest, type), META_MOBJ);
|
LUA_PushUserdata(L, P_SpawnMissile(source, dest, type), META_MOBJ);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -283,14 +336,14 @@ static int lib_pSpawnXYZMissile(lua_State *L)
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
mobj_t *dest = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
mobj_t *dest = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||||
mobjtype_t type = luaL_checkinteger(L, 3);
|
mobjtype_t type = luaL_checkinteger(L, 3);
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t x = luaL_checkfixed(L, 4);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 5);
|
fixed_t y = luaL_checkfixed(L, 5);
|
||||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 6);
|
fixed_t z = luaL_checkfixed(L, 6);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source || !dest)
|
if (!source || !dest)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
LUA_PushUserdata(L, P_SpawnXYZMissile(source, dest, type, x, y, z), META_MOBJ);
|
LUA_PushUserdata(L, P_SpawnXYZMissile(source, dest, type, x, y, z), META_MOBJ);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -298,18 +351,18 @@ static int lib_pSpawnXYZMissile(lua_State *L)
|
||||||
static int lib_pSpawnPointMissile(lua_State *L)
|
static int lib_pSpawnPointMissile(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
fixed_t xa = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t xa = luaL_checkfixed(L, 2);
|
||||||
fixed_t ya = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t ya = luaL_checkfixed(L, 3);
|
||||||
fixed_t za = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t za = luaL_checkfixed(L, 4);
|
||||||
mobjtype_t type = luaL_checkinteger(L, 5);
|
mobjtype_t type = luaL_checkinteger(L, 5);
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 6);
|
fixed_t x = luaL_checkfixed(L, 6);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 7);
|
fixed_t y = luaL_checkfixed(L, 7);
|
||||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 8);
|
fixed_t z = luaL_checkfixed(L, 8);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source)
|
if (!source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
LUA_PushUserdata(L, P_SpawnPointMissile(source, xa, ya, za, type, x, y, z), META_MOBJ);
|
LUA_PushUserdata(L, P_SpawnPointMissile(source, xa, ya, za, type, x, y, z), META_MOBJ);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -318,15 +371,15 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
mobjtype_t type = luaL_checkinteger(L, 2);
|
mobjtype_t type = luaL_checkinteger(L, 2);
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t x = luaL_checkfixed(L, 3);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t y = luaL_checkfixed(L, 4);
|
||||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 5);
|
fixed_t z = luaL_checkfixed(L, 5);
|
||||||
INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5);
|
INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source)
|
if (!source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
LUA_PushUserdata(L, P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle), META_MOBJ);
|
LUA_PushUserdata(L, P_SpawnAlteredDirectionMissile(source, type, x, y, z, shiftingAngle), META_MOBJ);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -348,14 +401,14 @@ static int lib_pSPMAngle(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
mobjtype_t type = luaL_checkinteger(L, 2);
|
mobjtype_t type = luaL_checkinteger(L, 2);
|
||||||
angle_t angle = (angle_t)luaL_checkinteger(L, 3);
|
angle_t angle = luaL_checkangle(L, 3);
|
||||||
UINT8 allowaim = (UINT8)luaL_optinteger(L, 4, 0);
|
UINT8 allowaim = (UINT8)luaL_optinteger(L, 4, 0);
|
||||||
UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0);
|
UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source)
|
if (!source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
LUA_PushUserdata(L, P_SPMAngle(source, type, angle, allowaim, flags2), META_MOBJ);
|
LUA_PushUserdata(L, P_SPMAngle(source, type, angle, allowaim, flags2), META_MOBJ);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -368,8 +421,8 @@ static int lib_pSpawnPlayerMissile(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!source)
|
if (!source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
LUA_PushUserdata(L, P_SpawnPlayerMissile(source, type, flags2), META_MOBJ);
|
LUA_PushUserdata(L, P_SpawnPlayerMissile(source, type, flags2), META_MOBJ);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -388,8 +441,8 @@ static int lib_pWeaponOrPanel(lua_State *L)
|
||||||
{
|
{
|
||||||
mobjtype_t type = luaL_checkinteger(L, 1);
|
mobjtype_t type = luaL_checkinteger(L, 1);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
lua_pushboolean(L, P_WeaponOrPanel(type));
|
lua_pushboolean(L, P_WeaponOrPanel(type));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -418,18 +471,20 @@ static int lib_pGetClosestAxis(lua_State *L)
|
||||||
|
|
||||||
static int lib_pSpawnParaloop(lua_State *L)
|
static int lib_pSpawnParaloop(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t x = luaL_checkfixed(L, 1);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t y = luaL_checkfixed(L, 2);
|
||||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t z = luaL_checkfixed(L, 3);
|
||||||
fixed_t radius = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t radius = luaL_checkfixed(L, 4);
|
||||||
INT32 number = (INT32)luaL_checkinteger(L, 5);
|
INT32 number = (INT32)luaL_checkinteger(L, 5);
|
||||||
mobjtype_t type = luaL_checkinteger(L, 6);
|
mobjtype_t type = luaL_checkinteger(L, 6);
|
||||||
angle_t rotangle = (angle_t)luaL_checkinteger(L, 7);
|
angle_t rotangle = luaL_checkangle(L, 7);
|
||||||
statenum_t nstate = luaL_optinteger(L, 8, S_NULL);
|
statenum_t nstate = luaL_optinteger(L, 8, S_NULL);
|
||||||
boolean spawncenter = lua_optboolean(L, 9);
|
boolean spawncenter = lua_optboolean(L, 9);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
|
if (nstate >= NUMSTATES)
|
||||||
|
return luaL_error(L, "state %d out of range (0 - %d)", nstate, NUMSTATES-1);
|
||||||
P_SpawnParaloop(x, y, z, radius, number, type, nstate, rotangle, spawncenter);
|
P_SpawnParaloop(x, y, z, radius, number, type, nstate, rotangle, spawncenter);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +513,7 @@ static int lib_pSupermanLook4Players(lua_State *L)
|
||||||
static int lib_pSetScale(lua_State *L)
|
static int lib_pSetScale(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
fixed_t newscale = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t newscale = luaL_checkfixed(L, 2);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!mobj)
|
if (!mobj)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -526,7 +581,7 @@ static int lib_pGetPlayerHeight(lua_State *L)
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
lua_pushinteger(L, P_GetPlayerHeight(player));
|
lua_pushfixed(L, P_GetPlayerHeight(player));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +591,7 @@ static int lib_pGetPlayerSpinHeight(lua_State *L)
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
lua_pushinteger(L, P_GetPlayerSpinHeight(player));
|
lua_pushfixed(L, P_GetPlayerSpinHeight(player));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +694,7 @@ static int lib_pInQuicksand(lua_State *L)
|
||||||
static int lib_pSetObjectMomZ(lua_State *L)
|
static int lib_pSetObjectMomZ(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
fixed_t value = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t value = luaL_checkfixed(L, 2);
|
||||||
boolean relative = lua_optboolean(L, 3);
|
boolean relative = lua_optboolean(L, 3);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!mo)
|
if (!mo)
|
||||||
|
@ -753,8 +808,8 @@ static int lib_pDoPlayerExit(lua_State *L)
|
||||||
static int lib_pInstaThrust(lua_State *L)
|
static int lib_pInstaThrust(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
angle_t angle = (angle_t)luaL_checkinteger(L, 2);
|
angle_t angle = luaL_checkangle(L, 2);
|
||||||
fixed_t move = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t move = luaL_checkfixed(L, 3);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!mo)
|
if (!mo)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -768,10 +823,10 @@ static int lib_pReturnThrustX(lua_State *L)
|
||||||
fixed_t move;
|
fixed_t move;
|
||||||
if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
|
if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
|
||||||
lua_remove(L, 1); // ignore mobj as arg1
|
lua_remove(L, 1); // ignore mobj as arg1
|
||||||
angle = (angle_t)luaL_checkinteger(L, 1);
|
angle = luaL_checkangle(L, 1);
|
||||||
move = (fixed_t)luaL_checkinteger(L, 2);
|
move = luaL_checkfixed(L, 2);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
lua_pushinteger(L, P_ReturnThrustX(NULL, angle, move));
|
lua_pushfixed(L, P_ReturnThrustX(NULL, angle, move));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,10 +836,10 @@ static int lib_pReturnThrustY(lua_State *L)
|
||||||
fixed_t move;
|
fixed_t move;
|
||||||
if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
|
if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
|
||||||
lua_remove(L, 1); // ignore mobj as arg1
|
lua_remove(L, 1); // ignore mobj as arg1
|
||||||
angle = (angle_t)luaL_checkinteger(L, 1);
|
angle = luaL_checkangle(L, 1);
|
||||||
move = (fixed_t)luaL_checkinteger(L, 2);
|
move = luaL_checkfixed(L, 2);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
lua_pushinteger(L, P_ReturnThrustY(NULL, angle, move));
|
lua_pushfixed(L, P_ReturnThrustY(NULL, angle, move));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,7 +857,7 @@ static int lib_pNukeEnemies(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *inflictor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *inflictor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||||
fixed_t radius = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t radius = luaL_checkfixed(L, 3);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!inflictor || !source)
|
if (!inflictor || !source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -859,8 +914,8 @@ static int lib_pSpawnSpinMobj(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
if (type > MT_LASTFREESLOT)
|
if (type >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
P_SpawnSpinMobj(player, type);
|
P_SpawnSpinMobj(player, type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -868,8 +923,8 @@ static int lib_pSpawnSpinMobj(lua_State *L)
|
||||||
static int lib_pTelekinesis(lua_State *L)
|
static int lib_pTelekinesis(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
fixed_t thrust = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t thrust = luaL_checkfixed(L, 2);
|
||||||
fixed_t range = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t range = luaL_checkfixed(L, 3);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
@ -884,8 +939,8 @@ static int lib_pCheckPosition(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *ptmthing = tmthing;
|
mobj_t *ptmthing = tmthing;
|
||||||
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t x = luaL_checkfixed(L, 2);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t y = luaL_checkfixed(L, 3);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!thing)
|
if (!thing)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -899,8 +954,8 @@ static int lib_pTryMove(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *ptmthing = tmthing;
|
mobj_t *ptmthing = tmthing;
|
||||||
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t x = luaL_checkfixed(L, 2);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t y = luaL_checkfixed(L, 3);
|
||||||
boolean allowdropoff = lua_optboolean(L, 4);
|
boolean allowdropoff = lua_optboolean(L, 4);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!thing)
|
if (!thing)
|
||||||
|
@ -915,7 +970,7 @@ static int lib_pMove(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *ptmthing = tmthing;
|
mobj_t *ptmthing = tmthing;
|
||||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
fixed_t speed = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t speed = luaL_checkfixed(L, 2);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -929,9 +984,9 @@ static int lib_pTeleportMove(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *ptmthing = tmthing;
|
mobj_t *ptmthing = tmthing;
|
||||||
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t x = luaL_checkfixed(L, 2);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t y = luaL_checkfixed(L, 3);
|
||||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t z = luaL_checkfixed(L, 4);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!thing)
|
if (!thing)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -975,10 +1030,10 @@ static int lib_pCheckSight(lua_State *L)
|
||||||
static int lib_pCheckHoopPosition(lua_State *L)
|
static int lib_pCheckHoopPosition(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t x = luaL_checkfixed(L, 2);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t y = luaL_checkfixed(L, 3);
|
||||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t z = luaL_checkfixed(L, 4);
|
||||||
fixed_t radius = (fixed_t)luaL_checkinteger(L, 5);
|
fixed_t radius = luaL_checkfixed(L, 5);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!hoopthing)
|
if (!hoopthing)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -990,7 +1045,7 @@ static int lib_pRadiusAttack(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *spot = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *spot = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||||
fixed_t damagedist = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t damagedist = luaL_checkfixed(L, 3);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!spot || !source)
|
if (!spot || !source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -1000,12 +1055,12 @@ static int lib_pRadiusAttack(lua_State *L)
|
||||||
|
|
||||||
static int lib_pFloorzAtPos(lua_State *L)
|
static int lib_pFloorzAtPos(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t x = luaL_checkfixed(L, 1);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t y = luaL_checkfixed(L, 2);
|
||||||
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t z = luaL_checkfixed(L, 3);
|
||||||
fixed_t height = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t height = luaL_checkfixed(L, 4);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
lua_pushinteger(L, P_FloorzAtPos(x, y, z, height));
|
lua_pushfixed(L, P_FloorzAtPos(x, y, z, height));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,8 +1071,8 @@ static int lib_pDoSpring(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!spring || !object)
|
if (!spring || !object)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
P_DoSpring(spring, object);
|
lua_pushboolean(L, P_DoSpring(spring, object));
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// P_INTER
|
// P_INTER
|
||||||
|
@ -1209,8 +1264,8 @@ static int lib_pDoNightsScore(lua_State *L)
|
||||||
static int lib_pThrust(lua_State *L)
|
static int lib_pThrust(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
angle_t angle = (angle_t)luaL_checkinteger(L, 2);
|
angle_t angle = luaL_checkangle(L, 2);
|
||||||
fixed_t move = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t move = luaL_checkfixed(L, 3);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!mo)
|
if (!mo)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
@ -1225,6 +1280,8 @@ static int lib_pSetMobjStateNF(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!mobj)
|
if (!mobj)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
if (state >= NUMSTATES)
|
||||||
|
return luaL_error(L, "state %d out of range (0 - %d)", state, NUMSTATES-1);
|
||||||
if (mobj->player && state == S_NULL)
|
if (mobj->player && state == S_NULL)
|
||||||
return luaL_error(L, "Attempt to remove player mobj with S_NULL.");
|
return luaL_error(L, "Attempt to remove player mobj with S_NULL.");
|
||||||
lua_pushboolean(L, P_SetMobjStateNF(mobj, state));
|
lua_pushboolean(L, P_SetMobjStateNF(mobj, state));
|
||||||
|
@ -1336,8 +1393,8 @@ static int lib_pIsFlagAtBase(lua_State *L)
|
||||||
{
|
{
|
||||||
mobjtype_t flag = luaL_checkinteger(L, 1);
|
mobjtype_t flag = luaL_checkinteger(L, 1);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (flag > MT_LASTFREESLOT)
|
if (flag >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobjtype_t out of bounds error!");
|
return luaL_error(L, "mobj type %d out of range (0 - %d)", flag, NUMMOBJTYPES-1);
|
||||||
lua_pushboolean(L, P_IsFlagAtBase(flag));
|
lua_pushboolean(L, P_IsFlagAtBase(flag));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1485,48 +1542,48 @@ static int lib_evCrumbleChain(lua_State *L)
|
||||||
|
|
||||||
static int lib_rPointToAngle(lua_State *L)
|
static int lib_rPointToAngle(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t x = luaL_checkfixed(L, 1);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t y = luaL_checkfixed(L, 2);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
lua_pushinteger(L, R_PointToAngle(x, y));
|
lua_pushangle(L, R_PointToAngle(x, y));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_rPointToAngle2(lua_State *L)
|
static int lib_rPointToAngle2(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t px2 = luaL_checkfixed(L, 1);
|
||||||
fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t py2 = luaL_checkfixed(L, 2);
|
||||||
fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t px1 = luaL_checkfixed(L, 3);
|
||||||
fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t py1 = luaL_checkfixed(L, 4);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
lua_pushinteger(L, R_PointToAngle2(px2, py2, px1, py1));
|
lua_pushangle(L, R_PointToAngle2(px2, py2, px1, py1));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_rPointToDist(lua_State *L)
|
static int lib_rPointToDist(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t x = luaL_checkfixed(L, 1);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t y = luaL_checkfixed(L, 2);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
lua_pushinteger(L, R_PointToDist(x, y));
|
lua_pushfixed(L, R_PointToDist(x, y));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_rPointToDist2(lua_State *L)
|
static int lib_rPointToDist2(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t px2 = luaL_checkfixed(L, 1);
|
||||||
fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t py2 = luaL_checkfixed(L, 2);
|
||||||
fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t px1 = luaL_checkfixed(L, 3);
|
||||||
fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4);
|
fixed_t py1 = luaL_checkfixed(L, 4);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
lua_pushinteger(L, R_PointToDist2(px2, py2, px1, py1));
|
lua_pushfixed(L, R_PointToDist2(px2, py2, px1, py1));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_rPointInSubsector(lua_State *L)
|
static int lib_rPointInSubsector(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t x = luaL_checkfixed(L, 1);
|
||||||
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
|
fixed_t y = luaL_checkfixed(L, 2);
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR);
|
LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1570,7 +1627,7 @@ static int lib_rSetPlayerSkin(lua_State *L)
|
||||||
{
|
{
|
||||||
INT32 i = luaL_checkinteger(L, 2);
|
INT32 i = luaL_checkinteger(L, 2);
|
||||||
if (i < 0 || i >= MAXSKINS)
|
if (i < 0 || i >= MAXSKINS)
|
||||||
return luaL_error(L, "argument #2 cannot exceed MAXSKINS");
|
return luaL_error(L, "skin number (argument #2) %d out of range (0 - %d)", i, MAXSKINS-1);
|
||||||
SetPlayerSkinByNum(player-players, i);
|
SetPlayerSkinByNum(player-players, i);
|
||||||
}
|
}
|
||||||
else // skin name
|
else // skin name
|
||||||
|
@ -1590,6 +1647,8 @@ static int lib_sStartSound(lua_State *L)
|
||||||
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
if (sound_id >= NUMSFX)
|
||||||
|
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
|
||||||
if (!lua_isnil(L, 1))
|
if (!lua_isnil(L, 1))
|
||||||
{
|
{
|
||||||
origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
@ -1614,12 +1673,15 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||||
INT32 volume = (INT32)luaL_checkinteger(L, 3);
|
INT32 volume = (INT32)luaL_checkinteger(L, 3);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
|
||||||
if (!lua_isnil(L, 1))
|
if (!lua_isnil(L, 1))
|
||||||
{
|
{
|
||||||
origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
}
|
}
|
||||||
|
if (sound_id >= NUMSFX)
|
||||||
|
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
|
||||||
if (!lua_isnone(L, 4) && lua_isuserdata(L, 4))
|
if (!lua_isnone(L, 4) && lua_isuserdata(L, 4))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 4, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 4, META_PLAYER));
|
||||||
|
@ -1643,24 +1705,69 @@ static int lib_sStopSound(lua_State *L)
|
||||||
|
|
||||||
static int lib_sChangeMusic(lua_State *L)
|
static int lib_sChangeMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
UINT32 music_num = (UINT32)luaL_checkinteger(L, 1);
|
#ifdef MUSICSLOT_COMPATIBILITY
|
||||||
|
const char *music_name;
|
||||||
|
UINT32 music_num;
|
||||||
|
char music_compat_name[7];
|
||||||
|
|
||||||
|
boolean looping;
|
||||||
|
player_t *player = NULL;
|
||||||
|
UINT16 music_flags = 0;
|
||||||
|
NOHUD
|
||||||
|
|
||||||
|
if (lua_isnumber(L, 1))
|
||||||
|
{
|
||||||
|
music_num = (UINT32)luaL_checkinteger(L, 1);
|
||||||
|
music_flags = (UINT16)(music_num & 0x0000FFFF);
|
||||||
|
if (music_flags && music_flags <= 1035)
|
||||||
|
snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags));
|
||||||
|
else if (music_flags && music_flags <= 1050)
|
||||||
|
strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7);
|
||||||
|
else
|
||||||
|
music_compat_name[0] = 0; // becomes empty string
|
||||||
|
music_compat_name[6] = 0;
|
||||||
|
music_name = (const char *)&music_compat_name;
|
||||||
|
music_flags = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
music_num = 0;
|
||||||
|
music_name = luaL_checkstring(L, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
looping = (boolean)lua_opttrueboolean(L, 2);
|
||||||
|
|
||||||
|
#else
|
||||||
|
const char *music_name = luaL_checkstring(L, 1);
|
||||||
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
|
UINT16 music_flags = 0;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
|
||||||
|
#endif
|
||||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||||
{
|
{
|
||||||
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
||||||
if (!player)
|
if (!player)
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MUSICSLOT_COMPATIBILITY
|
||||||
|
if (music_num)
|
||||||
|
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||||
|
|
||||||
if (!player || P_IsLocalPlayer(player))
|
if (!player || P_IsLocalPlayer(player))
|
||||||
S_ChangeMusic(music_num, looping);
|
S_ChangeMusic(music_name, music_flags, looping);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_sSpeedMusic(lua_State *L)
|
static int lib_sSpeedMusic(lua_State *L)
|
||||||
{
|
{
|
||||||
fixed_t fixedspeed = (fixed_t)luaL_checkinteger(L, 1);
|
fixed_t fixedspeed = luaL_checkfixed(L, 1);
|
||||||
float speed = FIXED_TO_FLOAT(fixedspeed);
|
float speed = FIXED_TO_FLOAT(fixedspeed);
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
@ -1706,6 +1813,8 @@ static int lib_sIdPlaying(lua_State *L)
|
||||||
{
|
{
|
||||||
sfxenum_t id = luaL_checkinteger(L, 1);
|
sfxenum_t id = luaL_checkinteger(L, 1);
|
||||||
NOHUD
|
NOHUD
|
||||||
|
if (id >= NUMSFX)
|
||||||
|
return luaL_error(L, "sfx %d out of range (0 - %d)", id, NUMSFX-1);
|
||||||
lua_pushboolean(L, S_IdPlaying(id));
|
lua_pushboolean(L, S_IdPlaying(id));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1717,6 +1826,8 @@ static int lib_sSoundPlaying(lua_State *L)
|
||||||
NOHUD
|
NOHUD
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
if (id >= NUMSFX)
|
||||||
|
return luaL_error(L, "sfx %d out of range (0 - %d)", id, NUMSFX-1);
|
||||||
lua_pushboolean(L, S_SoundPlaying(origin, id));
|
lua_pushboolean(L, S_SoundPlaying(origin, id));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1737,7 +1848,7 @@ static int lib_gDoReborn(lua_State *L)
|
||||||
INT32 playernum = luaL_checkinteger(L, 1);
|
INT32 playernum = luaL_checkinteger(L, 1);
|
||||||
NOHUD
|
NOHUD
|
||||||
if (playernum >= MAXPLAYERS)
|
if (playernum >= MAXPLAYERS)
|
||||||
return luaL_error(L, "playernum out of bounds error!");
|
return luaL_error(L, "playernum %d out of range (0 - %d)", playernum, MAXPLAYERS-1);
|
||||||
G_DoReborn(playernum);
|
G_DoReborn(playernum);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1864,10 +1975,13 @@ static luaL_Reg lib[] = {
|
||||||
{"EvalMath", lib_evalMath},
|
{"EvalMath", lib_evalMath},
|
||||||
|
|
||||||
// m_random
|
// m_random
|
||||||
{"P_Random",lib_pRandom},
|
{"P_RandomFixed",lib_pRandomFixed},
|
||||||
{"P_SignedRandom",lib_pSignedRandom},
|
{"P_RandomByte",lib_pRandomByte},
|
||||||
{"P_RandomKey",lib_pRandomKey},
|
{"P_RandomKey",lib_pRandomKey},
|
||||||
{"P_RandomRange",lib_pRandomRange},
|
{"P_RandomRange",lib_pRandomRange},
|
||||||
|
{"P_Random",lib_pRandom}, // DEPRECATED
|
||||||
|
{"P_SignedRandom",lib_pSignedRandom}, // MACRO
|
||||||
|
{"P_RandomChance",lib_pRandomChance}, // MACRO
|
||||||
|
|
||||||
// p_maputil
|
// p_maputil
|
||||||
{"P_AproxDistance",lib_pAproxDistance},
|
{"P_AproxDistance",lib_pAproxDistance},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -41,7 +41,8 @@ enum hook {
|
||||||
hook_BotAI,
|
hook_BotAI,
|
||||||
hook_LinedefExecute,
|
hook_LinedefExecute,
|
||||||
hook_PlayerMsg,
|
hook_PlayerMsg,
|
||||||
hook_DeathMsg,
|
hook_HurtMsg,
|
||||||
|
hook_PlayerSpawn,
|
||||||
|
|
||||||
hook_MAX // last hook
|
hook_MAX // last hook
|
||||||
};
|
};
|
||||||
|
@ -54,8 +55,9 @@ void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
|
||||||
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
|
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
|
||||||
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
|
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
|
||||||
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
|
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
|
||||||
UINT8 LUAh_MobjCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (thing) mobj type
|
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
|
||||||
UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (tmthing) mobj type
|
#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
|
||||||
|
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
|
||||||
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
|
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
|
||||||
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
|
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
|
||||||
#define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type
|
#define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type
|
||||||
|
@ -73,6 +75,7 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
||||||
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
||||||
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
|
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
|
||||||
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
|
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
|
||||||
boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
|
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
|
||||||
|
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
1209
src/lua_hooklib.c
1209
src/lua_hooklib.c
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2014 by John "JTE" Muniz.
|
// Copyright (C) 2014-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2014 by Sonic Team Junior.
|
// Copyright (C) 2014-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2014 by John "JTE" Muniz.
|
// Copyright (C) 2014-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2014 by Sonic Team Junior.
|
// Copyright (C) 2014-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -16,7 +16,9 @@
|
||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
#include "st_stuff.h" // hudinfo[]
|
#include "st_stuff.h" // hudinfo[]
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
#include "i_video.h" // rendermode
|
||||||
#include "p_local.h" // camera_t
|
#include "p_local.h" // camera_t
|
||||||
|
#include "screen.h" // screen width/height
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
@ -126,8 +128,6 @@ static const char *const widtht_opt[] = {
|
||||||
enum cameraf {
|
enum cameraf {
|
||||||
camera_chase = 0,
|
camera_chase = 0,
|
||||||
camera_aiming,
|
camera_aiming,
|
||||||
camera_viewheight,
|
|
||||||
camera_startangle,
|
|
||||||
camera_x,
|
camera_x,
|
||||||
camera_y,
|
camera_y,
|
||||||
camera_z,
|
camera_z,
|
||||||
|
@ -137,7 +137,6 @@ enum cameraf {
|
||||||
camera_ceilingz,
|
camera_ceilingz,
|
||||||
camera_radius,
|
camera_radius,
|
||||||
camera_height,
|
camera_height,
|
||||||
camera_relativex,
|
|
||||||
camera_momx,
|
camera_momx,
|
||||||
camera_momy,
|
camera_momy,
|
||||||
camera_momz
|
camera_momz
|
||||||
|
@ -147,8 +146,6 @@ enum cameraf {
|
||||||
static const char *const camera_opt[] = {
|
static const char *const camera_opt[] = {
|
||||||
"chase",
|
"chase",
|
||||||
"aiming",
|
"aiming",
|
||||||
"viewheight",
|
|
||||||
"startangle",
|
|
||||||
"x",
|
"x",
|
||||||
"y",
|
"y",
|
||||||
"z",
|
"z",
|
||||||
|
@ -158,7 +155,6 @@ static const char *const camera_opt[] = {
|
||||||
"ceilingz",
|
"ceilingz",
|
||||||
"radius",
|
"radius",
|
||||||
"height",
|
"height",
|
||||||
"relativex",
|
|
||||||
"momx",
|
"momx",
|
||||||
"momy",
|
"momy",
|
||||||
"momz",
|
"momz",
|
||||||
|
@ -170,6 +166,8 @@ static int lib_getHudInfo(lua_State *L)
|
||||||
lua_remove(L, 1);
|
lua_remove(L, 1);
|
||||||
|
|
||||||
i = luaL_checkinteger(L, 1);
|
i = luaL_checkinteger(L, 1);
|
||||||
|
if (i >= NUMHUDITEMS)
|
||||||
|
return luaL_error(L, "hudinfo[] index %d out of range (0 - %d)", i, NUMHUDITEMS-1);
|
||||||
LUA_PushUserdata(L, &hudinfo[i], META_HUDINFO);
|
LUA_PushUserdata(L, &hudinfo[i], META_HUDINFO);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -279,12 +277,6 @@ static int camera_get(lua_State *L)
|
||||||
case camera_aiming:
|
case camera_aiming:
|
||||||
lua_pushinteger(L, cam->aiming);
|
lua_pushinteger(L, cam->aiming);
|
||||||
break;
|
break;
|
||||||
case camera_viewheight:
|
|
||||||
lua_pushinteger(L, cam->viewheight);
|
|
||||||
break;
|
|
||||||
case camera_startangle:
|
|
||||||
lua_pushinteger(L, cam->startangle);
|
|
||||||
break;
|
|
||||||
case camera_x:
|
case camera_x:
|
||||||
lua_pushinteger(L, cam->x);
|
lua_pushinteger(L, cam->x);
|
||||||
break;
|
break;
|
||||||
|
@ -312,9 +304,6 @@ static int camera_get(lua_State *L)
|
||||||
case camera_height:
|
case camera_height:
|
||||||
lua_pushinteger(L, cam->height);
|
lua_pushinteger(L, cam->height);
|
||||||
break;
|
break;
|
||||||
case camera_relativex:
|
|
||||||
lua_pushinteger(L, cam->relativex);
|
|
||||||
break;
|
|
||||||
case camera_momx:
|
case camera_momx:
|
||||||
lua_pushinteger(L, cam->momx);
|
lua_pushinteger(L, cam->momx);
|
||||||
break;
|
break;
|
||||||
|
@ -408,7 +397,7 @@ static int libd_drawPaddedNum(lua_State *L)
|
||||||
HUDONLY
|
HUDONLY
|
||||||
x = luaL_checkinteger(L, 1);
|
x = luaL_checkinteger(L, 1);
|
||||||
y = luaL_checkinteger(L, 2);
|
y = luaL_checkinteger(L, 2);
|
||||||
num = abs(luaL_checkinteger(L, 3));
|
num = labs(luaL_checkinteger(L, 3));
|
||||||
digits = luaL_optinteger(L, 4, 2);
|
digits = luaL_optinteger(L, 4, 2);
|
||||||
flags = luaL_optinteger(L, 5, 0);
|
flags = luaL_optinteger(L, 5, 0);
|
||||||
flags &= ~V_PARAMMASK; // Don't let crashes happen.
|
flags &= ~V_PARAMMASK; // Don't let crashes happen.
|
||||||
|
@ -501,14 +490,14 @@ static int libd_getColormap(lua_State *L)
|
||||||
INT32 skinnum = TC_DEFAULT;
|
INT32 skinnum = TC_DEFAULT;
|
||||||
skincolors_t color = luaL_optinteger(L, 2, 0);
|
skincolors_t color = luaL_optinteger(L, 2, 0);
|
||||||
UINT8* colormap = NULL;
|
UINT8* colormap = NULL;
|
||||||
//HUDSAFE
|
HUDONLY
|
||||||
if (lua_isnoneornil(L, 1))
|
if (lua_isnoneornil(L, 1))
|
||||||
; // defaults to TC_DEFAULT
|
; // defaults to TC_DEFAULT
|
||||||
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
|
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
|
||||||
{
|
{
|
||||||
skinnum = (INT32)luaL_checkinteger(L, 1);
|
skinnum = (INT32)luaL_checkinteger(L, 1);
|
||||||
if (skinnum < TC_ALLWHITE || skinnum >= MAXSKINS)
|
if (skinnum < TC_ALLWHITE || skinnum >= MAXSKINS)
|
||||||
return luaL_error(L, "argument #1 is out of range");
|
return luaL_error(L, "skin number %d is out of range (%d - %d)", skinnum, TC_ALLWHITE, MAXSKINS-1);
|
||||||
}
|
}
|
||||||
else // skin name
|
else // skin name
|
||||||
{
|
{
|
||||||
|
@ -525,6 +514,47 @@ static int libd_getColormap(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int libd_width(lua_State *L)
|
||||||
|
{
|
||||||
|
HUDONLY
|
||||||
|
lua_pushinteger(L, vid.width); // push screen width
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int libd_height(lua_State *L)
|
||||||
|
{
|
||||||
|
HUDONLY
|
||||||
|
lua_pushinteger(L, vid.height); // push screen height
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int libd_dupx(lua_State *L)
|
||||||
|
{
|
||||||
|
HUDONLY
|
||||||
|
lua_pushinteger(L, vid.dupx); // push integral scale (patch scale)
|
||||||
|
lua_pushfixed(L, vid.fdupx); // push fixed point scale (position scale)
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int libd_dupy(lua_State *L)
|
||||||
|
{
|
||||||
|
HUDONLY
|
||||||
|
lua_pushinteger(L, vid.dupy); // push integral scale (patch scale)
|
||||||
|
lua_pushfixed(L, vid.fdupy); // push fixed point scale (position scale)
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int libd_renderer(lua_State *L)
|
||||||
|
{
|
||||||
|
HUDONLY
|
||||||
|
switch (rendermode) {
|
||||||
|
case render_opengl: lua_pushliteral(L, "opengl"); break; // OpenGL renderer
|
||||||
|
case render_soft: lua_pushliteral(L, "software"); break; // Software renderer
|
||||||
|
default: lua_pushliteral(L, "none"); break; // render_none (for dedicated), in case there's any reason this should be run
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static luaL_Reg lib_draw[] = {
|
static luaL_Reg lib_draw[] = {
|
||||||
{"patchExists", libd_patchExists},
|
{"patchExists", libd_patchExists},
|
||||||
{"cachePatch", libd_cachePatch},
|
{"cachePatch", libd_cachePatch},
|
||||||
|
@ -536,6 +566,11 @@ static luaL_Reg lib_draw[] = {
|
||||||
{"drawString", libd_drawString},
|
{"drawString", libd_drawString},
|
||||||
{"stringWidth", libd_stringWidth},
|
{"stringWidth", libd_stringWidth},
|
||||||
{"getColormap", libd_getColormap},
|
{"getColormap", libd_getColormap},
|
||||||
|
{"width", libd_width},
|
||||||
|
{"height", libd_height},
|
||||||
|
{"dupx", libd_dupx},
|
||||||
|
{"dupy", libd_dupy},
|
||||||
|
{"renderer", libd_renderer},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -689,8 +724,6 @@ void LUAh_GameHUD(player_t *stplayr)
|
||||||
LUA_Call(gL, 3);
|
LUA_Call(gL, 3);
|
||||||
}
|
}
|
||||||
lua_pop(gL, -1);
|
lua_pop(gL, -1);
|
||||||
lua_gc(gL, LUA_GCCOLLECT, 0);
|
|
||||||
|
|
||||||
hud_running = false;
|
hud_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,8 +749,6 @@ void LUAh_ScoresHUD(void)
|
||||||
LUA_Call(gL, 1);
|
LUA_Call(gL, 1);
|
||||||
}
|
}
|
||||||
lua_pop(gL, -1);
|
lua_pop(gL, -1);
|
||||||
lua_gc(gL, LUA_GCCOLLECT, 0);
|
|
||||||
|
|
||||||
hud_running = false;
|
hud_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -137,8 +137,6 @@ static void A_Lua(mobj_t *actor)
|
||||||
--superstack;
|
--superstack;
|
||||||
superactions[superstack] = NULL;
|
superactions[superstack] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_gc(gL, LUA_GCSTEP, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arbitrary states[] table index -> state_t *
|
// Arbitrary states[] table index -> state_t *
|
||||||
|
@ -148,6 +146,8 @@ static int lib_getState(lua_State *L)
|
||||||
lua_remove(L, 1);
|
lua_remove(L, 1);
|
||||||
|
|
||||||
i = luaL_checkinteger(L, 1);
|
i = luaL_checkinteger(L, 1);
|
||||||
|
if (i >= NUMSTATES)
|
||||||
|
return luaL_error(L, "states[] index %d out of range (0 - %d)", i, NUMSTATES-1);
|
||||||
LUA_PushUserdata(L, &states[i], META_STATE);
|
LUA_PushUserdata(L, &states[i], META_STATE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,12 @@ static int lib_setState(lua_State *L)
|
||||||
{
|
{
|
||||||
state_t *state;
|
state_t *state;
|
||||||
lua_remove(L, 1); // don't care about states[] userdata.
|
lua_remove(L, 1); // don't care about states[] userdata.
|
||||||
state = &states[luaL_checkinteger(L, 1)]; // get the state to assign to.
|
{
|
||||||
|
UINT32 i = luaL_checkinteger(L, 1);
|
||||||
|
if (i >= NUMSTATES)
|
||||||
|
return luaL_error(L, "states[] index %d out of range (0 - %d)", i, NUMSTATES-1);
|
||||||
|
state = &states[i]; // get the state to assign to.
|
||||||
|
}
|
||||||
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
|
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
|
||||||
lua_remove(L, 1); // pop state num, don't need it any more.
|
lua_remove(L, 1); // pop state num, don't need it any more.
|
||||||
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the state.
|
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the state.
|
||||||
|
@ -438,6 +443,8 @@ static int lib_getMobjInfo(lua_State *L)
|
||||||
lua_remove(L, 1);
|
lua_remove(L, 1);
|
||||||
|
|
||||||
i = luaL_checkinteger(L, 1);
|
i = luaL_checkinteger(L, 1);
|
||||||
|
if (i >= NUMMOBJTYPES)
|
||||||
|
return luaL_error(L, "mobjinfo[] index %d out of range (0 - %d)", i, NUMMOBJTYPES-1);
|
||||||
LUA_PushUserdata(L, &mobjinfo[i], META_MOBJINFO);
|
LUA_PushUserdata(L, &mobjinfo[i], META_MOBJINFO);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -447,7 +454,12 @@ static int lib_setMobjInfo(lua_State *L)
|
||||||
{
|
{
|
||||||
mobjinfo_t *info;
|
mobjinfo_t *info;
|
||||||
lua_remove(L, 1); // don't care about mobjinfo[] userdata.
|
lua_remove(L, 1); // don't care about mobjinfo[] userdata.
|
||||||
info = &mobjinfo[luaL_checkinteger(L, 1)]; // get the mobjinfo to assign to.
|
{
|
||||||
|
UINT32 i = luaL_checkinteger(L, 1);
|
||||||
|
if (i >= NUMMOBJTYPES)
|
||||||
|
return luaL_error(L, "mobjinfo[] index %d out of range (0 - %d)", i, NUMMOBJTYPES-1);
|
||||||
|
info = &mobjinfo[i]; // get the mobjinfo to assign to.
|
||||||
|
}
|
||||||
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
|
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
|
||||||
lua_remove(L, 1); // pop mobjtype num, don't need it any more.
|
lua_remove(L, 1); // pop mobjtype num, don't need it any more.
|
||||||
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the mobjinfo.
|
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the mobjinfo.
|
||||||
|
@ -510,11 +522,11 @@ static int lib_setMobjInfo(lua_State *L)
|
||||||
else if (i == 15 || (str && fastcmp(str,"deathsound")))
|
else if (i == 15 || (str && fastcmp(str,"deathsound")))
|
||||||
info->deathsound = luaL_checkinteger(L, 3);
|
info->deathsound = luaL_checkinteger(L, 3);
|
||||||
else if (i == 16 || (str && fastcmp(str,"speed")))
|
else if (i == 16 || (str && fastcmp(str,"speed")))
|
||||||
info->speed = (fixed_t)luaL_checkinteger(L, 3);
|
info->speed = luaL_checkfixed(L, 3);
|
||||||
else if (i == 17 || (str && fastcmp(str,"radius")))
|
else if (i == 17 || (str && fastcmp(str,"radius")))
|
||||||
info->radius = (fixed_t)luaL_checkinteger(L, 3);
|
info->radius = luaL_checkfixed(L, 3);
|
||||||
else if (i == 18 || (str && fastcmp(str,"height")))
|
else if (i == 18 || (str && fastcmp(str,"height")))
|
||||||
info->height = (fixed_t)luaL_checkinteger(L, 3);
|
info->height = luaL_checkfixed(L, 3);
|
||||||
else if (i == 19 || (str && fastcmp(str,"dispoffset")))
|
else if (i == 19 || (str && fastcmp(str,"dispoffset")))
|
||||||
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
|
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
|
||||||
else if (i == 20 || (str && fastcmp(str,"mass")))
|
else if (i == 20 || (str && fastcmp(str,"mass")))
|
||||||
|
@ -580,11 +592,11 @@ static int mobjinfo_get(lua_State *L)
|
||||||
else if (fastcmp(field,"deathsound"))
|
else if (fastcmp(field,"deathsound"))
|
||||||
lua_pushinteger(L, info->deathsound);
|
lua_pushinteger(L, info->deathsound);
|
||||||
else if (fastcmp(field,"speed"))
|
else if (fastcmp(field,"speed"))
|
||||||
lua_pushinteger(L, info->speed);
|
lua_pushinteger(L, info->speed); // sometimes it's fixed_t, sometimes it's not...
|
||||||
else if (fastcmp(field,"radius"))
|
else if (fastcmp(field,"radius"))
|
||||||
lua_pushinteger(L, info->radius);
|
lua_pushfixed(L, info->radius);
|
||||||
else if (fastcmp(field,"height"))
|
else if (fastcmp(field,"height"))
|
||||||
lua_pushinteger(L, info->height);
|
lua_pushfixed(L, info->height);
|
||||||
else if (fastcmp(field,"dispoffset"))
|
else if (fastcmp(field,"dispoffset"))
|
||||||
lua_pushinteger(L, info->dispoffset);
|
lua_pushinteger(L, info->dispoffset);
|
||||||
else if (fastcmp(field,"mass"))
|
else if (fastcmp(field,"mass"))
|
||||||
|
@ -656,11 +668,11 @@ static int mobjinfo_set(lua_State *L)
|
||||||
else if (fastcmp(field,"deathsound"))
|
else if (fastcmp(field,"deathsound"))
|
||||||
info->deathsound = luaL_checkinteger(L, 3);
|
info->deathsound = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"speed"))
|
else if (fastcmp(field,"speed"))
|
||||||
info->speed = (fixed_t)luaL_checkinteger(L, 3);
|
info->speed = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"radius"))
|
else if (fastcmp(field,"radius"))
|
||||||
info->radius = (fixed_t)luaL_checkinteger(L, 3);
|
info->radius = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"height"))
|
else if (fastcmp(field,"height"))
|
||||||
info->height = (fixed_t)luaL_checkinteger(L, 3);
|
info->height = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"dispoffset"))
|
else if (fastcmp(field,"dispoffset"))
|
||||||
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
|
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"mass"))
|
else if (fastcmp(field,"mass"))
|
||||||
|
@ -719,6 +731,8 @@ static int lib_getSfxInfo(lua_State *L)
|
||||||
lua_remove(L, 1);
|
lua_remove(L, 1);
|
||||||
|
|
||||||
i = luaL_checkinteger(L, 1);
|
i = luaL_checkinteger(L, 1);
|
||||||
|
if (i >= NUMSFX)
|
||||||
|
return luaL_error(L, "sfxinfo[] index %d out of range (0 - %d)", i, NUMSFX-1);
|
||||||
LUA_PushUserdata(L, &S_sfx[i], META_SFXINFO);
|
LUA_PushUserdata(L, &S_sfx[i], META_SFXINFO);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -729,7 +743,12 @@ static int lib_setSfxInfo(lua_State *L)
|
||||||
sfxinfo_t *info;
|
sfxinfo_t *info;
|
||||||
|
|
||||||
lua_remove(L, 1);
|
lua_remove(L, 1);
|
||||||
info = &S_sfx[luaL_checkinteger(L, 1)]; // get the mobjinfo to assign to.
|
{
|
||||||
|
UINT32 i = luaL_checkinteger(L, 1);
|
||||||
|
if (i >= NUMSFX)
|
||||||
|
return luaL_error(L, "sfxinfo[] index %d out of range (0 - %d)", i, NUMSFX-1);
|
||||||
|
info = &S_sfx[i]; // get the mobjinfo to assign to.
|
||||||
|
}
|
||||||
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
|
luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table.
|
||||||
lua_remove(L, 1); // pop mobjtype num, don't need it any more.
|
lua_remove(L, 1); // pop mobjtype num, don't need it any more.
|
||||||
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the mobjinfo.
|
lua_settop(L, 1); // cut the stack here. the only thing left now is the table of data we're assigning to the mobjinfo.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -42,6 +42,7 @@ extern lua_State *gL;
|
||||||
|
|
||||||
#define META_CVAR "CONSVAR_T*"
|
#define META_CVAR "CONSVAR_T*"
|
||||||
|
|
||||||
|
#define META_SECTORLINES "SECTOR_T*LINES"
|
||||||
#define META_SIDENUM "LINE_T*SIDENUM"
|
#define META_SIDENUM "LINE_T*SIDENUM"
|
||||||
|
|
||||||
#define META_HUDINFO "HUDINFO_T*"
|
#define META_HUDINFO "HUDINFO_T*"
|
||||||
|
|
223
src/lua_maplib.c
223
src/lua_maplib.c
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -37,6 +37,7 @@ enum sector_e {
|
||||||
sector_thinglist,
|
sector_thinglist,
|
||||||
sector_heightsec,
|
sector_heightsec,
|
||||||
sector_camsec,
|
sector_camsec,
|
||||||
|
sector_lines,
|
||||||
sector_ffloors
|
sector_ffloors
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ static const char *const sector_opt[] = {
|
||||||
"thinglist",
|
"thinglist",
|
||||||
"heightsec",
|
"heightsec",
|
||||||
"camsec",
|
"camsec",
|
||||||
|
"lines",
|
||||||
"ffloors",
|
"ffloors",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
|
@ -60,7 +62,6 @@ enum subsector_e {
|
||||||
subsector_sector,
|
subsector_sector,
|
||||||
subsector_numlines,
|
subsector_numlines,
|
||||||
subsector_firstline,
|
subsector_firstline,
|
||||||
subsector_validcount
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const subsector_opt[] = {
|
static const char *const subsector_opt[] = {
|
||||||
|
@ -68,7 +69,6 @@ static const char *const subsector_opt[] = {
|
||||||
"sector",
|
"sector",
|
||||||
"numlines",
|
"numlines",
|
||||||
"firstline",
|
"firstline",
|
||||||
"validcount",
|
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
enum line_e {
|
enum line_e {
|
||||||
|
@ -86,7 +86,6 @@ enum line_e {
|
||||||
line_slopetype,
|
line_slopetype,
|
||||||
line_frontsector,
|
line_frontsector,
|
||||||
line_backsector,
|
line_backsector,
|
||||||
line_validcount,
|
|
||||||
line_firsttag,
|
line_firsttag,
|
||||||
line_nexttag,
|
line_nexttag,
|
||||||
line_text,
|
line_text,
|
||||||
|
@ -108,7 +107,6 @@ static const char *const line_opt[] = {
|
||||||
"slopetype",
|
"slopetype",
|
||||||
"frontsector",
|
"frontsector",
|
||||||
"backsector",
|
"backsector",
|
||||||
"validcount",
|
|
||||||
"firsttag",
|
"firsttag",
|
||||||
"nexttag",
|
"nexttag",
|
||||||
"text",
|
"text",
|
||||||
|
@ -264,6 +262,67 @@ static int sector_iterate(lua_State *L)
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sector.lines, i -> sector.lines[i]
|
||||||
|
// sector.lines.valid, for validity checking
|
||||||
|
static int sectorlines_get(lua_State *L)
|
||||||
|
{
|
||||||
|
line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES));
|
||||||
|
size_t i;
|
||||||
|
size_t numoflines = 0;
|
||||||
|
lua_settop(L, 2);
|
||||||
|
if (!lua_isnumber(L, 2))
|
||||||
|
{
|
||||||
|
int field = luaL_checkoption(L, 2, NULL, valid_opt);
|
||||||
|
if (!seclines)
|
||||||
|
{
|
||||||
|
if (field == 0) {
|
||||||
|
lua_pushboolean(L, 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return luaL_error(L, "accessed sector_t doesn't exist anymore.");
|
||||||
|
} else if (field == 0) {
|
||||||
|
lua_pushboolean(L, 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check first linedef to figure which of its sectors owns this sector->lines pointer
|
||||||
|
// then check that sector's linecount to get a maximum index
|
||||||
|
//if (!seclines[0])
|
||||||
|
//return luaL_error(L, "no lines found!"); // no first linedef?????
|
||||||
|
if (seclines[0]->frontsector->lines == seclines)
|
||||||
|
numoflines = seclines[0]->frontsector->linecount;
|
||||||
|
else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first
|
||||||
|
numoflines = seclines[0]->backsector->linecount;
|
||||||
|
//if neither sector has it then ???
|
||||||
|
|
||||||
|
if (!numoflines)
|
||||||
|
return luaL_error(L, "no lines found!");
|
||||||
|
|
||||||
|
i = (size_t)lua_tointeger(L, 2);
|
||||||
|
if (i >= numoflines)
|
||||||
|
return 0;
|
||||||
|
LUA_PushUserdata(L, seclines[i], META_LINE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sectorlines_num(lua_State *L)
|
||||||
|
{
|
||||||
|
line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES));
|
||||||
|
size_t numoflines = 0;
|
||||||
|
// check first linedef to figure which of its sectors owns this sector->lines pointer
|
||||||
|
// then check that sector's linecount to get a maximum index
|
||||||
|
//if (!seclines[0])
|
||||||
|
//return luaL_error(L, "no lines found!"); // no first linedef?????
|
||||||
|
if (seclines[0]->frontsector->lines == seclines)
|
||||||
|
numoflines = seclines[0]->frontsector->linecount;
|
||||||
|
else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first
|
||||||
|
numoflines = seclines[0]->backsector->linecount;
|
||||||
|
//if neither sector has it then ???
|
||||||
|
lua_pushinteger(L, numoflines);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int sector_get(lua_State *L)
|
static int sector_get(lua_State *L)
|
||||||
{
|
{
|
||||||
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR));
|
||||||
|
@ -284,10 +343,10 @@ static int sector_get(lua_State *L)
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case sector_floorheight:
|
case sector_floorheight:
|
||||||
lua_pushinteger(L, sector->floorheight);
|
lua_pushfixed(L, sector->floorheight);
|
||||||
return 1;
|
return 1;
|
||||||
case sector_ceilingheight:
|
case sector_ceilingheight:
|
||||||
lua_pushinteger(L, sector->ceilingheight);
|
lua_pushfixed(L, sector->ceilingheight);
|
||||||
return 1;
|
return 1;
|
||||||
case sector_floorpic: { // floorpic
|
case sector_floorpic: { // floorpic
|
||||||
levelflat_t *levelflat;
|
levelflat_t *levelflat;
|
||||||
|
@ -329,6 +388,9 @@ static int sector_get(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
LUA_PushUserdata(L, §ors[sector->camsec], META_SECTOR);
|
LUA_PushUserdata(L, §ors[sector->camsec], META_SECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
|
case sector_lines: // lines
|
||||||
|
LUA_PushUserdata(L, sector->lines, META_SECTORLINES);
|
||||||
|
return 1;
|
||||||
case sector_ffloors: // ffloors
|
case sector_ffloors: // ffloors
|
||||||
lua_pushcfunction(L, lib_iterateSectorFFloors);
|
lua_pushcfunction(L, lib_iterateSectorFFloors);
|
||||||
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
|
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
|
||||||
|
@ -400,26 +462,30 @@ static int sector_set(lua_State *L)
|
||||||
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
||||||
case sector_floorheight: { // floorheight
|
case sector_floorheight: { // floorheight
|
||||||
boolean flag;
|
boolean flag;
|
||||||
|
mobj_t *ptmthing = tmthing;
|
||||||
fixed_t lastpos = sector->floorheight;
|
fixed_t lastpos = sector->floorheight;
|
||||||
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3);
|
sector->floorheight = luaL_checkfixed(L, 3);
|
||||||
flag = P_CheckSector(sector, true);
|
flag = P_CheckSector(sector, true);
|
||||||
if (flag && sector->numattached)
|
if (flag && sector->numattached)
|
||||||
{
|
{
|
||||||
sector->floorheight = lastpos;
|
sector->floorheight = lastpos;
|
||||||
P_CheckSector(sector, true);
|
P_CheckSector(sector, true);
|
||||||
}
|
}
|
||||||
|
P_SetTarget(&tmthing, ptmthing);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case sector_ceilingheight: { // ceilingheight
|
case sector_ceilingheight: { // ceilingheight
|
||||||
boolean flag;
|
boolean flag;
|
||||||
|
mobj_t *ptmthing = tmthing;
|
||||||
fixed_t lastpos = sector->ceilingheight;
|
fixed_t lastpos = sector->ceilingheight;
|
||||||
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3);
|
sector->ceilingheight = luaL_checkfixed(L, 3);
|
||||||
flag = P_CheckSector(sector, true);
|
flag = P_CheckSector(sector, true);
|
||||||
if (flag && sector->numattached)
|
if (flag && sector->numattached)
|
||||||
{
|
{
|
||||||
sector->ceilingheight = lastpos;
|
sector->ceilingheight = lastpos;
|
||||||
P_CheckSector(sector, true);
|
P_CheckSector(sector, true);
|
||||||
}
|
}
|
||||||
|
P_SetTarget(&tmthing, ptmthing);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case sector_floorpic:
|
case sector_floorpic:
|
||||||
|
@ -476,9 +542,6 @@ static int subsector_get(lua_State *L)
|
||||||
case subsector_firstline:
|
case subsector_firstline:
|
||||||
lua_pushinteger(L, subsector->firstline);
|
lua_pushinteger(L, subsector->firstline);
|
||||||
return 1;
|
return 1;
|
||||||
case subsector_validcount:
|
|
||||||
lua_pushinteger(L, subsector->validcount);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -516,10 +579,10 @@ static int line_get(lua_State *L)
|
||||||
LUA_PushUserdata(L, line->v2, META_VERTEX);
|
LUA_PushUserdata(L, line->v2, META_VERTEX);
|
||||||
return 1;
|
return 1;
|
||||||
case line_dx:
|
case line_dx:
|
||||||
lua_pushinteger(L, line->dx);
|
lua_pushfixed(L, line->dx);
|
||||||
return 1;
|
return 1;
|
||||||
case line_dy:
|
case line_dy:
|
||||||
lua_pushinteger(L, line->dy);
|
lua_pushfixed(L, line->dy);
|
||||||
return 1;
|
return 1;
|
||||||
case line_flags:
|
case line_flags:
|
||||||
lua_pushinteger(L, line->flags);
|
lua_pushinteger(L, line->flags);
|
||||||
|
@ -564,9 +627,6 @@ static int line_get(lua_State *L)
|
||||||
case line_backsector:
|
case line_backsector:
|
||||||
LUA_PushUserdata(L, line->backsector, META_SECTOR);
|
LUA_PushUserdata(L, line->backsector, META_SECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
case line_validcount:
|
|
||||||
lua_pushinteger(L, line->validcount);
|
|
||||||
return 1;
|
|
||||||
case line_firsttag:
|
case line_firsttag:
|
||||||
lua_pushinteger(L, line->firsttag);
|
lua_pushinteger(L, line->firsttag);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -638,10 +698,10 @@ static int side_get(lua_State *L)
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case side_textureoffset:
|
case side_textureoffset:
|
||||||
lua_pushinteger(L, side->textureoffset);
|
lua_pushfixed(L, side->textureoffset);
|
||||||
return 1;
|
return 1;
|
||||||
case side_rowoffset:
|
case side_rowoffset:
|
||||||
lua_pushinteger(L, side->rowoffset);
|
lua_pushfixed(L, side->rowoffset);
|
||||||
return 1;
|
return 1;
|
||||||
case side_toptexture:
|
case side_toptexture:
|
||||||
lua_pushinteger(L, side->toptexture);
|
lua_pushinteger(L, side->toptexture);
|
||||||
|
@ -668,6 +728,50 @@ static int side_get(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int side_set(lua_State *L)
|
||||||
|
{
|
||||||
|
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
|
||||||
|
enum side_e field = luaL_checkoption(L, 2, side_opt[0], side_opt);
|
||||||
|
|
||||||
|
if (!side)
|
||||||
|
{
|
||||||
|
if (field == side_valid) {
|
||||||
|
lua_pushboolean(L, 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return luaL_error(L, "accessed side_t doesn't exist anymore.");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(field)
|
||||||
|
{
|
||||||
|
case side_valid: // valid
|
||||||
|
case side_sector:
|
||||||
|
case side_special:
|
||||||
|
case side_text:
|
||||||
|
default:
|
||||||
|
return luaL_error(L, "side_t field " LUA_QS " cannot be set.", side_opt[field]);
|
||||||
|
case side_textureoffset:
|
||||||
|
side->textureoffset = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
|
case side_rowoffset:
|
||||||
|
side->rowoffset = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
|
case side_toptexture:
|
||||||
|
side->toptexture = luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
|
case side_bottomtexture:
|
||||||
|
side->bottomtexture = luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
|
case side_midtexture:
|
||||||
|
side->midtexture = luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
|
case side_repeatcnt:
|
||||||
|
side->repeatcnt = luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int side_num(lua_State *L)
|
static int side_num(lua_State *L)
|
||||||
{
|
{
|
||||||
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
|
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
|
||||||
|
@ -695,13 +799,13 @@ static int vertex_get(lua_State *L)
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case vertex_x:
|
case vertex_x:
|
||||||
lua_pushinteger(L, vertex->x);
|
lua_pushfixed(L, vertex->x);
|
||||||
return 1;
|
return 1;
|
||||||
case vertex_y:
|
case vertex_y:
|
||||||
lua_pushinteger(L, vertex->y);
|
lua_pushfixed(L, vertex->y);
|
||||||
return 1;
|
return 1;
|
||||||
case vertex_z:
|
case vertex_z:
|
||||||
lua_pushinteger(L, vertex->z);
|
lua_pushfixed(L, vertex->z);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -964,7 +1068,7 @@ static int ffloor_get(lua_State *L)
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
case ffloor_topheight:
|
case ffloor_topheight:
|
||||||
lua_pushinteger(L, *ffloor->topheight);
|
lua_pushfixed(L, *ffloor->topheight);
|
||||||
return 1;
|
return 1;
|
||||||
case ffloor_toppic: { // toppic
|
case ffloor_toppic: { // toppic
|
||||||
levelflat_t *levelflat;
|
levelflat_t *levelflat;
|
||||||
|
@ -978,7 +1082,7 @@ static int ffloor_get(lua_State *L)
|
||||||
lua_pushinteger(L, *ffloor->toplightlevel);
|
lua_pushinteger(L, *ffloor->toplightlevel);
|
||||||
return 1;
|
return 1;
|
||||||
case ffloor_bottomheight:
|
case ffloor_bottomheight:
|
||||||
lua_pushinteger(L, *ffloor->bottomheight);
|
lua_pushfixed(L, *ffloor->bottomheight);
|
||||||
return 1;
|
return 1;
|
||||||
case ffloor_bottompic: { // bottompic
|
case ffloor_bottompic: { // bottompic
|
||||||
levelflat_t *levelflat;
|
levelflat_t *levelflat;
|
||||||
|
@ -1037,14 +1141,16 @@ static int ffloor_set(lua_State *L)
|
||||||
case ffloor_topheight: { // topheight
|
case ffloor_topheight: { // topheight
|
||||||
boolean flag;
|
boolean flag;
|
||||||
fixed_t lastpos = *ffloor->topheight;
|
fixed_t lastpos = *ffloor->topheight;
|
||||||
|
mobj_t *ptmthing = tmthing;
|
||||||
sector_t *sector = §ors[ffloor->secnum];
|
sector_t *sector = §ors[ffloor->secnum];
|
||||||
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3);
|
sector->ceilingheight = luaL_checkfixed(L, 3);
|
||||||
flag = P_CheckSector(sector, true);
|
flag = P_CheckSector(sector, true);
|
||||||
if (flag && sector->numattached)
|
if (flag && sector->numattached)
|
||||||
{
|
{
|
||||||
*ffloor->topheight = lastpos;
|
*ffloor->topheight = lastpos;
|
||||||
P_CheckSector(sector, true);
|
P_CheckSector(sector, true);
|
||||||
}
|
}
|
||||||
|
P_SetTarget(&tmthing, ptmthing);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ffloor_toppic:
|
case ffloor_toppic:
|
||||||
|
@ -1056,22 +1162,28 @@ static int ffloor_set(lua_State *L)
|
||||||
case ffloor_bottomheight: { // bottomheight
|
case ffloor_bottomheight: { // bottomheight
|
||||||
boolean flag;
|
boolean flag;
|
||||||
fixed_t lastpos = *ffloor->bottomheight;
|
fixed_t lastpos = *ffloor->bottomheight;
|
||||||
|
mobj_t *ptmthing = tmthing;
|
||||||
sector_t *sector = §ors[ffloor->secnum];
|
sector_t *sector = §ors[ffloor->secnum];
|
||||||
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3);
|
sector->floorheight = luaL_checkfixed(L, 3);
|
||||||
flag = P_CheckSector(sector, true);
|
flag = P_CheckSector(sector, true);
|
||||||
if (flag && sector->numattached)
|
if (flag && sector->numattached)
|
||||||
{
|
{
|
||||||
*ffloor->bottomheight = lastpos;
|
*ffloor->bottomheight = lastpos;
|
||||||
P_CheckSector(sector, true);
|
P_CheckSector(sector, true);
|
||||||
}
|
}
|
||||||
|
P_SetTarget(&tmthing, ptmthing);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ffloor_bottompic:
|
case ffloor_bottompic:
|
||||||
*ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
|
*ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3));
|
||||||
break;
|
break;
|
||||||
case ffloor_flags:
|
case ffloor_flags: {
|
||||||
|
ffloortype_e oldflags = ffloor->flags; // store FOF's old flags
|
||||||
ffloor->flags = luaL_checkinteger(L, 3);
|
ffloor->flags = luaL_checkinteger(L, 3);
|
||||||
|
if (ffloor->flags != oldflags)
|
||||||
|
ffloor->target->moved = true; // reset target sector's lightlist
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ffloor_alpha:
|
case ffloor_alpha:
|
||||||
ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
|
ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
|
@ -1115,26 +1227,23 @@ static int mapheaderinfo_get(lua_State *L)
|
||||||
{
|
{
|
||||||
mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER));
|
mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER));
|
||||||
const char *field = luaL_checkstring(L, 2);
|
const char *field = luaL_checkstring(L, 2);
|
||||||
//INT16 i;
|
INT16 i;
|
||||||
if (fastcmp(field,"lvlttl")) {
|
if (fastcmp(field,"lvlttl"))
|
||||||
//for (i = 0; i < 21; i++)
|
lua_pushstring(L, header->lvlttl);
|
||||||
// if (!header->lvlttl[i])
|
else if (fastcmp(field,"subttl"))
|
||||||
// break;
|
lua_pushstring(L, header->subttl);
|
||||||
lua_pushlstring(L, header->lvlttl, 21);
|
|
||||||
} else if (fastcmp(field,"subttl"))
|
|
||||||
lua_pushlstring(L, header->subttl, 32);
|
|
||||||
else if (fastcmp(field,"actnum"))
|
else if (fastcmp(field,"actnum"))
|
||||||
lua_pushinteger(L, header->actnum);
|
lua_pushinteger(L, header->actnum);
|
||||||
else if (fastcmp(field,"typeoflevel"))
|
else if (fastcmp(field,"typeoflevel"))
|
||||||
lua_pushinteger(L, header->typeoflevel);
|
lua_pushinteger(L, header->typeoflevel);
|
||||||
else if (fastcmp(field,"nextlevel"))
|
else if (fastcmp(field,"nextlevel"))
|
||||||
lua_pushinteger(L, header->nextlevel);
|
lua_pushinteger(L, header->nextlevel);
|
||||||
else if (fastcmp(field,"musicslot"))
|
else if (fastcmp(field,"musname"))
|
||||||
lua_pushinteger(L, header->musicslot);
|
lua_pushstring(L, header->musname);
|
||||||
else if (fastcmp(field,"musicslottrack"))
|
else if (fastcmp(field,"mustrack"))
|
||||||
lua_pushinteger(L, header->musicslottrack);
|
lua_pushinteger(L, header->mustrack);
|
||||||
else if (fastcmp(field,"forcecharacter"))
|
else if (fastcmp(field,"forcecharacter"))
|
||||||
lua_pushlstring(L, header->forcecharacter, 16);
|
lua_pushstring(L, header->forcecharacter);
|
||||||
else if (fastcmp(field,"weather"))
|
else if (fastcmp(field,"weather"))
|
||||||
lua_pushinteger(L, header->weather);
|
lua_pushinteger(L, header->weather);
|
||||||
else if (fastcmp(field,"skynum"))
|
else if (fastcmp(field,"skynum"))
|
||||||
|
@ -1145,12 +1254,15 @@ static int mapheaderinfo_get(lua_State *L)
|
||||||
lua_pushinteger(L, header->skybox_scaley);
|
lua_pushinteger(L, header->skybox_scaley);
|
||||||
else if (fastcmp(field,"skybox_scalez"))
|
else if (fastcmp(field,"skybox_scalez"))
|
||||||
lua_pushinteger(L, header->skybox_scalez);
|
lua_pushinteger(L, header->skybox_scalez);
|
||||||
else if (fastcmp(field,"interscreen"))
|
else if (fastcmp(field,"interscreen")) {
|
||||||
lua_pushlstring(L, header->interscreen, 8);
|
for (i = 0; i < 8; i++)
|
||||||
else if (fastcmp(field,"runsoc"))
|
if (!header->interscreen[i])
|
||||||
lua_pushlstring(L, header->runsoc, 32);
|
break;
|
||||||
|
lua_pushlstring(L, header->interscreen, i);
|
||||||
|
} else if (fastcmp(field,"runsoc"))
|
||||||
|
lua_pushstring(L, header->runsoc);
|
||||||
else if (fastcmp(field,"scriptname"))
|
else if (fastcmp(field,"scriptname"))
|
||||||
lua_pushlstring(L, header->scriptname, 32);
|
lua_pushstring(L, header->scriptname);
|
||||||
else if (fastcmp(field,"precutscenenum"))
|
else if (fastcmp(field,"precutscenenum"))
|
||||||
lua_pushinteger(L, header->precutscenenum);
|
lua_pushinteger(L, header->precutscenenum);
|
||||||
else if (fastcmp(field,"cutscenenum"))
|
else if (fastcmp(field,"cutscenenum"))
|
||||||
|
@ -1175,11 +1287,11 @@ static int mapheaderinfo_get(lua_State *L)
|
||||||
else {
|
else {
|
||||||
// Read custom vars now
|
// Read custom vars now
|
||||||
// (note: don't include the "LUA." in your lua scripts!)
|
// (note: don't include the "LUA." in your lua scripts!)
|
||||||
UINT8 i = 0;
|
UINT8 j = 0;
|
||||||
for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i);
|
for (;j < header->numCustomOptions && !fastcmp(field, header->customopts[j].option); ++j);
|
||||||
|
|
||||||
if(i < header->numCustomOptions)
|
if(j < header->numCustomOptions)
|
||||||
lua_pushlstring(L, header->customopts[i].value, 255);
|
lua_pushstring(L, header->customopts[j].value);
|
||||||
else
|
else
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
|
@ -1188,6 +1300,14 @@ static int mapheaderinfo_get(lua_State *L)
|
||||||
|
|
||||||
int LUA_MapLib(lua_State *L)
|
int LUA_MapLib(lua_State *L)
|
||||||
{
|
{
|
||||||
|
luaL_newmetatable(L, META_SECTORLINES);
|
||||||
|
lua_pushcfunction(L, sectorlines_get);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
|
||||||
|
lua_pushcfunction(L, sectorlines_num);
|
||||||
|
lua_setfield(L, -2, "__len");
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
luaL_newmetatable(L, META_SECTOR);
|
luaL_newmetatable(L, META_SECTOR);
|
||||||
lua_pushcfunction(L, sector_get);
|
lua_pushcfunction(L, sector_get);
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
|
@ -1224,6 +1344,9 @@ int LUA_MapLib(lua_State *L)
|
||||||
lua_pushcfunction(L, side_get);
|
lua_pushcfunction(L, side_get);
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
|
|
||||||
|
lua_pushcfunction(L, side_set);
|
||||||
|
lua_setfield(L, -2, "__newindex");
|
||||||
|
|
||||||
lua_pushcfunction(L, side_num);
|
lua_pushcfunction(L, side_num);
|
||||||
lua_setfield(L, -2, "__len");
|
lua_setfield(L, -2, "__len");
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -32,13 +32,17 @@ static int lib_abs(lua_State *L)
|
||||||
|
|
||||||
static int lib_min(lua_State *L)
|
static int lib_min(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, min(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)));
|
int a = luaL_checkinteger(L, 1);
|
||||||
|
int b = luaL_checkinteger(L, 2);
|
||||||
|
lua_pushinteger(L, min(a,b));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_max(lua_State *L)
|
static int lib_max(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, max(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)));
|
int a = luaL_checkinteger(L, 1);
|
||||||
|
int b = luaL_checkinteger(L, 2);
|
||||||
|
lua_pushinteger(L, max(a,b));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,37 +51,50 @@ static int lib_max(lua_State *L)
|
||||||
|
|
||||||
static int lib_fixedangle(lua_State *L)
|
static int lib_fixedangle(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedAngle((fixed_t)luaL_checkinteger(L, 1)));
|
lua_pushangle(L, FixedAngle(luaL_checkfixed(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_anglefixed(lua_State *L)
|
static int lib_anglefixed(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, AngleFixed((angle_t)luaL_checkinteger(L, 1)));
|
lua_pushfixed(L, AngleFixed(luaL_checkangle(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_invangle(lua_State *L)
|
static int lib_invangle(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, InvAngle((angle_t)luaL_checkinteger(L, 1)));
|
lua_pushangle(L, InvAngle(luaL_checkangle(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_finesine(lua_State *L)
|
static int lib_finesine(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FINESINE((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
|
lua_pushfixed(L, FINESINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_finecosine(lua_State *L)
|
static int lib_finecosine(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FINECOSINE((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
|
lua_pushfixed(L, FINECOSINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_finetangent(lua_State *L)
|
static int lib_finetangent(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FINETANGENT((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
|
// 2.1.15 ONLY HACK: optional boolean argument, only add ANGLE_90 if true
|
||||||
|
boolean newtan = lua_optboolean(L, 2);
|
||||||
|
|
||||||
|
if (newtan)
|
||||||
|
{
|
||||||
|
// HACK: add ANGLE_90 to make tan() in Lua start at 0 like it should
|
||||||
|
// use & 4095 instead of & FINEMASK (8191), so it doesn't go out of the array's bounds
|
||||||
|
lua_pushfixed(L, FINETANGENT(((luaL_checkangle(L, 1)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LUA_Deprecated(L, "tan(angle)", "tan(angle, true)");
|
||||||
|
lua_pushfixed(L, FINETANGENT((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & 4095));
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,61 +103,68 @@ static int lib_finetangent(lua_State *L)
|
||||||
|
|
||||||
static int lib_fixedmul(lua_State *L)
|
static int lib_fixedmul(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedMul((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2)));
|
lua_pushfixed(L, FixedMul(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixedint(lua_State *L)
|
static int lib_fixedint(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedInt((fixed_t)luaL_checkinteger(L, 1)));
|
lua_pushinteger(L, FixedInt(luaL_checkfixed(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixeddiv(lua_State *L)
|
static int lib_fixeddiv(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedDiv((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2)));
|
fixed_t i = luaL_checkfixed(L, 1);
|
||||||
|
fixed_t j = luaL_checkfixed(L, 2);
|
||||||
|
if (j == 0)
|
||||||
|
return luaL_error(L, "divide by zero");
|
||||||
|
lua_pushfixed(L, FixedDiv(i, j));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixedrem(lua_State *L)
|
static int lib_fixedrem(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedRem((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2)));
|
lua_pushfixed(L, FixedRem(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixedsqrt(lua_State *L)
|
static int lib_fixedsqrt(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedSqrt((fixed_t)luaL_checkinteger(L, 1)));
|
fixed_t i = luaL_checkfixed(L, 1);
|
||||||
|
if (i < 0)
|
||||||
|
return luaL_error(L, "square root domain error");
|
||||||
|
lua_pushfixed(L, FixedSqrt(i));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixedhypot(lua_State *L)
|
static int lib_fixedhypot(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedHypot((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2)));
|
lua_pushfixed(L, FixedHypot(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixedfloor(lua_State *L)
|
static int lib_fixedfloor(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedFloor((fixed_t)luaL_checkinteger(L, 1)));
|
lua_pushfixed(L, FixedFloor(luaL_checkfixed(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixedtrunc(lua_State *L)
|
static int lib_fixedtrunc(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedTrunc((fixed_t)luaL_checkinteger(L, 1)));
|
lua_pushfixed(L, FixedTrunc(luaL_checkfixed(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixedceil(lua_State *L)
|
static int lib_fixedceil(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedCeil((fixed_t)luaL_checkinteger(L, 1)));
|
lua_pushfixed(L, FixedCeil(luaL_checkfixed(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_fixedround(lua_State *L)
|
static int lib_fixedround(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, FixedRound((fixed_t)luaL_checkinteger(L, 1)));
|
lua_pushfixed(L, FixedRound(luaL_checkfixed(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +180,7 @@ static int lib_getsecspecial(lua_State *L)
|
||||||
|
|
||||||
static int lib_all7emeralds(lua_State *L)
|
static int lib_all7emeralds(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushinteger(L, ALL7EMERALDS(luaL_checkinteger(L, 1)));
|
lua_pushboolean(L, ALL7EMERALDS(luaL_checkinteger(L, 1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +188,9 @@ static int lib_all7emeralds(lua_State *L)
|
||||||
// Returns both color and frame numbers!
|
// Returns both color and frame numbers!
|
||||||
static int lib_coloropposite(lua_State *L)
|
static int lib_coloropposite(lua_State *L)
|
||||||
{
|
{
|
||||||
int colornum = ((int)luaL_checkinteger(L, 1)) & MAXSKINCOLORS;
|
UINT8 colornum = (UINT8)luaL_checkinteger(L, 1);
|
||||||
|
if (colornum >= MAXSKINCOLORS)
|
||||||
|
return luaL_error(L, "skincolor %d out of range (0 - %d).", colornum, MAXSKINCOLORS-1);
|
||||||
lua_pushinteger(L, Color_Opposite[colornum*2]); // push color
|
lua_pushinteger(L, Color_Opposite[colornum*2]); // push color
|
||||||
lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame
|
lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame
|
||||||
return 2;
|
return 2;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -34,6 +34,7 @@ enum mobj_e {
|
||||||
mobj_angle,
|
mobj_angle,
|
||||||
mobj_sprite,
|
mobj_sprite,
|
||||||
mobj_frame,
|
mobj_frame,
|
||||||
|
mobj_anim_duration,
|
||||||
mobj_touching_sectorlist,
|
mobj_touching_sectorlist,
|
||||||
mobj_subsector,
|
mobj_subsector,
|
||||||
mobj_floorz,
|
mobj_floorz,
|
||||||
|
@ -92,6 +93,7 @@ static const char *const mobj_opt[] = {
|
||||||
"angle",
|
"angle",
|
||||||
"sprite",
|
"sprite",
|
||||||
"frame",
|
"frame",
|
||||||
|
"anim_duration",
|
||||||
"touching_sectorlist",
|
"touching_sectorlist",
|
||||||
"subsector",
|
"subsector",
|
||||||
"floorz",
|
"floorz",
|
||||||
|
@ -162,13 +164,13 @@ static int mobj_get(lua_State *L)
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
break;
|
break;
|
||||||
case mobj_x:
|
case mobj_x:
|
||||||
lua_pushinteger(L, mo->x);
|
lua_pushfixed(L, mo->x);
|
||||||
break;
|
break;
|
||||||
case mobj_y:
|
case mobj_y:
|
||||||
lua_pushinteger(L, mo->y);
|
lua_pushfixed(L, mo->y);
|
||||||
break;
|
break;
|
||||||
case mobj_z:
|
case mobj_z:
|
||||||
lua_pushinteger(L, mo->z);
|
lua_pushfixed(L, mo->z);
|
||||||
break;
|
break;
|
||||||
case mobj_snext:
|
case mobj_snext:
|
||||||
LUA_PushUserdata(L, mo->snext, META_MOBJ);
|
LUA_PushUserdata(L, mo->snext, META_MOBJ);
|
||||||
|
@ -179,7 +181,7 @@ static int mobj_get(lua_State *L)
|
||||||
// i.e. it will always ultimately point to THIS mobj -- so that's actually not useful to Lua and won't be included.
|
// i.e. it will always ultimately point to THIS mobj -- so that's actually not useful to Lua and won't be included.
|
||||||
return UNIMPLEMENTED;
|
return UNIMPLEMENTED;
|
||||||
case mobj_angle:
|
case mobj_angle:
|
||||||
lua_pushinteger(L, mo->angle);
|
lua_pushangle(L, mo->angle);
|
||||||
break;
|
break;
|
||||||
case mobj_sprite:
|
case mobj_sprite:
|
||||||
lua_pushinteger(L, mo->sprite);
|
lua_pushinteger(L, mo->sprite);
|
||||||
|
@ -187,34 +189,37 @@ static int mobj_get(lua_State *L)
|
||||||
case mobj_frame:
|
case mobj_frame:
|
||||||
lua_pushinteger(L, mo->frame);
|
lua_pushinteger(L, mo->frame);
|
||||||
break;
|
break;
|
||||||
|
case mobj_anim_duration:
|
||||||
|
lua_pushinteger(L, mo->anim_duration);
|
||||||
|
break;
|
||||||
case mobj_touching_sectorlist:
|
case mobj_touching_sectorlist:
|
||||||
return UNIMPLEMENTED;
|
return UNIMPLEMENTED;
|
||||||
case mobj_subsector:
|
case mobj_subsector:
|
||||||
LUA_PushUserdata(L, mo->subsector, META_SUBSECTOR);
|
LUA_PushUserdata(L, mo->subsector, META_SUBSECTOR);
|
||||||
break;
|
break;
|
||||||
case mobj_floorz:
|
case mobj_floorz:
|
||||||
lua_pushinteger(L, mo->floorz);
|
lua_pushfixed(L, mo->floorz);
|
||||||
break;
|
break;
|
||||||
case mobj_ceilingz:
|
case mobj_ceilingz:
|
||||||
lua_pushinteger(L, mo->ceilingz);
|
lua_pushfixed(L, mo->ceilingz);
|
||||||
break;
|
break;
|
||||||
case mobj_radius:
|
case mobj_radius:
|
||||||
lua_pushinteger(L, mo->radius);
|
lua_pushfixed(L, mo->radius);
|
||||||
break;
|
break;
|
||||||
case mobj_height:
|
case mobj_height:
|
||||||
lua_pushinteger(L, mo->height);
|
lua_pushfixed(L, mo->height);
|
||||||
break;
|
break;
|
||||||
case mobj_momx:
|
case mobj_momx:
|
||||||
lua_pushinteger(L, mo->momx);
|
lua_pushfixed(L, mo->momx);
|
||||||
break;
|
break;
|
||||||
case mobj_momy:
|
case mobj_momy:
|
||||||
lua_pushinteger(L, mo->momy);
|
lua_pushfixed(L, mo->momy);
|
||||||
break;
|
break;
|
||||||
case mobj_momz:
|
case mobj_momz:
|
||||||
lua_pushinteger(L, mo->momz);
|
lua_pushfixed(L, mo->momz);
|
||||||
break;
|
break;
|
||||||
case mobj_pmomz:
|
case mobj_pmomz:
|
||||||
lua_pushinteger(L, mo->pmomz);
|
lua_pushfixed(L, mo->pmomz);
|
||||||
break;
|
break;
|
||||||
case mobj_tics:
|
case mobj_tics:
|
||||||
lua_pushinteger(L, mo->tics);
|
lua_pushinteger(L, mo->tics);
|
||||||
|
@ -299,32 +304,32 @@ static int mobj_get(lua_State *L)
|
||||||
LUA_PushUserdata(L, mo->tracer, META_MOBJ);
|
LUA_PushUserdata(L, mo->tracer, META_MOBJ);
|
||||||
break;
|
break;
|
||||||
case mobj_friction:
|
case mobj_friction:
|
||||||
lua_pushinteger(L, mo->friction);
|
lua_pushfixed(L, mo->friction);
|
||||||
break;
|
break;
|
||||||
case mobj_movefactor:
|
case mobj_movefactor:
|
||||||
lua_pushinteger(L, mo->movefactor);
|
lua_pushfixed(L, mo->movefactor);
|
||||||
break;
|
break;
|
||||||
case mobj_fuse:
|
case mobj_fuse:
|
||||||
lua_pushinteger(L, mo->fuse);
|
lua_pushinteger(L, mo->fuse);
|
||||||
break;
|
break;
|
||||||
case mobj_watertop:
|
case mobj_watertop:
|
||||||
lua_pushinteger(L, mo->watertop);
|
lua_pushfixed(L, mo->watertop);
|
||||||
break;
|
break;
|
||||||
case mobj_waterbottom:
|
case mobj_waterbottom:
|
||||||
lua_pushinteger(L, mo->waterbottom);
|
lua_pushfixed(L, mo->waterbottom);
|
||||||
break;
|
break;
|
||||||
case mobj_mobjnum:
|
case mobj_mobjnum:
|
||||||
// mobjnum is a networking thing generated for $$$.sav
|
// mobjnum is a networking thing generated for $$$.sav
|
||||||
// and therefore shouldn't be used by Lua.
|
// and therefore shouldn't be used by Lua.
|
||||||
return UNIMPLEMENTED;
|
return UNIMPLEMENTED;
|
||||||
case mobj_scale:
|
case mobj_scale:
|
||||||
lua_pushinteger(L, mo->scale);
|
lua_pushfixed(L, mo->scale);
|
||||||
break;
|
break;
|
||||||
case mobj_destscale:
|
case mobj_destscale:
|
||||||
lua_pushinteger(L, mo->destscale);
|
lua_pushfixed(L, mo->destscale);
|
||||||
break;
|
break;
|
||||||
case mobj_scalespeed:
|
case mobj_scalespeed:
|
||||||
lua_pushinteger(L, mo->scalespeed);
|
lua_pushfixed(L, mo->scalespeed);
|
||||||
break;
|
break;
|
||||||
case mobj_extravalue1:
|
case mobj_extravalue1:
|
||||||
lua_pushinteger(L, mo->extravalue1);
|
lua_pushinteger(L, mo->extravalue1);
|
||||||
|
@ -382,7 +387,7 @@ static int mobj_set(lua_State *L)
|
||||||
{
|
{
|
||||||
// z doesn't cross sector bounds so it's okay.
|
// z doesn't cross sector bounds so it's okay.
|
||||||
mobj_t *ptmthing = tmthing;
|
mobj_t *ptmthing = tmthing;
|
||||||
mo->z = (fixed_t)luaL_checkinteger(L, 3);
|
mo->z = luaL_checkfixed(L, 3);
|
||||||
P_CheckPosition(mo, mo->x, mo->y);
|
P_CheckPosition(mo, mo->x, mo->y);
|
||||||
mo->floorz = tmfloorz;
|
mo->floorz = tmfloorz;
|
||||||
mo->ceilingz = tmceilingz;
|
mo->ceilingz = tmceilingz;
|
||||||
|
@ -394,7 +399,7 @@ static int mobj_set(lua_State *L)
|
||||||
case mobj_sprev:
|
case mobj_sprev:
|
||||||
return UNIMPLEMENTED;
|
return UNIMPLEMENTED;
|
||||||
case mobj_angle:
|
case mobj_angle:
|
||||||
mo->angle = (angle_t)luaL_checkinteger(L, 3);
|
mo->angle = luaL_checkangle(L, 3);
|
||||||
if (mo->player == &players[consoleplayer])
|
if (mo->player == &players[consoleplayer])
|
||||||
localangle = mo->angle;
|
localangle = mo->angle;
|
||||||
else if (mo->player == &players[secondarydisplayplayer])
|
else if (mo->player == &players[secondarydisplayplayer])
|
||||||
|
@ -406,6 +411,9 @@ static int mobj_set(lua_State *L)
|
||||||
case mobj_frame:
|
case mobj_frame:
|
||||||
mo->frame = (UINT32)luaL_checkinteger(L, 3);
|
mo->frame = (UINT32)luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
|
case mobj_anim_duration:
|
||||||
|
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
case mobj_touching_sectorlist:
|
case mobj_touching_sectorlist:
|
||||||
return UNIMPLEMENTED;
|
return UNIMPLEMENTED;
|
||||||
case mobj_subsector:
|
case mobj_subsector:
|
||||||
|
@ -417,7 +425,7 @@ static int mobj_set(lua_State *L)
|
||||||
case mobj_radius:
|
case mobj_radius:
|
||||||
{
|
{
|
||||||
mobj_t *ptmthing = tmthing;
|
mobj_t *ptmthing = tmthing;
|
||||||
mo->radius = (fixed_t)luaL_checkinteger(L, 3);
|
mo->radius = luaL_checkfixed(L, 3);
|
||||||
if (mo->radius < 0)
|
if (mo->radius < 0)
|
||||||
mo->radius = 0;
|
mo->radius = 0;
|
||||||
P_CheckPosition(mo, mo->x, mo->y);
|
P_CheckPosition(mo, mo->x, mo->y);
|
||||||
|
@ -429,7 +437,7 @@ static int mobj_set(lua_State *L)
|
||||||
case mobj_height:
|
case mobj_height:
|
||||||
{
|
{
|
||||||
mobj_t *ptmthing = tmthing;
|
mobj_t *ptmthing = tmthing;
|
||||||
mo->height = (fixed_t)luaL_checkinteger(L, 3);
|
mo->height = luaL_checkfixed(L, 3);
|
||||||
if (mo->height < 0)
|
if (mo->height < 0)
|
||||||
mo->height = 0;
|
mo->height = 0;
|
||||||
P_CheckPosition(mo, mo->x, mo->y);
|
P_CheckPosition(mo, mo->x, mo->y);
|
||||||
|
@ -439,16 +447,17 @@ static int mobj_set(lua_State *L)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mobj_momx:
|
case mobj_momx:
|
||||||
mo->momx = (fixed_t)luaL_checkinteger(L, 3);
|
mo->momx = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_momy:
|
case mobj_momy:
|
||||||
mo->momy = (fixed_t)luaL_checkinteger(L, 3);
|
mo->momy = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_momz:
|
case mobj_momz:
|
||||||
mo->momz = (fixed_t)luaL_checkinteger(L, 3);
|
mo->momz = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_pmomz:
|
case mobj_pmomz:
|
||||||
mo->pmomz = (fixed_t)luaL_checkinteger(L, 3);
|
mo->pmomz = luaL_checkfixed(L, 3);
|
||||||
|
mo->eflags |= MFE_APPLYPMOMZ;
|
||||||
break;
|
break;
|
||||||
case mobj_tics:
|
case mobj_tics:
|
||||||
mo->tics = luaL_checkinteger(L, 3);
|
mo->tics = luaL_checkinteger(L, 3);
|
||||||
|
@ -500,8 +509,13 @@ static int mobj_set(lua_State *L)
|
||||||
return luaL_error(L, "mobj.skin '%s' not found!", skin);
|
return luaL_error(L, "mobj.skin '%s' not found!", skin);
|
||||||
}
|
}
|
||||||
case mobj_color:
|
case mobj_color:
|
||||||
mo->color = ((UINT8)luaL_checkinteger(L, 3)) % MAXSKINCOLORS;
|
{
|
||||||
|
UINT8 newcolor = (UINT8)luaL_checkinteger(L,3);
|
||||||
|
if (newcolor >= MAXTRANSLATIONS)
|
||||||
|
return luaL_error(L, "mobj.color %d out of range (0 - %d).", newcolor, MAXTRANSLATIONS-1);
|
||||||
|
mo->color = newcolor;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case mobj_bnext:
|
case mobj_bnext:
|
||||||
return NOSETPOS;
|
return NOSETPOS;
|
||||||
case mobj_bprev:
|
case mobj_bprev:
|
||||||
|
@ -515,8 +529,8 @@ static int mobj_set(lua_State *L)
|
||||||
case mobj_type: // yeah sure, we'll let you change the mobj's type.
|
case mobj_type: // yeah sure, we'll let you change the mobj's type.
|
||||||
{
|
{
|
||||||
mobjtype_t newtype = luaL_checkinteger(L, 3);
|
mobjtype_t newtype = luaL_checkinteger(L, 3);
|
||||||
if (newtype > MT_LASTFREESLOT)
|
if (newtype >= NUMMOBJTYPES)
|
||||||
return luaL_error(L, "mobj.type %u is out of bounds.", newtype);
|
return luaL_error(L, "mobj.type %d out of range (0 - %d).", newtype, NUMMOBJTYPES-1);
|
||||||
mo->type = newtype;
|
mo->type = newtype;
|
||||||
mo->info = &mobjinfo[newtype];
|
mo->info = &mobjinfo[newtype];
|
||||||
P_SetScale(mo, mo->scale);
|
P_SetScale(mo, mo->scale);
|
||||||
|
@ -572,25 +586,25 @@ static int mobj_set(lua_State *L)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mobj_friction:
|
case mobj_friction:
|
||||||
mo->friction = (fixed_t)luaL_checkinteger(L, 3);
|
mo->friction = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_movefactor:
|
case mobj_movefactor:
|
||||||
mo->movefactor = (fixed_t)luaL_checkinteger(L, 3);
|
mo->movefactor = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_fuse:
|
case mobj_fuse:
|
||||||
mo->fuse = luaL_checkinteger(L, 3);
|
mo->fuse = luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_watertop:
|
case mobj_watertop:
|
||||||
mo->watertop = (fixed_t)luaL_checkinteger(L, 3);
|
mo->watertop = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_waterbottom:
|
case mobj_waterbottom:
|
||||||
mo->waterbottom = (fixed_t)luaL_checkinteger(L, 3);
|
mo->waterbottom = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_mobjnum:
|
case mobj_mobjnum:
|
||||||
return UNIMPLEMENTED;
|
return UNIMPLEMENTED;
|
||||||
case mobj_scale:
|
case mobj_scale:
|
||||||
{
|
{
|
||||||
fixed_t scale = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t scale = luaL_checkfixed(L, 3);
|
||||||
if (scale < FRACUNIT/100)
|
if (scale < FRACUNIT/100)
|
||||||
scale = FRACUNIT/100;
|
scale = FRACUNIT/100;
|
||||||
mo->destscale = scale;
|
mo->destscale = scale;
|
||||||
|
@ -599,14 +613,14 @@ static int mobj_set(lua_State *L)
|
||||||
}
|
}
|
||||||
case mobj_destscale:
|
case mobj_destscale:
|
||||||
{
|
{
|
||||||
fixed_t scale = (fixed_t)luaL_checkinteger(L, 3);
|
fixed_t scale = luaL_checkfixed(L, 3);
|
||||||
if (scale < FRACUNIT/100)
|
if (scale < FRACUNIT/100)
|
||||||
scale = FRACUNIT/100;
|
scale = FRACUNIT/100;
|
||||||
mo->destscale = scale;
|
mo->destscale = scale;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mobj_scalespeed:
|
case mobj_scalespeed:
|
||||||
mo->scalespeed = (fixed_t)luaL_checkinteger(L, 3);
|
mo->scalespeed = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
case mobj_extravalue1:
|
case mobj_extravalue1:
|
||||||
mo->extravalue1 = luaL_checkinteger(L, 3);
|
mo->extravalue1 = luaL_checkinteger(L, 3);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -55,7 +55,7 @@ static int lib_getPlayer(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_Integer i = luaL_checkinteger(L, 2);
|
lua_Integer i = luaL_checkinteger(L, 2);
|
||||||
if (i < 0 || i >= MAXPLAYERS)
|
if (i < 0 || i >= MAXPLAYERS)
|
||||||
return luaL_error(L, "players[] index cannot exceed MAXPLAYERS");
|
return luaL_error(L, "players[] index %d out of range (0 - %d)", i, MAXPLAYERS-1);
|
||||||
if (!playeringame[i])
|
if (!playeringame[i])
|
||||||
return 0;
|
return 0;
|
||||||
if (!players[i].mo)
|
if (!players[i].mo)
|
||||||
|
@ -109,15 +109,15 @@ static int player_get(lua_State *L)
|
||||||
else if (fastcmp(field,"playerstate"))
|
else if (fastcmp(field,"playerstate"))
|
||||||
lua_pushinteger(L, plr->playerstate);
|
lua_pushinteger(L, plr->playerstate);
|
||||||
else if (fastcmp(field,"viewz"))
|
else if (fastcmp(field,"viewz"))
|
||||||
lua_pushinteger(L, plr->viewz);
|
lua_pushfixed(L, plr->viewz);
|
||||||
else if (fastcmp(field,"viewheight"))
|
else if (fastcmp(field,"viewheight"))
|
||||||
lua_pushinteger(L, plr->viewheight);
|
lua_pushfixed(L, plr->viewheight);
|
||||||
else if (fastcmp(field,"deltaviewheight"))
|
else if (fastcmp(field,"deltaviewheight"))
|
||||||
lua_pushinteger(L, plr->deltaviewheight);
|
lua_pushfixed(L, plr->deltaviewheight);
|
||||||
else if (fastcmp(field,"bob"))
|
else if (fastcmp(field,"bob"))
|
||||||
lua_pushinteger(L, plr->bob);
|
lua_pushfixed(L, plr->bob);
|
||||||
else if (fastcmp(field,"aiming"))
|
else if (fastcmp(field,"aiming"))
|
||||||
lua_pushinteger(L, plr->aiming);
|
lua_pushangle(L, plr->aiming);
|
||||||
else if (fastcmp(field,"health"))
|
else if (fastcmp(field,"health"))
|
||||||
lua_pushinteger(L, plr->health);
|
lua_pushinteger(L, plr->health);
|
||||||
else if (fastcmp(field,"pity"))
|
else if (fastcmp(field,"pity"))
|
||||||
|
@ -141,13 +141,13 @@ static int player_get(lua_State *L)
|
||||||
else if (fastcmp(field,"score"))
|
else if (fastcmp(field,"score"))
|
||||||
lua_pushinteger(L, plr->score);
|
lua_pushinteger(L, plr->score);
|
||||||
else if (fastcmp(field,"dashspeed"))
|
else if (fastcmp(field,"dashspeed"))
|
||||||
lua_pushinteger(L, plr->dashspeed);
|
lua_pushfixed(L, plr->dashspeed);
|
||||||
else if (fastcmp(field,"dashtime"))
|
else if (fastcmp(field,"dashtime"))
|
||||||
lua_pushinteger(L, plr->dashtime);
|
lua_pushinteger(L, plr->dashtime);
|
||||||
else if (fastcmp(field,"normalspeed"))
|
else if (fastcmp(field,"normalspeed"))
|
||||||
lua_pushinteger(L, plr->normalspeed);
|
lua_pushfixed(L, plr->normalspeed);
|
||||||
else if (fastcmp(field,"runspeed"))
|
else if (fastcmp(field,"runspeed"))
|
||||||
lua_pushinteger(L, plr->runspeed);
|
lua_pushfixed(L, plr->runspeed);
|
||||||
else if (fastcmp(field,"thrustfactor"))
|
else if (fastcmp(field,"thrustfactor"))
|
||||||
lua_pushinteger(L, plr->thrustfactor);
|
lua_pushinteger(L, plr->thrustfactor);
|
||||||
else if (fastcmp(field,"accelstart"))
|
else if (fastcmp(field,"accelstart"))
|
||||||
|
@ -167,13 +167,13 @@ static int player_get(lua_State *L)
|
||||||
else if (fastcmp(field,"revitem"))
|
else if (fastcmp(field,"revitem"))
|
||||||
lua_pushinteger(L, plr->revitem);
|
lua_pushinteger(L, plr->revitem);
|
||||||
else if (fastcmp(field,"actionspd"))
|
else if (fastcmp(field,"actionspd"))
|
||||||
lua_pushinteger(L, plr->actionspd);
|
lua_pushfixed(L, plr->actionspd);
|
||||||
else if (fastcmp(field,"mindash"))
|
else if (fastcmp(field,"mindash"))
|
||||||
lua_pushinteger(L, plr->mindash);
|
lua_pushfixed(L, plr->mindash);
|
||||||
else if (fastcmp(field,"maxdash"))
|
else if (fastcmp(field,"maxdash"))
|
||||||
lua_pushinteger(L, plr->maxdash);
|
lua_pushfixed(L, plr->maxdash);
|
||||||
else if (fastcmp(field,"jumpfactor"))
|
else if (fastcmp(field,"jumpfactor"))
|
||||||
lua_pushinteger(L, plr->jumpfactor);
|
lua_pushfixed(L, plr->jumpfactor);
|
||||||
else if (fastcmp(field,"lives"))
|
else if (fastcmp(field,"lives"))
|
||||||
lua_pushinteger(L, plr->lives);
|
lua_pushinteger(L, plr->lives);
|
||||||
else if (fastcmp(field,"continues"))
|
else if (fastcmp(field,"continues"))
|
||||||
|
@ -183,7 +183,7 @@ static int player_get(lua_State *L)
|
||||||
else if (fastcmp(field,"gotcontinue"))
|
else if (fastcmp(field,"gotcontinue"))
|
||||||
lua_pushinteger(L, plr->gotcontinue);
|
lua_pushinteger(L, plr->gotcontinue);
|
||||||
else if (fastcmp(field,"speed"))
|
else if (fastcmp(field,"speed"))
|
||||||
lua_pushinteger(L, plr->speed);
|
lua_pushfixed(L, plr->speed);
|
||||||
else if (fastcmp(field,"jumping"))
|
else if (fastcmp(field,"jumping"))
|
||||||
lua_pushboolean(L, plr->jumping);
|
lua_pushboolean(L, plr->jumping);
|
||||||
else if (fastcmp(field,"secondjump"))
|
else if (fastcmp(field,"secondjump"))
|
||||||
|
@ -205,13 +205,13 @@ static int player_get(lua_State *L)
|
||||||
else if (fastcmp(field,"skidtime"))
|
else if (fastcmp(field,"skidtime"))
|
||||||
lua_pushinteger(L, plr->skidtime);
|
lua_pushinteger(L, plr->skidtime);
|
||||||
else if (fastcmp(field,"cmomx"))
|
else if (fastcmp(field,"cmomx"))
|
||||||
lua_pushinteger(L, plr->cmomx);
|
lua_pushfixed(L, plr->cmomx);
|
||||||
else if (fastcmp(field,"cmomy"))
|
else if (fastcmp(field,"cmomy"))
|
||||||
lua_pushinteger(L, plr->cmomy);
|
lua_pushfixed(L, plr->cmomy);
|
||||||
else if (fastcmp(field,"rmomx"))
|
else if (fastcmp(field,"rmomx"))
|
||||||
lua_pushinteger(L, plr->rmomx);
|
lua_pushfixed(L, plr->rmomx);
|
||||||
else if (fastcmp(field,"rmomy"))
|
else if (fastcmp(field,"rmomy"))
|
||||||
lua_pushinteger(L, plr->rmomy);
|
lua_pushfixed(L, plr->rmomy);
|
||||||
else if (fastcmp(field,"numboxes"))
|
else if (fastcmp(field,"numboxes"))
|
||||||
lua_pushinteger(L, plr->numboxes);
|
lua_pushinteger(L, plr->numboxes);
|
||||||
else if (fastcmp(field,"totalring"))
|
else if (fastcmp(field,"totalring"))
|
||||||
|
@ -239,11 +239,11 @@ static int player_get(lua_State *L)
|
||||||
else if (fastcmp(field,"starposttime"))
|
else if (fastcmp(field,"starposttime"))
|
||||||
lua_pushinteger(L, plr->starposttime);
|
lua_pushinteger(L, plr->starposttime);
|
||||||
else if (fastcmp(field,"starpostangle"))
|
else if (fastcmp(field,"starpostangle"))
|
||||||
lua_pushinteger(L, plr->starpostangle);
|
lua_pushangle(L, plr->starpostangle);
|
||||||
else if (fastcmp(field,"angle_pos"))
|
else if (fastcmp(field,"angle_pos"))
|
||||||
lua_pushinteger(L, plr->angle_pos);
|
lua_pushangle(L, plr->angle_pos);
|
||||||
else if (fastcmp(field,"old_angle_pos"))
|
else if (fastcmp(field,"old_angle_pos"))
|
||||||
lua_pushinteger(L, plr->old_angle_pos);
|
lua_pushangle(L, plr->old_angle_pos);
|
||||||
else if (fastcmp(field,"axis1"))
|
else if (fastcmp(field,"axis1"))
|
||||||
LUA_PushUserdata(L, plr->axis1, META_MOBJ);
|
LUA_PushUserdata(L, plr->axis1, META_MOBJ);
|
||||||
else if (fastcmp(field,"axis2"))
|
else if (fastcmp(field,"axis2"))
|
||||||
|
@ -298,6 +298,8 @@ static int player_get(lua_State *L)
|
||||||
lua_pushinteger(L, plr->lastlinehit);
|
lua_pushinteger(L, plr->lastlinehit);
|
||||||
else if (fastcmp(field,"losstime"))
|
else if (fastcmp(field,"losstime"))
|
||||||
lua_pushinteger(L, plr->losstime);
|
lua_pushinteger(L, plr->losstime);
|
||||||
|
else if (fastcmp(field,"timeshit"))
|
||||||
|
lua_pushinteger(L, plr->timeshit);
|
||||||
else if (fastcmp(field,"onconveyor"))
|
else if (fastcmp(field,"onconveyor"))
|
||||||
lua_pushinteger(L, plr->onconveyor);
|
lua_pushinteger(L, plr->onconveyor);
|
||||||
else if (fastcmp(field,"awayviewmobj"))
|
else if (fastcmp(field,"awayviewmobj"))
|
||||||
|
@ -305,16 +307,16 @@ static int player_get(lua_State *L)
|
||||||
else if (fastcmp(field,"awayviewtics"))
|
else if (fastcmp(field,"awayviewtics"))
|
||||||
lua_pushinteger(L, plr->awayviewtics);
|
lua_pushinteger(L, plr->awayviewtics);
|
||||||
else if (fastcmp(field,"awayviewaiming"))
|
else if (fastcmp(field,"awayviewaiming"))
|
||||||
lua_pushinteger(L, plr->awayviewaiming);
|
lua_pushangle(L, plr->awayviewaiming);
|
||||||
else if (fastcmp(field,"spectator"))
|
else if (fastcmp(field,"spectator"))
|
||||||
lua_pushinteger(L, plr->spectator);
|
lua_pushboolean(L, plr->spectator);
|
||||||
else if (fastcmp(field,"bot"))
|
else if (fastcmp(field,"bot"))
|
||||||
lua_pushinteger(L, plr->bot);
|
lua_pushinteger(L, plr->bot);
|
||||||
else if (fastcmp(field,"jointime"))
|
else if (fastcmp(field,"jointime"))
|
||||||
lua_pushinteger(L, plr->jointime);
|
lua_pushinteger(L, plr->jointime);
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
else if (fastcmp(field,"fovadd"))
|
else if (fastcmp(field,"fovadd"))
|
||||||
lua_pushinteger(L, plr->fovadd);
|
lua_pushfixed(L, plr->fovadd);
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||||
|
@ -354,15 +356,15 @@ static int player_set(lua_State *L)
|
||||||
else if (fastcmp(field,"playerstate"))
|
else if (fastcmp(field,"playerstate"))
|
||||||
plr->playerstate = luaL_checkinteger(L, 3);
|
plr->playerstate = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"viewz"))
|
else if (fastcmp(field,"viewz"))
|
||||||
plr->viewz = (fixed_t)luaL_checkinteger(L, 3);
|
plr->viewz = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"viewheight"))
|
else if (fastcmp(field,"viewheight"))
|
||||||
plr->viewheight = (fixed_t)luaL_checkinteger(L, 3);
|
plr->viewheight = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"deltaviewheight"))
|
else if (fastcmp(field,"deltaviewheight"))
|
||||||
plr->deltaviewheight = (fixed_t)luaL_checkinteger(L, 3);
|
plr->deltaviewheight = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"bob"))
|
else if (fastcmp(field,"bob"))
|
||||||
plr->bob = (fixed_t)luaL_checkinteger(L, 3);
|
plr->bob = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"aiming")) {
|
else if (fastcmp(field,"aiming")) {
|
||||||
plr->aiming = (angle_t)luaL_checkinteger(L, 3);
|
plr->aiming = luaL_checkangle(L, 3);
|
||||||
if (plr == &players[consoleplayer])
|
if (plr == &players[consoleplayer])
|
||||||
localaiming = plr->aiming;
|
localaiming = plr->aiming;
|
||||||
else if (plr == &players[secondarydisplayplayer])
|
else if (plr == &players[secondarydisplayplayer])
|
||||||
|
@ -387,17 +389,22 @@ static int player_set(lua_State *L)
|
||||||
else if (fastcmp(field,"flashpal"))
|
else if (fastcmp(field,"flashpal"))
|
||||||
plr->flashpal = (UINT16)luaL_checkinteger(L, 3);
|
plr->flashpal = (UINT16)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"skincolor"))
|
else if (fastcmp(field,"skincolor"))
|
||||||
plr->skincolor = ((UINT8)luaL_checkinteger(L, 3)) % MAXSKINCOLORS;
|
{
|
||||||
|
UINT8 newcolor = (UINT8)luaL_checkinteger(L,3);
|
||||||
|
if (newcolor >= MAXSKINCOLORS)
|
||||||
|
return luaL_error(L, "player.skincolor %d out of range (0 - %d).", newcolor, MAXSKINCOLORS-1);
|
||||||
|
plr->skincolor = newcolor;
|
||||||
|
}
|
||||||
else if (fastcmp(field,"score"))
|
else if (fastcmp(field,"score"))
|
||||||
plr->score = (UINT32)luaL_checkinteger(L, 3);
|
plr->score = (UINT32)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"dashspeed"))
|
else if (fastcmp(field,"dashspeed"))
|
||||||
plr->dashspeed = (fixed_t)luaL_checkinteger(L, 3);
|
plr->dashspeed = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"dashtime"))
|
else if (fastcmp(field,"dashtime"))
|
||||||
plr->dashtime = (INT32)luaL_checkinteger(L, 3);
|
plr->dashtime = (INT32)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"normalspeed"))
|
else if (fastcmp(field,"normalspeed"))
|
||||||
plr->normalspeed = (fixed_t)luaL_checkinteger(L, 3);
|
plr->normalspeed = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"runspeed"))
|
else if (fastcmp(field,"runspeed"))
|
||||||
plr->runspeed = (fixed_t)luaL_checkinteger(L, 3);
|
plr->runspeed = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"thrustfactor"))
|
else if (fastcmp(field,"thrustfactor"))
|
||||||
plr->thrustfactor = (UINT8)luaL_checkinteger(L, 3);
|
plr->thrustfactor = (UINT8)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"accelstart"))
|
else if (fastcmp(field,"accelstart"))
|
||||||
|
@ -433,7 +440,7 @@ static int player_set(lua_State *L)
|
||||||
else if (fastcmp(field,"gotcontinue"))
|
else if (fastcmp(field,"gotcontinue"))
|
||||||
plr->gotcontinue = (UINT8)luaL_checkinteger(L, 3);
|
plr->gotcontinue = (UINT8)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"speed"))
|
else if (fastcmp(field,"speed"))
|
||||||
plr->speed = (fixed_t)luaL_checkinteger(L, 3);
|
plr->speed = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"jumping"))
|
else if (fastcmp(field,"jumping"))
|
||||||
plr->jumping = luaL_checkboolean(L, 3);
|
plr->jumping = luaL_checkboolean(L, 3);
|
||||||
else if (fastcmp(field,"secondjump"))
|
else if (fastcmp(field,"secondjump"))
|
||||||
|
@ -455,13 +462,13 @@ static int player_set(lua_State *L)
|
||||||
else if (fastcmp(field,"skidtime"))
|
else if (fastcmp(field,"skidtime"))
|
||||||
plr->skidtime = (tic_t)luaL_checkinteger(L, 3);
|
plr->skidtime = (tic_t)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"cmomx"))
|
else if (fastcmp(field,"cmomx"))
|
||||||
plr->cmomx = (fixed_t)luaL_checkinteger(L, 3);
|
plr->cmomx = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"cmomy"))
|
else if (fastcmp(field,"cmomy"))
|
||||||
plr->cmomy = (fixed_t)luaL_checkinteger(L, 3);
|
plr->cmomy = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"rmomx"))
|
else if (fastcmp(field,"rmomx"))
|
||||||
plr->rmomx = (fixed_t)luaL_checkinteger(L, 3);
|
plr->rmomx = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"rmomy"))
|
else if (fastcmp(field,"rmomy"))
|
||||||
plr->rmomy = (fixed_t)luaL_checkinteger(L, 3);
|
plr->rmomy = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"numboxes"))
|
else if (fastcmp(field,"numboxes"))
|
||||||
plr->numboxes = (INT16)luaL_checkinteger(L, 3);
|
plr->numboxes = (INT16)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"totalring"))
|
else if (fastcmp(field,"totalring"))
|
||||||
|
@ -489,11 +496,11 @@ static int player_set(lua_State *L)
|
||||||
else if (fastcmp(field,"starposttime"))
|
else if (fastcmp(field,"starposttime"))
|
||||||
plr->starposttime = (tic_t)luaL_checkinteger(L, 3);
|
plr->starposttime = (tic_t)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"starpostangle"))
|
else if (fastcmp(field,"starpostangle"))
|
||||||
plr->starpostangle = (angle_t)luaL_checkinteger(L, 3);
|
plr->starpostangle = luaL_checkangle(L, 3);
|
||||||
else if (fastcmp(field,"angle_pos"))
|
else if (fastcmp(field,"angle_pos"))
|
||||||
plr->angle_pos = (angle_t)luaL_checkinteger(L, 3);
|
plr->angle_pos = luaL_checkangle(L, 3);
|
||||||
else if (fastcmp(field,"old_angle_pos"))
|
else if (fastcmp(field,"old_angle_pos"))
|
||||||
plr->old_angle_pos = (angle_t)luaL_checkinteger(L, 3);
|
plr->old_angle_pos = luaL_checkangle(L, 3);
|
||||||
else if (fastcmp(field,"axis1"))
|
else if (fastcmp(field,"axis1"))
|
||||||
P_SetTarget(&plr->axis1, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)));
|
P_SetTarget(&plr->axis1, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)));
|
||||||
else if (fastcmp(field,"axis2"))
|
else if (fastcmp(field,"axis2"))
|
||||||
|
@ -553,6 +560,8 @@ static int player_set(lua_State *L)
|
||||||
plr->lastlinehit = (INT16)luaL_checkinteger(L, 3);
|
plr->lastlinehit = (INT16)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"losstime"))
|
else if (fastcmp(field,"losstime"))
|
||||||
plr->losstime = (tic_t)luaL_checkinteger(L, 3);
|
plr->losstime = (tic_t)luaL_checkinteger(L, 3);
|
||||||
|
else if (fastcmp(field,"timeshit"))
|
||||||
|
plr->timeshit = (UINT8)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"onconveyor"))
|
else if (fastcmp(field,"onconveyor"))
|
||||||
plr->onconveyor = (INT32)luaL_checkinteger(L, 3);
|
plr->onconveyor = (INT32)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"awayviewmobj"))
|
else if (fastcmp(field,"awayviewmobj"))
|
||||||
|
@ -569,7 +578,7 @@ static int player_set(lua_State *L)
|
||||||
P_SetTarget(&plr->awayviewmobj, plr->mo); // but since the script might set awayviewmobj immediately AFTER setting awayviewtics, use player mobj as filler for now.
|
P_SetTarget(&plr->awayviewmobj, plr->mo); // but since the script might set awayviewmobj immediately AFTER setting awayviewtics, use player mobj as filler for now.
|
||||||
}
|
}
|
||||||
else if (fastcmp(field,"awayviewaiming"))
|
else if (fastcmp(field,"awayviewaiming"))
|
||||||
plr->awayviewaiming = (angle_t)luaL_checkinteger(L, 3);
|
plr->awayviewaiming = luaL_checkangle(L, 3);
|
||||||
else if (fastcmp(field,"spectator"))
|
else if (fastcmp(field,"spectator"))
|
||||||
plr->spectator = lua_toboolean(L, 3);
|
plr->spectator = lua_toboolean(L, 3);
|
||||||
else if (fastcmp(field,"bot"))
|
else if (fastcmp(field,"bot"))
|
||||||
|
@ -578,7 +587,7 @@ static int player_set(lua_State *L)
|
||||||
plr->jointime = (tic_t)luaL_checkinteger(L, 3);
|
plr->jointime = (tic_t)luaL_checkinteger(L, 3);
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
else if (fastcmp(field,"fovadd"))
|
else if (fastcmp(field,"fovadd"))
|
||||||
plr->fovadd = (fixed_t)luaL_checkinteger(L, 3);
|
plr->fovadd = luaL_checkfixed(L, 3);
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -442,7 +442,6 @@ enum
|
||||||
ARCH_NULL=0,
|
ARCH_NULL=0,
|
||||||
ARCH_BOOLEAN,
|
ARCH_BOOLEAN,
|
||||||
ARCH_SIGNED,
|
ARCH_SIGNED,
|
||||||
ARCH_UNSIGNED,
|
|
||||||
ARCH_STRING,
|
ARCH_STRING,
|
||||||
ARCH_TABLE,
|
ARCH_TABLE,
|
||||||
|
|
||||||
|
@ -522,13 +521,8 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
||||||
case LUA_TNUMBER:
|
case LUA_TNUMBER:
|
||||||
{
|
{
|
||||||
lua_Integer number = lua_tointeger(gL, myindex);
|
lua_Integer number = lua_tointeger(gL, myindex);
|
||||||
if (number < 0) {
|
WRITEUINT8(save_p, ARCH_SIGNED);
|
||||||
WRITEUINT8(save_p, ARCH_SIGNED);
|
WRITEFIXED(save_p, number);
|
||||||
WRITEFIXED(save_p, number);
|
|
||||||
} else {
|
|
||||||
WRITEUINT8(save_p, ARCH_UNSIGNED);
|
|
||||||
WRITEANGLE(save_p, number);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LUA_TSTRING:
|
case LUA_TSTRING:
|
||||||
|
@ -743,7 +737,7 @@ static int NetArchive(lua_State *L)
|
||||||
{
|
{
|
||||||
int TABLESINDEX = lua_upvalueindex(1);
|
int TABLESINDEX = lua_upvalueindex(1);
|
||||||
int i, n = lua_gettop(L);
|
int i, n = lua_gettop(L);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 1; i <= n; i++)
|
||||||
ArchiveValue(TABLESINDEX, i);
|
ArchiveValue(TABLESINDEX, i);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
@ -797,9 +791,6 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
||||||
case ARCH_SIGNED:
|
case ARCH_SIGNED:
|
||||||
lua_pushinteger(gL, READFIXED(save_p));
|
lua_pushinteger(gL, READFIXED(save_p));
|
||||||
break;
|
break;
|
||||||
case ARCH_UNSIGNED:
|
|
||||||
lua_pushinteger(gL, READANGLE(save_p));
|
|
||||||
break;
|
|
||||||
case ARCH_STRING:
|
case ARCH_STRING:
|
||||||
{
|
{
|
||||||
char value[1024];
|
char value[1024];
|
||||||
|
@ -893,7 +884,7 @@ static int NetUnArchive(lua_State *L)
|
||||||
{
|
{
|
||||||
int TABLESINDEX = lua_upvalueindex(1);
|
int TABLESINDEX = lua_upvalueindex(1);
|
||||||
int i, n = lua_gettop(L);
|
int i, n = lua_gettop(L);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 1; i <= n; i++)
|
||||||
UnArchiveValue(TABLESINDEX);
|
UnArchiveValue(TABLESINDEX);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
@ -924,28 +915,12 @@ static void UnArchiveTables(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NetArchiveHook(lua_CFunction archFunc)
|
void LUA_Step(void)
|
||||||
{
|
{
|
||||||
int TABLESINDEX;
|
|
||||||
|
|
||||||
if (!gL)
|
if (!gL)
|
||||||
return;
|
return;
|
||||||
|
lua_settop(gL, 0);
|
||||||
TABLESINDEX = lua_gettop(gL);
|
lua_gc(gL, LUA_GCSTEP, 1);
|
||||||
lua_getfield(gL, LUA_REGISTRYINDEX, "hook");
|
|
||||||
I_Assert(lua_istable(gL, -1));
|
|
||||||
lua_rawgeti(gL, -1, hook_NetVars);
|
|
||||||
lua_remove(gL, -2);
|
|
||||||
I_Assert(lua_istable(gL, -1));
|
|
||||||
|
|
||||||
lua_pushvalue(gL, TABLESINDEX);
|
|
||||||
lua_pushcclosure(gL, archFunc, 1);
|
|
||||||
lua_pushnil(gL);
|
|
||||||
while (lua_next(gL, -3) != 0) {
|
|
||||||
lua_pushvalue(gL, -3); // function
|
|
||||||
LUA_Call(gL, 1);
|
|
||||||
}
|
|
||||||
lua_pop(gL, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LUA_Archive(void)
|
void LUA_Archive(void)
|
||||||
|
@ -973,7 +948,7 @@ void LUA_Archive(void)
|
||||||
}
|
}
|
||||||
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
|
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
|
||||||
|
|
||||||
NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
|
LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
|
||||||
ArchiveTables();
|
ArchiveTables();
|
||||||
|
|
||||||
if (gL)
|
if (gL)
|
||||||
|
@ -1004,7 +979,7 @@ void LUA_UnArchive(void)
|
||||||
UnArchiveExtVars(th); // apply variables
|
UnArchiveExtVars(th); // apply variables
|
||||||
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||||
|
|
||||||
NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
|
LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode
|
||||||
UnArchiveTables();
|
UnArchiveTables();
|
||||||
|
|
||||||
if (gL)
|
if (gL)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -19,9 +19,21 @@
|
||||||
#include "blua/lua.h"
|
#include "blua/lua.h"
|
||||||
#include "blua/lualib.h"
|
#include "blua/lualib.h"
|
||||||
#include "blua/lauxlib.h"
|
#include "blua/lauxlib.h"
|
||||||
|
|
||||||
#define lua_optboolean(L, i) (!lua_isnoneornil(L, i) && lua_toboolean(L, i))
|
#define lua_optboolean(L, i) (!lua_isnoneornil(L, i) && lua_toboolean(L, i))
|
||||||
#define lua_opttrueboolean(L, i) (lua_isnoneornil(L, i) || lua_toboolean(L, i))
|
#define lua_opttrueboolean(L, i) (lua_isnoneornil(L, i) || lua_toboolean(L, i))
|
||||||
|
|
||||||
|
// fixed_t casting
|
||||||
|
// TODO add some distinction between fixed numbers and integer numbers
|
||||||
|
// for at least the purpose of printing and maybe math.
|
||||||
|
#define luaL_checkfixed(L, i) luaL_checkinteger(L, i)
|
||||||
|
#define lua_pushfixed(L, f) lua_pushinteger(L, f)
|
||||||
|
|
||||||
|
// angle_t casting
|
||||||
|
// TODO deal with signedness
|
||||||
|
#define luaL_checkangle(L, i) ((angle_t)luaL_checkinteger(L, i))
|
||||||
|
#define lua_pushangle(L, a) lua_pushinteger(L, a)
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void LUA_ClearExtVars(void);
|
void LUA_ClearExtVars(void);
|
||||||
#endif
|
#endif
|
||||||
|
@ -36,12 +48,14 @@ void LUA_InvalidateUserdata(void *data);
|
||||||
void LUA_InvalidateLevel(void);
|
void LUA_InvalidateLevel(void);
|
||||||
void LUA_InvalidateMapthings(void);
|
void LUA_InvalidateMapthings(void);
|
||||||
void LUA_InvalidatePlayer(player_t *player);
|
void LUA_InvalidatePlayer(player_t *player);
|
||||||
|
void LUA_Step(void);
|
||||||
void LUA_Archive(void);
|
void LUA_Archive(void);
|
||||||
void LUA_UnArchive(void);
|
void LUA_UnArchive(void);
|
||||||
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||||
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
||||||
int Lua_optoption(lua_State *L, int narg,
|
int Lua_optoption(lua_State *L, int narg,
|
||||||
const char *def, const char *const lst[]);
|
const char *def, const char *const lst[]);
|
||||||
|
void LUAh_NetArchiveHook(lua_CFunction archFunc);
|
||||||
|
|
||||||
// Console wrapper
|
// Console wrapper
|
||||||
void COM_Lua_f(void);
|
void COM_Lua_f(void);
|
||||||
|
@ -56,4 +70,26 @@ void COM_Lua_f(void);
|
||||||
|
|
||||||
#define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type ".");
|
#define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type ".");
|
||||||
|
|
||||||
|
// Deprecation warnings
|
||||||
|
// Shows once upon use. Then doesn't show again.
|
||||||
|
#define LUA_Deprecated(L,this_func,use_instead)\
|
||||||
|
{\
|
||||||
|
static UINT8 seen = 0;\
|
||||||
|
if (!seen) {\
|
||||||
|
seen = 1;\
|
||||||
|
CONS_Alert(CONS_WARNING,"\"%s\" is deprecated and will be removed.\nUse \"%s\" instead.\n", this_func, use_instead);\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warnings about incorrect function usage.
|
||||||
|
// Shows once, then never again, like deprecation
|
||||||
|
#define LUA_UsageWarning(L, warningmsg)\
|
||||||
|
{\
|
||||||
|
static UINT8 seen = 0;\
|
||||||
|
if (!seen) {\
|
||||||
|
seen = 1;\
|
||||||
|
CONS_Alert(CONS_WARNING,"%s\n", warningmsg);\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2014 by John "JTE" Muniz.
|
// Copyright (C) 2014-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2014 by Sonic Team Junior.
|
// Copyright (C) 2014-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
@ -147,19 +147,19 @@ static int skin_get(lua_State *L)
|
||||||
lua_pushinteger(L, skin->revitem);
|
lua_pushinteger(L, skin->revitem);
|
||||||
break;
|
break;
|
||||||
case skin_actionspd:
|
case skin_actionspd:
|
||||||
lua_pushinteger(L, skin->actionspd);
|
lua_pushfixed(L, skin->actionspd);
|
||||||
break;
|
break;
|
||||||
case skin_mindash:
|
case skin_mindash:
|
||||||
lua_pushinteger(L, skin->mindash);
|
lua_pushfixed(L, skin->mindash);
|
||||||
break;
|
break;
|
||||||
case skin_maxdash:
|
case skin_maxdash:
|
||||||
lua_pushinteger(L, skin->maxdash);
|
lua_pushfixed(L, skin->maxdash);
|
||||||
break;
|
break;
|
||||||
case skin_normalspeed:
|
case skin_normalspeed:
|
||||||
lua_pushinteger(L, skin->normalspeed);
|
lua_pushfixed(L, skin->normalspeed);
|
||||||
break;
|
break;
|
||||||
case skin_runspeed:
|
case skin_runspeed:
|
||||||
lua_pushinteger(L, skin->runspeed);
|
lua_pushfixed(L, skin->runspeed);
|
||||||
break;
|
break;
|
||||||
case skin_thrustfactor:
|
case skin_thrustfactor:
|
||||||
lua_pushinteger(L, skin->thrustfactor);
|
lua_pushinteger(L, skin->thrustfactor);
|
||||||
|
@ -171,7 +171,7 @@ static int skin_get(lua_State *L)
|
||||||
lua_pushinteger(L, skin->acceleration);
|
lua_pushinteger(L, skin->acceleration);
|
||||||
break;
|
break;
|
||||||
case skin_jumpfactor:
|
case skin_jumpfactor:
|
||||||
lua_pushinteger(L, skin->jumpfactor);
|
lua_pushfixed(L, skin->jumpfactor);
|
||||||
break;
|
break;
|
||||||
case skin_starttranscolor:
|
case skin_starttranscolor:
|
||||||
lua_pushinteger(L, skin->starttranscolor);
|
lua_pushinteger(L, skin->starttranscolor);
|
||||||
|
@ -244,7 +244,7 @@ static int lib_getSkin(lua_State *L)
|
||||||
{
|
{
|
||||||
i = luaL_checkinteger(L, 2);
|
i = luaL_checkinteger(L, 2);
|
||||||
if (i < 0 || i >= MAXSKINS)
|
if (i < 0 || i >= MAXSKINS)
|
||||||
return luaL_error(L, "skins[] index cannot exceed MAXSKINS");
|
return luaL_error(L, "skins[] index %d out of range (0 - %d)", i, MAXSKINS-1);
|
||||||
if (i >= numskins)
|
if (i >= numskins)
|
||||||
return 0;
|
return 0;
|
||||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2012-2014 by John "JTE" Muniz.
|
// Copyright (C) 2012-2016 by John "JTE" Muniz.
|
||||||
// Copyright (C) 2012-2014 by Sonic Team Junior.
|
// Copyright (C) 2012-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2013-2014 by Matthew "Inuyasha" Walsh.
|
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
|
||||||
// Copyright (C) 2013 by "Treeki" / "Ninjifox".
|
// Copyright (C) 2013 by "Ninji".
|
||||||
// Copyright (C) 2013-2014 by Sonic Team Junior.
|
// Copyright (C) 2013-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2013-2014 by Matthew "Inuyasha" Walsh.
|
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
|
||||||
// Copyright (C) 2013-2014 by Sonic Team Junior.
|
// Copyright (C) 2013-2016 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue