mirror of https://github.com/FWGS/hlsdk-xash3d
Merge branch 'poke646-fix' into poke646_vendetta-fix
This commit is contained in:
commit
bc6296a4be
|
@ -6,4 +6,14 @@
|
|||
*.a
|
||||
*.framework
|
||||
*.exe
|
||||
*.dll
|
||||
*.pdb
|
||||
build/
|
||||
CMakeLists.txt.user
|
||||
cmake_install.cmake
|
||||
*.orig
|
||||
*.cbp
|
||||
*.dsw
|
||||
*.vsxproj
|
||||
*.vsproj
|
||||
*.sln
|
||||
|
|
19
.travis.yml
19
.travis.yml
|
@ -5,10 +5,21 @@ compiler:
|
|||
os:
|
||||
- linux
|
||||
- osx
|
||||
sudo: true
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
- g++-multilib
|
||||
before_script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gcc-multilib g++-multilib; fi
|
||||
- curl http://libsdl.org/release/SDL2-devel-2.0.7-mingw.tar.gz | tar xzf -
|
||||
- mv SDL2-2.0.7/i686-w64-mingw32/include/SDL2 cl_dll/
|
||||
script:
|
||||
- mkdir -p build && cd build
|
||||
- cmake ../ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VOICEMGR=0 && make -j3 && rm -rf *
|
||||
- cmake ../ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VOICEMGR=1 && make -j3 && rm -rf *
|
||||
- cmake ../ -DCMAKE_C_FLAGS="-O2 -pipe -DNDEBUG -fvisibility=hidden -fomit-frame-pointer" -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--strip-all" -DGOLDSOURCE_SUPPORT=1 -DUSE_VOICEMGR=0 && make -j3
|
||||
- mkdir -p $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls
|
||||
- mkdir -p $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls
|
||||
- cp cl_dll/client.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/cl_dlls
|
||||
- cp dlls/hl.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls
|
||||
- tar -J -cf $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC
|
||||
- curl --upload-file $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz https://transfer.sh/$TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz
|
||||
|
||||
|
|
|
@ -21,16 +21,29 @@
|
|||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.6.0)
|
||||
|
||||
# Install custom module path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
|
||||
include(VSForceXPToolchain) # Force XP toolchain for Visual Studio
|
||||
|
||||
project (HLSDK-XASH3D)
|
||||
|
||||
#--------------
|
||||
# USER DEFINES \
|
||||
################\
|
||||
option(64BIT "Allow 64 Bit builds" OFF)
|
||||
option(USE_VGUI "Enable VGUI1. UNDONE" OFF)
|
||||
option(USE_VGUI2 "Enable VGUI2. UNDONE" OFF)
|
||||
option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
|
||||
option(BUILD_CLIENT "Build client dll" ON)
|
||||
option(BUILD_SERVER "Build server dll" ON)
|
||||
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
|
||||
option(64BIT "Disable auto -m32 appending to compiler flags" OFF)
|
||||
set(GAMEDIR "valve" CACHE STRING "Gamedir path")
|
||||
set(SERVER_INSTALL_DIR "dlls" CACHE STRING "Where put server dll")
|
||||
set(CLIENT_INSTALL_DIR "cl_dlls" CACHE STRING "Where put client dll")
|
||||
set(SERVER_LIBRARY_NAME "hl" CACHE STRING "Library name for Linux/MacOS/Windows")
|
||||
|
||||
#-----------------
|
||||
# MAIN BUILD CODE \
|
||||
|
@ -38,15 +51,40 @@ option(BUILD_SERVER "Build server dll" ON)
|
|||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
|
||||
# Build 32-bit Xash on 64-bit, because Xash3D not support this
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT)
|
||||
if(MSVC)
|
||||
error("UNDONE: set 32 build flags")
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
|
||||
endif()
|
||||
set(CMAKE_SIZEOF_VOID_P 4)
|
||||
endif()
|
||||
|
||||
if(64BIT AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
message(FATAL_ERROR "You enabled XASH_64BIT, but compiler can't create 64 bit code!")
|
||||
endif()
|
||||
|
||||
if(64BIT)
|
||||
message(STATUS "Building for 64 Bit")
|
||||
else()
|
||||
message(STATUS "Building for 32 Bit")
|
||||
endif()
|
||||
|
||||
if (MINGW)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--add-stdcall-alias")
|
||||
endif()
|
||||
|
||||
# add_compile_options for older cmake versions
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.0.2")
|
||||
macro(add_compile_options)
|
||||
set(list_var "${ARGV}")
|
||||
foreach(arg IN LISTS list_var)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${arg}")
|
||||
endforeach()
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if(BUILD_CLIENT)
|
||||
|
|
133
README.md
133
README.md
|
@ -1,4 +1,4 @@
|
|||
# Half-Life SDK for Xash3D [![Build Status](https://travis-ci.org/FWGS/hlsdk-xash3d.svg)](https://travis-ci.org/FWGS/hlsdk-xash3d)
|
||||
# Half-Life SDK for Xash3D [![Build Status](https://travis-ci.org/FWGS/hlsdk-xash3d.svg)](https://travis-ci.org/FWGS/hlsdk-xash3d) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/FWGS/hlsdk-xash3d?svg=true)](https://ci.appveyor.com/project/a1batross/hlsdk-xash3d)
|
||||
|
||||
Half-Life SDK for Xash3D & GoldSource with some fixes.
|
||||
|
||||
|
@ -6,37 +6,144 @@ Half-Life SDK for Xash3D & GoldSource with some fixes.
|
|||
|
||||
### CMake as most universal way
|
||||
|
||||
```
|
||||
mkdir build && cd build
|
||||
cmake ../
|
||||
```
|
||||
mkdir build && cd build
|
||||
cmake ../
|
||||
make
|
||||
|
||||
Crosscompiling using mingw:
|
||||
|
||||
mkdir build-mingw && cd build-mingw
|
||||
TOOLCHAIN_PREFIX=i686-w64-mingw32 # check up the actual mingw prefix of your mingw installation
|
||||
cmake ../ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="$TOOLCHAIN_PREFIX-gcc" -DCMAKE_CXX_COMPILER="$TOOLCHAIN_PREFIX-g++"
|
||||
|
||||
You may enable or disable some build options by -Dkey=value. All available build options are defined in CMakeLists.txt at root directory.
|
||||
See below if you want to build the GoldSource compatible libraries.
|
||||
|
||||
See below, if CMake is not suitable for you:
|
||||
|
||||
### Windows
|
||||
|
||||
#### Using msvc
|
||||
|
||||
We use compilers provided with Microsoft Visual Studio 6. There're `compile.bat` scripts in both `cl_dll` and `dlls` directories.
|
||||
Before running any of those files you must define `MSVCDir` variable which is the path to your msvc installation.
|
||||
|
||||
set MSVCDir=C:\Program Files\Microsoft Visual Studio
|
||||
compile.bat
|
||||
|
||||
These scripts also can be ran via wine:
|
||||
|
||||
MSVCDir="z:\home\$USER\.wine\drive_c\Program Files\Microsoft Visual Studio" wine cmd /c compile.bat
|
||||
|
||||
The libraries built this way are always GoldSource compatible.
|
||||
|
||||
There're dsp projects for Visual Studio 6 in `cl_dll` and `dlls` directories, but we don't keep them up-to-date. You're free to adapt them for yourself and try to import into the newer Visual Studio versions.
|
||||
|
||||
#### Using mingw
|
||||
|
||||
TODO
|
||||
|
||||
### Linux
|
||||
|
||||
TODO
|
||||
(cd dlls && make)
|
||||
(cd cl_dll && make)
|
||||
|
||||
### OS X
|
||||
|
||||
TODO
|
||||
Nothing here.
|
||||
|
||||
### FreeBSD
|
||||
|
||||
```
|
||||
cd dlls
|
||||
gmake CXX=clang++ CC=clang
|
||||
cd ../cl_dll
|
||||
gmake CXX=clang++ CC=clang
|
||||
```
|
||||
(cd dlls && gmake CXX=clang++ CC=clang)
|
||||
(cd cl_dll && gmake CXX=clang++ CC=clang)
|
||||
|
||||
### Android
|
||||
|
||||
Just typical `ndk-build`.
|
||||
TODO: describe what it is.
|
||||
|
||||
### Building GoldSource-compatible libraries
|
||||
|
||||
To enable building the goldsource compatible client library add GOLDSOURCE_SUPPORT flag when calling cmake:
|
||||
|
||||
cmake .. -DGOLDSOURCE_SUPPORT=ON
|
||||
|
||||
or when using make without cmake:
|
||||
|
||||
make GOLDSOURCE_SUPPORT=1
|
||||
|
||||
Unlike original client by Valve the resulting client library will not depend on vgui or SDL2 just like the one that's used in FWGS Xash3d.
|
||||
|
||||
Note for **Windows**: it's not possible to create GoldSource compatible libraries using mingw, only msvc builds will work.
|
||||
|
||||
Note for **Linux**: GoldSource requires libraries (both client and server) to be compiled with libstdc++ bundled with g++ of major version 4 (versions from 4.6 to 4.9 should work).
|
||||
If your Linux distribution does not provide compatible g++ version you have several options.
|
||||
|
||||
#### Method 1: Statically build with c++ library
|
||||
|
||||
This one is the most simple but has a drawback.
|
||||
|
||||
cmake ../ -DGOLDSOURCE_SUPPORT=ON -DCMAKE_C_FLAGS="-static-libstdc++ -static-libgcc"
|
||||
|
||||
The drawback is that the compiled libraries will be larger in size.
|
||||
|
||||
#### Method 2: Build in Steam Runtime chroot
|
||||
|
||||
This is the official way to build Steam compatible games for Linux.
|
||||
|
||||
Clone https://github.com/ValveSoftware/steam-runtime and follow instructions https://github.com/ValveSoftware/steam-runtime#building-in-the-runtime
|
||||
|
||||
sudo ./setup_chroot.sh --i386
|
||||
|
||||
Then use cmake and make as usual, but prepend the commands with `schroot --chroot steamrt_scout_i386 --`:
|
||||
|
||||
mkdir build-in-steamrt && cd build-in-steamrt
|
||||
schroot --chroot steamrt_scout_i386 -- cmake ../ -DGOLDSOURCE_SUPPORT=ON
|
||||
schroot --chroot steamrt_scout_i386 -- make
|
||||
|
||||
#### Method 3: Create your own chroot with older distro that includes g++ 4.
|
||||
|
||||
Use the most suitable way for you to create an old distro 32-bit chroot. E.g. on Debian (and similar) you can use debootstrap.
|
||||
|
||||
sudo debootstrap --arch=i386 jessie /var/chroot/jessie-debian-i386 # On Ubuntu type trusty instead of jessie
|
||||
sudo chroot /var/chroot/jessie-debian-i386
|
||||
|
||||
Inside chroot install cmake, make, g++ and libsdl2-dev. Then exit the chroot.
|
||||
|
||||
On the host system install schroot. Then create and adapt the following config in /etc/schroot/chroot.d/jessie.conf (you can choose a different name):
|
||||
|
||||
```
|
||||
[jessie]
|
||||
type=directory
|
||||
description=Debian jessie i386
|
||||
directory=/var/chroot/debian-jessie-i386/
|
||||
users=yourusername
|
||||
groups=yourusername
|
||||
root-groups=root
|
||||
preserve-environment=true
|
||||
personality=linux32
|
||||
```
|
||||
|
||||
Insert your actual user name in place of `yourusername`. Then prepend any make or cmake call with `schroot -c jessie --`:
|
||||
|
||||
mkdir build-in-chroot && cd build-in-chroot
|
||||
schroot --chroot jessie -- cmake ../ -DGOLDSOURCE_SUPPORT=ON
|
||||
schroot --chroot jessie -- make
|
||||
|
||||
#### Method 4: Install the needed g++ version yourself
|
||||
|
||||
TODO: describe steps.
|
||||
|
||||
#### Configuring Qt Creator to use toolchain from chroot
|
||||
|
||||
Create a file with the following contents anywhere:
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
schroot --chroot steamrt_scout_i386 -- cmake "$@"
|
||||
```
|
||||
|
||||
Make it executable.
|
||||
In Qt Creator go to `Tools` -> `Options` -> `Build & Run` -> `CMake`. Add a new cmake tool and specify the path of previously created file.
|
||||
Go to `Kits` tab, clone your default configuration and choose your CMake tool there.
|
||||
Choose the new kit when opening CMakeLists.txt.
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
version: 1.0.{build}
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- os: Visual Studio 2013
|
||||
GENERATOR_NAME: "Visual Studio 12 2013"
|
||||
- os: Visual Studio 2015
|
||||
GENERATOR_NAME: "Visual Studio 14 2015"
|
||||
# TODO: Uncomment when AppVeyor will provide XP toolchain for VS2017
|
||||
# - os: Visual Studio 2017
|
||||
# GENERATOR_NAME: "Visual Studio 15 2017"
|
||||
|
||||
clone_folder: c:\projects\xash\hlsdk-xash3d
|
||||
|
||||
build:
|
||||
project: INSTALL.vcxproj
|
||||
verbosity: normal
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
|
||||
before_build:
|
||||
- git submodule update --init --recursive
|
||||
- cmake -G "%GENERATOR_NAME%"
|
31
backup.bat
31
backup.bat
|
@ -1,31 +0,0 @@
|
|||
@echo off
|
||||
color 4F
|
||||
echo XashXT Group 2006 (C)
|
||||
echo Prepare source for backup
|
||||
echo.
|
||||
|
||||
if exist backup.log del /f /q backup.log
|
||||
if not exist D:\!backup/ mkdir D:\!backup\
|
||||
echo Prepare OK!
|
||||
echo Please wait: backup in progress
|
||||
C:\Progra~1\WinRar\rar a -agMMMYYYY-DD D:\!backup\.rar -dh -m5 @backup.lst >>backup.log
|
||||
if errorlevel 1 goto error
|
||||
if errorlevel 0 goto ok
|
||||
:ok
|
||||
cls
|
||||
echo Source was sucessfully backuped
|
||||
echo and stored in folder "backup"
|
||||
echo Press any key for exit. :-)
|
||||
if exist backup.log del /f /q backup.log
|
||||
exit
|
||||
:error
|
||||
echo ******************************
|
||||
echo ***********Error!*************
|
||||
echo ******************************
|
||||
echo **See backup.log for details**
|
||||
echo ******************************
|
||||
echo ******************************
|
||||
echo.
|
||||
echo press any key for exit :-(
|
||||
pause>nul
|
||||
exit
|
36
backup.lst
36
backup.lst
|
@ -1,36 +0,0 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// list with backup directories
|
||||
//=======================================================================
|
||||
|
||||
// global stuff
|
||||
xash.dsw
|
||||
debug.bat
|
||||
backup.lst
|
||||
backup.bat
|
||||
release.bat
|
||||
change.log
|
||||
make_sdk.bat
|
||||
xash_sdk.lst
|
||||
|
||||
cl_dll\
|
||||
cl_dll\hl\
|
||||
common\
|
||||
dlls\
|
||||
game_shared\
|
||||
game_launch\
|
||||
engine\
|
||||
engine\client\
|
||||
engine\client\vgui\
|
||||
engine\server\
|
||||
engine\common\
|
||||
engine\common\imagelib\
|
||||
engine\common\soundlib\
|
||||
pm_shared\
|
||||
mainui\
|
||||
mainui\legacy
|
||||
utils\
|
||||
utils\makefont\
|
||||
utils\vgui\
|
||||
utils\vgui\include\
|
||||
utils\vgui\lib\win32_vc6\
|
|
@ -13,7 +13,6 @@ LOCAL_MODULE := client
|
|||
#else
|
||||
APP_PLATFORM := android-8
|
||||
#endif
|
||||
LOCAL_CONLYFLAGS += -std=c99
|
||||
|
||||
include $(XASH3D_CONFIG)
|
||||
|
||||
|
@ -25,32 +24,11 @@ LOCAL_CFLAGS += -DCLIENT_DLL=1
|
|||
|
||||
SRCS=
|
||||
SRCS_C=
|
||||
SRCS+=../dlls/crossbow.cpp
|
||||
SRCS+=../dlls/crowbar.cpp
|
||||
#SRCS+=../dlls/egon.cpp
|
||||
SRCS+=./ev_hldm.cpp
|
||||
#SRCS+=../dlls/gauss.cpp
|
||||
#SRCS+=../dlls/handgrenade.cpp
|
||||
SRCS+=./hl/hl_baseentity.cpp
|
||||
SRCS+=./hl/hl_events.cpp
|
||||
SRCS+=./hl/hl_objects.cpp
|
||||
SRCS+=./hl/hl_weapons.cpp
|
||||
#SRCS+=../dlls/hornetgun.cpp
|
||||
#SRCS+=../dlls/mp5.cpp
|
||||
#SRCS+=../dlls/python.cpp
|
||||
SRCS+=../dlls/rpg.cpp
|
||||
SRCS+=../dlls/satchel.cpp
|
||||
SRCS+=../dlls/shotgun.cpp
|
||||
SRCS+=../dlls/squeakgrenade.cpp
|
||||
SRCS+=../dlls/tripmine.cpp
|
||||
#SRCS+=../dlls/glock.cpp
|
||||
SRCS+=../dlls/poke646/bradnailer.cpp
|
||||
SRCS+=../dlls/poke646/cmlwbr.cpp
|
||||
SRCS+=../dlls/poke646/heaterpipe.cpp
|
||||
SRCS+=../dlls/poke646/nailgun.cpp
|
||||
SRCS+=../dlls/poke646/weapon_pipebomb.cpp
|
||||
SRCS+=../dlls/poke646/xensquasher.cpp
|
||||
SRCS+=../dlls/vendetta/par21.cpp
|
||||
#SRCS+=../game_shared/voice_banmgr.cpp
|
||||
#SRCS+=../game_shared/voice_status.cpp
|
||||
SRCS+=./ammo.cpp
|
||||
|
@ -76,6 +54,8 @@ SRCS+=./hud_spectator.cpp
|
|||
SRCS+=./hud_update.cpp
|
||||
SRCS+=./in_camera.cpp
|
||||
SRCS+=./input.cpp
|
||||
SRCS+=./input_goldsource.cpp
|
||||
SRCS+=./input_mouse.cpp
|
||||
#SRCS+=./inputw32.cpp
|
||||
SRCS+=./menu.cpp
|
||||
SRCS+=./message.cpp
|
||||
|
@ -99,8 +79,8 @@ SRCS+=./input_xash3d.cpp
|
|||
SRCS+=./scoreboard.cpp
|
||||
SRCS+=./MOTD.cpp
|
||||
|
||||
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls
|
||||
DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w
|
||||
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -I../utils/false_vgui/include
|
||||
DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w -D_snprintf=snprintf
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
|
||||
$(LOCAL_PATH)/../common \
|
||||
|
@ -109,10 +89,17 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
|
|||
$(LOCAL_PATH)/../dlls \
|
||||
$(LOCAL_PATH)/../pm_shared \
|
||||
$(LOCAL_PATH)/poke646 \
|
||||
$(LOCAL_PATH)/../dlls/poke646
|
||||
|
||||
$(LOCAL_PATH)/../dlls/poke646 \
|
||||
$(LOCAL_PATH)/../utils/false_vgui/include
|
||||
LOCAL_CFLAGS += $(DEFINES) $(INCLUDES)
|
||||
|
||||
ifeq ($(GOLDSOURCE_SUPPORT),1)
|
||||
DEFINES += -DGOLDSOURCE_SUPPORT
|
||||
ifeq ($(shell uname -s),Linux)
|
||||
LOCAL_LDLIBS += -ldl
|
||||
endif
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := $(SRCS) $(SRCS_C)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
|
|
@ -25,31 +25,26 @@ project (CLDLL)
|
|||
|
||||
set (CLDLL_LIBRARY client)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
|
||||
add_definitions(-DCLIENT_DLL)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_compile_options(-fno-exceptions) # GCC/Clang flag
|
||||
add_compile_options(-Wno-write-strings) # GCC/Clang flag
|
||||
add_compile_options(-fvisibility=hidden) # GCC/Clang flag
|
||||
add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems
|
||||
add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp)
|
||||
if(NOT MINGW)
|
||||
add_definitions(-D_snprintf=snprintf -D_vsnprintf=vsnprintf)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif()
|
||||
|
||||
if (GOLDSOURCE_SUPPORT)
|
||||
add_definitions(-DGOLDSOURCE_SUPPORT)
|
||||
endif()
|
||||
|
||||
set (CLDLL_SOURCES
|
||||
../dlls/crossbow.cpp
|
||||
../dlls/crowbar.cpp
|
||||
# ../dlls/egon.cpp
|
||||
# ../dlls/gauss.cpp
|
||||
# ../dlls/handgrenade.cpp
|
||||
# ../dlls/hornetgun.cpp
|
||||
# ../dlls/mp5.cpp
|
||||
# ../dlls/python.cpp
|
||||
../dlls/rpg.cpp
|
||||
../dlls/satchel.cpp
|
||||
../dlls/shotgun.cpp
|
||||
../dlls/squeakgrenade.cpp
|
||||
../dlls/tripmine.cpp
|
||||
# ../dlls/glock.cpp
|
||||
../dlls/poke646/bradnailer.cpp
|
||||
../dlls/poke646/cmlwbr.cpp
|
||||
../dlls/poke646/heaterpipe.cpp
|
||||
../dlls/poke646/nailgun.cpp
|
||||
../dlls/poke646/weapon_pipebomb.cpp
|
||||
../dlls/poke646/xensquasher.cpp
|
||||
../dlls/vendetta/par21.cpp
|
||||
ev_hldm.cpp
|
||||
hl/hl_baseentity.cpp
|
||||
hl/hl_events.cpp
|
||||
|
@ -77,7 +72,9 @@ set (CLDLL_SOURCES
|
|||
hud_update.cpp
|
||||
in_camera.cpp
|
||||
input.cpp
|
||||
#SRCS+=./inputw32.cpp
|
||||
input_goldsource.cpp
|
||||
input_mouse.cpp
|
||||
input_xash3d.cpp
|
||||
menu.cpp
|
||||
message.cpp
|
||||
overview.cpp
|
||||
|
@ -96,10 +93,10 @@ set (CLDLL_SOURCES
|
|||
tri.cpp
|
||||
util.cpp
|
||||
view.cpp
|
||||
input_xash3d.cpp
|
||||
scoreboard.cpp
|
||||
MOTD.cpp)
|
||||
include_directories (. hl/ poke646 ../dlls ../dlls/poke646 ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public)
|
||||
|
||||
include_directories (. hl/ poke646 ../dlls ../dlls/poke646 ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include)
|
||||
|
||||
if(USE_VOICEMGR)
|
||||
#set(CLDLL_SOURCES
|
||||
|
@ -109,7 +106,26 @@ if(USE_VOICEMGR)
|
|||
endif()
|
||||
|
||||
add_library (${CLDLL_LIBRARY} SHARED ${CLDLL_SOURCES})
|
||||
if (GOLDSOURCE_SUPPORT)
|
||||
target_link_libraries( ${CLDLL_LIBRARY} ${CMAKE_DL_LIBS} )
|
||||
endif()
|
||||
|
||||
set_target_properties (${CLDLL_SHARED} PROPERTIES
|
||||
set_target_properties (${CLDLL_LIBRARY} PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE 1)
|
||||
|
||||
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(CLDLL_NAME "client")
|
||||
if(64BIT)
|
||||
set(CLDLL_NAME "client64")
|
||||
endif()
|
||||
|
||||
set_target_properties(${CLDLL_LIBRARY} PROPERTIES
|
||||
OUTPUT_NAME ${CLDLL_NAME}
|
||||
PREFIX "")
|
||||
endif()
|
||||
|
||||
install( TARGETS ${CLDLL_LIBRARY}
|
||||
DESTINATION "${GAMEDIR}/${CLIENT_INSTALL_DIR}/"
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE )
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined( GAMESTUDIOMODELRENDERER_H )
|
||||
#define GAMESTUDIOMODELRENDERER_H
|
||||
#if defined( _WIN32 )
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*
|
||||
====================
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined( GAMESTUDIOMODELRENDERER_H )
|
||||
#define GAMESTUDIOMODELRENDERER_H
|
||||
#if defined( _WIN32 )
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*
|
||||
====================
|
||||
|
|
|
@ -103,7 +103,7 @@ int CHudMOTD::Draw( float fTime )
|
|||
|
||||
// find where to start drawing the line
|
||||
if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) )
|
||||
gHUD.DrawHudString( xpos, ypos, xmax, ch, 255, 180, 0 );
|
||||
DrawUtfString( xpos, ypos, xmax, ch, 255, 180, 0 );
|
||||
|
||||
ypos += LINE_HEIGHT;
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ SRCS+=./hud_spectator.cpp
|
|||
SRCS+=./hud_update.cpp
|
||||
SRCS+=./in_camera.cpp
|
||||
SRCS+=./input.cpp
|
||||
#SRCS+=./inputw32.cpp
|
||||
SRCS+=./input_mouse.cpp
|
||||
SRCS+=./input_goldsource.cpp
|
||||
SRCS+=./menu.cpp
|
||||
SRCS+=./message.cpp
|
||||
SRCS+=./overview.cpp
|
||||
|
@ -66,15 +67,18 @@ SRCS+=./view.cpp
|
|||
SRCS+=./input_xash3d.cpp
|
||||
SRCS+=./scoreboard.cpp
|
||||
SRCS+=./MOTD.cpp
|
||||
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls
|
||||
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -I../utils/false_vgui/include
|
||||
DEFINES = -Wno-write-strings -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL
|
||||
CFLAGS = -m32
|
||||
OBJS = $(SRCS:.cpp=.o) $(SRCS_C:.c=.o)
|
||||
|
||||
LIBS=-lm
|
||||
ifeq ($(GOLDSOURCE_SUPPORT),1)
|
||||
DEFINES += -DGOLDSOURCE_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname -s),Linux)
|
||||
LIBS=$(LIBS) -ldl
|
||||
LIBS += -ldl
|
||||
endif
|
||||
|
||||
%.o : %.c
|
||||
|
@ -83,7 +87,7 @@ endif
|
|||
%.o : %.cpp
|
||||
$(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@
|
||||
client.so : $(OBJS)
|
||||
$(CXX) $(OBJS) -o client.so -shared -Wl,--no-undefined -fPIC $(LIBS)
|
||||
$(CXX) $(CFLAGS) $(OBJS) -o client.so -shared -Wl,--no-undefined -fPIC $(LIBS)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined ( STUDIOMODELRENDERER_H )
|
||||
#define STUDIOMODELRENDERER_H
|
||||
#if defined( _WIN32 )
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*
|
||||
====================
|
||||
|
|
161
cl_dll/ammo.cpp
161
cl_dll/ammo.cpp
|
@ -305,6 +305,9 @@ void CHudAmmo::Reset( void )
|
|||
gHR.Reset();
|
||||
|
||||
//VidInit();
|
||||
wrect_t nullrc = {0,};
|
||||
SetCrosshair( 0, nullrc, 0, 0, 0 ); // reset crosshair
|
||||
m_pWeapon = NULL; // reset last weapon
|
||||
}
|
||||
|
||||
int CHudAmmo::VidInit( void )
|
||||
|
@ -312,6 +315,7 @@ int CHudAmmo::VidInit( void )
|
|||
// Load sprites for buckets (top row of weapon menu)
|
||||
m_HUD_bucket0 = gHUD.GetSpriteIndex( "bucket1" );
|
||||
m_HUD_selection = gHUD.GetSpriteIndex( "selection" );
|
||||
m_HUD_stripe = gHUD.GetSpriteIndex( "stripe" );
|
||||
|
||||
ghsprBuckets = gHUD.GetSprite( m_HUD_bucket0 );
|
||||
giBucketWidth = gHUD.GetSpriteRect( m_HUD_bucket0 ).right - gHUD.GetSpriteRect( m_HUD_bucket0 ).left;
|
||||
|
@ -422,12 +426,6 @@ void WeaponsResource::SelectSlot( int iSlot, int fAdvance, int iDirection )
|
|||
if( gHUD.m_fPlayerDead || gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )
|
||||
return;
|
||||
|
||||
if ( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
|
||||
return;
|
||||
|
||||
if( ! ( gHUD.m_iWeaponBits & ~( 1 << ( WEAPON_SUIT ) ) ) )
|
||||
return;
|
||||
|
||||
WEAPON *p = NULL;
|
||||
bool fastSwitch = CVAR_GET_FLOAT( "hud_fastswitch" ) != 0;
|
||||
|
||||
|
@ -484,7 +482,7 @@ int CHudAmmo::MsgFunc_AmmoX( const char *pszName, int iSize, void *pbuf )
|
|||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
int iIndex = READ_BYTE();
|
||||
int iCount = READ_BYTE();
|
||||
int iCount = READ_SHORT();
|
||||
|
||||
gWR.SetAmmo( iIndex, abs( iCount ) );
|
||||
|
||||
|
@ -495,7 +493,7 @@ int CHudAmmo::MsgFunc_AmmoPickup( const char *pszName, int iSize, void *pbuf )
|
|||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
int iIndex = READ_BYTE();
|
||||
int iCount = READ_BYTE();
|
||||
int iCount = READ_SHORT();
|
||||
|
||||
// Add ammo to the history
|
||||
gHR.AddToHistory( HISTSLOT_AMMO, iIndex, abs( iCount ) );
|
||||
|
@ -534,15 +532,18 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
if( gEngfuncs.IsSpectateOnly() )
|
||||
return 1;
|
||||
|
||||
if( !( gHUD.m_iHideHUDDisplay & HIDEHUD_WEAPONS ) )
|
||||
gHUD.m_flScaleColorTime = gHUD.m_flTime + 2.0;
|
||||
|
||||
if( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )
|
||||
{
|
||||
static wrect_t nullrc;
|
||||
wrect_t nullrc = {0,};
|
||||
gpActiveSel = NULL;
|
||||
SetCrosshair( 0, nullrc, 0, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_pWeapon )
|
||||
if( m_pWeapon )
|
||||
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
|
||||
}
|
||||
|
||||
|
@ -556,7 +557,7 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
//
|
||||
int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
static wrect_t nullrc;
|
||||
wrect_t nullrc = {0,};
|
||||
int fOnTarget = FALSE;
|
||||
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
@ -574,6 +575,8 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
if( iId < 1 )
|
||||
{
|
||||
SetCrosshair( 0, nullrc, 0, 0, 0 );
|
||||
// Clear out the weapon so we don't keep drawing the last active weapon's ammo. - Solokiller
|
||||
m_pWeapon = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -604,6 +607,8 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
|
||||
m_pWeapon = pWeapon;
|
||||
|
||||
if( !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) )
|
||||
{
|
||||
if( gHUD.m_iFOV >= 90 )
|
||||
{
|
||||
// normal crosshairs
|
||||
|
@ -619,7 +624,7 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 );
|
||||
else
|
||||
SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
m_fFade = 200.0f; //!!!
|
||||
|
@ -826,9 +831,6 @@ int CHudAmmo::Draw( float flTime )
|
|||
int a, x, y, r, g, b;
|
||||
int AmmoWidth;
|
||||
|
||||
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
|
||||
return 1;
|
||||
|
||||
if( ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) )
|
||||
return 1;
|
||||
|
||||
|
@ -854,7 +856,7 @@ int CHudAmmo::Draw( float flTime )
|
|||
|
||||
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
|
||||
|
||||
a = (int) min( gHUD.m_flAlpha, max( MIN_ALPHA, m_fFade) );
|
||||
a = (int)max( MIN_ALPHA, m_fFade);
|
||||
|
||||
if( m_fFade > 0 )
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
|
@ -864,7 +866,7 @@ int CHudAmmo::Draw( float flTime )
|
|||
ScaleColors( r, g, b, a );
|
||||
|
||||
// Does this weapon have a clip?
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - 10;
|
||||
|
||||
// Does weapon have any ammo at all?
|
||||
if( m_pWeapon->iAmmoType > 0 )
|
||||
|
@ -874,40 +876,37 @@ int CHudAmmo::Draw( float flTime )
|
|||
if( pw->iClip >= 0 )
|
||||
{
|
||||
// room for the number and the '|' and the current ammo
|
||||
x = ScreenWidth - ( 8 * AmmoWidth ) - iIconWidth;
|
||||
int StripeWidth = gHUD.GetSpriteRect( m_HUD_stripe ).right - gHUD.GetSpriteRect( m_HUD_stripe ).left;
|
||||
|
||||
x = ScreenWidth - ( 6 * AmmoWidth ) - iIconWidth - StripeWidth - 62;
|
||||
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b );
|
||||
|
||||
wrect_t rc;
|
||||
rc.top = 0;
|
||||
rc.left = 0;
|
||||
rc.right = AmmoWidth;
|
||||
rc.bottom = 100;
|
||||
|
||||
int iBarWidth = AmmoWidth / 10;
|
||||
|
||||
x += AmmoWidth / 2;
|
||||
x += 16;
|
||||
|
||||
UnpackRGB( r,g,b, RGB_YELLOWISH );
|
||||
|
||||
// draw the | bar
|
||||
FillRGBA( x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a );
|
||||
|
||||
x += iBarWidth + AmmoWidth / 2;
|
||||
|
||||
// GL Seems to need this
|
||||
ScaleColors( r, g, b, a );
|
||||
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo( pw->iAmmoType ), r, g, b );
|
||||
|
||||
// draw the | bar
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_stripe ), r, g, b );
|
||||
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_stripe ) );
|
||||
|
||||
// GL Seems to need this
|
||||
x = gHUD.DrawHudNumber( x + StripeWidth + 16, y, iFlags | DHN_3DIGITS, gWR.CountAmmo( pw->iAmmoType ), r, g, b );
|
||||
x += 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
// SPR_Draw a bullets only line
|
||||
x = ScreenWidth - 4 * AmmoWidth - iIconWidth;
|
||||
x = ScreenWidth - 4 * AmmoWidth - iIconWidth - 10;
|
||||
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo( pw->iAmmoType ), r, g, b );
|
||||
x += 10;
|
||||
}
|
||||
|
||||
// Draw the ammo Icon
|
||||
// int iOffset = ( m_pWeapon->rcAmmo.bottom - m_pWeapon->rcAmmo.top ) / 8;
|
||||
SPR_Set( m_pWeapon->hAmmo, r, g, b );
|
||||
SPR_DrawAdditive( 0, x + iIconWidth / 4, y, &m_pWeapon->rcAmmo );
|
||||
SPR_DrawAdditive( 0, x, y + 1, &m_pWeapon->rcAmmo );
|
||||
}
|
||||
|
||||
// Does weapon have seconday ammo?
|
||||
|
@ -924,7 +923,8 @@ int CHudAmmo::Draw( float flTime )
|
|||
|
||||
// Draw the ammo Icon
|
||||
SPR_Set( m_pWeapon->hAmmo2, r, g, b );
|
||||
SPR_DrawAdditive( 0, x + iIconWidth / 4, y, &m_pWeapon->rcAmmo2 );
|
||||
int iOffset = ( m_pWeapon->rcAmmo2.bottom - m_pWeapon->rcAmmo2.top ) / 8;
|
||||
SPR_DrawAdditive( 0, x, y - iOffset, &m_pWeapon->rcAmmo2 );
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -942,7 +942,7 @@ int DrawBar( int x, int y, int width, int height, float f )
|
|||
if( f > 1 )
|
||||
f = 1;
|
||||
|
||||
if( f )
|
||||
if( f > 0 )
|
||||
{
|
||||
int w = f * width;
|
||||
|
||||
|
@ -954,18 +954,19 @@ int DrawBar( int x, int y, int width, int height, float f )
|
|||
r = 255 - g;
|
||||
b = 0;
|
||||
|
||||
ScaleColors( r, g, b, min( gHUD.m_flAlpha, 255 ) );
|
||||
//ScaleColors( r, g, b, min( gHUD.m_flAlpha, 255 ) );
|
||||
|
||||
FillRGBA( x, y, w, height, r, g, b, min( gHUD.m_flAlpha, 255 ) );
|
||||
FillRGBA( x, y, w, height, 255 - g, g, 0, 255 );
|
||||
x += w;
|
||||
width -= w;
|
||||
}
|
||||
else
|
||||
{
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
r=g=b=f;
|
||||
// UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
}
|
||||
|
||||
FillRGBA( x, y, width, height, r, g, b, min( gHUD.m_flAlpha, 128 ) );
|
||||
FillRGBA( x, y, width, height, r, g, b, 64 );
|
||||
|
||||
return( x + width );
|
||||
}
|
||||
|
@ -1003,73 +1004,39 @@ int CHudAmmo::DrawWList( float flTime )
|
|||
{
|
||||
int r, g, b, x, y, a, i;
|
||||
|
||||
if( !gpActiveSel )
|
||||
return 0;
|
||||
|
||||
int iActiveSlot;
|
||||
|
||||
if( gpActiveSel == (WEAPON *)1 )
|
||||
iActiveSlot = -1; // current slot has no weapons
|
||||
else
|
||||
iActiveSlot = gpActiveSel->iSlot;
|
||||
|
||||
x = 10; //!!!
|
||||
y = 10; //!!!
|
||||
|
||||
// Ensure that there are available choices in the active slot
|
||||
if( iActiveSlot > 0 )
|
||||
{
|
||||
if( !gWR.GetFirstPos( iActiveSlot ) )
|
||||
{
|
||||
gpActiveSel = (WEAPON *)1;
|
||||
iActiveSlot = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw top line
|
||||
for( i = 0; i < MAX_WEAPON_SLOTS; i++ )
|
||||
{
|
||||
int iHeight;
|
||||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
|
||||
if( iActiveSlot == i )
|
||||
a = min( gHUD.m_flAlpha, 255 );
|
||||
else
|
||||
a = min( gHUD.m_flAlpha, 192 );
|
||||
|
||||
ScaleColors( r, g, b, min( gHUD.m_flAlpha, 128 ) ); // 255
|
||||
ScaleColors( r, g, b, 100 ); // 255
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_bucket0 + i ), r, g, b );
|
||||
|
||||
// make active slot wide enough to accomodate gun pictures
|
||||
if( i == iActiveSlot )
|
||||
{
|
||||
WEAPON *p = gWR.GetFirstPos( iActiveSlot );
|
||||
if( p )
|
||||
iHeight = p->rcActive.bottom - p->rcActive.top;
|
||||
else
|
||||
iHeight = giBucketWidth;
|
||||
}
|
||||
else
|
||||
iHeight = giBucketHeight;
|
||||
|
||||
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_bucket0 + i ) );
|
||||
|
||||
y += iHeight + 5;
|
||||
y += giBucketHeight + 4;
|
||||
}
|
||||
|
||||
a = min(gHUD.m_flAlpha, 128); //!!!
|
||||
if( !gpActiveSel )
|
||||
return 0;
|
||||
|
||||
if( gpActiveSel != (WEAPON *)1 )
|
||||
{
|
||||
if( gpActiveSel->iSlot > 0 && !gWR.GetFirstPos( gpActiveSel->iSlot ) )
|
||||
{
|
||||
gpActiveSel = (WEAPON *)1;
|
||||
}
|
||||
}
|
||||
y = 10;
|
||||
|
||||
// Draw all of the buckets
|
||||
for( i = 0; i < MAX_WEAPON_SLOTS; i++ )
|
||||
{
|
||||
x = giBucketWidth + 15;
|
||||
x = giBucketWidth + 14;
|
||||
|
||||
WEAPON *p = gWR.GetFirstPos( i );
|
||||
int iHeight = giBucketHeight;
|
||||
if( p )
|
||||
iHeight = p->rcActive.bottom - p->rcActive.top;
|
||||
WEAPON *p; // = gWR.GetFirstPos( i );
|
||||
|
||||
for( int iPos = 0; iPos < MAX_WEAPON_POSITIONS; iPos++ )
|
||||
{
|
||||
|
@ -1078,12 +1045,12 @@ int CHudAmmo::DrawWList( float flTime )
|
|||
if( !p || !p->iId )
|
||||
continue;
|
||||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
UnpackRGB( r, g, b, RGB_WHITEISH );
|
||||
|
||||
// if active, then we must have ammo.
|
||||
if( gpActiveSel == p )
|
||||
{
|
||||
ScaleColors( r, g, b, min( gHUD.m_flAlpha, 192 ) );
|
||||
ScaleColors( r, g, b, 192 );
|
||||
|
||||
SPR_Set( p->hActive, r, g, b );
|
||||
SPR_DrawAdditive( 0, x, y, &p->rcActive );
|
||||
|
@ -1092,21 +1059,21 @@ int CHudAmmo::DrawWList( float flTime )
|
|||
{
|
||||
// Draw Weapon if Red if no ammo
|
||||
if( gWR.HasAmmo( p ) )
|
||||
ScaleColors( r, g, b, min( gHUD.m_flAlpha, 192 ) );
|
||||
ScaleColors( r, g, b, 192 );
|
||||
else
|
||||
ScaleColors( r, g, b, min( gHUD.m_flAlpha, 64 ) );
|
||||
ScaleColors( r, g, b, 96 );
|
||||
|
||||
SPR_Set( p->hInactive, r, g, b );
|
||||
SPR_DrawAdditive( 0, x, y, &p->rcInactive );
|
||||
}
|
||||
|
||||
// Draw Ammo Bar
|
||||
DrawAmmoBar( p, x + giABWidth/2, y, giABWidth, giABHeight );
|
||||
DrawAmmoBar( p, x + 1, y + 1, giABWidth, giABHeight );
|
||||
|
||||
x += p->rcActive.right - p->rcActive.left + 5;
|
||||
x += p->rcActive.right - p->rcActive.left + 4;
|
||||
}
|
||||
|
||||
y += iHeight + 5;
|
||||
y += giBucketHeight + 4;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef __AMMO_H__
|
||||
#define __AMMO_H__
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ int CHudAmmoSecondary::Draw( float flTime )
|
|||
// draw secondary ammo icons above normal ammo readout
|
||||
int a, x, y, r, g, b, AmmoWidth;
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
a = (int) max( min( gHUD.m_flAlpha, MIN_ALPHA ), m_fFade );
|
||||
a = (int) max( MIN_ALPHA, m_fFade );
|
||||
if( m_fFade > 0 )
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 ); // slowly lower alpha to fade out icons
|
||||
ScaleColors( r, g, b, a );
|
||||
|
|
|
@ -139,6 +139,8 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
|||
SPR_DrawAdditive( 0, xpos, ypos, &rcPic );
|
||||
}
|
||||
|
||||
// do not draw black console string
|
||||
if( !( ( hud_textmode->value == 2 ) && ( scale < 200 ) ) )
|
||||
// Draw the number
|
||||
gHUD.DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b );
|
||||
}
|
||||
|
@ -156,7 +158,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
|||
UnpackRGB( r, g, b, RGB_REDISH ); // if the weapon doesn't have ammo, display it as red
|
||||
|
||||
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
|
||||
ScaleColors( r, g, b, min( gHUD.m_flAlpha, min( scale, 255 ) ) );
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
|
||||
int xpos = ScreenWidth - ( weap->rcInactive.right - weap->rcInactive.left );
|
||||
|
@ -174,7 +176,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
|||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
|
||||
ScaleColors( r, g, b, min( gHUD.m_flAlpha, min( scale, 255 ) ) );
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
|
||||
int xpos = ScreenWidth - ( rect.right - rect.left ) - 10;
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
//
|
||||
// ammohistory.h
|
||||
//
|
||||
#pragma once
|
||||
#ifndef AMMOHISTORY_H
|
||||
#define AMMOHISTORY_H
|
||||
|
||||
// this is the max number of items in each bucket
|
||||
#define MAX_WEAPON_POSITIONS MAX_WEAPON_SLOTS
|
||||
|
@ -137,3 +140,4 @@ public:
|
|||
};
|
||||
|
||||
extern HistoryResource gHR;
|
||||
#endif // AMMOHISTORY_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -7,7 +7,7 @@
|
|||
|
||||
// Camera.h -- defines and such for a 3rd person camera
|
||||
// NOTE: must include quakedef.h first
|
||||
|
||||
#pragma once
|
||||
#ifndef _CAMERA_H_
|
||||
#define _CAMERA_H_
|
||||
|
||||
|
|
|
@ -21,6 +21,13 @@
|
|||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "netadr.h"
|
||||
#include "parsemsg.h"
|
||||
|
||||
#if defined(GOLDSOURCE_SUPPORT) && (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && (defined(__i386) || defined(_M_IX86))
|
||||
#define USE_VGUI_FOR_GOLDSOURCE_SUPPORT
|
||||
#include "VGUI_Panel.h"
|
||||
#include "VGUI_App.h"
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -32,14 +39,20 @@ extern "C"
|
|||
cl_enginefunc_t gEngfuncs;
|
||||
CHud gHUD;
|
||||
mobile_engfuncs_t *gMobileEngfuncs = NULL;
|
||||
|
||||
extern "C" int g_bhopcap;
|
||||
void InitInput( void );
|
||||
void EV_HookEvents( void );
|
||||
void IN_Commands( void );
|
||||
|
||||
extern cvar_t *cl_upspeed;
|
||||
extern cvar_t *cl_forwardspeed;
|
||||
extern cvar_t *cl_backspeed;
|
||||
extern cvar_t *cl_sidespeed;
|
||||
int __MsgFunc_Bhopcap( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
g_bhopcap = READ_BYTE();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
==========================
|
||||
|
@ -81,18 +94,18 @@ int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs )
|
|||
switch( hullnumber )
|
||||
{
|
||||
case 0: // Normal player
|
||||
mins = Vector( -16, -16, -36 );
|
||||
maxs = Vector( 16, 16, 36 );
|
||||
Vector( -16, -16, -36 ).CopyToArray(mins);
|
||||
Vector( 16, 16, 36 ).CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
case 1: // Crouched player
|
||||
mins = Vector( -16, -16, -18 );
|
||||
maxs = Vector( 16, 16, 18 );
|
||||
Vector( -16, -16, -18 ).CopyToArray(mins);
|
||||
Vector( 16, 16, 18 ).CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
case 2: // Point based hull
|
||||
mins = Vector( 0, 0, 0 );
|
||||
maxs = Vector( 0, 0, 0 );
|
||||
Vector( 0, 0, 0 ).CopyToArray(mins);
|
||||
Vector( 0, 0, 0 ).CopyToArray(maxs);
|
||||
iret = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -170,6 +183,46 @@ int *HUD_GetRect( void )
|
|||
return extent;
|
||||
}
|
||||
|
||||
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
|
||||
class TeamFortressViewport : public vgui::Panel
|
||||
{
|
||||
public:
|
||||
TeamFortressViewport(int x,int y,int wide,int tall);
|
||||
void Initialize( void );
|
||||
|
||||
virtual void paintBackground();
|
||||
void *operator new( size_t stAllocateBlock );
|
||||
};
|
||||
|
||||
static TeamFortressViewport* gViewPort = NULL;
|
||||
|
||||
TeamFortressViewport::TeamFortressViewport(int x, int y, int wide, int tall) : Panel(x, y, wide, tall)
|
||||
{
|
||||
gViewPort = this;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void TeamFortressViewport::Initialize()
|
||||
{
|
||||
//vgui::App::getInstance()->setCursorOveride( vgui::App::getInstance()->getScheme()->getCursor(vgui::Scheme::scu_none) );
|
||||
}
|
||||
|
||||
void TeamFortressViewport::paintBackground()
|
||||
{
|
||||
// int wide, tall;
|
||||
// getParent()->getSize( wide, tall );
|
||||
// setSize( wide, tall );
|
||||
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
|
||||
}
|
||||
|
||||
void *TeamFortressViewport::operator new( size_t stAllocateBlock )
|
||||
{
|
||||
void *mem = ::operator new( stAllocateBlock );
|
||||
memset( mem, 0, stAllocateBlock );
|
||||
return mem;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
==========================
|
||||
HUD_VidInit
|
||||
|
@ -184,14 +237,25 @@ int DLLEXPORT HUD_VidInit( void )
|
|||
{
|
||||
gHUD.VidInit();
|
||||
|
||||
//
|
||||
// Fixup player speed.
|
||||
//
|
||||
cl_upspeed->value =
|
||||
cl_forwardspeed->value =
|
||||
cl_backspeed->value =
|
||||
cl_sidespeed->value = 200;
|
||||
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
|
||||
vgui::Panel* root=(vgui::Panel*)gEngfuncs.VGui_GetPanel();
|
||||
if (root) {
|
||||
gEngfuncs.Con_Printf( "Root VGUI panel exists\n" );
|
||||
root->setBgColor(128,128,0,0);
|
||||
|
||||
if (gViewPort != NULL)
|
||||
{
|
||||
gViewPort->Initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
gViewPort = new TeamFortressViewport(0,0,root->getWide(),root->getTall());
|
||||
gViewPort->setParent(root);
|
||||
}
|
||||
} else {
|
||||
gEngfuncs.Con_Printf( "Root VGUI panel does not exist\n" );
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -209,6 +273,8 @@ void DLLEXPORT HUD_Init( void )
|
|||
{
|
||||
InitInput();
|
||||
gHUD.Init();
|
||||
|
||||
gEngfuncs.pfnHookUserMsg( "Bhopcap", __MsgFunc_Bhopcap );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -269,7 +335,13 @@ Called by engine every frame that client .dll is loaded
|
|||
*/
|
||||
|
||||
void DLLEXPORT HUD_Frame( double time )
|
||||
{ gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
|
||||
{
|
||||
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
|
||||
if (!gViewPort)
|
||||
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
|
||||
#else
|
||||
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -304,3 +376,23 @@ void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs )
|
|||
return;
|
||||
gMobileEngfuncs = gpMobileEngfuncs;
|
||||
}
|
||||
|
||||
bool HUD_MessageBox( const char *msg )
|
||||
{
|
||||
gEngfuncs.Con_Printf( msg ); // just in case
|
||||
|
||||
if( IsXashFWGS() )
|
||||
{
|
||||
gMobileEngfuncs->pfnSys_Warn( msg );
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Load SDL2 and call ShowSimpleMessageBox
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsXashFWGS()
|
||||
{
|
||||
return gMobileEngfuncs != NULL;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\utils\vgui\include" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\utils\false_vgui\include" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /YX /FD /c
|
||||
# SUBTRACT CPP /Z<none>
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
|
@ -80,7 +80,7 @@ SOURCE="$(InputPath)"
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /G5 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\dlls" /I "..\common" /I "..\pm_shared" /I "..\engine" /I "..\utils\vgui\include" /I "..\game_shared" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /FR /YX /FD /c
|
||||
# ADD CPP /nologo /G5 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\dlls" /I "..\common" /I "..\pm_shared" /I "..\engine" /I "..\utils\false_vgui\include" /I "..\game_shared" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
|
@ -300,7 +300,15 @@ SOURCE=.\input.cpp
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\inputw32.cpp
|
||||
SOURCE=.\input_goldsource.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\input_mouse.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\input_xash3d.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
@ -513,6 +521,10 @@ SOURCE=.\in_defs.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\input_mouse.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\common\itrackeruser.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
// - Drawing the HUD graphics every frame
|
||||
// - Handling the custum HUD-update packets
|
||||
//
|
||||
#pragma once
|
||||
#ifndef CL_DLL_H
|
||||
#define CL_DLL_H
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef float vec_t;
|
||||
|
@ -41,6 +44,11 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
|
|||
#include "exportdef.h"
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||
#define XASH_64BIT
|
||||
#endif
|
||||
|
||||
extern cl_enginefunc_t gEngfuncs;
|
||||
#include "../engine/mobility_int.h"
|
||||
extern mobile_engfuncs_t *gMobileEngfuncs;
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
//
|
||||
// cl_util.h
|
||||
//
|
||||
|
||||
#ifndef CL_UTIL_H
|
||||
#define CL_UTIL_H
|
||||
#include "exportdef.h"
|
||||
#include "cvardef.h"
|
||||
|
||||
|
@ -94,7 +95,11 @@ inline void DrawSetTextColor( float r, float g, float b )
|
|||
inline int SPR_Height( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Height(x, f); }
|
||||
inline int SPR_Width( HSPRITE x, int f ) { return gEngfuncs.pfnSPR_Width(x, f); }
|
||||
|
||||
inline client_textmessage_t *TextMessageGet( const char *pName ) { return gEngfuncs.pfnTextMessageGet( pName ); }
|
||||
inline client_textmessage_t *TextMessageGet( const char *pName )
|
||||
{
|
||||
return gEngfuncs.pfnTextMessageGet( pName );
|
||||
}
|
||||
|
||||
inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
||||
{
|
||||
return gEngfuncs.pfnDrawCharacter( x, y, number, r, g, b );
|
||||
|
@ -115,6 +120,8 @@ inline void GetConsoleStringSize( const char *string, int *width, int *height )
|
|||
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
|
||||
}
|
||||
|
||||
int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b );
|
||||
|
||||
inline int ConsoleStringLen( const char *string )
|
||||
{
|
||||
int _width = 0, _height = 0;
|
||||
|
@ -138,7 +145,7 @@ inline void CenterPrint( const char *string )
|
|||
#define GetPlayerInfo ( *gEngfuncs.pfnGetPlayerInfo )
|
||||
|
||||
// sound functions
|
||||
inline void PlaySound( char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); }
|
||||
inline void PlaySound( const char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); }
|
||||
inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); }
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
@ -173,3 +180,7 @@ inline void UnpackRGB( int &r, int &g, int &b, unsigned long ulRGB )\
|
|||
}
|
||||
|
||||
HSPRITE LoadSprite( const char *pszName );
|
||||
|
||||
bool HUD_MessageBox( const char *msg );
|
||||
bool IsXashFWGS();
|
||||
#endif
|
||||
|
|
|
@ -41,12 +41,12 @@ COM_Log
|
|||
Log debug messages to file ( appends )
|
||||
====================
|
||||
*/
|
||||
void COM_Log( char *pszFile, char *fmt, ... )
|
||||
void COM_Log( const char *pszFile, const char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
FILE *fp;
|
||||
char *pfilename;
|
||||
const char *pfilename;
|
||||
|
||||
if( !pszFile )
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ HUD_PlaySound
|
|||
Play a sound, if we are seeing this command for the first time
|
||||
=====================
|
||||
*/
|
||||
void HUD_PlaySound( char *sound, float volume )
|
||||
void HUD_PlaySound( const char *sound, float volume )
|
||||
{
|
||||
if( !g_runfuncs || !g_finalstate )
|
||||
return;
|
||||
|
@ -268,12 +268,12 @@ stub functions for such things as precaching. So we don't have to modify weapon
|
|||
is compiled into both game and client .dlls.
|
||||
======================
|
||||
*/
|
||||
int stub_PrecacheModel( char* s )
|
||||
int stub_PrecacheModel( const char* s )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stub_PrecacheSound( char* s )
|
||||
int stub_PrecacheSound( const char* s )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ unsigned short stub_PrecacheEvent( int type, const char *s )
|
|||
return 0;
|
||||
}
|
||||
|
||||
const char *stub_NameForFunction( unsigned long function )
|
||||
const char *stub_NameForFunction( void *function )
|
||||
{
|
||||
return "func";
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -7,11 +7,9 @@
|
|||
|
||||
// com_weapons.h
|
||||
// Shared weapons common function prototypes
|
||||
#pragma once
|
||||
#if !defined( COM_WEAPONSH )
|
||||
#define COM_WEAPONSH
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "hud_iface.h"
|
||||
|
||||
|
@ -20,7 +18,7 @@ extern "C"
|
|||
void _DLLEXPORT HUD_PostRunCmd( struct local_state_s *from, struct local_state_s *to, struct usercmd_s *cmd, int runfuncs, double time, unsigned int random_seed );
|
||||
}
|
||||
|
||||
void COM_Log( char *pszFile, char *fmt, ... );
|
||||
void COM_Log( const char *pszFile, const char *fmt, ... );
|
||||
int CL_IsDead( void );
|
||||
|
||||
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high );
|
||||
|
@ -28,13 +26,13 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high );
|
|||
|
||||
int HUD_GetWeaponAnim( void );
|
||||
void HUD_SendWeaponAnim( int iAnim, int body, int force );
|
||||
void HUD_PlaySound( char *sound, float volume );
|
||||
void HUD_PlaySound( const char *sound, float volume );
|
||||
void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||
void HUD_SetMaxSpeed( const struct edict_s *ed, float speed );
|
||||
int stub_PrecacheModel( char* s );
|
||||
int stub_PrecacheSound( char* s );
|
||||
int stub_PrecacheModel( const char* s );
|
||||
int stub_PrecacheSound( const char* s );
|
||||
unsigned short stub_PrecacheEvent( int type, const char *s );
|
||||
const char *stub_NameForFunction( unsigned long function );
|
||||
const char *stub_NameForFunction( void *function );
|
||||
void stub_SetModel( struct edict_s *e, const char *m );
|
||||
|
||||
extern cvar_t *cl_lw;
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
@echo off
|
||||
echo Setting environment for minimal Visual C++ 6
|
||||
set INCLUDE=%MSVCDir%\VC98\Include
|
||||
set LIB=%MSVCDir%\VC98\Lib
|
||||
set PATH=%MSVCDir%\VC98\Bin;%MSVCDir%\Common\MSDev98\Bin\;%PATH%
|
||||
|
||||
echo -- Compiler is MSVC6
|
||||
|
||||
set XASH3DSRC=..\..\Xash3D_original
|
||||
set INCLUDES=-I../common -I../engine -I../pm_shared -I../game_shared -I../public -I../external -I../dlls -I../utils/false_vgui/include
|
||||
set SOURCES=../dlls/crossbow.cpp^
|
||||
../dlls/crowbar.cpp^
|
||||
../dlls/egon.cpp^
|
||||
../dlls/gauss.cpp^
|
||||
../dlls/handgrenade.cpp^
|
||||
../dlls/hornetgun.cpp^
|
||||
../dlls/mp5.cpp^
|
||||
../dlls/python.cpp^
|
||||
../dlls/rpg.cpp^
|
||||
../dlls/satchel.cpp^
|
||||
../dlls/shotgun.cpp^
|
||||
../dlls/squeakgrenade.cpp^
|
||||
../dlls/tripmine.cpp^
|
||||
../dlls/glock.cpp^
|
||||
ev_hldm.cpp^
|
||||
hl/hl_baseentity.cpp^
|
||||
hl/hl_events.cpp^
|
||||
hl/hl_objects.cpp^
|
||||
hl/hl_weapons.cpp^
|
||||
ammo.cpp^
|
||||
ammo_secondary.cpp^
|
||||
ammohistory.cpp^
|
||||
battery.cpp^
|
||||
cdll_int.cpp^
|
||||
com_weapons.cpp^
|
||||
death.cpp^
|
||||
demo.cpp^
|
||||
entity.cpp^
|
||||
ev_common.cpp^
|
||||
events.cpp^
|
||||
flashlight.cpp^
|
||||
GameStudioModelRenderer.cpp^
|
||||
geiger.cpp^
|
||||
health.cpp^
|
||||
hud.cpp^
|
||||
hud_msg.cpp^
|
||||
hud_redraw.cpp^
|
||||
hud_spectator.cpp^
|
||||
hud_update.cpp^
|
||||
in_camera.cpp^
|
||||
input.cpp^
|
||||
input_goldsource.cpp^
|
||||
input_mouse.cpp^
|
||||
input_xash3d.cpp^
|
||||
menu.cpp^
|
||||
message.cpp^
|
||||
overview.cpp^
|
||||
parsemsg.cpp^
|
||||
../pm_shared/pm_debug.c^
|
||||
../pm_shared/pm_math.c^
|
||||
../pm_shared/pm_shared.c^
|
||||
saytext.cpp^
|
||||
status_icons.cpp^
|
||||
statusbar.cpp^
|
||||
studio_util.cpp^
|
||||
StudioModelRenderer.cpp^
|
||||
text_message.cpp^
|
||||
train.cpp^
|
||||
tri.cpp^
|
||||
util.cpp^
|
||||
view.cpp^
|
||||
scoreboard.cpp^
|
||||
MOTD.cpp
|
||||
set DEFINES=/DCLIENT_DLL /DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR /DGOLDSOURCE_SUPPORT
|
||||
set LIBS=user32.lib Winmm.lib
|
||||
set OUTNAME=client.dll
|
||||
set DEBUG=/debug
|
||||
|
||||
cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% %DEBUG%
|
||||
|
||||
echo -- Compile done. Cleaning...
|
||||
|
||||
del *.obj *.exp *.lib *.ilk
|
||||
echo -- Done.
|
|
@ -187,7 +187,8 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
gHUD.m_Scoreboard.GetAllPlayersInfo();
|
||||
|
||||
// Get the Killer's name
|
||||
char *killer_name = g_PlayerInfoList[killer].name;
|
||||
const char *killer_name = "";
|
||||
killer_name = g_PlayerInfoList[killer].name;
|
||||
if( !killer_name )
|
||||
{
|
||||
killer_name = "";
|
||||
|
@ -201,11 +202,11 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
}
|
||||
|
||||
// Get the Victim's name
|
||||
char *victim_name = NULL;
|
||||
const char *victim_name = "";
|
||||
// If victim is -1, the killer killed a specific, non-player object (like a sentrygun)
|
||||
if ( ( (char)victim ) != -1 )
|
||||
if( ( (char)victim ) != -1 )
|
||||
victim_name = g_PlayerInfoList[victim].name;
|
||||
if ( !victim_name )
|
||||
if( !victim_name )
|
||||
{
|
||||
victim_name = "";
|
||||
rgDeathNoticeList[i].szVictim[0] = 0;
|
||||
|
@ -218,7 +219,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
}
|
||||
|
||||
// Is it a non-player object kill?
|
||||
if ( ( (char)victim ) == -1 )
|
||||
if( ( (char)victim ) == -1 )
|
||||
{
|
||||
rgDeathNoticeList[i].iNonPlayerKill = TRUE;
|
||||
|
||||
|
@ -227,10 +228,10 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( killer == victim || killer == 0 )
|
||||
if( killer == victim || killer == 0 )
|
||||
rgDeathNoticeList[i].iSuicide = TRUE;
|
||||
|
||||
if ( !strcmp( killedwith, "d_teammate" ) )
|
||||
if( !strcmp( killedwith, "d_teammate" ) )
|
||||
rgDeathNoticeList[i].iTeamKill = TRUE;
|
||||
}
|
||||
|
||||
|
@ -285,7 +286,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu
|
|||
// replace the code names with the 'real' names
|
||||
if( !strcmp( killedwith + 2, "egon" ) )
|
||||
strcpy( killedwith, "d_gluon gun" );
|
||||
if ( !strcmp( killedwith + 2, "gauss" ) )
|
||||
if( !strcmp( killedwith + 2, "gauss" ) )
|
||||
strcpy( killedwith, "d_tau cannon" );
|
||||
|
||||
ConsolePrint( killedwith + 2 ); // skip over the "d_" part
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined( DEMOH )
|
||||
#define DEMOH
|
||||
#pragma once
|
||||
|
||||
// Types of demo messages we can write/parse
|
||||
enum
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -22,6 +22,7 @@
|
|||
|
||||
void Game_AddObjects( void );
|
||||
|
||||
bool bDrawScope;
|
||||
extern vec3_t v_origin;
|
||||
|
||||
int g_iAlive = 1;
|
||||
|
@ -95,6 +96,7 @@ void DLLEXPORT HUD_TxferLocalOverrides( struct entity_state_s *state, const stru
|
|||
|
||||
// Fire prevention
|
||||
state->iuser4 = client->iuser4;
|
||||
bDrawScope = client->iuser4;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -213,6 +215,7 @@ void DLLEXPORT HUD_TxferPredictionData( struct entity_state_s *ps, const struct
|
|||
|
||||
// Fire prevention
|
||||
pcd->iuser4 = ppcd->iuser4;
|
||||
bDrawScope = ppcd->iuser4;
|
||||
|
||||
pcd->fuser2 = ppcd->fuser2;
|
||||
pcd->fuser3 = ppcd->fuser3;
|
||||
|
@ -585,10 +588,10 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
static int gTempEntFrame = 0;
|
||||
int i;
|
||||
TEMPENTITY *pTemp, *pnext, *pprev;
|
||||
float freq, gravity, gravitySlow, life, fastFreq;
|
||||
float /*freq,*/ gravity, gravitySlow, life, fastFreq;
|
||||
|
||||
// Nothing to simulate
|
||||
if ( !*ppTempEntActive )
|
||||
if( !*ppTempEntActive )
|
||||
return;
|
||||
|
||||
// in order to have tents collide with players, we have to run the player prediction code so
|
||||
|
@ -623,7 +626,7 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
}
|
||||
|
||||
pprev = NULL;
|
||||
freq = client_time * 0.01;
|
||||
//freq = client_time * 0.01;
|
||||
fastFreq = client_time * 5.5;
|
||||
gravity = -frametime * cl_gravity;
|
||||
gravitySlow = gravity * 0.5;
|
||||
|
@ -709,12 +712,12 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
}
|
||||
else if( pTemp->flags & FTENT_SPIRAL )
|
||||
{
|
||||
float s, c;
|
||||
/*float s, c;
|
||||
s = sin( pTemp->entity.baseline.origin[2] + fastFreq );
|
||||
c = cos( pTemp->entity.baseline.origin[2] + fastFreq );
|
||||
c = cos( pTemp->entity.baseline.origin[2] + fastFreq );*/
|
||||
|
||||
pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (int)(size_t)pTemp );
|
||||
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (int)(size_t)pTemp );
|
||||
pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (size_t)pTemp );
|
||||
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (size_t)pTemp );
|
||||
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
|
||||
}
|
||||
else
|
||||
|
|
1466
cl_dll/ev_hldm.cpp
1466
cl_dll/ev_hldm.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,11 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined ( EV_HLDMH )
|
||||
#define EV_HLDMH
|
||||
|
||||
|
@ -17,9 +18,6 @@ typedef enum
|
|||
BULLET_PLAYER_357, // python
|
||||
BULLET_PLAYER_BUCKSHOT, // shotgun
|
||||
BULLET_PLAYER_CROWBAR, // crowbar swipe
|
||||
BULLET_PLAYER_NAIL, // nails
|
||||
BULLET_PLAYER_XS, // xen squasher
|
||||
BULLET_PLAYER_PAR21, // par21
|
||||
BULLET_MONSTER_9MM,
|
||||
BULLET_MONSTER_MP5,
|
||||
BULLET_MONSTER_12MM
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -6,6 +6,7 @@
|
|||
//=============================================================================
|
||||
|
||||
// eventscripts.h
|
||||
#pragma once
|
||||
#if !defined ( EVENTSCRIPTSH )
|
||||
#define EVENTSCRIPTSH
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ void CHudFlashlight::Reset( void )
|
|||
{
|
||||
m_fFade = 0;
|
||||
m_fOn = 0;
|
||||
m_iBat = 100;
|
||||
m_flBat = 1.0;
|
||||
}
|
||||
|
||||
int CHudFlashlight::VidInit( void )
|
||||
|
@ -91,5 +93,6 @@ int CHudFlashlight::MsgFunc_Flashlight( const char *pszName, int iSize, void *p
|
|||
|
||||
int CHudFlashlight::Draw( float flTime )
|
||||
{
|
||||
gMobileEngfuncs->pfnTouchHideButtons( "flashlight", 1 );
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ int CHudGeiger::Draw( float flTime )
|
|||
{
|
||||
int pct;
|
||||
float flvol = 0.0f;
|
||||
int rg[3];
|
||||
//int rg[3];
|
||||
int i;
|
||||
|
||||
if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 )
|
||||
|
@ -79,61 +79,61 @@ int CHudGeiger::Draw( float flTime )
|
|||
{
|
||||
pct = 2;
|
||||
flvol = 0.4; //Con_Printf( "range > 600\n" );
|
||||
rg[0] = 1;
|
||||
rg[1] = 1;
|
||||
//rg[0] = 1;
|
||||
//rg[1] = 1;
|
||||
i = 2;
|
||||
}
|
||||
else if( m_iGeigerRange > 500 )
|
||||
{
|
||||
pct = 4;
|
||||
flvol = 0.5; //Con_Printf( "range > 500\n" );
|
||||
rg[0] = 1;
|
||||
rg[1] = 2;
|
||||
//rg[0] = 1;
|
||||
//rg[1] = 2;
|
||||
i = 2;
|
||||
}
|
||||
else if( m_iGeigerRange > 400 )
|
||||
{
|
||||
pct = 8;
|
||||
flvol = 0.6; //Con_Printf( "range > 400\n" );
|
||||
rg[0] = 1;
|
||||
rg[1] = 2;
|
||||
rg[2] = 3;
|
||||
//rg[0] = 1;
|
||||
//rg[1] = 2;
|
||||
//rg[2] = 3;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 300 )
|
||||
{
|
||||
pct = 8;
|
||||
flvol = 0.7; //Con_Printf( "range > 300\n" );
|
||||
rg[0] = 2;
|
||||
rg[1] = 3;
|
||||
rg[2] = 4;
|
||||
//rg[0] = 2;
|
||||
//rg[1] = 3;
|
||||
//rg[2] = 4;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 200 )
|
||||
{
|
||||
pct = 28;
|
||||
flvol = 0.78; //Con_Printf( "range > 200\n" );
|
||||
rg[0] = 2;
|
||||
rg[1] = 3;
|
||||
rg[2] = 4;
|
||||
//rg[0] = 2;
|
||||
//rg[1] = 3;
|
||||
//rg[2] = 4;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 150 )
|
||||
{
|
||||
pct = 40;
|
||||
flvol = 0.80; //Con_Printf( "range > 150\n" );
|
||||
rg[0] = 3;
|
||||
rg[1] = 4;
|
||||
rg[2] = 5;
|
||||
//rg[0] = 3;
|
||||
//rg[1] = 4;
|
||||
//rg[2] = 5;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 100 )
|
||||
{
|
||||
pct = 60;
|
||||
flvol = 0.85; //Con_Printf( "range > 100\n" );
|
||||
rg[0] = 3;
|
||||
rg[1] = 4;
|
||||
rg[2] = 5;
|
||||
//rg[0] = 3;
|
||||
//rg[1] = 4;
|
||||
//rg[2] = 5;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 75 )
|
||||
|
@ -141,29 +141,29 @@ int CHudGeiger::Draw( float flTime )
|
|||
pct = 80;
|
||||
flvol = 0.9; //Con_Printf( "range > 75\n" );
|
||||
//gflGeigerDelay = cl.time + GEIGERDELAY * 0.75;
|
||||
rg[0] = 4;
|
||||
rg[1] = 5;
|
||||
rg[2] = 6;
|
||||
//rg[0] = 4;
|
||||
//rg[1] = 5;
|
||||
//rg[2] = 6;
|
||||
i = 3;
|
||||
}
|
||||
else if( m_iGeigerRange > 50 )
|
||||
{
|
||||
pct = 90;
|
||||
flvol = 0.95; //Con_Printf( "range > 50\n" );
|
||||
rg[0] = 5;
|
||||
rg[1] = 6;
|
||||
//rg[0] = 5;
|
||||
//rg[1] = 6;
|
||||
i = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pct = 95;
|
||||
flvol = 1.0; //Con_Printf( "range < 50\n" );
|
||||
rg[0] = 5;
|
||||
rg[1] = 6;
|
||||
//rg[0] = 5;
|
||||
//rg[1] = 6;
|
||||
i = 2;
|
||||
}
|
||||
|
||||
flvol = ( flvol * ( (rand() & 127) ) / 255) + 0.25; // UTIL_RandomFloat(0.25, 0.5);
|
||||
flvol = ( flvol * ( ( rand() & 127 ) ) / 255 ) + 0.25; // UTIL_RandomFloat( 0.25, 0.5 );
|
||||
|
||||
if( ( rand() & 127 ) < pct || ( rand() & 127 ) < pct )
|
||||
{
|
||||
|
|
|
@ -156,25 +156,33 @@ int CHudHealth::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
|
|||
// Green <-> Yellow <-> Red ramp
|
||||
void CHudHealth::GetPainColor( int &r, int &g, int &b )
|
||||
{
|
||||
#if 0
|
||||
int iHealth = m_iHealth;
|
||||
|
||||
if( iHealth > 25 )
|
||||
iHealth -= 25;
|
||||
else if( iHealth < 0 )
|
||||
iHealth = 0;
|
||||
#if 0
|
||||
|
||||
g = iHealth * 255 / 100;
|
||||
r = 255 - g;
|
||||
b = 0;
|
||||
#else
|
||||
if( m_iHealth > 25 )
|
||||
if( m_iHealth <= 0 )
|
||||
{
|
||||
UnpackRGB( r, g, b, RGB_REDISH );
|
||||
}
|
||||
else if( m_iHealth > 15 )
|
||||
{
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
}
|
||||
else
|
||||
{
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
g = b = 255 * fabs( sin( gEngfuncs.GetClientTime() * M_PI * 2.0f ) );
|
||||
float f = ( sin( ( 16 - gHUD.m_flTime ) * m_iHealth ) + 1.0 ) * 0.5;
|
||||
r = (int)( r * f * 58.0f );
|
||||
g = (int)( g * f );
|
||||
b = (int)( b * f );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -197,44 +205,37 @@ int CHudHealth::Draw( float flTime )
|
|||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
if( m_fFade <= 0 )
|
||||
{
|
||||
a = MIN_ALPHA;
|
||||
m_fFade = 0;
|
||||
}
|
||||
|
||||
// Fade the health number back to dim
|
||||
a = min( gHUD.m_flAlpha, MIN_ALPHA ) + ( m_fFade / FADE_TIME ) * 128;
|
||||
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
|
||||
}
|
||||
else
|
||||
a = min( gHUD.m_flAlpha, MIN_ALPHA );
|
||||
a = MIN_ALPHA;
|
||||
|
||||
// If health is getting low, make it bright red
|
||||
if( m_iHealth <= 15 )
|
||||
a = 255;
|
||||
a = 192;
|
||||
|
||||
GetPainColor( r, g, b );
|
||||
ScaleColors( r, g, b, a );
|
||||
|
||||
// Only draw health if we have the suit.
|
||||
if( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) )
|
||||
{
|
||||
HealthWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
|
||||
|
||||
wrect_t cross = gHUD.GetSpriteRect( m_HUD_cross );
|
||||
|
||||
int CrossWidth = cross.right - cross.left;
|
||||
int CrossHeight = cross.bottom - cross.top;
|
||||
|
||||
y = ScreenHeight - gHUD.m_iFontHeight / 2 - CrossHeight;
|
||||
x = CrossWidth;
|
||||
x = 10;
|
||||
y = ScreenHeight - CrossHeight - 10;
|
||||
|
||||
SPR_Set( gHUD.GetSprite( m_HUD_cross ), r, g, b );
|
||||
SPR_DrawAdditive( 0, x, y, &cross );
|
||||
SPR_DrawAdditive( 0, 10, y, &cross );
|
||||
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
|
||||
x = CrossWidth * 2.0f + HealthWidth;
|
||||
x = CrossWidth + 20;
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - 10;
|
||||
|
||||
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b );
|
||||
}
|
||||
gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b );
|
||||
|
||||
DrawDamage( flTime );
|
||||
return DrawPain( flTime );
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#pragma once
|
||||
#ifndef HEALTH_H
|
||||
#define HEALTH_H
|
||||
|
||||
#define DMG_IMAGE_LIFE 2 // seconds that image is up
|
||||
|
||||
|
@ -122,3 +125,4 @@ private:
|
|||
void CalcDamageDirection( vec3_t vecFrom );
|
||||
void UpdateTiles( float fTime, long bits );
|
||||
};
|
||||
#endif // HEALTH_H
|
||||
|
|
|
@ -54,7 +54,8 @@ int CBaseEntity::IsDormant( void ) { return 0; }
|
|||
BOOL CBaseEntity::IsInWorld( void ) { return TRUE; }
|
||||
int CBaseEntity::ShouldToggle( USE_TYPE useType, BOOL currentState ) { return 0; }
|
||||
int CBaseEntity::DamageDecal( int bitsDamageType ) { return -1; }
|
||||
CBaseEntity *CBaseEntity::Create( char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; }
|
||||
CBaseEntity *CBaseEntity::Create( const char *szName, const Vector &vecOrigin, const Vector &vecAngles, edict_t *pentOwner ) { return NULL; }
|
||||
void CBaseEntity::UpdateOnRemove( void ) { }
|
||||
void CBaseEntity::SUB_Remove( void ) { }
|
||||
|
||||
// CBaseDelay Stubs
|
||||
|
@ -146,7 +147,7 @@ int CBaseMonster::CheckEnemy( CBaseEntity *pEnemy ) { return 0; }
|
|||
void CBaseMonster::PushEnemy( CBaseEntity *pEnemy, Vector &vecLastKnownPos ) { }
|
||||
BOOL CBaseMonster::PopEnemy() { return FALSE; }
|
||||
void CBaseMonster::SetActivity( Activity NewActivity ) { }
|
||||
void CBaseMonster::SetSequenceByName( char *szSequence ) { }
|
||||
void CBaseMonster::SetSequenceByName( const char *szSequence ) { }
|
||||
int CBaseMonster::CheckLocalMove( const Vector &vecStart, const Vector &vecEnd, CBaseEntity *pTarget, float *pflDist ) { return 0; }
|
||||
float CBaseMonster::OpenDoorAndWait( entvars_t *pevDoor ) { return 0.0; }
|
||||
void CBaseMonster::AdvanceRoute( float distance ) { }
|
||||
|
@ -214,7 +215,7 @@ void CBaseMonster::MonsterInitDead( void ) { }
|
|||
BOOL CBaseMonster::BBoxFlat( void ) { return TRUE; }
|
||||
BOOL CBaseMonster::GetEnemy( void ) { return FALSE; }
|
||||
void CBaseMonster::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
|
||||
CBaseEntity* CBaseMonster::DropItem( char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; }
|
||||
CBaseEntity* CBaseMonster::DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng ) { return NULL; }
|
||||
BOOL CBaseMonster::ShouldFadeOnDeath( void ) { return FALSE; }
|
||||
void CBaseMonster::RadiusDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
|
||||
void CBaseMonster::RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType ) { }
|
||||
|
@ -258,8 +259,8 @@ void CBasePlayer::PreThink(void) { }
|
|||
void CBasePlayer::CheckTimeBasedDamage() { }
|
||||
void CBasePlayer::UpdateGeigerCounter( void ) { }
|
||||
void CBasePlayer::CheckSuitUpdate() { }
|
||||
void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) { }
|
||||
void CBasePlayer::UpdatePlayerSound ( void ) { }
|
||||
void CBasePlayer::SetSuitUpdate( const char *name, int fgroup, int iNoRepeatTime ) { }
|
||||
void CBasePlayer::UpdatePlayerSound( void ) { }
|
||||
void CBasePlayer::PostThink() { }
|
||||
void CBasePlayer::Precache( void ) { }
|
||||
int CBasePlayer::Save( CSave &save ) { return 0; }
|
||||
|
@ -276,7 +277,7 @@ void CBasePlayer::ForceClientDllUpdate( void ) { }
|
|||
void CBasePlayer::ImpulseCommands() { }
|
||||
void CBasePlayer::CheatImpulseCommands( int iImpulse ) { }
|
||||
int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem, bool bCallHoster ) { return FALSE; }
|
||||
void CBasePlayer::ItemPreFrame() { }
|
||||
void CBasePlayer::ItemPostFrame() { }
|
||||
int CBasePlayer::AmmoInventory( int iAmmoIndex ) { return -1; }
|
||||
|
@ -298,13 +299,9 @@ BOOL CBasePlayer::HasPlayerItem( CBasePlayerItem *pCheckItem ) { return FALSE; }
|
|||
BOOL CBasePlayer::SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; }
|
||||
Vector CBasePlayer::GetGunPosition( void ) { return g_vecZero; }
|
||||
const char *CBasePlayer::TeamID( void ) { return ""; }
|
||||
int CBasePlayer::GiveAmmo( int iCount, char *szName, int iMax ) { return 0; }
|
||||
int CBasePlayer::GiveAmmo( int iCount, const char *szName, int iMax ) { return 0; }
|
||||
void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) { }
|
||||
void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) { }
|
||||
void CBasePlayer::IncrementExertLevel( int amount ) { }
|
||||
void CBasePlayer::DecrementExertLevel( int amount ) { }
|
||||
void CBasePlayer::ShowPlayerHUD( BOOL bInstant ) {}
|
||||
void CBasePlayer::HidePlayerHUD( BOOL bInstant ) {}
|
||||
|
||||
void ClearMultiDamage( void ) { }
|
||||
void ApplyMultiDamage( entvars_t *pevInflictor, entvars_t *pevAttacker ) { }
|
||||
|
|
|
@ -20,34 +20,13 @@
|
|||
extern "C"
|
||||
{
|
||||
// HLDM
|
||||
void EV_FireGlock1( struct event_args_s *args );
|
||||
void EV_FireGlock2( struct event_args_s *args );
|
||||
//void EV_FireGlock1( struct event_args_s *args );
|
||||
//void EV_FireGlock2( struct event_args_s *args );
|
||||
void EV_FireShotGunSingle( struct event_args_s *args );
|
||||
void EV_FireShotGunDouble( struct event_args_s *args );
|
||||
void EV_FireMP5( struct event_args_s *args );
|
||||
void EV_FireMP52( struct event_args_s *args );
|
||||
void EV_FirePython( struct event_args_s *args );
|
||||
void EV_FireGauss( struct event_args_s *args );
|
||||
void EV_SpinGauss( struct event_args_s *args );
|
||||
void EV_Crowbar( struct event_args_s *args );
|
||||
void EV_FireCrossbow( struct event_args_s *args );
|
||||
void EV_FireCrossbow2( struct event_args_s *args );
|
||||
void EV_FireRpg( struct event_args_s *args );
|
||||
void EV_EgonFire( struct event_args_s *args );
|
||||
void EV_EgonStop( struct event_args_s *args );
|
||||
void EV_HornetGunFire( struct event_args_s *args );
|
||||
void EV_TripmineFire( struct event_args_s *args );
|
||||
void EV_SnarkFire( struct event_args_s *args );
|
||||
|
||||
void EV_TrainPitchAdjust( struct event_args_s *args );
|
||||
|
||||
void EV_HeaterPipe( struct event_args_s *args );
|
||||
void EV_FireBradnailer( struct event_args_s *args );
|
||||
void EV_FireNailgun( struct event_args_s *args );
|
||||
void EV_FireCmlwbr( struct event_args_s *args );
|
||||
void EV_SpinXS( struct event_args_s *args );
|
||||
void EV_FireXS( struct event_args_s *args );
|
||||
void EV_Reload( struct event_args_s *args );
|
||||
void EV_FirePar21( struct event_args_s *args );
|
||||
void EV_M203( struct event_args_s *args );
|
||||
}
|
||||
|
@ -67,33 +46,11 @@ That was what we were going to do, but we ran out of time...oh well.
|
|||
*/
|
||||
void Game_HookEvents( void )
|
||||
{
|
||||
gEngfuncs.pfnHookEvent( "events/glock1.sc", EV_FireGlock1 );
|
||||
gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 );
|
||||
// gEngfuncs.pfnHookEvent( "events/glock1.sc", EV_FireGlock1 );
|
||||
// gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 );
|
||||
gEngfuncs.pfnHookEvent( "events/shotgun1.sc", EV_FireShotGunSingle );
|
||||
gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble );
|
||||
gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 );
|
||||
gEngfuncs.pfnHookEvent( "events/mp52.sc", EV_FireMP52 );
|
||||
gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython );
|
||||
gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss );
|
||||
gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss );
|
||||
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust );
|
||||
gEngfuncs.pfnHookEvent( "events/crowbar.sc", EV_Crowbar );
|
||||
gEngfuncs.pfnHookEvent( "events/crossbow1.sc", EV_FireCrossbow );
|
||||
gEngfuncs.pfnHookEvent( "events/crossbow2.sc", EV_FireCrossbow2 );
|
||||
gEngfuncs.pfnHookEvent( "events/rpg.sc", EV_FireRpg );
|
||||
gEngfuncs.pfnHookEvent( "events/egon_fire.sc", EV_EgonFire );
|
||||
gEngfuncs.pfnHookEvent( "events/egon_stop.sc", EV_EgonStop );
|
||||
gEngfuncs.pfnHookEvent( "events/firehornet.sc", EV_HornetGunFire );
|
||||
gEngfuncs.pfnHookEvent( "events/tripfire.sc", EV_TripmineFire );
|
||||
gEngfuncs.pfnHookEvent( "events/snarkfire.sc", EV_SnarkFire );
|
||||
|
||||
gEngfuncs.pfnHookEvent( "events/heaterpipe.sc", EV_HeaterPipe );
|
||||
gEngfuncs.pfnHookEvent( "events/bradnailer.sc", EV_FireBradnailer );
|
||||
gEngfuncs.pfnHookEvent( "events/nailgun.sc", EV_FireNailgun );
|
||||
gEngfuncs.pfnHookEvent( "events/cmlwbr.sc", EV_FireCmlwbr );
|
||||
gEngfuncs.pfnHookEvent( "events/xsspin.sc", EV_SpinXS );
|
||||
gEngfuncs.pfnHookEvent( "events/xs.sc", EV_FireXS );
|
||||
gEngfuncs.pfnHookEvent( "events/reload.sc", EV_Reload );
|
||||
gEngfuncs.pfnHookEvent( "events/par21.sc", EV_FirePar21 );
|
||||
gEngfuncs.pfnHookEvent( "events/m203.sc", EV_M203 );
|
||||
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust );
|
||||
}
|
||||
|
|
|
@ -27,54 +27,10 @@
|
|||
#include "entity_types.h"
|
||||
#include "r_efx.h"
|
||||
|
||||
extern BEAM *pBeam;
|
||||
extern BEAM *pBeam2;
|
||||
void HUD_GetLastOrg( float *org );
|
||||
|
||||
void UpdateBeams( void )
|
||||
{
|
||||
vec3_t forward, vecSrc, vecEnd, origin, angles, right, up;
|
||||
vec3_t view_ofs;
|
||||
pmtrace_t tr;
|
||||
cl_entity_t *pthisplayer = gEngfuncs.GetLocalPlayer();
|
||||
int idx = pthisplayer->index;
|
||||
|
||||
// Get our exact viewangles from engine
|
||||
gEngfuncs.GetViewAngles( (float *)angles );
|
||||
|
||||
// Determine our last predicted origin
|
||||
HUD_GetLastOrg( (float *)&origin );
|
||||
|
||||
AngleVectors( angles, forward, right, up );
|
||||
|
||||
VectorCopy( origin, vecSrc );
|
||||
|
||||
VectorMA( vecSrc, 2048, forward, vecEnd );
|
||||
|
||||
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );
|
||||
|
||||
// Store off the old count
|
||||
gEngfuncs.pEventAPI->EV_PushPMStates();
|
||||
|
||||
// Now add in all of the players.
|
||||
gEngfuncs.pEventAPI->EV_SetSolidPlayers( idx - 1 );
|
||||
|
||||
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
|
||||
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PopPMStates();
|
||||
|
||||
if( pBeam )
|
||||
{
|
||||
pBeam->target = tr.endpos;
|
||||
pBeam->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
|
||||
}
|
||||
|
||||
if( pBeam2 )
|
||||
{
|
||||
pBeam2->target = tr.endpos;
|
||||
pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -86,6 +42,4 @@ Add game specific, client-side objects here
|
|||
*/
|
||||
void Game_AddObjects( void )
|
||||
{
|
||||
if( pBeam && pBeam2 )
|
||||
UpdateBeams();
|
||||
}
|
||||
|
|
|
@ -53,11 +53,6 @@ int g_irunninggausspred = 0;
|
|||
vec3_t previousorigin;
|
||||
|
||||
// HLDM Weapon placeholder entities.
|
||||
CHeaterPipe g_HeaterPipe;
|
||||
CCmlwbr g_Cmlwbr;
|
||||
CShotgun g_Shotgun;
|
||||
CPipeBomb g_PipeBomb;
|
||||
CPar21 g_Par21;
|
||||
/*
|
||||
======================
|
||||
AlertMessage
|
||||
|
@ -65,7 +60,7 @@ AlertMessage
|
|||
Print debug messages to console
|
||||
======================
|
||||
*/
|
||||
void AlertMessage( ALERT_TYPE atype, char *szFmt, ... )
|
||||
void AlertMessage( ALERT_TYPE atype, const char *szFmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
@ -86,7 +81,7 @@ bool bIsMultiplayer( void )
|
|||
}
|
||||
|
||||
//Just loads a v_ model.
|
||||
void LoadVModel( char *szViewModel, CBasePlayer *m_pPlayer )
|
||||
void LoadVModel( const char *szViewModel, CBasePlayer *m_pPlayer )
|
||||
{
|
||||
gEngfuncs.CL_LoadModel( szViewModel, &m_pPlayer->pev->viewmodel );
|
||||
}
|
||||
|
@ -141,7 +136,7 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i
|
|||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
return FALSE;
|
||||
|
||||
int j = min( iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
|
||||
int j = Q_min( iClipSize - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
|
||||
|
||||
if( j == 0 )
|
||||
return FALSE;
|
||||
|
@ -198,7 +193,7 @@ CBasePlayerWeapon::DefaultDeploy
|
|||
|
||||
=====================
|
||||
*/
|
||||
BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, int iAnim, char *szAnimExt, int skiplocal, int body )
|
||||
BOOL CBasePlayerWeapon::DefaultDeploy( const char *szViewModel, const char *szWeaponModel, int iAnim, const char *szAnimExt, int skiplocal, int body )
|
||||
{
|
||||
if( !CanDeploy() )
|
||||
return FALSE;
|
||||
|
@ -278,7 +273,7 @@ Only produces random numbers to match the server ones.
|
|||
*/
|
||||
Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker, int shared_rand )
|
||||
{
|
||||
float x = 0, y = 0, z;
|
||||
float x = 0.0f, y = 0.0f, z;
|
||||
|
||||
for( ULONG iShot = 1; iShot <= cShots; iShot++ )
|
||||
{
|
||||
|
@ -550,27 +545,6 @@ void UTIL_ParticleLine( CBasePlayer *player, float *start, float *end, float lif
|
|||
gEngfuncs.pEfxAPI->R_ParticleLine( start, end, r, g, b, life );
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CBasePlayerWeapon::PrintState
|
||||
|
||||
For debugging, print out state variables to log file
|
||||
=====================
|
||||
*/
|
||||
void CBasePlayerWeapon::PrintState( void )
|
||||
{
|
||||
COM_Log( "c:\\hl.log", "%.4f ", gpGlobals->time );
|
||||
COM_Log( "c:\\hl.log", "%.4f ", m_pPlayer->m_flNextAttack );
|
||||
COM_Log( "c:\\hl.log", "%.4f ", m_flNextPrimaryAttack );
|
||||
COM_Log( "c:\\hl.log", "%.4f ", m_flTimeWeaponIdle - gpGlobals->time );
|
||||
COM_Log( "c:\\hl.log", "%i ", m_iClip );
|
||||
}
|
||||
|
||||
int RandomLong( int a, int b )
|
||||
{
|
||||
return gEngfuncs.pfnRandomLong( a, b );
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
HUD_InitClientWeapons
|
||||
|
@ -611,13 +585,6 @@ void HUD_InitClientWeapons( void )
|
|||
|
||||
// Allocate a slot for the local player
|
||||
HUD_PrepEntity( &player, NULL );
|
||||
|
||||
// Allocate slot(s) for each weapon that we are going to be predicting
|
||||
HUD_PrepEntity( &g_HeaterPipe, &player );
|
||||
HUD_PrepEntity( &g_Shotgun, &player );
|
||||
HUD_PrepEntity( &g_Cmlwbr, &player );
|
||||
HUD_PrepEntity( &g_PipeBomb, &player );
|
||||
HUD_PrepEntity( &g_Par21, &player );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -679,24 +646,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
|
||||
// Fill in data based on selected weapon
|
||||
// FIXME, make this a method in each weapon? where you pass in an entity_state_t *?
|
||||
switch( from->client.m_iId )
|
||||
{
|
||||
case WEAPON_HEATERPIPE:
|
||||
pWeapon = &g_HeaterPipe;
|
||||
break;
|
||||
case WEAPON_SHOTGUN:
|
||||
pWeapon = &g_Shotgun;
|
||||
break;
|
||||
case WEAPON_CMLWBR:
|
||||
pWeapon = &g_Cmlwbr;
|
||||
break;
|
||||
case WEAPON_PIPEBOMB:
|
||||
pWeapon = &g_PipeBomb;
|
||||
break;
|
||||
case WEAPON_PAR21:
|
||||
pWeapon = &g_Par21;
|
||||
break;
|
||||
}
|
||||
|
||||
// Store pointer to our destination entity_state_t so we can get our origin, etc. from it
|
||||
// for setting up events on the client
|
||||
|
@ -741,11 +690,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
pCurrent->m_flNextSecondaryAttack = pfrom->m_flNextSecondaryAttack;
|
||||
pCurrent->m_flTimeWeaponIdle = pfrom->m_flTimeWeaponIdle;
|
||||
pCurrent->pev->fuser1 = pfrom->fuser1;
|
||||
pCurrent->m_flStartThrow = pfrom->fuser2;
|
||||
pCurrent->m_flReleaseThrow = pfrom->fuser3;
|
||||
pCurrent->m_chargeReady = pfrom->iuser1;
|
||||
pCurrent->m_fInAttack = pfrom->iuser2;
|
||||
pCurrent->m_fireState = pfrom->iuser3;
|
||||
|
||||
pCurrent->m_iSecondaryAmmoType = (int)from->client.vuser3[2];
|
||||
pCurrent->m_iPrimaryAmmoType = (int)from->client.vuser4[0];
|
||||
|
@ -784,36 +728,12 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
player.m_flNextAmmoBurn = from->client.fuser2;
|
||||
player.m_flAmmoStartCharge = from->client.fuser3;
|
||||
|
||||
//Stores all our ammo info, so the client side weapons can use them.
|
||||
player.ammo_9mm = (int)from->client.vuser1[0];
|
||||
player.ammo_357 = (int)from->client.vuser1[1];
|
||||
player.ammo_argrens = (int)from->client.vuser1[2];
|
||||
player.ammo_bolts = (int)from->client.ammo_nails; //is an int anyways...
|
||||
player.ammo_buckshot = (int)from->client.ammo_shells;
|
||||
player.ammo_uranium = (int)from->client.ammo_cells;
|
||||
player.ammo_hornets = (int)from->client.vuser2[0];
|
||||
player.ammo_rockets = (int)from->client.ammo_rockets;
|
||||
|
||||
// Point to current weapon object
|
||||
if( from->client.m_iId )
|
||||
{
|
||||
player.m_pActiveItem = g_pWpns[from->client.m_iId];
|
||||
}
|
||||
|
||||
if( player.m_pActiveItem->m_iId == WEAPON_BRADNAILER || player.m_pActiveItem->m_iId == WEAPON_NAILGUN )
|
||||
{
|
||||
player.ammo_nails = (int)from->client.vuser2[1];
|
||||
}
|
||||
else if( player.m_pActiveItem->m_iId == WEAPON_XS )
|
||||
{
|
||||
player.ammo_xencandy = (int)from->client.vuser2[1];
|
||||
}
|
||||
else if( player.m_pActiveItem->m_iId == WEAPON_PAR21 )
|
||||
{
|
||||
player.ammo_par21 = (int)from->client.vuser2[1];
|
||||
player.ammo_m203grens = (int)from->client.vuser2[2];
|
||||
}
|
||||
|
||||
// Don't go firing anything if we have died.
|
||||
// Or if we don't have a weapon model deployed
|
||||
if( ( player.pev->deadflag != ( DEAD_DISCARDBODY + 1 ) ) &&
|
||||
|
@ -865,31 +785,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
to->client.fuser3 = player.m_flAmmoStartCharge;
|
||||
to->client.maxspeed = player.pev->maxspeed;
|
||||
|
||||
//HL Weapons
|
||||
to->client.vuser1[0] = player.ammo_9mm;
|
||||
to->client.vuser1[1] = player.ammo_357;
|
||||
to->client.vuser1[2] = player.ammo_argrens;
|
||||
|
||||
to->client.ammo_nails = player.ammo_bolts;
|
||||
to->client.ammo_shells = player.ammo_buckshot;
|
||||
to->client.ammo_cells = player.ammo_uranium;
|
||||
to->client.vuser2[0] = player.ammo_hornets;
|
||||
to->client.ammo_rockets = player.ammo_rockets;
|
||||
|
||||
if( player.m_pActiveItem->m_iId == WEAPON_BRADNAILER || player.m_pActiveItem->m_iId == WEAPON_NAILGUN )
|
||||
{
|
||||
from->client.vuser2[1] = player.ammo_nails;
|
||||
}
|
||||
else if( player.m_pActiveItem->m_iId == WEAPON_XS )
|
||||
{
|
||||
from->client.vuser2[1] = player.ammo_xencandy;
|
||||
}
|
||||
else if( player.m_pActiveItem->m_iId == WEAPON_PAR21 )
|
||||
{
|
||||
from->client.vuser2[1] = player.ammo_par21;
|
||||
from->client.vuser2[2] = player.ammo_m203grens;
|
||||
}
|
||||
|
||||
// Make sure that weapon animation matches what the game .dll is telling us
|
||||
// over the wire ( fixes some animation glitches )
|
||||
if( g_runfuncs && ( HUD_GetWeaponAnim() != to->client.weaponanim ) )
|
||||
|
@ -920,11 +815,6 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
pto->m_flNextSecondaryAttack = pCurrent->m_flNextSecondaryAttack;
|
||||
pto->m_flTimeWeaponIdle = pCurrent->m_flTimeWeaponIdle;
|
||||
pto->fuser1 = pCurrent->pev->fuser1;
|
||||
pto->fuser2 = pCurrent->m_flStartThrow;
|
||||
pto->fuser3 = pCurrent->m_flReleaseThrow;
|
||||
pto->iuser1 = pCurrent->m_chargeReady;
|
||||
pto->iuser2 = pCurrent->m_fInAttack;
|
||||
pto->iuser3 = pCurrent->m_fireState;
|
||||
|
||||
// Decrement weapon counters, server does this at same time ( during post think, after doing everything else )
|
||||
pto->m_flNextReload -= cmd->msec / 1000.0;
|
||||
|
|
|
@ -35,6 +35,7 @@ extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz,
|
|||
|
||||
extern cvar_t *sensitivity;
|
||||
cvar_t *cl_lw = NULL;
|
||||
cvar_t *cl_viewbob = NULL;
|
||||
|
||||
void ShutdownInput( void );
|
||||
|
||||
|
@ -77,9 +78,26 @@ int __MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
|
|||
return gHUD.MsgFunc_GameMode( pszName, iSize, pbuf );
|
||||
}
|
||||
|
||||
int __MsgFunc_StartUp( const char *pszName, int iSize, void *pbuf )
|
||||
int __MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
return gHUD.MsgFunc_StartUp( pszName, iSize, pbuf );
|
||||
const char *pszSound;
|
||||
char cmd[64], path[64];
|
||||
int loop;
|
||||
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
pszSound = READ_STRING();
|
||||
loop = READ_BYTE();
|
||||
|
||||
sprintf( path, "sound/%s", pszSound );
|
||||
if( !IsXashFWGS() && gEngfuncs.pfnGetCvarPointer( "gl_overbright" ) )
|
||||
{
|
||||
sprintf( cmd, "mp3 play %s\n", path );
|
||||
gEngfuncs.pfnClientCmd( cmd );
|
||||
}
|
||||
else
|
||||
gEngfuncs.pfnPrimeMusicStream( path, loop );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// TFFree Command Menu
|
||||
|
@ -165,7 +183,7 @@ void CHud::Init( void )
|
|||
HOOK_MESSAGE( ViewMode );
|
||||
HOOK_MESSAGE( SetFOV );
|
||||
HOOK_MESSAGE( Concuss );
|
||||
HOOK_MESSAGE( StartUp );
|
||||
HOOK_MESSAGE( PlayMP3 );
|
||||
|
||||
// TFFree CommandMenu
|
||||
HOOK_COMMAND( "+commandmenu", OpenCommandMenu );
|
||||
|
@ -194,14 +212,13 @@ void CHud::Init( void )
|
|||
|
||||
m_iLogo = 0;
|
||||
m_iFOV = 0;
|
||||
m_flAlpha = 0;
|
||||
m_flTargetAlpha = 0;
|
||||
|
||||
CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 );
|
||||
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
|
||||
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
||||
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
|
||||
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
|
||||
cl_viewbob = CVAR_CREATE( "cl_viewbob", "0", FCVAR_ARCHIVE );
|
||||
|
||||
m_pSpriteList = NULL;
|
||||
|
||||
|
@ -235,7 +252,6 @@ void CHud::Init( void )
|
|||
m_AmmoSecondary.Init();
|
||||
m_TextMessage.Init();
|
||||
m_StatusIcons.Init();
|
||||
m_Scope.Init();
|
||||
m_MOTD.Init();
|
||||
m_Scoreboard.Init();
|
||||
|
||||
|
@ -388,6 +404,18 @@ void CHud::VidInit( void )
|
|||
// assumption: number_1, number_2, etc, are all listed and loaded sequentially
|
||||
m_HUD_number_0 = GetSpriteIndex( "number_0" );
|
||||
|
||||
if( m_HUD_number_0 == -1 )
|
||||
{
|
||||
const char *msg = "There is something wrong with your game data! Please, reinstall\n";
|
||||
|
||||
if( HUD_MessageBox( msg ) )
|
||||
{
|
||||
gEngfuncs.pfnClientCmd( "quit\n" );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_iFontHeight = m_rgrcRects[m_HUD_number_0].bottom - m_rgrcRects[m_HUD_number_0].top;
|
||||
|
||||
m_Ammo.VidInit();
|
||||
|
@ -405,7 +433,6 @@ void CHud::VidInit( void )
|
|||
m_AmmoSecondary.VidInit();
|
||||
m_TextMessage.VidInit();
|
||||
m_StatusIcons.VidInit();
|
||||
m_Scope.VidInit();
|
||||
m_Scoreboard.VidInit();
|
||||
m_MOTD.VidInit();
|
||||
}
|
||||
|
@ -521,10 +548,6 @@ int CHud::MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf )
|
|||
int newfov = READ_BYTE();
|
||||
int def_fov = CVAR_GET_FLOAT( "default_fov" );
|
||||
|
||||
//Weapon prediction already takes care of changing the fog. ( g_lastFOV ).
|
||||
if( cl_lw && cl_lw->value )
|
||||
return 1;
|
||||
|
||||
g_lastFOV = newfov;
|
||||
|
||||
if( newfov == 0 )
|
||||
|
@ -588,29 +611,3 @@ float CHud::GetSensitivity( void )
|
|||
return m_flMouseSensitivity;
|
||||
}
|
||||
|
||||
int CHud::MsgFunc_StartUp( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
// Target alpha
|
||||
float alpha = READ_BYTE();
|
||||
|
||||
if( alpha < 0 )
|
||||
alpha = 0;
|
||||
else if( alpha > 255 )
|
||||
alpha = 255;
|
||||
|
||||
m_flTargetAlpha = alpha;
|
||||
|
||||
// Start alpha
|
||||
alpha = READ_BYTE();
|
||||
|
||||
if( alpha < 0 )
|
||||
alpha = 0;
|
||||
else if( alpha > 255 )
|
||||
alpha = 255;
|
||||
|
||||
m_flAlpha = alpha;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
40
cl_dll/hud.h
40
cl_dll/hud.h
|
@ -19,9 +19,12 @@
|
|||
//
|
||||
// CHud handles the message, calculation, and drawing the HUD
|
||||
//
|
||||
|
||||
#define RGB_YELLOWISH 0x00FFFFFF //255,255,255
|
||||
#define RGB_REDISH 0x00FF1010 //255,160,0
|
||||
#pragma once
|
||||
#ifndef HUD_H
|
||||
#define HUD_H
|
||||
#define RGB_YELLOWISH 0x00C1CFCB //193,207,203
|
||||
#define RGB_WHITEISH 0x00FAFAFA //250,250,250
|
||||
#define RGB_REDISH 0x00FA0000 //250,0,0
|
||||
#define RGB_GREENISH 0x0000A000 //0,160,0
|
||||
|
||||
#include "wrect.h"
|
||||
|
@ -130,6 +133,7 @@ private:
|
|||
WEAPON *m_pWeapon;
|
||||
int m_HUD_bucket0;
|
||||
int m_HUD_selection;
|
||||
int m_HUD_stripe;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -228,7 +232,7 @@ public:
|
|||
void InitHUDData( void );
|
||||
int VidInit( void );
|
||||
int Draw( float flTime );
|
||||
int DrawPlayers( int xoffset, float listslot, int nameoffset = 0, char *team = NULL ); // returns the ypos where it finishes drawing
|
||||
int DrawPlayers( int xoffset, float listslot, int nameoffset = 0, const char *team = NULL ); // returns the ypos where it finishes drawing
|
||||
void UserCmd_ShowScores( void );
|
||||
void UserCmd_HideScores( void );
|
||||
int MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf );
|
||||
|
@ -480,7 +484,7 @@ public:
|
|||
int Init( void );
|
||||
static char *LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size );
|
||||
static char *BufferedLocaliseTextString( const char *msg );
|
||||
char *LookupString( const char *msg_name, int *msg_dest = NULL );
|
||||
const char *LookupString( const char *msg_name, int *msg_dest = NULL );
|
||||
int MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf );
|
||||
};
|
||||
|
||||
|
@ -541,8 +545,8 @@ public:
|
|||
|
||||
//had to make these public so CHud could access them (to enable concussion icon)
|
||||
//could use a friend declaration instead...
|
||||
void EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue );
|
||||
void DisableIcon( char *pszIconName );
|
||||
void EnableIcon( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue );
|
||||
void DisableIcon( const char *pszIconName );
|
||||
|
||||
private:
|
||||
typedef struct
|
||||
|
@ -559,15 +563,9 @@ private:
|
|||
//
|
||||
//-----------------------------------------------------
|
||||
//
|
||||
class CHudScope : public CHudBase
|
||||
class CHudScope
|
||||
{
|
||||
public:
|
||||
int Init( void );
|
||||
int VidInit( void );
|
||||
int Draw( float flTime );
|
||||
void Reset( void );
|
||||
int MsgFunc_Scope( const char *pszName, int iSize, void *pbuf );
|
||||
|
||||
int DrawScope( void );
|
||||
|
||||
private:
|
||||
|
@ -593,6 +591,7 @@ public:
|
|||
HSPRITE m_hsprCursor;
|
||||
float m_flTime; // the current client time
|
||||
float m_fOldTime; // the time at which the HUD was last redrawn
|
||||
float m_flScaleColorTime;
|
||||
double m_flTimeDelta; // the difference between flTime and fOldTime
|
||||
Vector m_vecOrigin;
|
||||
Vector m_vecAngles;
|
||||
|
@ -606,11 +605,11 @@ public:
|
|||
|
||||
int m_iFontHeight;
|
||||
int DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b );
|
||||
int DrawHudString( int x, int y, int iMaxX, char *szString, int r, int g, int b );
|
||||
int DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b );
|
||||
int DrawHudString( int x, int y, int iMaxX, const char *szString, int r, int g, int b );
|
||||
int DrawHudStringReverse( int xpos, int ypos, int iMinX, const char *szString, int r, int g, int b );
|
||||
int DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b );
|
||||
int GetNumWidth( int iNumber, int iFlags );
|
||||
int DrawHudStringLen( char *szIt );
|
||||
int DrawHudStringLen( const char *szIt );
|
||||
void DrawDarkRectangle( int x, int y, int wide, int tall );
|
||||
|
||||
private:
|
||||
|
@ -671,7 +670,6 @@ public:
|
|||
void _cdecl MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf );
|
||||
int _cdecl MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf );
|
||||
int _cdecl MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf );
|
||||
int _cdecl MsgFunc_StartUp( const char *pszName, int iSize, void *pbuf );
|
||||
|
||||
// Screen information
|
||||
SCREENINFO m_scrinfo;
|
||||
|
@ -688,11 +686,6 @@ public:
|
|||
void AddHudElem( CHudBase *p );
|
||||
|
||||
float GetSensitivity();
|
||||
|
||||
float m_flAlpha;
|
||||
|
||||
private:
|
||||
float m_flTargetAlpha;
|
||||
};
|
||||
|
||||
extern CHud gHUD;
|
||||
|
@ -702,3 +695,4 @@ extern int g_iTeamNumber;
|
|||
extern int g_iUser1;
|
||||
extern int g_iUser2;
|
||||
extern int g_iUser3;
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined( HUD_IFACEH )
|
||||
#define HUD_IFACEH
|
||||
#pragma once
|
||||
|
||||
#include "exportdef.h"
|
||||
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
|
||||
#define MAX_CLIENTS 32
|
||||
|
||||
extern BEAM *pBeam;
|
||||
extern BEAM *pBeam2;
|
||||
|
||||
extern float g_lastFOV; // Vit_amiN
|
||||
/// USER-DEFINED SERVER MESSAGE HANDLERS
|
||||
|
||||
int CHud::MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
|
||||
|
@ -48,6 +46,10 @@ int CHud::MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
|
|||
// reset concussion effect
|
||||
m_iConcussionEffect = 0;
|
||||
|
||||
// Vit_amiN: reset the FOV
|
||||
m_iFOV = 0; // default_fov
|
||||
g_lastFOV = 0.0f;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -69,9 +71,6 @@ void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
|||
pList->p->InitHUDData();
|
||||
pList = pList->pNext;
|
||||
}
|
||||
|
||||
//Probably not a good place to put this.
|
||||
pBeam = pBeam2 = NULL;
|
||||
}
|
||||
|
||||
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
|
||||
|
@ -107,10 +106,14 @@ int CHud::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
|
|||
|
||||
int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
int r, g, b;
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
m_iConcussionEffect = READ_BYTE();
|
||||
if( m_iConcussionEffect )
|
||||
this->m_StatusIcons.EnableIcon( "dmg_concuss", 255, 160, 0 );
|
||||
{
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH ); // Vit_amiN: fixed
|
||||
this->m_StatusIcons.EnableIcon( "dmg_concuss", r, g, b );
|
||||
}
|
||||
else
|
||||
this->m_StatusIcons.DisableIcon( "dmg_concuss" );
|
||||
return 1;
|
||||
|
|
|
@ -79,7 +79,6 @@ void CHud::Think( void )
|
|||
}
|
||||
}
|
||||
|
||||
void HUD_DrawOrthoTriangles( void );
|
||||
|
||||
// Redraw
|
||||
// step through the local data, placing the appropriate graphics & text as appropriate
|
||||
|
@ -95,6 +94,13 @@ int CHud::Redraw( float flTime, int intermission )
|
|||
if( m_flTimeDelta < 0 )
|
||||
m_flTimeDelta = 0;
|
||||
|
||||
if( !m_iIntermission && intermission )
|
||||
{
|
||||
// Take a screenshot if the client's got the cvar set
|
||||
if( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
|
||||
m_flShotTime = flTime + 1.0; // Take a screenshot in a second
|
||||
}
|
||||
|
||||
if( m_flShotTime && m_flShotTime < flTime )
|
||||
{
|
||||
gEngfuncs.pfnClientCmd( "snapshot\n" );
|
||||
|
@ -106,8 +112,6 @@ int CHud::Redraw( float flTime, int intermission )
|
|||
// if no redrawing is necessary
|
||||
// return 0;
|
||||
|
||||
HUD_DrawOrthoTriangles();
|
||||
|
||||
if( m_pCvarDraw->value )
|
||||
{
|
||||
HUDLIST *pList = m_pHudList;
|
||||
|
@ -173,23 +177,26 @@ int CHud::Redraw( float flTime, int intermission )
|
|||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// Slowly increase HUD alpha value.
|
||||
//
|
||||
if( m_flAlpha != m_flTargetAlpha )
|
||||
{
|
||||
if( m_flAlpha < m_flTargetAlpha )
|
||||
m_flAlpha = min( m_flAlpha + 2, m_flTargetAlpha );
|
||||
else if( m_flAlpha > m_flTargetAlpha )
|
||||
m_flAlpha = max( m_flAlpha - 8, m_flTargetAlpha );
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ScaleColors( int &r, int &g, int &b, int a )
|
||||
{
|
||||
float x = (float)a / 255;
|
||||
float f = 1.0;
|
||||
if( gHUD.m_flScaleColorTime != 0.0f )
|
||||
{
|
||||
float flTimeDiff = gHUD.m_flScaleColorTime - gHUD.m_flTime;
|
||||
if( flTimeDiff > 0.0f && flTimeDiff >= 1.0f )
|
||||
{
|
||||
flTimeDiff = 1.0f;
|
||||
}
|
||||
else if( flTimeDiff <= 0.0f )
|
||||
{
|
||||
flTimeDiff = 0.0f;
|
||||
}
|
||||
f = 1.0f - flTimeDiff;
|
||||
}
|
||||
float x = f * (float)a / 255;
|
||||
r = (int)( r * x );
|
||||
g = (int)( g * x );
|
||||
b = (int)( b * x );
|
||||
|
@ -207,7 +214,7 @@ const unsigned char colors[8][3] =
|
|||
{240, 180, 24}
|
||||
};
|
||||
|
||||
int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b )
|
||||
int CHud::DrawHudString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b )
|
||||
{
|
||||
if( hud_textmode->value == 2 )
|
||||
{
|
||||
|
@ -241,7 +248,40 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g
|
|||
return xpos;
|
||||
}
|
||||
|
||||
int CHud::DrawHudStringLen( char *szIt )
|
||||
int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b )
|
||||
{
|
||||
if (IsXashFWGS())
|
||||
{
|
||||
// xash3d: reset unicode state
|
||||
gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 );
|
||||
|
||||
// draw the string until we hit the null character or a newline character
|
||||
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||
{
|
||||
int w = gHUD.m_scrinfo.charWidths['M'];
|
||||
if( xpos + w > iMaxX )
|
||||
return xpos;
|
||||
if( ( *szIt == '^' ) && ( *( szIt + 1 ) >= '0') && ( *( szIt + 1 ) <= '7') )
|
||||
{
|
||||
szIt++;
|
||||
r = colors[*szIt - '0'][0];
|
||||
g = colors[*szIt - '0'][1];
|
||||
b = colors[*szIt - '0'][2];
|
||||
if( !*(++szIt) )
|
||||
return xpos;
|
||||
}
|
||||
int c = (unsigned int)(unsigned char)*szIt;
|
||||
xpos += gEngfuncs.pfnVGUI2DrawCharacterAdditive( xpos, ypos, c, r, g, b, 0 );
|
||||
}
|
||||
return xpos;
|
||||
}
|
||||
else
|
||||
{
|
||||
return gHUD.DrawHudString(xpos, ypos, iMaxX, szIt, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
int CHud::DrawHudStringLen( const char *szIt )
|
||||
{
|
||||
int l = 0;
|
||||
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||
|
@ -259,10 +299,10 @@ int CHud::DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r
|
|||
}
|
||||
|
||||
// draws a string from right to left (right-aligned)
|
||||
int CHud::DrawHudStringReverse( int xpos, int ypos, int iMinX, char *szString, int r, int g, int b )
|
||||
int CHud::DrawHudStringReverse( int xpos, int ypos, int iMinX, const char *szString, int r, int g, int b )
|
||||
{
|
||||
// find the end of the string
|
||||
for( char *szIt = szString; *szIt != 0; szIt++ )
|
||||
for( const char *szIt = szString; *szIt != 0; szIt++ )
|
||||
xpos -= gHUD.m_scrinfo.charWidths[(unsigned char)*szIt];
|
||||
if( xpos < iMinX )
|
||||
xpos = iMinX;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -175,13 +175,13 @@ void UTIL_StringToVector( float * pVector, const char *pString )
|
|||
}
|
||||
}
|
||||
|
||||
int UTIL_FindEntityInMap( char * name, float * origin, float * angle )
|
||||
int UTIL_FindEntityInMap( const char *name, float *origin, float *angle )
|
||||
{
|
||||
int n, found = 0;
|
||||
char keyname[256];
|
||||
char token[2048];
|
||||
|
||||
cl_entity_t * pEnt = gEngfuncs.GetEntityByIndex( 0 ); // get world model
|
||||
cl_entity_t *pEnt = gEngfuncs.GetEntityByIndex( 0 ); // get world model
|
||||
|
||||
if( !pEnt )
|
||||
return 0;
|
||||
|
@ -189,7 +189,7 @@ int UTIL_FindEntityInMap( char * name, float * origin, float * angle )
|
|||
if( !pEnt->model )
|
||||
return 0;
|
||||
|
||||
char * data = pEnt->model->entities;
|
||||
char *data = pEnt->model->entities;
|
||||
|
||||
while( data )
|
||||
{
|
||||
|
@ -1374,12 +1374,12 @@ void CHudSpectator::DeathMessage( int victim )
|
|||
AddOverviewEntityToList(m_hsprPlayerDead, pl, gEngfuncs.GetClientTime() + 2.0f );
|
||||
}
|
||||
|
||||
bool CHudSpectator::AddOverviewEntityToList(HSPRITE sprite, cl_entity_t *ent, double killTime)
|
||||
bool CHudSpectator::AddOverviewEntityToList( HSPRITE sprite, cl_entity_t *ent, double killTime )
|
||||
{
|
||||
for( int i = 0; i < MAX_OVERVIEW_ENTITIES; i++ )
|
||||
{
|
||||
// find empty entity slot
|
||||
if( m_OverviewEntities[i].entity == NULL)
|
||||
if( m_OverviewEntities[i].entity == NULL )
|
||||
{
|
||||
m_OverviewEntities[i].entity = ent;
|
||||
m_OverviewEntities[i].hSprite = sprite;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#ifndef SPECTATOR_H
|
||||
#define SPECTATOR_H
|
||||
#pragma once
|
||||
#ifndef HUD_SPECTATOR_H
|
||||
#define HUD_SPECTATOR_H
|
||||
|
||||
#include "cl_entity.h"
|
||||
|
||||
|
@ -64,11 +64,11 @@ public:
|
|||
void CheckOverviewEntities();
|
||||
void DrawOverview();
|
||||
void DrawOverviewEntities();
|
||||
void GetMapPosition( float * returnvec );
|
||||
void GetMapPosition( float *returnvec );
|
||||
void DrawOverviewLayer();
|
||||
void LoadMapSprites();
|
||||
bool ParseOverviewFile();
|
||||
bool IsActivePlayer( cl_entity_t * ent );
|
||||
bool IsActivePlayer( cl_entity_t *ent );
|
||||
void SetModes( int iMainMode, int iInsetMode );
|
||||
void HandleButtonsDown( int ButtonPressed );
|
||||
void HandleButtonsUp( int ButtonPressed );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined( IN_DEFSH )
|
||||
#define IN_DEFSH
|
||||
#pragma once
|
||||
|
||||
// up / down
|
||||
#define PITCH 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,83 @@
|
|||
#include "input_mouse.h"
|
||||
#include "exportdef.h"
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
|
||||
// shared between backends
|
||||
Vector dead_viewangles(0, 0, 0);
|
||||
cvar_t *sensitivity;
|
||||
cvar_t *in_joystick;
|
||||
|
||||
FWGSInput fwgsInput;
|
||||
|
||||
#ifdef SUPPORT_GOLDSOURCE_INPUT
|
||||
GoldSourceInput goldSourceInput;
|
||||
AbstractInput* currentInput = &goldSourceInput;
|
||||
#else
|
||||
AbstractInput* currentInput = &fwgsInput;
|
||||
#endif
|
||||
extern "C" void DLLEXPORT IN_ClientMoveEvent( float forwardmove, float sidemove )
|
||||
{
|
||||
currentInput->IN_ClientMoveEvent(forwardmove, sidemove);
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_ClientLookEvent( float relyaw, float relpitch )
|
||||
{
|
||||
currentInput->IN_ClientLookEvent(relyaw, relpitch);
|
||||
}
|
||||
|
||||
void IN_Move( float frametime, usercmd_t *cmd )
|
||||
{
|
||||
currentInput->IN_Move(frametime, cmd);
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_MouseEvent( int mstate )
|
||||
{
|
||||
currentInput->IN_MouseEvent(mstate);
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_ClearStates( void )
|
||||
{
|
||||
currentInput->IN_ClearStates();
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_ActivateMouse( void )
|
||||
{
|
||||
currentInput->IN_ActivateMouse();
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_DeactivateMouse( void )
|
||||
{
|
||||
currentInput->IN_DeactivateMouse();
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_Accumulate( void )
|
||||
{
|
||||
currentInput->IN_Accumulate();
|
||||
}
|
||||
|
||||
void IN_Commands( void )
|
||||
{
|
||||
currentInput->IN_Commands();
|
||||
}
|
||||
|
||||
void IN_Shutdown( void )
|
||||
{
|
||||
currentInput->IN_Shutdown();
|
||||
}
|
||||
|
||||
void IN_Init( void )
|
||||
{
|
||||
#ifdef SUPPORT_GOLDSOURCE_INPUT
|
||||
if (IsXashFWGS()) {
|
||||
gEngfuncs.Con_Printf( "FWGS Xash3D input is in use\n" );
|
||||
currentInput = &fwgsInput;
|
||||
} else {
|
||||
gEngfuncs.Con_Printf( "GoldSource input is in use\n" );
|
||||
currentInput = &goldSourceInput;
|
||||
}
|
||||
#else
|
||||
currentInput = &fwgsInput;
|
||||
#endif
|
||||
currentInput->IN_Init();
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
#pragma once
|
||||
#ifndef INPUT_MOUSE_H
|
||||
#define INPUT_MOUSE_H
|
||||
#include "cl_dll.h"
|
||||
#include "usercmd.h"
|
||||
#include "in_defs.h"
|
||||
|
||||
class AbstractInput
|
||||
{
|
||||
public:
|
||||
virtual void IN_ClientMoveEvent( float forwardmove, float sidemove ) = 0;
|
||||
virtual void IN_ClientLookEvent( float relyaw, float relpitch ) = 0;
|
||||
virtual void IN_Move( float frametime, usercmd_t *cmd ) = 0;
|
||||
virtual void IN_MouseEvent( int mstate ) = 0;
|
||||
virtual void IN_ClearStates( void ) = 0;
|
||||
virtual void IN_ActivateMouse( void ) = 0;
|
||||
virtual void IN_DeactivateMouse( void ) = 0;
|
||||
virtual void IN_Accumulate( void ) = 0;
|
||||
virtual void IN_Commands( void ) = 0;
|
||||
virtual void IN_Shutdown( void ) = 0;
|
||||
virtual void IN_Init( void ) = 0;
|
||||
};
|
||||
|
||||
class FWGSInput : public AbstractInput
|
||||
{
|
||||
public:
|
||||
virtual void IN_ClientMoveEvent( float forwardmove, float sidemove );
|
||||
virtual void IN_ClientLookEvent( float relyaw, float relpitch );
|
||||
virtual void IN_Move( float frametime, usercmd_t *cmd );
|
||||
virtual void IN_MouseEvent( int mstate );
|
||||
virtual void IN_ClearStates( void );
|
||||
virtual void IN_ActivateMouse( void );
|
||||
virtual void IN_DeactivateMouse( void );
|
||||
virtual void IN_Accumulate( void );
|
||||
virtual void IN_Commands( void );
|
||||
virtual void IN_Shutdown( void );
|
||||
virtual void IN_Init( void );
|
||||
|
||||
protected:
|
||||
float ac_forwardmove;
|
||||
float ac_sidemove;
|
||||
int ac_movecount;
|
||||
float rel_yaw;
|
||||
float rel_pitch;
|
||||
};
|
||||
|
||||
// No need for goldsource input support on the platforms that are not supported by GoldSource.
|
||||
#if defined(GOLDSOURCE_SUPPORT) && (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && (defined(__i386) || defined(_M_IX86))
|
||||
#define SUPPORT_GOLDSOURCE_INPUT
|
||||
class GoldSourceInput : public AbstractInput
|
||||
{
|
||||
public:
|
||||
virtual void IN_ClientMoveEvent( float forwardmove, float sidemove ) {}
|
||||
virtual void IN_ClientLookEvent( float relyaw, float relpitch ) {}
|
||||
virtual void IN_Move( float frametime, usercmd_t *cmd );
|
||||
virtual void IN_MouseEvent( int mstate );
|
||||
virtual void IN_ClearStates( void );
|
||||
virtual void IN_ActivateMouse( void );
|
||||
virtual void IN_DeactivateMouse( void );
|
||||
virtual void IN_Accumulate( void );
|
||||
virtual void IN_Commands( void );
|
||||
virtual void IN_Shutdown( void );
|
||||
virtual void IN_Init( void );
|
||||
|
||||
protected:
|
||||
void IN_GetMouseDelta( int *pOutX, int *pOutY);
|
||||
void IN_MouseMove ( float frametime, usercmd_t *cmd);
|
||||
void IN_StartupMouse (void);
|
||||
|
||||
int mouse_buttons;
|
||||
int mouse_oldbuttonstate;
|
||||
POINT current_pos;
|
||||
int old_mouse_x, old_mouse_y, mx_accum, my_accum;
|
||||
int mouseinitialized;
|
||||
void* sdl2Lib;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -3,14 +3,9 @@
|
|||
#include "cvardef.h"
|
||||
#include "kbutton.h"
|
||||
#include "keydefs.h"
|
||||
cvar_t *sensitivity;
|
||||
cvar_t *in_joystick;
|
||||
#define PITCH 0
|
||||
#define YAW 1
|
||||
#define ROLL 2
|
||||
|
||||
extern "C" void DLLEXPORT IN_ClientMoveEvent( float forwardmove, float sidemove );
|
||||
extern "C" void DLLEXPORT IN_ClientLookEvent( float relyaw, float relpitch );
|
||||
#include "input_mouse.h"
|
||||
extern cvar_t *sensitivity;
|
||||
extern cvar_t *in_joystick;
|
||||
|
||||
extern kbutton_t in_strafe;
|
||||
extern kbutton_t in_mlook;
|
||||
|
@ -37,12 +32,6 @@ extern cvar_t *cl_movespeedkey;
|
|||
cvar_t *cl_laddermode;
|
||||
|
||||
|
||||
float ac_forwardmove;
|
||||
float ac_sidemove;
|
||||
int ac_movecount;
|
||||
float rel_yaw;
|
||||
float rel_pitch;
|
||||
|
||||
#define F 1U<<0 // Forward
|
||||
#define B 1U<<1 // Back
|
||||
#define L 1U<<2 // Left
|
||||
|
@ -55,7 +44,7 @@ float rel_pitch;
|
|||
#define IMPULSE_UP 4
|
||||
|
||||
int CL_IsDead( void );
|
||||
Vector dead_viewangles(0, 0, 0);
|
||||
extern Vector dead_viewangles;
|
||||
|
||||
void IN_ToggleButtons( float forwardmove, float sidemove )
|
||||
{
|
||||
|
@ -135,7 +124,7 @@ void IN_ToggleButtons( float forwardmove, float sidemove )
|
|||
}
|
||||
}
|
||||
|
||||
void IN_ClientMoveEvent( float forwardmove, float sidemove )
|
||||
void FWGSInput::IN_ClientMoveEvent( float forwardmove, float sidemove )
|
||||
{
|
||||
//gEngfuncs.Con_Printf("IN_MoveEvent\n");
|
||||
|
||||
|
@ -144,14 +133,14 @@ void IN_ClientMoveEvent( float forwardmove, float sidemove )
|
|||
ac_movecount++;
|
||||
}
|
||||
|
||||
void IN_ClientLookEvent( float relyaw, float relpitch )
|
||||
void FWGSInput::IN_ClientLookEvent( float relyaw, float relpitch )
|
||||
{
|
||||
rel_yaw += relyaw;
|
||||
rel_pitch += relpitch;
|
||||
}
|
||||
|
||||
// Rotate camera and add move values to usercmd
|
||||
void IN_Move( float frametime, usercmd_t *cmd )
|
||||
void FWGSInput::IN_Move( float frametime, usercmd_t *cmd )
|
||||
{
|
||||
Vector viewangles;
|
||||
bool fLadder = false;
|
||||
|
@ -235,7 +224,7 @@ void IN_Move( float frametime, usercmd_t *cmd )
|
|||
ac_movecount = 0;
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_MouseEvent( int mstate )
|
||||
void FWGSInput::IN_MouseEvent( int mstate )
|
||||
{
|
||||
static int mouse_oldbuttonstate;
|
||||
// perform button actions
|
||||
|
@ -257,37 +246,37 @@ extern "C" void DLLEXPORT IN_MouseEvent( int mstate )
|
|||
|
||||
// Stubs
|
||||
|
||||
extern "C" void DLLEXPORT IN_ClearStates( void )
|
||||
void FWGSInput::IN_ClearStates( void )
|
||||
{
|
||||
//gEngfuncs.Con_Printf( "IN_ClearStates\n" );
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_ActivateMouse( void )
|
||||
void FWGSInput::IN_ActivateMouse( void )
|
||||
{
|
||||
//gEngfuncs.Con_Printf( "IN_ActivateMouse\n" );
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_DeactivateMouse( void )
|
||||
void FWGSInput::IN_DeactivateMouse( void )
|
||||
{
|
||||
//gEngfuncs.Con_Printf( "IN_DeactivateMouse\n" );
|
||||
}
|
||||
|
||||
extern "C" void DLLEXPORT IN_Accumulate( void )
|
||||
void FWGSInput::IN_Accumulate( void )
|
||||
{
|
||||
//gEngfuncs.Con_Printf( "IN_Accumulate\n" );
|
||||
}
|
||||
|
||||
void IN_Commands( void )
|
||||
void FWGSInput::IN_Commands( void )
|
||||
{
|
||||
//gEngfuncs.Con_Printf( "IN_Commands\n" );
|
||||
}
|
||||
|
||||
void IN_Shutdown( void )
|
||||
void FWGSInput::IN_Shutdown( void )
|
||||
{
|
||||
}
|
||||
|
||||
// Register cvars and reset data
|
||||
void IN_Init( void )
|
||||
void FWGSInput::IN_Init( void )
|
||||
{
|
||||
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE );
|
||||
in_joystick = gEngfuncs.pfnRegisterVariable( "joystick", "0", FCVAR_ARCHIVE );
|
||||
|
|
|
@ -1,901 +0,0 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
// in_win.c -- windows 95 mouse and joystick code
|
||||
// 02/21/97 JCB Added extended DirectInput code to support external controllers.
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "camera.h"
|
||||
#include "kbutton.h"
|
||||
#include "cvardef.h"
|
||||
#include "usercmd.h"
|
||||
#include "const.h"
|
||||
#include "camera.h"
|
||||
#include "in_defs.h"
|
||||
#include "../engine/keydefs.h"
|
||||
//#include "view.h"
|
||||
#include "windows.h"
|
||||
|
||||
#define MOUSE_BUTTON_COUNT 5
|
||||
|
||||
// Set this to 1 to show mouse cursor. Experimental
|
||||
int g_iVisibleMouse = 0;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void DLLEXPORT IN_ActivateMouse( void );
|
||||
void DLLEXPORT IN_DeactivateMouse( void );
|
||||
void DLLEXPORT IN_MouseEvent( int mstate );
|
||||
void DLLEXPORT IN_Accumulate( void );
|
||||
void DLLEXPORT IN_ClearStates( void );
|
||||
}
|
||||
|
||||
extern cl_enginefunc_t gEngfuncs;
|
||||
|
||||
extern int iMouseInUse;
|
||||
|
||||
extern kbutton_t in_strafe;
|
||||
extern kbutton_t in_mlook;
|
||||
extern kbutton_t in_speed;
|
||||
extern kbutton_t in_jlook;
|
||||
|
||||
extern cvar_t *m_pitch;
|
||||
extern cvar_t *m_yaw;
|
||||
extern cvar_t *m_forward;
|
||||
extern cvar_t *m_side;
|
||||
|
||||
extern cvar_t *lookstrafe;
|
||||
extern cvar_t *lookspring;
|
||||
extern cvar_t *cl_pitchdown;
|
||||
extern cvar_t *cl_pitchup;
|
||||
extern cvar_t *cl_yawspeed;
|
||||
extern cvar_t *cl_sidespeed;
|
||||
extern cvar_t *cl_forwardspeed;
|
||||
extern cvar_t *cl_pitchspeed;
|
||||
extern cvar_t *cl_movespeedkey;
|
||||
|
||||
// mouse variables
|
||||
cvar_t *m_filter;
|
||||
cvar_t *sensitivity;
|
||||
|
||||
int mouse_buttons;
|
||||
int mouse_oldbuttonstate;
|
||||
POINT current_pos;
|
||||
int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum;
|
||||
|
||||
static int restore_spi;
|
||||
static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1};
|
||||
static int mouseactive;
|
||||
int mouseinitialized;
|
||||
static int mouseparmsvalid;
|
||||
static int mouseshowtoggle = 1;
|
||||
|
||||
// joystick defines and variables
|
||||
// where should defines be moved?
|
||||
#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick
|
||||
#define JOY_RELATIVE_AXIS 0x00000010 // control like a mouse, spinner, trackball
|
||||
#define JOY_MAX_AXES 6 // X, Y, Z, R, U, V
|
||||
#define JOY_AXIS_X 0
|
||||
#define JOY_AXIS_Y 1
|
||||
#define JOY_AXIS_Z 2
|
||||
#define JOY_AXIS_R 3
|
||||
#define JOY_AXIS_U 4
|
||||
#define JOY_AXIS_V 5
|
||||
|
||||
enum _ControlList
|
||||
{
|
||||
AxisNada = 0,
|
||||
AxisForward,
|
||||
AxisLook,
|
||||
AxisSide,
|
||||
AxisTurn
|
||||
};
|
||||
|
||||
DWORD dwAxisFlags[JOY_MAX_AXES] =
|
||||
{
|
||||
JOY_RETURNX,
|
||||
JOY_RETURNY,
|
||||
JOY_RETURNZ,
|
||||
JOY_RETURNR,
|
||||
JOY_RETURNU,
|
||||
JOY_RETURNV
|
||||
};
|
||||
|
||||
DWORD dwAxisMap[JOY_MAX_AXES];
|
||||
DWORD dwControlMap[JOY_MAX_AXES];
|
||||
PDWORD pdwRawValue[JOY_MAX_AXES];
|
||||
|
||||
// none of these cvars are saved over a session
|
||||
// this means that advanced controller configuration needs to be executed
|
||||
// each time. this avoids any problems with getting back to a default usage
|
||||
// or when changing from one controller to another. this way at least something
|
||||
// works.
|
||||
cvar_t *in_joystick;
|
||||
cvar_t *joy_name;
|
||||
cvar_t *joy_advanced;
|
||||
cvar_t *joy_advaxisx;
|
||||
cvar_t *joy_advaxisy;
|
||||
cvar_t *joy_advaxisz;
|
||||
cvar_t *joy_advaxisr;
|
||||
cvar_t *joy_advaxisu;
|
||||
cvar_t *joy_advaxisv;
|
||||
cvar_t *joy_forwardthreshold;
|
||||
cvar_t *joy_sidethreshold;
|
||||
cvar_t *joy_pitchthreshold;
|
||||
cvar_t *joy_yawthreshold;
|
||||
cvar_t *joy_forwardsensitivity;
|
||||
cvar_t *joy_sidesensitivity;
|
||||
cvar_t *joy_pitchsensitivity;
|
||||
cvar_t *joy_yawsensitivity;
|
||||
cvar_t *joy_wwhack1;
|
||||
cvar_t *joy_wwhack2;
|
||||
|
||||
int joy_avail, joy_advancedinit, joy_haspov;
|
||||
DWORD joy_oldbuttonstate, joy_oldpovstate;
|
||||
|
||||
int joy_id;
|
||||
DWORD joy_flags;
|
||||
DWORD joy_numbuttons;
|
||||
|
||||
static JOYINFOEX ji;
|
||||
|
||||
/*
|
||||
===========
|
||||
Force_CenterView_f
|
||||
===========
|
||||
*/
|
||||
void Force_CenterView_f( void )
|
||||
{
|
||||
vec3_t viewangles;
|
||||
|
||||
if( !iMouseInUse )
|
||||
{
|
||||
gEngfuncs.GetViewAngles( (float *)viewangles );
|
||||
viewangles[PITCH] = 0;
|
||||
gEngfuncs.SetViewAngles( (float *)viewangles );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_ActivateMouse
|
||||
===========
|
||||
*/
|
||||
void DLLEXPORT IN_ActivateMouse( void )
|
||||
{
|
||||
if( mouseinitialized )
|
||||
{
|
||||
if( mouseparmsvalid )
|
||||
restore_spi = SystemParametersInfo( SPI_SETMOUSE, 0, newmouseparms, 0 );
|
||||
mouseactive = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_DeactivateMouse
|
||||
===========
|
||||
*/
|
||||
void DLLEXPORT IN_DeactivateMouse( void )
|
||||
{
|
||||
if( mouseinitialized )
|
||||
{
|
||||
if( restore_spi )
|
||||
SystemParametersInfo( SPI_SETMOUSE, 0, originalmouseparms, 0 );
|
||||
mouseactive = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_StartupMouse
|
||||
===========
|
||||
*/
|
||||
void IN_StartupMouse( void )
|
||||
{
|
||||
if( gEngfuncs.CheckParm( "-nomouse", NULL ) )
|
||||
return;
|
||||
|
||||
mouseinitialized = 1;
|
||||
mouseparmsvalid = SystemParametersInfo( SPI_GETMOUSE, 0, originalmouseparms, 0 );
|
||||
|
||||
if( mouseparmsvalid )
|
||||
{
|
||||
if( gEngfuncs.CheckParm( "-noforcemspd", NULL ) )
|
||||
newmouseparms[2] = originalmouseparms[2];
|
||||
|
||||
if( gEngfuncs.CheckParm( "-noforcemaccel", NULL ) )
|
||||
{
|
||||
newmouseparms[0] = originalmouseparms[0];
|
||||
newmouseparms[1] = originalmouseparms[1];
|
||||
}
|
||||
|
||||
if( gEngfuncs.CheckParm( "-noforcemparms", NULL ) )
|
||||
{
|
||||
newmouseparms[0] = originalmouseparms[0];
|
||||
newmouseparms[1] = originalmouseparms[1];
|
||||
newmouseparms[2] = originalmouseparms[2];
|
||||
}
|
||||
}
|
||||
|
||||
mouse_buttons = MOUSE_BUTTON_COUNT;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Shutdown
|
||||
===========
|
||||
*/
|
||||
void IN_Shutdown( void )
|
||||
{
|
||||
IN_DeactivateMouse ();
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_GetMousePos
|
||||
|
||||
Ask for mouse position from engine
|
||||
===========
|
||||
*/
|
||||
void IN_GetMousePos( int *mx, int *my )
|
||||
{
|
||||
gEngfuncs.GetMousePosition( mx, my );
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_ResetMouse
|
||||
|
||||
FIXME: Call through to engine?
|
||||
===========
|
||||
*/
|
||||
void IN_ResetMouse( void )
|
||||
{
|
||||
SetCursorPos ( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() );
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_MouseEvent
|
||||
===========
|
||||
*/
|
||||
void DLLEXPORT IN_MouseEvent( int mstate )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( iMouseInUse || g_iVisibleMouse )
|
||||
return;
|
||||
|
||||
// perform button actions
|
||||
for( i = 0; i < mouse_buttons; i++ )
|
||||
{
|
||||
if( ( mstate & ( 1 << i ) ) &&
|
||||
!( mouse_oldbuttonstate & ( 1 << i ) ) )
|
||||
{
|
||||
gEngfuncs.Key_Event( K_MOUSE1 + i, 1 );
|
||||
}
|
||||
|
||||
if( !( mstate & ( 1 << i ) ) &&
|
||||
( mouse_oldbuttonstate & ( 1 << i ) ) )
|
||||
{
|
||||
gEngfuncs.Key_Event( K_MOUSE1 + i, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
mouse_oldbuttonstate = mstate;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_MouseMove
|
||||
===========
|
||||
*/
|
||||
void IN_MouseMove( float frametime, usercmd_t *cmd )
|
||||
{
|
||||
int mx, my;
|
||||
vec3_t viewangles;
|
||||
|
||||
gEngfuncs.GetViewAngles( (float *)viewangles );
|
||||
|
||||
//jjb - this disbles normal mouse control if the user is trying to
|
||||
// move the camera, or if the mouse cursor is visible or if we're in intermission
|
||||
if( !iMouseInUse && !g_iVisibleMouse && !gHUD.m_iIntermission )
|
||||
{
|
||||
GetCursorPos( ¤t_pos );
|
||||
|
||||
mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum;
|
||||
my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum;
|
||||
|
||||
mx_accum = 0;
|
||||
my_accum = 0;
|
||||
|
||||
if( m_filter->value )
|
||||
{
|
||||
mouse_x = ( mx + old_mouse_x ) * 0.5;
|
||||
mouse_y = ( my + old_mouse_y ) * 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_x = mx;
|
||||
mouse_y = my;
|
||||
}
|
||||
|
||||
old_mouse_x = mx;
|
||||
old_mouse_y = my;
|
||||
|
||||
if( gHUD.GetSensitivity() != 0 )
|
||||
{
|
||||
mouse_x *= gHUD.GetSensitivity();
|
||||
mouse_y *= gHUD.GetSensitivity();
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_x *= sensitivity->value;
|
||||
mouse_y *= sensitivity->value;
|
||||
}
|
||||
|
||||
// add mouse X/Y movement to cmd
|
||||
if( ( in_strafe.state & 1 ) || ( lookstrafe->value && ( in_mlook.state & 1 ) ) )
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
else
|
||||
viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
|
||||
if( ( in_mlook.state & 1 ) && !( in_strafe.state & 1 ) )
|
||||
{
|
||||
viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
if( viewangles[PITCH] > cl_pitchdown->value )
|
||||
viewangles[PITCH] = cl_pitchdown->value;
|
||||
if( viewangles[PITCH] < -cl_pitchup->value )
|
||||
viewangles[PITCH] = -cl_pitchup->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( in_strafe.state & 1 ) && gEngfuncs.IsNoClipping() )
|
||||
{
|
||||
cmd->upmove -= m_forward->value * mouse_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd->forwardmove -= m_forward->value * mouse_y;
|
||||
}
|
||||
}
|
||||
|
||||
// if the mouse has moved, force it to the center, so there's room to move
|
||||
if( mx || my )
|
||||
{
|
||||
IN_ResetMouse();
|
||||
}
|
||||
}
|
||||
|
||||
gEngfuncs.SetViewAngles( (float *)viewangles );
|
||||
|
||||
/*
|
||||
//#define TRACE_TEST
|
||||
#if defined( TRACE_TEST )
|
||||
{
|
||||
int mx, my;
|
||||
void V_Move( int mx, int my );
|
||||
IN_GetMousePos( &mx, &my );
|
||||
V_Move( mx, my );
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Accumulate
|
||||
===========
|
||||
*/
|
||||
void DLLEXPORT IN_Accumulate( void )
|
||||
{
|
||||
//only accumulate mouse if we are not moving the camera with the mouse
|
||||
if( !iMouseInUse && !g_iVisibleMouse )
|
||||
{
|
||||
if( mouseactive )
|
||||
{
|
||||
GetCursorPos( ¤t_pos );
|
||||
|
||||
mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX();
|
||||
my_accum += current_pos.y - gEngfuncs.GetWindowCenterY();
|
||||
|
||||
// force the mouse to the center, so there's room to move
|
||||
IN_ResetMouse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
IN_ClearStates
|
||||
===================
|
||||
*/
|
||||
void DLLEXPORT IN_ClearStates( void )
|
||||
{
|
||||
if( !mouseactive )
|
||||
return;
|
||||
|
||||
mx_accum = 0;
|
||||
my_accum = 0;
|
||||
mouse_oldbuttonstate = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
IN_StartupJoystick
|
||||
===============
|
||||
*/
|
||||
void IN_StartupJoystick( void )
|
||||
{
|
||||
int numdevs;
|
||||
JOYCAPS jc;
|
||||
MMRESULT mmr;
|
||||
|
||||
// assume no joystick
|
||||
joy_avail = 0;
|
||||
|
||||
// abort startup if user requests no joystick
|
||||
if( gEngfuncs.CheckParm( "-nojoy", NULL ) )
|
||||
return;
|
||||
|
||||
// verify joystick driver is present
|
||||
if( ( numdevs = joyGetNumDevs() ) == 0 )
|
||||
{
|
||||
gEngfuncs.Con_DPrintf( "joystick not found -- driver not present\n\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// cycle through the joystick ids for the first valid one
|
||||
for( joy_id = 0; joy_id < numdevs; joy_id++ )
|
||||
{
|
||||
memset( &ji, 0, sizeof(ji) );
|
||||
ji.dwSize = sizeof(ji);
|
||||
ji.dwFlags = JOY_RETURNCENTERED;
|
||||
|
||||
if( ( mmr = joyGetPosEx( joy_id, &ji ) ) == JOYERR_NOERROR )
|
||||
break;
|
||||
}
|
||||
|
||||
// abort startup if we didn't find a valid joystick
|
||||
if( mmr != JOYERR_NOERROR )
|
||||
{
|
||||
gEngfuncs.Con_DPrintf( "joystick not found -- no valid joysticks (%x)\n\n", mmr );
|
||||
return;
|
||||
}
|
||||
|
||||
// get the capabilities of the selected joystick
|
||||
// abort startup if command fails
|
||||
memset( &jc, 0, sizeof(jc) );
|
||||
if( ( mmr = joyGetDevCaps( joy_id, &jc, sizeof(jc) ) ) != JOYERR_NOERROR )
|
||||
{
|
||||
gEngfuncs.Con_DPrintf( "joystick not found -- invalid joystick capabilities (%x)\n\n", mmr );
|
||||
return;
|
||||
}
|
||||
|
||||
// save the joystick's number of buttons and POV status
|
||||
joy_numbuttons = jc.wNumButtons;
|
||||
joy_haspov = jc.wCaps & JOYCAPS_HASPOV;
|
||||
|
||||
// old button and POV states default to no buttons pressed
|
||||
joy_oldbuttonstate = joy_oldpovstate = 0;
|
||||
|
||||
// mark the joystick as available and advanced initialization not completed
|
||||
// this is needed as cvars are not available during initialization
|
||||
gEngfuncs.Con_Printf( "joystick found\n\n", mmr );
|
||||
joy_avail = 1;
|
||||
joy_advancedinit = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
RawValuePointer
|
||||
===========
|
||||
*/
|
||||
PDWORD RawValuePointer( int axis )
|
||||
{
|
||||
switch( axis )
|
||||
{
|
||||
case JOY_AXIS_X:
|
||||
return &ji.dwXpos;
|
||||
case JOY_AXIS_Y:
|
||||
return &ji.dwYpos;
|
||||
case JOY_AXIS_Z:
|
||||
return &ji.dwZpos;
|
||||
case JOY_AXIS_R:
|
||||
return &ji.dwRpos;
|
||||
case JOY_AXIS_U:
|
||||
return &ji.dwUpos;
|
||||
case JOY_AXIS_V:
|
||||
return &ji.dwVpos;
|
||||
}
|
||||
// FIX: need to do some kind of error
|
||||
return &ji.dwXpos;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
Joy_AdvancedUpdate_f
|
||||
===========
|
||||
*/
|
||||
void Joy_AdvancedUpdate_f( void )
|
||||
{
|
||||
// called once by IN_ReadJoystick and by user whenever an update is needed
|
||||
// cvars are now available
|
||||
int i;
|
||||
DWORD dwTemp;
|
||||
|
||||
// initialize all the maps
|
||||
for( i = 0; i < JOY_MAX_AXES; i++ )
|
||||
{
|
||||
dwAxisMap[i] = AxisNada;
|
||||
dwControlMap[i] = JOY_ABSOLUTE_AXIS;
|
||||
pdwRawValue[i] = RawValuePointer(i);
|
||||
}
|
||||
|
||||
if( joy_advanced->value == 0.0 )
|
||||
{
|
||||
// default joystick initialization
|
||||
// 2 axes only with joystick control
|
||||
dwAxisMap[JOY_AXIS_X] = AxisTurn;
|
||||
// dwControlMap[JOY_AXIS_X] = JOY_ABSOLUTE_AXIS;
|
||||
dwAxisMap[JOY_AXIS_Y] = AxisForward;
|
||||
// dwControlMap[JOY_AXIS_Y] = JOY_ABSOLUTE_AXIS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( strcmp( joy_name->string, "joystick" ) != 0 )
|
||||
{
|
||||
// notify user of advanced controller
|
||||
gEngfuncs.Con_Printf( "\n%s configured\n\n", joy_name->string );
|
||||
}
|
||||
|
||||
// advanced initialization here
|
||||
// data supplied by user via joy_axisn cvars
|
||||
dwTemp = (DWORD)joy_advaxisx->value;
|
||||
dwAxisMap[JOY_AXIS_X] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_X] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD)joy_advaxisy->value;
|
||||
dwAxisMap[JOY_AXIS_Y] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_Y] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD)joy_advaxisz->value;
|
||||
dwAxisMap[JOY_AXIS_Z] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_Z] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD)joy_advaxisr->value;
|
||||
dwAxisMap[JOY_AXIS_R] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_R] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD)joy_advaxisu->value;
|
||||
dwAxisMap[JOY_AXIS_U] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_U] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
dwTemp = (DWORD)joy_advaxisv->value;
|
||||
dwAxisMap[JOY_AXIS_V] = dwTemp & 0x0000000f;
|
||||
dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS;
|
||||
}
|
||||
|
||||
// compute the axes to collect from DirectInput
|
||||
joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV;
|
||||
for( i = 0; i < JOY_MAX_AXES; i++ )
|
||||
{
|
||||
if( dwAxisMap[i] != AxisNada )
|
||||
{
|
||||
joy_flags |= dwAxisFlags[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Commands
|
||||
===========
|
||||
*/
|
||||
void IN_Commands( void )
|
||||
{
|
||||
int i, key_index;
|
||||
DWORD buttonstate, povstate;
|
||||
|
||||
if( !joy_avail )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// loop through the joystick buttons
|
||||
// key a joystick event or auxillary event for higher number buttons for each state change
|
||||
buttonstate = ji.dwButtons;
|
||||
for( i = 0; i < (int)joy_numbuttons; i++ )
|
||||
{
|
||||
if( ( buttonstate & ( 1 << i ) ) && !( joy_oldbuttonstate & ( 1 << i ) ) )
|
||||
{
|
||||
key_index = ( i < 4 ) ? K_JOY1 : K_AUX1;
|
||||
gEngfuncs.Key_Event( key_index + i, 1 );
|
||||
}
|
||||
|
||||
if( !( buttonstate & ( 1 << i ) ) && ( joy_oldbuttonstate & ( 1 << i ) ) )
|
||||
{
|
||||
key_index = ( i < 4 ) ? K_JOY1 : K_AUX1;
|
||||
gEngfuncs.Key_Event( key_index + i, 0 );
|
||||
}
|
||||
}
|
||||
joy_oldbuttonstate = buttonstate;
|
||||
|
||||
if( joy_haspov )
|
||||
{
|
||||
// convert POV information into 4 bits of state information
|
||||
// this avoids any potential problems related to moving from one
|
||||
// direction to another without going through the center position
|
||||
povstate = 0;
|
||||
if( ji.dwPOV != JOY_POVCENTERED )
|
||||
{
|
||||
if( ji.dwPOV == JOY_POVFORWARD )
|
||||
povstate |= 0x01;
|
||||
if( ji.dwPOV == JOY_POVRIGHT )
|
||||
povstate |= 0x02;
|
||||
if( ji.dwPOV == JOY_POVBACKWARD )
|
||||
povstate |= 0x04;
|
||||
if( ji.dwPOV == JOY_POVLEFT )
|
||||
povstate |= 0x08;
|
||||
}
|
||||
// determine which bits have changed and key an auxillary event for each change
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
if( ( povstate & ( 1 << i ) ) && !( joy_oldpovstate & ( 1 << i ) ) )
|
||||
{
|
||||
gEngfuncs.Key_Event( K_AUX29 + i, 1 );
|
||||
}
|
||||
|
||||
if( !( povstate & ( 1 << i ) ) && ( joy_oldpovstate & ( 1 << i ) ) )
|
||||
{
|
||||
gEngfuncs.Key_Event( K_AUX29 + i, 0 );
|
||||
}
|
||||
}
|
||||
joy_oldpovstate = povstate;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
IN_ReadJoystick
|
||||
===============
|
||||
*/
|
||||
int IN_ReadJoystick( void )
|
||||
{
|
||||
memset( &ji, 0, sizeof(ji) );
|
||||
ji.dwSize = sizeof(ji);
|
||||
ji.dwFlags = joy_flags;
|
||||
|
||||
if( joyGetPosEx( joy_id, &ji ) == JOYERR_NOERROR )
|
||||
{
|
||||
// this is a hack -- there is a bug in the Logitech WingMan Warrior DirectInput Driver
|
||||
// rather than having 32768 be the zero point, they have the zero point at 32668
|
||||
// go figure -- anyway, now we get the full resolution out of the device
|
||||
if( joy_wwhack1->value != 0.0 )
|
||||
{
|
||||
ji.dwUpos += 100;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// read error occurred
|
||||
// turning off the joystick seems too harsh for 1 read error,\
|
||||
// but what should be done?
|
||||
// Con_Printf( "IN_ReadJoystick: no response\n" );
|
||||
// joy_avail = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_JoyMove
|
||||
===========
|
||||
*/
|
||||
void IN_JoyMove( float frametime, usercmd_t *cmd )
|
||||
{
|
||||
float speed, aspeed;
|
||||
float fAxisValue, fTemp;
|
||||
int i;
|
||||
vec3_t viewangles;
|
||||
|
||||
gEngfuncs.GetViewAngles( (float *)viewangles );
|
||||
|
||||
// complete initialization if first time in
|
||||
// this is needed as cvars are not available at initialization time
|
||||
if( joy_advancedinit != 1 )
|
||||
{
|
||||
Joy_AdvancedUpdate_f();
|
||||
joy_advancedinit = 1;
|
||||
}
|
||||
|
||||
// verify joystick is available and that the user wants to use it
|
||||
if( !joy_avail || !in_joystick->value )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// collect the joystick data, if possible
|
||||
if( IN_ReadJoystick () != 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( in_speed.state & 1 )
|
||||
speed = cl_movespeedkey->value;
|
||||
else
|
||||
speed = 1;
|
||||
|
||||
aspeed = speed * frametime;
|
||||
|
||||
// loop through the axes
|
||||
for( i = 0; i < JOY_MAX_AXES; i++ )
|
||||
{
|
||||
// get the floating point zero-centered, potentially-inverted data for the current axis
|
||||
fAxisValue = (float) *pdwRawValue[i];
|
||||
// move centerpoint to zero
|
||||
fAxisValue -= 32768.0;
|
||||
|
||||
if( joy_wwhack2->value != 0.0 )
|
||||
{
|
||||
if( dwAxisMap[i] == AxisTurn )
|
||||
{
|
||||
// this is a special formula for the Logitech WingMan Warrior
|
||||
// y=ax^b; where a = 300 and b = 1.3
|
||||
// also x values are in increments of 800 (so this is factored out)
|
||||
// then bounds check result to level out excessively high spin rates
|
||||
fTemp = 300.0 * pow( abs( fAxisValue ) / 800.0, 1.3 );
|
||||
if( fTemp > 14000.0 )
|
||||
fTemp = 14000.0;
|
||||
// restore direction information
|
||||
fAxisValue = ( fAxisValue > 0.0 ) ? fTemp : -fTemp;
|
||||
}
|
||||
}
|
||||
|
||||
// convert range from -32768..32767 to -1..1
|
||||
fAxisValue /= 32768.0;
|
||||
|
||||
switch( dwAxisMap[i] )
|
||||
{
|
||||
case AxisForward:
|
||||
if( ( joy_advanced->value == 0.0 ) && ( in_jlook.state & 1 ) )
|
||||
{
|
||||
// user wants forward control to become look control
|
||||
if( fabs( fAxisValue ) > joy_pitchthreshold->value )
|
||||
{
|
||||
// if mouse invert is on, invert the joystick pitch value
|
||||
// only absolute control support here (joy_advanced is 0)
|
||||
if( m_pitch->value < 0.0 )
|
||||
{
|
||||
viewangles[PITCH] -= ( fAxisValue * joy_pitchsensitivity->value ) * aspeed * cl_pitchspeed->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewangles[PITCH] += ( fAxisValue * joy_pitchsensitivity->value ) * aspeed * cl_pitchspeed->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// user wants forward control to be forward control
|
||||
if( fabs( fAxisValue ) > joy_forwardthreshold->value )
|
||||
{
|
||||
cmd->forwardmove += ( fAxisValue * joy_forwardsensitivity->value ) * speed * cl_forwardspeed->value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AxisSide:
|
||||
if( fabs( fAxisValue ) > joy_sidethreshold->value )
|
||||
{
|
||||
cmd->sidemove += ( fAxisValue * joy_sidesensitivity->value ) * speed * cl_sidespeed->value;
|
||||
}
|
||||
break;
|
||||
case AxisTurn:
|
||||
if( ( in_strafe.state & 1 ) || ( lookstrafe->value && ( in_jlook.state & 1 ) ) )
|
||||
{
|
||||
// user wants turn control to become side control
|
||||
if( fabs( fAxisValue ) > joy_sidethreshold->value )
|
||||
{
|
||||
cmd->sidemove -= ( fAxisValue * joy_sidesensitivity->value ) * speed * cl_sidespeed->value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// user wants turn control to be turn control
|
||||
if( fabs( fAxisValue ) > joy_yawthreshold->value )
|
||||
{
|
||||
if( dwControlMap[i] == JOY_ABSOLUTE_AXIS )
|
||||
{
|
||||
viewangles[YAW] += ( fAxisValue * joy_yawsensitivity->value ) * aspeed * cl_yawspeed->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewangles[YAW] += ( fAxisValue * joy_yawsensitivity->value ) * speed * 180.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AxisLook:
|
||||
if( in_jlook.state & 1 )
|
||||
{
|
||||
if( fabs( fAxisValue ) > joy_pitchthreshold->value )
|
||||
{
|
||||
// pitch movement detected and pitch movement desired by user
|
||||
if( dwControlMap[i] == JOY_ABSOLUTE_AXIS )
|
||||
{
|
||||
viewangles[PITCH] += ( fAxisValue * joy_pitchsensitivity->value ) * aspeed * cl_pitchspeed->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewangles[PITCH] += ( fAxisValue * joy_pitchsensitivity->value ) * speed * 180.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// bounds check pitch
|
||||
if( viewangles[PITCH] > cl_pitchdown->value )
|
||||
viewangles[PITCH] = cl_pitchdown->value;
|
||||
if( viewangles[PITCH] < -cl_pitchup->value )
|
||||
viewangles[PITCH] = -cl_pitchup->value;
|
||||
|
||||
gEngfuncs.SetViewAngles( (float *)viewangles );
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Move
|
||||
===========
|
||||
*/
|
||||
void IN_Move( float frametime, usercmd_t *cmd )
|
||||
{
|
||||
if( !iMouseInUse && mouseactive )
|
||||
{
|
||||
IN_MouseMove( frametime, cmd );
|
||||
}
|
||||
|
||||
IN_JoyMove( frametime, cmd );
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Init
|
||||
===========
|
||||
*/
|
||||
void IN_Init( void )
|
||||
{
|
||||
m_filter = gEngfuncs.pfnRegisterVariable( "m_filter","0", FCVAR_ARCHIVE );
|
||||
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting.
|
||||
|
||||
in_joystick = gEngfuncs.pfnRegisterVariable( "joystick","0", FCVAR_ARCHIVE );
|
||||
joy_name = gEngfuncs.pfnRegisterVariable( "joyname", "joystick", 0 );
|
||||
joy_advanced = gEngfuncs.pfnRegisterVariable( "joyadvanced", "0", 0 );
|
||||
joy_advaxisx = gEngfuncs.pfnRegisterVariable( "joyadvaxisx", "0", 0 );
|
||||
joy_advaxisy = gEngfuncs.pfnRegisterVariable( "joyadvaxisy", "0", 0 );
|
||||
joy_advaxisz = gEngfuncs.pfnRegisterVariable( "joyadvaxisz", "0", 0 );
|
||||
joy_advaxisr = gEngfuncs.pfnRegisterVariable( "joyadvaxisr", "0", 0 );
|
||||
joy_advaxisu = gEngfuncs.pfnRegisterVariable( "joyadvaxisu", "0", 0 );
|
||||
joy_advaxisv = gEngfuncs.pfnRegisterVariable( "joyadvaxisv", "0", 0 );
|
||||
joy_forwardthreshold = gEngfuncs.pfnRegisterVariable( "joyforwardthreshold", "0.15", 0 );
|
||||
joy_sidethreshold = gEngfuncs.pfnRegisterVariable( "joysidethreshold", "0.15", 0 );
|
||||
joy_pitchthreshold = gEngfuncs.pfnRegisterVariable( "joypitchthreshold", "0.15", 0 );
|
||||
joy_yawthreshold = gEngfuncs.pfnRegisterVariable( "joyyawthreshold", "0.15", 0 );
|
||||
joy_forwardsensitivity = gEngfuncs.pfnRegisterVariable( "joyforwardsensitivity", "-1.0", 0 );
|
||||
joy_sidesensitivity = gEngfuncs.pfnRegisterVariable( "joysidesensitivity", "-1.0", 0 );
|
||||
joy_pitchsensitivity = gEngfuncs.pfnRegisterVariable( "joypitchsensitivity", "1.0", 0 );
|
||||
joy_yawsensitivity = gEngfuncs.pfnRegisterVariable( "joyyawsensitivity", "-1.0", 0 );
|
||||
joy_wwhack1 = gEngfuncs.pfnRegisterVariable( "joywwhack1", "0.0", 0 );
|
||||
joy_wwhack2 = gEngfuncs.pfnRegisterVariable( "joywwhack2", "0.0", 0 );
|
||||
|
||||
gEngfuncs.pfnAddCommand ("force_centerview", Force_CenterView_f);
|
||||
gEngfuncs.pfnAddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f);
|
||||
|
||||
IN_StartupMouse ();
|
||||
IN_StartupJoystick ();
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined( KBUTTONH )
|
||||
#define KBUTTONH
|
||||
#pragma once
|
||||
|
||||
typedef struct kbutton_s
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ int CHudMenu::Draw( float flTime )
|
|||
int nlc = 0;
|
||||
for( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
|
||||
{
|
||||
if ( g_szMenuString[i] == '\n' )
|
||||
if( g_szMenuString[i] == '\n' )
|
||||
nlc++;
|
||||
}
|
||||
|
||||
|
@ -153,19 +153,21 @@ int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
|
|||
else
|
||||
{
|
||||
// append to the current menu string
|
||||
strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen( g_szPrelocalisedMenuString ) );
|
||||
strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen( g_szPrelocalisedMenuString ) - 1 );
|
||||
}
|
||||
g_szPrelocalisedMenuString[MAX_MENU_STRING - 1] = 0; // ensure null termination (strncat/strncpy does not)
|
||||
|
||||
if( !NeedMore )
|
||||
{
|
||||
// we have the whole string, so we can localise it now
|
||||
strcpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ) );
|
||||
strncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING );
|
||||
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
|
||||
|
||||
// Swap in characters
|
||||
if( KB_ConvertString( g_szMenuString, &temp ) )
|
||||
{
|
||||
strcpy( g_szMenuString, temp );
|
||||
strncpy( g_szMenuString, temp, MAX_MENU_STRING );
|
||||
g_szMenuString[MAX_MENU_STRING - 1] = '\0';
|
||||
free( temp );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ DECLARE_MESSAGE( m_Message, GameTitle )
|
|||
|
||||
// 1 Global client_textmessage_t for custom messages that aren't in the titles.txt
|
||||
client_textmessage_t g_pCustomMessage;
|
||||
char *g_pCustomName = "Custom";
|
||||
const char *g_pCustomName = "Custom";
|
||||
char g_pCustomText[1024];
|
||||
|
||||
int CHudMessage::Init( void )
|
||||
|
@ -260,7 +260,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
|
|||
width = 0;
|
||||
}
|
||||
else
|
||||
width += gHUD.m_scrinfo.charWidths[*pText];
|
||||
width += gHUD.m_scrinfo.charWidths[(unsigned char)*pText];
|
||||
pText++;
|
||||
length++;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ int CHudMessage::Draw( float fTime )
|
|||
{
|
||||
int i, drawn;
|
||||
client_textmessage_t *pMessage;
|
||||
float endTime = 0;
|
||||
float endTime = 0.0f;
|
||||
|
||||
drawn = 0;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#ifndef OVERVIEW_H
|
||||
#define OVERVIEW_H
|
||||
#pragma once
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handles the drawing of the top-down map and all the things on it
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
//
|
||||
// parsemsg.h
|
||||
//
|
||||
#pragma once
|
||||
#ifndef PARSEMSG_H
|
||||
#define PARSEMSG_H
|
||||
|
||||
#define ASSERT( x )
|
||||
|
||||
|
@ -30,6 +33,7 @@ float READ_COORD( void );
|
|||
float READ_ANGLE( void );
|
||||
float READ_HIRESANGLE( void );
|
||||
|
||||
#endif // PARSEMSG_H
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,63 +26,15 @@
|
|||
#include "pm_shared.h"
|
||||
#include "pm_defs.h"
|
||||
#include "pmtrace.h"
|
||||
|
||||
extern bool bDrawScope;
|
||||
extern vec3_t v_origin; // last view origin
|
||||
extern vec3_t v_angles; // last view angle
|
||||
extern vec3_t v_cl_angles; // last client/mouse angle
|
||||
extern vec3_t v_sim_org; // last sim origin
|
||||
|
||||
DECLARE_MESSAGE(m_Scope, Scope)
|
||||
|
||||
int CHudScope::Init(void)
|
||||
int CHudScope::DrawScope()
|
||||
{
|
||||
HOOK_MESSAGE(Scope);
|
||||
|
||||
m_iFlags = 0;
|
||||
|
||||
gHUD.AddHudElem(this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CHudScope::Reset(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CHudScope::VidInit(void)
|
||||
{
|
||||
m_hSprite = SPR_Load("sprites/scopeborder.spr");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudScope::MsgFunc_Scope(const char *pszName, int iSize, void *pbuf)
|
||||
{
|
||||
// TODO: update local health data
|
||||
BEGIN_READ(pbuf, iSize);
|
||||
int fOn = READ_BYTE();
|
||||
|
||||
if (fOn)
|
||||
{
|
||||
m_iFlags |= HUD_ACTIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iFlags &= ~HUD_ACTIVE;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int CHudScope::Draw(float flTime)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CHudScope::DrawScope(void)
|
||||
{
|
||||
if (!(m_iFlags & HUD_ACTIVE))
|
||||
if( !bDrawScope )
|
||||
return 1;
|
||||
|
||||
if (!m_hSprite)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
cvar_t *cl_scoreboard_bg;
|
||||
cvar_t *cl_showpacketloss;
|
||||
hud_player_info_t g_PlayerInfoList[MAX_PLAYERS + 1]; // player info from the engine
|
||||
extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS + 1]; // additional player info sent directly to the client dll
|
||||
|
@ -59,6 +60,7 @@ int CHudScoreboard::Init( void )
|
|||
|
||||
InitHUDData();
|
||||
|
||||
cl_scoreboard_bg = CVAR_CREATE( "cl_scoreboard_bg", "1", FCVAR_ARCHIVE );
|
||||
cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE );
|
||||
|
||||
return 1;
|
||||
|
@ -92,6 +94,7 @@ We have a minimum width of 1-320 - we could have the field widths scale with it?
|
|||
// relative to the side of the scoreboard
|
||||
#define NAME_RANGE_MIN 20
|
||||
#define NAME_RANGE_MAX 145
|
||||
#define NAME_RANGE_MODIFIER 120
|
||||
#define KILLS_RANGE_MIN 130
|
||||
#define KILLS_RANGE_MAX 170
|
||||
#define DIVIDER_POS 180
|
||||
|
@ -126,11 +129,11 @@ int CHudScoreboard::Draw( float fTime )
|
|||
if( cl_showpacketloss && cl_showpacketloss->value && ( ScreenWidth >= 400 ) )
|
||||
{
|
||||
can_show_packetloss = 1;
|
||||
SCOREBOARD_WIDTH = 400;
|
||||
SCOREBOARD_WIDTH = ( ScreenWidth >= 520 ) ? ( 400 - NAME_RANGE_MODIFIER ) : 400;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCOREBOARD_WIDTH = 320;
|
||||
SCOREBOARD_WIDTH = ( ScreenWidth >= 440 ) ? ( 320 - NAME_RANGE_MODIFIER ) : 320;
|
||||
}
|
||||
|
||||
// just sort the list on the fly
|
||||
|
@ -144,25 +147,33 @@ int CHudScoreboard::Draw( float fTime )
|
|||
|
||||
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX;
|
||||
FAR_RIGHT += 5;
|
||||
|
||||
if( ( ScreenWidth >= 440 && !can_show_packetloss ) || ( ScreenWidth >= 520 && can_show_packetloss ) )
|
||||
{
|
||||
xpos -= NAME_RANGE_MODIFIER;
|
||||
FAR_RIGHT += NAME_RANGE_MODIFIER;
|
||||
}
|
||||
|
||||
if( cl_scoreboard_bg && cl_scoreboard_bg->value )
|
||||
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX );
|
||||
if( !gHUD.m_Teamplay )
|
||||
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
|
||||
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
|
||||
else
|
||||
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 );
|
||||
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 );
|
||||
|
||||
gHUD.DrawHudStringReverse( KILLS_RANGE_MAX + xpos_rel, ypos, 0, "kills", 255, 140, 0 );
|
||||
gHUD.DrawHudString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 );
|
||||
gHUD.DrawHudString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 );
|
||||
gHUD.DrawHudString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 );
|
||||
DrawUtfString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 );
|
||||
DrawUtfString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 );
|
||||
DrawUtfString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 );
|
||||
|
||||
if( can_show_packetloss )
|
||||
{
|
||||
gHUD.DrawHudString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
|
||||
DrawUtfString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
|
||||
}
|
||||
|
||||
list_slot += 1.2;
|
||||
ypos = ROW_RANGE_MIN + ( list_slot * ROW_GAP );
|
||||
xpos = NAME_RANGE_MIN + xpos_rel;
|
||||
// xpos = NAME_RANGE_MIN + xpos_rel;
|
||||
FillRGBA( xpos - 4, ypos, FAR_RIGHT -2, 1, 255, 140, 0, 255 ); // draw the seperator line
|
||||
|
||||
list_slot += 0.8;
|
||||
|
@ -263,16 +274,22 @@ int CHudScoreboard::Draw( float fTime )
|
|||
break;
|
||||
|
||||
xpos = NAME_RANGE_MIN + xpos_rel;
|
||||
|
||||
if( ( ScreenWidth >= 440 && !can_show_packetloss ) || ( ScreenWidth >= 520 && can_show_packetloss ) )
|
||||
{
|
||||
xpos -= NAME_RANGE_MODIFIER;
|
||||
}
|
||||
|
||||
int r = 255, g = 225, b = 55; // draw the stuff kinda yellowish
|
||||
|
||||
if( team_info->ownteam ) // if it is their team, draw the background different color
|
||||
{
|
||||
// overlay the background in blue, then draw the score text over it
|
||||
FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 );
|
||||
FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 );
|
||||
}
|
||||
|
||||
// draw their name (left to right)
|
||||
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b );
|
||||
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b );
|
||||
|
||||
// draw kills (right to left)
|
||||
xpos = KILLS_RANGE_MAX + xpos_rel;
|
||||
|
@ -280,7 +297,7 @@ int CHudScoreboard::Draw( float fTime )
|
|||
|
||||
// draw divider
|
||||
xpos = DIVIDER_POS + xpos_rel;
|
||||
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b );
|
||||
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b );
|
||||
|
||||
// draw deaths
|
||||
xpos = DEATHS_RANGE_MAX + xpos_rel;
|
||||
|
@ -300,7 +317,7 @@ int CHudScoreboard::Draw( float fTime )
|
|||
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2) + PL_RANGE_MIN + xpos_rel + 25;
|
||||
|
||||
sprintf( buf, " %d", team_info->packetloss );
|
||||
gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b );
|
||||
DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b );
|
||||
}
|
||||
|
||||
team_info->already_drawn = TRUE; // set the already_drawn to be TRUE, so this team won't get drawn again
|
||||
|
@ -320,7 +337,7 @@ int CHudScoreboard::Draw( float fTime )
|
|||
extern float *GetClientColor( int client );
|
||||
|
||||
// returns the ypos where it finishes drawing
|
||||
int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, char *team )
|
||||
int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, const char *team )
|
||||
{
|
||||
int can_show_packetloss = 0;
|
||||
int FAR_RIGHT;
|
||||
|
@ -339,6 +356,11 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
|||
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX;
|
||||
FAR_RIGHT += 5;
|
||||
|
||||
if( ( ScreenWidth >= 440 && !can_show_packetloss ) || ( ScreenWidth >= 520 && can_show_packetloss ) )
|
||||
{
|
||||
FAR_RIGHT += NAME_RANGE_MODIFIER;
|
||||
}
|
||||
|
||||
// draw the players, in order, and restricted to team if set
|
||||
while( 1 )
|
||||
{
|
||||
|
@ -377,6 +399,12 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
|||
break;
|
||||
|
||||
int xpos = NAME_RANGE_MIN + xpos_rel;
|
||||
|
||||
if( ( ScreenWidth >= 440 && !can_show_packetloss ) || ( ScreenWidth >= 520 && can_show_packetloss ) )
|
||||
{
|
||||
xpos -= NAME_RANGE_MODIFIER;
|
||||
}
|
||||
|
||||
int r = 255, g = 255, b = 255;
|
||||
float *colors = GetClientColor( best_player );
|
||||
r *= colors[0], g *= colors[1], b *= colors[2];
|
||||
|
@ -385,22 +413,22 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
|||
if( pl_info->thisplayer )
|
||||
{
|
||||
// green is the suicide color? i wish this could do grey...
|
||||
FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 80, 155, 0, 70 );
|
||||
FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 80, 155, 0, 70 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Highlight the killers name - overlay the background in red, then draw the score text over it
|
||||
FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 255, 0, 0, ( (float)15 * (float)( m_fLastKillTime - gHUD.m_flTime ) ) );
|
||||
FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 255, 0, 0, ( (float)15 * (float)( m_fLastKillTime - gHUD.m_flTime ) ) );
|
||||
}
|
||||
}
|
||||
else if( pl_info->thisplayer ) // if it is their name, draw it a different color
|
||||
{
|
||||
// overlay the background in blue, then draw the score text over it
|
||||
FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 );
|
||||
FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 );
|
||||
}
|
||||
|
||||
// draw their name (left to right)
|
||||
gHUD.DrawHudString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b );
|
||||
DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b );
|
||||
|
||||
// draw kills (right to left)
|
||||
xpos = KILLS_RANGE_MAX + xpos_rel;
|
||||
|
@ -408,7 +436,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
|||
|
||||
// draw divider
|
||||
xpos = DIVIDER_POS + xpos_rel;
|
||||
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b );
|
||||
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b );
|
||||
|
||||
// draw deaths
|
||||
xpos = DEATHS_RANGE_MAX + xpos_rel;
|
||||
|
@ -435,7 +463,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
|
|||
|
||||
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2 ) + PL_RANGE_MIN + xpos_rel + 25;
|
||||
|
||||
gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b );
|
||||
DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b );
|
||||
}
|
||||
|
||||
pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again
|
||||
|
|
|
@ -104,7 +104,7 @@ int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *p
|
|||
}
|
||||
|
||||
// add the icon to the icon list, and set it's drawing color
|
||||
void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned char green, unsigned char blue )
|
||||
void CHudStatusIcons::EnableIcon( const char *pszIconName, unsigned char red, unsigned char green, unsigned char blue )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -149,7 +149,7 @@ void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned
|
|||
}
|
||||
}
|
||||
|
||||
void CHudStatusIcons::DisableIcon( char *pszIconName )
|
||||
void CHudStatusIcons::DisableIcon( const char *pszIconName )
|
||||
{
|
||||
// find the sprite is in the current list
|
||||
for( int i = 0; i < MAX_ICONSPRITES; i++ )
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#pragma once
|
||||
#if !defined( STUDIO_UTIL_H )
|
||||
#define STUDIO_UTIL_H
|
||||
#if defined( WIN32 )
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
|
|
|
@ -45,14 +45,15 @@ int CHudTextMessage::Init( void )
|
|||
char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, int buffer_size )
|
||||
{
|
||||
char *dst = dst_buffer;
|
||||
for( char *src = (char*)msg; *src != 0 && buffer_size > 0; buffer_size-- )
|
||||
for( char *src = (char*)msg; *src != 0 && ( buffer_size - 1 ) > 0; buffer_size-- )
|
||||
{
|
||||
if( *src == '#' )
|
||||
{
|
||||
// cut msg name out of string
|
||||
static char word_buf[255];
|
||||
char *wdst = word_buf, *word_start = src;
|
||||
for( ++src; ( *src >= 'A' && *src <= 'z' ) || ( *src >= '0' && *src <= '9' ); wdst++, src++ )
|
||||
int wordbuf_size = (int)sizeof(word_buf);
|
||||
for( ++src; ( ( *src >= 'A' && *src <= 'z' ) || ( *src >= '0' && *src <= '9' ) ) && ( wordbuf_size - 1 ) > 0; wdst++, src++, wordbuf_size-- )
|
||||
{
|
||||
*wdst = *src;
|
||||
}
|
||||
|
@ -69,21 +70,20 @@ char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, in
|
|||
}
|
||||
|
||||
// copy string into message over the msg name
|
||||
for( char *wsrc = (char*)clmsg->pMessage; *wsrc != 0; wsrc++, dst++ )
|
||||
for( char *wsrc = (char*)clmsg->pMessage; *wsrc != 0 && ( buffer_size - 1 ) > 0; wsrc++, dst++, buffer_size-- )
|
||||
{
|
||||
*dst = *wsrc;
|
||||
}
|
||||
*dst = 0;
|
||||
buffer_size++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dst = *src;
|
||||
dst++, src++;
|
||||
*dst = 0;
|
||||
}
|
||||
}
|
||||
|
||||
dst_buffer[buffer_size - 1] = 0; // ensure null termination
|
||||
*dst = 0; // ensure null termination
|
||||
return dst_buffer;
|
||||
}
|
||||
|
||||
|
@ -91,12 +91,12 @@ char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, in
|
|||
char *CHudTextMessage::BufferedLocaliseTextString( const char *msg )
|
||||
{
|
||||
static char dst_buffer[1024];
|
||||
LocaliseTextString( msg, dst_buffer, 1024 );
|
||||
LocaliseTextString( msg, dst_buffer, sizeof(dst_buffer) );
|
||||
return dst_buffer;
|
||||
}
|
||||
|
||||
// Simplified version of LocaliseTextString; assumes string is only one word
|
||||
char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
||||
const char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
||||
{
|
||||
if( !msg )
|
||||
return "";
|
||||
|
@ -108,7 +108,7 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
|||
client_textmessage_t *clmsg = TextMessageGet( msg + 1 );
|
||||
|
||||
if( !clmsg || !(clmsg->pMessage) )
|
||||
return (char*)msg; // lookup failed, so return the original string
|
||||
return msg; // lookup failed, so return the original string
|
||||
|
||||
if( msg_dest )
|
||||
{
|
||||
|
@ -118,12 +118,12 @@ char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
|
|||
*msg_dest = -clmsg->effect;
|
||||
}
|
||||
|
||||
return (char*)clmsg->pMessage;
|
||||
return clmsg->pMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
// nothing special about this message, so just return the same string
|
||||
return (char*)msg;
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,42 +162,39 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
|
|||
|
||||
int msg_dest = READ_BYTE();
|
||||
|
||||
static char szBuf[6][128];
|
||||
char *msg_text = LookupString( READ_STRING(), &msg_dest );
|
||||
msg_text = strcpy( szBuf[0], msg_text );
|
||||
#define MSG_BUF_SIZE 128
|
||||
char szBuf[6][MSG_BUF_SIZE];
|
||||
|
||||
strncpy( szBuf[0], LookupString( READ_STRING(), &msg_dest ), MSG_BUF_SIZE - 1 );
|
||||
szBuf[0][MSG_BUF_SIZE - 1] = '\0';
|
||||
|
||||
for( int i = 1; i <= 4; i++ )
|
||||
{
|
||||
// keep reading strings and using C format strings for subsituting the strings into the localised text string
|
||||
char *sstr1 = LookupString( READ_STRING() );
|
||||
sstr1 = strcpy( szBuf[1], sstr1 );
|
||||
StripEndNewlineFromString( sstr1 ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
|
||||
char *sstr2 = LookupString( READ_STRING() );
|
||||
sstr2 = strcpy( szBuf[2], sstr2 );
|
||||
StripEndNewlineFromString( sstr2 );
|
||||
char *sstr3 = LookupString( READ_STRING() );
|
||||
sstr3 = strcpy( szBuf[3], sstr3 );
|
||||
StripEndNewlineFromString( sstr3 );
|
||||
char *sstr4 = LookupString( READ_STRING() );
|
||||
sstr4 = strcpy( szBuf[4], sstr4 );
|
||||
StripEndNewlineFromString( sstr4 );
|
||||
strncpy( szBuf[i], LookupString( READ_STRING() ), MSG_BUF_SIZE - 1 );
|
||||
szBuf[i][MSG_BUF_SIZE - 1] = '\0';
|
||||
StripEndNewlineFromString( szBuf[i] ); // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
|
||||
}
|
||||
|
||||
char *psz = szBuf[5];
|
||||
|
||||
switch( msg_dest )
|
||||
{
|
||||
case HUD_PRINTCENTER:
|
||||
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||
CenterPrint( ConvertCRtoNL( psz ) );
|
||||
break;
|
||||
case HUD_PRINTNOTIFY:
|
||||
psz[0] = 1; // mark this message to go into the notify buffer
|
||||
sprintf( psz + 1, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||
_snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||
ConsolePrint( ConvertCRtoNL( psz ) );
|
||||
break;
|
||||
case HUD_PRINTTALK:
|
||||
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
|
||||
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE );
|
||||
break;
|
||||
case HUD_PRINTCONSOLE:
|
||||
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
|
||||
_snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
|
||||
ConsolePrint( ConvertCRtoNL( psz ) );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -112,19 +112,9 @@ Render any triangles with transparent rendermode needs here
|
|||
*/
|
||||
void DLLEXPORT HUD_DrawTransparentTriangles( void )
|
||||
{
|
||||
gHUD.m_Scope.DrawScope();
|
||||
#if defined( TEST_IT )
|
||||
// Draw_Triangles();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
HUD_DrawOrthoTriangles
|
||||
Orthogonal Triangles -- (relative to resolution,
|
||||
smackdab on the screen) add them here
|
||||
=================
|
||||
*/
|
||||
void HUD_DrawOrthoTriangles( void )
|
||||
{
|
||||
gHUD.m_Scope.DrawScope();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
// Vector.h
|
||||
// A subset of the extdll.h in the project HL Entity DLL
|
||||
//
|
||||
#pragma once
|
||||
#ifndef UTIL_VECTOR_H
|
||||
#define UTIL_VECTOR_H
|
||||
|
||||
// Misc C-runtime library headers
|
||||
#include "stdio.h"
|
||||
|
@ -23,7 +26,7 @@
|
|||
|
||||
// Header file containing definition of globalvars_t and entvars_t
|
||||
typedef unsigned int func_t; //
|
||||
typedef unsigned int string_t; // from engine's pr_comp.h;
|
||||
typedef int string_t; // from engine's pr_comp.h;
|
||||
typedef float vec_t; // needed before including progdefs.h
|
||||
|
||||
//=========================================================
|
||||
|
@ -124,3 +127,4 @@ inline float DotProduct( const Vector& a, const Vector& b) { return( a.x * b.x +
|
|||
inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x ); }
|
||||
|
||||
#define vec3_t Vector
|
||||
#endif // UTIL_VECTOR_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include "shake.h"
|
||||
#include "hltv.h"
|
||||
|
||||
extern bool bDrawScope;
|
||||
// Spectator Mode
|
||||
extern "C"
|
||||
{
|
||||
|
@ -78,6 +79,7 @@ extern cvar_t *cl_forwardspeed;
|
|||
extern cvar_t *chase_active;
|
||||
extern cvar_t *scr_ofsx, *scr_ofsy, *scr_ofsz;
|
||||
extern cvar_t *cl_vsmoothing;
|
||||
extern cvar_t *cl_viewbob;
|
||||
extern Vector dead_viewangles;
|
||||
|
||||
#define CAM_MODE_RELAX 1
|
||||
|
@ -90,7 +92,7 @@ float v_cameraFocusAngle = 35.0f;
|
|||
int v_cameraMode = CAM_MODE_FOCUS;
|
||||
qboolean v_resetCamera = 1;
|
||||
|
||||
vec3_t ev_punchangle;
|
||||
vec3_t g_ev_punchangle;
|
||||
|
||||
cvar_t *scr_ofsx;
|
||||
cvar_t *scr_ofsy;
|
||||
|
@ -351,11 +353,11 @@ V_CalcIntermissionRefdef
|
|||
*/
|
||||
void V_CalcIntermissionRefdef( struct ref_params_s *pparams )
|
||||
{
|
||||
cl_entity_t *ent, *view;
|
||||
cl_entity_t /**ent,*/ *view;
|
||||
float old;
|
||||
|
||||
// ent is the player model ( visible when out of body )
|
||||
ent = gEngfuncs.GetLocalPlayer();
|
||||
//ent = gEngfuncs.GetLocalPlayer();
|
||||
|
||||
// view is the weapon model (only visible from inside body )
|
||||
view = gEngfuncs.GetViewModel();
|
||||
|
@ -527,7 +529,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
V_AddIdle( pparams );
|
||||
|
||||
// offsets
|
||||
if ( pparams->health <= 0 )
|
||||
if( pparams->health <= 0 )
|
||||
{
|
||||
VectorCopy( dead_viewangles, angles );
|
||||
}
|
||||
|
@ -598,6 +600,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
view->angles[ROLL] -= bob * 1;
|
||||
view->angles[PITCH] -= bob * 0.3;
|
||||
|
||||
if( cl_viewbob && cl_viewbob->value )
|
||||
VectorCopy( view->angles, view->curstate.angles );
|
||||
|
||||
// pushing the view origin down off of the same X/Z plane as the ent's origin will give the
|
||||
// gun a very nice 'shifting' effect when the player looks up/down. If there is a problem
|
||||
// with view model distortion, this may be a cause. (SJB).
|
||||
|
@ -626,9 +631,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
VectorAdd( pparams->viewangles, pparams->punchangle, pparams->viewangles );
|
||||
|
||||
// Include client side punch, too
|
||||
VectorAdd( pparams->viewangles, (float *)&ev_punchangle, pparams->viewangles );
|
||||
VectorAdd( pparams->viewangles, (float *)&g_ev_punchangle, pparams->viewangles );
|
||||
|
||||
V_DropPunchAngle( pparams->frametime, (float *)&ev_punchangle );
|
||||
V_DropPunchAngle( pparams->frametime, (float *)&g_ev_punchangle );
|
||||
|
||||
// smooth out stair step ups
|
||||
#if 1
|
||||
|
@ -758,6 +763,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
|
||||
// Store off overridden viewangles
|
||||
v_angles = pparams->viewangles;
|
||||
bDrawScope = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1307,7 +1313,7 @@ void V_GetMapChasePosition( int target, float *cl_angles, float *origin, float *
|
|||
|
||||
int V_FindViewModelByWeaponModel( int weaponindex )
|
||||
{
|
||||
static char *modelmap[][2] =
|
||||
static const char *modelmap[][2] =
|
||||
{
|
||||
{ "models/p_bradnailer.mdl", "models/v_bradnailer.mdl" },
|
||||
{ "models/p_cmlwbr.mdl", "models/v_cmlwbr.mdl" },
|
||||
|
@ -1321,7 +1327,7 @@ int V_FindViewModelByWeaponModel( int weaponindex )
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
struct model_s * weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
|
||||
struct model_s *weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
|
||||
|
||||
if( weaponModel )
|
||||
{
|
||||
|
@ -1569,7 +1575,7 @@ Client side punch effect
|
|||
*/
|
||||
void V_PunchAxis( int axis, float punch )
|
||||
{
|
||||
ev_punchangle[axis] = punch;
|
||||
g_ev_punchangle[axis] = punch;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
if(WIN32)
|
||||
# Windows XP compatible platform toolset. Must be set before project(),
|
||||
# otherwise change of CMAKE_*_TOOLSET will take no effect.
|
||||
# We get VS version from the generator name because neither MSVC* nor other
|
||||
# variables that describe the compiler aren't available before project().
|
||||
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
|
||||
if(${CMAKE_MATCH_1} LESS 11)
|
||||
# Nothing. Older VS does support XP by default.
|
||||
elseif(${CMAKE_MATCH_1} EQUAL 11)
|
||||
# Visual Studio 11 2012
|
||||
set(CMAKE_GENERATOR_TOOLSET "v110_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
|
||||
set(CMAK_VS_PLATFORM_TOOLSET "v110_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
|
||||
elseif (${CMAKE_MATCH_1} EQUAL 12)
|
||||
# Visual Studio 12 2013
|
||||
set(CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
|
||||
set(CMAKE_VS_PLATFORM_TOOLSET "v120_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
|
||||
elseif (${CMAKE_MATCH_1} EQUAL 14)
|
||||
# Visual Studio 14 2015
|
||||
set(CMAKE_GENERATOR_TOOLSET "v140_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
|
||||
set(CMAKE_VS_PLATFORM_TOOLSET "v140_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
|
||||
elseif (${CMAKE_MATCH_1} EQUAL 15)
|
||||
# Visual Studio 15 2017
|
||||
set(CMAKE_GENERATOR_TOOLSET "v141_xp" CACHE STRING "CMAKE_GENERATOR_TOOLSET" FORCE)
|
||||
set(CMAKE_VS_PLATFORM_TOOLSET "v141_xp" CACHE STRING "CMAKE_VS_PLATFORM_TOOLSET" FORCE)
|
||||
else()
|
||||
message(WARNING "WARNING: You maybe building without Windows XP compability. See which toolchain version Visual Studio provides, and say cmake to use it: cmake -G \"Visual Studio XX\" -T \"vXXX_xp\"")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef BEAMDEF_H
|
||||
#define BEAMDEF_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef BSPFILE_H
|
||||
#define BSPFILE_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef CL_ENTITY_H
|
||||
#define CL_ENTITY_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef COM_MODEL_H
|
||||
#define COM_MODEL_H
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#pragma once
|
||||
#ifndef CON_NPRINT_H
|
||||
#define CON_NPRINT_H
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#pragma once
|
||||
#ifndef CONST_H
|
||||
#define CONST_H
|
||||
//
|
||||
|
@ -110,7 +111,9 @@
|
|||
#define EF_NOINTERP 32 // don't interpolate the next frame
|
||||
#define EF_LIGHT 64 // rocket flare glow sprite
|
||||
#define EF_NODRAW 128 // don't draw entity
|
||||
|
||||
#define EF_NIGHTVISION 256 // player nightvision
|
||||
#define EF_SNIPERLASER 512 // sniper laser effect
|
||||
#define EF_FIBERCAMERA 1024 // fiber camera
|
||||
|
||||
|
||||
#define EF_NOREFLECT (1<<24) // Entity won't reflecting in mirrors
|
||||
|
@ -531,6 +534,7 @@
|
|||
#define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.
|
||||
#define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque
|
||||
#define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube.
|
||||
#define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered non-opaque with additive
|
||||
|
||||
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
|
||||
// byte (entity index of player)
|
||||
|
@ -623,6 +627,7 @@
|
|||
#define CHAN_STATIC 6 // allocate channel from the static area
|
||||
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
|
||||
#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
|
||||
#define CHAN_BOT 501 // channel used for bot chatter.
|
||||
|
||||
// attenuation values
|
||||
#define ATTN_NONE 0
|
||||
|
@ -724,11 +729,12 @@ enum
|
|||
kRenderFxDeadPlayer, // kRenderAmt is the player index
|
||||
kRenderFxExplode, // Scale up really big!
|
||||
kRenderFxGlowShell, // Glowing Shell
|
||||
kRenderFxClampMinScale // Keep this sprite from getting very small (SPRITES only!)
|
||||
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
||||
kRenderFxLightMultiplier //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier
|
||||
};
|
||||
|
||||
typedef unsigned int func_t;
|
||||
typedef unsigned int string_t;
|
||||
typedef int string_t;
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#pragma once
|
||||
#ifndef CVARDEF_H
|
||||
#define CVARDEF_H
|
||||
|
||||
|
@ -24,11 +25,12 @@
|
|||
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
||||
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
||||
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
||||
#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar
|
||||
|
||||
typedef struct cvar_s
|
||||
{
|
||||
char *name;
|
||||
char *string;
|
||||
const char *name;
|
||||
const char *string;
|
||||
int flags;
|
||||
float value;
|
||||
struct cvar_s *next;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef DEMO_API_H
|
||||
#define DEMO_API_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef DLIGHT_H
|
||||
#define DLIGHT_H
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#pragma once
|
||||
#ifndef ENTITY_STATE_H
|
||||
#define ENTITY_STATE_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef ENTITY_TYPES_H
|
||||
#define ENTITY_TYPES_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef EVENT_API_H
|
||||
#define EVENT_API_H
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#pragma once
|
||||
#ifndef EVENT_ARGS_H
|
||||
#define EVENT_ARGS_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef EVENT_FLAGS_H
|
||||
#define EVENT_FLAGS_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef GAMEINFO_H
|
||||
#define GAMEINFO_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef HLTV_H
|
||||
#define HLTV_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef IVOICETWEAK_H
|
||||
#define IVOICETWEAK_H
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef LIGHTSTYLE_H
|
||||
#define LIGHTSTYLE_H
|
||||
|
||||
|
|
|
@ -13,12 +13,19 @@
|
|||
*
|
||||
****/
|
||||
// mathlib.h
|
||||
|
||||
#pragma once
|
||||
#ifndef MATHLIB_H
|
||||
#define MATHLIB_H
|
||||
#include <math.h>
|
||||
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec2_t[2];
|
||||
|
||||
#ifndef DID_VEC3_T_DEFINE
|
||||
#define DID_VEC3_T_DEFINE
|
||||
typedef vec_t vec3_t[3];
|
||||
#endif
|
||||
|
||||
typedef vec_t vec4_t[4]; // x,y,z,w
|
||||
|
||||
#ifndef M_PI
|
||||
|
@ -93,3 +100,4 @@ float anglemod(float a);
|
|||
) \
|
||||
: \
|
||||
BoxOnPlaneSide( (emins), (emaxs), (p)))
|
||||
#endif // MATHLIB_H
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef NET_API_H
|
||||
#define NET_API_H
|
||||
|
||||
|
@ -94,4 +94,4 @@ typedef struct net_api_s
|
|||
void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize );
|
||||
} net_api_t;
|
||||
|
||||
#endif//NET_APIH
|
||||
#endif // NET_APIH
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue