Merge remote-tracking branch 'origin/Saturn' into Saturn-Next
This commit is contained in:
commit
b96663ffb8
79 files changed
+1497
-4223
No files matched your search
@@ -43,7 +43,7 @@ jobs:
|
||||
- v1-SRB2-APT
|
||||
- run:
|
||||
name: Install SDK
|
||||
command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libcurl4-openssl-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
|
||||
command: apt-get -qq -y --no-install-recommends install git build-essential libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libcurl4-openssl-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
|
||||
- save_cache:
|
||||
key: v1-SRB2-APT
|
||||
paths:
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
- You tell us! c:
|
||||
|
||||
## Dependencies
|
||||
- NASM (x86 builds only)
|
||||
- SDL2 (Linux/OS X only)
|
||||
- SDL2-Mixer (Linux/OS X only)
|
||||
- libupnp (Linux/OS X only)
|
||||
|
||||
@@ -1996,24 +1996,6 @@ HW3SOUND for 3D hardware sound support
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/v_video.h" />
|
||||
<Unit filename="src/vid_copy.s">
|
||||
<Option compilerVar="CC" />
|
||||
<Option compiler="avrgcc" 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="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="gcc" use="1" buildCommand="$compiler $options -x assembler-with-cpp -c $file -o $object" />
|
||||
<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" />
|
||||
<Option target="Debug Mingw/DirectX" />
|
||||
<Option target="Release Mingw/DirectX" />
|
||||
</Unit>
|
||||
<Unit filename="src/w_wad.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(PlatformTarget)'=='x86'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>USEASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
|
||||
@@ -5,7 +5,7 @@ Ver=3
|
||||
IsCpp=0
|
||||
Type=0
|
||||
UnitCount=279
|
||||
Folders=A_Asm,B_Bot,BLUA,D_Doom,F_Frame,G_Game,H_Hud,Hw_Hardware,Hw_Hardware/r_opengl,I_Interface,I_Interface/Dummy,I_Interface/SDL,I_Interface/Win32,LUA,M_Misc,P_Play,R_Rend,S_Sounds,W_Wad
|
||||
Folders=B_Bot,BLUA,D_Doom,F_Frame,G_Game,H_Hud,Hw_Hardware,Hw_Hardware/r_opengl,I_Interface,I_Interface/Dummy,I_Interface/SDL,I_Interface/Win32,LUA,M_Misc,P_Play,R_Rend,S_Sounds,W_Wad
|
||||
CommandLine=
|
||||
CompilerSettings=00000000000100000111e1
|
||||
PchHead=-1
|
||||
@@ -1473,36 +1473,6 @@ Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit149]
|
||||
FileName=src\tmap.nas
|
||||
Folder=A_Asm
|
||||
Compile=0
|
||||
CompileCpp=0
|
||||
Link=0
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=nasm.exe -g -o $@ -f win32 src/tmap.nas
|
||||
|
||||
[Unit150]
|
||||
FileName=src\asm_defs.inc
|
||||
Folder=A_Asm
|
||||
Compile=0
|
||||
CompileCpp=0
|
||||
Link=0
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit151]
|
||||
FileName=src\vid_copy.s
|
||||
Folder=A_Asm
|
||||
Compile=1
|
||||
CompileCpp=0
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=$(CC) $(CFLAGS) -x assembler-with-cpp -c src/vid_copy.s -o $@
|
||||
|
||||
[Unit152]
|
||||
FileName=src\y_inter.h
|
||||
Folder=H_Hud
|
||||
@@ -1543,26 +1513,6 @@ Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit156]
|
||||
FileName=src\p5prof.h
|
||||
Folder=A_Asm
|
||||
Compile=1
|
||||
CompileCpp=0
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit157]
|
||||
FileName=src\tmap_mmx.nas
|
||||
Folder=A_Asm
|
||||
Compile=0
|
||||
CompileCpp=0
|
||||
Link=0
|
||||
Priority=1000
|
||||
OverrideBuildCmd=1
|
||||
BuildCmd=nasm.exe -g -o $@ -f win32 src/tmap_mmx.nas
|
||||
|
||||
[Unit159]
|
||||
FileName=src\lzf.h
|
||||
Folder=W_Wad
|
||||
|
||||
@@ -11,8 +11,6 @@ environment:
|
||||
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead
|
||||
MINGW_SDK_64: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
|
||||
CFLAGS: -Wall -W -Werror -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3 -Wno-tautological-compare -Wno-error=suggest-attribute=noreturn
|
||||
NASM_ZIP: nasm-2.12.01
|
||||
NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip
|
||||
UPX_ZIP: upx391w
|
||||
UPX_URL: http://upx.sourceforge.net/download/upx391w.zip
|
||||
CCACHE_EXE: ccache.exe
|
||||
@@ -46,7 +44,6 @@ environment:
|
||||
ASSET_CLEAN: 0
|
||||
|
||||
cache:
|
||||
- nasm-2.12.01.zip
|
||||
- upx391w.zip
|
||||
- ccache.exe
|
||||
- C:\Users\appveyor\.ccache
|
||||
@@ -58,10 +55,6 @@ install:
|
||||
- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" )
|
||||
- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" )
|
||||
|
||||
- if not exist "%NASM_ZIP%.zip" appveyor DownloadFile "%NASM_URL%" -FileName "%NASM_ZIP%.zip"
|
||||
- 7z x -y "%NASM_ZIP%.zip" -o%TMP% >null
|
||||
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%NASM_ZIP%" "%MINGW_SDK%\bin" nasm.exe || exit 0
|
||||
|
||||
- if not exist "%UPX_ZIP%.zip" appveyor DownloadFile "%UPX_URL%" -FileName "%UPX_ZIP%.zip"
|
||||
- 7z x -y "%UPX_ZIP%.zip" -o%TMP% >null
|
||||
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%UPX_ZIP%" "%MINGW_SDK%\bin" upx.exe || exit 0
|
||||
@@ -78,7 +71,6 @@ before_build:
|
||||
- set "Path=%MINGW_SDK%\bin;%Path%"
|
||||
- if [%X86_64%] == [1] ( x86_64-w64-mingw32-gcc --version ) else ( i686-w64-mingw32-gcc --version )
|
||||
- mingw32-make --version
|
||||
- if not [%X86_64%] == [1] ( nasm -v )
|
||||
- if not [%NOUPX%] == [1] ( upx -V )
|
||||
- ccache -V
|
||||
- ccache -s
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# support for the yasm assembler
|
||||
|
||||
set(CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS nasm yasm asm)
|
||||
|
||||
if(NOT CMAKE_ASM_YASM_OBJECT_FORMAT)
|
||||
if(WIN32)
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT win64)
|
||||
else()
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT win32)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT macho64)
|
||||
else()
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT macho)
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT elf64)
|
||||
else()
|
||||
set(CMAKE_ASM_YASM_OBJECT_FORMAT elf)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_ASM_YASM_COMPILE_OBJECT "<CMAKE_ASM_YASM_COMPILER> <FLAGS> -f ${CMAKE_ASM_YASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
|
||||
|
||||
# Load the generic ASMInformation file:
|
||||
set(ASM_DIALECT "_YASM")
|
||||
include(CMakeASMInformation)
|
||||
set(ASM_DIALECT)
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
|
||||
|
||||
set(CMAKE_ASM_YASM_COMPILER_LIST nasm yasm)
|
||||
|
||||
if(NOT CMAKE_ASM_YASM_COMPILER)
|
||||
find_program(CMAKE_ASM_YASM_COMPILER yasm
|
||||
"$ENV{ProgramFiles}/YASM")
|
||||
endif()
|
||||
|
||||
# Load the generic DetermineASM compiler file with the DIALECT set properly:
|
||||
set(ASM_DIALECT "_YASM")
|
||||
include(CMakeDetermineASMCompiler)
|
||||
set(ASM_DIALECT)
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This file is used by EnableLanguage in cmGlobalGenerator to
|
||||
# determine that the selected ASM_NASM "compiler" works.
|
||||
# For assembler this can only check whether the compiler has been found,
|
||||
# because otherwise there would have to be a separate assembler source file
|
||||
# for each assembler on every architecture.
|
||||
|
||||
set(ASM_DIALECT "_YASM")
|
||||
include(CMakeTestASMCompiler)
|
||||
set(ASM_DIALECT)
|
||||
+23
-32
@@ -1,54 +1,45 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/sh
|
||||
path="."
|
||||
if [ x"$1" != x ]; then
|
||||
path="$1"
|
||||
fi
|
||||
|
||||
versiongit() {
|
||||
gitbranch=`git rev-parse --abbrev-ref HEAD`
|
||||
gitversion=`git rev-parse HEAD`
|
||||
cat <<EOF > $path/comptime.h
|
||||
version() {
|
||||
cat <<EOF > "$path/comptime.h"
|
||||
|
||||
// Do not edit! This file was autogenerated
|
||||
// by the $0 script with git
|
||||
//
|
||||
const char* compbranch = "$gitbranch";
|
||||
const char* comprevision = "${gitversion:0:8}";
|
||||
const char* compbranch = "$1";
|
||||
const char* comprevision = "$2";
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
versiongit() {
|
||||
gitbranch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
gitversion="$(git rev-parse HEAD | cut -c -8)"
|
||||
version "$gitbranch" "$gitversion";
|
||||
exit 0
|
||||
}
|
||||
|
||||
versionsvn() {
|
||||
svnrevision=`svnversion -n $1`
|
||||
cat <<EOF > $path/comptime.h
|
||||
|
||||
// Do not edit! This file was autogenerated
|
||||
// by the $0 script with subversion
|
||||
//
|
||||
const char* compbranch = "Subversion";
|
||||
const char* comprevision = "r$svnrevision";
|
||||
EOF
|
||||
exit 0
|
||||
svnrevision="$(svnversion -n "$1")"
|
||||
version "Subversion" "r$svnrevision";
|
||||
exit 0
|
||||
}
|
||||
|
||||
versionfake() {
|
||||
cat <<EOF > $path/comptime.h
|
||||
|
||||
// Do not edit! This file was autogenerated
|
||||
// by the $0 script with an unknown or nonexist SCM
|
||||
//
|
||||
const char* compbranch = "Unknown";
|
||||
const char* comprevision = "illegal";
|
||||
EOF
|
||||
version "Unknown" "illegal";
|
||||
}
|
||||
|
||||
compversion() {
|
||||
touch $path/comptime.c
|
||||
versionfake
|
||||
test -d $path/.svn && versionsvn
|
||||
test -d $path/../.git && versiongit
|
||||
exit 1
|
||||
touch "$path/comptime.c"
|
||||
versionfake
|
||||
[ -d "$path/.svn" ] && versionsvn "$@"
|
||||
[ -d "$path/../.git" ] && versiongit
|
||||
exit 1
|
||||
}
|
||||
|
||||
test -f $path/comptime.c && compversion
|
||||
[ -f "$path/comptime.c" ] && compversion "$@"
|
||||
exit 2
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ LOCAL_SRC_FILES := am_map.c \
|
||||
android/i_system.c \
|
||||
android/i_video.c
|
||||
|
||||
LOCAL_CFLAGS += -DPLATFORM_ANDROID -DNONX86 -DLINUX -DDEBUGMODE -DNOASM -DNOPIX -DUNIXCOMMON -DNOTERMIOS
|
||||
LOCAL_CFLAGS += -DPLATFORM_ANDROID -DNONX86 -DLINUX -DDEBUGMODE -DNOPIX -DUNIXCOMMON -DNOTERMIOS
|
||||
|
||||
LOCAL_MODULE := libsrb2
|
||||
|
||||
|
||||
+2
-52
@@ -3,6 +3,7 @@
|
||||
# Core sources
|
||||
set(SRB2_CORE_SOURCES
|
||||
am_map.c
|
||||
args.c
|
||||
b_bot.c
|
||||
command.c
|
||||
comptime.c
|
||||
@@ -52,6 +53,7 @@ set(SRB2_CORE_SOURCES
|
||||
|
||||
set(SRB2_CORE_HEADERS
|
||||
am_map.h
|
||||
args.h
|
||||
b_bot.h
|
||||
byteptr.h
|
||||
command.h
|
||||
@@ -196,32 +198,6 @@ source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
|
||||
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
|
||||
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
|
||||
|
||||
|
||||
set(SRB2_ASM_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s
|
||||
)
|
||||
|
||||
set(SRB2_NASM_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tmap_mmx.nas
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tmap.nas
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND SRB2_NASM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tmap_vc.nas)
|
||||
endif()
|
||||
|
||||
set(SRB2_NASM_OBJECTS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tmap_mmx.obj
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tmap.obj
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND SRB2_NASM_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/tmap_vc.obj)
|
||||
endif()
|
||||
|
||||
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
|
||||
|
||||
|
||||
### Configuration
|
||||
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
|
||||
"Enable Lua interpreter support")
|
||||
@@ -239,10 +215,6 @@ set(SRB2_CONFIG_HAVE_CURL ON CACHE BOOL
|
||||
"Enable curl support, used for downloading files via HTTP.")
|
||||
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
|
||||
"Enable hardware rendering through OpenGL.")
|
||||
set(SRB2_CONFIG_USEASM OFF CACHE BOOL
|
||||
"Enable NASM tmap implementation for software mode speedup.")
|
||||
set(SRB2_CONFIG_YASM OFF CACHE BOOL
|
||||
"Use YASM in place of NASM.")
|
||||
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
||||
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
||||
|
||||
@@ -533,28 +505,6 @@ if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_USEASM})
|
||||
#SRB2_ASM_FLAGS can be used to pass flags to either nasm or yasm.
|
||||
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
set(SRB2_ASM_FLAGS "-DLINUX ${SRB2_ASM_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_YASM})
|
||||
set(CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS} nas)
|
||||
set(CMAKE_ASM_YASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
|
||||
enable_language(ASM_YASM)
|
||||
else()
|
||||
set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS} nas)
|
||||
set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
|
||||
enable_language(ASM_NASM)
|
||||
endif()
|
||||
set(SRB2_USEASM ON)
|
||||
add_definitions(-DUSEASM)
|
||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -msse3 -mfpmath=sse)
|
||||
else()
|
||||
set(SRB2_USEASM OFF)
|
||||
add_definitions(-DNONX86 -DNORUSEASM)
|
||||
endif()
|
||||
|
||||
# Targets
|
||||
|
||||
|
||||
+3
-36
@@ -62,7 +62,6 @@
|
||||
# Compile a debug version, add 'DEBUGMODE=1'
|
||||
# Compile with less warnings, add 'RELAXWARNINGS=1'
|
||||
# Generate compiler errors for most compiler warnings, add 'ERRORMODE=1'
|
||||
# Compile without NASM's tmap.nas, add 'NOASM=1'
|
||||
# Compile without 3D hardware support, add 'NOHW=1'
|
||||
# Compile with GDBstubs, add 'RDB=1'
|
||||
# Compile without PNG, add 'NOPNG=1'
|
||||
@@ -166,7 +165,6 @@ endif
|
||||
ifdef MINGW64
|
||||
MINGW=1
|
||||
NONX86=1
|
||||
NOASM=1
|
||||
# MINGW64 should not necessarily imply X86_64=1, but we make that assumption elsewhere
|
||||
# Once that changes, remove this
|
||||
X86_64=1
|
||||
@@ -189,7 +187,6 @@ NOPNG=1
|
||||
NOZLIB=1
|
||||
NONET=1
|
||||
NOHW=1
|
||||
NOASM=1
|
||||
NOIPX=1
|
||||
EXENAME?=srb2dummy
|
||||
OBJS=$(OBJDIR)/i_video.o
|
||||
@@ -198,7 +195,6 @@ endif
|
||||
|
||||
ifdef HAIKU
|
||||
NOIPX=1
|
||||
NOASM=1
|
||||
ifndef NONET
|
||||
LIBS=-lnetwork
|
||||
endif
|
||||
@@ -272,7 +268,6 @@ NOPNG=1
|
||||
NOZLIB=1
|
||||
NONET=1
|
||||
#NOHW=1
|
||||
NOASM=1
|
||||
NOIPX=1
|
||||
NONX86=1
|
||||
OBJS+=$(OBJDIR)/i_video.o
|
||||
@@ -300,7 +295,6 @@ endif
|
||||
MSGFMT?=msgfmt
|
||||
|
||||
ifndef ECHO
|
||||
NASM:=@$(NASM)
|
||||
REMOVE:=@$(REMOVE)
|
||||
CC:=@$(CC)
|
||||
CXX:=@$(CXX)
|
||||
@@ -355,12 +349,6 @@ ifdef X86_64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NOASM
|
||||
ifndef NONX86
|
||||
OBJS+=$(OBJDIR)/tmap.o $(OBJDIR)/tmap_mmx.o
|
||||
OPTS+=-DUSEASM
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NOPNG
|
||||
OPTS+=-DHAVE_PNG
|
||||
@@ -511,16 +499,6 @@ else
|
||||
endif
|
||||
CFLAGS+=-g $(OPTS) $(ARCHOPTS) $(WINDRESFLAGS)
|
||||
|
||||
ifdef YASM
|
||||
ifdef STABS
|
||||
NASMOPTS?= -g stabs
|
||||
else
|
||||
NASMOPTS?= -g dwarf2
|
||||
endif
|
||||
else
|
||||
NASMOPTS?= -g
|
||||
endif
|
||||
|
||||
ifdef PROFILEMODE
|
||||
# build with profiling information
|
||||
CFLAGS+=-pg
|
||||
@@ -624,8 +602,8 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/i_tcp.o \
|
||||
$(OBJDIR)/i_time.o \
|
||||
$(OBJDIR)/lzf.o \
|
||||
$(OBJDIR)/vid_copy.o \
|
||||
$(OBJDIR)/b_bot.o \
|
||||
$(OBJDIR)/args.o \
|
||||
$(i_cdmus_o) \
|
||||
$(i_net_o) \
|
||||
$(i_system_o) \
|
||||
@@ -700,9 +678,9 @@ cleandep:
|
||||
|
||||
pre-build:
|
||||
ifdef WINDOWSHELL
|
||||
-..\comptime.bat .
|
||||
-$(.)..\comptime.bat .
|
||||
else
|
||||
-@../comptime.sh .
|
||||
-$(.)../comptime.sh .
|
||||
endif
|
||||
|
||||
clean:
|
||||
@@ -717,11 +695,6 @@ ifdef CYGWIN32
|
||||
$(REMOVE) $(OBJDIR)/*.res
|
||||
endif
|
||||
|
||||
#make a big srb2.s that is the disasm of the exe (dos only ?)
|
||||
asm:
|
||||
$(CC) $(LDFLAGS) $(OBJS) -o $(OBJDIR)/tmp.exe $(LIBS)
|
||||
$(OBJDUMP) -d $(OBJDIR)/tmp.exe --no-show-raw-insn > srb2.s
|
||||
$(REMOVE) $(OBJDIR)/tmp.exe
|
||||
|
||||
# executable
|
||||
# NOTE: DJGPP's objcopy do not have --add-gnu-debuglink
|
||||
@@ -907,12 +880,6 @@ $(OBJDIR)/%.o: hardware/%.c
|
||||
$(OBJDIR)/%.o: blua/%.c
|
||||
$(CC) $(CFLAGS) $(LUA_CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.nas
|
||||
$(NASM) $(NASMOPTS) -o $@ -f $(NASMFORMAT) $<
|
||||
|
||||
$(OBJDIR)/vid_copy.o: vid_copy.s asm_defs.inc
|
||||
$(CC) $(OPTS) $(ASFLAGS) -x assembler-with-cpp -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.s
|
||||
$(CC) $(OPTS) -x assembler-with-cpp -c $< -o $@
|
||||
|
||||
|
||||
@@ -383,12 +383,6 @@ i_main_o=$(OBJDIR)/i_main.o
|
||||
#set OBJDIR and BIN's starting place
|
||||
OBJDIR=../objs
|
||||
BIN=../bin
|
||||
#Nasm ASM and rm
|
||||
ifdef YASM
|
||||
NASM?=yasm
|
||||
else
|
||||
NASM?=nasm
|
||||
endif
|
||||
REMOVE?=rm -f
|
||||
CP?=cp
|
||||
MKDIR?=mkdir -p
|
||||
@@ -406,7 +400,6 @@ endif
|
||||
#Interface Setup
|
||||
ifdef DJGPPDOS
|
||||
INTERFACE=djgppdos
|
||||
NASMFORMAT=coff
|
||||
OBJDIR:=$(OBJDIR)/djgppdos
|
||||
ifdef WATTCP
|
||||
OBJDIR:=$(OBJDIR)/wattcp
|
||||
@@ -420,7 +413,6 @@ ifdef DUMMY
|
||||
BIN:=$(BIN)/dummy
|
||||
else
|
||||
ifdef LINUX
|
||||
NASMFORMAT=elf -DLINUX
|
||||
SDL=1
|
||||
ifdef LINUX64
|
||||
OBJDIR:=$(OBJDIR)/Linux64
|
||||
@@ -432,7 +424,6 @@ endif
|
||||
else
|
||||
ifdef FREEBSD
|
||||
INTERFACE=sdl
|
||||
NASMFORMAT=elf -DLINUX
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/FreeBSD
|
||||
@@ -440,7 +431,6 @@ ifdef FREEBSD
|
||||
else
|
||||
ifdef SOLARIS
|
||||
INTERFACE=sdl
|
||||
NASMFORMAT=elf -DLINUX
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/Solaris
|
||||
@@ -448,7 +438,6 @@ ifdef SOLARIS
|
||||
else
|
||||
ifdef CYGWIN32
|
||||
INTERFACE=sdl
|
||||
NASMFORMAT=win32
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/cygwin
|
||||
@@ -456,7 +445,6 @@ ifdef CYGWIN32
|
||||
else
|
||||
ifdef MINGW64
|
||||
INTERFACE=win32
|
||||
#NASMFORMAT=win64
|
||||
OBJDIR:=$(OBJDIR)/Mingw64
|
||||
BIN:=$(BIN)/Mingw64
|
||||
else
|
||||
@@ -488,13 +476,11 @@ ifdef PS3N
|
||||
else
|
||||
ifdef MINGW
|
||||
INTERFACE=win32
|
||||
NASMFORMAT=win32
|
||||
OBJDIR:=$(OBJDIR)/Mingw
|
||||
BIN:=$(BIN)/Mingw
|
||||
else
|
||||
ifdef XBOX
|
||||
INTERFACE=sdl12
|
||||
NASMFORMAT=win32
|
||||
PREFIX?=/usr/local/openxdk/bin/i386-pc-xbox
|
||||
SDL=1
|
||||
SDL12=1
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file asm_defs.inc
|
||||
/// \brief must match the C structures
|
||||
|
||||
#ifndef __ASM_DEFS__
|
||||
#define __ASM_DEFS__
|
||||
|
||||
// this makes variables more noticable,
|
||||
// and make the label match with C code
|
||||
|
||||
// Linux, unlike DOS, has no "_" 19990119 by Kin
|
||||
// and nasm needs .data code segs under linux 20010210 by metzgermeister
|
||||
// FIXME: nasm ignores these settings, so I put the macros into the makefile
|
||||
#ifdef __ELF__
|
||||
#define C(label) label
|
||||
#define CODE_SEG .data
|
||||
#else
|
||||
#define C(label) _##label
|
||||
#define CODE_SEG .text
|
||||
#endif
|
||||
|
||||
/* This is a more readable way to access the arguments passed from C code */
|
||||
/* PLEASE NOTE: it is supposed that all arguments passed from C code are */
|
||||
/* 32bit integer (INT32, long, and most *pointers) */
|
||||
#define ARG1 8(%ebp)
|
||||
#define ARG2 12(%ebp)
|
||||
#define ARG3 16(%ebp)
|
||||
#define ARG4 20(%ebp)
|
||||
#define ARG5 24(%ebp)
|
||||
#define ARG6 28(%ebp)
|
||||
#define ARG7 32(%ebp)
|
||||
#define ARG8 36(%ebp)
|
||||
#define ARG9 40(%ebp) //(c)tm ... Allegro by Shawn Hargreaves.
|
||||
|
||||
#endif
|
||||
+11
-1
@@ -277,7 +277,7 @@ static xcommand_t *com_commands = NULL; // current commands
|
||||
|
||||
#define MAX_ARGS 80
|
||||
static size_t com_argc;
|
||||
static char *com_argv[MAX_ARGS];
|
||||
char *com_argv[MAX_ARGS];
|
||||
static const char *com_null_string = "";
|
||||
static char *com_args = NULL; // current command args or NULL
|
||||
|
||||
@@ -327,6 +327,16 @@ const char *COM_Argv(size_t arg)
|
||||
return com_argv[arg];
|
||||
}
|
||||
|
||||
/** Returns all of the console command arguments
|
||||
*
|
||||
* \return String pointer to the argv table.
|
||||
* \sa COM_ArgvList
|
||||
*/
|
||||
char **COM_ArgvList(void)
|
||||
{
|
||||
return com_argv;
|
||||
}
|
||||
|
||||
/** Gets all console command arguments.
|
||||
*
|
||||
* \return String pointer to all arguments for the last command.
|
||||
|
||||
@@ -33,8 +33,12 @@ typedef void (*com_func_t)(void);
|
||||
void COM_AddCommand(const char *name, com_func_t func);
|
||||
int COM_AddLuaCommand(const char *name);
|
||||
|
||||
#define MAX_ARGS 80
|
||||
extern char *com_argv[MAX_ARGS];
|
||||
|
||||
size_t COM_Argc(void);
|
||||
const char *COM_Argv(size_t arg); // if argv > argc, returns empty string
|
||||
char **COM_ArgvList(void);
|
||||
char *COM_Args(void);
|
||||
size_t COM_CheckParm(const char *check); // like M_CheckParm :)
|
||||
size_t COM_CheckPartialParm(const char *check);
|
||||
|
||||
+21
-14
@@ -23,6 +23,7 @@
|
||||
#include "g_input.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "keys.h"
|
||||
#include "r_main.h"
|
||||
#include "r_defs.h"
|
||||
#include "sounds.h"
|
||||
#include "st_stuff.h"
|
||||
@@ -602,32 +603,38 @@ static void CON_ChangeHeight(void)
|
||||
//
|
||||
static void CON_MoveConsole(void)
|
||||
{
|
||||
fixed_t conspeed;
|
||||
static fixed_t fracmovement = 0;
|
||||
|
||||
Lock_state();
|
||||
|
||||
conspeed = FixedDiv(cons_speed.value*vid.fdupy, FRACUNIT);
|
||||
|
||||
// instant
|
||||
if (!cons_speed.value)
|
||||
{
|
||||
con_curlines = con_destlines;
|
||||
Unlock_state();
|
||||
return;
|
||||
}
|
||||
|
||||
// up/down move to dest
|
||||
if (con_curlines < con_destlines)
|
||||
// Not instant - Increment fracmovement fractionally
|
||||
fracmovement += FixedMul(cons_speed.value*vid.fdupy, renderdeltatics);
|
||||
|
||||
if (con_curlines < con_destlines) // Move the console downwards
|
||||
{
|
||||
con_curlines += FixedInt(conspeed);
|
||||
if (con_curlines > con_destlines)
|
||||
con_curlines = con_destlines;
|
||||
con_curlines += FixedInt(fracmovement); // Move by fracmovement's integer value
|
||||
if (con_curlines > con_destlines) // If we surpassed the destination...
|
||||
con_curlines = con_destlines; // ...clamp to it!
|
||||
}
|
||||
else if (con_curlines > con_destlines)
|
||||
else // Move the console upwards
|
||||
{
|
||||
con_curlines -= FixedInt(conspeed);
|
||||
con_curlines -= FixedInt(fracmovement);
|
||||
if (con_curlines < con_destlines)
|
||||
con_curlines = con_destlines;
|
||||
|
||||
if (con_destlines == 0) // If the console is being closed, not just moved up...
|
||||
con_tick = 0; // ...don't show the blinking cursor
|
||||
}
|
||||
|
||||
fracmovement %= FRACUNIT; // Reset fracmovement's integer value, but keep the fraction
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
@@ -724,10 +731,6 @@ void CON_Ticker(void)
|
||||
CON_ChangeHeight();
|
||||
}
|
||||
|
||||
// console movement
|
||||
if (con_destlines != con_curlines)
|
||||
CON_MoveConsole();
|
||||
|
||||
// clip the view, so that the part under the console is not drawn
|
||||
con_clipviewtop = -1;
|
||||
if (cons_backpic.value) // clip only when using an opaque background
|
||||
@@ -1774,6 +1777,10 @@ void CON_Drawer(void)
|
||||
if (con_curlines <= 0)
|
||||
CON_ClearHUD();
|
||||
}
|
||||
|
||||
// console movement
|
||||
if (con_curlines != con_destlines)
|
||||
CON_MoveConsole();
|
||||
|
||||
if (con_curlines > 0)
|
||||
CON_DrawConsole();
|
||||
|
||||
+165
-8
@@ -49,6 +49,7 @@
|
||||
#include "m_anigif.h"
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "y_inter.h"
|
||||
#include "fastcmp.h"
|
||||
#include "m_perfstats.h"
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
@@ -141,6 +142,8 @@ static void Command_SetViews_f(void);
|
||||
|
||||
static void Command_Addfilelocal(void);
|
||||
static void Command_Addfile(void);
|
||||
static void Command_Addskins(void);
|
||||
static void Command_GLocalSkin(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
#ifdef DELFILE
|
||||
static void Command_Delfile(void);
|
||||
@@ -289,6 +292,8 @@ consvar_t cv_skin = {"skin", DEFAULTSKIN, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin_
|
||||
consvar_t cv_skin2 = {"skin2", DEFAULTSKIN2, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skin3 = {"skin3", DEFAULTSKIN3, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
// haha I've beaten you now, ONLINE
|
||||
consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -447,6 +452,7 @@ static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "
|
||||
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_forceskin = {"forceskin", "Off", CV_NETVAR|CV_CALL|CV_CHEAT, Forceskin_cons_t, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fakelocalskin = {"fakelocalskin", "None", CV_SAVE, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -468,6 +474,7 @@ consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0
|
||||
|
||||
static CV_PossibleValue_t pingmeasurement_cons_t[] = {{0, "Frames"}, {1, "Milliseconds"}, {0, NULL}};
|
||||
consvar_t cv_pingmeasurement = {"pingmeasurement", "Frames", CV_SAVE, pingmeasurement_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -643,6 +650,8 @@ void D_RegisterServerCommands(void)
|
||||
|
||||
COM_AddCommand("addfilelocal", Command_Addfilelocal);
|
||||
COM_AddCommand("addfile", Command_Addfile);
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("localskin", Command_GLocalSkin);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
|
||||
#ifdef DELFILE
|
||||
@@ -777,6 +786,9 @@ void D_RegisterServerCommands(void)
|
||||
CV_RegisterVar(&cv_showping);
|
||||
CV_RegisterVar(&cv_pingmeasurement);
|
||||
|
||||
CV_RegisterVar(&cv_luaimmersion);
|
||||
CV_RegisterVar(&cv_fakelocalskin);
|
||||
|
||||
CV_RegisterVar(&cv_minihead);
|
||||
CV_RegisterVar(&cv_showminimapnames);
|
||||
|
||||
@@ -885,6 +897,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_playername);
|
||||
CV_RegisterVar(&cv_playercolor);
|
||||
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
|
||||
CV_RegisterVar(&cv_localskin);
|
||||
// secondary player (splitscreen)
|
||||
CV_RegisterVar(&cv_playername2);
|
||||
CV_RegisterVar(&cv_playercolor2);
|
||||
@@ -4567,7 +4580,7 @@ static void Command_Addfile(void)
|
||||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||
if (!(netgame || multiplayer) || musiconly)
|
||||
{
|
||||
P_AddWadFile(fn);
|
||||
P_AddWadFile(fn, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4616,6 +4629,156 @@ static void Command_Addfile(void)
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
}
|
||||
|
||||
// i hate myself
|
||||
static boolean DumbStartsWith(const char *pre, const char *str)
|
||||
{
|
||||
size_t lenpre = strlen(pre),
|
||||
lenstr = strlen(str);
|
||||
return lenstr < lenpre ? false : memcmp(pre, str, lenpre) == 0;
|
||||
}
|
||||
|
||||
/** Adds something at runtime.
|
||||
*/
|
||||
static void
|
||||
Command_Addskins (void)
|
||||
{
|
||||
if (COM_Argc() > 3)
|
||||
{
|
||||
CONS_Printf(
|
||||
"addskins <file>: Load a skin file.\n");
|
||||
return;
|
||||
}
|
||||
// no forcing?
|
||||
/*
|
||||
if (fasticmp(COM_Argv(2), "-force") || fasticmp(COM_Argv(2), "-f")) {
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Adding file %s. May or may not be a skin.\n"), COM_Argv(1));
|
||||
P_AddWadFile(COM_Argv(1), 0, true);
|
||||
} else {
|
||||
if (DumbStartsWith("KC_", COM_Argv(1))) {
|
||||
P_AddWadFile(COM_Argv(1), 0, true);
|
||||
} else if (DumbStartsWith("KCL_", COM_Argv(1))) {
|
||||
if (!demo.playback) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is a skin with lua. Include -force or -f to force it to load.\n"), COM_Argv(1));
|
||||
return;
|
||||
} else {
|
||||
*/
|
||||
P_AddWadFile(COM_Argv(1), true);
|
||||
/*
|
||||
}
|
||||
} else {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is not a skin.\n"), COM_Argv(1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// args n stuff
|
||||
#include "args.h"
|
||||
|
||||
static void Command_GLocalSkin (void)
|
||||
{
|
||||
size_t first_option;
|
||||
size_t option_display;
|
||||
size_t option_all;
|
||||
size_t option_player;
|
||||
|
||||
option_player = COM_CheckPartialParm("-p");
|
||||
option_display = COM_CheckPartialParm("-d");
|
||||
option_all = COM_CheckPartialParm("-a");
|
||||
|
||||
char* fuck; // local skin name
|
||||
|
||||
if (!( first_option = COM_FirstOption() ))
|
||||
first_option = COM_Argc();
|
||||
|
||||
if (first_option < 2)
|
||||
{
|
||||
/* holy fucking shit */
|
||||
CONS_Printf("localskin <name> [-player <name>] [-display <number>] [-all]:\n");
|
||||
CONS_Printf(M_GetText("Set a localskin via its internal name (usually printed on the console).\n\n\
|
||||
* Using \"-player\" will set a localskin to a specified player.\n\
|
||||
Defaults to yourself.\n\
|
||||
* Using \"-display\" will set a localskin to the displayed player.\n\
|
||||
Defaults to 0, which is the first player displayed.\n\
|
||||
Can go up to 3 for splitscreen.\n\
|
||||
* Using \"-all\" will set a localskin to ALL players.\n\
|
||||
* \"localskin none\" removes the localskin, just like how\n\
|
||||
\"forceskin none\" does.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
fuck = ConcatCommandArgv(1, first_option);
|
||||
|
||||
char* player_name = player_names[consoleplayer];
|
||||
char* display_num = "0";
|
||||
size_t dnum = 0;
|
||||
|
||||
if (option_display) // -display
|
||||
{
|
||||
// handle default: 0
|
||||
if (COM_Argv(option_display + 1)[0] == "" || COM_Argv(option_display + 1)[0] != "-")
|
||||
display_num = COM_Argv(option_display + 1);
|
||||
|
||||
if (isdigit(display_num[0]) || display_num == "0")
|
||||
{
|
||||
dnum = atoi(display_num);
|
||||
if (dnum > 3 || dnum < 0) // nuh uh
|
||||
dnum = 0;
|
||||
SetLocalPlayerSkin(displayplayers[dnum], fuck, NULL);
|
||||
|
||||
CONS_Printf("Successfully applied localskin to displayed player.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Could not apply localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else if (option_all) // -all
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
SetLocalPlayerSkin(i, fuck, NULL);
|
||||
}
|
||||
CONS_Printf("Successfully applied localskin to all players.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else // -player or no other arguments
|
||||
{
|
||||
if (option_player)
|
||||
{
|
||||
int i;
|
||||
player_name = COM_Argv(option_player + 1);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (fasticmp(player_names[i], player_name))
|
||||
SetLocalPlayerSkin(i, fuck, NULL);
|
||||
}
|
||||
CONS_Printf("Successfully applied localskin to specified player.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalPlayerSkin(consoleplayer, fuck, &cv_localskin);
|
||||
CONS_Printf("Successfully applied localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CONS_Printf("Could not apply localskin.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
/** removes the last added pwad at runtime.
|
||||
* Searches for sounds, maps, music and images to remove
|
||||
@@ -4772,7 +4935,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
ncs = findfile(filename,md5sum,true);
|
||||
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename))
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename, false))
|
||||
{
|
||||
Command_ExitGame_f();
|
||||
if (ncs == FS_FOUND)
|
||||
@@ -4861,11 +5024,6 @@ static void Command_Version_f(void)
|
||||
else // 16-bit? 128-bit?
|
||||
CONS_Printf("Bits Unknown ");
|
||||
|
||||
// No ASM?
|
||||
#ifdef NOASM
|
||||
CONS_Printf("\x85" "NOASM " "\x80");
|
||||
#endif
|
||||
|
||||
// Debug build
|
||||
#ifdef _DEBUG
|
||||
CONS_Printf("\x85" "DEBUG " "\x80");
|
||||
@@ -5928,7 +6086,6 @@ static void Command_ListSkins(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Sends a color change for the console player, unless that player is moving.
|
||||
* \sa cv_playercolor, Color2_OnChange, Skin_OnChange
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
extern consvar_t cv_playername;
|
||||
extern consvar_t cv_playercolor;
|
||||
extern consvar_t cv_skin;
|
||||
extern consvar_t cv_localskin;
|
||||
// secondary splitscreen player
|
||||
extern consvar_t cv_playername2;
|
||||
extern consvar_t cv_playercolor2;
|
||||
@@ -157,6 +158,8 @@ extern consvar_t cv_minihead;
|
||||
extern consvar_t cv_showlapemblem;
|
||||
|
||||
extern consvar_t cv_showviewpointtext;
|
||||
extern consvar_t cv_luaimmersion;
|
||||
extern consvar_t cv_fakelocalskin;
|
||||
|
||||
extern consvar_t cv_skipmapcheck;
|
||||
|
||||
|
||||
+2
-2
@@ -513,7 +513,7 @@ INT32 CL_CheckFiles(void)
|
||||
|
||||
for (i = 0, j = mainwads+1; i < fileneedednum || j < numwadfiles;)
|
||||
{
|
||||
if (j < numwadfiles && !wadfiles[j]->important)
|
||||
if (j < numwadfiles && (!wadfiles[j]->important || wadfiles[j]->localfile))
|
||||
{
|
||||
// Unimportant on our side. still don't care.
|
||||
++j;
|
||||
@@ -562,7 +562,7 @@ INT32 CL_CheckFiles(void)
|
||||
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
|
||||
|
||||
// Check in already loaded files
|
||||
for (j = mainwads+1; wadfiles[j]; j++)
|
||||
for (j = mainwads+1; j < numwadfiles; j++)
|
||||
{
|
||||
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
||||
if (!stricmp(wadfilename, fileneeded[i].filename) &&
|
||||
|
||||
@@ -416,6 +416,8 @@ typedef struct player_s
|
||||
UINT8 skincolor;
|
||||
|
||||
INT32 skin;
|
||||
INT32 localskin;
|
||||
boolean skinlocal;
|
||||
|
||||
UINT32 score; // player score
|
||||
fixed_t dashspeed; // dashing speed
|
||||
|
||||
+2
-2
@@ -149,8 +149,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#define VERSIONSTRING "Saturn v2.1 "
|
||||
#define VERSIONSTRINGW L"Saturn v2.1"
|
||||
#define VERSIONSTRING "Saturn v3 "
|
||||
#define VERSIONSTRINGW L"Saturn v3"
|
||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||
// AND appveyor.yml, for the build bots!
|
||||
|
||||
@@ -850,6 +850,16 @@ void G_SetGameModified(boolean silent, boolean major)
|
||||
M_EndModeAttackRun();
|
||||
}
|
||||
|
||||
void G_SetWadModified(boolean silent, boolean major, UINT16 wadnum)
|
||||
{
|
||||
// now that we have a wad that is actually well, a gameplay changing mod
|
||||
// (for later)
|
||||
wadfiles[wadnum]->majormod = true;
|
||||
|
||||
// set our game to be marked as modified.
|
||||
G_SetGameModified(silent, major);
|
||||
}
|
||||
|
||||
/** Builds an original game map name from a map number.
|
||||
* The complexity is due to MAPA0-MAPZZ.
|
||||
*
|
||||
@@ -2706,6 +2716,8 @@ void G_PlayerReborn(INT32 player)
|
||||
UINT8 mare;
|
||||
UINT8 skincolor;
|
||||
INT32 skin;
|
||||
int localskin;
|
||||
boolean skinlocal;
|
||||
tic_t jointime;
|
||||
UINT8 splitscreenindex;
|
||||
boolean spectator;
|
||||
@@ -2752,6 +2764,8 @@ void G_PlayerReborn(INT32 player)
|
||||
|
||||
skincolor = players[player].skincolor;
|
||||
skin = players[player].skin;
|
||||
localskin = players[player].localskin;
|
||||
skinlocal = players[player].skinlocal;
|
||||
// SRB2kart
|
||||
kartspeed = players[player].kartspeed;
|
||||
kartweight = players[player].kartweight;
|
||||
@@ -2841,6 +2855,8 @@ void G_PlayerReborn(INT32 player)
|
||||
// save player config truth reborn
|
||||
p->skincolor = skincolor;
|
||||
p->skin = skin;
|
||||
p->localskin = localskin;
|
||||
p->skinlocal = skinlocal;
|
||||
// SRB2kart
|
||||
p->kartspeed = kartspeed;
|
||||
p->kartweight = kartweight;
|
||||
|
||||
@@ -403,6 +403,7 @@ boolean G_GetRetryFlag(void);
|
||||
void G_LoadGameData(void);
|
||||
void G_LoadGameSettings(void);
|
||||
|
||||
void G_SetWadModified(boolean silent, boolean major, UINT16 wadnum);
|
||||
void G_SetGameModified(boolean silent, boolean major);
|
||||
|
||||
void G_SetGamestate(gamestate_t newstate);
|
||||
|
||||
+21
-13
@@ -3968,7 +3968,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
||||
GLPatch_t *gpatch;
|
||||
FSurfaceInfo Surf;
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->flags & SF_HIRES);
|
||||
extracolormap_t *colormap;
|
||||
FUINT lightlevel;
|
||||
FBITFIELD blend = 0;
|
||||
@@ -3992,7 +3992,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
|
||||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->highresscale);
|
||||
|
||||
gpatch = spr->gpatch; //W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
|
||||
|
||||
@@ -4314,11 +4314,11 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||
FOutVector wallVerts[4];
|
||||
GLPatch_t *gpatch; // sprite patch converted to hardware
|
||||
FSurfaceInfo Surf;
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->flags & SF_HIRES);
|
||||
if (spr->mobj)
|
||||
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->highresscale);
|
||||
|
||||
if (!spr->mobj)
|
||||
return;
|
||||
@@ -4865,8 +4865,19 @@ void HWR_DrawSprites(void)
|
||||
else
|
||||
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
md2_t *md2;
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
md2 = &md2_localplayermodels[(skin_t *)spr->mobj->localskin - localskins];
|
||||
else
|
||||
md2 = &md2_playermodels [(skin_t *)spr->mobj->localskin - skins];
|
||||
}
|
||||
else
|
||||
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
|
||||
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (!cv_grmdls.value || ((md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) && ((!cv_grfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
if (!cv_grmdls.value || ((md2->notfound || md2->scale < 0.0f) && ((!cv_grfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
@@ -5113,7 +5124,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)thing->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef;
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[thing->sprite];
|
||||
#endif
|
||||
@@ -5188,8 +5199,8 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
}
|
||||
}
|
||||
|
||||
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)thing->skin)->highresscale);
|
||||
if (thing->skin && ((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->flags & SF_HIRES)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->highresscale);
|
||||
|
||||
spr_width = spritecachedinfo[lumpoff].width;
|
||||
spr_height = spritecachedinfo[lumpoff].height;
|
||||
@@ -5348,10 +5359,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
if (thing->colorized)
|
||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE);
|
||||
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
|
||||
{
|
||||
size_t skinnum = (skin_t*)thing->skin-skins;
|
||||
vis->colormap = R_GetTranslationColormap((INT32)skinnum, thing->color, GTC_CACHE);
|
||||
}
|
||||
vis->colormap = R_GetLocalTranslationColormap(thing->skin, thing->localskin, thing->color, GTC_CACHE, thing->skinlocal);
|
||||
else
|
||||
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, thing->color, GTC_CACHE);
|
||||
}
|
||||
@@ -6202,7 +6210,7 @@ void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
// Armageddon Blast Flash!
|
||||
// Could this even be considered postprocessor?
|
||||
if (player->flashcount && !cv_grpaletteshader.value || player->flashcount && cv_grpaletteshader.value && !cv_grflashpal.value)
|
||||
if ((player->flashcount && !cv_grpaletteshader.value) || (player->flashcount && cv_grpaletteshader.value && !cv_grflashpal.value))
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
+46
-14
@@ -75,6 +75,7 @@
|
||||
|
||||
md2_t md2_models[NUMSPRITES];
|
||||
md2_t md2_playermodels[MAXSKINS];
|
||||
md2_t md2_localplayermodels[MAXSKINS];
|
||||
|
||||
|
||||
/*
|
||||
@@ -487,6 +488,13 @@ void HWR_InitMD2(void)
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
|
||||
md2_localplayermodels[s].scale = -1.0f;
|
||||
md2_localplayermodels[s].model = NULL;
|
||||
md2_localplayermodels[s].grpatch = NULL;
|
||||
md2_localplayermodels[s].skin = -1;
|
||||
md2_localplayermodels[s].notfound = true;
|
||||
md2_localplayermodels[s].error = false;
|
||||
}
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
@@ -559,11 +567,12 @@ md2found:
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
|
||||
void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added after startup
|
||||
{
|
||||
FILE *f;
|
||||
char name[20], filename[32];
|
||||
float scale, offset;
|
||||
md2_t *md2s;
|
||||
|
||||
if (nomd2s)
|
||||
return;
|
||||
@@ -585,22 +594,23 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
|
||||
}
|
||||
}
|
||||
|
||||
// Check for any MD2s that match the names of sprite names!
|
||||
md2s = ( (local) ? md2_localplayermodels : md2_playermodels );
|
||||
// Check for any MD2s that match the names of player skins!
|
||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
{
|
||||
if (stricmp(name, skins[skin].name) == 0)
|
||||
if (stricmp(name, ( (local) ? localskins : skins )[skin].name) == 0)
|
||||
{
|
||||
md2_playermodels[skin].skin = skin;
|
||||
md2_playermodels[skin].scale = scale;
|
||||
md2_playermodels[skin].offset = offset;
|
||||
md2_playermodels[skin].notfound = false;
|
||||
strcpy(md2_playermodels[skin].filename, filename);
|
||||
md2s[skin].skin = skin;
|
||||
md2s[skin].scale = scale;
|
||||
md2s[skin].offset = offset;
|
||||
md2s[skin].notfound = false;
|
||||
strcpy(md2s[skin].filename, filename);
|
||||
goto playermd2found;
|
||||
}
|
||||
}
|
||||
|
||||
//CONS_Printf("MD2 for player skin %s not found\n", skins[skin].name);
|
||||
md2_playermodels[skin].notfound = true;
|
||||
md2s[skin].notfound = true;
|
||||
playermd2found:
|
||||
fclose(f);
|
||||
}
|
||||
@@ -1154,6 +1164,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
md2_t *md2s;
|
||||
int skinnum;
|
||||
|
||||
// Apparently people don't like jump frames like that, so back it goes
|
||||
//if (tics > durs)
|
||||
@@ -1168,13 +1180,33 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
|
||||
/* fuck you */
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
{
|
||||
md2s = md2_localplayermodels;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - localskins;
|
||||
}
|
||||
else
|
||||
{
|
||||
md2s = md2_playermodels;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - skins;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
md2s = md2_playermodels;
|
||||
skinnum = (skin_t *)spr->mobj->skin - skins;
|
||||
}
|
||||
|
||||
// 1. load model+texture if not already loaded
|
||||
// 2. draw model with correct position, rotation,...
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && !md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound) // Use the player MD2 list if the mobj has a skin and is using the player sprites
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && !md2s[skinnum].notfound) // Use the player MD2 list if the mobj has a skin and is using the player sprites
|
||||
{
|
||||
md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins];
|
||||
md2->skin = (skin_t*)spr->mobj->skin-skins;
|
||||
md2 = &md2s[skinnum];
|
||||
md2->skin = skinnum;
|
||||
sprinfo = &spriteinfo[spr->mobj->sprite];
|
||||
}
|
||||
else
|
||||
@@ -1239,7 +1271,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
skinnum = TC_RAINBOW;
|
||||
else
|
||||
{
|
||||
skinnum = (INT32)((skin_t*)spr->mobj->skin-skins);
|
||||
skinnum = (INT32)((skin_t*)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ) - ( (spr->mobj->skinlocal) ? localskins : skins ));
|
||||
}
|
||||
}
|
||||
else skinnum = TC_DEFAULT;
|
||||
@@ -1306,7 +1338,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
p.z = FIXED_TO_FLOAT(interp.z);
|
||||
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
sprdef = &((skin_t *)spr->mobj->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->spritedef;
|
||||
else
|
||||
sprdef = &sprites[spr->mobj->sprite];
|
||||
|
||||
|
||||
@@ -37,10 +37,11 @@ typedef struct
|
||||
|
||||
extern md2_t md2_models[NUMSPRITES];
|
||||
extern md2_t md2_playermodels[MAXSKINS];
|
||||
extern md2_t md2_localplayermodels[MAXSKINS];
|
||||
|
||||
void HWR_InitMD2(void);
|
||||
void HWR_DrawMD2(gr_vissprite_t *spr);
|
||||
void HWR_AddPlayerMD2(INT32 skin);
|
||||
void HWR_AddPlayerMD2(INT32 skin, boolean local);
|
||||
void HWR_AddSpriteMD2(size_t spritenum);
|
||||
|
||||
#endif // _HW_MD2_H_
|
||||
+27
-12
@@ -504,7 +504,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
||||
|
||||
\return void
|
||||
*/
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color)
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 starttranscolor;
|
||||
@@ -540,7 +540,7 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color)
|
||||
return;
|
||||
}
|
||||
|
||||
starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
||||
starttranscolor = (skinnum != TC_DEFAULT) ? ( (local) ? localskins : skins )[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
||||
|
||||
// Fill in the entries of the palette that are fixed
|
||||
for (i = 0; i < starttranscolor; i++)
|
||||
@@ -8098,7 +8098,11 @@ static boolean K_drawKartPositionFaces(void)
|
||||
else
|
||||
colormap = R_GetTranslationColormap(players[rankplayer[i]].skin, players[rankplayer[i]].mo->color, GTC_CACHE);
|
||||
|
||||
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, facerankprefix[players[rankplayer[i]].skin], colormap);
|
||||
{
|
||||
player_t *p;
|
||||
p = &players[rankplayer[i]];
|
||||
V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_battlebumpers))
|
||||
@@ -8184,7 +8188,11 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
||||
else
|
||||
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE);
|
||||
|
||||
V_DrawMappedPatch(x, y-4, 0, facerankprefix[players[tab[i].num].skin], colormap);
|
||||
{
|
||||
player_t *p;
|
||||
p = &players[tab[i].num];
|
||||
V_DrawMappedPatch(x, y-4, 0, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap);
|
||||
}
|
||||
/*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this
|
||||
{
|
||||
INT32 bumperx = x+19;
|
||||
@@ -8531,7 +8539,7 @@ static void K_drawKartWanted(void)
|
||||
if (players[battlewanted[i]].skincolor)
|
||||
{
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? ( (p->skinlocal) ? localfacewantprefix : facewantprefix )[( (p->localskin) ? p->localskin-1 : p->skin )] : ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )]), colormap);
|
||||
/*if (basey2) // again with 4p stuff
|
||||
V_DrawFixedPatch(x<<FRACBITS, (y - (basey-basey2))<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);*/
|
||||
}
|
||||
@@ -8598,6 +8606,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
|
||||
// it, they wouldn't 'spawn' on the top-right side of the HUD.
|
||||
|
||||
UINT8 skin = 0;
|
||||
boolean skinlocal = mo->skinlocal;
|
||||
|
||||
fixed_t amnumxpos, amnumypos;
|
||||
INT32 amxpos, amypos;
|
||||
@@ -8610,7 +8619,7 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
|
||||
fixed_t xscale, yscale, zoom;
|
||||
|
||||
if (mo->skin)
|
||||
skin = ((skin_t*)mo->skin)-skins;
|
||||
skin = ((skin_t*)( (mo->localskin) ? mo->localskin : mo->skin ))-( (skinlocal) ? localskins : skins );
|
||||
|
||||
maxx = maxy = INT32_MAX;
|
||||
minx = miny = INT32_MIN;
|
||||
@@ -8654,20 +8663,26 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
|
||||
if (encoremode)
|
||||
amnumxpos = -amnumxpos;
|
||||
|
||||
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (facemmapprefix[skin]->width/2))<<FRACBITS);
|
||||
amypos = amnumypos + ((y + AutomapPic->height/2 - (facemmapprefix[skin]->height/2))<<FRACBITS);
|
||||
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->width/2))<<FRACBITS);
|
||||
amypos = amnumypos + ((y + AutomapPic->height/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->height/2))<<FRACBITS);
|
||||
|
||||
if (!mo->color) // 'default' color
|
||||
V_DrawSciencePatch(amxpos, amypos, flags, facemmapprefix[skin], FRACUNIT);
|
||||
V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT);
|
||||
else
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap((mo->colorized) ? TC_RAINBOW : skin, mo->color, GTC_CACHE);
|
||||
|
||||
if (cv_minihead.value == 1)
|
||||
V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, facemmapprefix[skin], colormap);
|
||||
{
|
||||
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
|
||||
V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT/2, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap);
|
||||
}
|
||||
else if (cv_minihead.value == 0)
|
||||
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, facemmapprefix[skin], colormap);
|
||||
|
||||
{
|
||||
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
|
||||
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap);
|
||||
}
|
||||
|
||||
if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK))
|
||||
{
|
||||
const char *player_name = va("%c%s", V_GetSkincolorChar(mo->color), player_names[mo->player - players]);
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ extern UINT8 colortranslations[MAXTRANSLATIONS][16];
|
||||
extern const char *KartColor_Names[MAXSKINCOLORS];
|
||||
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
|
||||
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color);
|
||||
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
|
||||
UINT8 K_GetKartColorByName(const char *name);
|
||||
|
||||
void K_RegisterKartStuff(void);
|
||||
|
||||
+11
-1
@@ -640,6 +640,8 @@ static int libd_drawPingNum(lua_State *L)
|
||||
{
|
||||
INT32 x, y, flags, num;
|
||||
const UINT8 *colormap = NULL;
|
||||
huddrawlist_h list;
|
||||
|
||||
HUDONLY
|
||||
x = luaL_checkinteger(L, 1);
|
||||
y = luaL_checkinteger(L, 2);
|
||||
@@ -649,7 +651,15 @@ static int libd_drawPingNum(lua_State *L)
|
||||
if (!lua_isnoneornil(L, 5))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
||||
|
||||
V_DrawPingNum(x, y, flags, num, colormap);
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
list = (huddrawlist_h) lua_touserdata(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list))
|
||||
LUA_HUD_AddDrawPingNum(list, x, y, num, flags, colormap);
|
||||
else
|
||||
V_DrawPingNum(x, y, flags, num, colormap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ enum drawitem_e {
|
||||
DI_DrawScaled,
|
||||
DI_DrawNum,
|
||||
DI_DrawPaddedNum,
|
||||
DI_DrawPingNum,
|
||||
DI_DrawFill,
|
||||
DI_DrawString,
|
||||
DI_DrawKartString,
|
||||
@@ -45,7 +46,7 @@ typedef struct drawitem_s {
|
||||
INT32 flags;
|
||||
UINT16 basecolor;
|
||||
UINT16 outlinecolor;
|
||||
UINT8 *colormap;
|
||||
const UINT8 *colormap;
|
||||
UINT8 *basecolormap;
|
||||
UINT8 *outlinecolormap;
|
||||
fixed_t sx;
|
||||
@@ -84,7 +85,7 @@ huddrawlist_h LUA_HUD_CreateDrawList(void)
|
||||
{
|
||||
huddrawlist_h drawlist;
|
||||
|
||||
drawlist = (huddrawlist_h) Z_CallocAlign(sizeof(struct huddrawlist_s), PU_STATIC, NULL, 64);
|
||||
drawlist = (huddrawlist_h) Z_Calloc(sizeof(struct huddrawlist_s), PU_STATIC, NULL);
|
||||
drawlist->items = NULL;
|
||||
drawlist->items_capacity = 0;
|
||||
drawlist->items_len = 0;
|
||||
@@ -145,7 +146,7 @@ static size_t AllocateDrawItem(huddrawlist_h list)
|
||||
{
|
||||
if (list->items_capacity == 0) list->items_capacity = 128;
|
||||
else list->items_capacity *= 2;
|
||||
list->items = (drawitem_t *) Z_ReallocAlign(list->items, sizeof(struct drawitem_s) * list->items_capacity, PU_STATIC, NULL, 64);
|
||||
list->items = (drawitem_t *) Z_Realloc(list->items, sizeof(struct drawitem_s) * list->items_capacity, PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
return list->items_len++;
|
||||
@@ -164,7 +165,7 @@ static size_t CopyString(huddrawlist_h list, const char* str)
|
||||
{
|
||||
if (list->strbuf_capacity == 0) list->strbuf_capacity = 256;
|
||||
else list->strbuf_capacity *= 2;
|
||||
list->strbuf = (char*) Z_ReallocAlign(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL, 8);
|
||||
list->strbuf = (char*) Z_Realloc(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -251,6 +252,25 @@ void LUA_HUD_AddDrawPaddedNum(
|
||||
item->flags = flags;
|
||||
}
|
||||
|
||||
void LUA_HUD_AddDrawPingNum(
|
||||
huddrawlist_h list,
|
||||
INT32 x,
|
||||
INT32 y,
|
||||
INT32 num,
|
||||
INT32 flags,
|
||||
const UINT8 *colormap
|
||||
)
|
||||
{
|
||||
size_t i = AllocateDrawItem(list);
|
||||
drawitem_t *item = &list->items[i];
|
||||
item->type = DI_DrawPingNum;
|
||||
item->x = x;
|
||||
item->y = y;
|
||||
item->num = num;
|
||||
item->flags = flags;
|
||||
item->colormap = colormap;
|
||||
}
|
||||
|
||||
void LUA_HUD_AddDrawFill(
|
||||
huddrawlist_h list,
|
||||
INT32 x,
|
||||
@@ -363,6 +383,9 @@ void LUA_HUD_DrawList(huddrawlist_h list)
|
||||
case DI_DrawPaddedNum:
|
||||
V_DrawPaddedTallNum(item->x, item->y, item->flags, item->num, item->digits);
|
||||
break;
|
||||
case DI_DrawPingNum:
|
||||
V_DrawPingNum(item->x, item->y, item->flags, item->num, item->colormap);
|
||||
break;
|
||||
case DI_DrawFill:
|
||||
V_DrawFill(item->x, item->y, item->w, item->h, item->c);
|
||||
break;
|
||||
|
||||
@@ -66,6 +66,14 @@ void LUA_HUD_AddDrawPaddedNum(
|
||||
INT32 digits,
|
||||
INT32 flags
|
||||
);
|
||||
void LUA_HUD_AddDrawPingNum(
|
||||
huddrawlist_h list,
|
||||
INT32 x,
|
||||
INT32 y,
|
||||
INT32 num,
|
||||
INT32 flags,
|
||||
const UINT8 *colormap
|
||||
);
|
||||
void LUA_HUD_AddDrawFill(
|
||||
huddrawlist_h list,
|
||||
INT32 x,
|
||||
|
||||
+14
-4
@@ -20,6 +20,8 @@
|
||||
#include "p_local.h"
|
||||
#include "g_game.h"
|
||||
#include "p_setup.h"
|
||||
#include "doomdef.h"
|
||||
#include "d_netcmd.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
@@ -363,8 +365,14 @@ int mobj_skin_getter(lua_State *L)
|
||||
if (!mo->skin)
|
||||
return 0;
|
||||
|
||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||
|
||||
if (hud_running && cv_luaimmersion.value) {
|
||||
if (mo->localskin) // HUD ONLY!!!!!!!!!!
|
||||
lua_pushstring(L, ((skin_t *)mo->localskin)->name);
|
||||
else
|
||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||
} else {
|
||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -376,7 +384,7 @@ int mobj_skin_setter(lua_State *L)
|
||||
char skin[SKINNAMESIZE+1]; // all skin names are limited to this length
|
||||
strlcpy(skin, luaL_checkstring(L, 2), sizeof skin);
|
||||
strlwr(skin); // all skin names are lowercase
|
||||
for (i = 0; i < numskins; i++)
|
||||
for (i = 0; i < numskins; i++) {
|
||||
{
|
||||
if (fastcmp(skins[i].name, skin))
|
||||
{
|
||||
@@ -385,7 +393,9 @@ int mobj_skin_setter(lua_State *L)
|
||||
}
|
||||
}
|
||||
|
||||
return luaL_error(L, "mobj.skin '%s' not found!", skin);
|
||||
}
|
||||
|
||||
return luaL_error(L, "mobj.skin '%s' not found!", skin);
|
||||
}
|
||||
|
||||
int mobj_color_setter(lua_State *L)
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
|
||||
LUA_LoadFile(&f, name); // actually load file!
|
||||
|
||||
// Okay, we've modified the game beyond the point of no return.
|
||||
G_SetGameModified(multiplayer, true);
|
||||
G_SetWadModified(multiplayer, true, wad);
|
||||
|
||||
free(name);
|
||||
Z_Free(f.data);
|
||||
|
||||
+9
-9
@@ -166,14 +166,14 @@ static int lib_iterateSkins(lua_State *L)
|
||||
lua_remove(L, 1); // state is unused.
|
||||
|
||||
if (!lua_isnil(L, 1))
|
||||
i = (INT32)(*((skin_t **)luaL_checkudata(L, 1, META_SKIN)) - skins) + 1;
|
||||
i = (INT32)(*((skin_t **)luaL_checkudata(L, 1, META_SKIN)) - allskins) + 1;
|
||||
else
|
||||
i = 0;
|
||||
|
||||
// skins are always valid, only added, never removed
|
||||
if (i < numskins)
|
||||
if (i < numallskins)
|
||||
{
|
||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||
LUA_PushUserdata(L, &allskins[i], META_SKIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -191,9 +191,9 @@ static int lib_getSkin(lua_State *L)
|
||||
i = luaL_checkinteger(L, 2);
|
||||
if (i < 0 || i >= MAXSKINS)
|
||||
return luaL_error(L, "skins[] index %d out of range (0 - %d)", i, MAXSKINS-1);
|
||||
if (i >= numskins)
|
||||
if (i >= numallskins)
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||
LUA_PushUserdata(L, &allskins[i], META_SKIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -207,10 +207,10 @@ static int lib_getSkin(lua_State *L)
|
||||
}
|
||||
|
||||
// find skin by name
|
||||
for (i = 0; i < numskins; i++)
|
||||
if (fastcmp(skins[i].name, field))
|
||||
for (i = 0; i < numallskins; i++)
|
||||
if (fastcmp(allskins[i].name, field))
|
||||
{
|
||||
LUA_PushUserdata(L, &skins[i], META_SKIN);
|
||||
LUA_PushUserdata(L, &allskins[i], META_SKIN);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ static int lib_getSkin(lua_State *L)
|
||||
|
||||
static int lib_numSkins(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, numskins);
|
||||
lua_pushinteger(L, numallskins);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,50 +23,6 @@
|
||||
#include "m_fixed.h"
|
||||
#include "tables.h" // ANGLETOFINESHIFT
|
||||
|
||||
#ifdef __USE_C_FIXEDMUL__
|
||||
|
||||
/** \brief The FixedMul function
|
||||
|
||||
\param a fixed_t number
|
||||
\param b fixed_t number
|
||||
|
||||
\return a*b>>FRACBITS
|
||||
|
||||
*/
|
||||
fixed_t FixedMul(fixed_t a, fixed_t b)
|
||||
{
|
||||
// Need to cast to unsigned before shifting to avoid undefined behaviour
|
||||
// for negative integers
|
||||
return (fixed_t)(((UINT64)((INT64)a * b)) >> FRACBITS);
|
||||
}
|
||||
|
||||
#endif //__USE_C_FIXEDMUL__
|
||||
|
||||
#ifdef __USE_C_FIXEDDIV__
|
||||
/** \brief The FixedDiv2 function
|
||||
|
||||
\param a fixed_t number
|
||||
\param b fixed_t number
|
||||
|
||||
\return a/b * FRACUNIT
|
||||
|
||||
*/
|
||||
fixed_t FixedDiv2(fixed_t a, fixed_t b)
|
||||
{
|
||||
INT64 ret;
|
||||
|
||||
if (b == 0)
|
||||
I_Error("FixedDiv: divide by zero");
|
||||
|
||||
ret = (((INT64)a * FRACUNIT)) / b;
|
||||
|
||||
if ((ret > INT32_MAX) || (ret < INT32_MIN))
|
||||
I_Error("FixedDiv: divide by zero");
|
||||
return (fixed_t)ret;
|
||||
}
|
||||
|
||||
#endif // __USE_C_FIXEDDIV__
|
||||
|
||||
fixed_t FixedSqrt(fixed_t x)
|
||||
{
|
||||
#ifdef HAVE_SQRT
|
||||
|
||||
+22
-113
@@ -62,126 +62,35 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f)
|
||||
#define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT))
|
||||
|
||||
|
||||
#if defined (__WATCOMC__) && FRACBITS == 16
|
||||
#pragma aux FixedMul = \
|
||||
"imul ebx", \
|
||||
"shrd eax,edx,16" \
|
||||
parm [eax] [ebx] \
|
||||
value [eax] \
|
||||
modify exact [eax edx]
|
||||
/** \brief The FixedMul function
|
||||
|
||||
#pragma aux FixedDiv2 = \
|
||||
"cdq", \
|
||||
"shld edx,eax,16", \
|
||||
"sal eax,16", \
|
||||
"idiv ebx" \
|
||||
parm [eax] [ebx] \
|
||||
value [eax] \
|
||||
modify exact [eax edx]
|
||||
#elif defined (__GNUC__) && defined (__i386__) && !defined (NOASM)
|
||||
// DJGPP, i386 linux, cygwin or mingw
|
||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // asm
|
||||
{
|
||||
fixed_t ret;
|
||||
asm
|
||||
(
|
||||
"imull %2;" // a*b
|
||||
"shrdl %3,%%edx,%0;" // shift logical right FRACBITS bits
|
||||
:"=a" (ret) // eax is always the result and the first operand (%0,%1)
|
||||
:"0" (a), "r" (b) // and %2 is what we use imull on with what in %1
|
||||
, "I" (FRACBITS) // %3 holds FRACBITS (normally 16)
|
||||
:"cc", "%edx" // edx and condition codes clobbered
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
\param a fixed_t number
|
||||
\param b fixed_t number
|
||||
|
||||
FUNCMATH FUNCINLINE static inline fixed_t FixedDiv2(fixed_t a, fixed_t b)
|
||||
{
|
||||
fixed_t ret;
|
||||
asm
|
||||
(
|
||||
"movl %1,%%edx;" // these two instructions allow the next two to pair, on the Pentium processor.
|
||||
"sarl $31,%%edx;" // shift arithmetic right 31 on EDX
|
||||
"shldl %3,%1,%%edx;" // DP shift logical left FRACBITS on EDX
|
||||
"sall %3,%0;" // shift arithmetic left FRACBITS on EAX
|
||||
"idivl %2;" // EDX/b = EAX
|
||||
: "=a" (ret)
|
||||
: "0" (a), "r" (b)
|
||||
, "I" (FRACBITS)
|
||||
: "%edx"
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
#elif defined (__GNUC__) && defined (__arm__) && !defined(__thumb__) && !defined(NOASM) //ARMv4 ASM
|
||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // let abuse smull
|
||||
{
|
||||
fixed_t ret;
|
||||
asm
|
||||
(
|
||||
"smull %[lo], r1, %[a], %[b];"
|
||||
"mov %[lo], %[lo], lsr %3;"
|
||||
"orr %[lo], %[lo], r1, lsl %3;"
|
||||
: [lo] "=&r" (ret) // rhi, rlo and rm must be distinct registers
|
||||
: [a] "r" (a), [b] "r" (b)
|
||||
, "i" (FRACBITS)
|
||||
: "r1"
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
\return a*b>>FRACBITS
|
||||
|
||||
#define __USE_C_FIXEDDIV__ // no double or asm div in ARM land
|
||||
#elif defined (__GNUC__) && defined (__ppc__) && !defined(NOASM) && 0 // WII: PPC CPU
|
||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // asm
|
||||
{
|
||||
fixed_t ret, hi, lo;
|
||||
asm
|
||||
(
|
||||
"mullw %0, %2, %3;"
|
||||
"mulhw %1, %2, %3"
|
||||
: "=r" (hi), "=r" (lo)
|
||||
: "r" (a), "r" (b)
|
||||
, "I" (FRACBITS)
|
||||
);
|
||||
ret = (INT64)((hi>>FRACBITS)+lo)<<FRACBITS;
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedMul(fixed_t a, fixed_t b)
|
||||
{
|
||||
// Need to cast to unsigned before shifting to avoid undefined behaviour
|
||||
// for negative integers
|
||||
return (fixed_t)(((UINT64)((INT64)a * b)) >> FRACBITS);
|
||||
}
|
||||
|
||||
#define __USE_C_FIXEDDIV__// Alam: I am lazy
|
||||
#elif defined (__GNUC__) && defined (__mips__) && !defined(NOASM) && 0 // PSP: MIPS CPU
|
||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // asm
|
||||
{
|
||||
fixed_t ret;
|
||||
asm
|
||||
(
|
||||
"mult %3, %4;" // a*b=h<32+l
|
||||
: "=r" (ret), "=l" (a), "=h" (b) //todo: abuse shr opcode
|
||||
: "0" (a), "r" (b)
|
||||
, "I" (FRACBITS)
|
||||
//: "+l", "+h"
|
||||
);
|
||||
ret = (INT64)((a>>FRACBITS)+b)<<FRACBITS;
|
||||
return ret;
|
||||
}
|
||||
/** \brief The FixedDiv2 function
|
||||
|
||||
#define __USE_C_FIXEDDIV__ // no 64b asm div in MIPS land
|
||||
#elif defined (__GNUC__) && defined (__sh__) && 0 // DC: SH4 CPU
|
||||
#elif defined (__GNUC__) && defined (__m68k__) && 0 // DEAD: Motorola 6800 CPU
|
||||
#elif defined (_MSC_VER) && defined(USEASM) && FRACBITS == 16
|
||||
// Microsoft Visual C++ (no asm inline)
|
||||
fixed_t __cdecl FixedMul(fixed_t a, fixed_t b);
|
||||
fixed_t __cdecl FixedDiv2(fixed_t a, fixed_t b);
|
||||
#else
|
||||
#define __USE_C_FIXEDMUL__
|
||||
#define __USE_C_FIXEDDIV__
|
||||
#endif
|
||||
\param a fixed_t number
|
||||
\param b fixed_t number
|
||||
|
||||
#ifdef __USE_C_FIXEDMUL__
|
||||
FUNCMATH fixed_t FixedMul(fixed_t a, fixed_t b);
|
||||
#endif
|
||||
\return a/b * FRACUNIT
|
||||
|
||||
#ifdef __USE_C_FIXEDDIV__
|
||||
FUNCMATH fixed_t FixedDiv2(fixed_t a, fixed_t b);
|
||||
#endif
|
||||
*/
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv2(fixed_t a, fixed_t b)
|
||||
{
|
||||
// This does not check for division overflow or division by 0!
|
||||
// That is the caller's responsibility.
|
||||
return (fixed_t)(((INT64)a * FRACUNIT) / b);
|
||||
}
|
||||
|
||||
/** \brief The FixedInt function
|
||||
|
||||
|
||||
+223
-16
@@ -145,6 +145,8 @@ INT32 mapwads[NUMMAPS];
|
||||
//static char *char_notes = NULL;
|
||||
//static fixed_t char_scroll = 0;
|
||||
|
||||
boolean browselocalskins = false;
|
||||
|
||||
boolean menuactive = false;
|
||||
boolean fromlevelselect = false;
|
||||
|
||||
@@ -234,6 +236,8 @@ menu_t SR_MainDef, SR_UnlockChecklistDef;
|
||||
static void M_SinglePlayerMenu(INT32 choice);
|
||||
#endif
|
||||
static void M_Options(INT32 choice);
|
||||
static void M_LocalSkinMenu(INT32 choice);
|
||||
static void M_LocalSkinChange(INT32 choice);
|
||||
static void M_Manual(INT32 choice);
|
||||
static void M_SelectableClearMenus(INT32 choice);
|
||||
static void M_Retry(INT32 choice);
|
||||
@@ -336,7 +340,9 @@ menu_t OP_MonitorToggleDef;
|
||||
static void M_ScreenshotOptions(INT32 choice);
|
||||
static void M_EraseData(INT32 choice);
|
||||
|
||||
static void M_AddonsInternal();
|
||||
static void M_Addons(INT32 choice);
|
||||
static void M_LocalSkins(INT32 choice);
|
||||
static void M_AddonsOptions(INT32 choice);
|
||||
static patch_t *addonsp[NUM_EXT+5];
|
||||
|
||||
@@ -350,6 +356,9 @@ menu_t OP_SaturnCreditsDef;
|
||||
|
||||
// Bird
|
||||
menu_t OP_BirdDef;
|
||||
// Stuff, yknow.
|
||||
menu_t OP_ForkedBirdDef;
|
||||
menu_t OP_LocalSkinDef;
|
||||
menu_t OP_TiltDef;
|
||||
menu_t OP_AdvancedBirdDef;
|
||||
|
||||
@@ -407,6 +416,7 @@ static void M_DrawConnectMenu(void);
|
||||
#endif
|
||||
static void M_DrawJoystick(void);
|
||||
static void M_DrawSetupMultiPlayerMenu(void);
|
||||
static void M_DrawLocalSkinMenu(void);
|
||||
|
||||
// Handling functions
|
||||
#ifndef NONET
|
||||
@@ -627,12 +637,13 @@ typedef enum
|
||||
// ---------------------
|
||||
static menuitem_t MPauseMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Addons...", M_Addons, 8},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 16},
|
||||
{IT_STRING | IT_CALL, NULL, "Switch Map..." , M_MapChange, 24},
|
||||
{IT_STRING | IT_CALL, NULL, "Addons...", M_Addons, 8},
|
||||
{IT_STRING | IT_CALL, NULL, "Add local skins...", M_LocalSkins, 16},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 24},
|
||||
{IT_STRING | IT_CALL, NULL, "Switch Map..." , M_MapChange, 32},
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Ask To Join Requests...", &MISC_DiscordRequestsDef, 24},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Ask To Join Requests...", &MISC_DiscordRequestsDef, 32},
|
||||
#endif
|
||||
|
||||
{IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus, 40},
|
||||
@@ -647,15 +658,17 @@ static menuitem_t MPauseMenu[] =
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Enter/Spectate...", &MISC_ChangeSpectateDef,48},
|
||||
{IT_CALL | IT_STRING, NULL, "Player Setup...", M_SetupMultiPlayer, 56}, // alone
|
||||
{IT_CALL | IT_STRING, NULL, "Options", M_Options, 64},
|
||||
{IT_CALL | IT_STRING, NULL, "Local Skin...", M_LocalSkinMenu, 64}, // alone
|
||||
{IT_CALL | IT_STRING, NULL, "Options", M_Options, 72},
|
||||
|
||||
{IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 80},
|
||||
{IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 88},
|
||||
{IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 88},
|
||||
{IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 96},
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
mpause_addons = 0,
|
||||
mpause_addlocalskins,
|
||||
mpause_scramble,
|
||||
mpause_switchmap,
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
@@ -674,6 +687,7 @@ typedef enum
|
||||
mpause_switchteam,
|
||||
mpause_switchspectate,
|
||||
mpause_psetup,
|
||||
mpause_localskin,
|
||||
mpause_options,
|
||||
|
||||
mpause_title,
|
||||
@@ -1128,6 +1142,7 @@ static menuitem_t OP_MainMenu[] =
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Options...", &OP_SaturnDef, 140},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Bird", &OP_BirdDef, 150},
|
||||
{IT_CALL|IT_STRING, NULL, "Local Skin Options...", M_LocalSkinMenu, 160},
|
||||
};
|
||||
|
||||
static menuitem_t OP_ControlsMenu[] =
|
||||
@@ -1817,6 +1832,17 @@ static menuitem_t OP_BirdMenu[] =
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120},
|
||||
};
|
||||
|
||||
static menuitem_t OP_ForkedBirdMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Local Skins", NULL, 0},
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Local Skin Name", &cv_fakelocalskin, 10},
|
||||
{IT_STRING2 | IT_SPACE, NULL, "Set to None for no Local Skin", NULL, 20},
|
||||
{IT_STRING | IT_CALL, NULL, "Apply to All Players", M_LocalSkinChange, 140},
|
||||
{IT_STRING | IT_CALL, NULL, "Apply to Displaying Player", M_LocalSkinChange, 150},
|
||||
{IT_STRING | IT_CALL, NULL, "Apply to Yourself", M_LocalSkinChange, 160},
|
||||
{IT_STRING | IT_CVAR, NULL, "Lua Immersion", &cv_luaimmersion, 170},
|
||||
};
|
||||
|
||||
static menuitem_t OP_TiltMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera Tilting", &cv_tilting, 0},
|
||||
@@ -2380,6 +2406,20 @@ menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30);
|
||||
menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60);
|
||||
menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60);
|
||||
|
||||
menu_t OP_ForkedBirdDef = {
|
||||
NULL,
|
||||
sizeof(OP_ForkedBirdMenu)/sizeof(menuitem_t),
|
||||
&OP_MainDef,
|
||||
OP_ForkedBirdMenu,
|
||||
M_DrawLocalSkinMenu,
|
||||
30, 6,
|
||||
0,
|
||||
NULL
|
||||
};
|
||||
|
||||
menu_t OP_LocalSkinDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_ForkedBirdDef, 30, 60);
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// CVAR ONCHANGE EVENTS GO HERE
|
||||
// ==========================================================================
|
||||
@@ -3593,14 +3633,16 @@ void M_StartControlPanel(void)
|
||||
|
||||
// Reset these in case splitscreen messes things up
|
||||
MPauseMenu[mpause_addons].alphaKey = 8;
|
||||
MPauseMenu[mpause_addlocalskins].alphaKey = 16;
|
||||
MPauseMenu[mpause_scramble].alphaKey = 8;
|
||||
MPauseMenu[mpause_switchmap].alphaKey = 24;
|
||||
|
||||
MPauseMenu[mpause_switchteam].alphaKey = 48;
|
||||
MPauseMenu[mpause_switchspectate].alphaKey = 48;
|
||||
MPauseMenu[mpause_options].alphaKey = 64;
|
||||
MPauseMenu[mpause_title].alphaKey = 80;
|
||||
MPauseMenu[mpause_quit].alphaKey = 88;
|
||||
MPauseMenu[mpause_localskin].alphaKey = 64;
|
||||
MPauseMenu[mpause_options].alphaKey = 72;
|
||||
MPauseMenu[mpause_title].alphaKey = 88;
|
||||
MPauseMenu[mpause_quit].alphaKey = 96;
|
||||
|
||||
Dummymenuplayer_OnChange();
|
||||
|
||||
@@ -3623,6 +3665,7 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU;
|
||||
MPauseMenu[mpause_switchteam].alphaKey += ((splitscreen+1) * 8);
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
@@ -3631,6 +3674,7 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_switchspectate].status = IT_STRING | IT_SUBMENU;
|
||||
MPauseMenu[mpause_switchspectate].alphaKey += ((splitscreen+1) * 8);
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
@@ -3641,6 +3685,7 @@ void M_StartControlPanel(void)
|
||||
{
|
||||
MPauseMenu[mpause_psetupsplit3].status = IT_STRING | IT_CALL;
|
||||
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
@@ -3648,6 +3693,7 @@ void M_StartControlPanel(void)
|
||||
if (splitscreen > 2)
|
||||
{
|
||||
MPauseMenu[mpause_psetupsplit4].status = IT_STRING | IT_CALL;
|
||||
MPauseMenu[mpause_localskin].alphaKey += 8;
|
||||
MPauseMenu[mpause_options].alphaKey += 8;
|
||||
MPauseMenu[mpause_title].alphaKey += 8;
|
||||
MPauseMenu[mpause_quit].alphaKey += 8;
|
||||
@@ -4288,7 +4334,7 @@ static void M_DrawGenericMenu(void)
|
||||
y += STRINGHEIGHT;
|
||||
break;
|
||||
case IT_STRING2:
|
||||
V_DrawString(x, y, lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(((BASEVIDWIDTH - V_StringWidth(currentMenu->menuitems[i].text, 0))>>1), y, 0, currentMenu->menuitems[i].text);
|
||||
/* FALLTHRU */
|
||||
case IT_DYLITLSPACE:
|
||||
y += SMALLLINEHEIGHT;
|
||||
@@ -5115,12 +5161,10 @@ static void M_AddonsOptions(INT32 choice)
|
||||
#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make addons!"
|
||||
#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make addons!"
|
||||
|
||||
static void M_Addons(INT32 choice)
|
||||
static void M_AddonsInternal()
|
||||
{
|
||||
const char *pathname = ".";
|
||||
|
||||
(void)choice;
|
||||
|
||||
#if 1
|
||||
if (cv_addons_option.value == 0)
|
||||
pathname = usehome ? srb2home : srb2path;
|
||||
@@ -5181,6 +5225,20 @@ static void M_Addons(INT32 choice)
|
||||
M_SetupNextMenu(&MISC_AddonsDef);
|
||||
}
|
||||
|
||||
static void M_Addons(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
browselocalskins = false;
|
||||
M_AddonsInternal();
|
||||
}
|
||||
|
||||
static void M_LocalSkins(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
browselocalskins = true;
|
||||
M_AddonsInternal();
|
||||
}
|
||||
|
||||
#define width 4
|
||||
#define vpadding 27
|
||||
#define h (BASEVIDHEIGHT-(2*vpadding))
|
||||
@@ -5333,7 +5391,12 @@ static void M_DrawAddons(void)
|
||||
}
|
||||
|
||||
if (Playing())
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems.");
|
||||
{
|
||||
if (browselocalskins)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, V_ALLOWLOWERCASE, "Load \x83local skins\x80 from addons!");
|
||||
else
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems.");
|
||||
}
|
||||
else
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, 0, (recommendedflags == V_SKYMAP ? LOCATIONSTRING2 : LOCATIONSTRING1));
|
||||
|
||||
@@ -5504,6 +5567,14 @@ static boolean M_ChangeStringAddons(INT32 choice)
|
||||
}
|
||||
#undef len
|
||||
|
||||
// i hate myself
|
||||
static boolean DumbStartsWith(const char *pre, const char *str)
|
||||
{
|
||||
size_t lenpre = strlen(pre),
|
||||
lenstr = strlen(str);
|
||||
return lenstr < lenpre ? false : memcmp(pre, str, lenpre) == 0;
|
||||
}
|
||||
|
||||
static void M_HandleAddons(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
@@ -5622,7 +5693,16 @@ static void M_HandleAddons(INT32 choice)
|
||||
case EXT_KART:
|
||||
#endif
|
||||
case EXT_PK3:
|
||||
COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
|
||||
if (browselocalskins) {
|
||||
if (DumbStartsWith("KC_", dirmenu[dir_on[menudepthleft]]+DIR_STRING)) {
|
||||
M_StartMessage(va("%c%s\x80\nYou are loading a local skin.\nLocal skins will not be usable\nafter going back from\nthe title screen.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
|
||||
COM_BufAddText(va("addskins \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
|
||||
}
|
||||
else
|
||||
S_StartSound(NULL, sfx_s26d);
|
||||
}
|
||||
else
|
||||
COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
|
||||
break;
|
||||
default:
|
||||
S_StartSound(NULL, sfx_s26d);
|
||||
@@ -11900,6 +11980,133 @@ static void M_DrawHUDOptions(void)
|
||||
V_DrawRightAlignedString(x, y, highlightflags, "(");
|
||||
}
|
||||
|
||||
static void M_LocalSkinMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
multi_state = &states[mobjinfo[MT_PLAYER].seestate];
|
||||
multi_tics = multi_state->tics;
|
||||
|
||||
OP_ForkedBirdDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&OP_ForkedBirdDef);
|
||||
}
|
||||
|
||||
static void M_LocalSkinChange(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
switch (itemOn) {
|
||||
case 3:
|
||||
COM_BufAddText(va("localskin -a %s", cv_fakelocalskin.string));
|
||||
break;
|
||||
case 4:
|
||||
COM_BufAddText(va("localskin -d 0 %s", cv_fakelocalskin.string));
|
||||
break;
|
||||
case 5:
|
||||
COM_BufAddText(va("localskin %s", cv_fakelocalskin.string));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
S_StartSound(NULL, sfx_s221);
|
||||
}
|
||||
|
||||
// Display our localskin in our goofy ahhhh local skin menu
|
||||
static void M_DrawLocalSkinMenu(void)
|
||||
{
|
||||
INT32 mx, my, st, flags = 0;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
patch_t *patch;
|
||||
UINT8 frame;
|
||||
UINT8 skintodisplay;
|
||||
UINT32 speenframe;
|
||||
|
||||
mx = OP_ForkedBirdDef.x;
|
||||
my = OP_ForkedBirdDef.y;
|
||||
|
||||
// use generic drawer for cursor, items and title
|
||||
M_DrawGenericMenu();
|
||||
|
||||
#define charw 72
|
||||
|
||||
// anim the player in the box
|
||||
if (--multi_tics <= 0)
|
||||
{
|
||||
st = multi_state->nextstate;
|
||||
if (st != S_NULL)
|
||||
multi_state = &states[st];
|
||||
multi_tics = multi_state->tics;
|
||||
if (multi_tics == -1)
|
||||
multi_tics = 15;
|
||||
}
|
||||
|
||||
// skin 0 is default player sprite
|
||||
if (R_AnySkinAvailable(cv_fakelocalskin.string) != -1)
|
||||
{
|
||||
sprdef = &allskins[R_AnySkinAvailable(cv_fakelocalskin.string)].spritedef;
|
||||
skintodisplay = R_AnySkinAvailable(cv_fakelocalskin.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ATTEMPT TO FIND REAL SKIN
|
||||
if (R_AnySkinAvailable(cv_skin.string) != -1)
|
||||
{
|
||||
sprdef = &allskins[R_AnySkinAvailable(cv_skin.string)].spritedef;
|
||||
skintodisplay = R_AnySkinAvailable(cv_skin.string);
|
||||
} else { // STILL NOTHIN? use sonic instead
|
||||
sprdef = &allskins[0].spritedef;
|
||||
skintodisplay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sprdef->numframes) // No frames ??
|
||||
return; // Can't render!
|
||||
|
||||
frame = multi_state->frame & FF_FRAMEMASK;
|
||||
if (frame >= sprdef->numframes) // Walking animation missing
|
||||
frame = 0; // Try to use standing frame
|
||||
|
||||
sprframe = &sprdef->spriteframes[frame];
|
||||
|
||||
//minenice's speen css, it's a piece of shit but hey
|
||||
//patch = W_CachePatchNum(sprframe->lumppat[1], PU_CACHE);
|
||||
speenframe = (I_GetTime()*4/TICRATE + 1)%8;
|
||||
|
||||
//this is a very shitty solution for checking if a sprite needs flipping
|
||||
//but it works
|
||||
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4)) {
|
||||
flags = V_FLIP; // This sprite is left/right flipped!
|
||||
}
|
||||
patch = W_CachePatchNum(sprframe->lumppat[speenframe], PU_CACHE);
|
||||
|
||||
// draw box around guy
|
||||
V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239);
|
||||
|
||||
// draw player sprite
|
||||
UINT8 *colormap = R_GetTranslationColormap(skintodisplay, cv_playercolor.value, GTC_MENUCACHE);
|
||||
colormap = R_GetLocalTranslationColormap(&skins[allskins[skintodisplay].localnum], (allskins[skintodisplay].localskin ? &localskins[allskins[skintodisplay].localnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, allskins[skintodisplay].localskin);
|
||||
|
||||
V_DrawMappedPatch(mx, my+50, 0, W_CachePatchName(allskins[skintodisplay].facewant, PU_CACHE), colormap);
|
||||
V_DrawMappedPatch(mx+8, my+85, 0, W_CachePatchName(allskins[skintodisplay].facerank, PU_CACHE), colormap);
|
||||
V_DrawString(mx, my+108, V_ALLOWLOWERCASE, "Character");
|
||||
if (strlen(allskins[skintodisplay].realname) > 10)
|
||||
V_DrawThinString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, allskins[skintodisplay].realname);
|
||||
else
|
||||
V_DrawString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, allskins[skintodisplay].realname);
|
||||
|
||||
if (allskins[skintodisplay].flags & SF_HIRES)
|
||||
{
|
||||
V_DrawFixedPatch((mx+220)<<FRACBITS,
|
||||
(my+120)<<FRACBITS,
|
||||
allskins[skintodisplay].highresscale,
|
||||
flags, patch, colormap);
|
||||
}
|
||||
else
|
||||
V_DrawMappedPatch(mx+220, my+120, flags, patch, colormap);
|
||||
#undef charw
|
||||
}
|
||||
|
||||
// Draw the video modes list, a-la-Quake
|
||||
static void M_DrawVideoMode(void)
|
||||
{
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ typedef off_t off64_t;
|
||||
|
||||
#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) && (__GNUC__ < 8)
|
||||
#define PRIdS "u"
|
||||
#elif defined (_WIN32)
|
||||
#elif defined(_WIN32) && !defined(__MINGW64__)
|
||||
#define PRIdS "Iu"
|
||||
#elif defined (_PSP) || defined (_arch_dreamcast) || defined (DJGPP) || defined (_WII) || defined (_NDS) || defined (_PS3)
|
||||
#define PRIdS "u"
|
||||
|
||||
-278
@@ -1,278 +0,0 @@
|
||||
/*********************************************************
|
||||
*
|
||||
* File: p5prof.h
|
||||
* By: Kevin Baca
|
||||
*
|
||||
* MODIFIED BY Fab SO THAT RDMSR(...) WRITES EDX : EAX TO A LONG LONG
|
||||
* (WHICH MEANS WRITE THE LOW DWORD FIRST)
|
||||
*
|
||||
* Now in yer code do:
|
||||
* INT64 count,total;
|
||||
*
|
||||
* ...
|
||||
* RDMSR(0x10,&count); //inner loop count
|
||||
* total += count;
|
||||
* ...
|
||||
*
|
||||
* printf("0x%x %x", (INT32)total, *((INT32 *)&total+1));
|
||||
* // HIGH LOW
|
||||
*
|
||||
*********************************************************/
|
||||
/**\file
|
||||
\brief This file provides macros to profile your code.
|
||||
|
||||
Here's how they work...
|
||||
|
||||
As you may or may not know, the Pentium class of
|
||||
processors provides extremely fine grained profiling
|
||||
capabilities through the use of what are called
|
||||
Machine Specific Registers (MSRs). These registers
|
||||
can provide information about almost any aspect of
|
||||
CPU performance down to a single cycle.
|
||||
|
||||
The MSRs of interest for profiling are specified by
|
||||
indices 0x10, 0x11, 0x12, and 0x13. Here is a brief
|
||||
description of each of these registers:
|
||||
|
||||
MSR 0x10
|
||||
This register is simple a cycle counter.
|
||||
|
||||
MSR 0x11
|
||||
This register controls what type of profiling data
|
||||
will be gathered.
|
||||
|
||||
MSRs 0x12 and 0x13
|
||||
These registers gather the profiling data specified in
|
||||
MSR 0x11.
|
||||
|
||||
Each MSR is 64 bits wide. For the Pentium processor,
|
||||
only the lower 32 bits of MSR 0x11 are valid. Bits 0-15
|
||||
specify what data will be gathered in MSR 0x12. Bits 16-31
|
||||
specify what data will be gathered in MSR 0x13. Both sets
|
||||
of bits have the same format:
|
||||
|
||||
Bits 0-5 specify which hardware event will be tracked.
|
||||
Bit 6, if set, indicates events will be tracked in
|
||||
rings 0-2.
|
||||
Bit 7, if set, indicates events will be tracked in
|
||||
ring 3.
|
||||
Bit 8, if set, indicates cycles should be counted for
|
||||
the specified event. If clear, it indicates the
|
||||
number of events should be counted.
|
||||
|
||||
Two instructions are provided for manupulating the MSRs.
|
||||
RDMSR (Read Machine Specific Register) and WRMSR
|
||||
(Write Machine Specific Register). These opcodes were
|
||||
originally undocumented and therefore most assemblers don't
|
||||
recognize them. Their byte codes are provided in the
|
||||
macros below.
|
||||
|
||||
RDMSR takes the MSR index in ecx and the profiling criteria
|
||||
in edx : eax.
|
||||
|
||||
WRMSR takes the MSR index in ecx and returns the profile data
|
||||
in edx : eax.
|
||||
|
||||
Two profiling registers limits profiling capability to
|
||||
gathering only two types of information. The register
|
||||
usage can, however, be combined in interesting ways.
|
||||
For example, you can set one register to gather the
|
||||
number of a specific type of event while the other gathers
|
||||
the number of cycles for the same event. Or you can
|
||||
gather the number of two separate events while using
|
||||
MSR 0x10 to gather the number of cycles.
|
||||
|
||||
The enumerated list provides somewhat readable labels for
|
||||
the types of events that can be tracked.
|
||||
|
||||
For more information, get ahold of appendix H from the
|
||||
Intel Pentium programmer's manual (I don't remember the
|
||||
order number) or go to
|
||||
http://green.kaist.ac.kr/jwhahn/art3.htm.
|
||||
That's an article by Terje Mathisen where I got most of
|
||||
my information.
|
||||
|
||||
You may use this code however you wish. I hope it's
|
||||
useful and I hope I got everything right.
|
||||
|
||||
-Kevin
|
||||
|
||||
kbaca@skygames.com
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define RDTSC(_dst) \
|
||||
__asm__("
|
||||
.byte 0x0F,0x31
|
||||
movl %%edx,(%%edi)
|
||||
movl %%eax,4(%%edi)"\
|
||||
: : "D" (_dst) : "eax", "edx", "edi")
|
||||
|
||||
// the old code... swapped it
|
||||
// movl %%edx,(%%edi)
|
||||
// movl %%eax,4(%%edi)"
|
||||
#define RDMSR(_msri, _msrd) \
|
||||
__asm__("
|
||||
.byte 0x0F,0x32
|
||||
movl %%eax,(%%edi)
|
||||
movl %%edx,4(%%edi)"\
|
||||
: : "c" (_msri), "D" (_msrd) : "eax", "ecx", "edx", "edi")
|
||||
|
||||
#define WRMSR(_msri, _msrd) \
|
||||
__asm__("
|
||||
xorl %%edx,%%edx
|
||||
.byte 0x0F,0x30"\
|
||||
: : "c" (_msri), "a" (_msrd) : "eax", "ecx", "edx")
|
||||
|
||||
#define RDMSR_0x12_0x13(_msr12, _msr13) \
|
||||
__asm__("
|
||||
movl $0x12,%%ecx
|
||||
.byte 0x0F,0x32
|
||||
movl %%edx,(%%edi)
|
||||
movl %%eax,4(%%edi)
|
||||
movl $0x13,%%ecx
|
||||
.byte 0x0F,0x32
|
||||
movl %%edx,(%%esi)
|
||||
movl %%eax,4(%%esi)"\
|
||||
: : "D" (_msr12), "S" (_msr13) : "eax", "ecx", "edx", "edi")
|
||||
|
||||
#define ZERO_MSR_0x12_0x13() \
|
||||
__asm__("
|
||||
xorl %%edx,%%edx
|
||||
xorl %%eax,%%eax
|
||||
movl $0x12,%%ecx
|
||||
.byte 0x0F,0x30
|
||||
movl $0x13,%%ecx
|
||||
.byte 0x0F,0x30"\
|
||||
: : : "eax", "ecx", "edx")
|
||||
|
||||
#elif defined (__WATCOMC__)
|
||||
|
||||
extern void RDTSC(UINT32 *dst);
|
||||
#pragma aux RDTSC =\
|
||||
"db 0x0F,0x31"\
|
||||
"mov [edi],edx"\
|
||||
"mov [4+edi],eax"\
|
||||
parm [edi]\
|
||||
modify [eax edx edi];
|
||||
|
||||
extern void RDMSR(UINT32 msri, UINT32 *msrd);
|
||||
#pragma aux RDMSR =\
|
||||
"db 0x0F,0x32"\
|
||||
"mov [edi],edx"\
|
||||
"mov [4+edi],eax"\
|
||||
parm [ecx] [edi]\
|
||||
modify [eax ecx edx edi];
|
||||
|
||||
extern void WRMSR(UINT32 msri, UINT32 msrd);
|
||||
#pragma aux WRMSR =\
|
||||
"xor edx,edx"\
|
||||
"db 0x0F,0x30"\
|
||||
parm [ecx] [eax]\
|
||||
modify [eax ecx edx];
|
||||
|
||||
extern void RDMSR_0x12_0x13(UINT32 *msr12, UINT32 *msr13);
|
||||
#pragma aux RDMSR_0x12_0x13 =\
|
||||
"mov ecx,0x12"\
|
||||
"db 0x0F,0x32"\
|
||||
"mov [edi],edx"\
|
||||
"mov [4+edi],eax"\
|
||||
"mov ecx,0x13"\
|
||||
"db 0x0F,0x32"\
|
||||
"mov [esi],edx"\
|
||||
"mov [4+esi],eax"\
|
||||
parm [edi] [esi]\
|
||||
modify [eax ecx edx edi esi];
|
||||
|
||||
extern void ZERO_MSR_0x12_0x13(void);
|
||||
#pragma aux ZERO_MSR_0x12_0x13 =\
|
||||
"xor edx,edx"\
|
||||
"xor eax,eax"\
|
||||
"mov ecx,0x12"\
|
||||
"db 0x0F,0x30"\
|
||||
"mov ecx,0x13"\
|
||||
"db 0x0F,0x30"\
|
||||
modify [eax ecx edx];
|
||||
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DataRead,
|
||||
DataWrite,
|
||||
DataTLBMiss,
|
||||
DataReadMiss,
|
||||
DataWriteMiss,
|
||||
WriteHitEM,
|
||||
DataCacheLinesWritten,
|
||||
DataCacheSnoops,
|
||||
DataCacheSnoopHit,
|
||||
MemAccessBothPipes,
|
||||
BankConflict,
|
||||
MisalignedDataRef,
|
||||
CodeRead,
|
||||
CodeTLBMiss,
|
||||
CodeCacheMiss,
|
||||
SegRegLoad,
|
||||
RESERVED0,
|
||||
RESERVED1,
|
||||
Branch,
|
||||
BTBHit,
|
||||
TakenBranchOrBTBHit,
|
||||
PipelineFlush,
|
||||
InstructionsExeced,
|
||||
InstructionsExecedVPipe,
|
||||
BusUtilizationClocks,
|
||||
PipelineStalledWriteBackup,
|
||||
PipelineStalledDateMemRead,
|
||||
PipeLineStalledWriteEM,
|
||||
LockedBusCycle,
|
||||
IOReadOrWriteCycle,
|
||||
NonCacheableMemRef,
|
||||
AGI,
|
||||
RESERVED2,
|
||||
RESERVED3,
|
||||
FPOperation,
|
||||
Breakpoint0Match,
|
||||
Breakpoint1Match,
|
||||
Breakpoint2Match,
|
||||
Breakpoint3Match,
|
||||
HWInterrupt,
|
||||
DataReadOrWrite,
|
||||
DataReadOrWriteMiss
|
||||
};
|
||||
|
||||
#define PROF_CYCLES (0x100)
|
||||
#define PROF_EVENTS (0x000)
|
||||
#define RING_012 (0x40)
|
||||
#define RING_3 (0x80)
|
||||
#define RING_0123 (RING_012 | RING_3)
|
||||
|
||||
/*void ProfSetProfiles(UINT32 msr12, UINT32 msr13);*/
|
||||
#define ProfSetProfiles(_msr12, _msr13)\
|
||||
{\
|
||||
UINT32 prof;\
|
||||
\
|
||||
prof = (_msr12) | ((_msr13) << 16);\
|
||||
WRMSR(0x11, prof);\
|
||||
}
|
||||
|
||||
/*void ProfBeginProfiles(void);*/
|
||||
#define ProfBeginProfiles()\
|
||||
ZERO_MSR_0x12_0x13();
|
||||
|
||||
/*void ProfGetProfiles(UINT32 msr12[2], UINT32 msr13[2]);*/
|
||||
#define ProfGetProfiles(_msr12, _msr13)\
|
||||
RDMSR_0x12_0x13(_msr12, _msr13);
|
||||
|
||||
/*void ProfZeroTimer(void);*/
|
||||
#define ProfZeroTimer()\
|
||||
WRMSR(0x10, 0);
|
||||
|
||||
/*void ProfReadTimer(UINT32 timer[2]);*/
|
||||
#define ProfReadTimer(timer)\
|
||||
RDMSR(0x10, timer);
|
||||
|
||||
/*EOF*/
|
||||
@@ -2608,6 +2608,7 @@ void A_MonitorPop(mobj_t *actor)
|
||||
remains->fuse = actor->fuse; // Transfer respawn timer
|
||||
remains->threshold = 68;
|
||||
remains->skin = NULL;
|
||||
remains->localskin = NULL;
|
||||
|
||||
P_SetTarget(&tmthing, remains);
|
||||
|
||||
@@ -4167,6 +4168,18 @@ void A_SignPlayer(mobj_t *actor)
|
||||
P_SetTarget(&ov->target, actor);
|
||||
ov->color = actor->target->player->skincolor;
|
||||
ov->skin = &skins[actor->target->player->skin];
|
||||
if (actor->target->skinlocal) {
|
||||
// needs - 1 or else it pukes an error out
|
||||
// same thing happens on p_mobj.c
|
||||
ov->localskin = &localskins[actor->target->player->localskin - 1];
|
||||
ov->skinlocal = actor->target->skinlocal;
|
||||
} else {
|
||||
// needs - 1 or else it pukes an error out
|
||||
// same thing happens on p_mobj.c
|
||||
if (actor->target->player->localskin)
|
||||
ov->localskin = &skins[actor->target->player->localskin - 1];
|
||||
ov->skinlocal = actor->target->skinlocal;
|
||||
}
|
||||
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
|
||||
}
|
||||
|
||||
|
||||
+13
-12
@@ -10359,7 +10359,7 @@ void P_SpawnPrecipitation(void)
|
||||
subsector_t *precipsector = NULL;
|
||||
precipmobj_t *rainmo = NULL;
|
||||
|
||||
if (dedicated || /*!cv_precipdensity*/!cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart
|
||||
if (dedicated || !(cv_drawdist_precip.value) || curWeather == PRECIP_NONE || curWeather == PRECIP_STORM_NORAIN) // SRB2Kart
|
||||
return;
|
||||
|
||||
// Use the blockmap to narrow down our placing patterns
|
||||
@@ -10402,22 +10402,13 @@ void P_SpawnPrecipitation(void)
|
||||
}
|
||||
else // everything else.
|
||||
rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN);
|
||||
if (curWeather == PRECIP_BLANK)
|
||||
rainmo->precipflags |= PCF_INVISIBLE;
|
||||
|
||||
// Randomly assign a height, now that floorz is set.
|
||||
rainmo->z = M_RandomRange(rainmo->floorz>>FRACBITS, rainmo->ceilingz>>FRACBITS)<<FRACBITS;
|
||||
}
|
||||
}
|
||||
|
||||
if (curWeather == PRECIP_BLANK)
|
||||
{
|
||||
curWeather = PRECIP_RAIN;
|
||||
P_SwitchWeather(PRECIP_BLANK);
|
||||
}
|
||||
else if (curWeather == PRECIP_STORM_NORAIN)
|
||||
{
|
||||
curWeather = PRECIP_RAIN;
|
||||
P_SwitchWeather(PRECIP_STORM_NORAIN);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -10772,6 +10763,16 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
// (usefulness: when body mobj is detached from player (who respawns),
|
||||
// the dead body mobj retains the skin through the 'spritedef' override).
|
||||
mobj->skin = &skins[p->skin];
|
||||
if (p->localskin > 0)
|
||||
{
|
||||
if (p->skinlocal)
|
||||
mobj->localskin = &localskins[p->localskin - 1];
|
||||
else
|
||||
mobj->localskin = & skins[p->localskin - 1];
|
||||
}
|
||||
else
|
||||
mobj->localskin = 0;
|
||||
mobj->skinlocal = p->skinlocal;
|
||||
|
||||
mobj->health = p->health;
|
||||
p->playerstate = PST_LIVE;
|
||||
|
||||
@@ -327,6 +327,8 @@ typedef struct mobj_s
|
||||
UINT16 eflags; // extra flags
|
||||
|
||||
void *skin; // overrides 'sprite' when non-NULL (for player bodies to 'remember' the skin)
|
||||
void *localskin;
|
||||
boolean skinlocal;
|
||||
// Player and mobj sprites in multiplayer modes are modified
|
||||
// using an internal color lookup table for re-indexing.
|
||||
UINT8 color; // This replaces MF_TRANSLATION. Use 0 for default (no translation).
|
||||
|
||||
+10
-5
@@ -3433,7 +3433,7 @@ boolean P_RunSOC(const char *socfilename)
|
||||
lumpnum_t lump;
|
||||
|
||||
if (strstr(socfilename, ".soc") != NULL)
|
||||
return P_AddWadFile(socfilename);
|
||||
return P_AddWadFile(socfilename, false);
|
||||
|
||||
lump = W_CheckNumForName(socfilename);
|
||||
if (lump == LUMPERROR)
|
||||
@@ -3449,11 +3449,11 @@ boolean P_RunSOC(const char *socfilename)
|
||||
// Add a wadfile to the active wad files,
|
||||
// replace sounds, musics, patches, textures, sprites and maps
|
||||
//
|
||||
boolean P_AddWadFile(const char *wadfilename)
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local)
|
||||
{
|
||||
UINT16 wadnum;
|
||||
|
||||
if ((wadnum = P_PartialAddWadFile(wadfilename, false)) == UINT16_MAX)
|
||||
if ((wadnum = P_PartialAddWadFile(wadfilename, local)) == UINT16_MAX)
|
||||
return false;
|
||||
|
||||
P_MultiSetupWadFiles(true);
|
||||
@@ -3483,7 +3483,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
boolean mapsadded = false;
|
||||
lumpinfo_t *lumpinfo;
|
||||
|
||||
if ((numlumps = W_InitFile(wadfilename, local)) == INT16_MAX)
|
||||
if ((numlumps = W_InitFile(wadfilename, 0, &wadnum, local)) == INT16_MAX)
|
||||
{
|
||||
refreshdirmenu |= REFRESHDIR_NOTLOADED;
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
|
||||
@@ -3493,6 +3493,11 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
|
||||
if (wadfiles[wadnum]->important)
|
||||
partadd_important = true;
|
||||
|
||||
if (local)
|
||||
wadfiles[wadnum]->localfile = true;
|
||||
else
|
||||
wadfiles[wadnum]->localfile = false;
|
||||
|
||||
//
|
||||
// search for sound replacements
|
||||
@@ -3545,7 +3550,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
//
|
||||
// look for skins
|
||||
//
|
||||
R_AddSkins(wadnum); // faB: wadfile index in wadfiles[]
|
||||
R_AddSkins(wadnum, local); // faB: wadfile index in wadfiles[]
|
||||
|
||||
//
|
||||
// edit music defs
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||
#endif
|
||||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
boolean P_AddWadFile(const char *wadfilename);
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local);
|
||||
boolean P_AddWadFileLocal(const char *wadfilename);
|
||||
#ifdef DELFILE
|
||||
boolean P_DelWadFile(void);
|
||||
|
||||
+17
-76
@@ -2006,53 +2006,14 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
||||
//
|
||||
void P_SwitchWeather(INT32 weathernum)
|
||||
{
|
||||
boolean purge = false;
|
||||
INT32 swap = 0;
|
||||
boolean purge = true;
|
||||
boolean raintype = (PRECIP_SNOW || PRECIP_RAIN || PRECIP_STORM || PRECIP_STORM_NOSTRIKES || PRECIP_BLANK);
|
||||
|
||||
switch (weathernum)
|
||||
{
|
||||
case PRECIP_NONE: // None
|
||||
if (curWeather == PRECIP_NONE)
|
||||
return; // Nothing to do.
|
||||
purge = true;
|
||||
break;
|
||||
case PRECIP_STORM: // Storm
|
||||
case PRECIP_STORM_NOSTRIKES: // Storm w/ no lightning
|
||||
case PRECIP_RAIN: // Rain
|
||||
if (curWeather == PRECIP_SNOW || curWeather == PRECIP_BLANK || curWeather == PRECIP_STORM_NORAIN)
|
||||
swap = PRECIP_RAIN;
|
||||
break;
|
||||
case PRECIP_SNOW: // Snow
|
||||
if (curWeather == PRECIP_SNOW)
|
||||
return; // Nothing to do.
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES || curWeather == PRECIP_BLANK || curWeather == PRECIP_STORM_NORAIN)
|
||||
swap = PRECIP_SNOW; // Need to delete the other precips.
|
||||
break;
|
||||
case PRECIP_STORM_NORAIN: // Storm w/o rain
|
||||
if (curWeather == PRECIP_SNOW
|
||||
|| curWeather == PRECIP_STORM
|
||||
|| curWeather == PRECIP_STORM_NOSTRIKES
|
||||
|| curWeather == PRECIP_RAIN
|
||||
|| curWeather == PRECIP_BLANK)
|
||||
swap = PRECIP_STORM_NORAIN;
|
||||
else if (curWeather == PRECIP_STORM_NORAIN)
|
||||
return;
|
||||
break;
|
||||
case PRECIP_BLANK:
|
||||
if (curWeather == PRECIP_SNOW
|
||||
|| curWeather == PRECIP_STORM
|
||||
|| curWeather == PRECIP_STORM_NOSTRIKES
|
||||
|| curWeather == PRECIP_RAIN)
|
||||
swap = PRECIP_BLANK;
|
||||
else if (curWeather == PRECIP_STORM_NORAIN)
|
||||
swap = PRECIP_BLANK;
|
||||
else if (curWeather == PRECIP_BLANK)
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
CONS_Debug(DBG_GAMELOGIC, "P_SwitchWeather: Unknown weather type %d.\n", weathernum);
|
||||
break;
|
||||
}
|
||||
if (weathernum == curWeather)
|
||||
return;
|
||||
|
||||
if (weathernum == raintype && curWeather == raintype)
|
||||
purge = false;
|
||||
|
||||
if (purge)
|
||||
{
|
||||
@@ -2069,7 +2030,7 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
P_RemovePrecipMobj(precipmobj);
|
||||
}
|
||||
}
|
||||
else if (swap && !((swap == PRECIP_BLANK && curWeather == PRECIP_STORM_NORAIN) || (swap == PRECIP_STORM_NORAIN && curWeather == PRECIP_BLANK))) // Rather than respawn all that crap, reuse it!
|
||||
else // Rather than respawn all that crap, reuse it!
|
||||
{
|
||||
thinker_t *think;
|
||||
precipmobj_t *precipmobj;
|
||||
@@ -2081,7 +2042,7 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
continue; // not a precipmobj thinker
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
|
||||
if (swap == PRECIP_RAIN) // Snow To Rain
|
||||
if (weathernum == PRECIP_RAIN || weathernum == PRECIP_STORM || weathernum == PRECIP_STORM_NOSTRIKES) // Snow To Rain
|
||||
{
|
||||
precipmobj->flags = mobjinfo[MT_RAIN].flags;
|
||||
st = &states[mobjinfo[MT_RAIN].spawnstate];
|
||||
@@ -2096,7 +2057,7 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
precipmobj->precipflags |= PCF_RAIN;
|
||||
//think->function.acp1 = (actionf_p1)P_RainThinker;
|
||||
}
|
||||
else if (swap == PRECIP_SNOW) // Rain To Snow
|
||||
else if (weathernum == PRECIP_SNOW) // Rain To Snow
|
||||
{
|
||||
INT32 z;
|
||||
|
||||
@@ -2121,7 +2082,7 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
|
||||
//think->function.acp1 = (actionf_p1)P_SnowThinker;
|
||||
}
|
||||
else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
|
||||
else // Remove precip, but keep it around for reuse.
|
||||
{
|
||||
//think->function.acp1 = (actionf_p1)P_NullPrecipThinker;
|
||||
|
||||
@@ -2135,48 +2096,31 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
case PRECIP_SNOW: // snow
|
||||
curWeather = PRECIP_SNOW;
|
||||
|
||||
if (!swap)
|
||||
if (purge)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
case PRECIP_RAIN: // rain
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_RAIN;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
if (purge)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM: // storm
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_STORM;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
if (purge)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM_NOSTRIKES: // storm w/o lightning
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_STORM_NOSTRIKES;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
if (purge)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
@@ -2184,14 +2128,11 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
case PRECIP_STORM_NORAIN: // storm w/o rain
|
||||
curWeather = PRECIP_STORM_NORAIN;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
case PRECIP_BLANK:
|
||||
case PRECIP_BLANK: //preloaded
|
||||
curWeather = PRECIP_BLANK;
|
||||
|
||||
if (!swap)
|
||||
if (purge)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
|
||||
+15
-4
@@ -1696,6 +1696,8 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||
|
||||
ghost->fuse = ghost->info->damage;
|
||||
ghost->skin = mobj->skin;
|
||||
ghost->localskin = mobj->localskin;
|
||||
ghost->skinlocal = mobj->skinlocal;
|
||||
|
||||
if (mobj->flags2 & MF2_OBJECTFLIP)
|
||||
ghost->flags |= MF2_OBJECTFLIP;
|
||||
@@ -1737,10 +1739,19 @@ void P_DoPlayerExit(player_t *player)
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
sfxenum_t sfx_id;
|
||||
if (K_IsPlayerLosing(player))
|
||||
sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_klose].skinsound];
|
||||
else
|
||||
sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_kwin].skinsound];
|
||||
// fix godjjsa win sounds
|
||||
if (K_IsPlayerLosing(player)) {
|
||||
if (player->mo->localskin)
|
||||
sfx_id = ((skin_t *)player->mo->localskin)->soundsid[S_sfx[sfx_klose].skinsound];
|
||||
else
|
||||
sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_klose].skinsound];
|
||||
}
|
||||
else {
|
||||
if (player->mo->localskin)
|
||||
sfx_id = ((skin_t *)player->mo->localskin)->soundsid[S_sfx[sfx_kwin].skinsound];
|
||||
else
|
||||
sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_kwin].skinsound];
|
||||
}
|
||||
S_StartSound(NULL, sfx_id);
|
||||
}
|
||||
else
|
||||
|
||||
+43
-14
@@ -18,6 +18,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_local.h"
|
||||
#include "r_things.h"
|
||||
#include "st_stuff.h" // need ST_HEIGHT
|
||||
#include "i_video.h"
|
||||
#include "v_video.h"
|
||||
@@ -141,6 +142,7 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
|
||||
#define NUM_PALETTE_ENTRIES 256
|
||||
|
||||
static UINT8** translationtablecache[TT_CACHE_SIZE] = {NULL};
|
||||
static UINT8** localtranslationtablecache[MAXSKINS] = {NULL};
|
||||
|
||||
|
||||
// See also the enum skincolors_t
|
||||
@@ -519,29 +521,39 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
|
||||
|
||||
\return Colormap. If not cached, caller should Z_Free.
|
||||
*/
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags, boolean local)
|
||||
{
|
||||
UINT8 ***tt;
|
||||
UINT8* ret;
|
||||
INT32 skintableindex;
|
||||
|
||||
// Adjust if we want the default colormap
|
||||
if (skinnum == TC_DEFAULT) skintableindex = DEFAULT_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BOSS) skintableindex = BOSS_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
|
||||
else skintableindex = skinnum;
|
||||
if (local)
|
||||
{
|
||||
tt = localtranslationtablecache;
|
||||
skintableindex = skinnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
tt = translationtablecache;
|
||||
// Adjust if we want the default colormap
|
||||
if (skinnum == TC_DEFAULT) skintableindex = DEFAULT_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BOSS) skintableindex = BOSS_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
|
||||
else skintableindex = skinnum;
|
||||
}
|
||||
|
||||
if (flags & GTC_CACHE)
|
||||
{
|
||||
|
||||
// Allocate table for skin if necessary
|
||||
if (!translationtablecache[skintableindex])
|
||||
translationtablecache[skintableindex] = Z_Calloc(MAXTRANSLATIONS * sizeof(UINT8**), PU_STATIC, NULL);
|
||||
if (!tt[skintableindex])
|
||||
tt[skintableindex] = Z_Calloc(MAXTRANSLATIONS * sizeof(UINT8**), PU_STATIC, NULL);
|
||||
|
||||
// Get colormap
|
||||
ret = translationtablecache[skintableindex][color];
|
||||
ret = tt[skintableindex][color];
|
||||
}
|
||||
else ret = NULL;
|
||||
|
||||
@@ -549,16 +561,29 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
if (!ret)
|
||||
{
|
||||
ret = Z_MallocAlign(NUM_PALETTE_ENTRIES, (flags & GTC_CACHE) ? PU_LEVEL : PU_STATIC, NULL, 8);
|
||||
K_GenerateKartColormap(ret, skinnum, color); //R_GenerateTranslationColormap(ret, skinnum, color); // SRB2kart
|
||||
K_GenerateKartColormap(ret, skinnum, color, local); //R_GenerateTranslationColormap(ret, skinnum, color); // SRB2kart
|
||||
|
||||
// Cache the colormap if desired
|
||||
if (flags & GTC_CACHE)
|
||||
translationtablecache[skintableindex][color] = ret;
|
||||
tt[skintableindex][color] = ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
{
|
||||
return RGetTranslationColormap(skinnum, color, flags, false);
|
||||
}
|
||||
|
||||
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local)
|
||||
{
|
||||
if (localskin)
|
||||
return RGetTranslationColormap(( localskin - ( (local) ? localskins : skins ) ), color, flags, local);
|
||||
else
|
||||
return RGetTranslationColormap(( skin - skins ), color, flags, false);
|
||||
}
|
||||
|
||||
/** \brief Flushes cache of translation colormaps.
|
||||
|
||||
Flushes cache of translation colormaps, but doesn't actually free the
|
||||
@@ -574,6 +599,10 @@ void R_FlushTranslationColormapCache(void)
|
||||
for (i = 0; i < (INT32)(sizeof(translationtablecache) / sizeof(translationtablecache[0])); i++)
|
||||
if (translationtablecache[i])
|
||||
memset(translationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
|
||||
|
||||
for (i = 0; i < (INT32)(sizeof(localtranslationtablecache) / sizeof(localtranslationtablecache[0])); i++)
|
||||
if (localtranslationtablecache[i])
|
||||
memset(localtranslationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-14
@@ -15,6 +15,7 @@
|
||||
#define __R_DRAW__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "r_things.h"
|
||||
|
||||
// -------------------------------
|
||||
// COMMON STUFF FOR 8bpp AND 16bpp
|
||||
@@ -115,6 +116,7 @@ extern lumpnum_t viewborderlump[8];
|
||||
// Initialize color translation tables, for player rendering etc.
|
||||
void R_InitTranslationTables(void);
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags);
|
||||
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local);
|
||||
void R_FlushTranslationColormapCache(void);
|
||||
UINT8 R_GetColorByName(const char *name);
|
||||
|
||||
@@ -142,20 +144,6 @@ void R_DrawColumn_8(void);
|
||||
void R_DrawShadeColumn_8(void);
|
||||
void R_DrawTranslucentColumn_8(void);
|
||||
|
||||
#ifdef USEASM
|
||||
void ASMCALL R_DrawColumn_8_ASM(void);
|
||||
#define R_DrawWallColumn_8_ASM R_DrawColumn_8_ASM
|
||||
void ASMCALL R_DrawShadeColumn_8_ASM(void);
|
||||
void ASMCALL R_DrawTranslucentColumn_8_ASM(void);
|
||||
void ASMCALL R_Draw2sMultiPatchColumn_8_ASM(void);
|
||||
|
||||
void ASMCALL R_DrawColumn_8_MMX(void);
|
||||
#define R_DrawWallColumn_8_MMX R_DrawColumn_8_MMX
|
||||
|
||||
void ASMCALL R_Draw2sMultiPatchColumn_8_MMX(void);
|
||||
void ASMCALL R_DrawSpan_8_MMX(void);
|
||||
#endif
|
||||
|
||||
void R_DrawTranslatedColumn_8(void);
|
||||
void R_DrawTranslatedTranslucentColumn_8(void);
|
||||
void R_DrawSpan_8(void);
|
||||
|
||||
+19
-22
@@ -37,6 +37,8 @@ static CV_PossibleValue_t fpscap_cons_t[] = {
|
||||
};
|
||||
consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_precipinterp = {"precipinterpolation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
UINT32 R_GetFramerateCap(void)
|
||||
{
|
||||
if (rendermode == render_none)
|
||||
@@ -315,7 +317,7 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
|
||||
void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
{
|
||||
if (frac == FRACUNIT)
|
||||
if (frac == FRACUNIT || !cv_precipinterp.value)
|
||||
{
|
||||
out->x = mobj->x;
|
||||
out->y = mobj->y;
|
||||
@@ -330,18 +332,18 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||
return;
|
||||
}
|
||||
|
||||
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
||||
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||
out->scale = FRACUNIT;
|
||||
out->spritexscale = R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
|
||||
out->spriteyscale = R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
|
||||
out->spritexoffset = R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
||||
out->spriteyoffset = R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
|
||||
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
||||
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||
out->scale = FRACUNIT;
|
||||
out->spritexscale = mobj->spritexscale;
|
||||
out->spriteyscale = mobj->spriteyscale;
|
||||
out->spritexoffset = mobj->spritexoffset;
|
||||
out->spriteyoffset = mobj->spriteyoffset;
|
||||
|
||||
out->subsector = R_PointInSubsector(out->x, out->y);
|
||||
out->subsector = R_PointInSubsector(out->x, out->y);
|
||||
|
||||
out->angle = R_LerpAngle(mobj->old_angle, mobj->angle, frac);
|
||||
out->angle = R_LerpAngle(mobj->old_angle, mobj->angle, frac);
|
||||
}
|
||||
|
||||
static void AddInterpolator(levelinterpolator_t* interpolator)
|
||||
@@ -357,12 +359,11 @@ static void AddInterpolator(levelinterpolator_t* interpolator)
|
||||
levelinterpolators_size *= 2;
|
||||
}
|
||||
|
||||
levelinterpolators = Z_ReallocAlign(
|
||||
levelinterpolators = Z_Realloc(
|
||||
(void*) levelinterpolators,
|
||||
sizeof(levelinterpolator_t*) * levelinterpolators_size,
|
||||
PU_LEVEL,
|
||||
NULL,
|
||||
sizeof(levelinterpolator_t*) * 8
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
@@ -372,11 +373,8 @@ static void AddInterpolator(levelinterpolator_t* interpolator)
|
||||
|
||||
static levelinterpolator_t *CreateInterpolator(levelinterpolator_type_e type, thinker_t *thinker)
|
||||
{
|
||||
levelinterpolator_t *ret = (levelinterpolator_t*) Z_CallocAlign(
|
||||
sizeof(levelinterpolator_t),
|
||||
PU_LEVEL,
|
||||
NULL,
|
||||
sizeof(levelinterpolator_t) * 8
|
||||
levelinterpolator_t *ret = (levelinterpolator_t*) Z_Calloc(
|
||||
sizeof(levelinterpolator_t), PU_LEVEL, NULL
|
||||
);
|
||||
|
||||
ret->type = type;
|
||||
@@ -691,12 +689,11 @@ void R_AddMobjInterpolator(mobj_t *mobj)
|
||||
interpolated_mobjs_capacity *= 2;
|
||||
}
|
||||
|
||||
interpolated_mobjs = Z_ReallocAlign(
|
||||
interpolated_mobjs = Z_Realloc(
|
||||
interpolated_mobjs,
|
||||
sizeof(mobj_t *) * interpolated_mobjs_capacity,
|
||||
PU_LEVEL,
|
||||
NULL,
|
||||
64
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "r_state.h"
|
||||
|
||||
extern consvar_t cv_fpscap;
|
||||
extern consvar_t cv_precipinterp;
|
||||
|
||||
UINT32 R_GetFramerateCap(void);
|
||||
boolean R_UsingFrameInterpolation(void);
|
||||
|
||||
+13
-22
@@ -160,8 +160,8 @@ static CV_PossibleValue_t drawdist_cons_t[] = {
|
||||
static CV_PossibleValue_t drawdist_precip_cons_t[] = {
|
||||
{256, "256"}, {512, "512"}, {768, "768"},
|
||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||
{3072, "3072"}, {4096, "4096"},
|
||||
{0, "None"}, {0, NULL}};
|
||||
{3072, "3072"}, {0, "None"}, {0, NULL}};
|
||||
|
||||
|
||||
static CV_PossibleValue_t fov_cons_t[] = {{5*FRACUNIT, "MIN"}, {178*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
|
||||
@@ -441,28 +441,18 @@ fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1)
|
||||
|
||||
angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
{
|
||||
mobj_t *mo = player->mo;
|
||||
mobj_t *mo;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
|
||||
if (!cv_sliptideroll.value || !mo || P_MobjWasRemoved(mo)) return 0;
|
||||
if (!cv_sliptideroll.value || !player || P_MobjWasRemoved(player->mo))
|
||||
return 0;
|
||||
|
||||
size_t rot = mo->frame&FF_FRAMEMASK;
|
||||
boolean papersprite = (mo->frame & FF_PAPERSPRITE);
|
||||
mo = player->mo;
|
||||
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
// Yes.
|
||||
if (R_UsingFrameInterpolation() && !paused)
|
||||
{
|
||||
R_InterpolateMobjState(mo, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(mo, FRACUNIT, &interp);
|
||||
}
|
||||
size_t rot = mo->frame & FF_FRAMEMASK;
|
||||
boolean papersprite = (mo->frame & FF_PAPERSPRITE);
|
||||
|
||||
if (mo->skin && mo->sprite == SPR_PLAY)
|
||||
{
|
||||
@@ -488,7 +478,7 @@ angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
if (!sprframe) return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
ang = R_PointToAngle(interp.x, interp.y) - interp.angle;
|
||||
ang = R_PointToAngle(mo->x, mo->y) - mo->angle;
|
||||
|
||||
return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mo->player->sliproll*(mo->player->sliptidemem));
|
||||
}
|
||||
@@ -2020,4 +2010,5 @@ void R_RegisterEngineStuff(void)
|
||||
|
||||
// Frame interpolation/uncapped
|
||||
CV_RegisterVar(&cv_fpscap);
|
||||
CV_RegisterVar(&cv_precipinterp);
|
||||
}
|
||||
@@ -23,11 +23,6 @@ static wallsplat_t wallsplats[MAXLEVELSPLATS]; // WALL splats
|
||||
static INT32 freewallsplat;
|
||||
#endif
|
||||
|
||||
#ifdef USEASM
|
||||
/// \brief for floorsplats \note accessed by asm code
|
||||
struct rastery_s *prastertab;
|
||||
#endif
|
||||
|
||||
#ifdef FLOORSPLATS
|
||||
static floorsplat_t floorsplats[1]; // FLOOR splats
|
||||
static INT32 freefloorsplat;
|
||||
@@ -339,12 +334,6 @@ void R_AddVisibleFloorSplats(subsector_t *subsec)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USEASM
|
||||
// tv1, tv2 = x/y qui varie dans la texture, tc = x/y qui est constant.
|
||||
void ASMCALL rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 tv1, INT32 tv2,
|
||||
INT32 tc, INT32 dir);
|
||||
#endif
|
||||
|
||||
// current test with floor tile
|
||||
//#define FLOORSPLATSOLIDCOLOR
|
||||
|
||||
|
||||
+163
-45
@@ -130,7 +130,7 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
|
||||
{
|
||||
char cn = R_Frame2Char(frame); // for debugging
|
||||
|
||||
INT32 r, ang;
|
||||
INT32 r;
|
||||
lumpnum_t lumppat = wad;
|
||||
lumppat <<= 16;
|
||||
lumppat += lump;
|
||||
@@ -643,7 +643,7 @@ void R_InitSprites(void)
|
||||
// it can be is do before loading config for skin cvar possible value
|
||||
R_InitSkins();
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
R_AddSkins((UINT16)i);
|
||||
R_AddSkins((UINT16)i, false);
|
||||
|
||||
//
|
||||
// check if all sprites have frames
|
||||
@@ -828,9 +828,9 @@ static void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight)
|
||||
static void R_DrawVisSprite(vissprite_t *vis)
|
||||
{
|
||||
column_t *column;
|
||||
void (*localcolfunc)(column_t *);
|
||||
#ifdef RANGECHECK
|
||||
INT32 texturecolumn;
|
||||
INT32 pwidth;
|
||||
#endif
|
||||
fixed_t frac;
|
||||
patch_t *patch = vis->patch;
|
||||
fixed_t this_scale = vis->thingscale;
|
||||
@@ -881,10 +881,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
if (vis->mobj->colorized)
|
||||
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
else if (vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // MT_GHOST LOOKS LIKE A PLAYER SO USE THE PLAYER TRANSLATION TABLES. >_>
|
||||
{
|
||||
size_t skinnum = (skin_t*)vis->mobj->skin-skins;
|
||||
dc_translation = R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
dc_translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
|
||||
else // Use the defaults
|
||||
dc_translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
@@ -902,10 +899,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
if (vis->mobj->colorized)
|
||||
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
else if (vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // This thing is a player!
|
||||
{
|
||||
size_t skinnum = (skin_t*)vis->mobj->skin-skins;
|
||||
dc_translation = R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
dc_translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
|
||||
else // Use the defaults
|
||||
dc_translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
@@ -934,7 +928,9 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
frac = vis->startfrac;
|
||||
windowtop = windowbottom = sprbotscreen = INT32_MAX;
|
||||
|
||||
if (vis->mobj->skin && ((skin_t *)vis->mobj->skin)->flags & SF_HIRES)
|
||||
if (vis->mobj->localskin && ((skin_t *)vis->mobj->localskin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)vis->mobj->localskin)->highresscale);
|
||||
else if (vis->mobj->skin && ((skin_t *)vis->mobj->skin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)vis->mobj->skin)->highresscale);
|
||||
if (this_scale <= 0)
|
||||
this_scale = 1;
|
||||
@@ -955,7 +951,6 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
if (!(vis->scalestep))
|
||||
{
|
||||
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
|
||||
//sprtopscreen += vis->shear.tan * vis->shear.offset;
|
||||
dc_iscale = FixedDiv(FRACUNIT, vis->scale);
|
||||
}
|
||||
|
||||
@@ -1210,8 +1205,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
fixed_t scalestep; // toast '16
|
||||
fixed_t offset, offset2;
|
||||
boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
fixed_t paperoffset = 0, paperdistance = 0;
|
||||
angle_t centerangle = 0;
|
||||
|
||||
//SoM: 3/17/2000
|
||||
fixed_t gz, gzt;
|
||||
@@ -1283,7 +1276,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)thing->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef;
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[thing->sprite];
|
||||
#endif
|
||||
@@ -1357,7 +1350,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
|
||||
I_Assert(lump < max_spritelumps);
|
||||
|
||||
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)thing->localskin)->highresscale);
|
||||
else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)thing->skin)->highresscale);
|
||||
|
||||
spr_width = spritecachedinfo[lump].width;
|
||||
@@ -1640,8 +1635,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
vis->scale += FixedMul(scalestep, spriteyscale) * (vis->x1 - x1);
|
||||
}
|
||||
|
||||
vis->thingscale = interp.scale;
|
||||
|
||||
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
#ifdef ROTSPRITE
|
||||
@@ -2793,6 +2786,8 @@ void R_DrawMasked(void)
|
||||
// ==========================================================================
|
||||
|
||||
INT32 numskins = 0;
|
||||
INT32 numallskins = 0;
|
||||
INT32 numlocalskins = 0;
|
||||
skin_t skins[MAXSKINS];
|
||||
UINT8 skinstats[9][9][MAXSKINS];
|
||||
UINT8 skinstatscount[9][9] = {
|
||||
@@ -2807,13 +2802,16 @@ UINT8 skinstatscount[9][9] = {
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
UINT8 skinsorted[MAXSKINS];
|
||||
skin_t localskins[MAXSKINS];
|
||||
skin_t allskins[MAXSKINS*2];
|
||||
// FIXTHIS: don't work because it must be inistilised before the config load
|
||||
//#define SKINVALUES
|
||||
#ifdef SKINVALUES
|
||||
CV_PossibleValue_t skin_cons_t[MAXSKINS+1];
|
||||
CV_PossibleValue_t localskin_cons_t[MAXSKINS+1];
|
||||
#endif
|
||||
|
||||
static void Sk_SetDefaultValue(skin_t *skin)
|
||||
static void Sk_SetDefaultValue(skin_t *skin, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
//
|
||||
@@ -2821,7 +2819,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
|
||||
//
|
||||
memset(skin, 0, sizeof (skin_t));
|
||||
snprintf(skin->name,
|
||||
sizeof skin->name, "skin %u", (UINT32)(skin-skins));
|
||||
sizeof skin->name, "skin %u", (UINT32)(skin-( (local) ? localskins : skins )));
|
||||
skin->name[sizeof skin->name - 1] = '\0';
|
||||
skin->wadnum = INT16_MAX;
|
||||
strcpy(skin->sprite, "");
|
||||
@@ -2862,13 +2860,15 @@ void R_InitSkins(void)
|
||||
{
|
||||
skin_cons_t[i].value = 0;
|
||||
skin_cons_t[i].strvalue = NULL;
|
||||
localskin_cons_t[i].value = 0;
|
||||
localskin_cons_t[i].strvalue = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
// skin[0] = Sonic skin
|
||||
skin = &skins[0];
|
||||
numskins = 1;
|
||||
Sk_SetDefaultValue(skin);
|
||||
Sk_SetDefaultValue(skin, false);
|
||||
memset(skinstats, 0, sizeof(skinstats));
|
||||
memset(skinsorted, 0, sizeof(skinsorted));
|
||||
|
||||
@@ -2884,7 +2884,10 @@ void R_InitSkins(void)
|
||||
strncpy(skin->facerank, "PLAYRANK", 9);
|
||||
strncpy(skin->facewant, "PLAYWANT", 9);
|
||||
strncpy(skin->facemmap, "PLAYMMAP", 9);
|
||||
skin->wadnum = 0; // god what have you brought to this world
|
||||
skin->prefcolor = SKINCOLOR_BLUE;
|
||||
skin->localskin = false;
|
||||
skin->localnum = 0;
|
||||
|
||||
// SRB2kart
|
||||
skin->kartspeed = 8;
|
||||
@@ -2902,8 +2905,12 @@ void R_InitSkins(void)
|
||||
//MD2 for sonic doesn't want to load in Linux.
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_AddPlayerMD2(0);
|
||||
HWR_AddPlayerMD2(0, false);
|
||||
#endif
|
||||
|
||||
// lets set it
|
||||
allskins[0] = skins[0];
|
||||
numallskins = 1;
|
||||
}
|
||||
|
||||
// returns true if the skin name is found (loaded from pwad)
|
||||
@@ -2920,6 +2927,37 @@ INT32 R_SkinAvailable(const char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// returns true if the skin name is found (loaded from pwad)
|
||||
// warning return -1 if not found
|
||||
INT32 R_AnySkinAvailable(const char *name)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < numallskins; i++)
|
||||
{
|
||||
if (stricmp(allskins[i].name,name)==0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT32 R_LocalSkinAvailable(const char *name, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
if (local)
|
||||
{
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
{
|
||||
if (stricmp(localskins[i].name,name)==0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return R_SkinAvailable(name);
|
||||
}
|
||||
|
||||
// network code calls this when a 'skin change' is received
|
||||
boolean SetPlayerSkin(INT32 playernum, const char *skinname)
|
||||
{
|
||||
@@ -2945,6 +2983,67 @@ boolean SetPlayerSkin(INT32 playernum, const char *skinname)
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
|
||||
{
|
||||
player_t *player = &players[playernum];
|
||||
INT32 i;
|
||||
|
||||
if (strcasecmp(skinname, "none"))
|
||||
{
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
{
|
||||
// search in the skin list
|
||||
if (stricmp(localskins[i].name, skinname) == 0)
|
||||
{
|
||||
player->localskin = 1 + i;
|
||||
player->skinlocal = true;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = &localskins[i];
|
||||
player->mo->skinlocal = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < numskins; i++)
|
||||
{
|
||||
// search in the skin list
|
||||
if (stricmp(skins[i].name, skinname) == 0)
|
||||
{
|
||||
player->localskin = 1 + i;
|
||||
player->skinlocal = false;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = &skins[i];
|
||||
player->mo->skinlocal = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->localskin = 0;
|
||||
player->skinlocal = false;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = 0;
|
||||
player->mo->skinlocal = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (cvar != NULL) {
|
||||
if (player->localskin > 0) {
|
||||
CV_StealthSet(&cv_fakelocalskin, ( (player->skinlocal) ? localskins : skins )[player->localskin - 1].name);
|
||||
CV_StealthSet(cvar, ( (player->skinlocal) ? localskins : skins )[player->localskin - 1].name);
|
||||
}
|
||||
else {
|
||||
CV_StealthSet(&cv_fakelocalskin, "none");
|
||||
CV_StealthSet(cvar, "none");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Same as SetPlayerSkin, but uses the skin #.
|
||||
// network code calls this when a 'skin change' is received
|
||||
void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
||||
@@ -3129,7 +3228,7 @@ void sortSkinGrid(void)
|
||||
//
|
||||
// Find skin sprites, sounds & optional status bar face, & add them
|
||||
//
|
||||
void R_AddSkins(UINT16 wadnum)
|
||||
void R_AddSkins(UINT16 wadnum, boolean local)
|
||||
{
|
||||
UINT16 lump, lastlump = 0;
|
||||
char *buf;
|
||||
@@ -3149,7 +3248,7 @@ void R_AddSkins(UINT16 wadnum)
|
||||
// advance by default
|
||||
lastlump = lump + 1;
|
||||
|
||||
if (numskins >= MAXSKINS)
|
||||
if (( (local) ? numlocalskins : numskins ) >= MAXSKINS)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Unable to add skin, too many characters are loaded (%d maximum)\n"), MAXSKINS);
|
||||
continue; // so we know how many skins couldn't be added
|
||||
@@ -3165,8 +3264,8 @@ void R_AddSkins(UINT16 wadnum)
|
||||
buf2[size] = '\0';
|
||||
|
||||
// set defaults
|
||||
skin = &skins[numskins];
|
||||
Sk_SetDefaultValue(skin);
|
||||
skin = &( (local) ? localskins : skins )[( (local) ? numlocalskins : numskins )];
|
||||
Sk_SetDefaultValue(skin, local);
|
||||
skin->wadnum = wadnum;
|
||||
hudname = realname = false;
|
||||
// parse
|
||||
@@ -3190,7 +3289,7 @@ void R_AddSkins(UINT16 wadnum)
|
||||
// the skin name must uniquely identify a single skin
|
||||
// I'm lazy so if name is already used I leave the 'skin x'
|
||||
// default skin name set in Sk_SetDefaultValue
|
||||
if (R_SkinAvailable(value) == -1)
|
||||
if (R_LocalSkinAvailable(value, local) == -1)
|
||||
{
|
||||
STRBUFCPY(skin->name, value);
|
||||
strlwr(skin->name);
|
||||
@@ -3200,12 +3299,12 @@ void R_AddSkins(UINT16 wadnum)
|
||||
else
|
||||
{
|
||||
const size_t stringspace =
|
||||
strlen(value) + sizeof (numskins) + 1;
|
||||
strlen(value) + sizeof (( (local) ? numlocalskins : numskins )) + 1;
|
||||
char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL);
|
||||
snprintf(value2, stringspace,
|
||||
"%s%d", value, numskins);
|
||||
"%s%d", value, ( (local) ? numlocalskins : numskins ));
|
||||
value2[stringspace - 1] = '\0';
|
||||
if (R_SkinAvailable(value2) == -1)
|
||||
if (R_LocalSkinAvailable(value2, local) == -1)
|
||||
{
|
||||
STRBUFCPY(skin->name,
|
||||
value2);
|
||||
@@ -3388,29 +3487,48 @@ next_token:
|
||||
|
||||
CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name);
|
||||
#ifdef SKINVALUES
|
||||
skin_cons_t[numskins].value = numskins;
|
||||
skin_cons_t[numskins].strvalue = skin->name;
|
||||
( (local) ? localskin_cons_t : skin_cons_t )[( (local) ? numlocalskins : numskins )].value = ( (local) ? numlocalskins : numskins );
|
||||
( (local) ? localskin_cons_t : skin_cons_t )[( (local) ? numlocalskins : numskins )].strvalue = skin->name;
|
||||
#endif
|
||||
|
||||
// Update the forceskin possiblevalues
|
||||
Forceskin_cons_t[numskins+1].value = numskins;
|
||||
Forceskin_cons_t[numskins+1].strvalue = skins[numskins].name;
|
||||
if (!local)
|
||||
{
|
||||
Forceskin_cons_t[numskins+1].value = numskins;
|
||||
Forceskin_cons_t[numskins+1].strvalue = skins[numskins].name;
|
||||
}
|
||||
|
||||
skin->localskin = local;
|
||||
// so we dont have to guess
|
||||
if (local)
|
||||
skin->localnum = numlocalskins;
|
||||
else
|
||||
skin->localnum = numskins;
|
||||
|
||||
// add face graphics
|
||||
ST_LoadFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, numskins);
|
||||
if (local) {
|
||||
ST_LoadLocalFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, numlocalskins);
|
||||
} else {
|
||||
ST_LoadFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, numskins);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_AddPlayerMD2(numskins);
|
||||
HWR_AddPlayerMD2(( (local) ? numlocalskins : numskins ), local);
|
||||
#endif
|
||||
skinstats[skin->kartspeed-1][skin->kartweight-1][skinstatscount[skin->kartspeed-1][skin->kartweight-1]] = numskins;
|
||||
CONS_Debug(DBG_SETUP, M_GetText("Added %d to %d, %d\n"), numskins, skin->kartweight, skin->kartweight);
|
||||
skinstatscount[skin->kartspeed-1][skin->kartweight-1]++;
|
||||
CONS_Debug(DBG_SETUP, M_GetText("Incremented %d, %d to %d\n"), skin->kartspeed, skin->kartweight, skinstatscount[skin->kartspeed - 1][skin->kartweight - 1]);
|
||||
if (!local) {
|
||||
skinstats[skin->kartspeed-1][skin->kartweight-1][skinstatscount[skin->kartspeed-1][skin->kartweight-1]] = numskins;
|
||||
CONS_Debug(DBG_SETUP, M_GetText("Added %d to %d, %d\n"), numskins, skin->kartweight, skin->kartweight);
|
||||
skinstatscount[skin->kartspeed-1][skin->kartweight-1]++;
|
||||
CONS_Debug(DBG_SETUP, M_GetText("Incremented %d, %d to %d\n"), skin->kartspeed, skin->kartweight, skinstatscount[skin->kartspeed - 1][skin->kartweight - 1]);
|
||||
|
||||
skinsorted[numskins] = numskins;
|
||||
}
|
||||
|
||||
allskins[numallskins] = ( (local) ? localskins : skins )[( (local) ? numlocalskins : numskins )];
|
||||
|
||||
skinsorted[numskins] = numskins;
|
||||
|
||||
numskins++;
|
||||
( (local) ? numlocalskins++ : numskins++ );
|
||||
numallskins++;
|
||||
}
|
||||
|
||||
sortSkinGrid();
|
||||
|
||||
+11
-4
@@ -97,6 +97,9 @@ typedef struct
|
||||
|
||||
// specific sounds per skin
|
||||
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
|
||||
|
||||
boolean localskin;
|
||||
INT32 localnum;
|
||||
} skin_t;
|
||||
|
||||
extern CV_PossibleValue_t Forceskin_cons_t[];
|
||||
@@ -133,10 +136,7 @@ typedef struct vissprite_s
|
||||
fixed_t thingscale; // the object's scale
|
||||
fixed_t sortscale; // sortscale only differs from scale for flat sprites
|
||||
fixed_t scalestep; // only for flat sprites, 0 otherwise
|
||||
fixed_t paperoffset, paperdistance; // for paper sprites, offset/dist relative to the angle
|
||||
fixed_t xiscale; // negative if flipped
|
||||
|
||||
angle_t centerangle; // for paper sprites
|
||||
|
||||
fixed_t texturemid;
|
||||
patch_t *patch;
|
||||
@@ -199,17 +199,24 @@ typedef struct drawnode_s
|
||||
} drawnode_t;
|
||||
|
||||
extern INT32 numskins;
|
||||
extern INT32 numlocalskins;
|
||||
extern INT32 numallskins;
|
||||
extern skin_t skins[MAXSKINS];
|
||||
extern UINT8 skinstats[9][9][MAXSKINS];
|
||||
extern UINT8 skinstatscount[9][9];
|
||||
extern UINT8 skinsorted[MAXSKINS];
|
||||
|
||||
void sortSkinGrid(void);
|
||||
extern skin_t localskins[MAXSKINS];
|
||||
extern skin_t allskins[MAXSKINS*2];
|
||||
|
||||
boolean SetPlayerSkin(INT32 playernum,const char *skinname);
|
||||
void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
|
||||
void SetLocalPlayerSkin(INT32 playernum,const char *skinname, consvar_t *cvar);
|
||||
INT32 R_SkinAvailable(const char *name);
|
||||
void R_AddSkins(UINT16 wadnum);
|
||||
INT32 R_AnySkinAvailable(const char *name);
|
||||
INT32 R_LocalSkinAvailable(const char *name, boolean local);
|
||||
void R_AddSkins(UINT16 wadnum, boolean local);
|
||||
|
||||
#ifdef DELFILE
|
||||
void R_DelSkins(UINT16 wadnum);
|
||||
|
||||
+1
-1
@@ -578,7 +578,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
if (sfx->skinsound != -1 && origin && origin->skin)
|
||||
{
|
||||
// redirect player sound to the sound in the skin table
|
||||
sfx_id = ((skin_t *)origin->skin)->soundsid[sfx->skinsound];
|
||||
sfx_id = ((skin_t *)( (origin->localskin) ? origin->localskin : origin->skin ))->soundsid[sfx->skinsound];
|
||||
sfx = &S_sfx[sfx_id];
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
// SRB2Kart
|
||||
#include "r_fps.h" // R_GetFramerateCap
|
||||
|
||||
#if defined (USEASM) && !defined (NORUSEASM)//&& (!defined (_MSC_VER) || (_MSC_VER <= 1200))
|
||||
#define RUSEASM //MSC.NET can't patch itself
|
||||
#endif
|
||||
|
||||
// --------------------------------------------
|
||||
// assembly or c drawer routines for 8bpp/16bpp
|
||||
// --------------------------------------------
|
||||
@@ -94,7 +90,6 @@ UINT8 *scr_borderpatch; // flat used to fill the reduced view borders set at ST_
|
||||
// Short and Tall sky drawer, for the current color mode
|
||||
void (*walldrawerfunc)(void);
|
||||
|
||||
boolean R_ASM = true;
|
||||
boolean R_486 = false;
|
||||
boolean R_586 = false;
|
||||
boolean R_MMX = false;
|
||||
@@ -132,30 +127,6 @@ void SCR_SetMode(void)
|
||||
walldrawerfunc = R_DrawWallColumn_8;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8;
|
||||
twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn_8;
|
||||
#ifdef RUSEASM
|
||||
if (R_ASM)
|
||||
{
|
||||
if (R_MMX)
|
||||
{
|
||||
//colfunc = basecolfunc = R_DrawColumn_8_MMX; Can we please not use this function it seems to break sometimes????
|
||||
colfunc = basecolfunc = R_DrawColumn_8_ASM;
|
||||
//shadecolfunc = R_DrawShadeColumn_8_ASM;
|
||||
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
|
||||
//walldrawerfunc = R_DrawWallColumn_8_MMX; This is just an alias to R_DrawColumn_8_MMX
|
||||
walldrawerfunc = R_DrawWallColumn_8_ASM;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_MMX;
|
||||
spanfunc = basespanfunc = R_DrawSpan_8_MMX;
|
||||
}
|
||||
else
|
||||
{
|
||||
colfunc = basecolfunc = R_DrawColumn_8_ASM;
|
||||
//shadecolfunc = R_DrawShadeColumn_8_ASM;
|
||||
//fuzzcolfunc = R_DrawTranslucentColumn_8_ASM;
|
||||
walldrawerfunc = R_DrawWallColumn_8_ASM;
|
||||
twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_ASM;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* else if (vid.bpp > 1)
|
||||
{
|
||||
@@ -204,8 +175,6 @@ void SCR_Startup(void)
|
||||
CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n", R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2);
|
||||
}
|
||||
|
||||
if (M_CheckParm("-noASM"))
|
||||
R_ASM = false;
|
||||
if (M_CheckParm("-486"))
|
||||
R_486 = true;
|
||||
if (M_CheckParm("-586"))
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
NOHW=1
|
||||
NOHS=1
|
||||
NOASM=1
|
||||
|
||||
OPTS+=-DLINUX
|
||||
|
||||
|
||||
+3
-1
@@ -20,6 +20,9 @@ endif
|
||||
#
|
||||
|
||||
OPTS=-DUNIXCOMMON
|
||||
|
||||
#Use -rdynamic so a backtrace log shows function names instead of addresses
|
||||
LDFLAGS+=-rdynamic
|
||||
|
||||
#LDFLAGS = -L/usr/local/lib
|
||||
LIBS=-lm
|
||||
@@ -39,7 +42,6 @@ endif
|
||||
#
|
||||
ifdef SOLARIS
|
||||
NOIPX=1
|
||||
NOASM=1
|
||||
OPTS+=-DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
|
||||
OPTS+=-I/usr/local/include -I/opt/sfw/include
|
||||
LDFLAGS+=-L/opt/sfw/lib
|
||||
|
||||
@@ -38,13 +38,6 @@ endif
|
||||
endif
|
||||
|
||||
|
||||
#use the x86 asm code
|
||||
ifndef CYGWIN32
|
||||
ifndef NOASM
|
||||
USEASM=1
|
||||
endif
|
||||
endif
|
||||
|
||||
OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
|
||||
|
||||
OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL
|
||||
|
||||
@@ -67,40 +67,6 @@ char logfilename[1024];
|
||||
typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32)
|
||||
static inline VOID MakeCodeWritable(VOID)
|
||||
{
|
||||
#ifdef USEASM // Disable write-protection of code segment
|
||||
DWORD OldRights;
|
||||
const DWORD NewRights = PAGE_EXECUTE_READWRITE;
|
||||
PBYTE pBaseOfImage = (PBYTE)GetModuleHandle(NULL);
|
||||
PIMAGE_DOS_HEADER dosH =(PIMAGE_DOS_HEADER)pBaseOfImage;
|
||||
PIMAGE_NT_HEADERS ntH = (PIMAGE_NT_HEADERS)(pBaseOfImage + dosH->e_lfanew);
|
||||
PIMAGE_OPTIONAL_HEADER oH = (PIMAGE_OPTIONAL_HEADER)
|
||||
((PBYTE)ntH + sizeof (IMAGE_NT_SIGNATURE) + sizeof (IMAGE_FILE_HEADER));
|
||||
LPVOID pA = pBaseOfImage+oH->BaseOfCode;
|
||||
SIZE_T pS = oH->SizeOfCode;
|
||||
#if 1 // try to find the text section
|
||||
PIMAGE_SECTION_HEADER ntS = IMAGE_FIRST_SECTION (ntH);
|
||||
WORD s;
|
||||
for (s = 0; s < ntH->FileHeader.NumberOfSections; s++)
|
||||
{
|
||||
if (memcmp (ntS[s].Name, ".text\0\0", 8) == 0)
|
||||
{
|
||||
pA = pBaseOfImage+ntS[s].VirtualAddress;
|
||||
pS = ntS[s].Misc.VirtualSize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!VirtualProtect(pA,pS,NewRights,&OldRights))
|
||||
I_Error("Could not make code writable\n");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
static void
|
||||
ChDirToExe (void)
|
||||
@@ -177,7 +143,6 @@ int main(int argc, char **argv)
|
||||
ExcHndlInit();
|
||||
}
|
||||
}
|
||||
MakeCodeWritable();
|
||||
#endif
|
||||
|
||||
// startup SRB2
|
||||
|
||||
@@ -137,6 +137,12 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <execinfo.h>
|
||||
#include <time.h>
|
||||
#define UNIXBACKTRACE
|
||||
#endif
|
||||
|
||||
// Locations for searching the srb2.srb
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2Kart"
|
||||
@@ -252,6 +258,72 @@ SDL_bool framebuffer = SDL_FALSE;
|
||||
|
||||
UINT8 keyboard_started = false;
|
||||
|
||||
#ifdef UNIXBACKTRACE
|
||||
#define STDERR_WRITE(string) if (fd != -1) I_OutputMsg("%s", string)
|
||||
#define CRASHLOG_WRITE(string) if (fd != -1) write(fd, string, strlen(string))
|
||||
#define CRASHLOG_STDERR_WRITE(string) \
|
||||
if (fd != -1)\
|
||||
write(fd, string, strlen(string));\
|
||||
I_OutputMsg("%s", string)
|
||||
|
||||
static void write_backtrace(INT32 signal)
|
||||
{
|
||||
int fd = -1;
|
||||
size_t size;
|
||||
time_t rawtime;
|
||||
struct tm timeinfo;
|
||||
|
||||
enum { BT_SIZE = 1024, STR_SIZE = 32 };
|
||||
void *array[BT_SIZE];
|
||||
char timestr[STR_SIZE];
|
||||
|
||||
const char *error = "An error occurred within SRB2! Send this stack trace to someone who can help!\n";
|
||||
const char *error2 = "(Or find crash-log.txt in your SRB2 directory.)\n"; // Shown only to stderr.
|
||||
|
||||
fd = open(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), O_CREAT|O_APPEND|O_RDWR, S_IRUSR|S_IWUSR);
|
||||
|
||||
if (fd == -1)
|
||||
I_OutputMsg("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n");
|
||||
|
||||
// Get the current time as a string.
|
||||
time(&rawtime);
|
||||
localtime_r(&rawtime, &timeinfo);
|
||||
strftime(timestr, STR_SIZE, "%a, %d %b %Y %T %z", &timeinfo);
|
||||
|
||||
CRASHLOG_WRITE("------------------------\n"); // Nice looking seperator
|
||||
|
||||
CRASHLOG_STDERR_WRITE("\n"); // Newline to look nice for both outputs.
|
||||
CRASHLOG_STDERR_WRITE(error); // "Oops, SRB2 crashed" message
|
||||
STDERR_WRITE(error2); // Tell the user where the crash log is.
|
||||
|
||||
// Tell the log when we crashed.
|
||||
CRASHLOG_WRITE("Time of crash: ");
|
||||
CRASHLOG_WRITE(timestr);
|
||||
CRASHLOG_WRITE("\n");
|
||||
|
||||
// Give the crash log the cause and a nice 'Backtrace:' thing
|
||||
// The signal is given to the user when the parent process sees we crashed.
|
||||
CRASHLOG_WRITE("Cause: ");
|
||||
CRASHLOG_WRITE(strsignal(signal));
|
||||
CRASHLOG_WRITE("\n"); // Newline for the signal name
|
||||
|
||||
CRASHLOG_STDERR_WRITE("\nBacktrace:\n");
|
||||
|
||||
// Flood the output and log with the backtrace
|
||||
size = backtrace(array, BT_SIZE);
|
||||
backtrace_symbols_fd(array, size, fd);
|
||||
backtrace_symbols_fd(array, size, STDERR_FILENO);
|
||||
|
||||
CRASHLOG_WRITE("\n"); // Write another newline to the log so it looks nice :)
|
||||
|
||||
close(fd);
|
||||
}
|
||||
#undef STDERR_WRITE
|
||||
#undef CRASHLOG_WRITE
|
||||
#undef CRASHLOG_STDERR_WRITE
|
||||
|
||||
#endif // UNIXBACKTRACE
|
||||
|
||||
static void I_ReportSignal(int num, int coredumped)
|
||||
{
|
||||
//static char msg[] = "oh no! back to reality!\r\n";
|
||||
@@ -310,6 +382,9 @@ static void I_ReportSignal(int num, int coredumped)
|
||||
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
|
||||
{
|
||||
D_QuitNetGame(); // Fix server freezes
|
||||
#ifdef UNIXBACKTRACE
|
||||
write_backtrace(num);
|
||||
#endif
|
||||
I_ReportSignal(num, 0);
|
||||
I_ShutdownSystem();
|
||||
signal(num, SIG_DFL); //default signal action
|
||||
@@ -700,6 +775,28 @@ static void I_RegisterSignals (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef NEWSIGNALHANDLER
|
||||
static void signal_handler_child(INT32 num)
|
||||
{
|
||||
#ifdef UNIXBACKTRACE
|
||||
write_backtrace(num);
|
||||
#endif
|
||||
|
||||
signal(num, SIG_DFL); //default signal action
|
||||
raise(num);
|
||||
}
|
||||
|
||||
static void I_RegisterChildSignals(void)
|
||||
{
|
||||
// If these defines don't exist,
|
||||
// then compilation would have failed above us...
|
||||
signal(SIGILL , signal_handler_child);
|
||||
signal(SIGSEGV , signal_handler_child);
|
||||
signal(SIGABRT , signal_handler_child);
|
||||
signal(SIGFPE , signal_handler_child);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
//I_OutputMsg
|
||||
//
|
||||
@@ -3072,6 +3169,7 @@ static void I_Fork(void)
|
||||
newsignalhandler_Warn("fork()");
|
||||
break;
|
||||
case 0:
|
||||
I_RegisterChildSignals();
|
||||
break;
|
||||
default:
|
||||
if (logstream)
|
||||
|
||||
+1
-1
@@ -1297,7 +1297,7 @@ void I_GetEvent(void)
|
||||
break;
|
||||
case SDL_DROPFILE:
|
||||
dropped_filedir = evt.drop.file;
|
||||
P_AddWadFile(dropped_filedir);
|
||||
P_AddWadFile(dropped_filedir, false);
|
||||
SDL_free(dropped_filedir); // Free dropped_filedir memory
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
|
||||
+38
-3
@@ -58,6 +58,18 @@ patch_t *facerankprefix[MAXSKINS]; // ranking
|
||||
patch_t *facewantprefix[MAXSKINS]; // wanted
|
||||
patch_t *facemmapprefix[MAXSKINS]; // minimap
|
||||
|
||||
patch_t *localfacerankprefix[MAXSKINS]; // ranking
|
||||
patch_t *localfacewantprefix[MAXSKINS]; // wanted
|
||||
patch_t *localfacemmapprefix[MAXSKINS]; // minimap
|
||||
|
||||
char *facerankprefix_name[MAXSKINS]; // ranking
|
||||
char *facewantprefix_name[MAXSKINS]; // wanted
|
||||
char *facemmapprefix_name[MAXSKINS]; // minimap
|
||||
|
||||
char *localfacerankprefix_name[MAXSKINS]; // ranking
|
||||
char *localfacewantprefix_name[MAXSKINS]; // wanted
|
||||
char *localfacemmapprefix_name[MAXSKINS]; // minimap
|
||||
|
||||
// ------------------------------------------
|
||||
// status bar overlay
|
||||
// ------------------------------------------
|
||||
@@ -235,7 +247,7 @@ void ST_doPaletteStuff(void)
|
||||
palette = min(max(palette, 0), 13);
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && !cv_grpaletteshader.value || rendermode == render_opengl && cv_grpaletteshader.value && !cv_grflashpal.value)
|
||||
if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && cv_grpaletteshader.value && !cv_grflashpal.value))
|
||||
palette = 0; // No flashpals here in OpenGL
|
||||
#endif
|
||||
|
||||
@@ -244,7 +256,7 @@ void ST_doPaletteStuff(void)
|
||||
st_palette = palette;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_none && cv_grpaletteshader.value && cv_grflashpal.value)
|
||||
if (rendermode == render_soft || (rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value))
|
||||
#else
|
||||
if (rendermode != render_none)
|
||||
#endif
|
||||
@@ -382,6 +394,25 @@ void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 skin
|
||||
facerankprefix[skinnum] = W_CachePatchName(rankstr, PU_HUDGFX);
|
||||
facewantprefix[skinnum] = W_CachePatchName(wantstr, PU_HUDGFX);
|
||||
facemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
|
||||
|
||||
facerankprefix_name[skinnum] = rankstr;
|
||||
facewantprefix_name[skinnum] = wantstr;
|
||||
facemmapprefix_name[skinnum] = mmapstr;
|
||||
}
|
||||
|
||||
void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 skinnum)
|
||||
{
|
||||
localfacerankprefix[skinnum] = W_CachePatchName(rankstr, PU_HUDGFX);
|
||||
localfacewantprefix[skinnum] = W_CachePatchName(wantstr, PU_HUDGFX);
|
||||
localfacemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
|
||||
|
||||
localfacerankprefix_name[skinnum] = rankstr;
|
||||
localfacewantprefix_name[skinnum] = wantstr;
|
||||
localfacemmapprefix_name[skinnum] = mmapstr;
|
||||
|
||||
//CONS_Printf("Added rank prefix %s\n", rankstr);
|
||||
//CONS_Printf("Added want prefix %s\n", wantstr);
|
||||
//CONS_Printf("Added mmap prefix %s\n", mmapstr);
|
||||
}
|
||||
|
||||
void ST_ReloadSkinFaceGraphics(void)
|
||||
@@ -390,6 +421,10 @@ void ST_ReloadSkinFaceGraphics(void)
|
||||
|
||||
for (i = 0; i < numskins; i++)
|
||||
ST_LoadFaceGraphics(skins[i].facerank, skins[i].facewant, skins[i].facemmap, i);
|
||||
|
||||
for (i = 0; i < numlocalskins; i++) {
|
||||
ST_LoadLocalFaceGraphics(localskins[i].facerank, localskins[i].facewant, localskins[i].facemmap, i);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ST_InitData(void)
|
||||
@@ -2171,7 +2206,7 @@ void ST_Drawer(void)
|
||||
//25/08/99: Hurdler: palette changes is done for all players,
|
||||
// not only player1! That's why this part
|
||||
// of code is moved somewhere else.
|
||||
if (rendermode == render_soft || rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value)
|
||||
if (rendermode == render_soft || (rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value))
|
||||
#endif
|
||||
if (rendermode != render_none) ST_doPaletteStuff();
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ void ST_LoadGraphics(void);
|
||||
|
||||
// face load graphics, called when skin changes
|
||||
void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum);
|
||||
void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum);
|
||||
void ST_ReloadSkinFaceGraphics(void);
|
||||
#ifdef DELFILE
|
||||
void ST_UnLoadFaceGraphics(INT32 skinnum);
|
||||
@@ -78,6 +79,15 @@ extern patch_t *sboperiod;
|
||||
extern patch_t *facerankprefix[MAXSKINS]; // ranking
|
||||
extern patch_t *facewantprefix[MAXSKINS]; // wanted
|
||||
extern patch_t *facemmapprefix[MAXSKINS]; // minimap
|
||||
extern patch_t *localfacerankprefix[MAXSKINS]; // ranking
|
||||
extern patch_t *localfacewantprefix[MAXSKINS]; // wanted
|
||||
extern patch_t *localfacemmapprefix[MAXSKINS]; // minimap
|
||||
extern char *facerankprefix_name[MAXSKINS]; // ranking
|
||||
extern char *facewantprefix_name[MAXSKINS]; // wanted
|
||||
extern char *facemmapprefix_name[MAXSKINS]; // minimap
|
||||
extern char *localfacerankprefix_name[MAXSKINS]; // ranking
|
||||
extern char *localfacewantprefix_name[MAXSKINS]; // wanted
|
||||
extern char *localfacemmapprefix_name[MAXSKINS]; // minimap
|
||||
extern patch_t *livesback;
|
||||
extern patch_t *ngradeletters[7];
|
||||
|
||||
|
||||
-1587
File diff suppressed because it is too large.
Load diff
-322
@@ -1,322 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file tmap_asm.s
|
||||
/// \brief ???
|
||||
|
||||
//.comm _dc_colormap,4
|
||||
//.comm _dc_x,4
|
||||
//.comm _dc_yl,4
|
||||
//.comm _dc_yh,4
|
||||
//.comm _dc_iscale,4
|
||||
//.comm _dc_texturemid,4
|
||||
//.comm _dc_source,4
|
||||
//.comm _ylookup,4
|
||||
//.comm _columnofs,4
|
||||
//.comm _loopcount,4
|
||||
//.comm _pixelcount,4
|
||||
.data
|
||||
_pixelcount:
|
||||
.long 0x00000000
|
||||
_loopcount:
|
||||
.long 0x00000000
|
||||
.align 8
|
||||
_mmxcomm:
|
||||
.long 0x00000000
|
||||
.text
|
||||
|
||||
.align 4
|
||||
.globl _R_DrawColumn8_NOMMX
|
||||
_R_DrawColumn8_NOMMX:
|
||||
pushl %ebp
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
pushl %ebx
|
||||
movl _dc_yl,%edx
|
||||
movl _dc_yh,%eax
|
||||
subl %edx,%eax
|
||||
leal 1(%eax),%ebx
|
||||
testl %ebx,%ebx
|
||||
jle rdc8ndone
|
||||
movl _dc_x,%eax
|
||||
movl _ylookup, %edi
|
||||
movl (%edi,%edx,4),%esi
|
||||
movl _columnofs, %edi
|
||||
addl (%edi,%eax,4),%esi
|
||||
movl _dc_iscale,%edi
|
||||
movl %edx,%eax
|
||||
imull %edi,%eax
|
||||
movl _dc_texturemid,%ecx
|
||||
addl %eax,%ecx
|
||||
|
||||
movl _dc_source,%ebp
|
||||
xorl %edx, %edx
|
||||
subl $0x12345678, %esi
|
||||
.globl rdc8nwidth1
|
||||
rdc8nwidth1:
|
||||
.align 4,0x90
|
||||
rdc8nloop:
|
||||
movl %ecx,%eax
|
||||
shrl $16,%eax
|
||||
addl %edi,%ecx
|
||||
andl $127,%eax
|
||||
addl $0x12345678,%esi
|
||||
.globl rdc8nwidth2
|
||||
rdc8nwidth2:
|
||||
movb (%eax,%ebp),%dl
|
||||
movl _dc_colormap,%eax
|
||||
movb (%eax,%edx),%al
|
||||
movb %al,(%esi)
|
||||
decl %ebx
|
||||
jne rdc8nloop
|
||||
rdc8ndone:
|
||||
popl %ebx
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
//
|
||||
// Optimised specifically for P54C/P55C (aka Pentium with/without MMX)
|
||||
// By ES 1998/08/01
|
||||
//
|
||||
|
||||
.globl _R_DrawColumn_8_Pentium
|
||||
_R_DrawColumn_8_Pentium:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl _dc_yl,%eax // Top pixel
|
||||
movl _dc_yh,%ebx // Bottom pixel
|
||||
movl _ylookup, %edi
|
||||
movl (%edi,%ebx,4),%ecx
|
||||
subl %eax,%ebx // ebx=number of pixels-1
|
||||
jl rdc8pdone // no pixel to draw, done
|
||||
jnz rdc8pmany
|
||||
movl _dc_x,%edx // Special case: only one pixel
|
||||
movl _columnofs, %edi
|
||||
addl (%edi,%edx,4),%ecx // dest pixel at (%ecx)
|
||||
movl _dc_iscale,%esi
|
||||
imull %esi,%eax
|
||||
movl _dc_texturemid,%edi
|
||||
addl %eax,%edi // texture index in edi
|
||||
movl _dc_colormap,%edx
|
||||
shrl $16, %edi
|
||||
movl _dc_source,%ebp
|
||||
andl $127,%edi
|
||||
movb (%edi,%ebp),%dl // read texture pixel
|
||||
movb (%edx),%al // lookup for light
|
||||
movb %al,0(%ecx) // write it
|
||||
jmp rdc8pdone // done!
|
||||
.align 4, 0x90
|
||||
rdc8pmany: // draw >1 pixel
|
||||
movl _dc_x,%edx
|
||||
movl _columnofs, %edi
|
||||
movl (%edi,%edx,4),%edx
|
||||
leal 0x12345678(%edx, %ecx), %edi // edi = two pixels above bottom
|
||||
.globl rdc8pwidth5
|
||||
rdc8pwidth5: // DeadBeef = -2*SCREENWIDTH
|
||||
movl _dc_iscale,%edx // edx = fracstep
|
||||
imull %edx,%eax
|
||||
shll $9, %edx // fixme: Should get 7.25 fix as input
|
||||
movl _dc_texturemid,%ecx
|
||||
addl %eax,%ecx // ecx = frac
|
||||
movl _dc_colormap,%eax // eax = lighting/special effects LUT
|
||||
shll $9, %ecx
|
||||
movl _dc_source,%esi // esi = source ptr
|
||||
|
||||
imull $0x12345678, %ebx // ebx = negative offset to pixel
|
||||
.globl rdc8pwidth6
|
||||
rdc8pwidth6: // DeadBeef = -SCREENWIDTH
|
||||
|
||||
// Begin the calculation of the two first pixels
|
||||
leal (%ecx, %edx), %ebp
|
||||
shrl $25, %ecx
|
||||
movb (%esi, %ecx), %al
|
||||
leal (%edx, %ebp), %ecx
|
||||
shrl $25, %ebp
|
||||
movb (%eax), %dl
|
||||
|
||||
// The main loop
|
||||
rdc8ploop:
|
||||
movb (%esi,%ebp), %al // load 1
|
||||
leal (%ecx, %edx), %ebp // calc frac 3
|
||||
|
||||
shrl $25, %ecx // shift frac 2
|
||||
movb %dl, 0x12345678(%edi, %ebx)// store 0
|
||||
.globl rdc8pwidth1
|
||||
rdc8pwidth1: // DeadBeef = 2*SCREENWIDTH
|
||||
|
||||
movb (%eax), %al // lookup 1
|
||||
|
||||
movb %al, 0x12345678(%edi, %ebx)// store 1
|
||||
.globl rdc8pwidth2
|
||||
rdc8pwidth2: // DeadBeef = 3*SCREENWIDTH
|
||||
movb (%esi, %ecx), %al // load 2
|
||||
|
||||
leal (%ebp, %edx), %ecx // calc frac 4
|
||||
|
||||
shrl $25, %ebp // shift frac 3
|
||||
movb (%eax), %dl // lookup 2
|
||||
|
||||
addl $0x12345678, %ebx // counter
|
||||
.globl rdc8pwidth3
|
||||
rdc8pwidth3: // DeadBeef = 2*SCREENWIDTH
|
||||
jl rdc8ploop // loop
|
||||
|
||||
// End of loop. Write extra pixel or just exit.
|
||||
jnz rdc8pdone
|
||||
movb %dl, 0x12345678(%edi, %ebx)// Write odd pixel
|
||||
.globl rdc8pwidth4
|
||||
rdc8pwidth4: // DeadBeef = 2*SCREENWIDTH
|
||||
|
||||
rdc8pdone:
|
||||
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
//
|
||||
// MMX asm version, optimised for K6
|
||||
// By ES 1998/07/05
|
||||
//
|
||||
|
||||
.globl _R_DrawColumn_8_K6_MMX
|
||||
_R_DrawColumn_8_K6_MMX:
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
movl %esp, %eax // Push 8 or 12, so that (%esp) gets aligned by 8
|
||||
andl $7,%eax
|
||||
addl $8,%eax
|
||||
movl %eax, _mmxcomm // Temp storage in mmxcomm: (%esp) is used instead
|
||||
subl %eax,%esp
|
||||
|
||||
movl _dc_yl,%edx // Top pixel
|
||||
movl _dc_yh,%ebx // Bottom pixel
|
||||
movl _ylookup, %edi
|
||||
movl (%edi,%ebx,4),%ecx
|
||||
subl %edx,%ebx // ebx=number of pixels-1
|
||||
jl 0x12345678 // no pixel to draw, done
|
||||
.globl rdc8moffs1
|
||||
rdc8moffs1:
|
||||
jnz rdc8mmany
|
||||
movl _dc_x,%eax // Special case: only one pixel
|
||||
movl _columnofs, %edi
|
||||
addl (%edi,%eax,4),%ecx // dest pixel at (%ecx)
|
||||
movl _dc_iscale,%esi
|
||||
imull %esi,%edx
|
||||
movl _dc_texturemid,%edi
|
||||
addl %edx,%edi // texture index in edi
|
||||
movl _dc_colormap,%edx
|
||||
shrl $16, %edi
|
||||
movl _dc_source,%ebp
|
||||
andl $127,%edi
|
||||
movb (%edi,%ebp),%dl // read texture pixel
|
||||
movb (%edx),%al // lookup for light
|
||||
movb %al,0(%ecx) // write it
|
||||
jmp rdc8mdone // done!
|
||||
.globl rdc8moffs2
|
||||
rdc8moffs2:
|
||||
.align 4, 0x90
|
||||
rdc8mmany: // draw >1 pixel
|
||||
movl _dc_x,%eax
|
||||
movl _columnofs, %edi
|
||||
movl (%edi,%eax,4),%eax
|
||||
leal 0x12345678(%eax, %ecx), %esi // esi = two pixels above bottom
|
||||
.globl rdc8mwidth3
|
||||
rdc8mwidth3: // DeadBeef = -2*SCREENWIDTH
|
||||
movl _dc_iscale,%ecx // ecx = fracstep
|
||||
imull %ecx,%edx
|
||||
shll $9, %ecx // fixme: Should get 7.25 fix as input
|
||||
movl _dc_texturemid,%eax
|
||||
addl %edx,%eax // eax = frac
|
||||
movl _dc_colormap,%edx // edx = lighting/special effects LUT
|
||||
shll $9, %eax
|
||||
leal (%ecx, %ecx), %edi
|
||||
movl _dc_source,%ebp // ebp = source ptr
|
||||
movl %edi, 0(%esp) // Start moving frac and fracstep to MMX regs
|
||||
|
||||
imull $0x12345678, %ebx // ebx = negative offset to pixel
|
||||
.globl rdc8mwidth5
|
||||
rdc8mwidth5: // DeadBeef = -SCREENWIDTH
|
||||
|
||||
movl %edi, 4(%esp)
|
||||
leal (%eax, %ecx), %edi
|
||||
movq 0(%esp), %mm1 // fracstep:fracstep in mm1
|
||||
movl %eax, 0(%esp)
|
||||
shrl $25, %eax
|
||||
movl %edi, 4(%esp)
|
||||
movzbl (%ebp, %eax), %eax
|
||||
movq 0(%esp), %mm0 // frac:frac in mm0
|
||||
|
||||
paddd %mm1, %mm0
|
||||
shrl $25, %edi
|
||||
movq %mm0, %mm2
|
||||
psrld $25, %mm2 // texture index in mm2
|
||||
paddd %mm1, %mm0
|
||||
movq %mm2, 0(%esp)
|
||||
|
||||
.globl rdc8mloop
|
||||
rdc8mloop: // The main loop
|
||||
movq %mm0, %mm2 // move 4-5 to temp reg
|
||||
movzbl (%ebp, %edi), %edi // read 1
|
||||
|
||||
psrld $25, %mm2 // shift 4-5
|
||||
movb (%edx,%eax), %cl // lookup 0
|
||||
|
||||
movl 0(%esp), %eax // load 2
|
||||
addl $0x12345678, %ebx // counter
|
||||
.globl rdc8mwidth2
|
||||
rdc8mwidth2: // DeadBeef = 2*SCREENWIDTH
|
||||
|
||||
movb %cl, (%esi, %ebx) // write 0
|
||||
movb (%edx,%edi), %ch // lookup 1
|
||||
|
||||
movb %ch, 0x12345678(%esi, %ebx) // write 1
|
||||
.globl rdc8mwidth1
|
||||
rdc8mwidth1: // DeadBeef = SCREENWIDTH
|
||||
movl 4(%esp), %edi // load 3
|
||||
|
||||
paddd %mm1, %mm0 // frac 6-7
|
||||
movzbl (%ebp, %eax), %eax // lookup 2
|
||||
|
||||
movq %mm2, 0(%esp) // store texture index 4-5
|
||||
jl rdc8mloop
|
||||
|
||||
jnz rdc8mno_odd
|
||||
movb (%edx,%eax), %cl // write the last odd pixel
|
||||
movb %cl, 0x12345678(%esi)
|
||||
.globl rdc8mwidth4
|
||||
rdc8mwidth4: // DeadBeef = 2*SCREENWIDTH
|
||||
rdc8mno_odd:
|
||||
|
||||
.globl rdc8mdone
|
||||
rdc8mdone:
|
||||
emms
|
||||
|
||||
addl _mmxcomm, %esp
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
// Need some extra space to align run-time
|
||||
.globl R_DrawColumn_8_K6_MMX_end
|
||||
R_DrawColumn_8_K6_MMX_end:
|
||||
nop;nop;nop;nop;nop;nop;nop;nop;
|
||||
nop;nop;nop;nop;nop;nop;nop;nop;
|
||||
nop;nop;nop;nop;nop;nop;nop;nop;
|
||||
nop;nop;nop;nop;nop;nop;nop;
|
||||
@@ -1,674 +0,0 @@
|
||||
;; SONIC ROBO BLAST 2
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Copyright (C) 1998-2000 by DOSDOOM.
|
||||
;; Copyright (C) 2010-2018 by Sonic Team Junior.
|
||||
;;
|
||||
;; This program is free software distributed under the
|
||||
;; terms of the GNU General Public License, version 2.
|
||||
;; See the 'LICENSE' file for more details.
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; FILE:
|
||||
;; tmap_mmx.nas
|
||||
;; DESCRIPTION:
|
||||
;; Assembler optimised rendering code for software mode, using SIMD
|
||||
;; instructions.
|
||||
;; Draw wall columns.
|
||||
|
||||
|
||||
[BITS 32]
|
||||
|
||||
%define FRACBITS 16
|
||||
%define TRANSPARENTPIXEL 247
|
||||
|
||||
%ifdef LINUX
|
||||
%macro cextern 1
|
||||
[extern %1]
|
||||
%endmacro
|
||||
|
||||
%macro cglobal 1
|
||||
[global %1]
|
||||
%endmacro
|
||||
|
||||
%else
|
||||
%macro cextern 1
|
||||
%define %1 _%1
|
||||
[extern %1]
|
||||
%endmacro
|
||||
|
||||
%macro cglobal 1
|
||||
%define %1 _%1
|
||||
[global %1]
|
||||
%endmacro
|
||||
|
||||
%endif
|
||||
|
||||
|
||||
; The viddef_s structure. We only need the width field.
|
||||
struc viddef_s
|
||||
resb 12
|
||||
.width: resb 4
|
||||
resb 44
|
||||
endstruc
|
||||
|
||||
|
||||
;; externs
|
||||
;; columns
|
||||
cextern dc_colormap
|
||||
cextern dc_x
|
||||
cextern dc_yl
|
||||
cextern dc_yh
|
||||
cextern dc_iscale
|
||||
cextern dc_texturemid
|
||||
cextern dc_texheight
|
||||
cextern dc_source
|
||||
cextern dc_hires
|
||||
cextern centery
|
||||
cextern centeryfrac
|
||||
cextern dc_transmap
|
||||
|
||||
cextern R_DrawColumn_8_ASM
|
||||
cextern R_Draw2sMultiPatchColumn_8_ASM
|
||||
|
||||
;; spans
|
||||
cextern nflatshiftup
|
||||
cextern nflatxshift
|
||||
cextern nflatyshift
|
||||
cextern nflatmask
|
||||
cextern ds_xfrac
|
||||
cextern ds_yfrac
|
||||
cextern ds_xstep
|
||||
cextern ds_ystep
|
||||
cextern ds_x1
|
||||
cextern ds_x2
|
||||
cextern ds_y
|
||||
cextern ds_source
|
||||
cextern ds_colormap
|
||||
|
||||
cextern ylookup
|
||||
cextern columnofs
|
||||
cextern vid
|
||||
|
||||
[SECTION .data]
|
||||
|
||||
nflatmask64 dq 0
|
||||
|
||||
|
||||
[SECTION .text]
|
||||
|
||||
;;----------------------------------------------------------------------
|
||||
;;
|
||||
;; R_DrawColumn : 8bpp column drawer
|
||||
;;
|
||||
;; MMX column drawer.
|
||||
;;
|
||||
;;----------------------------------------------------------------------
|
||||
;; eax = accumulator
|
||||
;; ebx = colormap
|
||||
;; ecx = count
|
||||
;; edx = accumulator
|
||||
;; esi = source
|
||||
;; edi = dest
|
||||
;; ebp = vid.width
|
||||
;; mm0 = accumulator
|
||||
;; mm1 = heightmask, twice
|
||||
;; mm2 = 2 * fracstep, twice
|
||||
;; mm3 = pair of consecutive fracs
|
||||
;;----------------------------------------------------------------------
|
||||
|
||||
|
||||
cglobal R_DrawColumn_8_MMX
|
||||
R_DrawColumn_8_MMX:
|
||||
push ebp ;; preserve caller's stack frame pointer
|
||||
push esi ;; preserve register variables
|
||||
push edi
|
||||
push ebx
|
||||
|
||||
;;
|
||||
;; Our algorithm requires that the texture height be a power of two.
|
||||
;; If not, fall back to the non-MMX drawer.
|
||||
;;
|
||||
.texheightcheck:
|
||||
mov edx, [dc_texheight]
|
||||
sub edx, 1 ;; edx = heightmask
|
||||
test edx, [dc_texheight]
|
||||
jnz near .usenonMMX
|
||||
|
||||
mov ebp, edx ;; Keep a copy of heightmask in a
|
||||
;; GPR for the time being.
|
||||
|
||||
;;
|
||||
;; Fill mm1 with heightmask
|
||||
;;
|
||||
movd mm1, edx ;; low dword = heightmask
|
||||
punpckldq mm1, mm1 ;; copy low dword to high dword
|
||||
|
||||
;;
|
||||
;; dest = ylookup[dc_yl] + columnofs[dc_x];
|
||||
;;
|
||||
mov eax, [dc_yl]
|
||||
mov edi, [ylookup+eax*4]
|
||||
mov ebx, [dc_x]
|
||||
add edi, [columnofs+ebx*4] ;; edi = dest
|
||||
|
||||
|
||||
;;
|
||||
;; pixelcount = yh - yl + 1
|
||||
;;
|
||||
mov ecx, [dc_yh]
|
||||
add ecx, 1
|
||||
sub ecx, eax ;; pixel count
|
||||
jle near .done ;; nothing to scale
|
||||
|
||||
;;
|
||||
;; fracstep = dc_iscale;
|
||||
;;
|
||||
movd mm2, [dc_iscale] ;; fracstep in low dword
|
||||
punpckldq mm2, mm2 ;; copy to high dword
|
||||
|
||||
mov ebx, [dc_colormap]
|
||||
mov esi, [dc_source]
|
||||
|
||||
;;
|
||||
;; frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
|
||||
;;
|
||||
;; eax == dc_yl already
|
||||
shl eax, FRACBITS
|
||||
sub eax, [centeryfrac]
|
||||
imul dword [dc_iscale]
|
||||
shrd eax, edx, FRACBITS
|
||||
add eax, [dc_texturemid]
|
||||
|
||||
;;
|
||||
;; if (dc_hires) frac = 0;
|
||||
;;
|
||||
test byte [dc_hires], 0x01
|
||||
jz .mod2
|
||||
xor eax, eax
|
||||
|
||||
|
||||
;;
|
||||
;; Do mod-2 pixel.
|
||||
;;
|
||||
.mod2:
|
||||
test ecx, 1
|
||||
jz .pairprepare
|
||||
mov edx, eax ;; edx = frac
|
||||
add eax, [dc_iscale] ;; eax += fracstep
|
||||
sar edx, FRACBITS
|
||||
and edx, ebp ;; edx &= heightmask
|
||||
movzx edx, byte [esi + edx]
|
||||
movzx edx, byte [ebx + edx]
|
||||
mov [edi], dl
|
||||
|
||||
add edi, [vid + viddef_s.width]
|
||||
sub ecx, 1
|
||||
jz .done
|
||||
|
||||
.pairprepare:
|
||||
;;
|
||||
;; Prepare for the main loop.
|
||||
;;
|
||||
movd mm3, eax ;; Low dword = frac
|
||||
movq mm4, mm3 ;; Copy to intermediate register
|
||||
paddd mm4, mm2 ;; dwords of mm4 += fracstep
|
||||
punpckldq mm3, mm4 ;; Low dword = first frac, high = second
|
||||
pslld mm2, 1 ;; fracstep *= 2
|
||||
|
||||
;;
|
||||
;; ebp = vid.width
|
||||
;;
|
||||
mov ebp, [vid + viddef_s.width]
|
||||
|
||||
align 16
|
||||
.pairloop:
|
||||
movq mm0, mm3 ;; 3B 1u.
|
||||
psrad mm0, FRACBITS ;; 4B 1u.
|
||||
pand mm0, mm1 ;; 3B 1u. frac &= heightmask
|
||||
paddd mm3, mm2 ;; 3B 1u. frac += fracstep
|
||||
|
||||
movd eax, mm0 ;; 3B 1u. Get first frac
|
||||
;; IFETCH boundary
|
||||
movzx eax, byte [esi + eax] ;; 4B 1u. Texture map
|
||||
movzx eax, byte [ebx + eax] ;; 4B 1u. Colormap
|
||||
|
||||
punpckhdq mm0, mm0 ;; 3B 1(2)u. low dword = high dword
|
||||
movd edx, mm0 ;; 3B 1u. Get second frac
|
||||
mov [edi], al ;; 2B 1(2)u. First pixel
|
||||
;; IFETCH boundary
|
||||
|
||||
movzx edx, byte [esi + edx] ;; 4B 1u. Texture map
|
||||
movzx edx, byte [ebx + edx] ;; 4B 1u. Colormap
|
||||
mov [edi + 1*ebp], dl ;; 3B 1(2)u. Second pixel
|
||||
|
||||
lea edi, [edi + 2*ebp] ;; 3B 1u. edi += 2 * vid.width
|
||||
;; IFETCH boundary
|
||||
sub ecx, 2 ;; 3B 1u. count -= 2
|
||||
jnz .pairloop ;; 2B 1u. if(count != 0) goto .pairloop
|
||||
|
||||
|
||||
.done:
|
||||
;;
|
||||
;; Clear MMX state, or else FPU operations will go badly awry.
|
||||
;;
|
||||
emms
|
||||
|
||||
pop ebx
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
.usenonMMX:
|
||||
call R_DrawColumn_8_ASM
|
||||
jmp .done
|
||||
|
||||
|
||||
;;----------------------------------------------------------------------
|
||||
;;
|
||||
;; R_Draw2sMultiPatchColumn : Like R_DrawColumn, but omits transparent
|
||||
;; pixels.
|
||||
;;
|
||||
;; MMX column drawer.
|
||||
;;
|
||||
;;----------------------------------------------------------------------
|
||||
;; eax = accumulator
|
||||
;; ebx = colormap
|
||||
;; ecx = count
|
||||
;; edx = accumulator
|
||||
;; esi = source
|
||||
;; edi = dest
|
||||
;; ebp = vid.width
|
||||
;; mm0 = accumulator
|
||||
;; mm1 = heightmask, twice
|
||||
;; mm2 = 2 * fracstep, twice
|
||||
;; mm3 = pair of consecutive fracs
|
||||
;;----------------------------------------------------------------------
|
||||
|
||||
|
||||
cglobal R_Draw2sMultiPatchColumn_8_MMX
|
||||
R_Draw2sMultiPatchColumn_8_MMX:
|
||||
push ebp ;; preserve caller's stack frame pointer
|
||||
push esi ;; preserve register variables
|
||||
push edi
|
||||
push ebx
|
||||
|
||||
;;
|
||||
;; Our algorithm requires that the texture height be a power of two.
|
||||
;; If not, fall back to the non-MMX drawer.
|
||||
;;
|
||||
.texheightcheck:
|
||||
mov edx, [dc_texheight]
|
||||
sub edx, 1 ;; edx = heightmask
|
||||
test edx, [dc_texheight]
|
||||
jnz near .usenonMMX
|
||||
|
||||
mov ebp, edx ;; Keep a copy of heightmask in a
|
||||
;; GPR for the time being.
|
||||
|
||||
;;
|
||||
;; Fill mm1 with heightmask
|
||||
;;
|
||||
movd mm1, edx ;; low dword = heightmask
|
||||
punpckldq mm1, mm1 ;; copy low dword to high dword
|
||||
|
||||
;;
|
||||
;; dest = ylookup[dc_yl] + columnofs[dc_x];
|
||||
;;
|
||||
mov eax, [dc_yl]
|
||||
mov edi, [ylookup+eax*4]
|
||||
mov ebx, [dc_x]
|
||||
add edi, [columnofs+ebx*4] ;; edi = dest
|
||||
|
||||
|
||||
;;
|
||||
;; pixelcount = yh - yl + 1
|
||||
;;
|
||||
mov ecx, [dc_yh]
|
||||
add ecx, 1
|
||||
sub ecx, eax ;; pixel count
|
||||
jle near .done ;; nothing to scale
|
||||
;;
|
||||
;; fracstep = dc_iscale;
|
||||
;;
|
||||
movd mm2, [dc_iscale] ;; fracstep in low dword
|
||||
punpckldq mm2, mm2 ;; copy to high dword
|
||||
|
||||
mov ebx, [dc_colormap]
|
||||
mov esi, [dc_source]
|
||||
|
||||
;;
|
||||
;; frac = (dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep));
|
||||
;;
|
||||
;; eax == dc_yl already
|
||||
shl eax, FRACBITS
|
||||
sub eax, [centeryfrac]
|
||||
imul dword [dc_iscale]
|
||||
shrd eax, edx, FRACBITS
|
||||
add eax, [dc_texturemid]
|
||||
|
||||
;;
|
||||
;; if (dc_hires) frac = 0;
|
||||
;;
|
||||
test byte [dc_hires], 0x01
|
||||
jz .mod2
|
||||
xor eax, eax
|
||||
|
||||
|
||||
;;
|
||||
;; Do mod-2 pixel.
|
||||
;;
|
||||
.mod2:
|
||||
test ecx, 1
|
||||
jz .pairprepare
|
||||
mov edx, eax ;; edx = frac
|
||||
add eax, [dc_iscale] ;; eax += fracstep
|
||||
sar edx, FRACBITS
|
||||
and edx, ebp ;; edx &= heightmask
|
||||
movzx edx, byte [esi + edx]
|
||||
cmp dl, TRANSPARENTPIXEL
|
||||
je .nextmod2
|
||||
movzx edx, byte [ebx + edx]
|
||||
mov [edi], dl
|
||||
|
||||
.nextmod2:
|
||||
add edi, [vid + viddef_s.width]
|
||||
sub ecx, 1
|
||||
jz .done
|
||||
|
||||
.pairprepare:
|
||||
;;
|
||||
;; Prepare for the main loop.
|
||||
;;
|
||||
movd mm3, eax ;; Low dword = frac
|
||||
movq mm4, mm3 ;; Copy to intermediate register
|
||||
paddd mm4, mm2 ;; dwords of mm4 += fracstep
|
||||
punpckldq mm3, mm4 ;; Low dword = first frac, high = second
|
||||
pslld mm2, 1 ;; fracstep *= 2
|
||||
|
||||
;;
|
||||
;; ebp = vid.width
|
||||
;;
|
||||
mov ebp, [vid + viddef_s.width]
|
||||
|
||||
align 16
|
||||
.pairloop:
|
||||
movq mm0, mm3 ;; 3B 1u.
|
||||
psrad mm0, FRACBITS ;; 4B 1u.
|
||||
pand mm0, mm1 ;; 3B 1u. frac &= heightmask
|
||||
paddd mm3, mm2 ;; 3B 1u. frac += fracstep
|
||||
|
||||
movd eax, mm0 ;; 3B 1u. Get first frac
|
||||
;; IFETCH boundary
|
||||
movzx eax, byte [esi + eax] ;; 4B 1u. Texture map
|
||||
punpckhdq mm0, mm0 ;; 3B 1(2)u. low dword = high dword
|
||||
movd edx, mm0 ;; 3B 1u. Get second frac
|
||||
cmp al, TRANSPARENTPIXEL ;; 2B 1u.
|
||||
je .secondinpair ;; 2B 1u.
|
||||
;; IFETCH boundary
|
||||
movzx eax, byte [ebx + eax] ;; 4B 1u. Colormap
|
||||
mov [edi], al ;; 2B 1(2)u. First pixel
|
||||
|
||||
.secondinpair:
|
||||
movzx edx, byte [esi + edx] ;; 4B 1u. Texture map
|
||||
cmp dl, TRANSPARENTPIXEL ;; 2B 1u.
|
||||
je .nextpair ;; 2B 1u.
|
||||
;; IFETCH boundary
|
||||
movzx edx, byte [ebx + edx] ;; 4B 1u. Colormap
|
||||
mov [edi + 1*ebp], dl ;; 3B 1(2)u. Second pixel
|
||||
|
||||
.nextpair:
|
||||
lea edi, [edi + 2*ebp] ;; 3B 1u. edi += 2 * vid.width
|
||||
sub ecx, 2 ;; 3B 1u. count -= 2
|
||||
jnz .pairloop ;; 2B 1u. if(count != 0) goto .pairloop
|
||||
|
||||
|
||||
.done:
|
||||
;;
|
||||
;; Clear MMX state, or else FPU operations will go badly awry.
|
||||
;;
|
||||
emms
|
||||
|
||||
pop ebx
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
.usenonMMX:
|
||||
call R_Draw2sMultiPatchColumn_8_ASM
|
||||
jmp .done
|
||||
|
||||
|
||||
;;----------------------------------------------------------------------
|
||||
;;
|
||||
;; R_DrawSpan : 8bpp span drawer
|
||||
;;
|
||||
;; MMX span drawer.
|
||||
;;
|
||||
;;----------------------------------------------------------------------
|
||||
;; eax = accumulator
|
||||
;; ebx = colormap
|
||||
;; ecx = count
|
||||
;; edx = accumulator
|
||||
;; esi = source
|
||||
;; edi = dest
|
||||
;; ebp = two pixels
|
||||
;; mm0 = accumulator
|
||||
;; mm1 = xposition
|
||||
;; mm2 = yposition
|
||||
;; mm3 = 2 * xstep
|
||||
;; mm4 = 2 * ystep
|
||||
;; mm5 = nflatxshift
|
||||
;; mm6 = nflatyshift
|
||||
;; mm7 = accumulator
|
||||
;;----------------------------------------------------------------------
|
||||
|
||||
cglobal R_DrawSpan_8_MMX
|
||||
R_DrawSpan_8_MMX:
|
||||
push ebp ;; preserve caller's stack frame pointer
|
||||
push esi ;; preserve register variables
|
||||
push edi
|
||||
push ebx
|
||||
|
||||
;;
|
||||
;; esi = ds_source
|
||||
;; ebx = ds_colormap
|
||||
;;
|
||||
mov esi, [ds_source]
|
||||
mov ebx, [ds_colormap]
|
||||
|
||||
;;
|
||||
;; edi = ylookup[ds_y] + columnofs[ds_x1]
|
||||
;;
|
||||
mov eax, [ds_y]
|
||||
mov edi, [ylookup + eax*4]
|
||||
mov edx, [ds_x1]
|
||||
add edi, [columnofs + edx*4]
|
||||
|
||||
;;
|
||||
;; ecx = ds_x2 - ds_x1 + 1
|
||||
;;
|
||||
mov ecx, [ds_x2]
|
||||
sub ecx, edx
|
||||
add ecx, 1
|
||||
|
||||
;;
|
||||
;; Needed for fracs and steps
|
||||
;;
|
||||
movd mm7, [nflatshiftup]
|
||||
|
||||
;;
|
||||
;; mm3 = xstep
|
||||
;;
|
||||
movd mm3, [ds_xstep]
|
||||
pslld mm3, mm7
|
||||
punpckldq mm3, mm3
|
||||
|
||||
;;
|
||||
;; mm4 = ystep
|
||||
;;
|
||||
movd mm4, [ds_ystep]
|
||||
pslld mm4, mm7
|
||||
punpckldq mm4, mm4
|
||||
|
||||
;;
|
||||
;; mm1 = pair of consecutive xpositions
|
||||
;;
|
||||
movd mm1, [ds_xfrac]
|
||||
pslld mm1, mm7
|
||||
movq mm6, mm1
|
||||
paddd mm6, mm3
|
||||
punpckldq mm1, mm6
|
||||
|
||||
;;
|
||||
;; mm2 = pair of consecutive ypositions
|
||||
;;
|
||||
movd mm2, [ds_yfrac]
|
||||
pslld mm2, mm7
|
||||
movq mm6, mm2
|
||||
paddd mm6, mm4
|
||||
punpckldq mm2, mm6
|
||||
|
||||
;;
|
||||
;; mm5 = nflatxshift
|
||||
;; mm6 = nflatyshift
|
||||
;;
|
||||
movd mm5, [nflatxshift]
|
||||
movd mm6, [nflatyshift]
|
||||
|
||||
;;
|
||||
;; Mask is in memory due to lack of registers.
|
||||
;;
|
||||
mov eax, [nflatmask]
|
||||
mov [nflatmask64], eax
|
||||
mov [nflatmask64 + 4], eax
|
||||
|
||||
|
||||
;;
|
||||
;; Go until we reach a dword boundary.
|
||||
;;
|
||||
.unaligned:
|
||||
test edi, 3
|
||||
jz .alignedprep
|
||||
.stragglers:
|
||||
cmp ecx, 0
|
||||
je .done ;; If ecx == 0, we're finished.
|
||||
|
||||
;;
|
||||
;; eax = ((yposition >> nflatyshift) & nflatmask) | (xposition >> nflatxshift)
|
||||
;;
|
||||
movq mm0, mm1 ;; mm0 = xposition
|
||||
movq mm7, mm2 ;; mm7 = yposition
|
||||
paddd mm1, mm3 ;; xposition += xstep (once!)
|
||||
paddd mm2, mm4 ;; yposition += ystep (once!)
|
||||
psrld mm0, mm5 ;; shift
|
||||
psrld mm7, mm6 ;; shift
|
||||
pand mm7, [nflatmask64] ;; mask
|
||||
por mm0, mm7 ;; or x and y together
|
||||
|
||||
movd eax, mm0 ;; eax = index of first pixel
|
||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
||||
movzx eax, byte [ebx + eax] ;; al = colormap[al]
|
||||
|
||||
mov [edi], al
|
||||
add edi, 1
|
||||
|
||||
sub ecx, 1
|
||||
jmp .unaligned
|
||||
|
||||
|
||||
.alignedprep:
|
||||
;;
|
||||
;; We can double the steps now.
|
||||
;;
|
||||
pslld mm3, 1
|
||||
pslld mm4, 1
|
||||
|
||||
|
||||
;;
|
||||
;; Generate chunks of four pixels.
|
||||
;;
|
||||
.alignedloop:
|
||||
|
||||
;;
|
||||
;; Make sure we have at least four pixels.
|
||||
;;
|
||||
cmp ecx, 4
|
||||
jl .prestragglers
|
||||
|
||||
;;
|
||||
;; First two pixels.
|
||||
;;
|
||||
movq mm0, mm1 ;; mm0 = xposition
|
||||
movq mm7, mm2 ;; mm7 = yposition
|
||||
paddd mm1, mm3 ;; xposition += xstep
|
||||
paddd mm2, mm4 ;; yposition += ystep
|
||||
psrld mm0, mm5 ;; shift
|
||||
psrld mm7, mm6 ;; shift
|
||||
pand mm7, [nflatmask64] ;; mask
|
||||
por mm0, mm7 ;; or x and y together
|
||||
|
||||
movd eax, mm0 ;; eax = index of first pixel
|
||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
||||
movzx ebp, byte [ebx + eax] ;; ebp = colormap[al]
|
||||
|
||||
punpckhdq mm0, mm0 ;; both dwords = high dword
|
||||
movd eax, mm0 ;; eax = index of second pixel
|
||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
||||
movzx eax, byte [ebx + eax] ;; al = colormap[al]
|
||||
shl eax, 8 ;; get pixel in right byte
|
||||
or ebp, eax ;; put pixel in ebp
|
||||
|
||||
;;
|
||||
;; Next two pixels.
|
||||
;;
|
||||
movq mm0, mm1 ;; mm0 = xposition
|
||||
movq mm7, mm2 ;; mm7 = yposition
|
||||
paddd mm1, mm3 ;; xposition += xstep
|
||||
paddd mm2, mm4 ;; yposition += ystep
|
||||
psrld mm0, mm5 ;; shift
|
||||
psrld mm7, mm6 ;; shift
|
||||
pand mm7, [nflatmask64] ;; mask
|
||||
por mm0, mm7 ;; or x and y together
|
||||
|
||||
movd eax, mm0 ;; eax = index of third pixel
|
||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
||||
movzx eax, byte [ebx + eax] ;; al = colormap[al]
|
||||
shl eax, 16 ;; get pixel in right byte
|
||||
or ebp, eax ;; put pixel in ebp
|
||||
|
||||
punpckhdq mm0, mm0 ;; both dwords = high dword
|
||||
movd eax, mm0 ;; eax = index of second pixel
|
||||
movzx eax, byte [esi + eax] ;; al = source[eax]
|
||||
movzx eax, byte [ebx + eax] ;; al = colormap[al]
|
||||
shl eax, 24 ;; get pixel in right byte
|
||||
or ebp, eax ;; put pixel in ebp
|
||||
|
||||
;;
|
||||
;; Write pixels.
|
||||
;;
|
||||
mov [edi], ebp
|
||||
add edi, 4
|
||||
|
||||
sub ecx, 4
|
||||
jmp .alignedloop
|
||||
|
||||
.prestragglers:
|
||||
;;
|
||||
;; Back to one step at a time.
|
||||
;;
|
||||
psrad mm3, 1
|
||||
psrad mm4, 1
|
||||
jmp .stragglers
|
||||
|
||||
.done:
|
||||
;;
|
||||
;; Clear MMX state, or else FPU operations will go badly awry.
|
||||
;;
|
||||
emms
|
||||
|
||||
pop ebx
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebp
|
||||
ret
|
||||
@@ -1,48 +0,0 @@
|
||||
;; SONIC ROBO BLAST 2
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
;; Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
;;
|
||||
;; This program is free software distributed under the
|
||||
;; terms of the GNU General Public License, version 2.
|
||||
;; See the 'LICENSE' file for more details.
|
||||
;;-----------------------------------------------------------------------------
|
||||
;; FILE:
|
||||
;; tmap_vc.nas
|
||||
;; DESCRIPTION:
|
||||
;; Assembler optimised math code for Visual C++.
|
||||
|
||||
|
||||
[BITS 32]
|
||||
|
||||
%macro cglobal 1
|
||||
%define %1 _%1
|
||||
[global %1]
|
||||
%endmacro
|
||||
|
||||
[SECTION .text write]
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
;fixed_t FixedMul (fixed_t a, fixed_t b)
|
||||
;----------------------------------------------------------------------------
|
||||
cglobal FixedMul
|
||||
; align 16
|
||||
FixedMul:
|
||||
mov eax,[esp+4]
|
||||
imul dword [esp+8]
|
||||
shrd eax,edx,16
|
||||
ret
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
;fixed_t FixedDiv2 (fixed_t a, fixed_t b);
|
||||
;----------------------------------------------------------------------------
|
||||
cglobal FixedDiv2
|
||||
; align 16
|
||||
FixedDiv2:
|
||||
mov eax,[esp+4]
|
||||
mov edx,eax ;; these two instructions allow the next
|
||||
sar edx,31 ;; two to pair, on the Pentium processor.
|
||||
shld edx,eax,16
|
||||
sal eax,16
|
||||
idiv dword [esp+8]
|
||||
ret
|
||||
+1
-13
@@ -255,8 +255,7 @@ void V_SetPaletteLump(const char *pal)
|
||||
gl_palette_initialized = false;
|
||||
InitPalette(0, false);
|
||||
}
|
||||
else
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
}
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
else
|
||||
@@ -286,27 +285,17 @@ static void CV_Gammaxxx_ONChange(void)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (__GNUC__) && defined (__i386__) && !defined (NOASM) && !defined (__APPLE__) && !defined (NORUSEASM)
|
||||
void VID_BlitLinearScreen_ASM(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
||||
size_t destrowbytes);
|
||||
#define HAVE_VIDCOPY
|
||||
#endif
|
||||
|
||||
static void CV_constextsize_OnChange(void)
|
||||
{
|
||||
con_recalc = true;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Copy a rectangular area from one bitmap to another (8bpp)
|
||||
// --------------------------------------------------------------------------
|
||||
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
|
||||
size_t destrowbytes)
|
||||
{
|
||||
#ifdef HAVE_VIDCOPY
|
||||
VID_BlitLinearScreen_ASM(srcptr,destptr,width,height,srcrowbytes,destrowbytes);
|
||||
#else
|
||||
if ((srcrowbytes == destrowbytes) && (srcrowbytes == (size_t)width))
|
||||
M_Memcpy(destptr, srcptr, srcrowbytes * height);
|
||||
else
|
||||
@@ -319,7 +308,6 @@ void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT3
|
||||
srcptr += srcrowbytes;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file vid_copy.s
|
||||
/// \brief code for updating the linear frame buffer screen.
|
||||
|
||||
#include "asm_defs.inc" // structures, must match the C structures!
|
||||
|
||||
// DJGPPv2 is as fast as this one, but then someone may compile with a less
|
||||
// good version of DJGPP than mine, so this little asm will do the trick!
|
||||
|
||||
#define srcptr 4+16
|
||||
#define destptr 8+16
|
||||
#define width 12+16
|
||||
#define height 16+16
|
||||
#define srcrowbytes 20+16
|
||||
#define destrowbytes 24+16
|
||||
|
||||
// VID_BlitLinearScreen( src, dest, width, height, srcwidth, destwidth );
|
||||
// width is given as BYTES
|
||||
|
||||
#ifdef __i386__
|
||||
|
||||
.globl C(VID_BlitLinearScreen_ASM)
|
||||
C(VID_BlitLinearScreen_ASM):
|
||||
pushl %ebp // preserve caller's stack frame
|
||||
pushl %edi
|
||||
pushl %esi // preserve register variables
|
||||
pushl %ebx
|
||||
|
||||
cld
|
||||
movl srcptr(%esp),%esi
|
||||
movl destptr(%esp),%edi
|
||||
movl width(%esp),%ebx
|
||||
movl srcrowbytes(%esp),%eax
|
||||
subl %ebx,%eax
|
||||
movl destrowbytes(%esp),%edx
|
||||
subl %ebx,%edx
|
||||
shrl $2,%ebx
|
||||
movl height(%esp),%ebp
|
||||
LLRowLoop:
|
||||
movl %ebx,%ecx
|
||||
rep/movsl (%esi),(%edi)
|
||||
addl %eax,%esi
|
||||
addl %edx,%edi
|
||||
decl %ebp
|
||||
jnz LLRowLoop
|
||||
|
||||
popl %ebx // restore register variables
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp // restore the caller's stack frame
|
||||
|
||||
ret
|
||||
#endif
|
||||
+14
-7
@@ -65,6 +65,7 @@
|
||||
#include "i_system.h"
|
||||
#include "md5.h"
|
||||
#include "lua_script.h"
|
||||
#include "st_stuff.h"
|
||||
#ifdef SCANTHINGS
|
||||
#include "p_setup.h" // P_ScanThings
|
||||
#endif
|
||||
@@ -724,7 +725,7 @@ static void W_ReadFileShaders(wadfile_t *wadfile)
|
||||
//
|
||||
// Can now load dehacked files (.soc)
|
||||
//
|
||||
UINT16 W_InitFile(const char *filename, boolean local)
|
||||
UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local)
|
||||
{
|
||||
FILE *handle;
|
||||
lumpinfo_t *lumpinfo = NULL;
|
||||
@@ -777,10 +778,13 @@ UINT16 W_InitFile(const char *filename, boolean local)
|
||||
{
|
||||
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
if (!local) {
|
||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||
if (handle)
|
||||
fclose(handle);
|
||||
return INT16_MAX;
|
||||
}
|
||||
CONS_Alert(CONS_WARNING, M_GetText("%s is a local skin that is already loaded\n"), filename);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -823,6 +827,7 @@ UINT16 W_InitFile(const char *filename, boolean local)
|
||||
fseek(handle, 0, SEEK_END);
|
||||
wadfile->filesize = (unsigned)ftell(handle);
|
||||
wadfile->type = type;
|
||||
wadfile->majormod = false;
|
||||
|
||||
// already generated, just copy it over
|
||||
M_Memcpy(&wadfile->md5sum, &md5sum, 16);
|
||||
@@ -932,7 +937,7 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons)
|
||||
G_SetGameModified(true, false);
|
||||
|
||||
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
||||
rc = W_InitFile(*filenames, false);
|
||||
rc = W_InitFile(*filenames, 0, 0, false);
|
||||
if (rc == INT16_MAX)
|
||||
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
|
||||
overallrc &= (rc != INT16_MAX) ? 1 : 0;
|
||||
@@ -1761,7 +1766,9 @@ void *W_CachePatchName(const char *name, INT32 tag)
|
||||
{
|
||||
lumpnum_t num;
|
||||
|
||||
num = W_CheckNumForName(name);
|
||||
const char *finalname = name;
|
||||
|
||||
num = W_CheckNumForName(finalname);
|
||||
|
||||
if (num == LUMPERROR)
|
||||
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
|
||||
|
||||
+3
-1
@@ -114,6 +114,8 @@ typedef struct wadfile_s
|
||||
UINT32 filesize; // for network
|
||||
UINT8 md5sum[16];
|
||||
boolean important;
|
||||
boolean majormod;
|
||||
boolean localfile; // only for skins
|
||||
} wadfile_t;
|
||||
|
||||
#define WADFILENUM(lumpnum) (UINT16)((lumpnum)>>16) // wad flumpnum>>16) // wad file number in upper word
|
||||
@@ -132,7 +134,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors);
|
||||
//
|
||||
// if local is true, it wouldn't check if file adds complex things, therefore
|
||||
// allowing to still join server without the "you have wrong addons loaded" error
|
||||
UINT16 W_InitFile(const char *filename, boolean local);
|
||||
UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local);
|
||||
#ifdef DELFILE
|
||||
void W_UnloadWadFile(UINT16 num);
|
||||
#endif
|
||||
|
||||
@@ -33,10 +33,6 @@ endif
|
||||
SDL_LDFLAGS?=-L../libs/SDL2/i686-w64-mingw32/lib -L../libs/SDL2_mixer/i686-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||
endif
|
||||
|
||||
ifndef NOASM
|
||||
USEASM=1
|
||||
endif
|
||||
|
||||
ifndef NONET
|
||||
ifndef MINGW64 #miniupnc is broken with MINGW64
|
||||
HAVE_MINIUPNPC=1
|
||||
|
||||
+10
-2
@@ -544,7 +544,15 @@ void Y_IntermissionDrawer(void)
|
||||
if (data.match.color[i])
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(*data.match.character[i], *data.match.color[i], GTC_CACHE);
|
||||
V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.match.character[i]], colormap);
|
||||
// i fucking hate this i fucking hate this i hate this so much
|
||||
if (!players[data.match.num[i]].skinlocal) {
|
||||
if (!players[data.match.num[i]].localskin)
|
||||
V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.match.character[i]], colormap);
|
||||
else
|
||||
V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[players[data.match.num[i]].localskin - 1], colormap);
|
||||
} else {
|
||||
V_DrawMappedPatch(x+16, y-4, 0, localfacerankprefix[players[data.match.num[i]].localskin - 1], colormap);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.match.num[i] == whiteplayer)
|
||||
@@ -1318,7 +1326,7 @@ void Y_VoteDrawer(void)
|
||||
if (players[i].skincolor)
|
||||
{
|
||||
UINT8 *colormap = R_GetTranslationColormap(players[i].skin, players[i].skincolor, GTC_CACHE);
|
||||
V_DrawMappedPatch(x+24, y+9, V_SNAPTOLEFT, facerankprefix[players[i].skin], colormap);
|
||||
V_DrawMappedPatch(x+24, y+9, V_SNAPTOLEFT, (players[i].skinlocal ? localfacerankprefix : facerankprefix)[((players[i].localskin) ? players[i].localskin-1 : players[i].skin)], colormap);
|
||||
}
|
||||
|
||||
if (!splitscreen && i == consoleplayer)
|
||||
|
||||
+234
-232
@@ -1,7 +1,7 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2006 by Graue.
|
||||
// Copyright (C) 2006-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2006-2023 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_patch.h"
|
||||
#include "i_system.h" // I_GetFreeMem
|
||||
#include "i_video.h" // rendermode
|
||||
#include "z_zone.h"
|
||||
@@ -49,27 +50,11 @@ static boolean Z_calloc = false;
|
||||
//#define ZDEBUG2
|
||||
#endif
|
||||
|
||||
struct memblock_s;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct memblock_s *block; // Describing this memory
|
||||
UINT32 id; // Should be ZONEID
|
||||
} ATTRPACK memhdr_t;
|
||||
|
||||
// Some code might want aligned memory. Assume it wants memory n bytes
|
||||
// aligned -- then we allocate n-1 extra bytes and return a pointer to
|
||||
// the first byte aligned as requested.
|
||||
// Thus, "real" is the pointer we get from malloc() and will free()
|
||||
// later, but "hdr" is where the memhdr_t starts.
|
||||
// For non-aligned allocations they will be the same.
|
||||
typedef struct memblock_s
|
||||
{
|
||||
void *real;
|
||||
memhdr_t *hdr;
|
||||
|
||||
void **user;
|
||||
INT32 tag; // purgelevel
|
||||
UINT32 id; // Should be ZONEID
|
||||
|
||||
size_t size; // including the header and blocks
|
||||
size_t realsize; // size of real data only
|
||||
@@ -80,64 +65,31 @@ typedef struct memblock_s
|
||||
#endif
|
||||
|
||||
struct memblock_s *next, *prev;
|
||||
} ATTRPACK memblock_t;
|
||||
} memblock_t;
|
||||
|
||||
#ifdef ZDEBUG
|
||||
#define Ptr2Memblock(s, f) Ptr2Memblock2(s, f, __FILE__, __LINE__)
|
||||
static memblock_t *Ptr2Memblock2(void *ptr, const char* func, const char *file, INT32 line)
|
||||
#else
|
||||
static memblock_t *Ptr2Memblock(void *ptr, const char* func)
|
||||
#endif
|
||||
{
|
||||
memhdr_t *hdr;
|
||||
memblock_t *block;
|
||||
|
||||
if (ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
#ifdef ZDEBUG2
|
||||
CONS_Printf("%s %s:%d\n", func, file, line);
|
||||
#endif
|
||||
|
||||
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_DEFINED
|
||||
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
#ifdef VALGRIND_MEMPOOL_EXISTS
|
||||
if (!VALGRIND_MEMPOOL_EXISTS(hdr->block))
|
||||
{
|
||||
#ifdef ZDEBUG
|
||||
I_Error("%s: bad memblock from %s:%d", func, file, line);
|
||||
#else
|
||||
I_Error("%s: bad memblock", func);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (hdr->id != ZONEID)
|
||||
{
|
||||
#ifdef ZDEBUG
|
||||
I_Error("%s: wrong id from %s:%d", func, file, line);
|
||||
#else
|
||||
I_Error("%s: wrong id", func);
|
||||
#endif
|
||||
}
|
||||
block = hdr->block;
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#endif
|
||||
return block;
|
||||
|
||||
}
|
||||
#define MEMORY(x) (void *)((uintptr_t)(x) + sizeof(memblock_t))
|
||||
#define MEMBLOCK(x) (memblock_t *)((uintptr_t)(x) - sizeof(memblock_t))
|
||||
|
||||
// both the head and tail of the zone memory block list
|
||||
static memblock_t head;
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
static void Command_Memfree_f(void);
|
||||
#ifdef ZDEBUG
|
||||
static void Command_Memdump_f(void);
|
||||
#endif
|
||||
|
||||
// --------------------------
|
||||
// Zone memory initialisation
|
||||
// --------------------------
|
||||
|
||||
/** Initialises zone memory.
|
||||
* Used at game startup.
|
||||
*
|
||||
* \sa I_GetFreeMem, Command_Memfree_f, Command_Memdump_f
|
||||
*/
|
||||
void Z_Init(void)
|
||||
{
|
||||
size_t total, memfree;
|
||||
@@ -157,6 +109,17 @@ void Z_Init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// ----------------------
|
||||
// Zone memory allocation
|
||||
// ----------------------
|
||||
|
||||
/** Frees allocated memory.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* \sa Z_FreeTags
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line)
|
||||
#else
|
||||
@@ -172,10 +135,14 @@ void Z_Free(void *ptr)
|
||||
CONS_Debug(DBG_MEMORY, "Z_Free %s:%d\n", file, line);
|
||||
#endif
|
||||
|
||||
block = MEMBLOCK(ptr);
|
||||
#ifdef PARANOIA
|
||||
if (block->id != ZONEID)
|
||||
#ifdef ZDEBUG
|
||||
block = Ptr2Memblock2(ptr, "Z_Free", file, line);
|
||||
I_Error("Z_Free at %s:%d: wrong id", file, line);
|
||||
#else
|
||||
block = Ptr2Memblock(ptr, "Z_Free");
|
||||
I_Error("Z_Free: wrong id");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ZDEBUG
|
||||
@@ -183,11 +150,9 @@ void Z_Free(void *ptr)
|
||||
CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// anything that isn't by lua gets passed to lua just in case.
|
||||
if (block->tag != PU_LUA)
|
||||
LUA_InvalidateUserdata(ptr);
|
||||
#endif
|
||||
|
||||
// TODO: if zdebugging, make sure no other block has a user
|
||||
// that is about to be freed.
|
||||
@@ -196,21 +161,27 @@ void Z_Free(void *ptr)
|
||||
if (block->user != NULL)
|
||||
*block->user = NULL;
|
||||
|
||||
// Free the memory and get rid of the block.
|
||||
free(block->real);
|
||||
block->prev->next = block->next;
|
||||
block->next->prev = block->prev;
|
||||
free(block);
|
||||
#ifdef VALGRIND_DESTROY_MEMPOOL
|
||||
VALGRIND_DESTROY_MEMPOOL(block);
|
||||
#endif
|
||||
block->prev->next = block->next;
|
||||
block->next->prev = block->prev;
|
||||
free(block);
|
||||
}
|
||||
|
||||
// malloc() that doesn't accept failure.
|
||||
/** malloc() that doesn't accept failure.
|
||||
*
|
||||
* \param size Amount of memory to be allocated, in bytes.
|
||||
* \return A pointer to the allocated memory.
|
||||
*/
|
||||
static void *xm(size_t size)
|
||||
{
|
||||
const size_t padedsize = size+sizeof (size_t);
|
||||
void *p = malloc(padedsize);
|
||||
void *p;
|
||||
|
||||
if (padedsize < size)/* overflow check */
|
||||
I_Error("You are allocating memory too large!");
|
||||
p = malloc(padedsize);
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
@@ -220,10 +191,6 @@ static void *xm(size_t size)
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
#if defined (_NDS) | defined (_PSP)
|
||||
// Temporary-ish debugging measure
|
||||
Command_Memfree_f();
|
||||
#endif
|
||||
I_Error("Out of memory allocating %s bytes", sizeu1(size));
|
||||
}
|
||||
}
|
||||
@@ -231,10 +198,18 @@ static void *xm(size_t size)
|
||||
return p;
|
||||
}
|
||||
|
||||
// Z_Malloc
|
||||
// You can pass Z_Malloc() a NULL user if the tag is less than
|
||||
// PU_PURGELEVEL.
|
||||
|
||||
/** The Z_MallocAlign function.
|
||||
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
|
||||
*
|
||||
* \param size Amount of memory to be allocated, in bytes.
|
||||
* \param tag Purge tag.
|
||||
* \param user The address of a pointer to the memory to be allocated.
|
||||
* When the memory is freed by Z_Free later,
|
||||
* the pointer at this address will then be automatically set to NULL.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \note You can pass Z_Malloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_CallocAlign, Z_ReallocAlign
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
|
||||
const char *file, INT32 line)
|
||||
@@ -242,75 +217,67 @@ void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
|
||||
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
#endif
|
||||
{
|
||||
size_t extrabytes = (1<<alignbits) - 1;
|
||||
size_t padsize = 0;
|
||||
memblock_t *block;
|
||||
void *ptr;
|
||||
memhdr_t *hdr;
|
||||
void *given;
|
||||
size_t blocksize = extrabytes + sizeof *hdr + size;
|
||||
(void)(alignbits); // no longer used, so silence warnings.
|
||||
|
||||
#ifdef ZDEBUG2
|
||||
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
|
||||
#endif
|
||||
|
||||
block = xm(sizeof *block);
|
||||
block = xm(sizeof (memblock_t) + size);
|
||||
ptr = MEMORY(block);
|
||||
I_Assert((intptr_t)ptr % sizeof (void *) == 0);
|
||||
|
||||
#ifdef HAVE_VALGRIND
|
||||
padsize += (1<<sizeof(size_t))*2;
|
||||
#endif
|
||||
ptr = xm(blocksize + padsize*2);
|
||||
|
||||
// This horrible calculation makes sure that "given" is aligned
|
||||
// properly.
|
||||
given = (void *)((size_t)((UINT8 *)ptr + extrabytes + sizeof *hdr + padsize/2)
|
||||
& ~extrabytes);
|
||||
|
||||
// The mem header lives 'sizeof (memhdr_t)' bytes before given.
|
||||
hdr = (memhdr_t *)((UINT8 *)given - sizeof *hdr);
|
||||
|
||||
#ifdef VALGRIND_CREATE_MEMPOOL
|
||||
VALGRIND_CREATE_MEMPOOL(block, padsize, Z_calloc);
|
||||
Z_calloc = false;
|
||||
#endif
|
||||
#ifdef VALGRIND_MEMPOOL_ALLOC
|
||||
VALGRIND_MEMPOOL_ALLOC(block, hdr, size + sizeof *hdr);
|
||||
#endif
|
||||
|
||||
block->next = head.next;
|
||||
block->prev = &head;
|
||||
head.next = block;
|
||||
block->next->prev = block;
|
||||
|
||||
block->real = ptr;
|
||||
block->hdr = hdr;
|
||||
block->tag = tag;
|
||||
block->user = NULL;
|
||||
#ifdef ZDEBUG
|
||||
block->ownerline = line;
|
||||
block->ownerfile = file;
|
||||
#endif
|
||||
block->size = blocksize;
|
||||
block->size = sizeof (memblock_t) + size;
|
||||
block->realsize = size;
|
||||
|
||||
hdr->id = ZONEID;
|
||||
hdr->block = block;
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#ifdef VALGRIND_CREATE_MEMPOOL
|
||||
VALGRIND_CREATE_MEMPOOL(block, size, Z_calloc);
|
||||
#endif
|
||||
|
||||
block->id = ZONEID;
|
||||
|
||||
if (user != NULL)
|
||||
{
|
||||
block->user = user;
|
||||
*(void **)user = given;
|
||||
*(void **)user = ptr;
|
||||
}
|
||||
else if (tag >= PU_PURGELEVEL)
|
||||
I_Error("Z_Malloc: attempted to allocate purgable block "
|
||||
"(size %s) with no user", sizeu1(size));
|
||||
|
||||
return given;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/** The Z_CallocAlign function.
|
||||
* Allocates a block of memory, adds it to a linked list so we can keep track of it.
|
||||
* Unlike Z_MallocAlign, this also initialises the bytes to zero.
|
||||
*
|
||||
* \param size Amount of memory to be allocated, in bytes.
|
||||
* \param tag Purge tag.
|
||||
* \param user The address of a pointer to the memory to be allocated.
|
||||
* When the memory is freed by Z_Free later,
|
||||
* the pointer at this address will then be automatically set to NULL.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \note You can pass Z_Calloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_MallocAlign, Z_ReallocAlign
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
|
||||
#else
|
||||
@@ -327,10 +294,26 @@ void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
#endif
|
||||
}
|
||||
|
||||
/** The Z_ReallocAlign function.
|
||||
* Reallocates a block of memory with a new size.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* If NULL, this function instead acts as a wrapper for Z_CallocAlign.
|
||||
* \param size New size of memory block, in bytes.
|
||||
* If zero, then the memory is freed and NULL is returned.
|
||||
* \param tag New purge tag.
|
||||
* \param user The address of a pointer to the memory to be reallocated.
|
||||
* This can be a different user to the one originally assigned to the memory block.
|
||||
* \param alignbits The alignment of the memory to be allocated, in bits. Can be 0.
|
||||
* \return A pointer to the reallocated memory. Can be NULL if memory was freed.
|
||||
* \note You can pass Z_Realloc() a NULL user if the tag is less than PU_PURGELEVEL.
|
||||
* \sa Z_MallocAlign, Z_CallocAlign
|
||||
*/
|
||||
#ifdef ZDEBUG
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line)
|
||||
#else
|
||||
void *Z_ReallocAlign(void *ptr, size_t size,INT32 tag, void *user, INT32 alignbits)
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits)
|
||||
#endif
|
||||
{
|
||||
void *rez;
|
||||
@@ -356,10 +339,14 @@ void *Z_ReallocAlign(void *ptr, size_t size,INT32 tag, void *user, INT32 alignb
|
||||
#endif
|
||||
}
|
||||
|
||||
block = MEMBLOCK(ptr);
|
||||
#ifdef PARANOIA
|
||||
if (block->id != ZONEID)
|
||||
#ifdef ZDEBUG
|
||||
block = Ptr2Memblock2(ptr, "Z_Realloc", file, line);
|
||||
I_Error("Z_ReallocAlign at %s:%d: wrong id", file, line);
|
||||
#else
|
||||
block = Ptr2Memblock(ptr, "Z_Realloc");
|
||||
I_Error("Z_ReallocAlign: wrong id");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (block == NULL)
|
||||
@@ -397,6 +384,11 @@ void *Z_ReallocAlign(void *ptr, size_t size,INT32 tag, void *user, INT32 alignb
|
||||
return rez;
|
||||
}
|
||||
|
||||
/** Frees all memory for a given set of tags.
|
||||
*
|
||||
* \param lowtag The lowest tag to consider.
|
||||
* \param hightag The highest tag to consider.
|
||||
*/
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
||||
{
|
||||
memblock_t *block, *next;
|
||||
@@ -405,28 +397,57 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
||||
for (block = head.next; block != &head; block = next)
|
||||
{
|
||||
next = block->next; // get link before freeing
|
||||
|
||||
if (block->tag >= lowtag && block->tag <= hightag)
|
||||
Z_Free((UINT8 *)block->hdr + sizeof *block->hdr);
|
||||
Z_Free(MEMORY(block));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Z_CheckMemCleanup
|
||||
//
|
||||
// TODO: Currently blocks >= PU_PURGELEVEL are freed every
|
||||
// CLEANUPCOUNT. It might be better to keep track of
|
||||
// the total size of all purgable memory and free it when the
|
||||
// size exceeds some value.
|
||||
//
|
||||
// This was in Z_Malloc, but was freeing data at
|
||||
// unsafe times. Now it is only called when it is safe
|
||||
// to cleanup memory.
|
||||
/** Iterates through all memory for a given set of tags.
|
||||
*
|
||||
* \param lowtag The lowest tag to consider.
|
||||
* \param hightag The highest tag to consider.
|
||||
* \param iterfunc The iterator function.
|
||||
*/
|
||||
void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *))
|
||||
{
|
||||
memblock_t *block, *next;
|
||||
|
||||
if (!iterfunc)
|
||||
I_Error("Z_IterateTags: no iterator function was given");
|
||||
|
||||
for (block = head.next; block != &head; block = next)
|
||||
{
|
||||
next = block->next; // get link before possibly freeing
|
||||
|
||||
if (block->tag >= lowtag && block->tag <= hightag)
|
||||
{
|
||||
void *mem = MEMORY(block);
|
||||
boolean free = iterfunc(mem);
|
||||
if (free)
|
||||
Z_Free(mem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// Utility functions
|
||||
// -----------------
|
||||
|
||||
// starting value of nextcleanup
|
||||
#define CLEANUPCOUNT 2000
|
||||
|
||||
// number of function calls left before next cleanup
|
||||
static INT32 nextcleanup = CLEANUPCOUNT;
|
||||
|
||||
/** This was in Z_Malloc, but was freeing data at
|
||||
* unsafe times. Now it is only called when it is safe
|
||||
* to cleanup memory.
|
||||
*
|
||||
* \todo Currently blocks >= PU_PURGELEVEL are freed every
|
||||
* CLEANUPCOUNT. It might be better to keep track of
|
||||
* the total size of all purgable memory and free it when the
|
||||
* size exceeds some value.
|
||||
*/
|
||||
void Z_CheckMemCleanup(void)
|
||||
{
|
||||
if (nextcleanup-- == 0)
|
||||
@@ -445,15 +466,13 @@ void Z_CheckMemCleanup(void)
|
||||
void Z_CheckHeap(INT32 i)
|
||||
{
|
||||
memblock_t *block;
|
||||
memhdr_t *hdr;
|
||||
UINT32 blocknumon = 0;
|
||||
void *given;
|
||||
|
||||
for (block = head.next; block != &head; block = block->next)
|
||||
{
|
||||
blocknumon++;
|
||||
hdr = block->hdr;
|
||||
given = (UINT8 *)hdr + sizeof *hdr;
|
||||
given = MEMORY(block);
|
||||
#ifdef ZDEBUG2
|
||||
CONS_Debug(DBG_MEMORY, "block %u owned by %s:%d\n",
|
||||
blocknumon, block->ownerfile, block->ownerline);
|
||||
@@ -469,7 +488,7 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
#endif
|
||||
if (block->user != NULL && *(block->user) != given)
|
||||
@@ -482,7 +501,7 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
if (block->next->prev != block)
|
||||
{
|
||||
@@ -494,7 +513,7 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
if (block->prev->next != block)
|
||||
{
|
||||
@@ -506,25 +525,9 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
#ifdef VALGRIND_MAKE_MEM_DEFINED
|
||||
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
|
||||
#endif
|
||||
if (hdr->block != block)
|
||||
{
|
||||
I_Error("Z_CheckHeap %d: block %u"
|
||||
#ifdef ZDEBUG
|
||||
"(owned by %s:%d)"
|
||||
#endif
|
||||
" doesn't have linkback from allocated memory",
|
||||
i, blocknumon
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
}
|
||||
if (hdr->id != ZONEID)
|
||||
if (block->id != ZONEID)
|
||||
{
|
||||
I_Error("Z_CheckHeap %d: block %u"
|
||||
#ifdef ZDEBUG
|
||||
@@ -534,50 +537,37 @@ void Z_CheckHeap(INT32 i)
|
||||
#ifdef ZDEBUG
|
||||
, block->ownerfile, block->ownerline
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Zone memory modification
|
||||
// ------------------------
|
||||
|
||||
/** Changes a memory block's purge tag.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* \param tag The new tag.
|
||||
* \sa Z_SetUser
|
||||
*/
|
||||
#ifdef PARANOIA
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag)
|
||||
void Z_ChangeTag(void *ptr, INT32 tag)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
memhdr_t *hdr;
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
|
||||
block = MEMBLOCK(ptr);
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_DEFINED
|
||||
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
#ifdef VALGRIND_MEMPOOL_EXISTS
|
||||
if (!VALGRIND_MEMPOOL_EXISTS(hdr->block))
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
I_Error("Z_CT at %s:%d: bad memblock", file, line);
|
||||
#else
|
||||
I_Error("Z_CT: bad memblock");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifdef PARANOIA
|
||||
if (hdr->id != ZONEID) I_Error("Z_CT at %s:%d: wrong id", file, line);
|
||||
#endif
|
||||
|
||||
block = hdr->block;
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
if (block->id != ZONEID) I_Error("Z_ChangeTag at %s:%d: wrong id", file, line);
|
||||
#endif
|
||||
|
||||
if (tag >= PU_PURGELEVEL && block->user == NULL)
|
||||
@@ -587,12 +577,48 @@ void Z_ChangeTag2(void *ptr, INT32 tag)
|
||||
block->tag = tag;
|
||||
}
|
||||
|
||||
/** Changes a memory block's user.
|
||||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* \param newuser The new user for the memory block.
|
||||
* \sa Z_ChangeTag
|
||||
*/
|
||||
#ifdef PARANOIA
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_SetUser(void *ptr, void **newuser)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
block = MEMBLOCK(ptr);
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (block->id != ZONEID) I_Error("Z_SetUser at %s:%d: wrong id", file, line);
|
||||
#endif
|
||||
|
||||
if (block->tag >= PU_PURGELEVEL && newuser == NULL)
|
||||
I_Error("Internal memory management error: "
|
||||
"tried to make block purgable but it has no owner");
|
||||
|
||||
block->user = (void*)newuser;
|
||||
*newuser = ptr;
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// Zone memory usage
|
||||
// -----------------
|
||||
|
||||
/** Calculates memory usage for a given set of tags.
|
||||
*
|
||||
* \param lowtag The lowest tag to consider.
|
||||
* \param hightag The highest tag to consider.
|
||||
* \return Number of bytes currently allocated in the heap for the
|
||||
* given tags.
|
||||
* \sa Z_TagUsage
|
||||
*/
|
||||
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag)
|
||||
{
|
||||
@@ -609,12 +635,14 @@ size_t Z_TagsUsage(INT32 lowtag, INT32 hightag)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
size_t Z_TagUsage(INT32 tagnum)
|
||||
{
|
||||
return Z_TagsUsage(tagnum, tagnum);
|
||||
}
|
||||
// -----------------------
|
||||
// Miscellaneous functions
|
||||
// -----------------------
|
||||
|
||||
void Command_Memfree_f(void)
|
||||
/** The function called by the "memfree" console command.
|
||||
* Prints the memory being used by each part of the game to the console.
|
||||
*/
|
||||
static void Command_Memfree_f(void)
|
||||
{
|
||||
size_t freebytes, totalbytes;
|
||||
|
||||
@@ -638,7 +666,7 @@ void Command_Memfree_f(void)
|
||||
CONS_Printf(M_GetText("Mipmap patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
|
||||
CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
|
||||
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
|
||||
CONS_Printf(M_GetText("All GPU textures : %7s KB\n"), sizeu1(HWR_GetTextureUsed()>>10));
|
||||
CONS_Printf(M_GetText("All GPU textures : %7d KB\n"), HWR_GetTextureUsed()>>10);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -648,7 +676,14 @@ void Command_Memfree_f(void)
|
||||
CONS_Printf(M_GetText("Available physical memory: %s KB\n"), sizeu1(freebytes>>10));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef ZDEBUG
|
||||
/** The function called by the "memdump" console command.
|
||||
* Prints zone memory debugging information (i.e. tag, size, location in code allocated).
|
||||
* Can be all memory allocated in game, or between a set of tags (if -min/-max args used).
|
||||
* This command is available only if ZDEBUG is enabled.
|
||||
*/
|
||||
static void Command_Memdump_f(void)
|
||||
{
|
||||
memblock_t *block;
|
||||
@@ -670,45 +705,12 @@ static void Command_Memdump_f(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Creates a copy of a string.
|
||||
/** Creates a copy of a string.
|
||||
*
|
||||
* \param s The string to be copied.
|
||||
* \return A copy of the string, allocated in zone memory.
|
||||
*/
|
||||
char *Z_StrDup(const char *s)
|
||||
{
|
||||
return strcpy(ZZ_Alloc(strlen(s) + 1), s);
|
||||
}
|
||||
|
||||
|
||||
#ifdef PARANOIA
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line)
|
||||
#else
|
||||
void Z_SetUser2(void *ptr, void **newuser)
|
||||
#endif
|
||||
{
|
||||
memblock_t *block;
|
||||
memhdr_t *hdr;
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
hdr = (memhdr_t *)((UINT8 *)ptr - sizeof *hdr);
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_DEFINED
|
||||
VALGRIND_MAKE_MEM_DEFINED(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (hdr->id != ZONEID) I_Error("Z_CT at %s:%d: wrong id", file, line);
|
||||
#endif
|
||||
|
||||
block = hdr->block;
|
||||
|
||||
#ifdef VALGRIND_MAKE_MEM_NOACCESS
|
||||
VALGRIND_MAKE_MEM_NOACCESS(hdr, sizeof *hdr);
|
||||
#endif
|
||||
|
||||
if (block->tag >= PU_PURGELEVEL && newuser == NULL)
|
||||
I_Error("Internal memory management error: "
|
||||
"tried to make block purgable but it has no owner");
|
||||
|
||||
block->user = (void*)newuser;
|
||||
*newuser = ptr;
|
||||
}
|
||||
+90
-66
@@ -2,7 +2,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2023 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -15,6 +15,7 @@
|
||||
#define __Z_ZONE__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
|
||||
#ifdef __GNUC__ // __attribute__ ((X))
|
||||
@@ -30,97 +31,120 @@
|
||||
//#define ZDEBUG
|
||||
|
||||
//
|
||||
// ZONE MEMORY
|
||||
// PU - purge tags.
|
||||
// Tags < PU_LEVEL are not purged until freed explicitly.
|
||||
#define PU_STATIC 1 // static entire execution time
|
||||
#define PU_LUA 2 // static entire execution time -- used by lua so it doesn't get caught in loops forever
|
||||
#define PU_PERFSTATS 3 // static between changes to ps_samplesize cvar
|
||||
// Purge tags
|
||||
//
|
||||
// Now they are an enum! -- Monster Iestyn 15/02/18
|
||||
//
|
||||
enum
|
||||
{
|
||||
// Tags < PU_LEVEL are not purged until freed explicitly.
|
||||
PU_STATIC = 1, // static entire execution time
|
||||
PU_LUA = 2, // static entire execution time -- used by lua so it doesn't get caught in loops forever
|
||||
PU_PERFSTATS = 3, // static between changes to ps_samplesize cvar
|
||||
|
||||
#define PU_SOUND 11 // static while playing
|
||||
#define PU_MUSIC 12 // static while playing
|
||||
#define PU_HUDGFX 13 // static until WAD added
|
||||
PU_SOUND = 11, // static while playing
|
||||
PU_MUSIC = 12, // static while playing
|
||||
PU_HUDGFX = 13, // static until WAD added
|
||||
|
||||
#define PU_HWRPATCHINFO 21 // Hardware GLPatch_t struct for OpenGL texture cache
|
||||
#define PU_HWRPATCHCOLMIPMAP 22 // Hardware GLMipmap_t struct colromap variation of patch
|
||||
PU_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache
|
||||
PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch
|
||||
|
||||
#define PU_HWRCACHE 48 // static until unlocked
|
||||
#define PU_CACHE 49 // static until unlocked
|
||||
PU_HWRCACHE = 48, // static until unlocked
|
||||
PU_CACHE = 49, // static until unlocked
|
||||
|
||||
// Tags s.t. PU_LEVEL <= tag < PU_PURGELEVEL are purged at level start
|
||||
#define PU_LEVEL 50 // static until level exited
|
||||
#define PU_LEVSPEC 51 // a special thinker in a level
|
||||
#define PU_HWRPLANE 52
|
||||
// Tags s.t. PU_LEVEL <= tag < PU_PURGELEVEL are purged at level start
|
||||
PU_LEVEL = 50, // static until level exited
|
||||
PU_LEVSPEC = 51, // a special thinker in a level
|
||||
PU_HWRPLANE = 52, // if ZPLANALLOC is enabled in hw_bsp.c, this is used to alloc polygons for OpenGL
|
||||
|
||||
// Tags >= PU_PURGELEVEL are purgable whenever needed
|
||||
#define PU_PURGELEVEL 100
|
||||
#define PU_CACHE_UNLOCKED 101
|
||||
#define PU_HWRCACHE_UNLOCKED 102 // 'second-level' cache for graphics
|
||||
// stored in hardware format and downloaded as needed
|
||||
#define PU_HWRPATCHINFO_UNLOCKED 103
|
||||
// Tags >= PU_PURGELEVEL are purgable whenever needed
|
||||
PU_PURGELEVEL = 100, // Note: this is never actually used as a tag
|
||||
PU_CACHE_UNLOCKED = 101, // Note: unused
|
||||
PU_HWRCACHE_UNLOCKED = 102, // 'unlocked' PU_HWRCACHE memory:
|
||||
// 'second-level' cache for graphics
|
||||
// stored in hardware format and downloaded as needed
|
||||
PU_HWRPATCHINFO_UNLOCKED = 103, // 'unlocked' PU_HWRMODELTEXTURE memory
|
||||
};
|
||||
|
||||
//
|
||||
// Zone memory initialisation
|
||||
//
|
||||
void Z_Init(void);
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag);
|
||||
void Z_CheckMemCleanup(void);
|
||||
void Z_CheckHeap(INT32 i);
|
||||
#ifdef PARANOIA
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line);
|
||||
#else
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag);
|
||||
#endif
|
||||
|
||||
#ifdef PARANOIA
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line);
|
||||
#else
|
||||
void Z_SetUser2(void *ptr, void **newuser);
|
||||
#endif
|
||||
//
|
||||
// Zone memory allocation
|
||||
//
|
||||
// enable ZDEBUG to get the file + line the functions were called from
|
||||
// for ZZ_Alloc, see doomdef.h
|
||||
//
|
||||
|
||||
// Z_Free and alloc with alignment
|
||||
#ifdef ZDEBUG
|
||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line);
|
||||
#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
#define Z_Realloc(p,s,t,u) Z_Realloc2(p, s, t, u, 0, __FILE__, __LINE__)
|
||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__)
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line);
|
||||
void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1);
|
||||
void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(2);
|
||||
#else
|
||||
void Z_Free(void *ptr);
|
||||
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
|
||||
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, 0)
|
||||
void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1);
|
||||
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, 0)
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2) ;
|
||||
#define Z_Realloc(p, s,t,u) Z_ReallocAlign(p, s, t, u, 0)
|
||||
void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2);
|
||||
#endif
|
||||
|
||||
size_t Z_TagUsage(INT32 tagnum);
|
||||
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag);
|
||||
// Alloc with standard alignment
|
||||
#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, sizeof(void *))
|
||||
#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, sizeof(void *))
|
||||
#define Z_Realloc(p,s,t,u) Z_ReallocAlign(p, s, t, u, sizeof(void *))
|
||||
|
||||
char *Z_StrDup(const char *in);
|
||||
// Free all memory by tag
|
||||
// these don't give line numbers for ZDEBUG currently though
|
||||
// (perhaps this should be changed in future?)
|
||||
#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum)
|
||||
void Z_FreeTags(INT32 lowtag, INT32 hightag);
|
||||
|
||||
// This is used to get the local FILE : LINE info from CPP
|
||||
// prior to really call the function in question.
|
||||
// Iterate memory by tag
|
||||
#define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func)
|
||||
void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *));
|
||||
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
void Z_CheckMemCleanup(void);
|
||||
void Z_CheckHeap(INT32 i);
|
||||
|
||||
//
|
||||
// Zone memory modification
|
||||
//
|
||||
// enable PARANOIA to get the file + line the functions were called from
|
||||
//
|
||||
#ifdef PARANOIA
|
||||
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t, __FILE__, __LINE__)
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u, __FILE__, __LINE__)
|
||||
void Z_ChangeTag2(void *ptr, INT32 tag, const char *file, INT32 line);
|
||||
void Z_SetUser2(void *ptr, void **newuser, const char *file, INT32 line);
|
||||
#else
|
||||
#define Z_ChangeTag(p,t) Z_ChangeTag2(p, t)
|
||||
void Z_ChangeTag(void *ptr, INT32 tag);
|
||||
void Z_SetUser(void *ptr, void **newuser);
|
||||
#endif
|
||||
|
||||
#ifdef PARANOIA
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u, __FILE__, __LINE__)
|
||||
#else
|
||||
#define Z_SetUser(p,u) Z_SetUser2(p, u)
|
||||
#endif
|
||||
//
|
||||
// Zone memory usage
|
||||
//
|
||||
// Note: These give the memory used in bytes,
|
||||
// shift down by 10 to convert to KB
|
||||
//
|
||||
#define Z_TagUsage(tagnum) Z_TagsUsage(tagnum, tagnum)
|
||||
size_t Z_TagsUsage(INT32 lowtag, INT32 hightag);
|
||||
#define Z_TotalUsage() Z_TagsUsage(0, INT32_MAX)
|
||||
|
||||
#ifdef _NDS ///TODO: need a lock reference system
|
||||
#define Z_Unlock(p) Z_ChangeTag(p, PU_CACHE_UNLOCKED)
|
||||
#else
|
||||
#define Z_Unlock(p) (void)p
|
||||
#endif
|
||||
//
|
||||
// Miscellaneous functions
|
||||
//
|
||||
char *Z_StrDup(const char *in);
|
||||
#define Z_Unlock(p) (void)p // TODO: remove this now that NDS code has been removed
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,6 @@
|
||||
#ifdef _MSC_VER
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#define NOASM
|
||||
#include "../src/tables.h"
|
||||
#define NO_M
|
||||
#include "../src/m_fixed.c"
|
||||
|
||||
Reference in new issue
Block a user