mirror of https://github.com/FWGS/hlsdk-xash3d
Merge branch 'master' into sci
This commit is contained in:
commit
bd09e35be3
|
@ -6,4 +6,21 @@
|
|||
*.a
|
||||
*.framework
|
||||
*.exe
|
||||
build/
|
||||
*.dll
|
||||
*.pdb
|
||||
build/
|
||||
CMakeLists.txt.user
|
||||
cmake_install.cmake
|
||||
*.orig
|
||||
*.cbp
|
||||
*.dsw
|
||||
*.vsxproj
|
||||
*.vsproj
|
||||
*.sln
|
||||
.waf-*
|
||||
waf-*
|
||||
.waf3-*
|
||||
waf3-*
|
||||
.lock*
|
||||
*.pyc
|
||||
.vscode/
|
|
@ -8,7 +8,9 @@ os:
|
|||
sudo: true
|
||||
before_script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gcc-multilib g++-multilib; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "gcc" ]]; then sudo apt-get install mingw-w64-i686-dev binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686; fi
|
||||
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_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VOICEMGR=1 && make -j3 && rm -rf *
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "gcc" ]]; then cd ..; mkdir build-mingw; cd build-mingw; cmake ../ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ && make -j3; fi
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
#
|
||||
|
||||
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)
|
||||
|
||||
#--------------
|
||||
|
@ -31,6 +37,12 @@ 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,17 +50,52 @@ 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")
|
||||
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()
|
||||
|
||||
# Xash3D FWGS Library Naming Scheme compliance
|
||||
# see documentation: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/library-naming.md
|
||||
include(LibraryNaming)
|
||||
|
||||
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(NOT MSVC)
|
||||
#add_compile_options(-Wempty-body) # GCC/Clang flag
|
||||
add_compile_options(-Wreturn-type) # GCC/Clang flag
|
||||
endif()
|
||||
|
||||
|
||||
if(BUILD_CLIENT)
|
||||
add_subdirectory(cl_dll)
|
||||
endif()
|
||||
|
@ -59,4 +106,4 @@ endif()
|
|||
|
||||
if(NOT BUILD_SERVER AND NOT BUILD_CLIENT)
|
||||
error("Nothing to build")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
Half Life 1 SDK LICENSE
|
||||
======================
|
||||
|
||||
Half Life 1 SDK Copyright(c) Valve Corp.
|
||||
|
||||
THIS DOCUMENT DESCRIBES A CONTRACT BETWEEN YOU AND VALVE CORPORATION ("Valve").
|
||||
PLEASE READ IT BEFORE DOWNLOADING OR USING THE HALF LIFE 1 SDK ("SDK"). BY
|
||||
DOWNLOADING AND/OR USING THE HALF LIFE 1 SDK YOU ACCEPT THIS LICENSE. IF YOU DO
|
||||
NOT AGREE TO THE TERMS OF THIS LICENSE PLEASE DON'T DOWNLOAD OR USE THE SDK.
|
||||
|
||||
You may, free of charge, download and use the SDK to develop a modified Valve
|
||||
game running on the Half-Life 1 engine. You may distribute your modified Valve
|
||||
game in source and object code form, but only for free. Terms of use for Valve
|
||||
games are found in the Steam Subscriber Agreement located here:
|
||||
http://store.steampowered.com/subscriber_agreement/
|
||||
|
||||
You may copy, modify, and distribute the SDK and any modifications you make to
|
||||
the SDK in source and object code form, but only for free. Any distribution of
|
||||
this SDK must include this LICENSE file.
|
||||
|
||||
Any distribution of the SDK or a substantial portion of the SDK must include
|
||||
the above copyright notice and the following:
|
||||
|
||||
DISCLAIMER OF WARRANTIES. THE HALF LIFE 1 SDK AND ANY OTHER MATERIAL
|
||||
DOWNLOADED BY LICENSEE IS PROVIDED "AS IS". VALVE AND ITS SUPPLIERS
|
||||
DISCLAIM ALL WARRANTIES WITH RESPECT TO THE SDK, EITHER EXPRESS OR IMPLIED,
|
||||
INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
NON-INFRINGEMENT, TITLE AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
LIMITATION OF LIABILITY. IN NO EVENT SHALL VALVE OR ITS SUPPLIERS BE LIABLE
|
||||
FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER
|
||||
(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
|
||||
BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY
|
||||
LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE ENGINE AND/OR THE
|
||||
SDK, EVEN IF VALVE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
|
||||
If you would like to use the SDK for a commercial purpose, please contact Valve
|
||||
at sourceengine@valvesoftware.com.
|
134
README.md
134
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,137 @@ 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
|
||||
|
||||
TODO
|
||||
#### Using msvc
|
||||
|
||||
### Linux
|
||||
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
|
||||
|
||||
### OS X
|
||||
### Unix-like
|
||||
|
||||
TODO
|
||||
To use waf, you need to install python (2.7 minimum)
|
||||
|
||||
### FreeBSD
|
||||
|
||||
```
|
||||
cd dlls
|
||||
gmake CXX=clang++ CC=clang
|
||||
cd ../cl_dll
|
||||
gmake CXX=clang++ CC=clang
|
||||
```
|
||||
(./waf configure -T release)
|
||||
(./waf)
|
||||
|
||||
### 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 waf:
|
||||
|
||||
./waf configure -T release --enable-goldsrc-support
|
||||
|
||||
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)
|
||||
|
||||
|
@ -69,6 +68,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
|
||||
|
@ -90,17 +91,25 @@ 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
|
||||
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 \
|
||||
$(LOCAL_PATH)/../engine \
|
||||
$(LOCAL_PATH)/../game_shared \
|
||||
$(LOCAL_PATH)/../dlls \
|
||||
$(LOCAL_PATH)/../pm_shared
|
||||
$(LOCAL_PATH)/../pm_shared \
|
||||
$(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,25 +25,48 @@ 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}")
|
||||
include(CheckIncludeFile)
|
||||
check_include_file("tgmath.h" HAVE_TGMATH_H)
|
||||
if(HAVE_TGMATH_H)
|
||||
add_definitions(-DHAVE_TGMATH_H)
|
||||
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
|
||||
add_definitions(-DCLIENT_WEAPONS -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
|
||||
ev_hldm.cpp
|
||||
ev_hldm.cpp
|
||||
hl/hl_baseentity.cpp
|
||||
hl/hl_events.cpp
|
||||
hl/hl_objects.cpp
|
||||
|
@ -70,7 +93,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
|
||||
|
@ -88,10 +113,10 @@ set (CLDLL_SOURCES
|
|||
tri.cpp
|
||||
util.cpp
|
||||
view.cpp
|
||||
input_xash3d.cpp
|
||||
scoreboard.cpp
|
||||
MOTD.cpp)
|
||||
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public)
|
||||
|
||||
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include)
|
||||
|
||||
if(USE_VOICEMGR)
|
||||
#set(CLDLL_SOURCES
|
||||
|
@ -101,7 +126,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
|
||||
if(WIN32)
|
||||
target_link_libraries( ${CLDLL_LIBRARY} user32.lib )
|
||||
endif()
|
||||
|
||||
set_target_properties (${CLDLL_LIBRARY} PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE 1)
|
||||
|
||||
if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(CLDLL_NAME "client")
|
||||
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:
|
||||
//
|
||||
|
@ -18,8 +18,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "studio_util.h"
|
||||
#include "r_studioint.h"
|
||||
|
|
|
@ -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
|
||||
|
||||
/*
|
||||
====================
|
||||
|
@ -23,4 +21,4 @@ public:
|
|||
CGameStudioModelRenderer( void );
|
||||
};
|
||||
|
||||
#endif // GAMESTUDIOMODELRENDERER_H
|
||||
#endif // GAMESTUDIOMODELRENDERER_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -18,8 +18,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "studio_util.h"
|
||||
#include "r_studioint.h"
|
||||
|
|
|
@ -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
|
||||
|
||||
/*
|
||||
====================
|
||||
|
@ -52,4 +50,4 @@ private:
|
|||
bool m_bLocal;
|
||||
};
|
||||
|
||||
#endif // GAMESTUDIOMODELRENDERER_H
|
||||
#endif // GAMESTUDIOMODELRENDERER_H
|
||||
|
|
|
@ -56,7 +56,7 @@ void CHudMOTD::Reset( void )
|
|||
m_bShow = 0;
|
||||
}
|
||||
|
||||
#define LINE_HEIGHT 13
|
||||
#define LINE_HEIGHT (gHUD.m_scrinfo.iCharHeight)
|
||||
#define ROW_GAP 13
|
||||
#define ROW_RANGE_MIN 30
|
||||
#define ROW_RANGE_MAX ( ScreenHeight - 100 )
|
||||
|
@ -80,13 +80,13 @@ int CHudMOTD::Draw( float fTime )
|
|||
{
|
||||
ypos = ROW_RANGE_MIN + 7 + scroll;
|
||||
if( ypos > ROW_RANGE_MIN + 4 )
|
||||
scroll-= ( ypos - ( ROW_RANGE_MIN + 4 ) ) / 3.0;
|
||||
scroll-= ( ypos - ( ROW_RANGE_MIN + 4 ) ) / 3.0f;
|
||||
if( ypos + height < ROW_RANGE_MAX )
|
||||
scroll+= ( ROW_RANGE_MAX - ( ypos + height ) ) / 3.0;
|
||||
scroll+= ( ROW_RANGE_MAX - ( ypos + height ) ) / 3.0f;
|
||||
ypos_r = ROW_RANGE_MIN;
|
||||
height = ROW_RANGE_MAX;
|
||||
}
|
||||
int ymax = ypos + height;
|
||||
// int ymax = ypos + height;
|
||||
if( xmax > ScreenWidth - 30 ) xmax = ScreenWidth - 30;
|
||||
gHUD.DrawDarkRectangle( xpos - 5, ypos_r - 5, xmax - xpos + 10, height + 10 );
|
||||
while( *ch )
|
||||
|
@ -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;
|
||||
|
||||
|
@ -130,7 +130,7 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
|
|||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
int is_finished = READ_BYTE();
|
||||
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) );
|
||||
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) - 1 );
|
||||
|
||||
if( is_finished )
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
|
|||
if( length > m_iMaxLength )
|
||||
{
|
||||
m_iMaxLength = length;
|
||||
length = 0;
|
||||
// length = 0;
|
||||
}
|
||||
m_bShow = true;
|
||||
}
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
CC?=gcc
|
||||
CXX?=g++
|
||||
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/glock.cpp
|
||||
SRCS+=../dlls/hornetgun.cpp
|
||||
#SRCS+=../common/interface.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+=../game_shared/voice_banmgr.cpp
|
||||
#SRCS+=../game_shared/voice_status.cpp
|
||||
SRCS+=./ammo.cpp
|
||||
SRCS+=./ammo_secondary.cpp
|
||||
SRCS+=./ammohistory.cpp
|
||||
SRCS+=./battery.cpp
|
||||
SRCS+=./cdll_int.cpp
|
||||
SRCS+=./com_weapons.cpp
|
||||
SRCS+=./death.cpp
|
||||
SRCS+=./demo.cpp
|
||||
SRCS+=./entity.cpp
|
||||
SRCS+=./ev_common.cpp
|
||||
SRCS+=./events.cpp
|
||||
SRCS+=./flashlight.cpp
|
||||
SRCS+=./GameStudioModelRenderer.cpp
|
||||
SRCS+=./geiger.cpp
|
||||
SRCS+=./health.cpp
|
||||
SRCS+=./hud.cpp
|
||||
SRCS+=./hud_msg.cpp
|
||||
SRCS+=./hud_redraw.cpp
|
||||
#SRCS+=./hud_servers.cpp
|
||||
SRCS+=./hud_spectator.cpp
|
||||
SRCS+=./hud_update.cpp
|
||||
SRCS+=./in_camera.cpp
|
||||
SRCS+=./input.cpp
|
||||
#SRCS+=./inputw32.cpp
|
||||
SRCS+=./menu.cpp
|
||||
SRCS+=./message.cpp
|
||||
SRCS+=./overview.cpp
|
||||
SRCS+=./parsemsg.cpp
|
||||
SRCS_C+=../pm_shared/pm_debug.c
|
||||
SRCS_C+=../pm_shared/pm_math.c
|
||||
SRCS_C+=../pm_shared/pm_shared.c
|
||||
SRCS+=./saytext.cpp
|
||||
SRCS+=./status_icons.cpp
|
||||
SRCS+=./statusbar.cpp
|
||||
SRCS+=./studio_util.cpp
|
||||
SRCS+=./StudioModelRenderer.cpp
|
||||
SRCS+=./text_message.cpp
|
||||
SRCS+=./train.cpp
|
||||
SRCS+=./tri.cpp
|
||||
SRCS+=./util.cpp
|
||||
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
|
||||
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 ($(shell uname -s),Linux)
|
||||
LIBS=$(LIBS) -ldl
|
||||
endif
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@
|
||||
|
||||
%.o : %.cpp
|
||||
$(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@
|
||||
client.so : $(OBJS)
|
||||
$(CXX) $(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:
|
||||
//
|
||||
|
@ -20,8 +20,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "studio_util.h"
|
||||
#include "r_studioint.h"
|
||||
|
@ -138,27 +136,27 @@ void CStudioModelRenderer::StudioCalcBoneAdj( float dadt, float *adj, const byte
|
|||
int a, b;
|
||||
a = ( pcontroller1[j] + 128 ) % 256;
|
||||
b = ( pcontroller2[j] + 128 ) % 256;
|
||||
value = ( ( a * dadt ) + ( b * ( 1 - dadt ) ) - 128 ) * ( 360.0 / 256.0 ) + pbonecontroller[j].start;
|
||||
value = ( ( a * dadt ) + ( b * ( 1.0f - dadt ) ) - 128.0f ) * ( 360.0f / 256.0f ) + pbonecontroller[j].start;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = ( ( pcontroller1[i] * dadt + ( pcontroller2[i] ) * ( 1.0 - dadt ) ) ) * ( 360.0 / 256.0 ) + pbonecontroller[j].start;
|
||||
value = ( ( pcontroller1[i] * dadt + ( pcontroller2[i] ) * ( 1.0f - dadt ) ) ) * ( 360.0f / 256.0f ) + pbonecontroller[j].start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value = ( pcontroller1[i] * dadt + pcontroller2[i] * ( 1.0 - dadt ) ) / 255.0;
|
||||
if( value < 0 ) value = 0;
|
||||
if( value > 1.0 ) value = 1.0;
|
||||
value = ( 1.0 - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
|
||||
value = ( pcontroller1[i] * dadt + pcontroller2[i] * ( 1.0f - dadt ) ) / 255.0f;
|
||||
if( value < 0.0f ) value = 0.0f;
|
||||
if( value > 1.0f ) value = 1.0f;
|
||||
value = ( 1.0f - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
|
||||
}
|
||||
// Con_DPrintf( "%d %d %f : %f\n", m_pCurrentEntity->curstate.controller[j], m_pCurrentEntity->latched.prevcontroller[j], value, dadt );
|
||||
}
|
||||
else
|
||||
{
|
||||
value = mouthopen / 64.0;
|
||||
if( value > 1.0 ) value = 1.0;
|
||||
value = ( 1.0 - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
|
||||
value = mouthopen / 64.0f;
|
||||
if( value > 1.0f ) value = 1.0f;
|
||||
value = ( 1.0f - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
|
||||
// Con_DPrintf( "%d %f\n", mouthopen, value );
|
||||
}
|
||||
switch( pbonecontroller[j].type & STUDIO_TYPES )
|
||||
|
@ -166,7 +164,7 @@ void CStudioModelRenderer::StudioCalcBoneAdj( float dadt, float *adj, const byte
|
|||
case STUDIO_XR:
|
||||
case STUDIO_YR:
|
||||
case STUDIO_ZR:
|
||||
adj[j] = value * ( M_PI / 180.0 );
|
||||
adj[j] = value * ( M_PI_F / 180.0f );
|
||||
break;
|
||||
case STUDIO_X:
|
||||
case STUDIO_Y:
|
||||
|
@ -305,7 +303,7 @@ void CStudioModelRenderer::StudioCalcBonePosition( int frame, float s, mstudiobo
|
|||
// and there's more data in the span
|
||||
if( panimvalue->num.valid > k + 1 )
|
||||
{
|
||||
pos[j] += ( panimvalue[k + 1].value * ( 1.0 - s ) + s * panimvalue[k + 2].value ) * pbone->scale[j];
|
||||
pos[j] += ( panimvalue[k + 1].value * ( 1.0f - s ) + s * panimvalue[k + 2].value ) * pbone->scale[j];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -317,7 +315,7 @@ void CStudioModelRenderer::StudioCalcBonePosition( int frame, float s, mstudiobo
|
|||
// are we at the end of the repeating values section and there's another section with data?
|
||||
if( panimvalue->num.total <= k + 1 )
|
||||
{
|
||||
pos[j] += ( panimvalue[panimvalue->num.valid].value * ( 1.0 - s ) + s * panimvalue[panimvalue->num.valid + 2].value ) * pbone->scale[j];
|
||||
pos[j] += ( panimvalue[panimvalue->num.valid].value * ( 1.0f - s ) + s * panimvalue[panimvalue->num.valid + 2].value ) * pbone->scale[j];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -344,12 +342,12 @@ void CStudioModelRenderer::StudioSlerpBones( vec4_t q1[], float pos1[][3], vec4_
|
|||
vec4_t q3;
|
||||
float s1;
|
||||
|
||||
if( s < 0 )
|
||||
s = 0;
|
||||
else if( s > 1.0 )
|
||||
s = 1.0;
|
||||
if( s < 0.0f )
|
||||
s = 0.0f;
|
||||
else if( s > 1.0f )
|
||||
s = 1.0f;
|
||||
|
||||
s1 = 1.0 - s;
|
||||
s1 = 1.0f - s;
|
||||
|
||||
for( i = 0; i < m_pStudioHeader->numbones; i++ )
|
||||
{
|
||||
|
@ -410,17 +408,17 @@ void CStudioModelRenderer::StudioPlayerBlend( mstudioseqdesc_t *pseqdesc, int *p
|
|||
*pBlend = ( *pPitch * 3 );
|
||||
if( *pBlend < pseqdesc->blendstart[0] )
|
||||
{
|
||||
*pPitch -= pseqdesc->blendstart[0] / 3.0;
|
||||
*pPitch -= pseqdesc->blendstart[0] / 3.0f;
|
||||
*pBlend = 0;
|
||||
}
|
||||
else if( *pBlend > pseqdesc->blendend[0] )
|
||||
{
|
||||
*pPitch -= pseqdesc->blendend[0] / 3.0;
|
||||
*pPitch -= pseqdesc->blendend[0] / 3.0f;
|
||||
*pBlend = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pseqdesc->blendend[0] - pseqdesc->blendstart[0] < 0.1 ) // catch qc error
|
||||
if( pseqdesc->blendend[0] - pseqdesc->blendstart[0] < 0.1f ) // catch qc error
|
||||
*pBlend = 127;
|
||||
else
|
||||
*pBlend = 255 * ( *pBlend - pseqdesc->blendstart[0] ) / ( pseqdesc->blendend[0] - pseqdesc->blendstart[0] );
|
||||
|
@ -475,11 +473,11 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
|
|||
if( m_fDoInterp )
|
||||
{
|
||||
// ugly hack to interpolate angle, position. current is reached 0.1 seconds after being set
|
||||
f = f - 1.0;
|
||||
f = f - 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = 0;
|
||||
f = 0.0f;
|
||||
}
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
|
@ -489,7 +487,7 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
|
|||
|
||||
// NOTE: Because multiplayer lag can be relatively large, we don't want to cap
|
||||
// f at 1.5 anymore.
|
||||
//if( f > -1.0 && f < 1.5 ) {}
|
||||
//if( f > -1.0f && f < 1.5f ) {}
|
||||
//Con_DPrintf( "%.0f %.0f\n",m_pCurrentEntity->msg_angles[0][YAW], m_pCurrentEntity->msg_angles[1][YAW] );
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
|
@ -499,13 +497,13 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
|
|||
ang2 = m_pCurrentEntity->latched.prevangles[i];
|
||||
|
||||
d = ang1 - ang2;
|
||||
if( d > 180 )
|
||||
if( d > 180.0f )
|
||||
{
|
||||
d -= 360;
|
||||
d -= 360.0f;
|
||||
}
|
||||
else if( d < -180 )
|
||||
else if( d < -180.0f )
|
||||
{
|
||||
d += 360;
|
||||
d += 360.0f;
|
||||
}
|
||||
|
||||
angles[i] += d * f;
|
||||
|
@ -547,9 +545,9 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
|
|||
{
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
(*m_paliastransform)[0][i] *= m_fSoftwareXScale * ( 1.0 / ( ZISCALE * 0x10000 ) );
|
||||
(*m_paliastransform)[1][i] *= m_fSoftwareYScale * ( 1.0 / ( ZISCALE * 0x10000 ) );
|
||||
(*m_paliastransform)[2][i] *= 1.0 / ( ZISCALE * 0x10000 );
|
||||
(*m_paliastransform)[0][i] *= m_fSoftwareXScale * ( 1.0f / ( ZISCALE * 0x10000 ) );
|
||||
(*m_paliastransform)[1][i] *= m_fSoftwareYScale * ( 1.0f / ( ZISCALE * 0x10000 ) );
|
||||
(*m_paliastransform)[2][i] *= 1.0f / ( ZISCALE * 0x10000 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -567,14 +565,14 @@ StudioEstimateInterpolant
|
|||
*/
|
||||
float CStudioModelRenderer::StudioEstimateInterpolant( void )
|
||||
{
|
||||
float dadt = 1.0;
|
||||
float dadt = 1.0f;
|
||||
|
||||
if( m_fDoInterp && ( m_pCurrentEntity->curstate.animtime >= m_pCurrentEntity->latched.prevanimtime + 0.01 ) )
|
||||
if( m_fDoInterp && ( m_pCurrentEntity->curstate.animtime >= m_pCurrentEntity->latched.prevanimtime + 0.01f ) )
|
||||
{
|
||||
dadt = ( m_clTime - m_pCurrentEntity->curstate.animtime ) / 0.1;
|
||||
if( dadt > 2.0 )
|
||||
dadt = ( m_clTime - m_pCurrentEntity->curstate.animtime ) / 0.1f;
|
||||
if( dadt > 2.0f )
|
||||
{
|
||||
dadt = 2.0;
|
||||
dadt = 2.0f;
|
||||
}
|
||||
}
|
||||
return dadt;
|
||||
|
@ -598,14 +596,14 @@ void CStudioModelRenderer::StudioCalcRotations( float pos[][3], vec4_t *q, mstud
|
|||
|
||||
if( f > pseqdesc->numframes - 1 )
|
||||
{
|
||||
f = 0; // bah, fix this bug with changing sequences too fast
|
||||
f = 0.0f; // bah, fix this bug with changing sequences too fast
|
||||
}
|
||||
// BUG ( somewhere else ) but this code should validate this data.
|
||||
// This could cause a crash if the frame # is negative, so we'll go ahead
|
||||
// and clamp it here
|
||||
else if( f < -0.01 )
|
||||
else if( f < -0.01f )
|
||||
{
|
||||
f = -0.01;
|
||||
f = -0.01f;
|
||||
}
|
||||
|
||||
frame = (int)f;
|
||||
|
@ -635,18 +633,18 @@ void CStudioModelRenderer::StudioCalcRotations( float pos[][3], vec4_t *q, mstud
|
|||
|
||||
if( pseqdesc->motiontype & STUDIO_X )
|
||||
{
|
||||
pos[pseqdesc->motionbone][0] = 0.0;
|
||||
pos[pseqdesc->motionbone][0] = 0.0f;
|
||||
}
|
||||
if( pseqdesc->motiontype & STUDIO_Y )
|
||||
{
|
||||
pos[pseqdesc->motionbone][1] = 0.0;
|
||||
pos[pseqdesc->motionbone][1] = 0.0f;
|
||||
}
|
||||
if( pseqdesc->motiontype & STUDIO_Z )
|
||||
{
|
||||
pos[pseqdesc->motionbone][2] = 0.0;
|
||||
pos[pseqdesc->motionbone][2] = 0.0f;
|
||||
}
|
||||
|
||||
s = 0 * ( ( 1.0 - ( f - (int)( f ) ) ) / ( pseqdesc->numframes ) ) * m_pCurrentEntity->curstate.framerate;
|
||||
s = 0 * ( ( 1.0f - ( f - (int)( f ) ) ) / ( pseqdesc->numframes ) ) * m_pCurrentEntity->curstate.framerate;
|
||||
|
||||
if( pseqdesc->motiontype & STUDIO_LX )
|
||||
{
|
||||
|
@ -679,15 +677,15 @@ void CStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[
|
|||
int axis = gEngfuncs.pfnRandomLong( 0, 1 );
|
||||
if( axis == 1 ) // Choose between x & z
|
||||
axis = 2;
|
||||
VectorScale( transform[axis], gEngfuncs.pfnRandomFloat( 1, 1.484 ), transform[axis] );
|
||||
VectorScale( transform[axis], gEngfuncs.pfnRandomFloat( 1.0f, 1.484f ), transform[axis] );
|
||||
}
|
||||
else if( gEngfuncs.pfnRandomLong( 0, 49 ) == 0 )
|
||||
{
|
||||
float offset;
|
||||
int axis = gEngfuncs.pfnRandomLong(0,1);
|
||||
/*int axis = gEngfuncs.pfnRandomLong(0,1);
|
||||
if( axis == 1 ) // Choose between x & z
|
||||
axis = 2;
|
||||
offset = gEngfuncs.pfnRandomFloat( -10, 10 );
|
||||
axis = 2;*/
|
||||
offset = gEngfuncs.pfnRandomFloat( -10.0f, 10.0f );
|
||||
transform[gEngfuncs.pfnRandomLong( 0, 2 )][3] += offset;
|
||||
}
|
||||
break;
|
||||
|
@ -695,7 +693,7 @@ void CStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[
|
|||
{
|
||||
float scale;
|
||||
|
||||
scale = 1.0 + ( m_clTime - ent->curstate.animtime ) * 10.0;
|
||||
scale = 1.0f + ( m_clTime - ent->curstate.animtime ) * 10.0f;
|
||||
if( scale > 2 ) // Don't blow up more than 200%
|
||||
scale = 2;
|
||||
transform[0][1] *= scale;
|
||||
|
@ -734,7 +732,7 @@ float CStudioModelRenderer::StudioEstimateFrame( mstudioseqdesc_t *pseqdesc )
|
|||
|
||||
if( pseqdesc->numframes <= 1 )
|
||||
{
|
||||
f = 0;
|
||||
f = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1188,10 +1186,10 @@ void CStudioModelRenderer::StudioEstimateGait( entity_state_t *pplayer )
|
|||
vec3_t est_velocity;
|
||||
|
||||
dt = ( m_clTime - m_clOldTime );
|
||||
if( dt < 0 )
|
||||
dt = 0;
|
||||
else if( dt > 1.0 )
|
||||
dt = 1;
|
||||
if( dt < 0.0f )
|
||||
dt = 0.0f;
|
||||
else if( dt > 1.0f )
|
||||
dt = 1.0f;
|
||||
|
||||
if( dt == 0 || m_pPlayerInfo->renderframe == m_nFrameCount )
|
||||
{
|
||||
|
@ -1221,29 +1219,29 @@ void CStudioModelRenderer::StudioEstimateGait( entity_state_t *pplayer )
|
|||
if( est_velocity[1] == 0 && est_velocity[0] == 0 )
|
||||
{
|
||||
float flYawDiff = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;
|
||||
flYawDiff = flYawDiff - (int)( flYawDiff / 360 ) * 360;
|
||||
if( flYawDiff > 180 )
|
||||
flYawDiff -= 360;
|
||||
if( flYawDiff < -180 )
|
||||
flYawDiff += 360;
|
||||
flYawDiff = flYawDiff - (int)( flYawDiff / 360.0f ) * 360.0f;
|
||||
if( flYawDiff > 180.0f )
|
||||
flYawDiff -= 360.0f;
|
||||
if( flYawDiff < -180.0f )
|
||||
flYawDiff += 360.0f;
|
||||
|
||||
if( dt < 0.25 )
|
||||
flYawDiff *= dt * 4;
|
||||
if( dt < 0.25f )
|
||||
flYawDiff *= dt * 4.0f;
|
||||
else
|
||||
flYawDiff *= dt;
|
||||
|
||||
m_pPlayerInfo->gaityaw += flYawDiff;
|
||||
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - (int)( m_pPlayerInfo->gaityaw / 360 ) * 360;
|
||||
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - (int)( m_pPlayerInfo->gaityaw / 360.0f ) * 360.0f;
|
||||
|
||||
m_flGaitMovement = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pPlayerInfo->gaityaw = ( atan2( est_velocity[1], est_velocity[0] ) * 180 / M_PI );
|
||||
if( m_pPlayerInfo->gaityaw > 180 )
|
||||
m_pPlayerInfo->gaityaw = 180;
|
||||
if( m_pPlayerInfo->gaityaw < -180 )
|
||||
m_pPlayerInfo->gaityaw = -180;
|
||||
m_pPlayerInfo->gaityaw = ( atan2( est_velocity[1], est_velocity[0] ) * 180.0f / M_PI_F );
|
||||
if( m_pPlayerInfo->gaityaw > 180.0f )
|
||||
m_pPlayerInfo->gaityaw = 180.0f;
|
||||
if( m_pPlayerInfo->gaityaw < -180.0f )
|
||||
m_pPlayerInfo->gaityaw = -180.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1277,10 +1275,10 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
|
|||
// Con_DPrintf( "%f %d\n", m_pCurrentEntity->angles[PITCH], m_pCurrentEntity->blending[0] );
|
||||
|
||||
dt = ( m_clTime - m_clOldTime );
|
||||
if( dt < 0 )
|
||||
dt = 0;
|
||||
else if( dt > 1.0 )
|
||||
dt = 1;
|
||||
if( dt < 0.0f )
|
||||
dt = 0.0f;
|
||||
else if( dt > 1.0f )
|
||||
dt = 1.0f;
|
||||
|
||||
StudioEstimateGait( pplayer );
|
||||
|
||||
|
@ -1288,38 +1286,38 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
|
|||
|
||||
// calc side to side turning
|
||||
flYaw = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;
|
||||
flYaw = flYaw - (int)( flYaw / 360 ) * 360;
|
||||
if( flYaw < -180 )
|
||||
flYaw = flYaw + 360;
|
||||
if( flYaw > 180 )
|
||||
flYaw = flYaw - 360;
|
||||
flYaw = flYaw - (int)( flYaw / 360.0f ) * 360.0f;
|
||||
if( flYaw < -180.0f )
|
||||
flYaw = flYaw + 360.0f;
|
||||
if( flYaw > 180.0f )
|
||||
flYaw = flYaw - 360.0f;
|
||||
|
||||
if( flYaw > 120 )
|
||||
if( flYaw > 120.0f )
|
||||
{
|
||||
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - 180;
|
||||
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - 180.0f;
|
||||
m_flGaitMovement = -m_flGaitMovement;
|
||||
flYaw = flYaw - 180;
|
||||
flYaw = flYaw - 180.0f;
|
||||
}
|
||||
else if( flYaw < -120 )
|
||||
else if( flYaw < -120.0f )
|
||||
{
|
||||
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw + 180;
|
||||
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw + 180.0f;
|
||||
m_flGaitMovement = -m_flGaitMovement;
|
||||
flYaw = flYaw + 180;
|
||||
flYaw = flYaw + 180.0f;
|
||||
}
|
||||
|
||||
// adjust torso
|
||||
m_pCurrentEntity->curstate.controller[0] = ( ( flYaw / 4.0 ) + 30 ) / ( 60.0 / 255.0 );
|
||||
m_pCurrentEntity->curstate.controller[1] = ( ( flYaw / 4.0 ) + 30 ) / ( 60.0 / 255.0 );
|
||||
m_pCurrentEntity->curstate.controller[2] = ( ( flYaw / 4.0 ) + 30 ) / ( 60.0 / 255.0 );
|
||||
m_pCurrentEntity->curstate.controller[3] = ( ( flYaw / 4.0 ) + 30 ) / ( 60.0 / 255.0 );
|
||||
m_pCurrentEntity->curstate.controller[0] = ( ( flYaw / 4.0f ) + 30.0f ) / ( 60.0f / 255.0f );
|
||||
m_pCurrentEntity->curstate.controller[1] = ( ( flYaw / 4.0f ) + 30.0f ) / ( 60.0f / 255.0f );
|
||||
m_pCurrentEntity->curstate.controller[2] = ( ( flYaw / 4.0f ) + 30.0f ) / ( 60.0f / 255.0f );
|
||||
m_pCurrentEntity->curstate.controller[3] = ( ( flYaw / 4.0f ) + 30.0f ) / ( 60.0f / 255.0f );
|
||||
m_pCurrentEntity->latched.prevcontroller[0] = m_pCurrentEntity->curstate.controller[0];
|
||||
m_pCurrentEntity->latched.prevcontroller[1] = m_pCurrentEntity->curstate.controller[1];
|
||||
m_pCurrentEntity->latched.prevcontroller[2] = m_pCurrentEntity->curstate.controller[2];
|
||||
m_pCurrentEntity->latched.prevcontroller[3] = m_pCurrentEntity->curstate.controller[3];
|
||||
|
||||
m_pCurrentEntity->angles[YAW] = m_pPlayerInfo->gaityaw;
|
||||
if( m_pCurrentEntity->angles[YAW] < -0 )
|
||||
m_pCurrentEntity->angles[YAW] += 360;
|
||||
if( m_pCurrentEntity->angles[YAW] < -0.0f )
|
||||
m_pCurrentEntity->angles[YAW] += 360.0f;
|
||||
m_pCurrentEntity->latched.prevangles[YAW] = m_pCurrentEntity->angles[YAW];
|
||||
|
||||
if( pplayer->gaitsequence >= m_pStudioHeader->numseq )
|
||||
|
|
|
@ -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
|
||||
|
||||
/*
|
||||
====================
|
||||
|
|
|
@ -77,7 +77,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
|||
else
|
||||
iRes = 640;
|
||||
|
||||
char sz[128];
|
||||
char sz[256];
|
||||
|
||||
if( !pWeapon )
|
||||
return;
|
||||
|
@ -152,7 +152,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
|||
pWeapon->hInactive = SPR_Load( sz );
|
||||
pWeapon->rcInactive = p->rc;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
else
|
||||
pWeapon->hInactive = 0;
|
||||
|
@ -174,7 +174,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
|||
pWeapon->hAmmo = SPR_Load( sz );
|
||||
pWeapon->rcAmmo = p->rc;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
else
|
||||
pWeapon->hAmmo = 0;
|
||||
|
@ -186,7 +186,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
|||
pWeapon->hAmmo2 = SPR_Load( sz );
|
||||
pWeapon->rcAmmo2 = p->rc;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
else
|
||||
pWeapon->hAmmo2 = 0;
|
||||
|
@ -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 )
|
||||
|
@ -317,7 +320,7 @@ int CHudAmmo::VidInit( void )
|
|||
giBucketWidth = gHUD.GetSpriteRect( m_HUD_bucket0 ).right - gHUD.GetSpriteRect( m_HUD_bucket0 ).left;
|
||||
giBucketHeight = gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top;
|
||||
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top );
|
||||
gHR.iHistoryGap = Q_max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top );
|
||||
|
||||
// If we've already loaded weapons, let's get new sprites
|
||||
gWR.LoadAllWeaponSprites();
|
||||
|
@ -536,13 +539,13 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
|
||||
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 +559,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 +577,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,22 +609,24 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf )
|
|||
|
||||
m_pWeapon = pWeapon;
|
||||
|
||||
if( gHUD.m_iFOV >= 90 )
|
||||
if( !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) )
|
||||
{
|
||||
// normal crosshairs
|
||||
if( fOnTarget && m_pWeapon->hAutoaim )
|
||||
SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 );
|
||||
if( gHUD.m_iFOV >= 90 )
|
||||
{
|
||||
// normal crosshairs
|
||||
if( fOnTarget && m_pWeapon->hAutoaim )
|
||||
SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 );
|
||||
else
|
||||
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
|
||||
}
|
||||
else
|
||||
SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// zoomed crosshairs
|
||||
if( fOnTarget && m_pWeapon->hZoomedAutoaim )
|
||||
SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 );
|
||||
else
|
||||
SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 );
|
||||
|
||||
{
|
||||
// zoomed crosshairs
|
||||
if( fOnTarget && m_pWeapon->hZoomedAutoaim )
|
||||
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; //!!!
|
||||
|
@ -854,10 +861,10 @@ int CHudAmmo::Draw( float flTime )
|
|||
|
||||
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
|
||||
|
||||
a = (int)max( MIN_ALPHA, m_fFade );
|
||||
a = (int)Q_max( MIN_ALPHA, m_fFade );
|
||||
|
||||
if( m_fFade > 0 )
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
|
||||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
|
||||
|
@ -877,11 +884,11 @@ int CHudAmmo::Draw( float flTime )
|
|||
x = ScreenWidth - ( 8 * AmmoWidth ) - iIconWidth;
|
||||
x = gHUD.DrawHudNumber( x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b );
|
||||
|
||||
wrect_t rc;
|
||||
/*wrect_t rc;
|
||||
rc.top = 0;
|
||||
rc.left = 0;
|
||||
rc.right = AmmoWidth;
|
||||
rc.bottom = 100;
|
||||
rc.bottom = 100;*/
|
||||
|
||||
int iBarWidth = AmmoWidth / 10;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef __AMMO_H__
|
||||
#define __AMMO_H__
|
||||
|
||||
|
|
|
@ -61,9 +61,9 @@ 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_ALPHA, m_fFade );
|
||||
a = (int)Q_max( MIN_ALPHA, m_fFade );
|
||||
if( m_fFade > 0 )
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 ); // slowly lower alpha to fade out icons
|
||||
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f ); // slowly lower alpha to fade out icons
|
||||
ScaleColors( r, g, b, a );
|
||||
|
||||
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
|
||||
|
@ -142,7 +142,7 @@ int CHudAmmoSecondary::MsgFunc_SecAmmoVal( const char *pszName, int iSize, void
|
|||
int count = 0;
|
||||
for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
|
||||
{
|
||||
count += max( 0, m_iAmmoAmounts[i] );
|
||||
count += Q_max( 0, m_iAmmoAmounts[i] );
|
||||
}
|
||||
|
||||
if( count == 0 )
|
||||
|
|
|
@ -111,7 +111,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
|||
{
|
||||
if( rgAmmoHistory[i].type )
|
||||
{
|
||||
rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );
|
||||
rgAmmoHistory[i].DisplayTime = Q_min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );
|
||||
|
||||
if( rgAmmoHistory[i].DisplayTime <= flTime )
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
|||
int r, g, b;
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
ScaleColors( r, g, b, Q_min( scale, 255 ) );
|
||||
|
||||
// Draw the pic
|
||||
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
|
||||
|
@ -158,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( scale, 255 ) );
|
||||
ScaleColors( r, g, b, Q_min( scale, 255 ) );
|
||||
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
|
||||
int xpos = ScreenWidth - ( weap->rcInactive.right - weap->rcInactive.left );
|
||||
|
@ -176,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( scale, 255 ) );
|
||||
ScaleColors( r, g, b, Q_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
|
||||
|
|
|
@ -78,7 +78,7 @@ int CHudBattery::Draw( float flTime )
|
|||
wrect_t rc;
|
||||
|
||||
rc = *m_prc2;
|
||||
rc.top += m_iHeight * ( (float)( 100 - ( min( 100,m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
||||
rc.top += m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iBat ) ) ) * 0.01f ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
||||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
|
||||
|
@ -91,7 +91,7 @@ int CHudBattery::Draw( float flTime )
|
|||
if( m_fFade > FADE_TIME )
|
||||
m_fFade = FADE_TIME;
|
||||
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
|
||||
if( m_fFade <= 0 )
|
||||
{
|
||||
a = 128;
|
||||
|
|
|
@ -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,10 +39,21 @@ 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 );
|
||||
|
||||
int __MsgFunc_Bhopcap( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
BEGIN_READ( pbuf, iSize );
|
||||
|
||||
g_bhopcap = READ_BYTE();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
==========================
|
||||
Initialize
|
||||
|
@ -76,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;
|
||||
}
|
||||
|
@ -106,7 +124,7 @@ HUD_ConnectionlessPacket
|
|||
int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
|
||||
{
|
||||
// Parse stuff from args
|
||||
int max_buffer_size = *response_buffer_size;
|
||||
// int max_buffer_size = *response_buffer_size;
|
||||
|
||||
// Zero it out since we aren't going to respond.
|
||||
// If we wanted to response, we'd write data into response_buffer
|
||||
|
@ -165,6 +183,48 @@ 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 );
|
||||
int extents[4];
|
||||
getParent()->getAbsExtents(extents[0],extents[1],extents[2],extents[3]);
|
||||
gEngfuncs.VGui_ViewportPaintBackground(extents);
|
||||
}
|
||||
|
||||
void *TeamFortressViewport::operator new( size_t stAllocateBlock )
|
||||
{
|
||||
void *mem = ::operator new( stAllocateBlock );
|
||||
memset( mem, 0, stAllocateBlock );
|
||||
return mem;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
==========================
|
||||
HUD_VidInit
|
||||
|
@ -178,7 +238,25 @@ so the HUD can reinitialize itself.
|
|||
int DLLEXPORT HUD_VidInit( void )
|
||||
{
|
||||
gHUD.VidInit();
|
||||
#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;
|
||||
}
|
||||
|
||||
|
@ -196,6 +274,8 @@ void DLLEXPORT HUD_Init( void )
|
|||
{
|
||||
InitInput();
|
||||
gHUD.Init();
|
||||
|
||||
gEngfuncs.pfnHookUserMsg( "Bhopcap", __MsgFunc_Bhopcap );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -256,7 +336,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
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -291,3 +377,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,22 +25,35 @@
|
|||
// - 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;
|
||||
typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
|
||||
// redefine
|
||||
//typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
|
||||
|
||||
#include "util_vector.h"
|
||||
|
||||
#include "../engine/cdll_int.h"
|
||||
#include "../dlls/cdll_dll.h"
|
||||
|
||||
#ifndef __MSC_VER
|
||||
#if !defined(_WIN32)
|
||||
#define _cdecl
|
||||
#endif
|
||||
#include "exportdef.h"
|
||||
#include <string.h>
|
||||
#if HAVE_CMATH
|
||||
#include <cmath>
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
#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,8 +95,12 @@ 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 int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
||||
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,11 +145,11 @@ 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))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define Q_max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define Q_min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define fabs(x) ((x) > 0 ? (x) : 0 - (x))
|
||||
|
||||
void ScaleColors( int &r, int &g, int &b, int a );
|
||||
|
@ -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,12 +111,12 @@ 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;
|
||||
|
||||
gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, (float *)&g_finalstate->playerstate.origin );
|
||||
gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, g_finalstate->playerstate.origin );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -127,7 +127,7 @@ Directly queue up an event on the client
|
|||
=====================
|
||||
*/
|
||||
void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay,
|
||||
float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 )
|
||||
const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 )
|
||||
{
|
||||
vec3_t org;
|
||||
vec3_t ang;
|
||||
|
@ -138,7 +138,7 @@ void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short event
|
|||
// Weapon prediction events are assumed to occur at the player's origin
|
||||
org = g_finalstate->playerstate.origin;
|
||||
ang = v_angles;
|
||||
gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, (float *)&org, (float *)&ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 );
|
||||
gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, org, ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -161,7 +161,7 @@ Always 0.0 on client, even if not predicting weapons ( won't get called
|
|||
*/
|
||||
float UTIL_WeaponTimeBase( void )
|
||||
{
|
||||
return 0.0;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
static unsigned int glSeed = 0;
|
||||
|
@ -254,7 +254,7 @@ float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
|
|||
|
||||
tensixrand = U_Random() & 65535;
|
||||
|
||||
offset = (float)tensixrand / 65536.0;
|
||||
offset = (float)tensixrand / 65536.0f;
|
||||
|
||||
return ( low + offset * range );
|
||||
}
|
||||
|
@ -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_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_PlaySound( const char *sound, float volume );
|
||||
void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, const float *origin, const 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.
|
|
@ -71,7 +71,7 @@ int CHudDeathNotice::Init( void )
|
|||
|
||||
HOOK_MESSAGE( DeathMsg );
|
||||
|
||||
CVAR_CREATE( "hud_deathnotice_time", "6", 0 );
|
||||
CVAR_CREATE( "hud_deathnotice_time", "6", FCVAR_ARCHIVE );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ int CHudDeathNotice::Draw( float flTime )
|
|||
continue;
|
||||
}
|
||||
|
||||
rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME );
|
||||
rgDeathNoticeList[i].flDisplayTime = Q_min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME );
|
||||
|
||||
// Only draw if the viewport will let me
|
||||
// vgui dropped out
|
||||
|
@ -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( ( (signed 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( ( (signed 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
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "cl_util.h"
|
||||
#include "demo.h"
|
||||
#include "demo_api.h"
|
||||
#include <memory.h>
|
||||
|
||||
int g_demosniper = 0;
|
||||
int g_demosniperdamage = 0;
|
||||
|
@ -88,12 +87,12 @@ void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer )
|
|||
g_demosniperorg[1] = *(float *)&buffer[i];
|
||||
i += sizeof(float);
|
||||
g_demosniperorg[2] = *(float *)&buffer[i];
|
||||
i += sizeof(float);
|
||||
// i += sizeof(float);
|
||||
}
|
||||
break;
|
||||
case TYPE_ZOOM:
|
||||
g_demozoom = *(float *)&buffer[i];
|
||||
i += sizeof(float);
|
||||
// i += sizeof(float);
|
||||
break;
|
||||
default:
|
||||
gEngfuncs.Con_DPrintf( "Unknown demo buffer type, skipping.\n" );
|
||||
|
|
|
@ -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:
|
||||
//
|
||||
|
@ -7,8 +7,6 @@
|
|||
|
||||
// Client side entity management functions
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "const.h"
|
||||
|
@ -319,12 +317,12 @@ void Particles( void )
|
|||
|
||||
curtime = gEngfuncs.GetClientTime();
|
||||
|
||||
if( ( curtime - lasttime ) < 2.0 )
|
||||
if( ( curtime - lasttime ) < 2.0f )
|
||||
return;
|
||||
|
||||
if( !color )
|
||||
{
|
||||
color = gEngfuncs.pfnRegisterVariable ( "color","255 0 0", 0 );
|
||||
color = gEngfuncs.pfnRegisterVariable( "color", "255 0 0", 0 );
|
||||
}
|
||||
|
||||
lasttime = curtime;
|
||||
|
@ -342,8 +340,8 @@ void Particles( void )
|
|||
|
||||
for( j = 0; j < 3; j++ )
|
||||
{
|
||||
p->org[j] = v_origin[j] + gEngfuncs.pfnRandomFloat( -32.0, 32.0 );
|
||||
p->vel[j] = gEngfuncs.pfnRandomFloat( -100.0, 100.0 );
|
||||
p->org[j] = v_origin[j] + gEngfuncs.pfnRandomFloat( -32.0f, 32.0f );
|
||||
p->vel[j] = gEngfuncs.pfnRandomFloat( -100.0f, 100.0f );
|
||||
}
|
||||
|
||||
if( color )
|
||||
|
@ -361,7 +359,7 @@ void Particles( void )
|
|||
gEngfuncs.pEfxAPI->R_GetPackedColor( &p->packedColor, p->color );
|
||||
|
||||
// p->die is set to current time so all you have to do is add an additional time to it
|
||||
p->die += 3.0;
|
||||
p->die += 3.0f;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -384,7 +382,7 @@ void TempEnts( void )
|
|||
|
||||
curtime = gEngfuncs.GetClientTime();
|
||||
|
||||
if( ( curtime - lasttime ) < 10.0 )
|
||||
if( ( curtime - lasttime ) < 10.0f )
|
||||
return;
|
||||
|
||||
lasttime = curtime;
|
||||
|
@ -417,11 +415,11 @@ void TempEnts( void )
|
|||
p->entity.curstate.origin[j] = origin[j];
|
||||
|
||||
// Store velocity in baseline origin
|
||||
p->entity.baseline.origin[j] = gEngfuncs.pfnRandomFloat( -100, 100 );
|
||||
p->entity.baseline.origin[j] = gEngfuncs.pfnRandomFloat( -100.0f, 100.0f );
|
||||
}
|
||||
|
||||
// p->die is set to current time so all you have to do is add an additional time to it
|
||||
p->die += 10.0;
|
||||
p->die += 10.0f;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -585,10 +583,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
|
||||
|
@ -601,7 +599,7 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
gEngfuncs.pEventAPI->EV_PushPMStates();
|
||||
|
||||
// Now add in all of the players.
|
||||
gEngfuncs.pEventAPI->EV_SetSolidPlayers( -1 );
|
||||
gEngfuncs.pEventAPI->EV_SetSolidPlayers( -1 );
|
||||
|
||||
// !!!BUGBUG -- This needs to be time based
|
||||
gTempEntFrame = ( gTempEntFrame + 1 ) & 31;
|
||||
|
@ -623,10 +621,10 @@ 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;
|
||||
gravitySlow = gravity * 0.5f;
|
||||
|
||||
while( pTemp )
|
||||
{
|
||||
|
@ -634,7 +632,7 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
|
||||
active = 1;
|
||||
|
||||
life = pTemp->die - client_time;
|
||||
life = pTemp->die - (float)client_time;
|
||||
pnext = pTemp->next;
|
||||
if( life < 0 )
|
||||
{
|
||||
|
@ -674,9 +672,9 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
gEngfuncs.pEfxAPI->R_SparkEffect( pTemp->entity.origin, 8, -200, 200 );
|
||||
|
||||
// Reduce life
|
||||
pTemp->entity.baseline.framerate -= 0.1;
|
||||
pTemp->entity.baseline.framerate -= 0.1f;
|
||||
|
||||
if( pTemp->entity.baseline.framerate <= 0.0 )
|
||||
if( pTemp->entity.baseline.framerate <= 0.0f )
|
||||
{
|
||||
pTemp->die = client_time;
|
||||
}
|
||||
|
@ -700,32 +698,32 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
}
|
||||
else if( pTemp->flags & FTENT_SINEWAVE )
|
||||
{
|
||||
pTemp->x += pTemp->entity.baseline.origin[0] * frametime;
|
||||
pTemp->y += pTemp->entity.baseline.origin[1] * frametime;
|
||||
pTemp->x += pTemp->entity.baseline.origin[0] * (float)frametime;
|
||||
pTemp->y += pTemp->entity.baseline.origin[1] * (float)frametime;
|
||||
|
||||
pTemp->entity.origin[0] = pTemp->x + sin( pTemp->entity.baseline.origin[2] + client_time * pTemp->entity.prevstate.frame ) * ( 10 * pTemp->entity.curstate.framerate );
|
||||
pTemp->entity.origin[1] = pTemp->y + sin( pTemp->entity.baseline.origin[2] + fastFreq + 0.7 ) * ( 8 * pTemp->entity.curstate.framerate );
|
||||
pTemp->entity.origin[1] = pTemp->y + sin( pTemp->entity.baseline.origin[2] + fastFreq + 0.7f ) * ( 8 * pTemp->entity.curstate.framerate );
|
||||
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
|
||||
}
|
||||
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[2] += pTemp->entity.baseline.origin[2] * frametime;
|
||||
pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * (float)frametime + 8 * sin( client_time * 20 + (size_t)pTemp );
|
||||
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * (float)frametime + 4 * sin( client_time * 30 + (size_t)pTemp );
|
||||
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * (float)frametime;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; i < 3; i++ )
|
||||
pTemp->entity.origin[i] += pTemp->entity.baseline.origin[i] * frametime;
|
||||
pTemp->entity.origin[i] += pTemp->entity.baseline.origin[i] * (float)frametime;
|
||||
}
|
||||
|
||||
if( pTemp->flags & FTENT_SPRANIMATE )
|
||||
{
|
||||
pTemp->entity.curstate.frame += frametime * pTemp->entity.curstate.framerate;
|
||||
pTemp->entity.curstate.frame += (float)frametime * pTemp->entity.curstate.framerate;
|
||||
if( pTemp->entity.curstate.frame >= pTemp->frameMax )
|
||||
{
|
||||
pTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)( pTemp->entity.curstate.frame );
|
||||
|
@ -755,9 +753,9 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
|
||||
if( pTemp->flags & FTENT_ROTATE )
|
||||
{
|
||||
pTemp->entity.angles[0] += pTemp->entity.baseline.angles[0] * frametime;
|
||||
pTemp->entity.angles[1] += pTemp->entity.baseline.angles[1] * frametime;
|
||||
pTemp->entity.angles[2] += pTemp->entity.baseline.angles[2] * frametime;
|
||||
pTemp->entity.angles[0] += pTemp->entity.baseline.angles[0] * (float)frametime;
|
||||
pTemp->entity.angles[1] += pTemp->entity.baseline.angles[1] * (float)frametime;
|
||||
pTemp->entity.angles[2] += pTemp->entity.baseline.angles[2] * (float)frametime;
|
||||
|
||||
VectorCopy( pTemp->entity.angles, pTemp->entity.latched.prevangles );
|
||||
}
|
||||
|
@ -809,7 +807,7 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
{
|
||||
// Chop spark speeds a bit more
|
||||
//
|
||||
VectorScale( pTemp->entity.baseline.origin, 0.6, pTemp->entity.baseline.origin );
|
||||
VectorScale( pTemp->entity.baseline.origin, 0.6f, pTemp->entity.baseline.origin );
|
||||
|
||||
if( Length( pTemp->entity.baseline.origin ) < 10 )
|
||||
{
|
||||
|
@ -829,13 +827,13 @@ void DLLEXPORT HUD_TempEntUpdate (
|
|||
float proj, damp;
|
||||
|
||||
// Place at contact point
|
||||
VectorMA( pTemp->entity.prevstate.origin, traceFraction * frametime, pTemp->entity.baseline.origin, pTemp->entity.origin );
|
||||
VectorMA( pTemp->entity.prevstate.origin, traceFraction * (float)frametime, pTemp->entity.baseline.origin, pTemp->entity.origin );
|
||||
// Damp velocity
|
||||
damp = pTemp->bounceFactor;
|
||||
if( pTemp->flags & ( FTENT_GRAVITY | FTENT_SLOWGRAVITY ) )
|
||||
{
|
||||
damp *= 0.5;
|
||||
if( traceNormal[2] > 0.9 ) // Hit floor?
|
||||
damp *= 0.5f;
|
||||
if( traceNormal[2] > 0.9f ) // Hit floor?
|
||||
{
|
||||
if( pTemp->entity.baseline.origin[2] <= 0 && pTemp->entity.baseline.origin[2] >= gravity*3 )
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
extern engine_studio_api_t IEngineStudio;
|
||||
|
||||
static int tracerCount[32];
|
||||
static int g_tracerCount[32];
|
||||
|
||||
extern "C" char PM_FindTextureType( char *name );
|
||||
|
||||
|
@ -72,18 +72,18 @@ void EV_SnarkFire( struct event_args_s *args );
|
|||
void EV_TrainPitchAdjust( struct event_args_s *args );
|
||||
}
|
||||
|
||||
#define VECTOR_CONE_1DEGREES Vector( 0.00873, 0.00873, 0.00873 )
|
||||
#define VECTOR_CONE_2DEGREES Vector( 0.01745, 0.01745, 0.01745 )
|
||||
#define VECTOR_CONE_3DEGREES Vector( 0.02618, 0.02618, 0.02618 )
|
||||
#define VECTOR_CONE_4DEGREES Vector( 0.03490, 0.03490, 0.03490 )
|
||||
#define VECTOR_CONE_5DEGREES Vector( 0.04362, 0.04362, 0.04362 )
|
||||
#define VECTOR_CONE_6DEGREES Vector( 0.05234, 0.05234, 0.05234 )
|
||||
#define VECTOR_CONE_7DEGREES Vector( 0.06105, 0.06105, 0.06105 )
|
||||
#define VECTOR_CONE_8DEGREES Vector( 0.06976, 0.06976, 0.06976 )
|
||||
#define VECTOR_CONE_9DEGREES Vector( 0.07846, 0.07846, 0.07846 )
|
||||
#define VECTOR_CONE_10DEGREES Vector( 0.08716, 0.08716, 0.08716 )
|
||||
#define VECTOR_CONE_15DEGREES Vector( 0.13053, 0.13053, 0.13053 )
|
||||
#define VECTOR_CONE_20DEGREES Vector( 0.17365, 0.17365, 0.17365 )
|
||||
#define VECTOR_CONE_1DEGREES Vector( 0.00873f, 0.00873f, 0.00873f )
|
||||
#define VECTOR_CONE_2DEGREES Vector( 0.01745f, 0.01745f, 0.01745f )
|
||||
#define VECTOR_CONE_3DEGREES Vector( 0.02618f, 0.02618f, 0.02618f )
|
||||
#define VECTOR_CONE_4DEGREES Vector( 0.03490f, 0.03490f, 0.03490f )
|
||||
#define VECTOR_CONE_5DEGREES Vector( 0.04362f, 0.04362f, 0.04362f )
|
||||
#define VECTOR_CONE_6DEGREES Vector( 0.05234f, 0.05234f, 0.05234f )
|
||||
#define VECTOR_CONE_7DEGREES Vector( 0.06105f, 0.06105f, 0.06105f )
|
||||
#define VECTOR_CONE_8DEGREES Vector( 0.06976f, 0.06976f, 0.06976f )
|
||||
#define VECTOR_CONE_9DEGREES Vector( 0.07846f, 0.07846f, 0.07846f )
|
||||
#define VECTOR_CONE_10DEGREES Vector( 0.08716f, 0.08716f, 0.08716f )
|
||||
#define VECTOR_CONE_15DEGREES Vector( 0.13053f, 0.13053f, 0.13053f )
|
||||
#define VECTOR_CONE_20DEGREES Vector( 0.17365f, 0.17365f, 0.17365f )
|
||||
|
||||
// play a strike sound based on the texture that was hit by the attack traceline. VecSrc/VecEnd are the
|
||||
// original traceline endpoints used by the attacker, iBulletType is the type of bullet that hit the texture.
|
||||
|
@ -94,7 +94,7 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
|
|||
char chTextureType = CHAR_TEX_CONCRETE;
|
||||
float fvol;
|
||||
float fvolbar;
|
||||
char *rgsz[4];
|
||||
const char *rgsz[4];
|
||||
int cnt;
|
||||
float fattn = ATTN_NORM;
|
||||
int entity;
|
||||
|
@ -425,7 +425,7 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
|
|||
tracer = EV_HLDM_CheckTracer( idx, vecSrc, tr.endpos, forward, right, iBulletType, iTracerFreq, tracerCount );
|
||||
|
||||
// do damage, paint decals
|
||||
if( tr.fraction != 1.0 )
|
||||
if( tr.fraction != 1.0f )
|
||||
{
|
||||
switch( iBulletType )
|
||||
{
|
||||
|
@ -521,16 +521,17 @@ void EV_FireGlock2( event_args_t *args )
|
|||
VectorCopy( args->origin, origin );
|
||||
VectorCopy( args->angles, angles );
|
||||
VectorCopy( args->velocity, velocity );
|
||||
int empty = args->bparam1;
|
||||
|
||||
AngleVectors( angles, forward, right, up );
|
||||
|
||||
shell = gEngfuncs.pEventAPI->EV_FindModelIndex ("models/shell.mdl");// brass shell
|
||||
shell = gEngfuncs.pEventAPI->EV_FindModelIndex( "models/shell.mdl" );// brass shell
|
||||
|
||||
if( EV_IsLocal( idx ) )
|
||||
{
|
||||
// Add muzzle flash to current weapon model
|
||||
EV_MuzzleFlash();
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( GLOCK_SHOOT, 2 );
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 2 );
|
||||
|
||||
V_PunchAxis( 0, -2.0 );
|
||||
}
|
||||
|
@ -545,7 +546,7 @@ void EV_FireGlock2( event_args_t *args )
|
|||
|
||||
VectorCopy( forward, vecAiming );
|
||||
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_9MM, 0, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
}
|
||||
//======================
|
||||
// GLOCK END
|
||||
|
@ -568,7 +569,7 @@ void EV_FireShotGunDouble( event_args_t *args )
|
|||
vec3_t vecSrc, vecAiming;
|
||||
vec3_t vecSpread;
|
||||
vec3_t up, right, forward;
|
||||
float flSpread = 0.01;
|
||||
//float flSpread = 0.01;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
|
@ -601,11 +602,11 @@ void EV_FireShotGunDouble( event_args_t *args )
|
|||
|
||||
if( gEngfuncs.GetMaxClients() > 1 )
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 8, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx - 1], 0.17365, 0.04362 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 8, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.17365, 0.04362 );
|
||||
}
|
||||
else
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 12, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx - 1], 0.08716, 0.08716 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 12, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.08716 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,7 +623,7 @@ void EV_FireShotGunSingle( event_args_t *args )
|
|||
vec3_t vecSrc, vecAiming;
|
||||
vec3_t vecSpread;
|
||||
vec3_t up, right, forward;
|
||||
float flSpread = 0.01;
|
||||
//float flSpread = 0.01;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
|
@ -653,11 +654,11 @@ void EV_FireShotGunSingle( event_args_t *args )
|
|||
|
||||
if( gEngfuncs.GetMaxClients() > 1 )
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 4, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx - 1], 0.08716, 0.04362 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 4, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.04362 );
|
||||
}
|
||||
else
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount[idx - 1], 0.08716, 0.08716 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, 2048, BULLET_PLAYER_BUCKSHOT, 0, &g_tracerCount[idx - 1], 0.08716, 0.08716 );
|
||||
}
|
||||
}
|
||||
//======================
|
||||
|
@ -679,7 +680,7 @@ void EV_FireMP5( event_args_t *args )
|
|||
int shell;
|
||||
vec3_t vecSrc, vecAiming;
|
||||
vec3_t up, right, forward;
|
||||
float flSpread = 0.01;
|
||||
//float flSpread = 0.01;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
|
@ -718,11 +719,11 @@ void EV_FireMP5( event_args_t *args )
|
|||
|
||||
if( gEngfuncs.GetMaxClients() > 1 )
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, BULLET_PLAYER_MP5, 2, &g_tracerCount[idx - 1], args->fparam1, args->fparam2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -769,7 +770,7 @@ void EV_FirePython( event_args_t *args )
|
|||
|
||||
vec3_t vecSrc, vecAiming;
|
||||
vec3_t up, right, forward;
|
||||
float flSpread = 0.01;
|
||||
//float flSpread = 0.01;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
|
@ -814,6 +815,7 @@ void EV_FirePython( event_args_t *args )
|
|||
//======================
|
||||
// GAUSS START
|
||||
//======================
|
||||
#define SND_STOP (1 << 5)
|
||||
#define SND_CHANGE_PITCH (1 << 7) // duplicated in protocol.h change sound pitch
|
||||
|
||||
void EV_SpinGauss( event_args_t *args )
|
||||
|
@ -834,6 +836,7 @@ void EV_SpinGauss( event_args_t *args )
|
|||
pitch = args->iparam1;
|
||||
|
||||
iSoundState = args->bparam1 ? SND_CHANGE_PITCH : 0;
|
||||
iSoundState = args->bparam2 ? SND_STOP : iSoundState;
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "ambience/pulsemachine.wav", 1.0, ATTN_NORM, iSoundState, pitch );
|
||||
}
|
||||
|
@ -860,16 +863,16 @@ void EV_FireGauss( event_args_t *args )
|
|||
vec3_t angles;
|
||||
vec3_t velocity;
|
||||
float flDamage = args->fparam1;
|
||||
int primaryfire = args->bparam1;
|
||||
//int primaryfire = args->bparam1;
|
||||
|
||||
int m_fPrimaryFire = args->bparam1;
|
||||
int m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
|
||||
//int m_iWeaponVolume = GAUSS_PRIMARY_FIRE_VOLUME;
|
||||
vec3_t vecSrc;
|
||||
vec3_t vecDest;
|
||||
edict_t *pentIgnore;
|
||||
//edict_t *pentIgnore;
|
||||
pmtrace_t tr, beam_tr;
|
||||
float flMaxFrac = 1.0;
|
||||
int nTotal = 0;
|
||||
//int nTotal = 0;
|
||||
int fHasPunched = 0;
|
||||
int fFirstBeam = 1;
|
||||
int nMaxHits = 10;
|
||||
|
@ -900,14 +903,14 @@ void EV_FireGauss( event_args_t *args )
|
|||
|
||||
if( EV_IsLocal( idx ) )
|
||||
{
|
||||
V_PunchAxis( 0, -2.0 );
|
||||
V_PunchAxis( 0.0f, -2.0f );
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 2 );
|
||||
|
||||
if( m_fPrimaryFire == false )
|
||||
g_flApplyVel = flDamage;
|
||||
}
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/gauss2.wav", 0.5 + flDamage * ( 1.0 / 400.0 ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/gauss2.wav", 0.5f + flDamage * ( 1.0f / 400.0f ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
|
||||
|
||||
while( flDamage > 10 && nMaxHits > 0 )
|
||||
{
|
||||
|
@ -942,10 +945,10 @@ void EV_FireGauss( event_args_t *args )
|
|||
idx | 0x1000,
|
||||
tr.endpos,
|
||||
m_iBeam,
|
||||
0.1,
|
||||
m_fPrimaryFire ? 1.0 : 2.5,
|
||||
0.0,
|
||||
m_fPrimaryFire ? 128.0 : flDamage,
|
||||
0.1f,
|
||||
m_fPrimaryFire ? 1.0f : 2.5f,
|
||||
0.0f,
|
||||
m_fPrimaryFire ? 128.0f : flDamage,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@ -959,10 +962,10 @@ void EV_FireGauss( event_args_t *args )
|
|||
gEngfuncs.pEfxAPI->R_BeamPoints( vecSrc,
|
||||
tr.endpos,
|
||||
m_iBeam,
|
||||
0.1,
|
||||
m_fPrimaryFire ? 1.0 : 2.5,
|
||||
0.0,
|
||||
m_fPrimaryFire ? 128.0 : flDamage,
|
||||
0.1f,
|
||||
m_fPrimaryFire ? 1.0f : 2.5f,
|
||||
0.0f,
|
||||
m_fPrimaryFire ? 128.0f : flDamage,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@ -980,17 +983,17 @@ void EV_FireGauss( event_args_t *args )
|
|||
{
|
||||
float n;
|
||||
|
||||
pentIgnore = NULL;
|
||||
//pentIgnore = NULL;
|
||||
|
||||
n = -DotProduct( tr.plane.normal, forward );
|
||||
|
||||
if( n < 0.5 ) // 60 degrees
|
||||
if( n < 0.5f ) // 60 degrees
|
||||
{
|
||||
// ALERT( at_console, "reflect %f\n", n );
|
||||
// reflect
|
||||
vec3_t r;
|
||||
|
||||
VectorMA( forward, 2.0 * n, tr.plane.normal, r );
|
||||
VectorMA( forward, 2.0f * n, tr.plane.normal, r );
|
||||
|
||||
flMaxFrac = flMaxFrac - tr.fraction;
|
||||
|
||||
|
@ -999,18 +1002,18 @@ void EV_FireGauss( event_args_t *args )
|
|||
VectorMA( tr.endpos, 8.0, forward, vecSrc );
|
||||
VectorMA( vecSrc, 8192.0, forward, vecDest );
|
||||
|
||||
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage * n / 255.0, flDamage * n * 0.5 * 0.1, FTENT_FADEOUT );
|
||||
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage * n / 255.0f, flDamage * n * 0.5f * 0.1f, FTENT_FADEOUT );
|
||||
|
||||
vec3_t fwd;
|
||||
VectorAdd( tr.endpos, tr.plane.normal, fwd );
|
||||
|
||||
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
|
||||
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10.0f, 20.0f ) / 100.0f, 100,
|
||||
255, 100 );
|
||||
|
||||
// lose energy
|
||||
if( n == 0 )
|
||||
if( n == 0.0f )
|
||||
{
|
||||
n = 0.1;
|
||||
n = 0.1f;
|
||||
}
|
||||
|
||||
flDamage = flDamage * ( 1 - n );
|
||||
|
@ -1020,7 +1023,7 @@ void EV_FireGauss( event_args_t *args )
|
|||
// tunnel
|
||||
EV_HLDM_DecalGunshot( &tr, BULLET_MONSTER_12MM );
|
||||
|
||||
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 1.0, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0, 6.0, FTENT_FADEOUT );
|
||||
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 1.0, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0f, 6.0f, FTENT_FADEOUT );
|
||||
|
||||
// limit it to one hole punch
|
||||
if( fHasPunched )
|
||||
|
@ -1066,7 +1069,7 @@ void EV_FireGauss( event_args_t *args )
|
|||
{
|
||||
vec3_t fwd;
|
||||
VectorSubtract( tr.endpos, forward, fwd );
|
||||
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
|
||||
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10.0f, 20.0f ) / 100.0f, 100,
|
||||
255, 100 );
|
||||
}
|
||||
|
||||
|
@ -1075,13 +1078,13 @@ void EV_FireGauss( event_args_t *args )
|
|||
|
||||
EV_HLDM_DecalGunshot( &beam_tr, BULLET_MONSTER_12MM );
|
||||
|
||||
gEngfuncs.pEfxAPI->R_TempSprite( beam_tr.endpos, vec3_origin, 0.1, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0, 6.0, FTENT_FADEOUT );
|
||||
gEngfuncs.pEfxAPI->R_TempSprite( beam_tr.endpos, vec3_origin, 0.1, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0f, 6.0f, FTENT_FADEOUT );
|
||||
|
||||
// balls
|
||||
{
|
||||
vec3_t fwd;
|
||||
VectorSubtract( beam_tr.endpos, forward, fwd );
|
||||
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, beam_tr.endpos, fwd, m_iBalls, (int)( flDamage * 0.3 ), 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 200,
|
||||
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, beam_tr.endpos, fwd, m_iBalls, (int)( flDamage * 0.3f ), 0.1, gEngfuncs.pfnRandomFloat( 10.0f, 20.0f ) / 100.0f, 200,
|
||||
255, 40 );
|
||||
}
|
||||
|
||||
|
@ -1101,11 +1104,11 @@ void EV_FireGauss( event_args_t *args )
|
|||
{
|
||||
// slug doesn't punch through ever with primary
|
||||
// fire, so leave a little glowy bit and make some balls
|
||||
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, 200.0 / 255.0, 0.3, FTENT_FADEOUT );
|
||||
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, 200.0f / 255.0f, 0.3, FTENT_FADEOUT );
|
||||
{
|
||||
vec3_t fwd;
|
||||
VectorAdd( tr.endpos, tr.plane.normal, fwd );
|
||||
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 8, 0.6, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
|
||||
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 8, 0.6, gEngfuncs.pfnRandomFloat( 10.0f, 20.0f ) / 100.0f, 100,
|
||||
255, 200 );
|
||||
}
|
||||
}
|
||||
|
@ -1137,7 +1140,13 @@ enum crowbar_e
|
|||
CROWBAR_ATTACK2MISS,
|
||||
CROWBAR_ATTACK2HIT,
|
||||
CROWBAR_ATTACK3MISS,
|
||||
#ifndef CROWBAR_IDLE_ANIM
|
||||
CROWBAR_ATTACK3HIT
|
||||
#else
|
||||
CROWBAR_ATTACK3HIT,
|
||||
CROWBAR_IDLE2,
|
||||
CROWBAR_IDLE3
|
||||
#endif
|
||||
};
|
||||
|
||||
int g_iSwing;
|
||||
|
@ -1159,8 +1168,6 @@ void EV_Crowbar( event_args_t *args )
|
|||
|
||||
if( EV_IsLocal( idx ) )
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 );
|
||||
|
||||
switch( (g_iSwing++) % 3 )
|
||||
{
|
||||
case 0:
|
||||
|
@ -1233,7 +1240,7 @@ void EV_FireCrossbow2( event_args_t *args )
|
|||
VectorMA( vecSrc, 8192, forward, vecEnd );
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/xbow_fire1.wav", 1, ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, "weapons/xbow_reload1.wav", gEngfuncs.pfnRandomFloat( 0.95, 1.0 ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, "weapons/xbow_reload1.wav", gEngfuncs.pfnRandomFloat( 0.95f, 1.0f ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
|
||||
|
||||
if( EV_IsLocal( idx ) )
|
||||
{
|
||||
|
@ -1252,7 +1259,7 @@ void EV_FireCrossbow2( event_args_t *args )
|
|||
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
|
||||
|
||||
//We hit something
|
||||
if( tr.fraction < 1.0 )
|
||||
if( tr.fraction < 1.0f )
|
||||
{
|
||||
physent_t *pe = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent );
|
||||
|
||||
|
@ -1272,7 +1279,7 @@ void EV_FireCrossbow2( event_args_t *args )
|
|||
//Stick to world but don't stick to glass, it might break and leave the bolt floating. It can still stick to other non-transparent breakables though.
|
||||
else if( pe->rendermode == kRenderNormal )
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( 0, tr.endpos, CHAN_BODY, "weapons/xbow_hit1.wav", gEngfuncs.pfnRandomFloat( 0.95, 1.0 ), ATTN_NORM, 0, PITCH_NORM );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( 0, tr.endpos, CHAN_BODY, "weapons/xbow_hit1.wav", gEngfuncs.pfnRandomFloat( 0.95f, 1.0f ), ATTN_NORM, 0, PITCH_NORM );
|
||||
|
||||
//Not underwater, do some sparks...
|
||||
if( gEngfuncs.PM_PointContents( tr.endpos, NULL ) != CONTENTS_WATER )
|
||||
|
@ -1308,7 +1315,7 @@ void EV_FireCrossbow( event_args_t *args )
|
|||
VectorCopy( args->origin, origin );
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/xbow_fire1.wav", 1, ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, "weapons/xbow_reload1.wav", gEngfuncs.pfnRandomFloat( 0.95, 1.0 ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, "weapons/xbow_reload1.wav", gEngfuncs.pfnRandomFloat( 0.95f, 1.0f ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
|
||||
|
||||
//Only play the weapon anims if I shot it.
|
||||
if( EV_IsLocal( idx ) )
|
||||
|
@ -1318,7 +1325,7 @@ void EV_FireCrossbow( event_args_t *args )
|
|||
else if ( args->iparam2 )
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 1 );
|
||||
|
||||
V_PunchAxis( 0, -2.0 );
|
||||
V_PunchAxis( 0.0f, -2.0f );
|
||||
}
|
||||
}
|
||||
//======================
|
||||
|
@ -1405,19 +1412,32 @@ enum EGON_FIREMODE
|
|||
#define EGON_SOUND_RUN "weapons/egon_run3.wav"
|
||||
#define EGON_SOUND_STARTUP "weapons/egon_windup2.wav"
|
||||
|
||||
#if !defined(ARRAYSIZE)
|
||||
#define ARRAYSIZE(p) ( sizeof(p) /sizeof(p[0]) )
|
||||
#endif
|
||||
|
||||
BEAM *pBeam;
|
||||
BEAM *pBeam2;
|
||||
TEMPENTITY *pFlare; // Vit_amiN: egon's beam flare
|
||||
|
||||
void EV_EgonFlareCallback( struct tempent_s *ent, float frametime, float currenttime )
|
||||
{
|
||||
float delta = currenttime - ent->tentOffset.z; // time past since the last scale
|
||||
if( delta >= ent->tentOffset.y )
|
||||
{
|
||||
ent->entity.curstate.scale += ent->tentOffset.x * delta;
|
||||
ent->tentOffset.z = currenttime;
|
||||
}
|
||||
}
|
||||
|
||||
void EV_EgonFire( event_args_t *args )
|
||||
{
|
||||
int idx, iFireState, iFireMode;
|
||||
int idx, /*iFireState,*/ iFireMode;
|
||||
vec3_t origin;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
iFireState = args->iparam1;
|
||||
//iFireState = args->iparam1;
|
||||
iFireMode = args->iparam2;
|
||||
int iStartup = args->bparam1;
|
||||
|
||||
|
@ -1430,6 +1450,12 @@ void EV_EgonFire( event_args_t *args )
|
|||
}
|
||||
else
|
||||
{
|
||||
// If there is any sound playing already, kill it. - Solokiller
|
||||
// This is necessary because multiple sounds can play on the same channel at the same time.
|
||||
// In some cases, more than 1 run sound plays when the egon stops firing, in which case only the earliest entry in the list is stopped.
|
||||
// This ensures no more than 1 of those is ever active at the same time.
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, EGON_SOUND_RUN );
|
||||
|
||||
if( iFireMode == FIRE_WIDE )
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, EGON_SOUND_RUN, 0.98, ATTN_NORM, 0, 125 );
|
||||
else
|
||||
|
@ -1438,9 +1464,9 @@ void EV_EgonFire( event_args_t *args )
|
|||
|
||||
//Only play the weapon anims if I shot it.
|
||||
if( EV_IsLocal( idx ) )
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation ( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 );
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 );
|
||||
|
||||
if( iStartup == 1 && EV_IsLocal( idx ) && !pBeam && !pBeam2 && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
|
||||
if( iStartup == 1 && EV_IsLocal( idx ) && !( pBeam || pBeam2 || pFlare ) && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
|
||||
{
|
||||
vec3_t vecSrc, vecEnd, angles, forward, right, up;
|
||||
pmtrace_t tr;
|
||||
|
@ -1488,8 +1514,16 @@ void EV_EgonFire( event_args_t *args )
|
|||
pBeam->flags |= ( FBEAM_SINENOISE );
|
||||
|
||||
pBeam2 = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 5.0, 0.08, 0.7, 25, 0, 0, r, g, b );
|
||||
|
||||
// Vit_amiN: egon beam flare
|
||||
pFlare = gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 1.0, gEngfuncs.pEventAPI->EV_FindModelIndex( EGON_FLARE_SPRITE ), kRenderGlow, kRenderFxNoDissipation, 1.0, 99999, FTENT_SPRCYCLE | FTENT_PERSIST );
|
||||
}
|
||||
}
|
||||
|
||||
if( pFlare ) // Vit_amiN: store the last mode for EV_EgonStop()
|
||||
{
|
||||
pFlare->tentOffset.x = ( iFireMode == FIRE_WIDE ) ? 1.0f : 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void EV_EgonStop( event_args_t *args )
|
||||
|
@ -1509,15 +1543,35 @@ void EV_EgonStop( event_args_t *args )
|
|||
{
|
||||
if( pBeam )
|
||||
{
|
||||
pBeam->die = 0.0;
|
||||
pBeam->die = 0.0f;
|
||||
pBeam = NULL;
|
||||
}
|
||||
|
||||
if( pBeam2 )
|
||||
{
|
||||
pBeam2->die = 0.0;
|
||||
pBeam2->die = 0.0f;
|
||||
pBeam2 = NULL;
|
||||
}
|
||||
|
||||
if( pFlare ) // Vit_amiN: egon beam flare
|
||||
{
|
||||
pFlare->die = gEngfuncs.GetClientTime();
|
||||
|
||||
if( gEngfuncs.GetMaxClients() == 1 || !(pFlare->flags & FTENT_NOMODEL) )
|
||||
{
|
||||
if( pFlare->tentOffset.x != 0.0f ) // true for iFireMode == FIRE_WIDE
|
||||
{
|
||||
pFlare->callback = &EV_EgonFlareCallback;
|
||||
pFlare->fadeSpeed = 2.0; // fade out will take 0.5 sec
|
||||
pFlare->tentOffset.x = 10.0; // scaling speed per second
|
||||
pFlare->tentOffset.y = 0.1; // min time between two scales
|
||||
pFlare->tentOffset.z = pFlare->die; // the last callback run time
|
||||
pFlare->flags = FTENT_FADEOUT | FTENT_CLIENTCUSTOM;
|
||||
}
|
||||
}
|
||||
|
||||
pFlare = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
//======================
|
||||
|
@ -1539,13 +1593,13 @@ enum hgun_e
|
|||
|
||||
void EV_HornetGunFire( event_args_t *args )
|
||||
{
|
||||
int idx, iFireMode;
|
||||
int idx; //, iFireMode;
|
||||
vec3_t origin, angles, vecSrc, forward, right, up;
|
||||
|
||||
idx = args->entindex;
|
||||
VectorCopy( args->origin, origin );
|
||||
VectorCopy( args->angles, angles );
|
||||
iFireMode = args->iparam1;
|
||||
//iFireMode = args->iparam1;
|
||||
|
||||
//Only play the weapon anims if I shot it.
|
||||
if( EV_IsLocal( idx ) )
|
||||
|
@ -1554,7 +1608,7 @@ void EV_HornetGunFire( event_args_t *args )
|
|||
gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 1 );
|
||||
}
|
||||
|
||||
switch( gEngfuncs.pfnRandomLong( 0 , 2 ) )
|
||||
switch( gEngfuncs.pfnRandomLong( 0, 2 ) )
|
||||
{
|
||||
case 0:
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "agrunt/ag_fire1.wav", 1, ATTN_NORM, 0, 100 );
|
||||
|
@ -1615,10 +1669,10 @@ void EV_TripmineFire( event_args_t *args )
|
|||
// Now add in all of the players.
|
||||
gEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );
|
||||
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
|
||||
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecSrc + forward * 128, PM_NORMAL, -1, &tr );
|
||||
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecSrc + forward * 128.0f, PM_NORMAL, -1, &tr );
|
||||
|
||||
//Hit something solid
|
||||
if( tr.fraction < 1.0 )
|
||||
if( tr.fraction < 1.0f )
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation ( TRIPMINE_DRAW, 0 );
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PopPMStates();
|
||||
|
@ -1670,7 +1724,7 @@ void EV_SnarkFire( event_args_t *args )
|
|||
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc + forward * 20, vecSrc + forward * 64, PM_NORMAL, -1, &tr );
|
||||
|
||||
//Find space to drop the thing.
|
||||
if( tr.allsolid == 0 && tr.startsolid == 0 && tr.fraction > 0.25 )
|
||||
if( tr.allsolid == 0 && tr.startsolid == 0 && tr.fraction > 0.25f )
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation( SQUEAK_THROW, 0 );
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PopPMStates();
|
||||
|
@ -1690,7 +1744,7 @@ void EV_TrainPitchAdjust( event_args_t *args )
|
|||
int pitch;
|
||||
int stop;
|
||||
|
||||
char sz[256];
|
||||
const char *pszSound;
|
||||
|
||||
idx = args->entindex;
|
||||
|
||||
|
@ -1699,43 +1753,42 @@ void EV_TrainPitchAdjust( event_args_t *args )
|
|||
us_params = (unsigned short)args->iparam1;
|
||||
stop = args->bparam1;
|
||||
|
||||
m_flVolume = (float)( us_params & 0x003f ) / 40.0;
|
||||
m_flVolume = (float)( us_params & 0x003f ) / 40.0f;
|
||||
noise = (int)( ( ( us_params ) >> 12 ) & 0x0007 );
|
||||
pitch = (int)( 10.0 * (float)( ( us_params >> 6 ) & 0x003f ) );
|
||||
pitch = (int)( 10.0f * (float)( ( us_params >> 6 ) & 0x003f ) );
|
||||
|
||||
switch( noise )
|
||||
{
|
||||
case 1:
|
||||
strcpy( sz, "plats/ttrain1.wav" );
|
||||
pszSound = "plats/ttrain1.wav";
|
||||
break;
|
||||
case 2:
|
||||
strcpy( sz, "plats/ttrain2.wav" );
|
||||
pszSound = "plats/ttrain2.wav";
|
||||
break;
|
||||
case 3:
|
||||
strcpy( sz, "plats/ttrain3.wav" );
|
||||
pszSound = "plats/ttrain3.wav";
|
||||
break;
|
||||
case 4:
|
||||
strcpy( sz, "plats/ttrain4.wav");
|
||||
pszSound = "plats/ttrain4.wav";
|
||||
break;
|
||||
case 5:
|
||||
strcpy( sz, "plats/ttrain6.wav");
|
||||
pszSound = "plats/ttrain6.wav";
|
||||
break;
|
||||
case 6:
|
||||
strcpy( sz, "plats/ttrain7.wav");
|
||||
pszSound = "plats/ttrain7.wav";
|
||||
break;
|
||||
default:
|
||||
// no sound
|
||||
strcpy( sz, "" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( stop )
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, sz );
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, pszSound );
|
||||
}
|
||||
else
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, sz, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, pszSound, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.0f;
|
||||
}
|
||||
|
||||
int CHudFlashlight::VidInit( void )
|
||||
|
@ -73,7 +75,7 @@ int CHudFlashlight::MsgFunc_FlashBat( const char *pszName, int iSize, void *pbu
|
|||
BEGIN_READ( pbuf, iSize );
|
||||
int x = READ_BYTE();
|
||||
m_iBat = x;
|
||||
m_flBat = ( (float)x ) / 100.0;
|
||||
m_flBat = ( (float)x ) / 100.0f;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -84,7 +86,7 @@ int CHudFlashlight::MsgFunc_Flashlight( const char *pszName, int iSize, void *p
|
|||
m_fOn = READ_BYTE();
|
||||
int x = READ_BYTE();
|
||||
m_iBat = x;
|
||||
m_flBat = ( (float)x ) / 100.0;
|
||||
m_flBat = ( (float)x ) / 100.0f;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -106,6 +108,9 @@ int CHudFlashlight::Draw( float flTime )
|
|||
int r, g, b, x, y, a;
|
||||
wrect_t rc;
|
||||
|
||||
if( gEngfuncs.IsSpectateOnly() )
|
||||
return 1;
|
||||
|
||||
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
|
||||
return 1;
|
||||
|
||||
|
@ -114,7 +119,7 @@ int CHudFlashlight::Draw( float flTime )
|
|||
else
|
||||
a = MIN_ALPHA;
|
||||
|
||||
if( m_flBat < 0.20 )
|
||||
if( m_flBat < 0.20f )
|
||||
UnpackRGB( r,g,b, RGB_REDISH );
|
||||
else
|
||||
UnpackRGB( r,g,b, RGB_YELLOWISH );
|
||||
|
@ -139,7 +144,7 @@ int CHudFlashlight::Draw( float flTime )
|
|||
|
||||
// draw the flashlight energy level
|
||||
x = ScreenWidth - m_iWidth - m_iWidth / 2;
|
||||
int iOffset = m_iWidth * ( 1.0 - m_flBat );
|
||||
int iOffset = m_iWidth * ( 1.0f - m_flBat );
|
||||
if( iOffset < m_iWidth )
|
||||
{
|
||||
rc = *m_prc2;
|
||||
|
|
|
@ -65,8 +65,8 @@ int CHudGeiger::Draw( float flTime )
|
|||
{
|
||||
int pct;
|
||||
float flvol = 0.0f;
|
||||
int rg[3];
|
||||
int i;
|
||||
//int rg[3];
|
||||
int i = 0;
|
||||
|
||||
if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 )
|
||||
{
|
||||
|
@ -78,96 +78,96 @@ int CHudGeiger::Draw( float flTime )
|
|||
else if( m_iGeigerRange > 600 )
|
||||
{
|
||||
pct = 2;
|
||||
flvol = 0.4; //Con_Printf( "range > 600\n" );
|
||||
rg[0] = 1;
|
||||
rg[1] = 1;
|
||||
flvol = 0.4f; //Con_Printf( "range > 600\n" );
|
||||
//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;
|
||||
flvol = 0.5f; //Con_Printf( "range > 500\n" );
|
||||
//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;
|
||||
flvol = 0.6f; //Con_Printf( "range > 400\n" );
|
||||
//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;
|
||||
flvol = 0.7f; //Con_Printf( "range > 300\n" );
|
||||
//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;
|
||||
flvol = 0.78f; //Con_Printf( "range > 200\n" );
|
||||
//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;
|
||||
flvol = 0.80f; //Con_Printf( "range > 150\n" );
|
||||
//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 )
|
||||
{
|
||||
pct = 80;
|
||||
flvol = 0.9; //Con_Printf( "range > 75\n" );
|
||||
flvol = 0.9f; //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;
|
||||
flvol = 0.95f; //Con_Printf( "range > 50\n" );
|
||||
//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;
|
||||
flvol = 1.0f; //Con_Printf( "range < 50\n" );
|
||||
//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.25f; // UTIL_RandomFloat( 0.25f, 0.5f );
|
||||
|
||||
if( ( rand() & 127 ) < pct || ( rand() & 127 ) < pct )
|
||||
{
|
||||
//S_StartDynamicSound( -1, 0, rgsfx[rand() % i], r_origin, flvol, 1.0, 0, 100 );
|
||||
//S_StartDynamicSound( -1, 0, rgsfx[rand() % i], r_origin, flvol, 1.0f, 0, 100 );
|
||||
char sz[256];
|
||||
|
||||
int j = rand() & 1;
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
// implementation of CHudHealth class
|
||||
//
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
|
@ -152,13 +152,14 @@ 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;
|
||||
|
@ -191,7 +192,7 @@ int CHudHealth::Draw( float flTime )
|
|||
// Has health changed? Flash the health #
|
||||
if( m_fFade )
|
||||
{
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
|
||||
if( m_fFade <= 0 )
|
||||
{
|
||||
a = MIN_ALPHA;
|
||||
|
@ -231,7 +232,8 @@ int CHudHealth::Draw( float flTime )
|
|||
|
||||
int iHeight = gHUD.m_iFontHeight;
|
||||
int iWidth = HealthWidth / 10;
|
||||
FillRGBA( x, y, iWidth, iHeight, 255, 160, 0, a );
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
FillRGBA( x, y, iWidth, iHeight, r, g, b, a );
|
||||
}
|
||||
|
||||
DrawDamage( flTime );
|
||||
|
@ -269,28 +271,28 @@ void CHudHealth::CalcDamageDirection( vec3_t vecFrom )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( side > 0 )
|
||||
if( side > 0.0f )
|
||||
{
|
||||
if( side > 0.3 )
|
||||
m_fAttackFront = max( m_fAttackFront, side );
|
||||
if( side > 0.3f )
|
||||
m_fAttackFront = Q_max( m_fAttackFront, side );
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = fabs( side );
|
||||
if( f > 0.3 )
|
||||
m_fAttackRear = max( m_fAttackRear, f );
|
||||
if( f > 0.3f )
|
||||
m_fAttackRear = Q_max( m_fAttackRear, f );
|
||||
}
|
||||
|
||||
if( front > 0 )
|
||||
if( front > 0.0f )
|
||||
{
|
||||
if( front > 0.3 )
|
||||
m_fAttackRight = max( m_fAttackRight, front );
|
||||
if( front > 0.3f )
|
||||
m_fAttackRight = Q_max( m_fAttackRight, front );
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = fabs( front );
|
||||
if( f > 0.3 )
|
||||
m_fAttackLeft = max( m_fAttackLeft, f );
|
||||
if( f > 0.3f )
|
||||
m_fAttackLeft = Q_max( m_fAttackLeft, f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,54 +311,54 @@ int CHudHealth::DrawPain( float flTime )
|
|||
float fFade = gHUD.m_flTimeDelta * 2;
|
||||
|
||||
// SPR_Draw top
|
||||
if( m_fAttackFront > 0.4 )
|
||||
if( m_fAttackFront > 0.4f )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * max( m_fAttackFront, 0.5 );
|
||||
shade = a * Q_max( m_fAttackFront, 0.5f );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 0 ) / 2;
|
||||
y = ScreenHeight / 2 - SPR_Height( m_hSprite, 0 ) * 3;
|
||||
SPR_DrawAdditive( 0, x, y, NULL );
|
||||
m_fAttackFront = max( 0, m_fAttackFront - fFade );
|
||||
m_fAttackFront = Q_max( 0, m_fAttackFront - fFade );
|
||||
} else
|
||||
m_fAttackFront = 0;
|
||||
|
||||
if( m_fAttackRight > 0.4 )
|
||||
if( m_fAttackRight > 0.4f )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * max( m_fAttackRight, 0.5 );
|
||||
shade = a * Q_max( m_fAttackRight, 0.5f );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
x = ScreenWidth / 2 + SPR_Width( m_hSprite, 1 ) * 2;
|
||||
y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2;
|
||||
SPR_DrawAdditive( 1, x, y, NULL );
|
||||
m_fAttackRight = max( 0, m_fAttackRight - fFade );
|
||||
m_fAttackRight = Q_max( 0, m_fAttackRight - fFade );
|
||||
}
|
||||
else
|
||||
m_fAttackRight = 0;
|
||||
|
||||
if( m_fAttackRear > 0.4 )
|
||||
if( m_fAttackRear > 0.4f )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * max( m_fAttackRear, 0.5 );
|
||||
shade = a * Q_max( m_fAttackRear, 0.5f );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 2 ) / 2;
|
||||
y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2;
|
||||
SPR_DrawAdditive( 2, x, y, NULL );
|
||||
m_fAttackRear = max( 0, m_fAttackRear - fFade );
|
||||
m_fAttackRear = Q_max( 0, m_fAttackRear - fFade );
|
||||
}
|
||||
else
|
||||
m_fAttackRear = 0;
|
||||
|
||||
if( m_fAttackLeft > 0.4 )
|
||||
if( m_fAttackLeft > 0.4f )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * max( m_fAttackLeft, 0.5 );
|
||||
shade = a * Q_max( m_fAttackLeft, 0.5f );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
|
@ -364,7 +366,7 @@ int CHudHealth::DrawPain( float flTime )
|
|||
y = ScreenHeight / 2 - SPR_Height( m_hSprite,3 ) / 2;
|
||||
SPR_DrawAdditive( 3, x, y, NULL );
|
||||
|
||||
m_fAttackLeft = max( 0, m_fAttackLeft - fFade );
|
||||
m_fAttackLeft = Q_max( 0, m_fAttackLeft - fFade );
|
||||
} else
|
||||
m_fAttackLeft = 0;
|
||||
|
||||
|
@ -381,7 +383,7 @@ int CHudHealth::DrawDamage( float flTime )
|
|||
|
||||
UnpackRGB( r, g, b, RGB_YELLOWISH );
|
||||
|
||||
a = (int)( fabs( sin( flTime * 2 ) ) * 256.0 );
|
||||
a = (int)( fabs( sin( flTime * 2.0f ) ) * 256.0f );
|
||||
|
||||
ScaleColors( r, g, b, a );
|
||||
|
||||
|
@ -396,7 +398,7 @@ int CHudHealth::DrawDamage( float flTime )
|
|||
SPR_Set( gHUD.GetSprite( m_HUD_dmg_bio + i ), r, g, b );
|
||||
SPR_DrawAdditive( 0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect( m_HUD_dmg_bio + i ) );
|
||||
|
||||
pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );
|
||||
pdmg->fExpire = Q_min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire );
|
||||
|
||||
if( pdmg->fExpire <= flTime // when the time has expired
|
||||
&& a < 40 ) // and the flash is at the low point of the cycle
|
||||
|
@ -460,7 +462,7 @@ void CHudHealth::UpdateTiles( float flTime, long bitsDamage )
|
|||
if( pdmg->y )
|
||||
pdmg->y -= giDmgHeight;
|
||||
}
|
||||
pdmg = &m_dmg[i];
|
||||
// pdmg = &m_dmg[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,7 +299,7 @@ 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 ) { }
|
||||
|
||||
|
@ -314,6 +315,7 @@ int CBasePlayerItem::Restore( class CRestore & ) { return 1; }
|
|||
int CBasePlayerItem::Save( class CSave & ) { return 1; }
|
||||
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
|
||||
int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
|
||||
float CBasePlayerWeapon::GetNextAttackDelay( float flTime ) { return flTime; }
|
||||
void CBasePlayerItem::SetObjectCollisionBox( void ) { }
|
||||
void CBasePlayerItem::FallInit( void ) { }
|
||||
void CBasePlayerItem::FallThink( void ) { }
|
||||
|
@ -345,3 +347,4 @@ int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0;
|
|||
void CBasePlayerWeapon::RetireWeapon( void ) { }
|
||||
void CSoundEnt::InsertSound( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {}
|
||||
void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, float flRadius, int iClassIgnore, int bitsDamageType ){}
|
||||
void CSprite::AnimateUntilDead( void ) {}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
extern BEAM *pBeam;
|
||||
extern BEAM *pBeam2;
|
||||
extern TEMPENTITY *pFlare; // Vit_amiN: egon's energy flare
|
||||
void HUD_GetLastOrg( float *org );
|
||||
|
||||
void UpdateBeams( void )
|
||||
|
@ -67,13 +68,35 @@ void UpdateBeams( void )
|
|||
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.
|
||||
pBeam->die = gEngfuncs.GetClientTime() + 0.1f; // 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.
|
||||
pBeam2->die = gEngfuncs.GetClientTime() + 0.1f; // We keep it alive just a little bit forward in the future, just in case.
|
||||
}
|
||||
|
||||
if( pFlare ) // Vit_amiN: beam flare
|
||||
{
|
||||
pFlare->entity.origin = tr.endpos;
|
||||
pFlare->die = gEngfuncs.GetClientTime() + 0.1f; // We keep it alive just a little bit forward in the future, just in case.
|
||||
|
||||
if( gEngfuncs.GetMaxClients() != 1 ) // Singleplayer always draws the egon's energy beam flare
|
||||
{
|
||||
pFlare->flags |= FTENT_NOMODEL;
|
||||
|
||||
if( !( tr.allsolid || tr.ent <= 0 || tr.fraction == 1.0f ) ) // Beam hit some non-world entity
|
||||
{
|
||||
physent_t *pEntity = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent );
|
||||
|
||||
// Not the world, let's assume that we hit something organic ( dog, cat, uncle joe, etc )
|
||||
if( pEntity && !( pEntity->solid == SOLID_BSP || pEntity->movetype == MOVETYPE_PUSHSTEP ) )
|
||||
{
|
||||
pFlare->flags &= ~FTENT_NOMODEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,6 +109,6 @@ Add game specific, client-side objects here
|
|||
*/
|
||||
void Game_AddObjects( void )
|
||||
{
|
||||
if( pBeam && pBeam2 )
|
||||
if( pBeam || pBeam2 || pFlare ) // Vit_amiN: egon flare added
|
||||
UpdateBeams();
|
||||
}
|
||||
|
|
|
@ -75,7 +75,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];
|
||||
|
@ -96,7 +96,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 );
|
||||
}
|
||||
|
@ -151,7 +151,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;
|
||||
|
@ -163,7 +163,7 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i
|
|||
|
||||
m_fInReload = TRUE;
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,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;
|
||||
|
@ -218,8 +218,8 @@ BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, i
|
|||
SendWeaponAnim( iAnim, skiplocal, body );
|
||||
|
||||
g_irunninggausspred = false;
|
||||
m_pPlayer->m_flNextAttack = 0.5;
|
||||
m_flTimeWeaponIdle = 1.0;
|
||||
m_pPlayer->m_flNextAttack = 0.5f;
|
||||
m_flTimeWeaponIdle = 1.0f;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ BOOL CBasePlayerWeapon::PlayEmptySound( void )
|
|||
{
|
||||
if( m_iPlayEmptySound )
|
||||
{
|
||||
HUD_PlaySound( "weapons/357_cock1.wav", 0.8 );
|
||||
HUD_PlaySound( "weapons/357_cock1.wav", 0.8f );
|
||||
m_iPlayEmptySound = 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -288,7 +288,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, y, z;
|
||||
float x = 0.0f, y = 0.0f, z;
|
||||
|
||||
for( ULONG iShot = 1; iShot <= cShots; iShot++ )
|
||||
{
|
||||
|
@ -296,8 +296,8 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
|
|||
{
|
||||
// get circular gaussian spread
|
||||
do {
|
||||
x = RANDOM_FLOAT( -0.5, 0.5 ) + RANDOM_FLOAT( -0.5, 0.5 );
|
||||
y = RANDOM_FLOAT( -0.5, 0.5 ) + RANDOM_FLOAT( -0.5, 0.5 );
|
||||
x = RANDOM_FLOAT( -0.5f, 0.5f ) + RANDOM_FLOAT( -0.5f, 0.5f );
|
||||
y = RANDOM_FLOAT( -0.5f, 0.5f ) + RANDOM_FLOAT( -0.5f, 0.5f );
|
||||
z = x * x + y * y;
|
||||
} while( z > 1 );
|
||||
}
|
||||
|
@ -305,13 +305,13 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
|
|||
{
|
||||
//Use player's random seed.
|
||||
// get circular gaussian spread
|
||||
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5, 0.5 );
|
||||
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5, 0.5 );
|
||||
z = x * x + y * y;
|
||||
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5f, 0.5f ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5f, 0.5f );
|
||||
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5f, 0.5f ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5f, 0.5f );
|
||||
// z = x * x + y * y;
|
||||
}
|
||||
}
|
||||
|
||||
return Vector( x * vecSpread.x, y * vecSpread.y, 0.0 );
|
||||
return Vector( x * vecSpread.x, y * vecSpread.y, 0.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -323,7 +323,7 @@ Handles weapon firing, reloading, etc.
|
|||
*/
|
||||
void CBasePlayerWeapon::ItemPostFrame( void )
|
||||
{
|
||||
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= 0.0 ) )
|
||||
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= 0.0f ) )
|
||||
{
|
||||
#if 0 // FIXME, need ammo on client to make this work right
|
||||
// complete the reload.
|
||||
|
@ -338,7 +338,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
|
|||
m_fInReload = FALSE;
|
||||
}
|
||||
|
||||
if( ( m_pPlayer->pev->button & IN_ATTACK2 ) && ( m_flNextSecondaryAttack <= 0.0 ) )
|
||||
if( ( m_pPlayer->pev->button & IN_ATTACK2 ) && ( m_flNextSecondaryAttack <= 0.0f ) )
|
||||
{
|
||||
if( pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] )
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
|
|||
SecondaryAttack();
|
||||
m_pPlayer->pev->button &= ~IN_ATTACK2;
|
||||
}
|
||||
else if( ( m_pPlayer->pev->button & IN_ATTACK ) && ( m_flNextPrimaryAttack <= 0.0 ) )
|
||||
else if( ( m_pPlayer->pev->button & IN_ATTACK ) && ( m_flNextPrimaryAttack <= 0.0f ) )
|
||||
{
|
||||
if( ( m_iClip == 0 && pszAmmo1() ) || ( iMaxClip() == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
|
|||
m_fFireOnEmpty = FALSE;
|
||||
|
||||
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
|
||||
if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack < 0.0 )
|
||||
if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack < 0.0f )
|
||||
{
|
||||
Reload();
|
||||
return;
|
||||
|
@ -483,7 +483,7 @@ Don't actually trace, but act like the trace didn't hit anything.
|
|||
void UTIL_TraceLine( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr )
|
||||
{
|
||||
memset( ptr, 0, sizeof(*ptr) );
|
||||
ptr->flFraction = 1.0;
|
||||
ptr->flFraction = 1.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -560,27 +560,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
|
||||
|
@ -965,73 +944,73 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
|
|||
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;
|
||||
pto->m_fNextAimBonus -= cmd->msec / 1000.0;
|
||||
pto->m_flNextPrimaryAttack -= cmd->msec / 1000.0;
|
||||
pto->m_flNextSecondaryAttack -= cmd->msec / 1000.0;
|
||||
pto->m_flTimeWeaponIdle -= cmd->msec / 1000.0;
|
||||
pto->fuser1 -= cmd->msec / 1000.0;
|
||||
pto->m_flNextReload -= cmd->msec / 1000.0f;
|
||||
pto->m_fNextAimBonus -= cmd->msec / 1000.0f;
|
||||
pto->m_flNextPrimaryAttack -= cmd->msec / 1000.0f;
|
||||
pto->m_flNextSecondaryAttack -= cmd->msec / 1000.0f;
|
||||
pto->m_flTimeWeaponIdle -= cmd->msec / 1000.0f;
|
||||
pto->fuser1 -= cmd->msec / 1000.0f;
|
||||
|
||||
to->client.vuser3[2] = pCurrent->m_iSecondaryAmmoType;
|
||||
to->client.vuser4[0] = pCurrent->m_iPrimaryAmmoType;
|
||||
to->client.vuser4[1] = player.m_rgAmmo[pCurrent->m_iPrimaryAmmoType];
|
||||
to->client.vuser4[2] = player.m_rgAmmo[pCurrent->m_iSecondaryAmmoType];
|
||||
|
||||
/* if( pto->m_flPumpTime != -9999 )
|
||||
/* if( pto->m_flPumpTime != -9999.0f )
|
||||
{
|
||||
pto->m_flPumpTime -= cmd->msec / 1000.0;
|
||||
if( pto->m_flPumpTime < -0.001 )
|
||||
pto->m_flPumpTime = -0.001;
|
||||
pto->m_flPumpTime -= cmd->msec / 1000.0f;
|
||||
if( pto->m_flPumpTime < -0.001f )
|
||||
pto->m_flPumpTime = -0.001f;
|
||||
}*/
|
||||
|
||||
if( pto->m_fNextAimBonus < -1.0 )
|
||||
if( pto->m_fNextAimBonus < -1.0f )
|
||||
{
|
||||
pto->m_fNextAimBonus = -1.0;
|
||||
pto->m_fNextAimBonus = -1.0f;
|
||||
}
|
||||
|
||||
if( pto->m_flNextPrimaryAttack < -1.0 )
|
||||
if( pto->m_flNextPrimaryAttack < -1.0f )
|
||||
{
|
||||
pto->m_flNextPrimaryAttack = -1.0;
|
||||
pto->m_flNextPrimaryAttack = -1.0f;
|
||||
}
|
||||
|
||||
if( pto->m_flNextSecondaryAttack < -0.001 )
|
||||
if( pto->m_flNextSecondaryAttack < -0.001f )
|
||||
{
|
||||
pto->m_flNextSecondaryAttack = -0.001;
|
||||
pto->m_flNextSecondaryAttack = -0.001f;
|
||||
}
|
||||
|
||||
if( pto->m_flTimeWeaponIdle < -0.001 )
|
||||
if( pto->m_flTimeWeaponIdle < -0.001f )
|
||||
{
|
||||
pto->m_flTimeWeaponIdle = -0.001;
|
||||
pto->m_flTimeWeaponIdle = -0.001f;
|
||||
}
|
||||
|
||||
if( pto->m_flNextReload < -0.001 )
|
||||
if( pto->m_flNextReload < -0.001f )
|
||||
{
|
||||
pto->m_flNextReload = -0.001;
|
||||
pto->m_flNextReload = -0.001f;
|
||||
}
|
||||
|
||||
if( pto->fuser1 < -0.001 )
|
||||
if( pto->fuser1 < -0.001f )
|
||||
{
|
||||
pto->fuser1 = -0.001;
|
||||
pto->fuser1 = -0.001f;
|
||||
}
|
||||
}
|
||||
|
||||
// m_flNextAttack is now part of the weapons, but is part of the player instead
|
||||
to->client.m_flNextAttack -= cmd->msec / 1000.0;
|
||||
if( to->client.m_flNextAttack < -0.001 )
|
||||
to->client.m_flNextAttack -= cmd->msec / 1000.0f;
|
||||
if( to->client.m_flNextAttack < -0.001f )
|
||||
{
|
||||
to->client.m_flNextAttack = -0.001;
|
||||
to->client.m_flNextAttack = -0.001f;
|
||||
}
|
||||
|
||||
to->client.fuser2 -= cmd->msec / 1000.0;
|
||||
if( to->client.fuser2 < -0.001 )
|
||||
to->client.fuser2 -= cmd->msec / 1000.0f;
|
||||
if( to->client.fuser2 < -0.001f )
|
||||
{
|
||||
to->client.fuser2 = -0.001;
|
||||
to->client.fuser2 = -0.001f;
|
||||
}
|
||||
|
||||
to->client.fuser3 -= cmd->msec / 1000.0;
|
||||
if( to->client.fuser3 < -0.001 )
|
||||
to->client.fuser3 -= cmd->msec / 1000.0f;
|
||||
if( to->client.fuser3 < -0.001f )
|
||||
{
|
||||
to->client.fuser3 = -0.001;
|
||||
to->client.fuser3 = -0.001f;
|
||||
}
|
||||
|
||||
// Store off the last position from the predicted state.
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
@ -189,11 +190,13 @@ void CHud::Init( void )
|
|||
m_iLogo = 0;
|
||||
m_iFOV = 0;
|
||||
|
||||
CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 );
|
||||
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
|
||||
CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", FCVAR_ARCHIVE );
|
||||
CVAR_CREATE( "cl_autowepswitch", "1", FCVAR_ARCHIVE | FCVAR_USERINFO );
|
||||
default_fov = CVAR_CREATE( "default_fov", "90", FCVAR_ARCHIVE );
|
||||
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;
|
||||
|
||||
|
@ -379,6 +382,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();
|
||||
|
@ -511,10 +526,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 )
|
||||
|
|
19
cl_dll/hud.h
19
cl_dll/hud.h
|
@ -19,7 +19,9 @@
|
|||
//
|
||||
// CHud handles the message, calculation, and drawing the HUD
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#ifndef HUD_H
|
||||
#define HUD_H
|
||||
#define RGB_YELLOWISH 0x00FFA000 //255,160,0
|
||||
#define RGB_REDISH 0x00FF1010 //255,160,0
|
||||
#define RGB_GREENISH 0x0000A000 //0,160,0
|
||||
|
@ -228,7 +230,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 +482,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 +543,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
|
||||
|
@ -588,11 +590,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:
|
||||
|
@ -677,3 +679,4 @@ extern int g_iTeamNumber;
|
|||
extern int g_iUser1;
|
||||
extern int g_iUser2;
|
||||
extern int g_iUser3;
|
||||
#endif
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
//========= 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"
|
||||
|
||||
typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf );
|
||||
// redefine
|
||||
// typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf );
|
||||
#include "wrect.h"
|
||||
#include "../engine/cdll_int.h"
|
||||
extern cl_enginefunc_t gEngfuncs;
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
extern BEAM *pBeam;
|
||||
extern BEAM *pBeam2;
|
||||
extern TEMPENTITY *pFlare; // Vit_amiN
|
||||
|
||||
extern float g_lastFOV; // Vit_amiN
|
||||
|
||||
/// USER-DEFINED SERVER MESSAGE HANDLERS
|
||||
|
||||
|
@ -48,6 +51,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;
|
||||
}
|
||||
|
||||
|
@ -72,6 +79,7 @@ void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
|||
|
||||
//Probably not a good place to put this.
|
||||
pBeam = pBeam2 = NULL;
|
||||
pFlare = NULL; // Vit_amiN: clear egon's beam flare
|
||||
}
|
||||
|
||||
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
|
||||
|
@ -107,10 +115,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;
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
//
|
||||
// hud_redraw.cpp
|
||||
//
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
//#include "triangleapi.h"
|
||||
|
@ -75,7 +76,7 @@ void CHud::Think( void )
|
|||
if( m_iFOV == 0 )
|
||||
{
|
||||
// only let players adjust up in fov, and only if they are not overriden by something else
|
||||
m_iFOV = max( default_fov->value, 90 );
|
||||
m_iFOV = Q_max( default_fov->value, 90 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,13 +87,20 @@ int CHud::Redraw( float flTime, int intermission )
|
|||
{
|
||||
m_fOldTime = m_flTime; // save time of previous redraw
|
||||
m_flTime = flTime;
|
||||
m_flTimeDelta = (double)m_flTime - m_fOldTime;
|
||||
m_flTimeDelta = (double)( m_flTime - m_fOldTime );
|
||||
static float m_flShotTime = 0;
|
||||
|
||||
// Clock was reset, reset delta
|
||||
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.0f; // Take a screenshot in a second
|
||||
}
|
||||
|
||||
if( m_flShotTime && m_flShotTime < flTime )
|
||||
{
|
||||
gEngfuncs.pfnClientCmd( "snapshot\n" );
|
||||
|
@ -192,7 +200,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 )
|
||||
{
|
||||
|
@ -226,7 +234,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++ )
|
||||
|
@ -244,10 +285,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:
|
||||
//
|
||||
|
@ -69,10 +69,10 @@ void SpectatorSpray( void )
|
|||
VectorScale( forward, 128, forward );
|
||||
VectorAdd( forward, v_origin, forward );
|
||||
pmtrace_t * trace = gEngfuncs.PM_TraceLine( v_origin, forward, PM_TRACELINE_PHYSENTSONLY, 2, -1 );
|
||||
if( trace->fraction != 1.0 )
|
||||
if( trace->fraction != 1.0f )
|
||||
{
|
||||
sprintf( string, "drc_spray %.2f %.2f %.2f %i",
|
||||
trace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );
|
||||
(double)trace->endpos[0], (double)trace->endpos[1], (double)trace->endpos[2], trace->ent );
|
||||
gEngfuncs.pfnServerCmd( string );
|
||||
}
|
||||
}
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -355,7 +355,7 @@ int CHudSpectator::Draw( float flTime )
|
|||
int lx;
|
||||
|
||||
char string[256];
|
||||
float * color;
|
||||
float *color;
|
||||
|
||||
// draw only in spectator mode
|
||||
if( !g_iUser1 )
|
||||
|
@ -820,12 +820,12 @@ bool CHudSpectator::IsActivePlayer( cl_entity_t *ent )
|
|||
|
||||
bool CHudSpectator::ParseOverviewFile()
|
||||
{
|
||||
char filename[255] = { 0 };
|
||||
char levelname[255] = { 0 };
|
||||
char filename[512] = { 0 };
|
||||
char levelname[256] = { 0 };
|
||||
char token[1024] = { 0 };
|
||||
float height;
|
||||
|
||||
char *pfile = NULL;
|
||||
char *afile = NULL, *pfile = NULL;
|
||||
|
||||
memset( &m_OverviewData, 0, sizeof(m_OverviewData) );
|
||||
|
||||
|
@ -842,7 +842,7 @@ bool CHudSpectator::ParseOverviewFile()
|
|||
m_OverviewData.layersHeights[0] = 0.0f;
|
||||
strcpy( m_OverviewData.map, gEngfuncs.pfnGetLevelName() );
|
||||
|
||||
if( strlen( m_OverviewData.map ) == 0 )
|
||||
if( m_OverviewData.map[0] == '\0' )
|
||||
return false; // not active yet
|
||||
|
||||
strcpy( levelname, m_OverviewData.map + 5 );
|
||||
|
@ -850,7 +850,7 @@ bool CHudSpectator::ParseOverviewFile()
|
|||
|
||||
sprintf( filename, "overviews/%s.txt", levelname );
|
||||
|
||||
pfile = (char *)gEngfuncs.COM_LoadFile( filename, 5, NULL );
|
||||
afile = pfile = (char *)gEngfuncs.COM_LoadFile( filename, 5, NULL );
|
||||
|
||||
if( !pfile )
|
||||
{
|
||||
|
@ -963,7 +963,7 @@ bool CHudSpectator::ParseOverviewFile()
|
|||
}
|
||||
}
|
||||
|
||||
gEngfuncs.COM_FreeFile( pfile );
|
||||
gEngfuncs.COM_FreeFile( afile );
|
||||
|
||||
m_mapZoom = m_OverviewData.zoom;
|
||||
m_mapOrigin = m_OverviewData.origin;
|
||||
|
@ -987,15 +987,15 @@ void CHudSpectator::DrawOverviewLayer()
|
|||
float screenaspect, xs, ys, xStep, yStep, x, y, z;
|
||||
int ix, iy, i, xTiles, yTiles, frame;
|
||||
|
||||
qboolean hasMapImage = m_MapSprite?TRUE:FALSE;
|
||||
model_t * dummySprite = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprUnkownMap);
|
||||
qboolean hasMapImage = m_MapSprite ? TRUE : FALSE;
|
||||
model_t *dummySprite = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprUnkownMap );
|
||||
|
||||
if ( hasMapImage)
|
||||
if( hasMapImage )
|
||||
{
|
||||
i = m_MapSprite->numframes / (4*3);
|
||||
i = sqrt(i);
|
||||
xTiles = i*4;
|
||||
yTiles = i*3;
|
||||
i = m_MapSprite->numframes / ( 4 * 3 );
|
||||
i = sqrt( float( i ) );
|
||||
xTiles = i * 4;
|
||||
yTiles = i * 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1014,7 +1014,7 @@ void CHudSpectator::DrawOverviewLayer()
|
|||
|
||||
gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );
|
||||
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
|
||||
gEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 );
|
||||
gEngfuncs.pTriAPI->Color4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
frame = 0;
|
||||
|
||||
|
@ -1143,7 +1143,7 @@ void CHudSpectator::DrawOverviewEntities()
|
|||
|
||||
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
|
||||
|
||||
gEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 );
|
||||
gEngfuncs.pTriAPI->Color4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f(1, 0);
|
||||
VectorMA( origin, 16.0f * sizeScale, up, point );
|
||||
|
@ -1183,28 +1183,28 @@ void CHudSpectator::DrawOverviewEntities()
|
|||
hSpriteModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprBeam );
|
||||
gEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );
|
||||
|
||||
gEngfuncs.pTriAPI->Color4f( r, g, b, 0.3 );
|
||||
gEngfuncs.pTriAPI->Color4f( r, g, b, 0.3f );
|
||||
|
||||
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4, origin[1] + 4, origin[2] - zScale );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4, origin[1] - 4, origin[2] - zScale );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4, origin[1] - 4, z );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4, origin[1] + 4, z );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 0.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4.0f, origin[1] + 4.0f, origin[2] - zScale );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 0.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4.0f, origin[1] - 4.0f, origin[2] - zScale );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 1.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4.0f, origin[1] - 4.0f, z );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 1.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4.0f, origin[1] + 4.0f, z );
|
||||
gEngfuncs.pTriAPI->End();
|
||||
|
||||
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4, origin[1] + 4, origin[2] - zScale );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4, origin[1] - 4, origin[2] - zScale );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4, origin[1] - 4, z );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4, origin[1] + 4, z );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 0.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4.0f, origin[1] + 4.0f, origin[2] - zScale );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 0.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4.0f, origin[1] - 4.0f, origin[2] - zScale );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 1.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4.0f, origin[1] - 4.0f, z );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 1.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4.0f, origin[1] + 4.0f, z );
|
||||
gEngfuncs.pTriAPI->End();
|
||||
|
||||
// calculate screen position for name and infromation in hud::draw()
|
||||
|
@ -1265,7 +1265,7 @@ void CHudSpectator::DrawOverviewEntities()
|
|||
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
|
||||
gEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );
|
||||
|
||||
gEngfuncs.pTriAPI->Color4f( r, g, b, 1.0 );
|
||||
gEngfuncs.pTriAPI->Color4f( r, g, b, 1.0f );
|
||||
|
||||
AngleVectors( angles, forward, NULL, NULL );
|
||||
VectorScale( forward, 512.0f, forward );
|
||||
|
@ -1282,13 +1282,13 @@ void CHudSpectator::DrawOverviewEntities()
|
|||
VectorTransform( forward, rmatrix , left );
|
||||
|
||||
gEngfuncs.pTriAPI->Begin( TRI_TRIANGLES );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 0.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( x + right[0], y + right[1], ( z + right[2] ) * zScale);
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 1.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( x, y, z * zScale );
|
||||
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
|
||||
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 1.0f );
|
||||
gEngfuncs.pTriAPI->Vertex3f( x + left[0], y + left[1], ( z + left[2] ) * zScale );
|
||||
gEngfuncs.pTriAPI->End ();
|
||||
}
|
||||
|
@ -1329,7 +1329,7 @@ void CHudSpectator::CheckOverviewEntities()
|
|||
bool CHudSpectator::AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname)
|
||||
{
|
||||
HSPRITE hSprite = 0;
|
||||
double duration = -1.0f; // duration -1 means show it only this frame;
|
||||
double duration = -1.0; // duration -1 means show it only this frame;
|
||||
|
||||
if( !ent )
|
||||
return false;
|
||||
|
@ -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 );
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
// hud_update.cpp
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
int CL_ButtonBits( int );
|
||||
void CL_ResetButtonBits( int bits );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -28,16 +28,16 @@ extern cl_enginefunc_t gEngfuncs;
|
|||
|
||||
//-------------------------------------------------- Constants
|
||||
|
||||
#define CAM_DIST_DELTA 1.0
|
||||
#define CAM_ANGLE_DELTA 2.5
|
||||
#define CAM_ANGLE_SPEED 2.5
|
||||
#define CAM_MIN_DIST 30.0
|
||||
#define CAM_ANGLE_MOVE .5
|
||||
#define MAX_ANGLE_DIFF 10.0
|
||||
#define PITCH_MAX 90.0
|
||||
#define PITCH_MIN 0
|
||||
#define YAW_MAX 135.0
|
||||
#define YAW_MIN -135.0
|
||||
#define CAM_DIST_DELTA 1.0f
|
||||
#define CAM_ANGLE_DELTA 2.5f
|
||||
#define CAM_ANGLE_SPEED 2.5f
|
||||
#define CAM_MIN_DIST 30.0f
|
||||
#define CAM_ANGLE_MOVE 0.5f
|
||||
#define MAX_ANGLE_DIFF 10.0f
|
||||
#define PITCH_MAX 90.0f
|
||||
#define PITCH_MIN 0.0f
|
||||
#define YAW_MAX 135.0f
|
||||
#define YAW_MIN -135.0f
|
||||
|
||||
enum ECAM_Command
|
||||
{
|
||||
|
@ -91,35 +91,35 @@ float MoveToward( float cur, float goal, float maxspeed )
|
|||
{
|
||||
if( cur != goal )
|
||||
{
|
||||
if( fabs( cur - goal ) > 180.0 )
|
||||
if( fabs( cur - goal ) > 180.0f )
|
||||
{
|
||||
if( cur < goal )
|
||||
cur += 360.0;
|
||||
cur += 360.0f;
|
||||
else
|
||||
cur -= 360.0;
|
||||
cur -= 360.0f;
|
||||
}
|
||||
|
||||
if( cur < goal )
|
||||
{
|
||||
if( cur < goal - 1.0 )
|
||||
cur += ( goal - cur ) / 4.0;
|
||||
if( cur < goal - 1.0f )
|
||||
cur += ( goal - cur ) * 0.25f;
|
||||
else
|
||||
cur = goal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( cur > goal + 1.0 )
|
||||
cur -= ( cur - goal ) / 4.0;
|
||||
if( cur > goal + 1.0f )
|
||||
cur -= ( cur - goal ) * 0.25f;
|
||||
else
|
||||
cur = goal;
|
||||
}
|
||||
}
|
||||
|
||||
// bring cur back into range
|
||||
if( cur < 0 )
|
||||
cur += 360.0;
|
||||
else if( cur >= 360 )
|
||||
cur -= 360;
|
||||
if( cur < 0.0f )
|
||||
cur += 360.0f;
|
||||
else if( cur >= 360.0f )
|
||||
cur -= 360.0f;
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ void DLLEXPORT CAM_Think( void )
|
|||
if( cam_contain->value )
|
||||
{
|
||||
gEngfuncs.GetClientOrigin( origin );
|
||||
ext[0] = ext[1] = ext[2] = 0.0;
|
||||
ext[0] = ext[1] = ext[2] = 0.0f;
|
||||
}
|
||||
#endif
|
||||
camAngles[PITCH] = cam_idealpitch->value;
|
||||
|
@ -195,7 +195,7 @@ void DLLEXPORT CAM_Think( void )
|
|||
//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)
|
||||
if( cam_mouse.x>gEngfuncs.GetWindowCenterX() )
|
||||
{
|
||||
//if( ( camAngles[YAW] >= 225.0 ) || ( camAngles[YAW] < 135.0 ) )
|
||||
//if( ( camAngles[YAW] >= 225.0f ) || ( camAngles[YAW] < 135.0f ) )
|
||||
if( camAngles[YAW] < c_maxyaw->value )
|
||||
{
|
||||
camAngles[YAW] += CAM_ANGLE_MOVE * ( ( cam_mouse.x - gEngfuncs.GetWindowCenterX() ) / 2 );
|
||||
|
@ -207,7 +207,7 @@ void DLLEXPORT CAM_Think( void )
|
|||
}
|
||||
else if( cam_mouse.x<gEngfuncs.GetWindowCenterX() )
|
||||
{
|
||||
//if( ( camAngles[YAW] <= 135.0 ) || ( camAngles[YAW] > 225.0 ) )
|
||||
//if( ( camAngles[YAW] <= 135.0f ) || ( camAngles[YAW] > 225.0f ) )
|
||||
if( camAngles[YAW] > c_minyaw->value )
|
||||
{
|
||||
camAngles[YAW] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterX() - cam_mouse.x ) / 2 );
|
||||
|
@ -363,10 +363,10 @@ void DLLEXPORT CAM_Think( void )
|
|||
if( camAngles[PITCH] - viewangles[PITCH] != cam_idealpitch->value )
|
||||
camAngles[PITCH] = MoveToward( camAngles[PITCH], cam_idealpitch->value + viewangles[PITCH], CAM_ANGLE_SPEED );
|
||||
|
||||
if( fabs( camAngles[2] - cam_idealdist->value ) < 2.0 )
|
||||
if( fabs( camAngles[2] - cam_idealdist->value ) < 2.0f )
|
||||
camAngles[2] = cam_idealdist->value;
|
||||
else
|
||||
camAngles[2] += ( cam_idealdist->value - camAngles[2] ) / 4.0;
|
||||
camAngles[2] += ( cam_idealdist->value - camAngles[2] ) * 0.25f;
|
||||
}
|
||||
#ifdef LATER
|
||||
if( cam_contain->value )
|
||||
|
@ -382,9 +382,9 @@ void DLLEXPORT CAM_Think( void )
|
|||
|
||||
// check line from r_refdef.vieworg to pnt
|
||||
memset( &clip, 0, sizeof(moveclip_t) );
|
||||
ext[0] = ext[1] = ext[2] = 0.0;
|
||||
ext[0] = ext[1] = ext[2] = 0.0f;
|
||||
clip.trace = SV_ClipMoveToEntity( sv.edicts, r_refdef.vieworg, ext, ext, pnt );
|
||||
if( clip.trace.fraction != 1.0 )
|
||||
if( clip.trace.fraction != 1.0f )
|
||||
return;
|
||||
}
|
||||
#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( 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:
|
||||
//
|
||||
|
@ -169,7 +169,7 @@ int KB_ConvertString( char *in, char **ppout )
|
|||
*pEnd = '\0';
|
||||
|
||||
pBinding = NULL;
|
||||
if( strlen( binding + 1 ) > 0 )
|
||||
if( binding[1] != '\0' )
|
||||
{
|
||||
// See if there is a binding for binding?
|
||||
pBinding = gEngfuncs.Key_LookupBinding( binding + 1 );
|
||||
|
@ -819,7 +819,7 @@ void DLLEXPORT CL_CreateMove( float frametime, struct usercmd_s *cmd, int active
|
|||
|
||||
// clip to maxspeed
|
||||
spd = gEngfuncs.GetClientMaxspeed();
|
||||
if( spd != 0.0 )
|
||||
if( spd != 0.0f )
|
||||
{
|
||||
// scale the 3 speeds so that the total velocity is not > cl.maxspeed
|
||||
float fmov = sqrt( ( cmd->forwardmove * cmd->forwardmove ) + ( cmd->sidemove * cmd->sidemove ) + ( cmd->upmove * cmd->upmove ) );
|
||||
|
|
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
|
||||
|
@ -54,8 +43,8 @@ float rel_pitch;
|
|||
#define IMPULSE_DOWN 2
|
||||
#define IMPULSE_UP 4
|
||||
|
||||
bool CL_IsDead();
|
||||
Vector dead_viewangles(0, 0, 0);
|
||||
int CL_IsDead( void );
|
||||
extern Vector dead_viewangles;
|
||||
|
||||
void IN_ToggleButtons( float forwardmove, float sidemove )
|
||||
{
|
||||
|
@ -93,49 +82,49 @@ void IN_ToggleButtons( float forwardmove, float sidemove )
|
|||
}
|
||||
}
|
||||
|
||||
if( forwardmove > 0.7 && !( moveflags & F ) )
|
||||
if( forwardmove > 0.7f && !( moveflags & F ) )
|
||||
{
|
||||
moveflags |= F;
|
||||
in_forward.state |= BUTTON_DOWN;
|
||||
}
|
||||
if( forwardmove < 0.7 && ( moveflags & F ) )
|
||||
if( forwardmove < 0.7f && ( moveflags & F ) )
|
||||
{
|
||||
moveflags &= ~F;
|
||||
in_forward.state &= ~BUTTON_DOWN;
|
||||
}
|
||||
if( forwardmove < -0.7 && !( moveflags & B ) )
|
||||
if( forwardmove < -0.7f && !( moveflags & B ) )
|
||||
{
|
||||
moveflags |= B;
|
||||
in_back.state |= BUTTON_DOWN;
|
||||
}
|
||||
if( forwardmove > -0.7 && ( moveflags & B ) )
|
||||
if( forwardmove > -0.7f && ( moveflags & B ) )
|
||||
{
|
||||
moveflags &= ~B;
|
||||
in_back.state &= ~BUTTON_DOWN;
|
||||
}
|
||||
if( sidemove > 0.9 && !( moveflags & R ) )
|
||||
if( sidemove > 0.9f && !( moveflags & R ) )
|
||||
{
|
||||
moveflags |= R;
|
||||
in_moveright.state |= BUTTON_DOWN;
|
||||
}
|
||||
if( sidemove < 0.9 && ( moveflags & R ) )
|
||||
if( sidemove < 0.9f && ( moveflags & R ) )
|
||||
{
|
||||
moveflags &= ~R;
|
||||
in_moveright.state &= ~BUTTON_DOWN;
|
||||
}
|
||||
if( sidemove < -0.9 && !( moveflags & L ) )
|
||||
if( sidemove < -0.9f && !( moveflags & L ) )
|
||||
{
|
||||
moveflags |= L;
|
||||
in_moveleft.state |= BUTTON_DOWN;
|
||||
}
|
||||
if( sidemove > -0.9 && ( moveflags & L ) )
|
||||
if( sidemove > -0.9f && ( moveflags & L ) )
|
||||
{
|
||||
moveflags &= ~L;
|
||||
in_moveleft.state &= ~BUTTON_DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -239,7 +228,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
|
||||
|
@ -261,37 +250,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 )
|
||||
|
@ -66,22 +66,22 @@ float CHudMessage::FadeBlend( float fadein, float fadeout, float hold, float loc
|
|||
float fadeTime = fadein + hold;
|
||||
float fadeBlend;
|
||||
|
||||
if( localTime < 0 )
|
||||
if( localTime < 0.0f )
|
||||
return 0;
|
||||
|
||||
if( localTime < fadein )
|
||||
{
|
||||
fadeBlend = 1 - ( ( fadein - localTime ) / fadein );
|
||||
fadeBlend = 1.0f - ( ( fadein - localTime ) / fadein );
|
||||
}
|
||||
else if( localTime > fadeTime )
|
||||
{
|
||||
if( fadeout > 0 )
|
||||
fadeBlend = 1 - ( ( localTime - fadeTime ) / fadeout );
|
||||
if( fadeout > 0.0f )
|
||||
fadeBlend = 1.0f - ( ( localTime - fadeTime ) / fadeout );
|
||||
else
|
||||
fadeBlend = 0;
|
||||
fadeBlend = 0.0f;
|
||||
}
|
||||
else
|
||||
fadeBlend = 1;
|
||||
fadeBlend = 1.0f;
|
||||
|
||||
return fadeBlend;
|
||||
}
|
||||
|
@ -91,14 +91,14 @@ int CHudMessage::XPosition( float x, int width, int totalWidth )
|
|||
{
|
||||
int xPos;
|
||||
|
||||
if( x == -1 )
|
||||
if( x == -1.0f )
|
||||
{
|
||||
xPos = ( ScreenWidth - width ) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( x < 0 )
|
||||
xPos = ( 1.0 + x ) * ScreenWidth - totalWidth; // Alight right
|
||||
if( x < 0.0f )
|
||||
xPos = ( 1.0f + x ) * ScreenWidth - totalWidth; // Alight right
|
||||
else
|
||||
xPos = x * ScreenWidth;
|
||||
}
|
||||
|
@ -116,12 +116,12 @@ int CHudMessage::YPosition( float y, int height )
|
|||
int yPos;
|
||||
|
||||
if( y == -1 ) // Centered?
|
||||
yPos = ( ScreenHeight - height ) * 0.5;
|
||||
yPos = ( ScreenHeight - height ) * 0.5f;
|
||||
else
|
||||
{
|
||||
// Alight bottom?
|
||||
if ( y < 0 )
|
||||
yPos = ( 1.0 + y ) * ScreenHeight - height; // Alight bottom
|
||||
yPos = ( 1.0f + y ) * ScreenHeight - height; // Alight bottom
|
||||
else // align top
|
||||
yPos = y * ScreenHeight;
|
||||
}
|
||||
|
@ -164,18 +164,20 @@ void CHudMessage::MessageScanNextChar( void )
|
|||
float deltaTime = m_parms.time - m_parms.charTime;
|
||||
|
||||
destRed = destGreen = destBlue = 0;
|
||||
if ( m_parms.time > m_parms.fadeTime )
|
||||
if( m_parms.time > m_parms.fadeTime )
|
||||
{
|
||||
blend = m_parms.fadeBlend;
|
||||
}
|
||||
else if ( deltaTime > m_parms.pMessage->fxtime )
|
||||
else if( deltaTime > m_parms.pMessage->fxtime )
|
||||
{
|
||||
blend = 0; // pure dest
|
||||
}
|
||||
else
|
||||
{
|
||||
destRed = m_parms.pMessage->r2;
|
||||
destGreen = m_parms.pMessage->g2;
|
||||
destBlue = m_parms.pMessage->b2;
|
||||
blend = 255 - (deltaTime * (1.0/m_parms.pMessage->fxtime) * 255.0 + 0.5);
|
||||
blend = 255 - ( deltaTime * ( 1.0f / m_parms.pMessage->fxtime) * 255.0f + 0.5f );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -208,7 +210,7 @@ void CHudMessage::MessageScanStart( void )
|
|||
|
||||
if( m_parms.time < m_parms.pMessage->fadein )
|
||||
{
|
||||
m_parms.fadeBlend = ( ( m_parms.pMessage->fadein - m_parms.time ) * ( 1.0 / m_parms.pMessage->fadein ) * 255 );
|
||||
m_parms.fadeBlend = ( ( m_parms.pMessage->fadein - m_parms.time ) * ( 1.0f / m_parms.pMessage->fadein ) * 255 );
|
||||
}
|
||||
else if( m_parms.time > m_parms.fadeTime )
|
||||
{
|
||||
|
@ -240,7 +242,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
|
|||
{
|
||||
int i, j, length, width;
|
||||
const char *pText;
|
||||
unsigned char line[80];
|
||||
const char *pLineStart;
|
||||
|
||||
pText = pMessage->pMessage;
|
||||
// Count lines
|
||||
|
@ -260,7 +262,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++;
|
||||
}
|
||||
|
@ -278,22 +280,21 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
|
|||
{
|
||||
m_parms.lineLength = 0;
|
||||
m_parms.width = 0;
|
||||
pLineStart = pText;
|
||||
while( *pText && *pText != '\n' )
|
||||
{
|
||||
unsigned char c = *pText;
|
||||
line[m_parms.lineLength] = c;
|
||||
m_parms.width += gHUD.m_scrinfo.charWidths[c];
|
||||
m_parms.lineLength++;
|
||||
pText++;
|
||||
}
|
||||
pText++; // Skip LF
|
||||
line[m_parms.lineLength] = 0;
|
||||
|
||||
m_parms.x = XPosition( pMessage->x, m_parms.width, m_parms.totalWidth );
|
||||
|
||||
for( j = 0; j < m_parms.lineLength; j++ )
|
||||
{
|
||||
m_parms.text = line[j];
|
||||
m_parms.text = pLineStart[j];
|
||||
int next = m_parms.x + gHUD.m_scrinfo.charWidths[m_parms.text];
|
||||
MessageScanNextChar();
|
||||
|
||||
|
@ -310,7 +311,7 @@ int CHudMessage::Draw( float fTime )
|
|||
{
|
||||
int i, drawn;
|
||||
client_textmessage_t *pMessage;
|
||||
float endTime;
|
||||
float endTime = 0.0f;
|
||||
|
||||
drawn = 0;
|
||||
|
||||
|
@ -351,9 +352,9 @@ int CHudMessage::Draw( float fTime )
|
|||
// Assume m_parms.time contains last time
|
||||
if( m_pMessages[i] )
|
||||
{
|
||||
pMessage = m_pMessages[i];
|
||||
// pMessage = m_pMessages[i];
|
||||
if( m_startTime[i] > gHUD.m_flTime )
|
||||
m_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2; // Server takes 0.2 seconds to spawn, adjust for this
|
||||
m_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2f; // Server takes 0.2 seconds to spawn, adjust for this
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,11 +430,11 @@ void CHudMessage::MessageAdd( const char *pName, float time )
|
|||
g_pCustomMessage.g2 = 110;
|
||||
g_pCustomMessage.b2 = 0;
|
||||
g_pCustomMessage.a2 = 0;
|
||||
g_pCustomMessage.x = -1; // Centered
|
||||
g_pCustomMessage.y = 0.7;
|
||||
g_pCustomMessage.fadein = 0.01;
|
||||
g_pCustomMessage.fadeout = 1.5;
|
||||
g_pCustomMessage.fxtime = 0.25;
|
||||
g_pCustomMessage.x = -1.0f; // Centered
|
||||
g_pCustomMessage.y = 0.7f;
|
||||
g_pCustomMessage.fadein = 0.01f;
|
||||
g_pCustomMessage.fadeout = 1.5f;
|
||||
g_pCustomMessage.fxtime = 0.25f;
|
||||
g_pCustomMessage.holdtime = 5;
|
||||
g_pCustomMessage.pName = g_pCustomName;
|
||||
strcpy( g_pCustomText, pName );
|
||||
|
@ -453,9 +454,9 @@ void CHudMessage::MessageAdd( const char *pName, float time )
|
|||
}
|
||||
|
||||
// get rid of any other messages in same location (only one displays at a time)
|
||||
if( fabs( tempMessage->y - m_pMessages[j]->y ) < 0.0001 )
|
||||
if( fabs( tempMessage->y - m_pMessages[j]->y ) < 0.0001f )
|
||||
{
|
||||
if ( fabs( tempMessage->x - m_pMessages[j]->x ) < 0.0001 )
|
||||
if( fabs( tempMessage->x - m_pMessages[j]->x ) < 0.0001f )
|
||||
{
|
||||
m_pMessages[j] = NULL;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -96,10 +96,7 @@ int CHudSayText::Draw( float flTime )
|
|||
int y = Y_START;
|
||||
|
||||
// make sure the scrolltime is within reasonable bounds, to guard against the clock being reset
|
||||
flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );
|
||||
|
||||
// make sure the scrolltime is within reasonable bounds, to guard against the clock being reset
|
||||
flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value );
|
||||
flScrollTime = Q_min( flScrollTime, flTime + m_HUD_saytext_time->value );
|
||||
|
||||
if( flScrollTime <= flTime )
|
||||
{
|
||||
|
@ -126,8 +123,8 @@ int CHudSayText::Draw( float flTime )
|
|||
static char buf[MAX_PLAYER_NAME_LENGTH + 32];
|
||||
|
||||
// draw the first x characters in the player color
|
||||
strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) );
|
||||
buf[min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0;
|
||||
strncpy( buf, g_szLineBuffer[i], Q_min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) );
|
||||
buf[Q_min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0;
|
||||
DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] );
|
||||
int x = DrawConsoleString( LINE_START, y, buf );
|
||||
|
||||
|
@ -196,7 +193,7 @@ void CHudSayText::SayTextPrint( const char *pszBuf, int iBufSize, int clientInde
|
|||
}
|
||||
}
|
||||
|
||||
strncpy( g_szLineBuffer[i], pszBuf, max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) );
|
||||
strncpy( g_szLineBuffer[i], pszBuf, Q_max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) );
|
||||
|
||||
// make sure the text fits in one line
|
||||
EnsureTextFitsInOneLineAndWrapIfHaveTo( i );
|
||||
|
@ -262,7 +259,7 @@ void CHudSayText::EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
|
|||
if( !last_break )
|
||||
last_break = x - 1;
|
||||
|
||||
x = last_break;
|
||||
// x = last_break;
|
||||
|
||||
// find an empty string slot
|
||||
int j;
|
||||
|
|
|
@ -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
|
||||
|
@ -105,7 +108,7 @@ We have a minimum width of 1-320 - we could have the field widths scale with it?
|
|||
int SCOREBOARD_WIDTH = 320;
|
||||
|
||||
// Y positions
|
||||
#define ROW_GAP 13
|
||||
#define ROW_GAP (gHUD.m_scrinfo.iCharHeight)
|
||||
#define ROW_RANGE_MIN 15
|
||||
#define ROW_RANGE_MAX ( ScreenHeight - 50 )
|
||||
|
||||
|
@ -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,28 +147,36 @@ int CHudScoreboard::Draw( float fTime )
|
|||
|
||||
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX;
|
||||
FAR_RIGHT += 5;
|
||||
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX );
|
||||
|
||||
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;
|
||||
list_slot += 1.2f;
|
||||
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;
|
||||
list_slot += 0.8f;
|
||||
|
||||
if( !gHUD.m_Teamplay )
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -311,7 +328,7 @@ int CHudScoreboard::Draw( float fTime )
|
|||
}
|
||||
|
||||
// draw all the players who are not in a team
|
||||
list_slot += 0.5;
|
||||
list_slot += 0.5f;
|
||||
DrawPlayers( xpos_rel, list_slot, 0, "" );
|
||||
|
||||
return 1;
|
||||
|
@ -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
|
||||
|
@ -533,7 +561,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf
|
|||
if( g_TeamInfo[j].name[0] == '\0' )
|
||||
break;
|
||||
}
|
||||
m_iNumTeams = max( j, m_iNumTeams );
|
||||
m_iNumTeams = Q_max( j, m_iNumTeams );
|
||||
|
||||
strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME );
|
||||
g_TeamInfo[j].players = 0;
|
||||
|
|
|
@ -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++ )
|
||||
|
|
|
@ -197,7 +197,7 @@ int CHudStatusBar::Draw( float fTime )
|
|||
// let user set status ID bar centering
|
||||
if( ( i == STATUSBAR_ID_LINE ) && CVAR_GET_FLOAT( "hud_centerid" ) )
|
||||
{
|
||||
x = max( 0, max( 2, ( ScreenWidth - TextWidth ) ) / 2 );
|
||||
x = Q_max( 0, Q_max( 2, ( ScreenWidth - TextWidth ) ) / 2 );
|
||||
y = ( ScreenHeight / 2 ) + ( TextHeight * CVAR_GET_FLOAT( "hud_centerid" ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#include <memory.h>
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "const.h"
|
||||
|
@ -23,13 +22,13 @@ void AngleMatrix( const float *angles, float (*matrix)[4] )
|
|||
float angle;
|
||||
float sr, sp, sy, cr, cp, cy;
|
||||
|
||||
angle = angles[YAW] * ( M_PI*2 / 360 );
|
||||
angle = angles[YAW] * ( M_PI_F * 2.0f / 360.0f );
|
||||
sy = sin( angle );
|
||||
cy = cos( angle );
|
||||
angle = angles[PITCH] * ( M_PI*2 / 360 );
|
||||
angle = angles[PITCH] * ( M_PI_F * 2.0f / 360.0f );
|
||||
sp = sin( angle );
|
||||
cp = cos( angle );
|
||||
angle = angles[ROLL] * ( M_PI*2 / 360 );
|
||||
angle = angles[ROLL] * ( M_PI_F * 2.0f / 360.0f );
|
||||
sr = sin( angle );
|
||||
cr = cos( angle );
|
||||
|
||||
|
@ -43,9 +42,9 @@ void AngleMatrix( const float *angles, float (*matrix)[4] )
|
|||
matrix[0][2] = (cr * sp * cy + -sr * -sy);
|
||||
matrix[1][2] = (cr * sp * sy + -sr* cy);
|
||||
matrix[2][2] = cr * cp;
|
||||
matrix[0][3] = 0.0;
|
||||
matrix[1][3] = 0.0;
|
||||
matrix[2][3] = 0.0;
|
||||
matrix[0][3] = 0.0f;
|
||||
matrix[1][3] = 0.0f;
|
||||
matrix[2][3] = 0.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -73,9 +72,9 @@ CrossProduct
|
|||
*/
|
||||
void CrossProduct( const float *v1, const float *v2, float *cross )
|
||||
{
|
||||
cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||
cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||
cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||
cross[0] = v1[1] * v2[2] - v1[2] * v2[1];
|
||||
cross[1] = v1[2] * v2[0] - v1[0] * v2[2];
|
||||
cross[2] = v1[0] * v2[1] - v1[1] * v2[0];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -139,13 +138,13 @@ void AngleQuaternion( float *angles, vec4_t quaternion )
|
|||
float sr, sp, sy, cr, cp, cy;
|
||||
|
||||
// FIXME: rescale the inputs to 1/2 angle
|
||||
angle = angles[2] * 0.5;
|
||||
angle = angles[2] * 0.5f;
|
||||
sy = sin( angle );
|
||||
cy = cos( angle );
|
||||
angle = angles[1] * 0.5;
|
||||
angle = angles[1] * 0.5f;
|
||||
sp = sin( angle );
|
||||
cp = cos( angle );
|
||||
angle = angles[0] * 0.5;
|
||||
angle = angles[0] * 0.5f;
|
||||
sr = sin( angle );
|
||||
cr = cos( angle );
|
||||
|
||||
|
@ -185,18 +184,18 @@ void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )
|
|||
|
||||
cosom = p[0] * q[0] + p[1] * q[1] + p[2] * q[2] + p[3] * q[3];
|
||||
|
||||
if( ( 1.0 + cosom ) > 0.000001 )
|
||||
if( ( 1.0f + cosom ) > 0.000001f )
|
||||
{
|
||||
if( ( 1.0 - cosom ) > 0.000001 )
|
||||
if( ( 1.0f - cosom ) > 0.000001f )
|
||||
{
|
||||
omega = acos( cosom );
|
||||
sinom = sin( omega );
|
||||
sclp = sin( ( 1.0 - t ) * omega ) / sinom;
|
||||
sclp = sin( ( 1.0f - t ) * omega ) / sinom;
|
||||
sclq = sin( t * omega ) / sinom;
|
||||
}
|
||||
else
|
||||
{
|
||||
sclp = 1.0 - t;
|
||||
sclp = 1.0f - t;
|
||||
sclq = t;
|
||||
}
|
||||
for( i = 0; i < 4; i++ )
|
||||
|
@ -210,8 +209,8 @@ void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )
|
|||
qt[1] = q[0];
|
||||
qt[2] = -q[3];
|
||||
qt[3] = q[2];
|
||||
sclp = sin( ( 1.0 - t ) * ( 0.5 * M_PI ) );
|
||||
sclq = sin( t * ( 0.5 * M_PI ) );
|
||||
sclp = sin( ( 1.0f - t ) * ( 0.5f * M_PI_F ) );
|
||||
sclq = sin( t * ( 0.5f * M_PI_F ) );
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
qt[i] = sclp * p[i] + sclq * qt[i];
|
||||
|
@ -227,17 +226,17 @@ QuaternionMatrix
|
|||
*/
|
||||
void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] )
|
||||
{
|
||||
matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2];
|
||||
matrix[1][0] = 2.0 * quaternion[0] * quaternion[1] + 2.0 * quaternion[3] * quaternion[2];
|
||||
matrix[2][0] = 2.0 * quaternion[0] * quaternion[2] - 2.0 * quaternion[3] * quaternion[1];
|
||||
matrix[0][0] = 1.0f - 2.0f * quaternion[1] * quaternion[1] - 2.0f * quaternion[2] * quaternion[2];
|
||||
matrix[1][0] = 2.0f * quaternion[0] * quaternion[1] + 2.0f * quaternion[3] * quaternion[2];
|
||||
matrix[2][0] = 2.0f * quaternion[0] * quaternion[2] - 2.0f * quaternion[3] * quaternion[1];
|
||||
|
||||
matrix[0][1] = 2.0 * quaternion[0] * quaternion[1] - 2.0 * quaternion[3] * quaternion[2];
|
||||
matrix[1][1] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[2] * quaternion[2];
|
||||
matrix[2][1] = 2.0 * quaternion[1] * quaternion[2] + 2.0 * quaternion[3] * quaternion[0];
|
||||
matrix[0][1] = 2.0f * quaternion[0] * quaternion[1] - 2.0f * quaternion[3] * quaternion[2];
|
||||
matrix[1][1] = 1.0f - 2.0f * quaternion[0] * quaternion[0] - 2.0f * quaternion[2] * quaternion[2];
|
||||
matrix[2][1] = 2.0f * quaternion[1] * quaternion[2] + 2.0f * quaternion[3] * quaternion[0];
|
||||
|
||||
matrix[0][2] = 2.0 * quaternion[0] * quaternion[2] + 2.0 * quaternion[3] * quaternion[1];
|
||||
matrix[1][2] = 2.0 * quaternion[1] * quaternion[2] - 2.0 * quaternion[3] * quaternion[0];
|
||||
matrix[2][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[1] * quaternion[1];
|
||||
matrix[0][2] = 2.0f * quaternion[0] * quaternion[2] + 2.0f * quaternion[3] * quaternion[1];
|
||||
matrix[1][2] = 2.0f * quaternion[1] * quaternion[2] - 2.0f * quaternion[3] * quaternion[0];
|
||||
matrix[2][2] = 1.0f - 2.0f * quaternion[0] * quaternion[0] - 2.0f * quaternion[1] * quaternion[1];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
//========= 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
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_F
|
||||
#define M_PI_F (float)M_PI
|
||||
#endif
|
||||
|
||||
#ifndef PITCH
|
||||
// MOVEMENT INFO
|
||||
// up / down
|
||||
|
|
|
@ -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,43 @@ 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
|
||||
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
|
||||
}
|
||||
|
||||
// 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 );
|
||||
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] );
|
||||
psz[MSG_BUF_SIZE - 1] = '\0';
|
||||
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] );
|
||||
psz[MSG_BUF_SIZE - 2] = '\0';
|
||||
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] );
|
||||
psz[MSG_BUF_SIZE - 1] = '\0';
|
||||
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] );
|
||||
psz[MSG_BUF_SIZE - 1] = '\0';
|
||||
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:
|
||||
//
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
// implementation of class-less helper functions
|
||||
//
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
|
@ -30,16 +30,22 @@
|
|||
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_F
|
||||
#define M_PI_F (float)M_PI
|
||||
#endif
|
||||
extern vec3_t vec3_origin;
|
||||
|
||||
double sqrt( double x );
|
||||
// if C++ mangling differs from C symbol name
|
||||
#if defined _MSC_VER || defined __WATCOMC__
|
||||
vec3_t vec3_origin;
|
||||
#endif
|
||||
|
||||
float Length( const float *v )
|
||||
{
|
||||
int i;
|
||||
float length;
|
||||
|
||||
length = 0;
|
||||
length = 0.0f;
|
||||
for( i = 0; i < 3; i++ )
|
||||
length += v[i] * v[i];
|
||||
length = sqrt( length ); // FIXME
|
||||
|
@ -51,29 +57,29 @@ void VectorAngles( const float *forward, float *angles )
|
|||
{
|
||||
float tmp, yaw, pitch;
|
||||
|
||||
if( forward[1] == 0 && forward[0] == 0 )
|
||||
if( forward[1] == 0.0f && forward[0] == 0.0f )
|
||||
{
|
||||
yaw = 0;
|
||||
if( forward[2] > 0 )
|
||||
pitch = 90;
|
||||
yaw = 0.0f;
|
||||
if( forward[2] > 0.0f )
|
||||
pitch = 90.0f;
|
||||
else
|
||||
pitch = 270;
|
||||
pitch = 270.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
yaw = ( atan2( forward[1], forward[0]) * 180 / M_PI );
|
||||
if( yaw < 0 )
|
||||
yaw += 360;
|
||||
yaw = ( atan2( forward[1], forward[0]) * 180.0f / M_PI_F );
|
||||
if( yaw < 0.0f )
|
||||
yaw += 360.0f;
|
||||
|
||||
tmp = sqrt( forward[0] * forward[0] + forward[1] * forward[1] );
|
||||
pitch = ( atan2( forward[2], tmp ) * 180 / M_PI );
|
||||
if( pitch < 0 )
|
||||
pitch += 360;
|
||||
pitch = ( atan2( forward[2], tmp ) * 180.0f / M_PI_F );
|
||||
if( pitch < 0.0f )
|
||||
pitch += 360.0f;
|
||||
}
|
||||
|
||||
angles[0] = pitch;
|
||||
angles[1] = yaw;
|
||||
angles[2] = 0;
|
||||
angles[2] = 0.0f;
|
||||
}
|
||||
|
||||
float VectorNormalize( float *v )
|
||||
|
@ -85,7 +91,7 @@ float VectorNormalize( float *v )
|
|||
|
||||
if( length )
|
||||
{
|
||||
ilength = 1 / length;
|
||||
ilength = 1.0f / length;
|
||||
v[0] *= ilength;
|
||||
v[1] *= ilength;
|
||||
v[2] *= ilength;
|
||||
|
|
|
@ -15,15 +15,21 @@
|
|||
// 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"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_CMATH
|
||||
#include <cmath>
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
// 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 +130,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
|
||||
|
|
200
cl_dll/view.cpp
200
cl_dll/view.cpp
|
@ -1,4 +1,4 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
|
@ -40,6 +40,10 @@ extern "C"
|
|||
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_F
|
||||
#define M_PI_F (float)M_PI
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int CL_IsThirdPerson( void );
|
||||
|
@ -78,6 +82,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 +95,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;
|
||||
|
@ -125,13 +130,13 @@ void V_NormalizeAngles( float *angles )
|
|||
// Normalize angles
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
if( angles[i] > 180.0 )
|
||||
if( angles[i] > 180.0f )
|
||||
{
|
||||
angles[i] -= 360.0;
|
||||
angles[i] -= 360.0f;
|
||||
}
|
||||
else if( angles[i] < -180.0 )
|
||||
else if( angles[i] < -180.0f )
|
||||
{
|
||||
angles[i] += 360.0;
|
||||
angles[i] += 360.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -159,13 +164,13 @@ void V_InterpolateAngles( float *start, float *end, float *output, float frac )
|
|||
ang2 = end[i];
|
||||
|
||||
d = ang2 - ang1;
|
||||
if( d > 180 )
|
||||
if( d > 180.0f )
|
||||
{
|
||||
d -= 360;
|
||||
d -= 360.0f;
|
||||
}
|
||||
else if( d < -180 )
|
||||
else if( d < -180.0f )
|
||||
{
|
||||
d += 360;
|
||||
d += 360.0f;
|
||||
}
|
||||
|
||||
output[i] = ang1 + d * frac;
|
||||
|
@ -198,11 +203,11 @@ float V_CalcBob( struct ref_params_s *pparams )
|
|||
|
||||
if( cycle < cl_bobup->value )
|
||||
{
|
||||
cycle = M_PI * cycle / cl_bobup->value;
|
||||
cycle = M_PI_F * cycle / cl_bobup->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
cycle = M_PI + M_PI * ( cycle - cl_bobup->value )/( 1.0 - cl_bobup->value );
|
||||
cycle = M_PI_F + M_PI_F * ( cycle - cl_bobup->value )/( 1.0f - cl_bobup->value );
|
||||
}
|
||||
|
||||
// bob is proportional to simulated velocity in the xy plane
|
||||
|
@ -211,9 +216,9 @@ float V_CalcBob( struct ref_params_s *pparams )
|
|||
vel[2] = 0;
|
||||
|
||||
bob = sqrt( vel[0] * vel[0] + vel[1] * vel[1] ) * cl_bob->value;
|
||||
bob = bob * 0.3 + bob * 0.7 * sin(cycle);
|
||||
bob = min( bob, 4 );
|
||||
bob = max( bob, -7 );
|
||||
bob = bob * 0.3f + bob * 0.7f * sin(cycle);
|
||||
bob = Q_min( bob, 4.0f );
|
||||
bob = Q_max( bob, -7.0f );
|
||||
return bob;
|
||||
}
|
||||
|
||||
|
@ -233,7 +238,7 @@ float V_CalcRoll( vec3_t angles, vec3_t velocity, float rollangle, float rollspe
|
|||
AngleVectors( angles, forward, right, up );
|
||||
|
||||
side = DotProduct( velocity, right );
|
||||
sign = side < 0 ? -1 : 1;
|
||||
sign = side < 0.0f ? -1.0f : 1.0f;
|
||||
side = fabs( side );
|
||||
|
||||
value = rollangle;
|
||||
|
@ -289,11 +294,11 @@ void V_CalcGunAngle( struct ref_params_s *pparams )
|
|||
return;
|
||||
|
||||
viewent->angles[YAW] = pparams->viewangles[YAW] + pparams->crosshairangle[YAW];
|
||||
viewent->angles[PITCH] = -pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25;
|
||||
viewent->angles[PITCH] = -pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25f;
|
||||
viewent->angles[ROLL] -= v_idlescale * sin( pparams->time * v_iroll_cycle.value ) * v_iroll_level.value;
|
||||
|
||||
// don't apply all of the v_ipitch to prevent normally unseen parts of viewmodel from coming into view.
|
||||
viewent->angles[PITCH] -= v_idlescale * sin( pparams->time * v_ipitch_cycle.value ) * ( v_ipitch_level.value * 0.5 );
|
||||
viewent->angles[PITCH] -= v_idlescale * sin( pparams->time * v_ipitch_cycle.value ) * ( v_ipitch_level.value * 0.5f );
|
||||
viewent->angles[YAW] -= v_idlescale * sin( pparams->time * v_iyaw_cycle.value ) * v_iyaw_level.value;
|
||||
|
||||
VectorCopy( viewent->angles, viewent->curstate.angles );
|
||||
|
@ -351,11 +356,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();
|
||||
|
@ -452,15 +457,15 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
}
|
||||
|
||||
gEngfuncs.V_CalcShake();
|
||||
gEngfuncs.V_ApplyShake( pparams->vieworg, pparams->viewangles, 1.0 );
|
||||
gEngfuncs.V_ApplyShake( pparams->vieworg, pparams->viewangles, 1.0f );
|
||||
|
||||
// never let view origin sit exactly on a node line, because a water plane can
|
||||
// dissapear when viewed with the eye exactly on it.
|
||||
// FIXME, we send origin at 1/128 now, change this?
|
||||
// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
|
||||
pparams->vieworg[0] += 1.0 / 32;
|
||||
pparams->vieworg[1] += 1.0 / 32;
|
||||
pparams->vieworg[2] += 1.0 / 32;
|
||||
pparams->vieworg[0] += 1.0f / 32.0f;
|
||||
pparams->vieworg[1] += 1.0f / 32.0f;
|
||||
pparams->vieworg[2] += 1.0f / 32.0f;
|
||||
|
||||
// Check for problems around water, move the viewer artificially if necessary
|
||||
// -- this prevents drawing errors in GL due to waves
|
||||
|
@ -480,13 +485,13 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
pwater = gEngfuncs.GetEntityByIndex( waterEntity );
|
||||
if( pwater && ( pwater->model != NULL ) )
|
||||
{
|
||||
waterDist += ( pwater->curstate.scale * 16 ); // Add in wave height
|
||||
waterDist += ( pwater->curstate.scale * 16.0f ); // Add in wave height
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
waterEntity = 0; // Don't need this in software
|
||||
// waterEntity = 0; // Don't need this in software
|
||||
}
|
||||
|
||||
VectorCopy( pparams->vieworg, point );
|
||||
|
@ -527,7 +532,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 );
|
||||
}
|
||||
|
@ -552,7 +557,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
{
|
||||
vec3_t ofs;
|
||||
|
||||
ofs[0] = ofs[1] = ofs[2] = 0.0;
|
||||
ofs[0] = ofs[1] = ofs[2] = 0.0f;
|
||||
|
||||
CL_CameraOffset( (float *)&ofs );
|
||||
|
||||
|
@ -585,54 +590,57 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
VectorAdd( view->origin, pparams->viewheight, view->origin );
|
||||
|
||||
// Let the viewmodel shake at about 10% of the amplitude
|
||||
gEngfuncs.V_ApplyShake( view->origin, view->angles, 0.9 );
|
||||
gEngfuncs.V_ApplyShake( view->origin, view->angles, 0.9f );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
view->origin[i] += bob * 0.4 * pparams->forward[i];
|
||||
view->origin[i] += bob * 0.4f * pparams->forward[i];
|
||||
}
|
||||
view->origin[2] += bob;
|
||||
|
||||
// throw in a little tilt.
|
||||
view->angles[YAW] -= bob * 0.5;
|
||||
view->angles[ROLL] -= bob * 1;
|
||||
view->angles[PITCH] -= bob * 0.3;
|
||||
view->angles[YAW] -= bob * 0.5f;
|
||||
view->angles[ROLL] -= bob * 1.0f;
|
||||
view->angles[PITCH] -= bob * 0.3f;
|
||||
|
||||
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).
|
||||
view->origin[2] -= 1;
|
||||
view->origin[2] -= 1.0f;
|
||||
|
||||
// fudge position around to keep amount of weapon visible
|
||||
// roughly equal with different FOV
|
||||
if( pparams->viewsize == 110 )
|
||||
if( pparams->viewsize == 110.0f )
|
||||
{
|
||||
view->origin[2] += 1;
|
||||
view->origin[2] += 1.0f;
|
||||
}
|
||||
else if( pparams->viewsize == 100 )
|
||||
else if( pparams->viewsize == 100.0f )
|
||||
{
|
||||
view->origin[2] += 2;
|
||||
view->origin[2] += 2.0f;
|
||||
}
|
||||
else if( pparams->viewsize == 90 )
|
||||
else if( pparams->viewsize == 90.0f )
|
||||
{
|
||||
view->origin[2] += 1;
|
||||
view->origin[2] += 1.0f;
|
||||
}
|
||||
else if( pparams->viewsize == 80 )
|
||||
else if( pparams->viewsize == 80.0f )
|
||||
{
|
||||
view->origin[2] += 0.5;
|
||||
view->origin[2] += 0.5f;
|
||||
}
|
||||
|
||||
// Add in the punchangle, if any
|
||||
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
|
||||
if( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0 )
|
||||
if( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0.0f )
|
||||
{
|
||||
float steptime;
|
||||
|
||||
|
@ -642,11 +650,11 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
//FIXME I_Error( "steptime < 0" );
|
||||
steptime = 0;
|
||||
|
||||
oldz += steptime * 150;
|
||||
oldz += steptime * 150.0f;
|
||||
if( oldz > pparams->simorg[2] )
|
||||
oldz = pparams->simorg[2];
|
||||
if( pparams->simorg[2] - oldz > 18 )
|
||||
oldz = pparams->simorg[2]- 18;
|
||||
if( pparams->simorg[2] - oldz > 18.0f )
|
||||
oldz = pparams->simorg[2]- 18.0f;
|
||||
pparams->vieworg[2] += oldz - pparams->simorg[2];
|
||||
view->origin[2] += oldz - pparams->simorg[2];
|
||||
}
|
||||
|
@ -661,7 +669,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
|
||||
VectorSubtract( pparams->simorg, lastorg, delta );
|
||||
|
||||
if( Length( delta ) != 0.0 )
|
||||
if( Length( delta ) != 0.0f )
|
||||
{
|
||||
VectorCopy( pparams->simorg, ViewInterp.Origins[ViewInterp.CurrentOrigin & ORIGIN_MASK] );
|
||||
ViewInterp.OriginTime[ViewInterp.CurrentOrigin & ORIGIN_MASK] = pparams->time;
|
||||
|
@ -678,9 +686,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
int foundidx;
|
||||
float t;
|
||||
|
||||
if( cl_vsmoothing->value < 0.0 )
|
||||
if( cl_vsmoothing->value < 0.0f )
|
||||
{
|
||||
gEngfuncs.Cvar_SetValue( "cl_vsmoothing", 0.0 );
|
||||
gEngfuncs.Cvar_SetValue( "cl_vsmoothing", 0.0f );
|
||||
}
|
||||
|
||||
t = pparams->time - cl_vsmoothing->value;
|
||||
|
@ -692,7 +700,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
break;
|
||||
}
|
||||
|
||||
if( i < ORIGIN_MASK && ViewInterp.OriginTime[foundidx & ORIGIN_MASK] != 0.0 )
|
||||
if( i < ORIGIN_MASK && ViewInterp.OriginTime[foundidx & ORIGIN_MASK] != 0.0f )
|
||||
{
|
||||
// Interpolate
|
||||
vec3_t delta;
|
||||
|
@ -704,12 +712,12 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
if( dt > 0.0 )
|
||||
{
|
||||
frac = ( t - ViewInterp.OriginTime[foundidx & ORIGIN_MASK] ) / dt;
|
||||
frac = min( 1.0, frac );
|
||||
frac = Q_min( 1.0, frac );
|
||||
VectorSubtract( ViewInterp.Origins[( foundidx + 1 ) & ORIGIN_MASK], ViewInterp.Origins[foundidx & ORIGIN_MASK], delta );
|
||||
VectorMA( ViewInterp.Origins[foundidx & ORIGIN_MASK], frac, delta, neworg );
|
||||
|
||||
// Dont interpolate large changes
|
||||
if( Length( delta ) < 64 )
|
||||
if( Length( delta ) < 64.0f )
|
||||
{
|
||||
VectorSubtract( neworg, pparams->simorg, delta );
|
||||
|
||||
|
@ -731,13 +739,13 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
float pitch = camAngles[0];
|
||||
|
||||
// Normalize angles
|
||||
if( pitch > 180 )
|
||||
pitch -= 360.0;
|
||||
else if( pitch < -180 )
|
||||
pitch += 360;
|
||||
if( pitch > 180.0f )
|
||||
pitch -= 360.0f;
|
||||
else if( pitch < -180.0f )
|
||||
pitch += 360.0f;
|
||||
|
||||
// Player pitch is inverted
|
||||
pitch /= -3.0;
|
||||
pitch /= -3.0f;
|
||||
|
||||
// Slam local player's pitch value
|
||||
ent->angles[0] = pitch;
|
||||
|
@ -792,7 +800,7 @@ void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * fi
|
|||
{
|
||||
frac = degreesPerSec * v_frametime;
|
||||
|
||||
threshhold= degreesPerSec / 4;
|
||||
threshhold= degreesPerSec / 4.0f;
|
||||
|
||||
if( absd < threshhold )
|
||||
{
|
||||
|
@ -807,7 +815,7 @@ void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * fi
|
|||
}
|
||||
else
|
||||
{
|
||||
if( d > 0 )
|
||||
if( d > 0.0f )
|
||||
finalAngle[i] = startAngle[i] + frac;
|
||||
else
|
||||
finalAngle[i] = startAngle[i] - frac;
|
||||
|
@ -903,7 +911,7 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
|||
VectorCopy( ent1->origin, newOrigin );
|
||||
|
||||
if( ent1->player )
|
||||
newOrigin[2] += 17; // head level of living player
|
||||
newOrigin[2] += 17.0f; // head level of living player
|
||||
|
||||
// get new angle towards second target
|
||||
if( ent2 )
|
||||
|
@ -917,7 +925,7 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
|
|||
// if no second target is given, look down to dead player
|
||||
newAngle[0] = 90.0f;
|
||||
newAngle[1] = 0.0f;
|
||||
newAngle[2] = 0;
|
||||
newAngle[2] = 0.0f;
|
||||
}
|
||||
|
||||
// and smooth view
|
||||
|
@ -958,12 +966,12 @@ void V_GetSingleTargetCam( cl_entity_t * ent1, float * angle, float * origin )
|
|||
if( ent1->player )
|
||||
{
|
||||
if( deadPlayer )
|
||||
newOrigin[2] += 2; //laying on ground
|
||||
newOrigin[2] += 2.0f; //laying on ground
|
||||
else
|
||||
newOrigin[2] += 17; // head level of living player
|
||||
newOrigin[2] += 17.0f; // head level of living player
|
||||
}
|
||||
else
|
||||
newOrigin[2]+= 8; // object, tricky, must be above bomb in CS
|
||||
newOrigin[2]+= 8.0f; // object, tricky, must be above bomb in CS
|
||||
|
||||
// we have no second target, choose view direction based on
|
||||
// show front of primary target
|
||||
|
@ -1001,13 +1009,13 @@ float MaxAngleBetweenAngles( float *a1, float *a2 )
|
|||
for( int i = 0; i < 3; i++ )
|
||||
{
|
||||
d = a2[i] - a1[i];
|
||||
if( d > 180 )
|
||||
if( d > 180.0f )
|
||||
{
|
||||
d -= 360;
|
||||
d -= 360.0f;
|
||||
}
|
||||
else if( d < -180 )
|
||||
else if( d < -180.0f )
|
||||
{
|
||||
d += 360;
|
||||
d += 360.0f;
|
||||
}
|
||||
|
||||
d = fabs( d );
|
||||
|
@ -1042,9 +1050,9 @@ void V_GetDoubleTargetsCam( cl_entity_t *ent1, cl_entity_t *ent2, float *angle,
|
|||
VectorCopy( ent1->origin, newOrigin );
|
||||
|
||||
if( ent1->player )
|
||||
newOrigin[2] += 17; // head level of living player
|
||||
newOrigin[2] += 17.0f; // head level of living player
|
||||
else
|
||||
newOrigin[2] += 8; // object, tricky, must be above bomb in CS
|
||||
newOrigin[2] += 8.0f; // object, tricky, must be above bomb in CS
|
||||
|
||||
// get new angle towards second target
|
||||
VectorSubtract( ent2->origin, ent1->origin, newAngle );
|
||||
|
@ -1147,9 +1155,9 @@ void V_GetDirectedChasePosition(cl_entity_t *ent1, cl_entity_t *ent2,float *angl
|
|||
VectorCopy( ent1->origin, newOrigin );
|
||||
|
||||
if( ent1->player )
|
||||
newOrigin[2] += 17; // head level of living player
|
||||
newOrigin[2] += 17.0f; // head level of living player
|
||||
else
|
||||
newOrigin[2] += 8; // object, tricky, must be above bomb in CS
|
||||
newOrigin[2] += 8.0f; // object, tricky, must be above bomb in CS
|
||||
|
||||
V_GetChaseOrigin( angle, newOrigin, distance, origin );
|
||||
}
|
||||
|
@ -1188,14 +1196,14 @@ void V_GetChasePos( int target, float *cl_angles, float *origin, float *angles )
|
|||
if( cl_angles == NULL ) // no mouse angles given, use entity angles ( locked mode )
|
||||
{
|
||||
VectorCopy( ent->angles, angles);
|
||||
angles[0] *= -1;
|
||||
angles[0] *= -1.0f;
|
||||
}
|
||||
else
|
||||
VectorCopy( cl_angles, angles );
|
||||
|
||||
VectorCopy( ent->origin, origin );
|
||||
|
||||
origin[2] += 28; // DEFAULT_VIEWHEIGHT - some offset
|
||||
origin[2] += 28.0f; // DEFAULT_VIEWHEIGHT - some offset
|
||||
|
||||
V_GetChaseOrigin( angles, origin, cl_chasedist->value, origin );
|
||||
}
|
||||
|
@ -1230,15 +1238,15 @@ void V_GetInEyePos( int target, float *origin, float *angles )
|
|||
|
||||
if( ent->curstate.solid == SOLID_NOT )
|
||||
{
|
||||
angles[ROLL] = 80; // dead view angle
|
||||
origin[2] += -8 ; // PM_DEAD_VIEWHEIGHT
|
||||
angles[ROLL] = 80.0f; // dead view angle
|
||||
origin[2] += -8.0f; // PM_DEAD_VIEWHEIGHT
|
||||
}
|
||||
else if( ent->curstate.usehull == 1 )
|
||||
origin[2] += 12; // VEC_DUCK_VIEW;
|
||||
origin[2] += 12.0f; // VEC_DUCK_VIEW;
|
||||
else
|
||||
// exacty eye position can't be caluculated since it depends on
|
||||
// client values like cl_bobcycle, this offset matches the default values
|
||||
origin[2] += 28; // DEFAULT_VIEWHEIGHT
|
||||
origin[2] += 28.0f; // DEFAULT_VIEWHEIGHT
|
||||
}
|
||||
|
||||
void V_GetMapFreePosition( float *cl_angles, float *origin, float *angles )
|
||||
|
@ -1302,12 +1310,12 @@ void V_GetMapChasePosition( int target, float *cl_angles, float *origin, float *
|
|||
|
||||
VectorNormalize( forward );
|
||||
|
||||
VectorMA( origin, -1536, forward, origin );
|
||||
VectorMA( origin, -1536.0f, forward, origin );
|
||||
}
|
||||
|
||||
int V_FindViewModelByWeaponModel( int weaponindex )
|
||||
{
|
||||
static char *modelmap[][2] =
|
||||
static const char *modelmap[][2] =
|
||||
{
|
||||
{ "models/p_crossbow.mdl", "models/v_crossbow.mdl" },
|
||||
{ "models/p_crowbar.mdl", "models/v_crowbar.mdl" },
|
||||
|
@ -1327,7 +1335,7 @@ int V_FindViewModelByWeaponModel( int weaponindex )
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
struct model_s * weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
|
||||
struct model_s *weaponModel = IEngineStudio.GetModelByIndex( weaponindex );
|
||||
|
||||
if( weaponModel )
|
||||
{
|
||||
|
@ -1561,8 +1569,8 @@ void V_DropPunchAngle( float frametime, float *ev_punchangle )
|
|||
float len;
|
||||
|
||||
len = VectorNormalize( ev_punchangle );
|
||||
len -= ( 10.0 + len * 0.5 ) * frametime;
|
||||
len = max( len, 0.0 );
|
||||
len -= ( 10.0f + len * 0.5f ) * (float)frametime;
|
||||
len = Q_max( len, 0.0f );
|
||||
VectorScale( ev_punchangle, len, ev_punchangle );
|
||||
}
|
||||
|
||||
|
@ -1575,7 +1583,7 @@ Client side punch effect
|
|||
*/
|
||||
void V_PunchAxis( int axis, float punch )
|
||||
{
|
||||
ev_punchangle[axis] = punch;
|
||||
g_ev_punchangle[axis] = punch;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1613,14 +1621,14 @@ float CalcFov( float fov_x, float width, float height )
|
|||
float a;
|
||||
float x;
|
||||
|
||||
if( fov_x < 1 || fov_x > 179 )
|
||||
fov_x = 90; // error, set to 90
|
||||
if( fov_x < 1.0f || fov_x > 179.0f )
|
||||
fov_x = 90.0f; // error, set to 90
|
||||
|
||||
x = width / tan( fov_x / 360 * M_PI );
|
||||
x = width / tan( fov_x / 360.0f * M_PI_F );
|
||||
|
||||
a = atan ( height / x );
|
||||
|
||||
a = a * 360 / M_PI;
|
||||
a = a * 360.0f / M_PI_F;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
@ -1642,8 +1650,8 @@ void V_Move( int mx, int my )
|
|||
|
||||
fov = CalcFov( in_fov, (float)ScreenWidth, (float)ScreenHeight );
|
||||
|
||||
c_x = (float)ScreenWidth / 2.0;
|
||||
c_y = (float)ScreenHeight / 2.0;
|
||||
c_x = (float)ScreenWidth / 2.0f;
|
||||
c_y = (float)ScreenHeight / 2.0f;
|
||||
|
||||
dx = (float)mx - c_x;
|
||||
dy = (float)my - c_y;
|
||||
|
@ -1652,8 +1660,8 @@ void V_Move( int mx, int my )
|
|||
fx = dx / c_x;
|
||||
fy = dy / c_y;
|
||||
|
||||
dX = fx * in_fov / 2.0 ;
|
||||
dY = fy * fov / 2.0;
|
||||
dX = fx * in_fov / 2.0f;
|
||||
dY = fy * fov / 2.0f;
|
||||
|
||||
newangles = v_angles;
|
||||
|
||||
|
@ -1668,10 +1676,10 @@ void V_Move( int mx, int my )
|
|||
// Trace
|
||||
tr = *( gEngfuncs.PM_TraceLine( (float *)&v_origin, (float *)&farpoint, PM_TRACELINE_PHYSENTSONLY, 2 /*point sized hull*/, -1 ) );
|
||||
|
||||
if( tr.fraction != 1.0 && tr.ent != 0 )
|
||||
if( tr.fraction != 1.0f && tr.ent != 0 )
|
||||
{
|
||||
hitent = PM_GetPhysEntInfo( tr.ent );
|
||||
PM_ParticleLine( (float *)&v_origin, (float *)&tr.endpos, 5, 1.0, 0.0 );
|
||||
PM_ParticleLine( (float *)&v_origin, (float *)&tr.endpos, 5, 1.0f, 0.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -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,16 @@
|
|||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
#pragma once
|
||||
#if !defined( WRECTH )
|
||||
#define WRECTH
|
||||
|
||||
typedef struct rect_s
|
||||
{
|
||||
int left, right, top, bottom;
|
||||
} wrect_t;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,127 @@
|
|||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# a1batross, mittorn, 2018
|
||||
|
||||
from waflib import Utils
|
||||
import os
|
||||
|
||||
def options(opt):
|
||||
# stub
|
||||
return
|
||||
|
||||
def configure(conf):
|
||||
if conf.env.GOLDSRC and conf.env.DEST_OS != 'win32':
|
||||
conf.check_cc(lib='dl')
|
||||
|
||||
if conf.env.DEST_OS == 'win32':
|
||||
conf.check_cxx(lib='user32')
|
||||
|
||||
def build(bld):
|
||||
source = bld.path.parent.ant_glob([
|
||||
'pm_shared/*.c'
|
||||
])
|
||||
source += bld.path.ant_glob([
|
||||
'hl/*.cpp'
|
||||
])
|
||||
source += bld.path.ant_glob([
|
||||
'dlls/crossbow.cpp',
|
||||
'dlls/crowbar.cpp',
|
||||
'dlls/egon.cpp',
|
||||
'dlls/gauss.cpp',
|
||||
'dlls/glock.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'
|
||||
])
|
||||
source += [
|
||||
'GameStudioModelRenderer.cpp',
|
||||
'MOTD.cpp',
|
||||
'StudioModelRenderer.cpp',
|
||||
'ammo.cpp',
|
||||
'ammo_secondary.cpp',
|
||||
'ammohistory.cpp',
|
||||
'battery.cpp',
|
||||
'cdll_int.cpp',
|
||||
'com_weapons.cpp',
|
||||
'death.cpp',
|
||||
'demo.cpp',
|
||||
'entity.cpp',
|
||||
'ev_hldm.cpp',
|
||||
'ev_common.cpp',
|
||||
'events.cpp',
|
||||
'flashlight.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',
|
||||
'saytext.cpp',
|
||||
'scoreboard.cpp',
|
||||
'status_icons.cpp',
|
||||
'statusbar.cpp',
|
||||
'studio_util.cpp',
|
||||
'text_message.cpp',
|
||||
'train.cpp',
|
||||
'tri.cpp',
|
||||
'util.cpp',
|
||||
'view.cpp'
|
||||
]
|
||||
|
||||
includes = [
|
||||
'.',
|
||||
'hl/',
|
||||
'../dlls',
|
||||
'../dlls/wpn_shared',
|
||||
'../common',
|
||||
'../engine',
|
||||
'../pm_shared',
|
||||
'../game_shared',
|
||||
'../public',
|
||||
'../utils/false_vgui/include'
|
||||
]
|
||||
|
||||
defines = ['CLIENT_DLL']
|
||||
if bld.env.GOLDSRC:
|
||||
defines += ['GOLDSOURCE_SUPPORT']
|
||||
|
||||
libs = []
|
||||
if bld.env.GOLDSRC and bld.env.DEST_OS != 'win32':
|
||||
libs += ['DL']
|
||||
|
||||
if bld.env.DEST_OS == 'win32':
|
||||
libs += ["USER32"]
|
||||
|
||||
if bld.env.DEST_OS not in ['android', 'dos']:
|
||||
install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_DIR)
|
||||
else:
|
||||
install_path = bld.env.PREFIX
|
||||
|
||||
bld.shlib(
|
||||
source = source,
|
||||
target = 'client' + bld.env.POSTFIX,
|
||||
name = 'client',
|
||||
features = 'c cxx',
|
||||
includes = includes,
|
||||
defines = defines,
|
||||
use = libs,
|
||||
install_path = install_path,
|
||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||
idx = bld.get_taskgen_count()
|
||||
)
|
|
@ -0,0 +1,107 @@
|
|||
include(CheckSymbolExists)
|
||||
|
||||
# generated(see comments in public/build.h)
|
||||
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_SOURCE_DIR}/public/")
|
||||
check_symbol_exists(XASH_64BIT "build.h" XASH_64BIT)
|
||||
check_symbol_exists(XASH_AMD64 "build.h" XASH_AMD64)
|
||||
check_symbol_exists(XASH_ANDROID "build.h" XASH_ANDROID)
|
||||
check_symbol_exists(XASH_APPLE "build.h" XASH_APPLE)
|
||||
check_symbol_exists(XASH_ARM "build.h" XASH_ARM)
|
||||
check_symbol_exists(XASH_ARM64 "build.h" XASH_ARM64)
|
||||
check_symbol_exists(XASH_ARM_HARDFP "build.h" XASH_ARM_HARDFP)
|
||||
check_symbol_exists(XASH_ARM_SOFTFP "build.h" XASH_ARM_SOFTFP)
|
||||
check_symbol_exists(XASH_ARMv4 "build.h" XASH_ARMv4)
|
||||
check_symbol_exists(XASH_ARMv5 "build.h" XASH_ARMv5)
|
||||
check_symbol_exists(XASH_ARMv6 "build.h" XASH_ARMv6)
|
||||
check_symbol_exists(XASH_ARMv7 "build.h" XASH_ARMv7)
|
||||
check_symbol_exists(XASH_BIG_ENDIAN "build.h" XASH_BIG_ENDIAN)
|
||||
check_symbol_exists(XASH_BSD "build.h" XASH_BSD)
|
||||
check_symbol_exists(XASH_E2K "build.h" XASH_E2K)
|
||||
check_symbol_exists(XASH_EMSCRIPTEN "build.h" XASH_EMSCRIPTEN)
|
||||
check_symbol_exists(XASH_FREEBSD "build.h" XASH_FREEBSD)
|
||||
check_symbol_exists(XASH_IOS "build.h" XASH_IOS)
|
||||
check_symbol_exists(XASH_JS "build.h" XASH_JS)
|
||||
check_symbol_exists(XASH_LINUX "build.h" XASH_LINUX)
|
||||
check_symbol_exists(XASH_LITTLE_ENDIAN "build.h" XASH_LITTLE_ENDIAN)
|
||||
check_symbol_exists(XASH_MINGW "build.h" XASH_MINGW)
|
||||
check_symbol_exists(XASH_MIPS "build.h" XASH_MIPS)
|
||||
check_symbol_exists(XASH_MOBILE_PLATFORM "build.h" XASH_MOBILE_PLATFORM)
|
||||
check_symbol_exists(XASH_MSVC "build.h" XASH_MSVC)
|
||||
check_symbol_exists(XASH_NETBSD "build.h" XASH_NETBSD)
|
||||
check_symbol_exists(XASH_OPENBSD "build.h" XASH_OPENBSD)
|
||||
check_symbol_exists(XASH_WIN32 "build.h" XASH_WIN32)
|
||||
check_symbol_exists(XASH_WIN64 "build.h" XASH_WIN64)
|
||||
check_symbol_exists(XASH_X86 "build.h" XASH_X86)
|
||||
unset(CMAKE_REQUIRED_INCLUDES)
|
||||
|
||||
# engine/common/build.c
|
||||
if(XASH_ANDROID)
|
||||
set(BUILDOS "android")
|
||||
elseif(XASH_WIN32 OR XASH_LINUX OR XASH_APPLE)
|
||||
set(BUILDOS "") # no prefix for default OS
|
||||
elseif(XASH_FREEBSD)
|
||||
set(BUILDOS "freebsd")
|
||||
elseif(XASH_NETBSD)
|
||||
set(BUILDOS "netbsd")
|
||||
elseif(XASH_OPENBSD)
|
||||
set(BUILDOS "openbsd")
|
||||
elseif(XASH_EMSCRIPTEN)
|
||||
set(BUILDOS "emscripten")
|
||||
else()
|
||||
message(SEND_ERROR "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug")
|
||||
endif()
|
||||
|
||||
if(XASH_AMD64)
|
||||
set(BUILDARCH "amd64")
|
||||
elseif(XASH_X86)
|
||||
set(BUILDARCH "")
|
||||
elseif(XASH_ARM64)
|
||||
set(BUILDARCH "arm64")
|
||||
elseif(XASH_ARM)
|
||||
set(BUILDARCH "armv")
|
||||
if(XASH_ARMv7)
|
||||
set(BUILDARCH "${BUILDARCH}7")
|
||||
elseif(XASH_ARMv6)
|
||||
set(BUILDARCH "${BUILDARCH}6")
|
||||
elseif(XASH_ARMv5)
|
||||
set(BUILDARCH "${BUILDARCH}5")
|
||||
elseif(XASH_ARMv4)
|
||||
set(BUILDARCH "${BUILDARCH}4")
|
||||
else()
|
||||
message(SEND_ERROR "Unknown ARM")
|
||||
endif()
|
||||
|
||||
if(XASH_ARM_HARDFP)
|
||||
set(BUILDARCH "${BUILDARCH}hf")
|
||||
else()
|
||||
set(BUILDARCH "${BUILDARCH}l")
|
||||
endif()
|
||||
elseif(XASH_MIPS AND XASH_BIG_ENDIAN)
|
||||
set(BUILDARCH "mips")
|
||||
elseif(XASH_MIPS AND XASH_LITTLE_ENDIAN)
|
||||
set(BUILDARCH "mipsel")
|
||||
elseif(XASH_JS)
|
||||
set(BUILDARCH "javascript")
|
||||
elseif(XASH_E2K)
|
||||
set(BUILDARCH "e2k")
|
||||
else()
|
||||
message(SEND_ERROR "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug")
|
||||
endif()
|
||||
|
||||
if(BUILDOS STREQUAL "android")
|
||||
set(POSTFIX "") # force disable for Android, as Android ports aren't distributed in normal way and doesn't follow library naming
|
||||
elif(BUILDOS AND BUILDARCH)
|
||||
set(POSTFIX "_${BUILDOS}_${BUILDARCH}")
|
||||
elseif(BUILDARCH)
|
||||
set(POSTFIX "_${BUILDARCH}")
|
||||
else()
|
||||
set(POSTFIX "")
|
||||
endif()
|
||||
|
||||
message(STATUS "Library postfix: " ${POSTFIX})
|
||||
|
||||
set(CMAKE_RELEASE_POSTFIX ${POSTFIX})
|
||||
set(CMAKE_DEBUG_POSTFIX ${POSTFIX})
|
||||
set(CMAKE_RELWITHDEBINFO_POSTFIX ${POSTFIX})
|
||||
set(CMAKE_MINSIZEREL_POSTFIX ${POSTFIX})
|
||||
set(CMAKE_POSTFIX ${POSTFIX})
|
|
@ -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
|
||||
|
||||
|
@ -57,4 +57,4 @@ struct beam_s
|
|||
struct particle_s *particles;
|
||||
};
|
||||
|
||||
#endif//BEAMDEF_H
|
||||
#endif//BEAMDEF_H
|
||||
|
|
246
common/bspfile.h
246
common/bspfile.h
|
@ -1,246 +0,0 @@
|
|||
/*
|
||||
bspfile.h - BSP format included q1, hl1 support
|
||||
Copyright (C) 2010 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef BSPFILE_H
|
||||
#define BSPFILE_H
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
BRUSH MODELS
|
||||
|
||||
.bsp contain level static geometry with including PVS and lightning info
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
// header
|
||||
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
|
||||
#define HLBSP_VERSION 30 // half-life regular version
|
||||
#define XTBSP_VERSION 31 // extended lightmaps and expanded clipnodes limit
|
||||
|
||||
#define IDEXTRAHEADER (('H'<<24)+('S'<<16)+('A'<<8)+'X') // little-endian "XASH"
|
||||
#define EXTRA_VERSION 2 // because version 1 was occupied by old versions of XashXT
|
||||
|
||||
#define DELUXEMAP_VERSION 1
|
||||
#define IDDELUXEMAPHEADER (('T'<<24)+('I'<<16)+('L'<<8)+'Q') // little-endian "QLIT"
|
||||
|
||||
// worldcraft predefined angles
|
||||
#define ANGLE_UP -1
|
||||
#define ANGLE_DOWN -2
|
||||
|
||||
// bmodel limits
|
||||
#define MAX_MAP_HULLS 4 // MAX_HULLS
|
||||
|
||||
#define SURF_NOCULL BIT( 0 ) // two-sided polygon (e.g. 'water4b')
|
||||
#define SURF_PLANEBACK BIT( 1 ) // plane should be negated
|
||||
#define SURF_DRAWSKY BIT( 2 ) // sky surface
|
||||
#define SURF_WATERCSG BIT( 3 ) // culled by csg (was SURF_DRAWSPRITE)
|
||||
#define SURF_DRAWTURB BIT( 4 ) // warp surface
|
||||
#define SURF_DRAWTILED BIT( 5 ) // face without lighmap
|
||||
#define SURF_CONVEYOR BIT( 6 ) // scrolled texture (was SURF_DRAWBACKGROUND)
|
||||
#define SURF_UNDERWATER BIT( 7 ) // caustics
|
||||
#define SURF_TRANSPARENT BIT( 8 ) // it's a transparent texture (was SURF_DONTWARP)
|
||||
|
||||
#define SURF_REFLECT BIT( 31 ) // reflect surface (mirror)
|
||||
|
||||
// lightstyle management
|
||||
#define LM_STYLES 4 // MAXLIGHTMAPS
|
||||
#define LS_NORMAL 0x00
|
||||
#define LS_UNUSED 0xFE
|
||||
#define LS_NONE 0xFF
|
||||
|
||||
#define MAX_MAP_MODELS 1024 // can be increased up to 2048 if needed
|
||||
#define MAX_MAP_BRUSHES 32768 // unsigned short limit
|
||||
#define MAX_MAP_ENTITIES 8192 // can be increased up to 32768 if needed
|
||||
#define MAX_MAP_ENTSTRING 0x80000 // 512 kB should be enough
|
||||
#define MAX_MAP_PLANES 65536 // can be increased without problems
|
||||
#define MAX_MAP_NODES 32767 // because negative shorts are leafs
|
||||
#define MAX_MAP_CLIPNODES 32767 // because negative shorts are contents
|
||||
#define MAX_MAP_LEAFS 32767 // signed short limit
|
||||
#define MAX_MAP_VERTS 65535 // unsigned short limit
|
||||
#define MAX_MAP_FACES 65535 // unsigned short limit
|
||||
#define MAX_MAP_MARKSURFACES 65535 // unsigned short limit
|
||||
#define MAX_MAP_TEXINFO MAX_MAP_FACES // in theory each face may have personal texinfo
|
||||
#define MAX_MAP_EDGES 0x100000 // can be increased but not needed
|
||||
#define MAX_MAP_SURFEDGES 0x200000 // can be increased but not needed
|
||||
#define MAX_MAP_TEXTURES 2048 // can be increased but not needed
|
||||
#define MAX_MAP_MIPTEX 0x2000000 // 32 Mb internal textures data
|
||||
#define MAX_MAP_LIGHTING 0x2000000 // 32 Mb lightmap raw data (can contain deluxemaps)
|
||||
#define MAX_MAP_VISIBILITY 0x800000 // 8 Mb visdata
|
||||
|
||||
// quake lump ordering
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_PLANES 1
|
||||
#define LUMP_TEXTURES 2 // internal textures
|
||||
#define LUMP_VERTEXES 3
|
||||
#define LUMP_VISIBILITY 4
|
||||
#define LUMP_NODES 5
|
||||
#define LUMP_TEXINFO 6
|
||||
#define LUMP_FACES 7
|
||||
#define LUMP_LIGHTING 8
|
||||
#define LUMP_CLIPNODES 9
|
||||
#define LUMP_LEAFS 10
|
||||
#define LUMP_MARKSURFACES 11
|
||||
#define LUMP_EDGES 12
|
||||
#define LUMP_SURFEDGES 13
|
||||
#define LUMP_MODELS 14 // internal submodels
|
||||
#define HEADER_LUMPS 15
|
||||
|
||||
// version 31
|
||||
#define LUMP_CLIPNODES2 15 // hull0 goes into LUMP_NODES, hull1 goes into LUMP_CLIPNODES,
|
||||
#define LUMP_CLIPNODES3 16 // hull2 goes into LUMP_CLIPNODES2, hull3 goes into LUMP_CLIPNODES3
|
||||
#define HEADER_LUMPS_31 17
|
||||
|
||||
#define LUMP_FACES_EXTRADATA 0 // extension of dface_t
|
||||
#define LUMP_VERTS_EXTRADATA 1 // extension of dvertex_t
|
||||
#define LUMP_CUBEMAPS 2 // cubemap description
|
||||
|
||||
#define EXTRA_LUMPS 8 // g-cont. just for future expansions
|
||||
|
||||
// texture flags
|
||||
#define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision
|
||||
|
||||
// ambient sound types
|
||||
enum
|
||||
{
|
||||
AMBIENT_WATER = 0, // waterfall
|
||||
AMBIENT_SKY, // wind
|
||||
AMBIENT_SLIME, // never used in quake
|
||||
AMBIENT_LAVA, // never used in quake
|
||||
NUM_AMBIENTS // automatic ambient sounds
|
||||
};
|
||||
|
||||
//
|
||||
// BSP File Structures
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fileofs;
|
||||
int filelen;
|
||||
} dlump_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version;
|
||||
dlump_t lumps[HEADER_LUMPS];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version;
|
||||
dlump_t lumps[HEADER_LUMPS_31];
|
||||
} dheader31_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id; // must be little endian XASH
|
||||
int version;
|
||||
dlump_t lumps[EXTRA_LUMPS];
|
||||
} dextrahdr_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t mins;
|
||||
vec3_t maxs;
|
||||
vec3_t origin; // for sounds or lights
|
||||
int headnode[MAX_MAP_HULLS];
|
||||
int visleafs; // not including the solid leaf 0
|
||||
int firstface;
|
||||
int numfaces;
|
||||
} dmodel_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nummiptex;
|
||||
int dataofs[4]; // [nummiptex]
|
||||
} dmiptexlump_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t point;
|
||||
} dvertex_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t normal;
|
||||
float dist;
|
||||
int type; // PLANE_X - PLANE_ANYZ ?
|
||||
} dplane_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
short children[2]; // negative numbers are -(leafs + 1), not nodes
|
||||
short mins[3]; // for sphere culling
|
||||
short maxs[3];
|
||||
word firstface;
|
||||
word numfaces; // counting both sides
|
||||
} dnode_t;
|
||||
|
||||
// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
|
||||
// all other leafs need visibility info
|
||||
typedef struct
|
||||
{
|
||||
int contents;
|
||||
int visofs; // -1 = no visibility info
|
||||
|
||||
short mins[3]; // for frustum culling
|
||||
short maxs[3];
|
||||
word firstmarksurface;
|
||||
word nummarksurfaces;
|
||||
|
||||
// automatic ambient sounds
|
||||
byte ambient_level[NUM_AMBIENTS]; // ambient sound level (0 - 255)
|
||||
} dleaf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
short children[2]; // negative numbers are contents
|
||||
} dclipnode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float vecs[2][4]; // texmatrix [s/t][xyz offset]
|
||||
int miptex;
|
||||
int flags;
|
||||
} dtexinfo_t;
|
||||
|
||||
typedef word dmarkface_t; // leaf marksurfaces indexes
|
||||
typedef int dsurfedge_t; // map surfedges
|
||||
|
||||
// NOTE: that edge 0 is never used, because negative edge nums
|
||||
// are used for counterclockwise use of the edge in a face
|
||||
typedef struct
|
||||
{
|
||||
word v[2]; // vertex numbers
|
||||
} dedge_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
word planenum;
|
||||
short side;
|
||||
|
||||
int firstedge; // we must support > 64k edges
|
||||
short numedges;
|
||||
short texinfo;
|
||||
|
||||
// lighting info
|
||||
byte styles[LM_STYLES];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
} dface_t;
|
||||
|
||||
#endif//BSPFILE_H
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef CL_ENTITY_H
|
||||
#define CL_ENTITY_H
|
||||
|
||||
|
@ -102,4 +102,4 @@ struct cl_entity_s
|
|||
colorVec cvFloorColor;
|
||||
};
|
||||
|
||||
#endif//CL_ENTITY_H
|
||||
#endif//CL_ENTITY_H
|
||||
|
|
|
@ -1,59 +1,78 @@
|
|||
/*
|
||||
com_model.h - cient model structures
|
||||
Copyright (C) 2010 Uncle Mike
|
||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef COM_MODEL_H
|
||||
// com_model.h
|
||||
#pragma once
|
||||
#if !defined( COM_MODEL_H )
|
||||
#define COM_MODEL_H
|
||||
|
||||
#include "bspfile.h" // we need some declarations from it
|
||||
#define STUDIO_RENDER 1
|
||||
#define STUDIO_EVENTS 2
|
||||
|
||||
typedef vec_t vec2_t[2];
|
||||
typedef vec_t vec4_t[4];
|
||||
#define MAX_CLIENTS 32
|
||||
#define MAX_EDICTS 900
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
#define MAX_MODEL_NAME 64
|
||||
#define MAX_MAP_HULLS 4
|
||||
#define MIPLEVELS 4
|
||||
#define NUM_AMBIENTS 4 // automatic ambient sounds
|
||||
#define MAXLIGHTMAPS 4
|
||||
#define PLANE_ANYZ 5
|
||||
|
||||
ENGINE MODEL FORMAT
|
||||
==============================================================================
|
||||
*/
|
||||
#define STUDIO_RENDER 1
|
||||
#define STUDIO_EVENTS 2
|
||||
#define ALIAS_Z_CLIP_PLANE 5
|
||||
|
||||
#define ZISCALE ((float)0x8000)
|
||||
// flags in finalvert_t.flags
|
||||
#define ALIAS_LEFT_CLIP 0x0001
|
||||
#define ALIAS_TOP_CLIP 0x0002
|
||||
#define ALIAS_RIGHT_CLIP 0x0004
|
||||
#define ALIAS_BOTTOM_CLIP 0x0008
|
||||
#define ALIAS_Z_CLIP 0x0010
|
||||
#define ALIAS_ONSEAM 0x0020
|
||||
#define ALIAS_XY_CLIP_MASK 0x000F
|
||||
|
||||
#define MIPLEVELS 4
|
||||
#define VERTEXSIZE 7
|
||||
#define MAXLIGHTMAPS 4
|
||||
#define NUM_AMBIENTS 4 // automatic ambient sounds
|
||||
#define ZISCALE ((float)0x8000)
|
||||
|
||||
// model types
|
||||
typedef enum
|
||||
{
|
||||
mod_bad = -1,
|
||||
mod_brush,
|
||||
mod_sprite,
|
||||
mod_alias,
|
||||
mod_studio
|
||||
} modtype_t;
|
||||
|
||||
// must match definition in modelgen.h
|
||||
#ifndef SYNCTYPE_T
|
||||
#define SYNCTYPE_T
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ST_SYNC=0,
|
||||
ST_RAND
|
||||
} synctype_t;
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float mins[3], maxs[3];
|
||||
float origin[3];
|
||||
int headnode[MAX_MAP_HULLS];
|
||||
int visleafs; // not including the solid leaf 0
|
||||
int firstface, numfaces;
|
||||
} dmodel_t;
|
||||
|
||||
// plane_t structure
|
||||
typedef struct mplane_s
|
||||
{
|
||||
vec3_t normal;
|
||||
float dist;
|
||||
byte type; // for fast side tests
|
||||
byte signbits; // signx + (signy<<1) + (signz<<1)
|
||||
byte pad[2];
|
||||
vec3_t normal; // surface normal
|
||||
float dist; // closest appoach to origin
|
||||
byte type; // for texture axis selection and fast side tests
|
||||
byte signbits; // signx + signy<<1 + signz<<1
|
||||
byte pad[2];
|
||||
} mplane_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -70,292 +89,246 @@ typedef struct
|
|||
typedef struct texture_s
|
||||
{
|
||||
char name[16];
|
||||
unsigned int width, height;
|
||||
int gl_texturenum;
|
||||
struct msurface_s *texturechain; // for gl_texsort drawing
|
||||
int anim_total; // total tenths in sequence ( 0 = no)
|
||||
int anim_min, anim_max; // time for this frame min <=time< max
|
||||
struct texture_s *anim_next; // in the animation sequence
|
||||
struct texture_s *alternate_anims; // bmodels in frame 1 use these
|
||||
unsigned short fb_texturenum; // auto-luma texturenum
|
||||
unsigned short dt_texturenum; // detail-texture binding
|
||||
unsigned int unused[3]; // reserved
|
||||
unsigned width, height;
|
||||
int anim_total; // total tenths in sequence ( 0 = no)
|
||||
int anim_min, anim_max; // time for this frame min <=time< max
|
||||
struct texture_s *anim_next; // in the animation sequence
|
||||
struct texture_s *alternate_anims; // bmodels in frame 1 use these
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
unsigned paloffset;
|
||||
} texture_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float vecs[2][4]; // [s/t] unit vectors in world space.
|
||||
// [i][3] is the s/t offset relative to the origin.
|
||||
// s or t = dot( 3Dpoint, vecs[i] ) + vecs[i][3]
|
||||
float mipadjust; // mipmap limits for very small surfaces
|
||||
texture_t *texture;
|
||||
int flags; // sky or slime, no lightmap or 256 subdivision
|
||||
float vecs[2][4]; // [s/t] unit vectors in world space.
|
||||
// [i][3] is the s/t offset relative to the origin.
|
||||
// s or t = dot(3Dpoint,vecs[i])+vecs[i][3]
|
||||
float mipadjust; // ?? mipmap limits for very small surfaces
|
||||
texture_t *texture;
|
||||
int flags; // sky or slime, no lightmap or 256 subdivision
|
||||
} mtexinfo_t;
|
||||
|
||||
// 73 bytes per VBO vertex
|
||||
// FIXME: align to 32 bytes
|
||||
typedef struct glvert_s
|
||||
{
|
||||
vec3_t vertex; // position
|
||||
vec3_t normal; // normal
|
||||
vec2_t stcoord; // ST texture coords
|
||||
vec2_t lmcoord; // ST lightmap coords
|
||||
vec2_t sccoord; // ST scissor coords (decals only) - for normalmap coords migration
|
||||
vec3_t tangent; // tangent
|
||||
vec3_t binormal; // binormal
|
||||
byte color[4]; // colors per vertex
|
||||
} glvert_t;
|
||||
|
||||
typedef struct glpoly_s
|
||||
{
|
||||
struct glpoly_s *next;
|
||||
struct glpoly_s *chain;
|
||||
int numverts;
|
||||
int flags; // for SURF_UNDERWATER
|
||||
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
||||
} glpoly_t;
|
||||
|
||||
typedef struct mnode_s
|
||||
{
|
||||
// common with leaf
|
||||
int contents; // 0, to differentiate from leafs
|
||||
int visframe; // node needs to be traversed if current
|
||||
int contents; // 0, to differentiate from leafs
|
||||
int visframe; // node needs to be traversed if current
|
||||
|
||||
short minmaxs[6]; // for bounding box culling
|
||||
|
||||
float minmaxs[6]; // for bounding box culling
|
||||
struct mnode_s *parent;
|
||||
|
||||
// node specific
|
||||
mplane_t *plane;
|
||||
mplane_t *plane;
|
||||
struct mnode_s *children[2];
|
||||
|
||||
unsigned short firstsurface;
|
||||
unsigned short numsurfaces;
|
||||
unsigned short firstsurface;
|
||||
unsigned short numsurfaces;
|
||||
} mnode_t;
|
||||
|
||||
typedef struct msurface_s msurface_t;
|
||||
typedef struct decal_s decal_t;
|
||||
typedef struct decal_s decal_t;
|
||||
|
||||
// JAY: Compress this as much as possible
|
||||
struct decal_s
|
||||
{
|
||||
decal_t *pnext; // linked list for each surface
|
||||
msurface_t *psurface; // Surface id for persistence / unlinking
|
||||
float dx; // local texture coordinates
|
||||
float dy; //
|
||||
float scale; // Pixel scale
|
||||
decal_t *pnext; // linked list for each surface
|
||||
msurface_t *psurface; // Surface id for persistence / unlinking
|
||||
short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats)
|
||||
short dy;
|
||||
short texture; // Decal texture
|
||||
byte flags; // Decal flags FDECAL_*
|
||||
byte scale; // Pixel scale
|
||||
byte flags; // Decal flags
|
||||
|
||||
short entityIndex; // Entity this is attached to
|
||||
// Xash3D added
|
||||
vec3_t position; // location of the decal center in world space.
|
||||
vec3_t saxis; // direction of the s axis in world space
|
||||
struct msurfmesh_s *mesh; // decal mesh in local space
|
||||
int reserved[4]; // for future expansions
|
||||
};
|
||||
|
||||
typedef struct mleaf_s
|
||||
{
|
||||
// common with node
|
||||
int contents;
|
||||
int visframe; // node needs to be traversed if current
|
||||
int contents; // wil be a negative contents number
|
||||
int visframe; // node needs to be traversed if current
|
||||
|
||||
float minmaxs[6]; // for bounding box culling
|
||||
short minmaxs[6]; // for bounding box culling
|
||||
|
||||
struct mnode_s *parent;
|
||||
|
||||
// leaf specific
|
||||
byte *compressed_vis;
|
||||
struct efrag_s *efrags;
|
||||
|
||||
msurface_t **firstmarksurface;
|
||||
int nummarksurfaces;
|
||||
byte *compressed_pas;
|
||||
int nummarksurfaces;
|
||||
int key; // BSP sequence number for leaf's contents
|
||||
byte ambient_sound_level[NUM_AMBIENTS];
|
||||
|
||||
} mleaf_t;
|
||||
|
||||
typedef struct msurface_s
|
||||
struct msurface_s
|
||||
{
|
||||
int visframe; // should be drawn when node is crossed
|
||||
int visframe; // should be drawn when node is crossed
|
||||
|
||||
mplane_t *plane; // pointer to shared plane
|
||||
int flags; // see SURF_ #defines
|
||||
int dlightframe; // last frame the surface was checked by an animated light
|
||||
int dlightbits; // dynamically generated. Indicates if the surface illumination
|
||||
// is modified by an animated light.
|
||||
|
||||
int firstedge; // look up in model->surfedges[], negative numbers
|
||||
int numedges; // are backwards edges
|
||||
mplane_t *plane; // pointer to shared plane
|
||||
int flags; // see SURF_ #defines
|
||||
|
||||
short texturemins[2];
|
||||
short extents[2];
|
||||
int firstedge; // look up in model->surfedges[], negative numbers
|
||||
int numedges; // are backwards edges
|
||||
|
||||
// surface generation data
|
||||
struct surfcache_s *cachespots[MIPLEVELS];
|
||||
|
||||
int light_s, light_t; // gl lightmap coordinates
|
||||
short texturemins[2]; // smallest s/t position on the surface.
|
||||
short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces
|
||||
|
||||
glpoly_t *polys; // multiple if warped
|
||||
struct msurface_s *texturechain;
|
||||
|
||||
mtexinfo_t *texinfo;
|
||||
|
||||
// lighting info
|
||||
int dlightframe; // last frame the surface was checked by an animated light
|
||||
int dlightbits; // dynamically generated. Indicates if the surface illumination
|
||||
// is modified by an animated light.
|
||||
|
||||
int lightmaptexturenum;
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
|
||||
struct msurface_s *lightmapchain; // for new dlights rendering (was cached_dlight)
|
||||
|
||||
color24 *samples; // note: this is the actual lightmap data for this surface
|
||||
mtexinfo_t *texinfo;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS]; // index into d_lightstylevalue[] for animated lights
|
||||
// no one surface can be effected by more than 4
|
||||
// animated lights.
|
||||
color24 *samples;
|
||||
|
||||
decal_t *pdecals;
|
||||
} msurface_t;
|
||||
};
|
||||
|
||||
typedef struct msurfmesh_s
|
||||
typedef struct
|
||||
{
|
||||
unsigned short numVerts;
|
||||
unsigned short numElems; // ~ 20 000 vertex per one surface. Should be enough
|
||||
unsigned int startVert; // user-variable. may be used for construct world single-VBO
|
||||
unsigned int startElem; // user-variable. may be used for construct world single-VBO
|
||||
|
||||
glvert_t *verts; // vertexes array
|
||||
unsigned short *elems; // indices
|
||||
|
||||
struct msurface_s *surf; // pointer to parent surface. Just for consistency
|
||||
struct msurfmesh_s *next; // temporary chain of subdivided surfaces
|
||||
} msurfmesh_t;
|
||||
|
||||
// surface extradata stored in cache.data for all brushmodels
|
||||
typedef struct mextrasurf_s
|
||||
{
|
||||
vec3_t mins, maxs;
|
||||
vec3_t origin; // surface origin
|
||||
msurfmesh_t *mesh; // VBO\VA ready surface mesh. Not used by engine but can be used by mod-makers
|
||||
|
||||
int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps
|
||||
|
||||
int mirrortexturenum; // gl texnum
|
||||
float mirrormatrix[4][4];
|
||||
struct mextrasurf_s *mirrorchain; // for gl_texsort drawing
|
||||
struct mextrasurf_s *detailchain; // for detail textures drawing
|
||||
color24 *deluxemap; // note: this is the actual deluxemap data for this surface
|
||||
|
||||
int reserved[32]; // just for future expansions or mod-makers
|
||||
} mextrasurf_t;
|
||||
int planenum;
|
||||
short children[2]; // negative numbers are contents
|
||||
} dclipnode_t;
|
||||
|
||||
typedef struct hull_s
|
||||
{
|
||||
dclipnode_t *clipnodes;
|
||||
mplane_t *planes;
|
||||
int firstclipnode;
|
||||
int lastclipnode;
|
||||
mplane_t *planes;
|
||||
int firstclipnode;
|
||||
int lastclipnode;
|
||||
vec3_t clip_mins;
|
||||
vec3_t clip_maxs;
|
||||
} hull_t;
|
||||
|
||||
#ifndef CACHE_USER
|
||||
#if !defined( CACHE_USER ) && !defined( QUAKEDEF_H )
|
||||
#define CACHE_USER
|
||||
typedef struct cache_user_s
|
||||
{
|
||||
void *data; // extradata
|
||||
void *data;
|
||||
} cache_user_t;
|
||||
#endif
|
||||
|
||||
typedef struct model_s
|
||||
{
|
||||
char name[64]; // model name
|
||||
qboolean needload; // bmodels and sprites don't cache normally
|
||||
char name[ MAX_MODEL_NAME ];
|
||||
qboolean needload; // bmodels and sprites don't cache normally
|
||||
|
||||
// shared modelinfo
|
||||
modtype_t type; // model type
|
||||
int numframes; // sprite's framecount
|
||||
byte *mempool; // private mempool (was synctype)
|
||||
int flags; // hl compatibility
|
||||
modtype_t type;
|
||||
int numframes;
|
||||
synctype_t synctype;
|
||||
|
||||
int flags;
|
||||
|
||||
//
|
||||
// volume occupied by the model
|
||||
//
|
||||
vec3_t mins, maxs; // bounding box at angles '0 0 0'
|
||||
//
|
||||
vec3_t mins, maxs;
|
||||
float radius;
|
||||
|
||||
// brush model
|
||||
int firstmodelsurface;
|
||||
int nummodelsurfaces;
|
||||
|
||||
int numsubmodels;
|
||||
dmodel_t *submodels; // or studio animations
|
||||
//
|
||||
// brush model
|
||||
//
|
||||
int firstmodelsurface, nummodelsurfaces;
|
||||
|
||||
int numplanes;
|
||||
mplane_t *planes;
|
||||
int numsubmodels;
|
||||
dmodel_t *submodels;
|
||||
|
||||
int numleafs; // number of visible leafs, not counting 0
|
||||
mleaf_t *leafs;
|
||||
int numplanes;
|
||||
mplane_t *planes;
|
||||
|
||||
int numvertexes;
|
||||
mvertex_t *vertexes;
|
||||
int numleafs; // number of visible leafs, not counting 0
|
||||
struct mleaf_s *leafs;
|
||||
|
||||
int numedges;
|
||||
int numvertexes;
|
||||
mvertex_t *vertexes;
|
||||
|
||||
int numedges;
|
||||
medge_t *edges;
|
||||
|
||||
int numnodes;
|
||||
int numnodes;
|
||||
mnode_t *nodes;
|
||||
|
||||
int numtexinfo;
|
||||
int numtexinfo;
|
||||
mtexinfo_t *texinfo;
|
||||
|
||||
int numsurfaces;
|
||||
int numsurfaces;
|
||||
msurface_t *surfaces;
|
||||
|
||||
int numsurfedges;
|
||||
int *surfedges;
|
||||
int numsurfedges;
|
||||
int *surfedges;
|
||||
|
||||
int numclipnodes;
|
||||
int numclipnodes;
|
||||
dclipnode_t *clipnodes;
|
||||
|
||||
int nummarksurfaces;
|
||||
int nummarksurfaces;
|
||||
msurface_t **marksurfaces;
|
||||
|
||||
hull_t hulls[MAX_MAP_HULLS];
|
||||
|
||||
int numtextures;
|
||||
texture_t **textures;
|
||||
int numtextures;
|
||||
texture_t **textures;
|
||||
|
||||
byte *visdata;
|
||||
|
||||
color24 *lightdata;
|
||||
|
||||
char *entities;
|
||||
|
||||
//
|
||||
// additional model data
|
||||
//
|
||||
cache_user_t cache; // only access through Mod_Extradata
|
||||
|
||||
} model_t;
|
||||
|
||||
typedef vec_t vec4_t[4];
|
||||
|
||||
typedef struct alight_s
|
||||
{
|
||||
int ambientlight; // clip at 128
|
||||
int shadelight; // clip at 192 - ambientlight
|
||||
int ambientlight; // clip at 128
|
||||
int shadelight; // clip at 192 - ambientlight
|
||||
vec3_t color;
|
||||
float *plightvec;
|
||||
} alight_t;
|
||||
|
||||
typedef struct auxvert_s
|
||||
{
|
||||
float fv[3]; // viewspace x, y
|
||||
float fv[3]; // viewspace x, y
|
||||
} auxvert_t;
|
||||
|
||||
#define MAX_SCOREBOARDNAME 32
|
||||
#define MAX_INFO_STRING 256
|
||||
|
||||
#include "custom.h"
|
||||
|
||||
#define MAX_INFO_STRING 256
|
||||
#define MAX_SCOREBOARDNAME 32
|
||||
typedef struct player_info_s
|
||||
{
|
||||
int userid; // User id on server
|
||||
char userinfo[MAX_INFO_STRING]; // User info string
|
||||
char name[MAX_SCOREBOARDNAME]; // Name (extracted from userinfo)
|
||||
int spectator; // Spectator or not, unused
|
||||
// User id on server
|
||||
int userid;
|
||||
|
||||
// User info string
|
||||
char userinfo[ MAX_INFO_STRING ];
|
||||
|
||||
// Name
|
||||
char name[ MAX_SCOREBOARDNAME ];
|
||||
|
||||
// Spectator or not, unused
|
||||
int spectator;
|
||||
|
||||
int ping;
|
||||
int packet_loss;
|
||||
|
||||
// skin information
|
||||
char model[64];
|
||||
char model[MAX_QPATH];
|
||||
int topcolor;
|
||||
int bottomcolor;
|
||||
|
||||
|
@ -364,50 +337,12 @@ typedef struct player_info_s
|
|||
|
||||
// Gait frame estimation
|
||||
int gaitsequence;
|
||||
float gaitframe;
|
||||
float gaityaw;
|
||||
vec3_t prevgaitorigin;
|
||||
float gaitframe;
|
||||
float gaityaw;
|
||||
vec3_t prevgaitorigin;
|
||||
|
||||
customization_t customdata;
|
||||
customization_t customdata;
|
||||
} player_info_t;
|
||||
|
||||
//
|
||||
// sprite representation in memory
|
||||
//
|
||||
typedef enum { SPR_SINGLE = 0, SPR_GROUP, SPR_ANGLED } spriteframetype_t;
|
||||
#endif // COM_MODEL_H
|
||||
|
||||
typedef struct mspriteframe_s
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
float up, down, left, right;
|
||||
int gl_texturenum;
|
||||
} mspriteframe_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numframes;
|
||||
float *intervals;
|
||||
mspriteframe_t *frames[1];
|
||||
} mspritegroup_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
spriteframetype_t type;
|
||||
mspriteframe_t *frameptr;
|
||||
} mspriteframedesc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short type;
|
||||
short texFormat;
|
||||
int maxwidth;
|
||||
int maxheight;
|
||||
int numframes;
|
||||
int radius;
|
||||
int facecull;
|
||||
int synctype;
|
||||
mspriteframedesc_t frames[1];
|
||||
} msprite_t;
|
||||
|
||||
#endif//COM_MODEL_H
|
|
@ -12,6 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#pragma once
|
||||
#ifndef CON_NPRINT_H
|
||||
#define CON_NPRINT_H
|
||||
|
||||
|
@ -22,4 +23,4 @@ typedef struct con_nprint_s
|
|||
float color[3]; // RGB colors ( 0.0 -> 1.0 scale )
|
||||
} con_nprint_t;
|
||||
|
||||
#endif//CON_NPRINT_H
|
||||
#endif//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)
|
||||
|
@ -621,8 +625,9 @@
|
|||
#define CHAN_BODY 4
|
||||
#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area
|
||||
#define CHAN_STATIC 6 // allocate channel from the static area
|
||||
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
|
||||
#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,14 +25,15 @@
|
|||
#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;
|
||||
} cvar_t;
|
||||
|
||||
#endif//CVARDEF_H
|
||||
#endif//CVARDEF_H
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef DEMO_API_H
|
||||
#define DEMO_API_H
|
||||
|
||||
|
@ -24,4 +24,4 @@ typedef struct demo_api_s
|
|||
void (*WriteBuffer)( int size, unsigned char *buffer );
|
||||
} demo_api_t;
|
||||
|
||||
#endif//DEMO_API_H
|
||||
#endif//DEMO_API_H
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef DLIGHT_H
|
||||
#define DLIGHT_H
|
||||
|
||||
|
@ -28,4 +28,4 @@ typedef struct dlight_s
|
|||
qboolean dark; // subtracts light instead of adding
|
||||
} dlight_t;
|
||||
|
||||
#endif//DLIGHT_H
|
||||
#endif//DLIGHT_H
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
#pragma once
|
||||
#ifndef ENTITY_STATE_H
|
||||
#define ENTITY_STATE_H
|
||||
|
||||
|
@ -183,4 +184,4 @@ typedef struct local_state_s
|
|||
weapon_data_t weapondata[64];
|
||||
} local_state_t;
|
||||
|
||||
#endif//ENTITY_STATE_H
|
||||
#endif//ENTITY_STATE_H
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef ENTITY_TYPES_H
|
||||
#define ENTITY_TYPES_H
|
||||
|
||||
|
@ -22,4 +22,4 @@
|
|||
#define ET_BEAM 3
|
||||
#define ET_FRAGMENTED 4 // BMODEL or SPRITE that was split across BSP nodes
|
||||
|
||||
#endif//ENTITY_TYPES_H
|
||||
#endif//ENTITY_TYPES_H
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* without written permission from Valve LLC.
|
||||
*
|
||||
****/
|
||||
|
||||
#pragma once
|
||||
#ifndef EVENT_API_H
|
||||
#define EVENT_API_H
|
||||
|
||||
|
@ -51,4 +51,4 @@ typedef struct event_api_s
|
|||
struct msurface_s *( *EV_TraceSurface )( int ground, float *vstart, float *vend );
|
||||
} event_api_t;
|
||||
|
||||
#endif//EVENT_API_H
|
||||
#endif//EVENT_API_H
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue