Merge branch 'master' into sohl1.2

This commit is contained in:
Roman Chistokhodov 2017-12-18 23:47:12 +03:00
commit 30f2409952
347 changed files with 49269 additions and 33961 deletions

View File

@ -1,6 +1,9 @@
# Binaries
*.o
*.so
*/*.o
*/*/*.o
*.a
*.framework
*.exe
build/

14
.travis.yml Normal file
View File

@ -0,0 +1,14 @@
language: cpp
compiler:
- gcc
- clang
os:
- linux
- osx
sudo: true
before_script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gcc-multilib g++-multilib; 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 *

1
Android.mk Normal file
View File

@ -0,0 +1 @@
include $(call all-subdir-makefiles)

63
CMakeLists.txt Normal file
View File

@ -0,0 +1,63 @@
#
# Copyright (c) 2016 Alibek Omarov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
cmake_minimum_required(VERSION 2.6.0)
project (HLSDK-XASH3D)
#--------------
# USER DEFINES \
################\
option(USE_VGUI "Enable VGUI1. UNDONE" OFF)
option(USE_VGUI2 "Enable VGUI2. UNDONE" OFF)
option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
option(BUILD_CLIENT "Build client dll" ON)
option(BUILD_SERVER "Build server dll" ON)
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
#-----------------
# MAIN BUILD CODE \
###################\
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(MSVC)
error("UNDONE: set 32 build flags")
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
endif()
endif()
if(BUILD_CLIENT)
add_subdirectory(cl_dll)
endif()
if(BUILD_SERVER)
add_subdirectory(dlls)
endif()
if(NOT BUILD_SERVER AND NOT BUILD_CLIENT)
error("Nothing to build")
endif()

141
README.md Normal file
View File

@ -0,0 +1,141 @@
# 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 & GoldSource with some fixes.
## How to build
### CMake as most universal way
mkdir build && cd build
cmake ../
make
You may enable or disable some build options by -Dkey=value. All available build options are defined in CMakeLists.txt at root directory.
See below if you want to build the GoldSource compatible libraries.
See below, if CMake is not suitable for you:
### Windows
#### Using msvc
We use compilers provided with Microsoft Visual Studio 6. There're `compile.bat` scripts in both `cl_dll` and `dlls` directories.
Before running any of those files you must define `MSVCDir` variable which is the path to your msvc installation.
set MSVCDir=C:\Program Files\Microsoft Visual Studio
compile.bat
These scripts also can be ran via wine:
MSVCDir="z:\home\$USER\.wine\drive_c\Program Files\Microsoft Visual Studio" wine cmd /c compile.bat
The libraries built this way are always GoldSource compatible.
There're dsp projects for MVS 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 MVS versions.
#### Using mingw
TODO
### Linux
(cd dlls && make)
(cd cl_dll && make)
### OS X
TODO
### FreeBSD
(cd dlls && gmake CXX=clang++ CC=clang)
(cd cl_dll && gmake CXX=clang++ CC=clang)
### Android
Just typical `ndk-build`.
TODO: describe what it is.
### Building GoldSource-compatible libraries
To enable building the goldsource compatible client library add GOLDSOURCE_SUPPORT flag when calling cmake:
cmake .. -DGOLDSOURCE_SUPPORT=ON
or when using make without cmake:
make GOLDSOURCE_SUPPORT=1
Unlike original client by Valve the resulting client library will not depend on vgui or SDL2 just like the one that's used in FWGS Xash3d.
Note for **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.

31
backup.bat Normal file
View File

@ -0,0 +1,31 @@
@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 Normal file
View File

@ -0,0 +1,36 @@
//=======================================================================
// 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\

View File

@ -13,7 +13,6 @@ LOCAL_MODULE := client
#else
APP_PLATFORM := android-8
#endif
LOCAL_CONLYFLAGS += -std=c99
include $(XASH3D_CONFIG)
@ -25,7 +24,6 @@ LOCAL_CFLAGS += -DCLIENT_DLL=1
SRCS=
SRCS_C=
SRCS+=./MOTD.cpp
SRCS+=../dlls/crossbow.cpp
SRCS+=../dlls/crowbar.cpp
SRCS+=../dlls/egon.cpp
@ -36,9 +34,7 @@ SRCS+=./hl/hl_baseentity.cpp
SRCS+=./hl/hl_events.cpp
SRCS+=./hl/hl_objects.cpp
SRCS+=./hl/hl_weapons.cpp
SRCS+=../dlls/wpn_shared/hl_wpn_glock.cpp
SRCS+=../dlls/hornetgun.cpp
SRCS+=../common/interface.cpp
SRCS+=../dlls/mp5.cpp
SRCS+=../dlls/python.cpp
SRCS+=../dlls/rpg.cpp
@ -46,6 +42,9 @@ SRCS+=../dlls/satchel.cpp
SRCS+=../dlls/shotgun.cpp
SRCS+=../dlls/squeakgrenade.cpp
SRCS+=../dlls/tripmine.cpp
SRCS+=../dlls/glock.cpp
#SRCS+=../game_shared/voice_banmgr.cpp
#SRCS+=../game_shared/voice_status.cpp
SRCS+=./ammo.cpp
SRCS+=./ammo_secondary.cpp
SRCS+=./ammohistory.cpp
@ -64,20 +63,22 @@ 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+=./input_xash3d.cpp
SRCS+=./input_goldsource.cpp
SRCS+=./input_mouse.cpp
#SRCS+=./inputw32.cpp
SRCS+=./menu.cpp
SRCS+=./message.cpp
SRCS+=./overview.cpp
SRCS+=./parsemsg.cpp
SRCS+=./particlemgr.cpp
SRCS+=./particlemsg.cpp
SRCS+=./particlesys.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+=./scoreboard.cpp
SRCS+=./status_icons.cpp
SRCS+=./statusbar.cpp
SRCS+=./studio_util.cpp
@ -87,21 +88,28 @@ SRCS+=./train.cpp
SRCS+=./tri.cpp
SRCS+=./util.cpp
SRCS+=./view.cpp
SRCS_C+=../pm_shared/pm_debug.c
SRCS_C+=../pm_shared/pm_math.c
SRCS_C+=../pm_shared/pm_shared.c
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
SRCS+=./input_xash3d.cpp
SRCS+=./scoreboard.cpp
SRCS+=./MOTD.cpp
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
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)

118
cl_dll/CMakeLists.txt Normal file
View File

@ -0,0 +1,118 @@
#
# Copyright (c) 2016 Alibek Omarov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
cmake_minimum_required(VERSION 2.6.0)
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")
if (GOLDSOURCE_SUPPORT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGOLDSOURCE_SUPPORT")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ldl")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
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
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
particlemgr.cpp
particlemsg.cpp
particlesys.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)
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include)
if(USE_VOICEMGR)
#set(CLDLL_SOURCES
# ${CLDLL_SOURCES}
# ../game_shared/voice_banmgr.cpp
# ../game_shared/voice_status.cpp)
endif()
add_library (${CLDLL_LIBRARY} SHARED ${CLDLL_SOURCES})
set_target_properties (${CLDLL_SHARED} PROPERTIES
POSITION_INDEPENDENT_CODE 1)

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -99,9 +99,6 @@ HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects.
====================
*/
#include "exportdef.h"
extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
{
if ( version != STUDIO_INTERFACE_VERSION )

View File

@ -1,15 +1,13 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 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

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -972,7 +972,7 @@ HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects.
====================
*/
#include "exportdef.h"
extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
{
if ( version != STUDIO_INTERFACE_VERSION )

View File

@ -1,15 +1,13 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright <EFBFBD> 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

View File

@ -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 )
{

93
cl_dll/Makefile Normal file
View File

@ -0,0 +1,93 @@
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+=./input_mouse.cpp
SRCS+=./input_goldsource.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 -I../utils/false_vgui/include
DEFINES = -Wno-write-strings -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL
CFLAGS = -m32
OBJS = $(SRCS:.cpp=.o) $(SRCS_C:.c=.o)
LIBS=-lm
ifeq ($(GOLDSOURCE_SUPPORT),1)
DEFINES += -DGOLDSOURCE_SUPPORT
endif
ifeq ($(shell uname -s),Linux)
LIBS += -ldl
endif
%.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@
%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@
client.so : $(OBJS)
$(CXX) $(CFLAGS) $(OBJS) -o client.so -shared -Wl,--no-undefined -fPIC $(LIBS)
clean:
$(RM) $(OBJS)

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,13 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#pragma once
#if !defined ( STUDIOMODELRENDERER_H )
#define STUDIOMODELRENDERER_H
#if defined( _WIN32 )
#pragma once
#endif
/*
====================
@ -27,76 +25,76 @@ public:
// Initialization
virtual void Init( void );
public:
public:
// Public Interfaces
virtual int StudioDrawModel ( int flags );
virtual int StudioDrawPlayer ( int flags, struct entity_state_s *pplayer );
virtual int StudioDrawModel( int flags );
virtual int StudioDrawPlayer( int flags, struct entity_state_s *pplayer );
public:
// Local interfaces
//
// Look up animation data for sequence
virtual mstudioanim_t *StudioGetAnim ( model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc );
virtual mstudioanim_t *StudioGetAnim( model_t *m_pSubModel, mstudioseqdesc_t *pseqdesc );
// Interpolate model position and angles and set up matrices
virtual void StudioSetUpTransform (int trivial_accept);
virtual void StudioSetUpTransform( int trivial_accept );
// Set up model bone positions
virtual void StudioSetupBones ( void );
virtual void StudioSetupBones( void );
// Find final attachment points
virtual void StudioCalcAttachments ( void );
virtual void StudioCalcAttachments( void );
// Save bone matrices and names
virtual void StudioSaveBones( void );
// Merge cached bones with current bones for model
virtual void StudioMergeBones ( model_t *m_pSubModel );
virtual void StudioMergeBones( model_t *m_pSubModel );
// Determine interpolation fraction
virtual float StudioEstimateInterpolant( void );
// Determine current frame for rendering
virtual float StudioEstimateFrame ( mstudioseqdesc_t *pseqdesc );
virtual float StudioEstimateFrame( mstudioseqdesc_t *pseqdesc );
// Apply special effects to transform matrix
virtual void StudioFxTransform( cl_entity_t *ent, float transform[3][4] );
// Spherical interpolation of bones
virtual void StudioSlerpBones ( vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s );
virtual void StudioSlerpBones( vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s );
// Compute bone adjustments ( bone controllers )
virtual void StudioCalcBoneAdj ( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen );
// Compute bone adjustments( bone controllers )
virtual void StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen );
// Get bone quaternions
virtual void StudioCalcBoneQuaterion ( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q );
virtual void StudioCalcBoneQuaterion( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *q );
// Get bone positions
virtual void StudioCalcBonePosition ( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos );
virtual void StudioCalcBonePosition( int frame, float s, mstudiobone_t *pbone, mstudioanim_t *panim, float *adj, float *pos );
// Compute rotations
virtual void StudioCalcRotations ( float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f );
virtual void StudioCalcRotations( float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqdesc, mstudioanim_t *panim, float f );
// Send bones and verts to renderer
virtual void StudioRenderModel ( void );
virtual void StudioRenderModel( void );
// Finalize rendering
virtual void StudioRenderFinal (void);
virtual void StudioRenderFinal( void );
// GL&D3D vs. Software renderer finishing functions
virtual void StudioRenderFinal_Software ( void );
virtual void StudioRenderFinal_Hardware ( void );
virtual void StudioRenderFinal_Software( void );
virtual void StudioRenderFinal_Hardware( void );
// Player specific data
// Determine pitch and blending amounts for players
virtual void StudioPlayerBlend ( mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch );
virtual void StudioPlayerBlend( mstudioseqdesc_t *pseqdesc, int *pBlend, float *pPitch );
// Estimate gait frame for player
virtual void StudioEstimateGait ( entity_state_t *pplayer );
virtual void StudioEstimateGait( entity_state_t *pplayer );
// Process movement of player
virtual void StudioProcessGait ( entity_state_t *pplayer );
virtual void StudioProcessGait( entity_state_t *pplayer );
public:
@ -145,7 +143,7 @@ public:
mstudiomodel_t *m_pSubModel;
// Palette substition for top and bottom of model
int m_nTopColor;
int m_nTopColor;
int m_nBottomColor;
//
@ -156,34 +154,34 @@ public:
// Number of bones in bone cache
int m_nCachedBones;
// Names of cached bones
char m_nCachedBoneNames[ MAXSTUDIOBONES ][ 32 ];
char m_nCachedBoneNames[MAXSTUDIOBONES][32];
// Cached bone & light transformation matrices
float m_rgCachedBoneTransform [ MAXSTUDIOBONES ][ 3 ][ 4 ];
float m_rgCachedLightTransform[ MAXSTUDIOBONES ][ 3 ][ 4 ];
float m_rgCachedBoneTransform[MAXSTUDIOBONES][3][4];
float m_rgCachedLightTransform[MAXSTUDIOBONES][3][4];
// Software renderer scale factors
float m_fSoftwareXScale, m_fSoftwareYScale;
// Current view vectors and render origin
float m_vUp[ 3 ];
float m_vRight[ 3 ];
float m_vNormal[ 3 ];
float m_vUp[3];
float m_vRight[3];
float m_vNormal[3];
float m_vRenderOrigin[3];
float m_vRenderOrigin[ 3 ];
// Model render counters ( from engine )
int *m_pStudioModelCount;
int *m_pModelsDrawn;
// Matrices
// Model to world transformation
float (*m_protationmatrix)[ 3 ][ 4 ];
float (*m_protationmatrix)[3][4];
// Model to view transformation
float (*m_paliastransform)[ 3 ][ 4 ];
float (*m_paliastransform)[3][4];
// Concatenated bone and light transforms
float (*m_pbonetransform) [ MAXSTUDIOBONES ][ 3 ][ 4 ];
float (*m_plighttransform)[ MAXSTUDIOBONES ][ 3 ][ 4 ];
float (*m_pbonetransform)[MAXSTUDIOBONES][3][4];
float (*m_plighttransform)[MAXSTUDIOBONES][3][4];
};
#endif // STUDIOMODELRENDERER_H
#endif // STUDIOMODELRENDERER_H

File diff suppressed because it is too large Load Diff

View File

@ -12,13 +12,12 @@
* without written permission from Valve LLC.
*
****/
#pragma once
#ifndef __AMMO_H__
#define __AMMO_H__
#define MAX_WEAPON_NAME 128
#define WEAPON_FLAGS_SELECTONEMPTY 1
#define WEAPON_IS_ONTARGET 0x40
@ -57,6 +56,4 @@ struct WEAPON
};
typedef int AMMO;
#endif
#endif

View File

@ -24,10 +24,10 @@
#include <stdio.h>
#include "parsemsg.h"
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoVal );
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoIcon );
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoVal )
DECLARE_MESSAGE( m_AmmoSecondary, SecAmmoIcon )
int CHudAmmoSecondary :: Init( void )
int CHudAmmoSecondary::Init( void )
{
HOOK_MESSAGE( SecAmmoVal );
HOOK_MESSAGE( SecAmmoIcon );
@ -35,7 +35,7 @@ int CHudAmmoSecondary :: Init( void )
gHUD.AddHudElem(this);
m_HUD_ammoicon = 0;
for ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
m_iAmmoAmounts[i] = -1; // -1 means don't draw this value
Reset();
@ -43,67 +43,68 @@ int CHudAmmoSecondary :: Init( void )
return 1;
}
void CHudAmmoSecondary :: Reset( void )
void CHudAmmoSecondary::Reset( void )
{
m_fFade = 0;
}
int CHudAmmoSecondary :: VidInit( void )
int CHudAmmoSecondary::VidInit( void )
{
return 1;
}
int CHudAmmoSecondary :: Draw(float flTime)
int CHudAmmoSecondary::Draw( float flTime )
{
if ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
if( ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) )
return 1;
// draw secondary ammo icons above normal ammo readout
int a, x, y, r, g, b, AmmoWidth;
UnpackRGB( r, g, b, gHUD.m_iHUDColor ); //LRC
a = (int) max( MIN_ALPHA, m_fFade );
if (m_fFade > 0)
m_fFade -= (gHUD.m_flTimeDelta * 20); // slowly lower alpha to fade out icons
a = (int)max( MIN_ALPHA, m_fFade );
if( m_fFade > 0 )
m_fFade -= ( gHUD.m_flTimeDelta * 20 ); // slowly lower alpha to fade out icons
ScaleColors( r, g, b, a );
AmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
y = ScreenHeight - (gHUD.m_iFontHeight*4); // this is one font height higher than the weapon ammo values
y = ScreenHeight - ( gHUD.m_iFontHeight * 4 ); // this is one font height higher than the weapon ammo values
x = ScreenWidth - AmmoWidth;
if ( m_HUD_ammoicon )
if( m_HUD_ammoicon )
{
// Draw the ammo icon
x -= (gHUD.GetSpriteRect(m_HUD_ammoicon).right - gHUD.GetSpriteRect(m_HUD_ammoicon).left);
y -= (gHUD.GetSpriteRect(m_HUD_ammoicon).top - gHUD.GetSpriteRect(m_HUD_ammoicon).bottom);
x -= ( gHUD.GetSpriteRect( m_HUD_ammoicon ).right - gHUD.GetSpriteRect( m_HUD_ammoicon ).left );
y -= ( gHUD.GetSpriteRect( m_HUD_ammoicon ).top - gHUD.GetSpriteRect( m_HUD_ammoicon ).bottom );
SPR_Set( gHUD.GetSprite(m_HUD_ammoicon), r, g, b );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_ammoicon) );
SPR_Set( gHUD.GetSprite( m_HUD_ammoicon ), r, g, b );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_ammoicon ) );
}
else
{ // move the cursor by the '0' char instead, since we don't have an icon to work with
{
// move the cursor by the '0' char instead, since we don't have an icon to work with
x -= AmmoWidth;
y -= (gHUD.GetSpriteRect(gHUD.m_HUD_number_0).top - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).bottom);
y -= ( gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).top - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).bottom );
}
// draw the ammo counts, in reverse order, from right to left
for ( int i = MAX_SEC_AMMO_VALUES-1; i >= 0; i-- )
for( int i = MAX_SEC_AMMO_VALUES-1; i >= 0; i-- )
{
if ( m_iAmmoAmounts[i] < 0 )
if( m_iAmmoAmounts[i] < 0 )
continue; // negative ammo amounts imply that they shouldn't be drawn
// half a char gap between the ammo number and the previous pic
x -= (AmmoWidth / 2);
x -= ( AmmoWidth / 2 );
// draw the number, right-aligned
x -= (gHUD.GetNumWidth( m_iAmmoAmounts[i], DHN_DRAWZERO ) * AmmoWidth);
x -= ( gHUD.GetNumWidth( m_iAmmoAmounts[i], DHN_DRAWZERO ) * AmmoWidth );
gHUD.DrawHudNumber( x, y, DHN_DRAWZERO, m_iAmmoAmounts[i], r, g, b );
if ( i != 0 )
if( i != 0 )
{
// draw the divider bar
x -= (AmmoWidth / 2);
FillRGBA(x, y, (AmmoWidth/10), gHUD.m_iFontHeight, r, g, b, a);
x -= ( AmmoWidth / 2 );
FillRGBA( x, y, ( AmmoWidth/10 ), gHUD.m_iFontHeight, r, g, b, a );
}
}
@ -113,7 +114,7 @@ int CHudAmmoSecondary :: Draw(float flTime)
// Message handler for Secondary Ammo Value
// accepts one value:
// string: sprite name
int CHudAmmoSecondary :: MsgFunc_SecAmmoIcon( const char *pszName, int iSize, void *pbuf )
int CHudAmmoSecondary::MsgFunc_SecAmmoIcon( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_HUD_ammoicon = gHUD.GetSpriteIndex( READ_STRING() );
@ -126,12 +127,12 @@ int CHudAmmoSecondary :: MsgFunc_SecAmmoIcon( const char *pszName, int iSize, vo
// takes two values:
// byte: ammo index
// byte: ammo value
int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, void *pbuf )
int CHudAmmoSecondary::MsgFunc_SecAmmoVal( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int index = READ_BYTE();
if ( index < 0 || index >= MAX_SEC_AMMO_VALUES )
if( index < 0 || index >= MAX_SEC_AMMO_VALUES )
return 1;
m_iAmmoAmounts[index] = READ_BYTE();
@ -139,13 +140,14 @@ int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, voi
// check to see if there is anything left to draw
int count = 0;
for ( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ )
{
count += max( 0, m_iAmmoAmounts[i] );
}
if ( count == 0 )
{ // the ammo fields are all empty, so turn off this hud area
if( count == 0 )
{
// the ammo fields are all empty, so turn off this hud area
m_iFlags &= ~HUD_ACTIVE;
return 1;
}
@ -155,5 +157,3 @@ int CHudAmmoSecondary :: MsgFunc_SecAmmoVal( const char *pszName, int iSize, voi
return 1;
}

View File

@ -28,9 +28,9 @@
HistoryResource gHR;
#define AMMO_PICKUP_GAP (gHR.iHistoryGap+5)
#define AMMO_PICKUP_PICK_HEIGHT (32 + (gHR.iHistoryGap * 2))
#define AMMO_PICKUP_HEIGHT_MAX (ScreenHeight - 100)
#define AMMO_PICKUP_GAP ( gHR.iHistoryGap + 5 )
#define AMMO_PICKUP_PICK_HEIGHT ( 32 + ( gHR.iHistoryGap * 2 ) )
#define AMMO_PICKUP_HEIGHT_MAX ( ScreenHeight - 100 )
#define MAX_ITEM_NAME 32
int HISTORY_DRAW_TIME = 5;
@ -43,13 +43,14 @@ struct ITEM_INFO
wrect_t rect;
};
void HistoryResource :: AddToHistory( int iType, int iId, int iCount )
void HistoryResource::AddToHistory( int iType, int iId, int iCount )
{
if ( iType == HISTSLOT_AMMO && !iCount )
if( iType == HISTSLOT_AMMO && !iCount )
return; // no amount, so don't add
if ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) )
{ // the pic would have to be drawn too high
if( ( ( ( AMMO_PICKUP_GAP * iCurrentHistorySlot ) + AMMO_PICKUP_PICK_HEIGHT ) > AMMO_PICKUP_HEIGHT_MAX ) || ( iCurrentHistorySlot >= MAX_HISTORY ) )
{
// the pic would have to be drawn too high
// so start from the bottom
iCurrentHistorySlot = 0;
}
@ -63,13 +64,14 @@ void HistoryResource :: AddToHistory( int iType, int iId, int iCount )
freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME;
}
void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount )
void HistoryResource::AddToHistory( int iType, const char *szName, int iCount )
{
if ( iType != HISTSLOT_ITEM )
if( iType != HISTSLOT_ITEM )
return;
if ( (((AMMO_PICKUP_GAP * iCurrentHistorySlot) + AMMO_PICKUP_PICK_HEIGHT) > AMMO_PICKUP_HEIGHT_MAX) || (iCurrentHistorySlot >= MAX_HISTORY) )
{ // the pic would have to be drawn too high
if( ( ( ( AMMO_PICKUP_GAP * iCurrentHistorySlot ) + AMMO_PICKUP_PICK_HEIGHT ) > AMMO_PICKUP_HEIGHT_MAX ) || ( iCurrentHistorySlot >= MAX_HISTORY ) )
{
// the pic would have to be drawn too high
// so start from the bottom
iCurrentHistorySlot = 0;
}
@ -77,9 +79,8 @@ void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount
HIST_ITEM *freeslot = &rgAmmoHistory[iCurrentHistorySlot++]; // default to just writing to the first slot
// I am really unhappy with all the code in this file
int i = gHUD.GetSpriteIndex( szName );
if ( i == -1 )
if( i == -1 )
return; // unknown sprite name, don't add it to history
freeslot->iId = i;
@ -90,12 +91,11 @@ void HistoryResource :: AddToHistory( int iType, const char *szName, int iCount
freeslot->DisplayTime = gHUD.m_flTime + HISTORY_DRAW_TIME;
}
void HistoryResource :: CheckClearHistory( void )
void HistoryResource::CheckClearHistory( void )
{
for ( int i = 0; i < MAX_HISTORY; i++ )
for( int i = 0; i < MAX_HISTORY; i++ )
{
if ( rgAmmoHistory[i].type )
if( rgAmmoHistory[i].type )
return;
}
@ -105,34 +105,36 @@ void HistoryResource :: CheckClearHistory( void )
//
// Draw Ammo pickup history
//
int HistoryResource :: DrawAmmoHistory( float flTime )
int HistoryResource::DrawAmmoHistory( float flTime )
{
for ( int i = 0; i < MAX_HISTORY; i++ )
for( int i = 0; i < MAX_HISTORY; i++ )
{
if ( rgAmmoHistory[i].type )
if( rgAmmoHistory[i].type )
{
rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME );
if ( rgAmmoHistory[i].DisplayTime <= flTime )
{ // pic drawing time has expired
if( rgAmmoHistory[i].DisplayTime <= flTime )
{
// pic drawing time has expired
memset( &rgAmmoHistory[i], 0, sizeof(HIST_ITEM) );
CheckClearHistory();
}
else if ( rgAmmoHistory[i].type == HISTSLOT_AMMO )
else if( rgAmmoHistory[i].type == HISTSLOT_AMMO )
{
wrect_t rcPic;
HSPRITE *spr = gWR.GetAmmoPicFromWeapon( rgAmmoHistory[i].iId, rcPic );
int r, g, b;
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) );
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
ScaleColors( r, g, b, min( scale, 255 ) );
// Draw the pic
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - 24;
if ( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic
{ // the dll has to make sure it has sent info the weapons you need
if( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic
{
// the dll has to make sure it has sent info the weapons you need
SPR_Set( *spr, r, g, b );
SPR_DrawAdditive( 0, xpos, ypos, &rcPic );
}
@ -142,42 +144,42 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
// Draw the number
gHUD.DrawHudNumberString( xpos - 10, ypos, xpos - 100, rgAmmoHistory[i].iCount, r, g, b );
}
else if ( rgAmmoHistory[i].type == HISTSLOT_WEAP )
else if( rgAmmoHistory[i].type == HISTSLOT_WEAP )
{
WEAPON *weap = gWR.GetWeapon( rgAmmoHistory[i].iId );
if ( !weap )
if( !weap )
return 1; // we don't know about the weapon yet, so don't draw anything
int r, g, b;
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
if ( !gWR.HasAmmo( weap ) )
UnpackRGB(r,g,b, RGB_REDISH); // if the weapon doesn't have ammo, display it as red
if( !gWR.HasAmmo( weap ) )
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) );
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
ScaleColors( r, g, b, min( scale, 255 ) );
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - (weap->rcInactive.right - weap->rcInactive.left);
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
int xpos = ScreenWidth - ( weap->rcInactive.right - weap->rcInactive.left );
SPR_Set( weap->hInactive, r, g, b );
SPR_DrawAdditive( 0, xpos, ypos, &weap->rcInactive );
}
else if ( rgAmmoHistory[i].type == HISTSLOT_ITEM )
else if( rgAmmoHistory[i].type == HISTSLOT_ITEM )
{
int r, g, b;
if ( !rgAmmoHistory[i].iId )
if( !rgAmmoHistory[i].iId )
continue; // sprite not loaded
wrect_t rect = gHUD.GetSpriteRect( rgAmmoHistory[i].iId );
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
float scale = (rgAmmoHistory[i].DisplayTime - flTime) * 80;
ScaleColors(r, g, b, min(scale, 255) );
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
ScaleColors( r, g, b, min( scale, 255 ) );
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
int xpos = ScreenWidth - (rect.right - rect.left) - 10;
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
int xpos = ScreenWidth - ( rect.right - rect.left ) - 10;
SPR_Set( gHUD.GetSprite( rgAmmoHistory[i].iId ), r, g, b );
SPR_DrawAdditive( 0, xpos, ypos, &rect );
@ -185,8 +187,5 @@ int HistoryResource :: DrawAmmoHistory( float flTime )
}
}
return 1;
}

View File

@ -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
@ -26,8 +29,8 @@ private:
WEAPON rgWeapons[MAX_WEAPONS]; // Weapons Array
// counts of weapons * ammo
WEAPON* rgSlots[MAX_WEAPON_SLOTS+1][MAX_WEAPON_POSITIONS+1]; // The slots currently in use by weapons. The value is a pointer to the weapon; if it's NULL, no weapon is there
int riAmmo[MAX_AMMO_TYPES]; // count of each ammo type
WEAPON* rgSlots[MAX_WEAPON_SLOTS + 1][MAX_WEAPON_POSITIONS + 1]; // The slots currently in use by weapons. The value is a pointer to the weapon; if it's NULL, no weapon is there
int riAmmo[MAX_AMMO_TYPES]; // count of each ammo type
public:
void Init( void )
@ -49,25 +52,25 @@ public:
WEAPON *GetWeapon( int iId ) { return &rgWeapons[iId]; }
void AddWeapon( WEAPON *wp )
{
rgWeapons[ wp->iId ] = *wp;
LoadWeaponSprites( &rgWeapons[ wp->iId ] );
rgWeapons[wp->iId] = *wp;
LoadWeaponSprites( &rgWeapons[wp->iId] );
}
void PickupWeapon( WEAPON *wp )
{
rgSlots[ wp->iSlot ][ wp->iSlotPos ] = wp;
rgSlots[wp->iSlot][wp->iSlotPos] = wp;
}
void DropWeapon( WEAPON *wp )
{
rgSlots[ wp->iSlot ][ wp->iSlotPos ] = NULL;
rgSlots[wp->iSlot][wp->iSlotPos] = NULL;
}
void DropAllWeapons( void )
{
for ( int i = 0; i < MAX_WEAPONS; i++ )
for( int i = 0; i < MAX_WEAPONS; i++ )
{
if ( rgWeapons[i].iId )
if( rgWeapons[i].iId )
DropWeapon( &rgWeapons[i] );
}
}
@ -94,13 +97,12 @@ public:
extern WeaponsResource gWR;
#define MAX_HISTORY 12
enum {
HISTSLOT_EMPTY,
HISTSLOT_AMMO,
HISTSLOT_WEAP,
HISTSLOT_ITEM,
HISTSLOT_ITEM
};
class HistoryResource
@ -138,6 +140,4 @@ public:
};
extern HistoryResource gHR;
#endif // AMMOHISTORY_H

View File

@ -25,23 +25,22 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE(m_Battery, Battery)
DECLARE_MESSAGE( m_Battery, Battery )
int CHudBattery::Init(void)
int CHudBattery::Init( void )
{
m_iBat = 0;
m_fFade = 0;
m_iFlags = 0;
HOOK_MESSAGE(Battery);
HOOK_MESSAGE( Battery );
gHUD.AddHudElem(this);
gHUD.AddHudElem( this );
return 1;
};
}
int CHudBattery::VidInit(void)
int CHudBattery::VidInit( void )
{
int HUD_suit_empty = gHUD.GetSpriteIndex( "suit_empty" );
int HUD_suit_full = gHUD.GetSpriteIndex( "suit_full" );
@ -52,17 +51,16 @@ int CHudBattery::VidInit(void)
m_iHeight = m_prc2->bottom - m_prc1->top;
m_fFade = 0;
return 1;
};
}
int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )
int CHudBattery::MsgFunc_Battery( const char *pszName, int iSize, void *pbuf )
{
m_iFlags |= HUD_ACTIVE;
BEGIN_READ( pbuf, iSize );
int x = READ_SHORT();
if (x != m_iBat)
if( x != m_iBat )
{
m_fFade = FADE_TIME;
m_iBat = x;
@ -71,68 +69,65 @@ int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudBattery::Draw(float flTime)
int CHudBattery::Draw( float flTime )
{
if ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
if( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH )
return 1;
int r, g, b, x, y, a;
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 - ( min( 100,m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
return 1;
// Has health changed? Flash the health #
if (m_fFade)
if( m_fFade )
{
if (m_fFade > FADE_TIME)
if( m_fFade > FADE_TIME )
m_fFade = FADE_TIME;
m_fFade -= (gHUD.m_flTimeDelta * 20);
if (m_fFade <= 0)
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
if( m_fFade <= 0 )
{
a = 128;
m_fFade = 0;
}
// Fade the health number back to dim
a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128;
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
}
else
a = MIN_ALPHA;
ScaleColors(r, g, b, a );
int iOffset = (m_prc1->bottom - m_prc1->top)/6;
ScaleColors( r, g, b, a );
int iOffset = ( m_prc1->bottom - m_prc1->top ) / 6;
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = ScreenWidth/5;
x = ScreenWidth / 5;
// make sure we have the right sprite handles
if ( !m_hSprite1 )
if( !m_hSprite1 )
m_hSprite1 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_empty" ) );
if ( !m_hSprite2 )
if( !m_hSprite2 )
m_hSprite2 = gHUD.GetSprite( gHUD.GetSpriteIndex( "suit_full" ) );
SPR_Set(m_hSprite1, r, g, b );
SPR_DrawAdditive( 0, x, y - iOffset, m_prc1);
SPR_Set( m_hSprite1, r, g, b );
SPR_DrawAdditive( 0, x, y - iOffset, m_prc1 );
if (rc.bottom > rc.top)
if( rc.bottom > rc.top )
{
SPR_Set(m_hSprite2, r, g, b );
SPR_DrawAdditive( 0, x, y - iOffset + (rc.top - m_prc2->top), &rc);
SPR_Set( m_hSprite2, r, g, b );
SPR_DrawAdditive( 0, x, y - iOffset + ( rc.top - m_prc2->top ), &rc );
}
x += (m_prc1->right - m_prc1->left);
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b);
x += ( m_prc1->right - m_prc1->left );
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iBat, r, g, b );
return 1;
}

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright <EFBFBD> 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_
@ -18,7 +18,6 @@ extern int cam_thirdperson;
void CAM_Init( void );
void CAM_ClearStates( void );
void CAM_StartMouseMove(void);
void CAM_EndMouseMove(void);
#endif // _CAMERA_H_
void CAM_StartMouseMove( void );
void CAM_EndMouseMove( void );
#endif // _CAMERA_H_

View File

@ -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"
{
@ -28,10 +35,6 @@ extern "C"
}
#include <string.h>
#include "interface.h"
#include "exportdef.h"
cl_enginefunc_t gEngfuncs;
CHud gHUD;
@ -45,10 +48,21 @@ int g_iTeamNumber;
int g_iPlayerClass;*/
mobile_engfuncs_t *gMobileEngfuncs = NULL;
void InitInput (void);
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
@ -86,21 +100,21 @@ int DLLEXPORT HUD_GetHullBounds( int hullnumber, float *mins, float *maxs )
{
int iret = 0;
switch ( hullnumber )
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;
}
@ -116,7 +130,7 @@ HUD_ConnectionlessPacket
size of the response_buffer, so you must zero it out if you choose not to respond.
================================
*/
int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
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;
@ -149,10 +163,10 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
{
gEngfuncs = *pEnginefuncs;
if (iVersion != CLDLL_INTERFACE_VERSION)
if( iVersion != CLDLL_INTERFACE_VERSION )
return 0;
memcpy(&gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t));
memcpy( &gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t) );
EV_HookEvents();
@ -178,6 +192,46 @@ int *HUD_GetRect( void )
return extent;
}
#ifdef USE_VGUI_FOR_GOLDSOURCE_SUPPORT
class TeamFortressViewport : public vgui::Panel
{
public:
TeamFortressViewport(int x,int y,int wide,int tall);
void Initialize( void );
virtual void paintBackground();
void *operator new( size_t stAllocateBlock );
};
static TeamFortressViewport* gViewPort = NULL;
TeamFortressViewport::TeamFortressViewport(int x, int y, int wide, int tall) : Panel(x, y, wide, tall)
{
gViewPort = this;
Initialize();
}
void TeamFortressViewport::Initialize()
{
//vgui::App::getInstance()->setCursorOveride( vgui::App::getInstance()->getScheme()->getCursor(vgui::Scheme::scu_none) );
}
void TeamFortressViewport::paintBackground()
{
// int wide, tall;
// getParent()->getSize( wide, tall );
// setSize( wide, tall );
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
}
void *TeamFortressViewport::operator new( size_t stAllocateBlock )
{
void *mem = ::operator new( stAllocateBlock );
memset( mem, 0, stAllocateBlock );
return mem;
}
#endif
/*
==========================
HUD_VidInit
@ -191,7 +245,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;
}
@ -209,8 +281,9 @@ void DLLEXPORT HUD_Init( void )
{
InitInput();
gHUD.Init();
}
gEngfuncs.pfnHookUserMsg( "Bhopcap", __MsgFunc_Bhopcap );
}
/*
==========================
@ -228,7 +301,6 @@ int DLLEXPORT HUD_Redraw( float time, int intermission )
return 1;
}
/*
==========================
HUD_UpdateClientData
@ -242,11 +314,11 @@ returns 1 if anything has been changed, 0 otherwise.
==========================
*/
int DLLEXPORT HUD_UpdateClientData(client_data_t *pcldata, float flTime )
int DLLEXPORT HUD_UpdateClientData( client_data_t *pcldata, float flTime )
{
IN_Commands();
return gHUD.UpdateClientData(pcldata, flTime );
return gHUD.UpdateClientData( pcldata, flTime );
}
/*
@ -272,10 +344,14 @@ 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
}
/*
==========================
HUD_VoiceStatus
@ -284,7 +360,7 @@ Called when a player starts or stops talking.
==========================
*/
void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking)
void DLLEXPORT HUD_VoiceStatus( int entindex, qboolean bTalking )
{
}
@ -308,3 +384,8 @@ void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs )
return;
gMobileEngfuncs = gpMobileEngfuncs;
}
bool isXashFWGS()
{
return gMobileEngfuncs != NULL;
}

File diff suppressed because it is too large Load Diff

View File

@ -25,17 +25,31 @@
// - 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);
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
#define _cdecl
#endif
#include "exportdef.h"
#include <string.h>
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
#define XASH_64BIT
#endif
extern cl_enginefunc_t gEngfuncs;
#include "../engine/mobility_int.h"
extern mobile_engfuncs_t *gMobileEngfuncs;
#define CONPRINT (gEngfuncs.Con_Printf) //LRC - I can't live without printf!
#endif

View File

@ -15,7 +15,9 @@
//
// cl_util.h
//
#ifndef CL_UTIL_H
#define CL_UTIL_H
#include "exportdef.h"
#include "cvardef.h"
#ifndef TRUE
@ -24,66 +26,63 @@
#endif
// Macros to hook function calls into the HUD object
#define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg(#x, __MsgFunc_##x );
#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \
{ \
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
}
#define HOOK_MESSAGE(x) gEngfuncs.pfnHookUserMsg( #x, __MsgFunc_##x );
#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x( const char *pszName, int iSize, void *pbuf ) \
{ \
return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
}
#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y );
#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \
{ \
gHUD.y.UserCmd_##x( ); \
}
{ \
gHUD.y.UserCmd_##x( ); \
}
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); }
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); }
inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int flags ) { return gEngfuncs.pfnRegisterVariable( (char*)cv, (char*)val, flags ); }
#define SPR_Load (*gEngfuncs.pfnSPR_Load)
#define SPR_Set (*gEngfuncs.pfnSPR_Set)
#define SPR_Frames (*gEngfuncs.pfnSPR_Frames)
#define SPR_GetList (*gEngfuncs.pfnSPR_GetList)
#define SPR_Load ( *gEngfuncs.pfnSPR_Load )
#define SPR_Set ( *gEngfuncs.pfnSPR_Set )
#define SPR_Frames ( *gEngfuncs.pfnSPR_Frames )
#define SPR_GetList ( *gEngfuncs.pfnSPR_GetList )
// SPR_Draw draws a the current sprite as solid
#define SPR_Draw (*gEngfuncs.pfnSPR_Draw)
// SPR_DrawHoles draws the current sprites, with color index255 not drawn (transparent)
#define SPR_DrawHoles (*gEngfuncs.pfnSPR_DrawHoles)
#define SPR_Draw ( *gEngfuncs.pfnSPR_Draw )
// SPR_DrawHoles draws the current sprites, with color index255 not drawn (transparent)
#define SPR_DrawHoles ( *gEngfuncs.pfnSPR_DrawHoles )
// SPR_DrawAdditive adds the sprites RGB values to the background (additive transulency)
#define SPR_DrawAdditive (*gEngfuncs.pfnSPR_DrawAdditive)
#define SPR_DrawAdditive ( *gEngfuncs.pfnSPR_DrawAdditive )
// SPR_EnableScissor sets a clipping rect for HUD sprites. (0,0) is the top-left hand corner of the screen.
#define SPR_EnableScissor (*gEngfuncs.pfnSPR_EnableScissor)
// SPR_EnableScissor sets a clipping rect for HUD sprites. (0,0) is the top-left hand corner of the screen.
#define SPR_EnableScissor ( *gEngfuncs.pfnSPR_EnableScissor )
// SPR_DisableScissor disables the clipping rect
#define SPR_DisableScissor (*gEngfuncs.pfnSPR_DisableScissor)
#define SPR_DisableScissor ( *gEngfuncs.pfnSPR_DisableScissor )
//
#define FillRGBA (*gEngfuncs.pfnFillRGBA)
#define FillRGBA ( *gEngfuncs.pfnFillRGBA )
// ScreenHeight returns the height of the screen, in pixels
#define ScreenHeight (gHUD.m_scrinfo.iHeight)
#define ScreenHeight ( gHUD.m_scrinfo.iHeight )
// ScreenWidth returns the width of the screen, in pixels
#define ScreenWidth (gHUD.m_scrinfo.iWidth)
#define ScreenWidth ( gHUD.m_scrinfo.iWidth )
// Use this to set any co-ords in 640x480 space
#define XRES(x) ((int)(float(x) * ((float)ScreenWidth / 640.0f) + 0.5f))
#define YRES(y) ((int)(float(y) * ((float)ScreenHeight / 480.0f) + 0.5f))
#define XRES(x) ( (int)( float(x) * ( (float)ScreenWidth / 640.0f ) + 0.5f ) )
#define YRES(y) ( (int)( float(y) * ( (float)ScreenHeight / 480.0f ) + 0.5f ) )
// use this to project world coordinates to screen coordinates
#define XPROJECT(x) ( (1.0f+(x))*ScreenWidth*0.5f )
#define YPROJECT(y) ( (1.0f-(y))*ScreenHeight*0.5f )
#define GetScreenInfo (*gEngfuncs.pfnGetScreenInfo)
#define ServerCmd (*gEngfuncs.pfnServerCmd)
#define ClientCmd (*gEngfuncs.pfnClientCmd)
#define SetCrosshair (*gEngfuncs.pfnSetCrosshair)
#define AngleVectors (*gEngfuncs.pfnAngleVectors)
#define XPROJECT(x) ( ( 1.0f + (x) ) * ScreenWidth * 0.5f )
#define YPROJECT(y) ( ( 1.0f - (y) ) * ScreenHeight * 0.5f )
#define GetScreenInfo ( *gEngfuncs.pfnGetScreenInfo )
#define ServerCmd ( *gEngfuncs.pfnServerCmd )
#define ClientCmd ( *gEngfuncs.pfnClientCmd )
#define SetCrosshair ( *gEngfuncs.pfnSetCrosshair )
#define AngleVectors ( *gEngfuncs.pfnAngleVectors )
extern cvar_t *hud_textmode;
extern float g_hud_text_color[3];
inline void DrawSetTextColor( float r, float g, float b )
{
if( hud_textmode->value == 1 )
@ -96,9 +95,13 @@ 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 );
}
@ -117,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;
@ -137,10 +142,10 @@ inline void CenterPrint( const char *string )
}
// returns the players name of entity no.
#define GetPlayerInfo (*gEngfuncs.pfnGetPlayerInfo)
#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))
@ -149,16 +154,16 @@ inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex(
void ScaleColors( int &r, int &g, int &b, int a );
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
inline void VectorClear(float *a) { a[0]=0.0;a[1]=0.0;a[2]=0.0;}
float Length(const float *v);
void VectorMA (const float *veca, float scale, const float *vecb, float *vecc);
void VectorScale (const float *in, float scale, float *out);
float VectorNormalize (float *v);
void VectorInverse ( float *v );
#define DotProduct(x, y) ((x)[0] * (y)[0] + (x)[1] * (y)[1] + (x)[2] * (y)[2])
#define VectorSubtract(a, b, c) { (c)[0] = (a)[0] - (b)[0]; (c)[1] = (a)[1] - (b)[1]; (c)[2] = (a)[2] - (b)[2]; }
#define VectorAdd(a, b, c) { (c)[0] = (a)[0] + (b)[0]; (c)[1] = (a)[1] + (b)[1]; (c)[2] = (a)[2] + (b)[2]; }
#define VectorCopy(a, b) { (b)[0] = (a)[0]; (b)[1] = (a)[1]; (b)[2] = (a)[2]; }
inline void VectorClear( float *a ) { a[0] = 0.0; a[1] = 0.0; a[2] = 0.0; }
float Length( const float *v );
void VectorMA( const float *veca, float scale, const float *vecb, float *vecc );
void VectorScale( const float *in, float scale, float *out );
float VectorNormalize( float *v );
void VectorInverse( float *v );
extern vec3_t vec3_origin;
@ -167,11 +172,14 @@ extern vec3_t vec3_origin;
// disable 'truncation from 'const double' to 'float' warning message
#pragma warning( disable: 4305 )
inline void UnpackRGB(int &r, int &g, int &b, unsigned long ulRGB)\
inline void UnpackRGB( int &r, int &g, int &b, unsigned long ulRGB )\
{\
r = (ulRGB & 0xFF0000) >>16;\
g = (ulRGB & 0xFF00) >> 8;\
r = ( ulRGB & 0xFF0000 ) >> 16;\
g = ( ulRGB & 0xFF00 ) >> 8;\
b = ulRGB & 0xFF;\
}
HSPRITE LoadSprite(const char *pszName);
HSPRITE LoadSprite( const char *pszName );
bool isXashFWGS();
#endif

View File

@ -27,7 +27,7 @@
// g_runfuncs is true if this is the first time we've "predicated" a particular movement/firing
// command. If it is 1, then we should play events/sounds etc., otherwise, we just will be
// updating state info, but not firing events
int g_runfuncs = 0;
int g_runfuncs = 0;
// During our weapon prediction processing, we'll need to reference some data that is part of
// the final state passed into the postthink functionality. We'll set this pointer and then
@ -41,14 +41,14 @@ 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;
if ( !pszFile )
const char *pfilename;
if( !pszFile )
{
pfilename = "c:\\hllog.txt";
}
@ -57,15 +57,15 @@ void COM_Log( char *pszFile, char *fmt, ...)
pfilename = pszFile;
}
va_start (argptr,fmt);
vsprintf (string, fmt,argptr);
va_end (argptr);
va_start( argptr, fmt );
vsprintf( string, fmt, argptr );
va_end( argptr );
fp = fopen( pfilename, "a+t");
if (fp)
if( fp )
{
fprintf(fp, "%s", string);
fclose(fp);
fprintf( fp, "%s", string );
fclose( fp );
}
}
@ -83,7 +83,7 @@ Change weapon model animation
void HUD_SendWeaponAnim( int iAnim, int body, int force )
{
// Don't actually change it.
if ( !g_runfuncs && !force )
if( !g_runfuncs && !force )
return;
g_currentanim = iAnim;
@ -111,9 +111,9 @@ 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 )
if( !g_runfuncs || !g_finalstate )
return;
gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, (float *)&g_finalstate->playerstate.origin );
@ -132,7 +132,7 @@ void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short event
vec3_t org;
vec3_t ang;
if ( !g_runfuncs || !g_finalstate )
if( !g_runfuncs || !g_finalstate )
return;
// Weapon prediction events are assumed to occur at the player's origin
@ -151,7 +151,6 @@ void HUD_SetMaxSpeed( const edict_t *ed, float speed )
{
}
/*
=====================
UTIL_WeaponTimeBase
@ -167,7 +166,7 @@ float UTIL_WeaponTimeBase( void )
static unsigned int glSeed = 0;
unsigned int seed_table[ 256 ] =
unsigned int seed_table[256] =
{
28985, 27138, 26457, 9451, 17764, 10909, 28790, 8716, 6361, 4853, 17798, 21977, 19643, 20662, 10834, 20103,
27067, 28634, 18623, 25849, 8576, 26234, 23887, 18228, 32587, 4836, 3306, 1811, 3035, 24559, 18399, 315,
@ -188,16 +187,16 @@ unsigned int seed_table[ 256 ] =
};
unsigned int U_Random( void )
{
{
glSeed *= 69069;
glSeed += seed_table[ glSeed & 0xff ];
return ( ++glSeed & 0x0fffffff );
glSeed += seed_table[glSeed & 0xff];
return ( ++glSeed & 0x0fffffff );
}
void U_Srand( unsigned int seed )
{
glSeed = seed_table[ seed & 0xff ];
glSeed = seed_table[seed & 0xff];
}
/*
@ -212,7 +211,7 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high )
U_Srand( (int)seed + low + high );
range = high - low + 1;
if ( !(range - 1) )
if( !( range - 1 ) )
{
return low;
}
@ -225,7 +224,7 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high )
offset = rnum % range;
return (low + offset);
return ( low + offset );
}
}
@ -236,7 +235,6 @@ UTIL_SharedRandomFloat
*/
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
{
//
unsigned int range;
U_Srand( (int)seed + *(int *)&low + *(int *)&high );
@ -245,7 +243,7 @@ float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
U_Random();
range = high - low;
if ( !range )
if( !range )
{
return low;
}
@ -258,7 +256,7 @@ float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
offset = (float)tensixrand / 65536.0;
return (low + offset * range );
return ( low + offset * range );
}
}
@ -270,8 +268,26 @@ 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 ) { return 0; }
int stub_PrecacheSound ( char* s ) { return 0; }
unsigned short stub_PrecacheEvent ( int type, const char *s ) { return 0; }
const char *stub_NameForFunction ( unsigned long function ) { return "func"; }
void stub_SetModel ( edict_t *e, const char *m ) {}
int stub_PrecacheModel( const char* s )
{
return 0;
}
int stub_PrecacheSound( const char* s )
{
return 0;
}
unsigned short stub_PrecacheEvent( int type, const char *s )
{
return 0;
}
const char *stub_NameForFunction( void *function )
{
return "func";
}
void stub_SetModel( edict_t *e, const char *m )
{
}

View File

@ -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,15 +26,14 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high );
int HUD_GetWeaponAnim( void );
void HUD_SendWeaponAnim( int iAnim, int body, int force );
void HUD_PlaySound( char *sound, float volume );
void HUD_PlaySound( const char *sound, float volume );
void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void HUD_SetMaxSpeed( const struct edict_s *ed, float speed );
int stub_PrecacheModel( char* s );
int stub_PrecacheSound( char* s );
int stub_PrecacheModel( const char* s );
int stub_PrecacheSound( const char* s );
unsigned short stub_PrecacheEvent( int type, const char *s );
const char *stub_NameForFunction ( unsigned long function );
void stub_SetModel ( struct edict_s *e, const char *m );
const char *stub_NameForFunction( void *function );
void stub_SetModel( struct edict_s *e, const char *m );
extern cvar_t *cl_lw;
@ -44,5 +41,4 @@ extern int g_runfuncs;
extern vec3_t v_angles;
extern float g_lastFOV;
extern struct local_state_s *g_finalstate;
#endif
#endif

84
cl_dll/compile.bat Normal file
View File

@ -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.

View File

@ -15,6 +15,7 @@
//
// death notice
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
@ -22,12 +23,11 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE( m_DeathNotice, DeathMsg );
DECLARE_MESSAGE( m_DeathNotice, DeathMsg )
struct DeathNoticeItem {
char szKiller[MAX_PLAYER_NAME_LENGTH*2];
char szVictim[MAX_PLAYER_NAME_LENGTH*2];
char szKiller[MAX_PLAYER_NAME_LENGTH * 2];
char szVictim[MAX_PLAYER_NAME_LENGTH * 2];
int iId; // the index number of the associated sprite
int iSuicide;
int iTeamKill;
@ -42,31 +42,30 @@ static int DEATHNOTICE_DISPLAY_TIME = 6;
#define DEATHNOTICE_TOP 32
DeathNoticeItem rgDeathNoticeList[ MAX_DEATHNOTICES + 1 ];
DeathNoticeItem rgDeathNoticeList[MAX_DEATHNOTICES + 1];
float g_ColorBlue[3] = { 0.6, 0.8, 1.0 };
float g_ColorRed[3] = { 1.0, 0.25, 0.25 };
float g_ColorRed[3] = { 1.0, 0.25, 0.25 };
float g_ColorGreen[3] = { 0.6, 1.0, 0.6 };
float g_ColorYellow[3] = { 1.0, 0.7, 0.0 };
float g_ColorGrey[3] = { 0.8, 0.8, 0.8 };
float *GetClientColor( int clientIndex )
{
switch ( g_PlayerExtraInfo[clientIndex].teamnumber )
switch( g_PlayerExtraInfo[clientIndex].teamnumber )
{
case 1: return g_ColorBlue;
case 2: return g_ColorRed;
case 3: return g_ColorYellow;
case 4: return g_ColorGreen;
case 0: return g_ColorYellow;
default : return g_ColorGrey;
default: return g_ColorGrey;
}
return NULL;
}
int CHudDeathNotice :: Init( void )
int CHudDeathNotice::Init( void )
{
gHUD.AddHudElem( this );
@ -77,33 +76,32 @@ int CHudDeathNotice :: Init( void )
return 1;
}
void CHudDeathNotice :: InitHUDData( void )
void CHudDeathNotice::InitHUDData( void )
{
memset( rgDeathNoticeList, 0, sizeof(rgDeathNoticeList) );
}
int CHudDeathNotice :: VidInit( void )
int CHudDeathNotice::VidInit( void )
{
m_HUD_d_skull = gHUD.GetSpriteIndex( "d_skull" );
return 1;
}
int CHudDeathNotice :: Draw( float flTime )
int CHudDeathNotice::Draw( float flTime )
{
int x, y, r, g, b;
for ( int i = 0; i < MAX_DEATHNOTICES; i++ )
for( int i = 0; i < MAX_DEATHNOTICES; i++ )
{
if ( rgDeathNoticeList[i].iId == 0 )
if( rgDeathNoticeList[i].iId == 0 )
break; // we've gone through them all
if ( rgDeathNoticeList[i].flDisplayTime < flTime )
{ // display time has expired
if( rgDeathNoticeList[i].flDisplayTime < flTime )
{
// display time has expired
// remove the current item from the list
memmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i+1], sizeof(DeathNoticeItem) * (MAX_DEATHNOTICES - i) );
memmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i + 1], sizeof(DeathNoticeItem) * ( MAX_DEATHNOTICES - i ) );
i--; // continue on the next item; stop the counter getting incremented
continue;
}
@ -111,26 +109,27 @@ int CHudDeathNotice :: Draw( float flTime )
rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME );
// Only draw if the viewport will let me
//if ( gViewPort && gViewPort->AllowedToPrintText() )
// vgui dropped out
//if( gViewPort && gViewPort->AllowedToPrintText() )
{
// Draw the death notice
y = YRES(DEATHNOTICE_TOP) + 2 + (20 * i); //!!!
y = YRES( DEATHNOTICE_TOP ) + 2 + ( 20 * i ); //!!!
int id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId;
x = ScreenWidth - ConsoleStringLen(rgDeathNoticeList[i].szVictim) - (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left);
int id = ( rgDeathNoticeList[i].iId == -1 ) ? m_HUD_d_skull : rgDeathNoticeList[i].iId;
x = ScreenWidth - ConsoleStringLen( rgDeathNoticeList[i].szVictim ) - ( gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left );
if ( !rgDeathNoticeList[i].iSuicide )
if( !rgDeathNoticeList[i].iSuicide )
{
x -= (5 + ConsoleStringLen( rgDeathNoticeList[i].szKiller ) );
x -= ( 5 + ConsoleStringLen( rgDeathNoticeList[i].szKiller ) );
// Draw killers name
if ( rgDeathNoticeList[i].KillerColor )
if( rgDeathNoticeList[i].KillerColor )
DrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] );
x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller );
}
r = 255; g = 80; b = 0;
if ( rgDeathNoticeList[i].iTeamKill )
r = 255; g = 80; b = 0;
if( rgDeathNoticeList[i].iTeamKill )
{
r = 10; g = 240; b = 10; // display it in sickly green
}
@ -139,12 +138,12 @@ int CHudDeathNotice :: Draw( float flTime )
SPR_Set( gHUD.GetSprite(id), r, g, b );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(id) );
x += (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left);
x += ( gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left );
// Draw victims name (if it was a player that was killed)
if (rgDeathNoticeList[i].iNonPlayerKill == FALSE)
if( rgDeathNoticeList[i].iNonPlayerKill == FALSE )
{
if ( rgDeathNoticeList[i].VictimColor )
if( rgDeathNoticeList[i].VictimColor )
DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] );
x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim );
}
@ -155,7 +154,7 @@ int CHudDeathNotice :: Draw( float flTime )
}
// This message handler may be better off elsewhere
int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbuf )
int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbuf )
{
int i;
m_iFlags |= HUD_ACTIVE;
@ -169,26 +168,28 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
strcpy( killedwith, "d_" );
strncat( killedwith, READ_STRING(), sizeof(killedwith) - strlen(killedwith) - 1 );
gHUD.m_Spectator.DeathMessage(victim);
gHUD.m_Spectator.DeathMessage( victim );
for ( i = 0; i < MAX_DEATHNOTICES; i++ )
for( i = 0; i < MAX_DEATHNOTICES; i++ )
{
if ( rgDeathNoticeList[i].iId == 0 )
if( rgDeathNoticeList[i].iId == 0 )
break;
}
if ( i == MAX_DEATHNOTICES )
{ // move the rest of the list forward to make room for this item
memmove( rgDeathNoticeList, rgDeathNoticeList+1, sizeof(DeathNoticeItem) * MAX_DEATHNOTICES );
if( i == MAX_DEATHNOTICES )
{
// move the rest of the list forward to make room for this item
memmove( rgDeathNoticeList, rgDeathNoticeList + 1, sizeof(DeathNoticeItem) * MAX_DEATHNOTICES );
i = MAX_DEATHNOTICES - 1;
}
// if (gViewPort)
// gViewPort->GetAllPlayersInfo();
//if(gViewPort)
// gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
// Get the Killer's name
char *killer_name = g_PlayerInfoList[ killer ].name;
if ( !killer_name )
const char *killer_name = "";
killer_name = g_PlayerInfoList[killer].name;
if( !killer_name )
{
killer_name = "";
rgDeathNoticeList[i].szKiller[0] = 0;
@ -197,15 +198,15 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
{
rgDeathNoticeList[i].KillerColor = GetClientColor( killer );
strncpy( rgDeathNoticeList[i].szKiller, killer_name, MAX_PLAYER_NAME_LENGTH );
rgDeathNoticeList[i].szKiller[MAX_PLAYER_NAME_LENGTH-1] = 0;
rgDeathNoticeList[i].szKiller[MAX_PLAYER_NAME_LENGTH - 1] = 0;
}
// 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 )
victim_name = g_PlayerInfoList[ victim ].name;
if ( !victim_name )
if( ( (char)victim ) != -1 )
victim_name = g_PlayerInfoList[victim].name;
if( !victim_name )
{
victim_name = "";
rgDeathNoticeList[i].szVictim[0] = 0;
@ -214,23 +215,23 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
{
rgDeathNoticeList[i].VictimColor = GetClientColor( victim );
strncpy( rgDeathNoticeList[i].szVictim, victim_name, MAX_PLAYER_NAME_LENGTH );
rgDeathNoticeList[i].szVictim[MAX_PLAYER_NAME_LENGTH-1] = 0;
rgDeathNoticeList[i].szVictim[MAX_PLAYER_NAME_LENGTH - 1] = 0;
}
// Is it a non-player object kill?
if ( ((char)victim) == -1 )
if( ( (char)victim ) == -1 )
{
rgDeathNoticeList[i].iNonPlayerKill = TRUE;
// Store the object's name in the Victim slot (skip the d_ bit)
strcpy( rgDeathNoticeList[i].szVictim, killedwith+2 );
strcpy( rgDeathNoticeList[i].szVictim, killedwith + 2 );
}
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;
}
@ -242,7 +243,7 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
DEATHNOTICE_DISPLAY_TIME = CVAR_GET_FLOAT( "hud_deathnotice_time" );
rgDeathNoticeList[i].flDisplayTime = gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME;
if (rgDeathNoticeList[i].iNonPlayerKill)
if( rgDeathNoticeList[i].iNonPlayerKill )
{
ConsolePrint( rgDeathNoticeList[i].szKiller );
ConsolePrint( " killed a " );
@ -252,11 +253,11 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
else
{
// record the death notice in the console
if ( rgDeathNoticeList[i].iSuicide )
if( rgDeathNoticeList[i].iSuicide )
{
ConsolePrint( rgDeathNoticeList[i].szVictim );
if ( !strcmp( killedwith, "d_world" ) )
if( !strcmp( killedwith, "d_world" ) )
{
ConsolePrint( " died" );
}
@ -265,7 +266,7 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
ConsolePrint( " killed self" );
}
}
else if ( rgDeathNoticeList[i].iTeamKill )
else if( rgDeathNoticeList[i].iTeamKill )
{
ConsolePrint( rgDeathNoticeList[i].szKiller );
ConsolePrint( " killed his teammate " );
@ -278,17 +279,17 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
ConsolePrint( rgDeathNoticeList[i].szVictim );
}
if ( *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill )
if( *killedwith && (*killedwith > 13 ) && strcmp( killedwith, "d_world" ) && !rgDeathNoticeList[i].iTeamKill )
{
ConsolePrint( " with " );
// replace the code names with the 'real' names
if ( !strcmp( killedwith+2, "egon" ) )
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
ConsolePrint( killedwith + 2 ); // skip over the "d_" part
}
ConsolePrint( "\n" );
@ -296,7 +297,3 @@ int CHudDeathNotice :: MsgFunc_DeathMsg( const char *pszName, int iSize, void *p
return 1;
}

View File

@ -12,14 +12,13 @@
* without written permission from Valve LLC.
*
****/
#include "hud.h"
#include "cl_util.h"
#include "demo.h"
#include "demo_api.h"
#include <memory.h>
#include "exportdef.h"
int g_demosniper = 0;
int g_demosniperdamage = 0;
float g_demosniperorg[3];
@ -43,14 +42,14 @@ Write some data to the demo stream
void Demo_WriteBuffer( int type, int size, unsigned char *buffer )
{
int pos = 0;
unsigned char buf[ 32 * 1024 ];
*( int * )&buf[pos] = type;
pos+=sizeof( int );
unsigned char buf[32 * 1024];
*(int *)&buf[pos] = type;
pos += sizeof(int);
memcpy( &buf[pos], buffer, size );
// Write full buffer out
gEngfuncs.pDemoAPI->WriteBuffer( size + sizeof( int ), buf );
gEngfuncs.pDemoAPI->WriteBuffer( size + sizeof(int), buf );
}
/*
@ -65,39 +64,39 @@ void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer )
int type;
int i = 0;
type = *( int * )buffer;
i += sizeof( int );
switch ( type )
type = *(int *)buffer;
i += sizeof(int);
switch( type )
{
case TYPE_SNIPERDOT:
g_demosniper = *(int * )&buffer[ i ];
i += sizeof( int );
g_demosniper = *(int *)&buffer[i];
i += sizeof(int);
if ( g_demosniper )
if( g_demosniper )
{
g_demosniperdamage = *( int * )&buffer[ i ];
i += sizeof( int );
g_demosniperdamage = *(int *)&buffer[i];
i += sizeof(int);
g_demosniperangles[ 0 ] = *(float *)&buffer[i];
i += sizeof( float );
g_demosniperangles[ 1 ] = *(float *)&buffer[i];
i += sizeof( float );
g_demosniperangles[ 2 ] = *(float *)&buffer[i];
i += sizeof( float );
g_demosniperorg[ 0 ] = *(float *)&buffer[i];
i += sizeof( float );
g_demosniperorg[ 1 ] = *(float *)&buffer[i];
i += sizeof( float );
g_demosniperorg[ 2 ] = *(float *)&buffer[i];
i += sizeof( float );
g_demosniperangles[0] = *(float *)&buffer[i];
i += sizeof(float);
g_demosniperangles[1] = *(float *)&buffer[i];
i += sizeof(float);
g_demosniperangles[2] = *(float *)&buffer[i];
i += sizeof(float);
g_demosniperorg[0] = *(float *)&buffer[i];
i += sizeof(float);
g_demosniperorg[1] = *(float *)&buffer[i];
i += sizeof(float);
g_demosniperorg[2] = *(float *)&buffer[i];
i += sizeof(float);
}
break;
case TYPE_ZOOM:
g_demozoom = *(float * )&buffer[ i ];
i += sizeof( float );
g_demozoom = *(float *)&buffer[i];
i += sizeof(float);
break;
default:
gEngfuncs.Con_DPrintf( "Unknown demo buffer type, skipping.\n" );
break;
}
}
}

View File

@ -1,13 +1,13 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 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
@ -23,5 +23,4 @@ extern int g_demosniperdamage;
extern float g_demosniperorg[3];
extern float g_demosniperangles[3];
extern float g_demozoom;
#endif
#endif

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -20,15 +20,13 @@
#include "pmtrace.h"
#include "pm_shared.h"
#include "exportdef.h"
void Game_AddObjects( void );
extern vec3_t v_origin;
int g_iAlive = 1;
extern "C"
extern "C"
{
int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname );
void DLLEXPORT HUD_CreateEntities( void );
@ -48,7 +46,7 @@ HUD_AddEntity
*/
int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *modelname )
{
switch ( type )
switch( type )
{
case ET_NORMAL:
case ET_PLAYER:
@ -63,14 +61,13 @@ int DLLEXPORT HUD_AddEntity( int type, struct cl_entity_s *ent, const char *mode
// each frame every entity passes this function, so the overview hooks
// it to filter the overview entities
if ( g_iUser1 )
if( g_iUser1 )
{
gHUD.m_Spectator.AddOverviewEntity( type, ent, modelname );
if ( ( g_iUser1 == OBS_IN_EYE || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) &&
if( ( g_iUser1 == OBS_IN_EYE || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) &&
ent->index == g_iUser2 )
return 0; // don't draw the player we are following in eye
}
return 1;
@ -116,16 +113,16 @@ void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct
VectorCopy( src->velocity, dst->velocity );
dst->frame = src->frame;
dst->frame = src->frame;
dst->modelindex = src->modelindex;
dst->skin = src->skin;
dst->skin = src->skin;
dst->effects = src->effects;
dst->weaponmodel = src->weaponmodel;
dst->movetype = src->movetype;
dst->sequence = src->sequence;
dst->animtime = src->animtime;
dst->solid = src->solid;
dst->solid = src->solid;
dst->rendermode = src->rendermode;
dst->renderamt = src->renderamt;
@ -135,10 +132,10 @@ void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct
dst->renderfx = src->renderfx;
dst->framerate = src->framerate;
dst->body = src->body;
dst->body = src->body;
memcpy( &dst->controller[0], &src->controller[0], 4 * sizeof( byte ) );
memcpy( &dst->blending[0], &src->blending[0], 2 * sizeof( byte ) );
memcpy( &dst->controller[0], &src->controller[0], 4 * sizeof(byte) );
memcpy( &dst->blending[0], &src->blending[0], 2 * sizeof(byte) );
VectorCopy( src->basevelocity, dst->basevelocity );
@ -148,12 +145,12 @@ void DLLEXPORT HUD_ProcessPlayerState( struct entity_state_s *dst, const struct
dst->spectator = src->spectator;
dst->usehull = src->usehull;
dst->playerclass = src->playerclass;
dst->team = src->team;
dst->team = src->team;
dst->colormap = src->colormap;
// Save off some data so other areas of the Client DLL can get to it
cl_entity_t *player = gEngfuncs.GetLocalPlayer(); // Get the local player's index
if ( dst->number == player->index )
if( dst->number == player->index )
{
g_iPlayerClass = dst->playerclass;
g_iTeamNumber = dst->team;
@ -174,7 +171,7 @@ Because we can predict an arbitrary number of frames before the server responds
update is occupying.
=========================
*/
void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd )
void DLLEXPORT HUD_TxferPredictionData( struct entity_state_s *ps, const struct entity_state_s *pps, struct clientdata_s *pcd, const struct clientdata_s *ppcd, struct weapon_data_s *wd, const struct weapon_data_s *pwd )
{
ps->oldbuttons = pps->oldbuttons;
ps->flFallVelocity = pps->flFallVelocity;
@ -182,13 +179,13 @@ void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct
ps->playerclass = pps->playerclass;
pcd->viewmodel = ppcd->viewmodel;
pcd->m_iId = ppcd->m_iId;
pcd->m_iId = ppcd->m_iId;
pcd->ammo_shells = ppcd->ammo_shells;
pcd->ammo_nails = ppcd->ammo_nails;
pcd->ammo_cells = ppcd->ammo_cells;
pcd->ammo_rockets = ppcd->ammo_rockets;
pcd->m_flNextAttack = ppcd->m_flNextAttack;
pcd->fov = ppcd->fov;
pcd->fov = ppcd->fov;
pcd->weaponanim = ppcd->weaponanim;
pcd->tfstate = ppcd->tfstate;
pcd->maxspeed = ppcd->maxspeed;
@ -205,18 +202,17 @@ void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct
// Duck prevention
pcd->iuser3 = ppcd->iuser3;
if ( gEngfuncs.IsSpectateOnly() )
if( gEngfuncs.IsSpectateOnly() )
{
// in specator mode we tell the engine who we want to spectate and how
// iuser3 is not used for duck prevention (since the spectator can't duck at all)
pcd->iuser1 = g_iUser1; // observer mode
pcd->iuser2 = g_iUser2; // first target
pcd->iuser3 = g_iUser3; // second target
}
// Fire prevention
pcd->iuser4 = ppcd->iuser4;
pcd->iuser4 = ppcd->iuser4;
pcd->fuser2 = ppcd->fuser2;
pcd->fuser3 = ppcd->fuser3;
@ -226,7 +222,7 @@ void DLLEXPORT HUD_TxferPredictionData ( struct entity_state_s *ps, const struct
VectorCopy( ppcd->vuser3, pcd->vuser3 );
VectorCopy( ppcd->vuser4, pcd->vuser4 );
memcpy( wd, pwd, 32 * sizeof( weapon_data_t ) );
memcpy( wd, pwd, 32 * sizeof(weapon_data_t) );
}
/*
@ -244,35 +240,33 @@ void MoveModel( void )
// Load it up with some bogus data
player = gEngfuncs.GetLocalPlayer();
if ( !player )
if( !player )
return;
mod = gEngfuncs.CL_LoadModel( "models/sentry3.mdl", &modelindex );
for ( i = 0; i < 3; i++ )
for( i = 0; i < 3; i++ )
{
for ( j = 0; j < 3; j++ )
for( j = 0; j < 3; j++ )
{
// Don't draw over ourself...
if ( ( i == 1 ) && ( j == 1 ) )
if( ( i == 1 ) && ( j == 1 ) )
continue;
mymodel[ i * 3 + j ] = *player;
mymodel[i * 3 + j] = *player;
mymodel[ i * 3 + j ].player = 0;
mymodel[i * 3 + j].player = 0;
mymodel[ i * 3 + j ].model = mod;
mymodel[ i * 3 + j ].curstate.modelindex = modelindex;
mymodel[i * 3 + j].model = mod;
mymodel[i * 3 + j].curstate.modelindex = modelindex;
// Move it out a bit
mymodel[ i * 3 + j ].origin[0] = player->origin[0] + 50 * ( 1 - i );
mymodel[ i * 3 + j ].origin[1] = player->origin[1] + 50 * ( 1 - j );
// Move it out a bit
mymodel[i * 3 + j].origin[0] = player->origin[0] + 50 * ( 1 - i );
mymodel[i * 3 + j].origin[1] = player->origin[1] + 50 * ( 1 - j );
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &mymodel[i*3+j] );
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &mymodel[i * 3 + j] );
}
}
}
#endif
//#define TRACE_TEST
@ -286,12 +280,12 @@ void TraceModel( void )
{
cl_entity_t *ent;
if ( hitent <= 0 )
if( hitent <= 0 )
return;
// Load it up with some bogus data
ent = gEngfuncs.GetEntityByIndex( hitent );
if ( !ent )
if( !ent )
return;
hit = *ent;
@ -303,7 +297,6 @@ void TraceModel( void )
gEngfuncs.CL_CreateVisibleEntity( ET_NORMAL, &hit );
}
#endif
*/
@ -312,9 +305,9 @@ void ParticleCallback( struct particle_s *particle, float frametime )
{
int i;
for ( i = 0; i < 3; i++ )
for( i = 0; i < 3; i++ )
{
particle->org[ i ] += particle->vel[ i ] * frametime;
particle->org[i] += particle->vel[i] * frametime;
}
}
@ -323,13 +316,13 @@ void Particles( void )
{
static float lasttime;
float curtime;
curtime = gEngfuncs.GetClientTime();
if ( ( curtime - lasttime ) < 2.0 )
if( ( curtime - lasttime ) < 2.0 )
return;
if ( !color )
if( !color )
{
color = gEngfuncs.pfnRegisterVariable ( "color","255 0 0", 0 );
}
@ -340,20 +333,20 @@ void Particles( void )
particle_t *p;
int i, j;
for ( i = 0; i < 1000; i++ )
for( i = 0; i < 1000; i++ )
{
int r, g, b;
p = gEngfuncs.pEfxAPI->R_AllocParticle( ParticleCallback );
if ( !p )
if( !p )
break;
for ( j = 0; j < 3; j++ )
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.0, 32.0 );
p->vel[j] = gEngfuncs.pfnRandomFloat( -100.0, 100.0 );
}
if ( color )
if( color )
{
sscanf( color->string, "%i %i %i", &r, &g, &b );
}
@ -364,7 +357,7 @@ void Particles( void )
b = 0;
}
p->color = gEngfuncs.pEfxAPI->R_LookupColor( r, g, b );
p->color = gEngfuncs.pEfxAPI->R_LookupColor( r, g, b );
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
@ -374,13 +367,13 @@ void Particles( void )
*/
/*
void TempEntCallback ( struct tempent_s *ent, float frametime, float currenttime )
void TempEntCallback( struct tempent_s *ent, float frametime, float currenttime )
{
int i;
for ( i = 0; i < 3; i++ )
for( i = 0; i < 3; i++ )
{
ent->entity.curstate.origin[ i ] += ent->entity.baseline.origin[ i ] * frametime;
ent->entity.curstate.origin[i] += ent->entity.baseline.origin[i] * frametime;
}
}
@ -388,10 +381,10 @@ void TempEnts( void )
{
static float lasttime;
float curtime;
curtime = gEngfuncs.GetClientTime();
if ( ( curtime - lasttime ) < 10.0 )
if( ( curtime - lasttime ) < 10.0 )
return;
lasttime = curtime;
@ -404,27 +397,27 @@ void TempEnts( void )
mod = gEngfuncs.CL_LoadModel( "sprites/laserdot.spr", &index );
for ( i = 0; i < 100; i++ )
for( i = 0; i < 100; i++ )
{
for ( j = 0; j < 3; j++ )
for( j = 0; j < 3; j++ )
{
origin[ j ] = v_origin[ j ];
if ( j != 2 )
origin[j] = v_origin[j];
if( j != 2 )
{
origin[ j ] += 75;
origin[j] += 75;
}
}
p = gEngfuncs.pEfxAPI->CL_TentEntAllocCustom( (float *)&origin, mod, 0, TempEntCallback );
if ( !p )
if( !p )
break;
for ( j = 0; j < 3; j++ )
for( j = 0; j < 3; j++ )
{
p->entity.curstate.origin[ j ] = origin[ j ];
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, 100 );
}
// p->die is set to current time so all you have to do is add an additional time to it
@ -434,9 +427,9 @@ void TempEnts( void )
*/
#if defined( BEAM_TEST )
// Note can't index beam[ 0 ] in Beam callback, so don't use that index
// Note can't index beam[0] in Beam callback, so don't use that index
// Room for 1 beam ( 0 can't be used )
static cl_entity_t beams[ 2 ];
static cl_entity_t beams[2];
void BeamEndModel( void )
{
@ -446,21 +439,21 @@ void BeamEndModel( void )
// Load it up with some bogus data
player = gEngfuncs.GetLocalPlayer();
if ( !player )
if( !player )
return;
mod = gEngfuncs.CL_LoadModel( "models/sentry3.mdl", &modelindex );
if ( !mod )
if( !mod )
return;
// Slot 1
model = &beams[ 1 ];
model = &beams[1];
*model = *player;
model->player = 0;
model->model = mod;
model->curstate.modelindex = modelindex;
// Move it out a bit
model->origin[0] = player->origin[0] - 100;
model->origin[1] = player->origin[1];
@ -481,22 +474,22 @@ void Beams( void )
int index;
BeamEndModel();
curtime = gEngfuncs.GetClientTime();
float end[ 3 ];
if ( ( curtime - lasttime ) < 10.0 )
curtime = gEngfuncs.GetClientTime();
float end[3];
if( ( curtime - lasttime ) < 10.0 )
return;
mod = gEngfuncs.CL_LoadModel( "sprites/laserbeam.spr", &index );
if ( !mod )
if( !mod )
return;
lasttime = curtime;
end [ 0 ] = v_origin.x + 100;
end [ 1 ] = v_origin.y + 100;
end [ 2 ] = v_origin.z;
end[0] = v_origin.x + 100;
end[1] = v_origin.y + 100;
end[2] = v_origin.z;
BEAM *p1;
p1 = gEngfuncs.pEfxAPI->R_BeamEntPoint( -1, end, index,
@ -520,7 +513,6 @@ void DLLEXPORT HUD_CreateEntities( void )
#if defined( TEST_IT )
MoveModel();
#endif
#if defined( TRACE_TEST )
TraceModel();
#endif
@ -531,11 +523,9 @@ void DLLEXPORT HUD_CreateEntities( void )
/*
TempEnts();
*/
#if defined( BEAM_TEST )
Beams();
#endif
// Add in any game specific objects
Game_AddObjects();
}
@ -553,19 +543,19 @@ void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, const struct
switch( event->event )
{
case 5001:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options) );
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options ) );
break;
case 5011:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options) );
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options ) );
break;
case 5021:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options) );
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options ) );
break;
case 5031:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options) );
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options ) );
break;
case 5002:
gEngfuncs.pEfxAPI->R_SparkEffect( (float *)&entity->attachment[0], atoi( event->options), -100, 100 );
gEngfuncs.pEfxAPI->R_SparkEffect( (float *)&entity->attachment[0], atoi( event->options ), -100, 100 );
break;
// Client side sound
case 5004:
@ -595,10 +585,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
@ -611,19 +601,19 @@ 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;
gTempEntFrame = ( gTempEntFrame + 1 ) & 31;
pTemp = *ppTempEntActive;
// !!! Don't simulate while paused.... This is sort of a hack, revisit.
if ( frametime <= 0 )
if( frametime <= 0 )
{
while ( pTemp )
while( pTemp )
{
if ( !(pTemp->flags & FTENT_NOMODEL ) )
if( !( pTemp->flags & FTENT_NOMODEL ) )
{
Callback_AddVisibleEntity( &pTemp->entity );
}
@ -633,12 +623,12 @@ 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;
while ( pTemp )
while( pTemp )
{
int active;
@ -646,25 +636,24 @@ void DLLEXPORT HUD_TempEntUpdate (
life = pTemp->die - client_time;
pnext = pTemp->next;
if ( life < 0 )
if( life < 0 )
{
if ( pTemp->flags & FTENT_FADEOUT )
if( pTemp->flags & FTENT_FADEOUT )
{
if (pTemp->entity.curstate.rendermode == kRenderNormal)
if( pTemp->entity.curstate.rendermode == kRenderNormal)
pTemp->entity.curstate.rendermode = kRenderTransTexture;
pTemp->entity.curstate.renderamt = pTemp->entity.baseline.renderamt * ( 1 + life * pTemp->fadeSpeed );
if ( pTemp->entity.curstate.renderamt <= 0 )
if( pTemp->entity.curstate.renderamt <= 0 )
active = 0;
}
else
active = 0;
}
if ( !active ) // Kill it
if( !active ) // Kill it
{
pTemp->next = *ppTempEntFree;
*ppTempEntFree = pTemp;
if ( !pprev ) // Deleting at head of list
if( !pprev ) // Deleting at head of list
*ppTempEntActive = pnext;
else
pprev->next = pnext;
@ -672,14 +661,14 @@ void DLLEXPORT HUD_TempEntUpdate (
else
{
pprev = pTemp;
VectorCopy( pTemp->entity.origin, pTemp->entity.prevstate.origin );
if ( pTemp->flags & FTENT_SPARKSHOWER )
if( pTemp->flags & FTENT_SPARKSHOWER )
{
// Adjust speed if it's time
// Scale is next think time
if ( client_time > pTemp->entity.baseline.scale )
if( client_time > pTemp->entity.baseline.scale )
{
// Show Sparks
gEngfuncs.pEfxAPI->R_SparkEffect( pTemp->entity.origin, 8, -200, 200 );
@ -687,7 +676,7 @@ void DLLEXPORT HUD_TempEntUpdate (
// Reduce life
pTemp->entity.baseline.framerate -= 0.1;
if ( pTemp->entity.baseline.framerate <= 0.0 )
if( pTemp->entity.baseline.framerate <= 0.0 )
{
pTemp->die = client_time;
}
@ -701,7 +690,7 @@ void DLLEXPORT HUD_TempEntUpdate (
}
}
}
else if ( pTemp->flags & FTENT_PLYRATTACHMENT )
else if( pTemp->flags & FTENT_PLYRATTACHMENT )
{
cl_entity_t *pClient;
@ -709,40 +698,39 @@ void DLLEXPORT HUD_TempEntUpdate (
VectorAdd( pClient->origin, pTemp->tentOffset, pTemp->entity.origin );
}
else if ( pTemp->flags & FTENT_SINEWAVE )
else if( pTemp->flags & FTENT_SINEWAVE )
{
pTemp->x += pTemp->entity.baseline.origin[0] * frametime;
pTemp->y += pTemp->entity.baseline.origin[1] * 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[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[2] += pTemp->entity.baseline.origin[2] * frametime;
}
else if ( pTemp->flags & FTENT_SPIRAL )
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)pTemp );
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (int)pTemp );
pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (size_t)pTemp );
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (size_t)pTemp );
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
}
else
{
for ( i = 0; i < 3; i++ )
for( i = 0; i < 3; i++ )
pTemp->entity.origin[i] += pTemp->entity.baseline.origin[i] * frametime;
}
if ( pTemp->flags & FTENT_SPRANIMATE )
if( pTemp->flags & FTENT_SPRANIMATE )
{
pTemp->entity.curstate.frame += frametime * pTemp->entity.curstate.framerate;
if ( pTemp->entity.curstate.frame >= pTemp->frameMax )
if( pTemp->entity.curstate.frame >= pTemp->frameMax )
{
pTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)(pTemp->entity.curstate.frame);
pTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)( pTemp->entity.curstate.frame );
if ( !(pTemp->flags & FTENT_SPRANIMATELOOP) )
if( !( pTemp->flags & FTENT_SPRANIMATELOOP ) )
{
// this animating sprite isn't set to loop, so destroy it.
pTemp->die = client_time;
@ -751,21 +739,21 @@ void DLLEXPORT HUD_TempEntUpdate (
}
}
}
else if ( pTemp->flags & FTENT_SPRCYCLE )
else if( pTemp->flags & FTENT_SPRCYCLE )
{
pTemp->entity.curstate.frame += frametime * 10;
if ( pTemp->entity.curstate.frame >= pTemp->frameMax )
if( pTemp->entity.curstate.frame >= pTemp->frameMax )
{
pTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)(pTemp->entity.curstate.frame);
pTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)( pTemp->entity.curstate.frame );
}
}
// Experiment
#if 0
if ( pTemp->flags & FTENT_SCALE )
pTemp->entity.curstate.framerate += 20.0 * (frametime / pTemp->entity.curstate.framerate);
if( pTemp->flags & FTENT_SCALE )
pTemp->entity.curstate.framerate += 20.0 * ( frametime / pTemp->entity.curstate.framerate );
#endif
if ( pTemp->flags & FTENT_ROTATE )
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;
@ -774,98 +762,97 @@ void DLLEXPORT HUD_TempEntUpdate (
VectorCopy( pTemp->entity.angles, pTemp->entity.latched.prevangles );
}
if ( pTemp->flags & (FTENT_COLLIDEALL | FTENT_COLLIDEWORLD) )
if( pTemp->flags & ( FTENT_COLLIDEALL | FTENT_COLLIDEWORLD ) )
{
vec3_t traceNormal( 0.0f, 0.0f, 0.0f );
float traceFraction = 1;
if ( pTemp->flags & FTENT_COLLIDEALL )
if( pTemp->flags & FTENT_COLLIDEALL )
{
pmtrace_t pmtrace;
physent_t *pe;
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( pTemp->entity.prevstate.origin, pTemp->entity.origin, PM_STUDIO_BOX, -1, &pmtrace );
if ( pmtrace.fraction != 1 )
if( pmtrace.fraction != 1 )
{
pe = gEngfuncs.pEventAPI->EV_GetPhysent( pmtrace.ent );
if ( !pmtrace.ent || ( pe->info != pTemp->clientIndex ) )
if( !pmtrace.ent || ( pe->info != pTemp->clientIndex ) )
{
traceFraction = pmtrace.fraction;
VectorCopy( pmtrace.plane.normal, traceNormal );
if ( pTemp->hitcallback )
if( pTemp->hitcallback )
{
(*pTemp->hitcallback)( pTemp, &pmtrace );
}
}
}
}
else if ( pTemp->flags & FTENT_COLLIDEWORLD )
else if( pTemp->flags & FTENT_COLLIDEWORLD )
{
pmtrace_t pmtrace;
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( pTemp->entity.prevstate.origin, pTemp->entity.origin, PM_STUDIO_BOX | PM_WORLD_ONLY, -1, &pmtrace );
gEngfuncs.pEventAPI->EV_PlayerTrace( pTemp->entity.prevstate.origin, pTemp->entity.origin, PM_STUDIO_BOX | PM_WORLD_ONLY, -1, &pmtrace );
if ( pmtrace.fraction != 1 )
if( pmtrace.fraction != 1 )
{
traceFraction = pmtrace.fraction;
VectorCopy( pmtrace.plane.normal, traceNormal );
if ( pTemp->flags & FTENT_SPARKSHOWER )
if( pTemp->flags & FTENT_SPARKSHOWER )
{
// Chop spark speeds a bit more
//
VectorScale( pTemp->entity.baseline.origin, 0.6, pTemp->entity.baseline.origin );
if ( Length( pTemp->entity.baseline.origin ) < 10 )
if( Length( pTemp->entity.baseline.origin ) < 10 )
{
pTemp->entity.baseline.framerate = 0.0;
}
}
if ( pTemp->hitcallback )
if( pTemp->hitcallback )
{
(*pTemp->hitcallback)( pTemp, &pmtrace );
}
}
}
if ( traceFraction != 1 ) // Decent collision now, and damping works
if( traceFraction != 1 ) // Decent collision now, and damping works
{
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 * frametime, pTemp->entity.baseline.origin, pTemp->entity.origin );
// Damp velocity
damp = pTemp->bounceFactor;
if ( pTemp->flags & (FTENT_GRAVITY|FTENT_SLOWGRAVITY) )
if( pTemp->flags & ( FTENT_GRAVITY | FTENT_SLOWGRAVITY ) )
{
damp *= 0.5;
if ( traceNormal[2] > 0.9 ) // Hit floor?
if( traceNormal[2] > 0.9 ) // Hit floor?
{
if ( pTemp->entity.baseline.origin[2] <= 0 && pTemp->entity.baseline.origin[2] >= gravity*3 )
if( pTemp->entity.baseline.origin[2] <= 0 && pTemp->entity.baseline.origin[2] >= gravity*3 )
{
damp = 0; // Stop
pTemp->flags &= ~(FTENT_ROTATE|FTENT_GRAVITY|FTENT_SLOWGRAVITY|FTENT_COLLIDEWORLD|FTENT_SMOKETRAIL);
pTemp->flags &= ~( FTENT_ROTATE | FTENT_GRAVITY | FTENT_SLOWGRAVITY | FTENT_COLLIDEWORLD | FTENT_SMOKETRAIL);
pTemp->entity.angles[0] = 0;
pTemp->entity.angles[2] = 0;
}
}
}
if (pTemp->hitSound)
if( pTemp->hitSound )
{
Callback_TempEntPlaySound(pTemp, damp);
Callback_TempEntPlaySound( pTemp, damp );
}
if (pTemp->flags & FTENT_COLLIDEKILL)
if( pTemp->flags & FTENT_COLLIDEKILL )
{
// die on impact
pTemp->flags &= ~FTENT_FADEOUT;
@ -874,16 +861,16 @@ void DLLEXPORT HUD_TempEntUpdate (
else
{
// Reflect velocity
if ( damp != 0 )
if( damp != 0 )
{
proj = DotProduct( pTemp->entity.baseline.origin, traceNormal );
VectorMA( pTemp->entity.baseline.origin, -proj*2, traceNormal, pTemp->entity.baseline.origin );
VectorMA( pTemp->entity.baseline.origin, -proj * 2, traceNormal, pTemp->entity.baseline.origin );
// Reflect rotation (fake)
pTemp->entity.angles[1] = -pTemp->entity.angles[1];
}
if ( damp != 1 )
if( damp != 1 )
{
VectorScale( pTemp->entity.baseline.origin, damp, pTemp->entity.baseline.origin );
@ -893,11 +880,10 @@ void DLLEXPORT HUD_TempEntUpdate (
}
}
if ( (pTemp->flags & FTENT_FLICKER) && gTempEntFrame == pTemp->entity.curstate.effects )
if( ( pTemp->flags & FTENT_FLICKER ) && gTempEntFrame == pTemp->entity.curstate.effects )
{
dlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocDlight (0);
VectorCopy (pTemp->entity.origin, dl->origin);
dlight_t *dl = gEngfuncs.pEfxAPI->CL_AllocDlight(0);
VectorCopy( pTemp->entity.origin, dl->origin );
dl->radius = 60;
dl->color.r = 255;
dl->color.g = 120;
@ -905,30 +891,30 @@ void DLLEXPORT HUD_TempEntUpdate (
dl->die = client_time + 0.01;
}
if ( pTemp->flags & FTENT_SMOKETRAIL )
if( pTemp->flags & FTENT_SMOKETRAIL )
{
gEngfuncs.pEfxAPI->R_RocketTrail (pTemp->entity.prevstate.origin, pTemp->entity.origin, 1);
gEngfuncs.pEfxAPI->R_RocketTrail( pTemp->entity.prevstate.origin, pTemp->entity.origin, 1 );
}
if ( pTemp->flags & FTENT_GRAVITY )
if( pTemp->flags & FTENT_GRAVITY )
pTemp->entity.baseline.origin[2] += gravity;
else if ( pTemp->flags & FTENT_SLOWGRAVITY )
else if( pTemp->flags & FTENT_SLOWGRAVITY )
pTemp->entity.baseline.origin[2] += gravitySlow;
if ( pTemp->flags & FTENT_CLIENTCUSTOM )
if( pTemp->flags & FTENT_CLIENTCUSTOM )
{
if ( pTemp->callback )
if( pTemp->callback )
{
( *pTemp->callback )( pTemp, frametime, client_time );
(*pTemp->callback)( pTemp, frametime, client_time );
}
}
// Cull to PVS (not frustum cull, just PVS)
if ( !(pTemp->flags & FTENT_NOMODEL ) )
if( !( pTemp->flags & FTENT_NOMODEL ) )
{
if ( !Callback_AddVisibleEntity( &pTemp->entity ) )
if( !Callback_AddVisibleEntity( &pTemp->entity ) )
{
if ( !(pTemp->flags & FTENT_PERSIST) )
if( !( pTemp->flags & FTENT_PERSIST ) )
{
pTemp->die = client_time; // If we can't draw it this frame, just dump it.
pTemp->flags &= ~FTENT_FADEOUT; // Don't fade out, just die
@ -938,7 +924,6 @@ void DLLEXPORT HUD_TempEntUpdate (
}
pTemp = pnext;
}
finish:
// Restore state info
gEngfuncs.pEventAPI->EV_PopPMStates();
@ -960,9 +945,9 @@ cl_entity_t DLLEXPORT *HUD_GetUserEntity( int index )
#if defined( BEAM_TEST )
// None by default, you would return a valic pointer if you create a client side
// beam and attach it to a client side entity.
if ( index > 0 && index <= 1 )
if( index > 0 && index <= 1 )
{
return &beams[ index ];
return &beams[index];
}
else
{
@ -972,4 +957,3 @@ cl_entity_t DLLEXPORT *HUD_GetUserEntity( int index )
return NULL;
#endif
}

View File

@ -13,6 +13,7 @@
*
****/
// shared event functions
#include "hud.h"
#include "cl_util.h"
#include "const.h"
@ -25,7 +26,7 @@
#include "event_api.h"
#include "pm_shared.h"
#define IS_FIRSTPERSON_SPEC ( g_iUser1 == OBS_IN_EYE || (g_iUser1 && (gHUD.m_Spectator.m_pip->value == INSET_IN_EYE)) )
#define IS_FIRSTPERSON_SPEC ( g_iUser1 == OBS_IN_EYE || ( g_iUser1 && ( gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) ) )
/*
=================
GetEntity
@ -71,7 +72,7 @@ Is the entity's index in the player range?
*/
qboolean EV_IsPlayer( int idx )
{
if ( idx >= 1 && idx <= gEngfuncs.GetMaxClients() )
if( idx >= 1 && idx <= gEngfuncs.GetMaxClients() )
return true;
return false;
@ -87,8 +88,8 @@ Is the entity == the local player
qboolean EV_IsLocal( int idx )
{
// check if we are in some way in first person spec mode
if ( IS_FIRSTPERSON_SPEC )
return (g_iUser2 == idx);
if( IS_FIRSTPERSON_SPEC )
return ( g_iUser2 == idx );
else
return gEngfuncs.pEventAPI->EV_IsLocal( idx - 1 ) ? true : false;
}
@ -110,15 +111,15 @@ void EV_GetGunPosition( event_args_t *args, float *pos, float *origin )
VectorClear( view_ofs );
view_ofs[2] = DEFAULT_VIEWHEIGHT;
if ( EV_IsPlayer( idx ) )
if( EV_IsPlayer( idx ) )
{
// in spec mode use entity viewheigh, not own
if ( EV_IsLocal( idx ) && !IS_FIRSTPERSON_SPEC )
if( EV_IsLocal( idx ) && !IS_FIRSTPERSON_SPEC )
{
// Grab predicted result for local player
gEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );
}
else if ( args->ducking == 1 )
else if( args->ducking == 1 )
{
view_ofs[2] = VEC_DUCK_VIEW;
}
@ -162,13 +163,13 @@ void EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity,
VectorClear( view_ofs );
view_ofs[2] = DEFAULT_VIEWHEIGHT;
if ( EV_IsPlayer( idx ) )
if( EV_IsPlayer( idx ) )
{
if ( EV_IsLocal( idx ) )
if( EV_IsLocal( idx ) )
{
gEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );
}
else if ( args->ducking == 1 )
else if( args->ducking == 1 )
{
view_ofs[2] = VEC_DUCK_VIEW;
}
@ -177,10 +178,10 @@ void EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity,
fR = gEngfuncs.pfnRandomFloat( 50, 70 );
fU = gEngfuncs.pfnRandomFloat( 100, 150 );
for ( i = 0; i < 3; i++ )
for( i = 0; i < 3; i++ )
{
ShellVelocity[i] = velocity[i] + right[i] * fR + up[i] * fU + forward[i] * 25;
ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * upScale + forward[i] * forwardScale + right[i] * rightScale;
ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * upScale + forward[i] * forwardScale + right[i] * rightScale;
}
}
@ -195,11 +196,11 @@ void EV_MuzzleFlash( void )
{
// Add muzzle flash to current weapon model
cl_entity_t *ent = GetViewEntity();
if ( !ent )
if( !ent )
{
return;
}
// Or in the muzzle flash
ent->curstate.effects |= EF_MUZZLEFLASH;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,11 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#pragma once
#if !defined ( EV_HLDMH )
#define EV_HLDMH
@ -20,10 +21,11 @@ typedef enum
BULLET_MONSTER_9MM,
BULLET_MONSTER_MP5,
BULLET_MONSTER_12MM,
} Bullet;
BULLET_MONSTER_12MM
}Bullet;
enum glock_e {
enum glock_e
{
GLOCK_IDLE1 = 0,
GLOCK_IDLE2,
GLOCK_IDLE3,
@ -36,7 +38,8 @@ enum glock_e {
GLOCK_ADD_SILENCER
};
enum shotgun_e {
enum shotgun_e
{
SHOTGUN_IDLE = 0,
SHOTGUN_FIRE,
SHOTGUN_FIRE2,
@ -58,10 +61,11 @@ enum mp5_e
MP5_DEPLOY,
MP5_FIRE1,
MP5_FIRE2,
MP5_FIRE3,
MP5_FIRE3
};
enum python_e {
enum python_e
{
PYTHON_IDLE1 = 0,
PYTHON_FIDGET,
PYTHON_FIRE1,
@ -75,7 +79,8 @@ enum python_e {
#define GAUSS_PRIMARY_CHARGE_VOLUME 256// how loud gauss is while charging
#define GAUSS_PRIMARY_FIRE_VOLUME 450// how loud gauss is when discharged
enum gauss_e {
enum gauss_e
{
GAUSS_IDLE = 0,
GAUSS_IDLE2,
GAUSS_FIDGET,
@ -91,5 +96,4 @@ void EV_HLDM_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName );
void EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType );
int EV_HLDM_CheckTracer( int idx, float *vecSrc, float *end, float *forward, float *right, int iBulletType, int iTracerFreq, int *tracerCount );
void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int cShots, float *vecSrc, float *vecDirShooting, float flDistance, int iBulletType, int iTracerFreq, int *tracerCount, float flSpreadX, float flSpreadY );
#endif // EV_HLDMH
#endif // EV_HLDMH

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -6,6 +6,7 @@
//=============================================================================
// eventscripts.h
#pragma once
#if !defined ( EVENTSCRIPTSH )
#define EVENTSCRIPTSH
@ -15,49 +16,6 @@
#define FTENT_FADEOUT 0x00000080
#define DMG_GENERIC 0 // generic damage was done
#define DMG_CRUSH (1 << 0) // crushed by falling or moving object
#define DMG_BULLET (1 << 1) // shot
#define DMG_SLASH (1 << 2) // cut, clawed, stabbed
#define DMG_BURN (1 << 3) // heat burned
#define DMG_FREEZE (1 << 4) // frozen
#define DMG_FALL (1 << 5) // fell too far
#define DMG_BLAST (1 << 6) // explosive blast damage
#define DMG_CLUB (1 << 7) // crowbar, punch, headbutt
#define DMG_SHOCK (1 << 8) // electric shock
#define DMG_SONIC (1 << 9) // sound pulse shockwave
#define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam
#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death.
// time-based damage
//mask off TF-specific stuff too
#define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage
#define DMG_DROWN (1 << 14) // Drowning
#define DMG_FIRSTTIMEBASED DMG_DROWN
#define DMG_PARALYZE (1 << 15) // slows affected creature down
#define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad
#define DMG_POISON (1 << 17) // blood poisioning
#define DMG_RADIATION (1 << 18) // radiation exposure
#define DMG_DROWNRECOVER (1 << 19) // drowning recovery
#define DMG_ACID (1 << 20) // toxic chemicals or acid burns
#define DMG_SLOWBURN (1 << 21) // in an oven
#define DMG_SLOWFREEZE (1 << 22) // in a subzero freezer
#define DMG_MORTAR (1 << 23) // Hit by air raid (done to distinguish grenade from mortar)
//TF ADDITIONS
#define DMG_IGNITE (1 << 24) // Players hit by this begin to burn
#define DMG_RADIUS_MAX (1 << 25) // Radius damage with this flag doesn't decrease over distance
#define DMG_RADIUS_QUAKE (1 << 26) // Radius damage is done like Quake. 1/2 damage at 1/2 radius.
#define DMG_IGNOREARMOR (1 << 27) // Damage ignores target's armor
#define DMG_AIMED (1 << 28) // Does Hit location damage
#define DMG_WALLPIERCING (1 << 29) // Blast Damages ents through walls
#define DMG_CALTROP (1<<30)
#define DMG_HALLUC (1<<31)
// Some of these are HL/TFC specific?
void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype );
void EV_GetGunPosition( struct event_args_s *args, float *pos, float *origin );
@ -69,5 +27,4 @@ void EV_CreateTracer( float *start, float *end );
struct cl_entity_s *GetEntity( int idx );
struct cl_entity_s *GetViewEntity( void );
void EV_MuzzleFlash( void );
#endif // EVENTSCRIPTSH

View File

@ -25,76 +25,73 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE(m_Flash, FlashBat)
DECLARE_MESSAGE(m_Flash, Flashlight)
DECLARE_MESSAGE( m_Flash, FlashBat )
DECLARE_MESSAGE( m_Flash, Flashlight )
#define BAT_NAME "sprites/%d_Flashlight.spr"
int CHudFlashlight::Init(void)
int CHudFlashlight::Init( void )
{
m_fFade = 0;
m_fOn = 0;
HOOK_MESSAGE(Flashlight);
HOOK_MESSAGE(FlashBat);
HOOK_MESSAGE( Flashlight );
HOOK_MESSAGE( FlashBat );
m_iFlags |= HUD_ACTIVE;
gHUD.AddHudElem(this);
gHUD.AddHudElem( this );
return 1;
};
}
void CHudFlashlight::Reset(void)
void CHudFlashlight::Reset( void )
{
m_fFade = 0;
m_fOn = 0;
m_iBat = 100;
m_flBat = 1.0;
}
int CHudFlashlight::VidInit(void)
int CHudFlashlight::VidInit( void )
{
int HUD_flash_empty = gHUD.GetSpriteIndex( "flash_empty" );
int HUD_flash_full = gHUD.GetSpriteIndex( "flash_full" );
int HUD_flash_beam = gHUD.GetSpriteIndex( "flash_beam" );
m_hSprite1 = gHUD.GetSprite(HUD_flash_empty);
m_hSprite2 = gHUD.GetSprite(HUD_flash_full);
m_hBeam = gHUD.GetSprite(HUD_flash_beam);
m_prc1 = &gHUD.GetSpriteRect(HUD_flash_empty);
m_prc2 = &gHUD.GetSpriteRect(HUD_flash_full);
m_hSprite1 = gHUD.GetSprite( HUD_flash_empty );
m_hSprite2 = gHUD.GetSprite( HUD_flash_full );
m_hBeam = gHUD.GetSprite( HUD_flash_beam );
m_prc1 = &gHUD.GetSpriteRect( HUD_flash_empty );
m_prc2 = &gHUD.GetSpriteRect( HUD_flash_full );
m_prcBeam = &gHUD.GetSpriteRect(HUD_flash_beam);
m_iWidth = m_prc2->right - m_prc2->left;
return 1;
};
}
int CHudFlashlight:: MsgFunc_FlashBat(const char *pszName, int iSize, void *pbuf )
int CHudFlashlight::MsgFunc_FlashBat( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int x = READ_BYTE();
m_iBat = x;
m_flBat = ((float)x)/100.0;
m_flBat = ( (float)x ) / 100.0;
return 1;
}
int CHudFlashlight:: MsgFunc_Flashlight(const char *pszName, int iSize, void *pbuf )
int CHudFlashlight::MsgFunc_Flashlight( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_fOn = READ_BYTE();
int x = READ_BYTE();
m_iBat = x;
m_flBat = ((float)x)/100.0;
m_flBat = ( (float)x ) / 100.0;
return 1;
}
int CHudFlashlight::Draw(float flTime)
int CHudFlashlight::Draw( float flTime )
{
static bool show = ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) );
if( show != !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) ) )
@ -111,48 +108,48 @@ int CHudFlashlight::Draw(float flTime)
int r, g, b, x, y, a;
wrect_t rc;
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
return 1;
if (m_fOn)
if( m_fOn )
a = 225;
else
a = MIN_ALPHA;
if (m_flBat < 0.20)
UnpackRGB(r,g,b, RGB_REDISH);
if( m_flBat < 0.20 )
UnpackRGB( r,g,b, RGB_REDISH );
else
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
ScaleColors(r, g, b, a);
ScaleColors( r, g, b, a );
y = (m_prc1->bottom - m_prc2->top)/2;
x = ScreenWidth - m_iWidth - m_iWidth/2 ;
y = ( m_prc1->bottom - m_prc2->top ) / 2;
x = ScreenWidth - m_iWidth - m_iWidth / 2 ;
// Draw the flashlight casing
SPR_Set(m_hSprite1, r, g, b );
SPR_DrawAdditive( 0, x, y, m_prc1);
SPR_Set( m_hSprite1, r, g, b );
SPR_DrawAdditive( 0, x, y, m_prc1 );
if ( m_fOn )
{ // draw the flashlight beam
x = ScreenWidth - m_iWidth/2;
if( m_fOn )
{
// draw the flashlight beam
x = ScreenWidth - m_iWidth / 2;
SPR_Set( m_hBeam, r, g, b );
SPR_DrawAdditive( 0, x, y, m_prcBeam );
}
// draw the flashlight energy level
x = ScreenWidth - m_iWidth - m_iWidth/2 ;
int iOffset = m_iWidth * (1.0 - m_flBat);
if (iOffset < m_iWidth)
x = ScreenWidth - m_iWidth - m_iWidth / 2;
int iOffset = m_iWidth * ( 1.0 - m_flBat );
if( iOffset < m_iWidth )
{
rc = *m_prc2;
rc.left += iOffset;
SPR_Set(m_hSprite2, r, g, b );
SPR_DrawAdditive( 0, x + iOffset, y, &rc);
SPR_Set( m_hSprite2, r, g, b );
SPR_DrawAdditive( 0, x + iOffset, y, &rc );
}
return 1;
}

View File

@ -26,28 +26,28 @@
#include "parsemsg.h"
DECLARE_MESSAGE(m_Geiger, Geiger )
DECLARE_MESSAGE( m_Geiger, Geiger )
int CHudGeiger::Init(void)
int CHudGeiger::Init( void )
{
HOOK_MESSAGE( Geiger );
m_iGeigerRange = 0;
m_iFlags = 0;
gHUD.AddHudElem(this);
gHUD.AddHudElem( this );
srand( (unsigned)time( NULL ) );
return 1;
};
}
int CHudGeiger::VidInit(void)
int CHudGeiger::VidInit( void )
{
return 1;
};
}
int CHudGeiger::MsgFunc_Geiger(const char *pszName, int iSize, void *pbuf)
int CHudGeiger::MsgFunc_Geiger( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -55,128 +55,127 @@ int CHudGeiger::MsgFunc_Geiger(const char *pszName, int iSize, void *pbuf)
// update geiger data
m_iGeigerRange = READ_BYTE();
m_iGeigerRange = m_iGeigerRange << 2;
m_iFlags |= HUD_ACTIVE;
return 1;
}
int CHudGeiger::Draw (float flTime)
int CHudGeiger::Draw( float flTime )
{
int pct;
float flvol = 0.0f;
int rg[3];
//int rg[3];
int i;
if (m_iGeigerRange < 1000 && m_iGeigerRange > 0)
if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 )
{
// peicewise linear is better than continuous formula for this
if (m_iGeigerRange > 800)
if( m_iGeigerRange > 800 )
{
pct = 0; //Con_Printf ( "range > 800\n");
pct = 0; //Con_Printf( "range > 800\n" );
}
else if (m_iGeigerRange > 600)
else if( m_iGeigerRange > 600 )
{
pct = 2;
flvol = 0.4; //Con_Printf ( "range > 600\n");
rg[0] = 1;
rg[1] = 1;
flvol = 0.4; //Con_Printf( "range > 600\n" );
//rg[0] = 1;
//rg[1] = 1;
i = 2;
}
else if (m_iGeigerRange > 500)
else if( m_iGeigerRange > 500 )
{
pct = 4;
flvol = 0.5; //Con_Printf ( "range > 500\n");
rg[0] = 1;
rg[1] = 2;
flvol = 0.5; //Con_Printf( "range > 500\n" );
//rg[0] = 1;
//rg[1] = 2;
i = 2;
}
else if (m_iGeigerRange > 400)
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.6; //Con_Printf( "range > 400\n" );
//rg[0] = 1;
//rg[1] = 2;
//rg[2] = 3;
i = 3;
}
else if (m_iGeigerRange > 300)
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.7; //Con_Printf( "range > 300\n" );
//rg[0] = 2;
//rg[1] = 3;
//rg[2] = 4;
i = 3;
}
else if (m_iGeigerRange > 200)
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.78; //Con_Printf( "range > 200\n" );
//rg[0] = 2;
//rg[1] = 3;
//rg[2] = 4;
i = 3;
}
else if (m_iGeigerRange > 150)
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.80; //Con_Printf( "range > 150\n" );
//rg[0] = 3;
//rg[1] = 4;
//rg[2] = 5;
i = 3;
}
else if (m_iGeigerRange > 100)
else if( m_iGeigerRange > 100 )
{
pct = 60;
flvol = 0.85; //Con_Printf ( "range > 100\n");
rg[0] = 3;
rg[1] = 4;
rg[2] = 5;
flvol = 0.85; //Con_Printf( "range > 100\n" );
//rg[0] = 3;
//rg[1] = 4;
//rg[2] = 5;
i = 3;
}
else if (m_iGeigerRange > 75)
else if( m_iGeigerRange > 75 )
{
pct = 80;
flvol = 0.9; //Con_Printf ( "range > 75\n");
flvol = 0.9; //Con_Printf( "range > 75\n" );
//gflGeigerDelay = cl.time + GEIGERDELAY * 0.75;
rg[0] = 4;
rg[1] = 5;
rg[2] = 6;
//rg[0] = 4;
//rg[1] = 5;
//rg[2] = 6;
i = 3;
}
else if (m_iGeigerRange > 50)
else if( m_iGeigerRange > 50 )
{
pct = 90;
flvol = 0.95; //Con_Printf ( "range > 50\n");
rg[0] = 5;
rg[1] = 6;
flvol = 0.95; //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.0; //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.25; // UTIL_RandomFloat( 0.25, 0.5 );
if ((rand() & 127) < pct || (rand() & 127) < pct)
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.0, 0, 100 );
char sz[256];
int j = rand() & 1;
if (i > 2)
if( i > 2 )
j += rand() & 1;
sprintf(sz, "player/geiger%d.wav", j + 1);
PlaySound(sz, flvol);
sprintf( sz, "player/geiger%d.wav", j + 1 );
PlaySound( sz, flvol );
}
}

View File

@ -29,15 +29,15 @@
#include "mobility_int.h"
DECLARE_MESSAGE(m_Health, Health )
DECLARE_MESSAGE(m_Health, Damage )
DECLARE_MESSAGE( m_Health, Health )
DECLARE_MESSAGE( m_Health, Damage )
#define PAIN_NAME "sprites/%d_pain.spr"
#define DAMAGE_NAME "sprites/%d_dmg.spr"
int giDmgHeight, giDmgWidth;
int giDmgFlags[NUM_DMG_TYPES] =
int giDmgFlags[NUM_DMG_TYPES] =
{
DMG_POISON,
DMG_ACID,
@ -53,10 +53,10 @@ int giDmgFlags[NUM_DMG_TYPES] =
DMG_HALLUC
};
int CHudHealth::Init(void)
int CHudHealth::Init( void )
{
HOOK_MESSAGE(Health);
HOOK_MESSAGE(Damage);
HOOK_MESSAGE( Health );
HOOK_MESSAGE( Damage );
m_iHealth = 100;
m_fFade = 0;
m_iFlags = 0;
@ -65,10 +65,9 @@ int CHudHealth::Init(void)
giDmgHeight = 0;
giDmgWidth = 0;
memset(m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES);
memset( m_dmg, 0, sizeof(DAMAGE_IMAGE) * NUM_DMG_TYPES );
gHUD.AddHudElem(this);
gHUD.AddHudElem( this );
return 1;
}
@ -77,28 +76,28 @@ void CHudHealth::Reset( void )
// make sure the pain compass is cleared when the player respawns
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
// force all the flashing damage icons to expire
m_bitsDamage = 0;
for ( int i = 0; i < NUM_DMG_TYPES; i++ )
for( int i = 0; i < NUM_DMG_TYPES; i++ )
{
m_dmg[i].fExpire = 0;
}
}
int CHudHealth::VidInit(void)
int CHudHealth::VidInit( void )
{
m_hSprite = 0;
m_HUD_dmg_bio = gHUD.GetSpriteIndex( "dmg_bio" ) + 1;
m_HUD_cross = gHUD.GetSpriteIndex( "cross" );
giDmgHeight = gHUD.GetSpriteRect(m_HUD_dmg_bio).right - gHUD.GetSpriteRect(m_HUD_dmg_bio).left;
giDmgWidth = gHUD.GetSpriteRect(m_HUD_dmg_bio).bottom - gHUD.GetSpriteRect(m_HUD_dmg_bio).top;
giDmgHeight = gHUD.GetSpriteRect( m_HUD_dmg_bio ).right - gHUD.GetSpriteRect( m_HUD_dmg_bio ).left;
giDmgWidth = gHUD.GetSpriteRect( m_HUD_dmg_bio ).bottom - gHUD.GetSpriteRect( m_HUD_dmg_bio ).top;
return 1;
}
int CHudHealth:: MsgFunc_Health(const char *pszName, int iSize, void *pbuf )
int CHudHealth::MsgFunc_Health( const char *pszName, int iSize, void *pbuf )
{
// TODO: update local health data
BEGIN_READ( pbuf, iSize );
@ -107,7 +106,7 @@ int CHudHealth:: MsgFunc_Health(const char *pszName, int iSize, void *pbuf )
m_iFlags |= HUD_ACTIVE;
// Only update the fade if we've changed health
if (x != m_iHealth)
if( x != m_iHealth )
{
m_fFade = FADE_TIME;
m_iHealth = x;
@ -116,8 +115,7 @@ int CHudHealth:: MsgFunc_Health(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
int CHudHealth::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -127,44 +125,45 @@ int CHudHealth:: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
vec3_t vecFrom;
for ( int i = 0 ; i < 3 ; i++)
for( int i = 0; i < 3; i++ )
vecFrom[i] = READ_COORD();
UpdateTiles(gHUD.m_flTime, bitsDamage);
UpdateTiles( gHUD.m_flTime, bitsDamage );
// Actually took damage?
if ( damageTaken > 0 || armor > 0 )
if( damageTaken > 0 || armor > 0 )
{
CalcDamageDirection(vecFrom);
CalcDamageDirection( vecFrom );
if( gMobileEngfuncs && damageTaken > 0 )
{
if( gMobileEngfuncs && damageTaken > 0 )
{
float time = damageTaken * 4.0f;
if( time > 200.0f ) time = 200.0f;
if( time > 200.0f )
time = 200.0f;
gMobileEngfuncs->pfnVibrate( time, 0 );
}
}
}
return 1;
}
// Returns back a color from the
// Green <-> Yellow <-> Red ramp
void CHudHealth::GetPainColor( int &r, int &g, int &b )
{
int iHealth = m_iHealth;
if (iHealth > 25)
if( iHealth > 25 )
iHealth -= 25;
else if ( iHealth < 0 )
else if( iHealth < 0 )
iHealth = 0;
#if 0
g = iHealth * 255 / 100;
r = 255 - g;
b = 0;
#else
if (m_iHealth > 25)
if( m_iHealth > 25 )
{
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
}
@ -174,138 +173,134 @@ void CHudHealth::GetPainColor( int &r, int &g, int &b )
g = 0;
b = 0;
}
#endif
#endif
}
int CHudHealth::Draw(float flTime)
int CHudHealth::Draw( float flTime )
{
int r, g, b;
int a = 0, x, y;
int HealthWidth;
if ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) || gEngfuncs.IsSpectateOnly() )
if( ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH ) || gEngfuncs.IsSpectateOnly() )
return 1;
if ( !m_hSprite )
m_hSprite = LoadSprite(PAIN_NAME);
if( !m_hSprite )
m_hSprite = LoadSprite( PAIN_NAME );
// Has health changed? Flash the health #
if (m_fFade)
if( m_fFade )
{
m_fFade -= (gHUD.m_flTimeDelta * 20);
if (m_fFade <= 0)
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
if( m_fFade <= 0 )
{
a = MIN_ALPHA;
m_fFade = 0;
}
// Fade the health number back to dim
a = MIN_ALPHA + (m_fFade/FADE_TIME) * 128;
a = MIN_ALPHA + ( m_fFade / FADE_TIME ) * 128;
}
else
a = MIN_ALPHA;
// If health is getting low, make it bright red
if (m_iHealth <= 15)
if( m_iHealth <= 15 )
a = 255;
GetPainColor( r, g, b );
ScaleColors(r, g, b, a );
ScaleColors( r, g, b, a );
// Only draw health if we have the suit.
if (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)))
if( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) )
{
HealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;
int CrossWidth = gHUD.GetSpriteRect(m_HUD_cross).right - gHUD.GetSpriteRect(m_HUD_cross).left;
HealthWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
int CrossWidth = gHUD.GetSpriteRect( m_HUD_cross ).right - gHUD.GetSpriteRect( m_HUD_cross ).left;
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = CrossWidth /2;
x = CrossWidth / 2;
SPR_Set(gHUD.GetSprite(m_HUD_cross), r, g, b);
SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_cross));
SPR_Set( gHUD.GetSprite( m_HUD_cross ), r, g, b );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_cross ) );
x = CrossWidth + HealthWidth / 2;
x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b);
x = gHUD.DrawHudNumber( x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b );
x += HealthWidth/2;
x += HealthWidth / 2;
int iHeight = gHUD.m_iFontHeight;
int iWidth = HealthWidth/10;
int iWidth = HealthWidth / 10;
UnpackRGB(r,g,b, gHUD.m_iHUDColor); //LRC
//LRC FillRGBA(x, y, iWidth, iHeight, 255, 160, 0, a);
FillRGBA(x, y, iWidth, iHeight, r, g, b, a); //LRC
}
DrawDamage(flTime);
return DrawPain(flTime);
DrawDamage( flTime );
return DrawPain( flTime );
}
void CHudHealth::CalcDamageDirection(vec3_t vecFrom)
void CHudHealth::CalcDamageDirection( vec3_t vecFrom )
{
vec3_t forward, right, up;
float side, front;
vec3_t forward, right, up;
float side, front;
vec3_t vecOrigin, vecAngles;
if (!vecFrom[0] && !vecFrom[1] && !vecFrom[2])
if( !vecFrom[0] && !vecFrom[1] && !vecFrom[2] )
{
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 0;
return;
}
memcpy( vecOrigin, gHUD.m_vecOrigin, sizeof(vec3_t) );
memcpy( vecAngles, gHUD.m_vecAngles, sizeof(vec3_t) );
memcpy(vecOrigin, gHUD.m_vecOrigin, sizeof(vec3_t));
memcpy(vecAngles, gHUD.m_vecAngles, sizeof(vec3_t));
VectorSubtract (vecFrom, vecOrigin, vecFrom);
VectorSubtract( vecFrom, vecOrigin, vecFrom );
float flDistToTarget = vecFrom.Length();
vecFrom = vecFrom.Normalize();
AngleVectors (vecAngles, forward, right, up);
AngleVectors( vecAngles, forward, right, up );
front = DotProduct (vecFrom, right);
side = DotProduct (vecFrom, forward);
front = DotProduct( vecFrom, right );
side = DotProduct( vecFrom, forward );
if (flDistToTarget <= 50)
if( flDistToTarget <= 50 )
{
m_fAttackFront = m_fAttackRear = m_fAttackRight = m_fAttackLeft = 1;
}
else
{
if (side > 0)
if( side > 0 )
{
if (side > 0.3)
m_fAttackFront = max(m_fAttackFront, side);
if( side > 0.3 )
m_fAttackFront = max( m_fAttackFront, side );
}
else
{
float f = fabs(side);
if (f > 0.3)
m_fAttackRear = max(m_fAttackRear, f);
float f = fabs( side );
if( f > 0.3 )
m_fAttackRear = max( m_fAttackRear, f );
}
if (front > 0)
if( front > 0 )
{
if (front > 0.3)
m_fAttackRight = max(m_fAttackRight, front);
if( front > 0.3 )
m_fAttackRight = max( m_fAttackRight, front );
}
else
{
float f = fabs(front);
if (f > 0.3)
m_fAttackLeft = max(m_fAttackLeft, f);
float f = fabs( front );
if( f > 0.3 )
m_fAttackLeft = max( m_fAttackLeft, f );
}
}
}
int CHudHealth::DrawPain(float flTime)
int CHudHealth::DrawPain( float flTime )
{
if (!(m_fAttackFront || m_fAttackRear || m_fAttackLeft || m_fAttackRight))
if( !( m_fAttackFront || m_fAttackRear || m_fAttackLeft || m_fAttackRight) )
return 1;
int r, g, b;
@ -315,60 +310,62 @@ int CHudHealth::DrawPain(float flTime)
a = 255; // max brightness until then
float fFade = gHUD.m_flTimeDelta * 2;
// SPR_Draw top
if (m_fAttackFront > 0.4)
{
GetPainColor(r,g,b);
shade = a * max( m_fAttackFront, 0.5 );
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);
// SPR_Draw top
if( m_fAttackFront > 0.4 )
{
GetPainColor( r, g, b );
shade = a * max( m_fAttackFront, 0.5 );
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 );
} else
m_fAttackFront = 0;
if (m_fAttackRight > 0.4)
if( m_fAttackRight > 0.4 )
{
GetPainColor(r,g,b);
GetPainColor( r, g, b );
shade = a * max( m_fAttackRight, 0.5 );
ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b );
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);
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 );
} else
}
else
m_fAttackRight = 0;
if (m_fAttackRear > 0.4)
if( m_fAttackRear > 0.4 )
{
GetPainColor(r,g,b);
GetPainColor( r, g, b );
shade = a * max( m_fAttackRear, 0.5 );
ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b );
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);
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 );
} else
}
else
m_fAttackRear = 0;
if (m_fAttackLeft > 0.4)
if( m_fAttackLeft > 0.4 )
{
GetPainColor(r,g,b);
GetPainColor( r, g, b );
shade = a * max( m_fAttackLeft, 0.5 );
ScaleColors(r, g, b, shade);
SPR_Set(m_hSprite, r, g, b );
ScaleColors( r, g, b, shade );
SPR_Set( m_hSprite, r, g, b );
x = ScreenWidth/2 - SPR_Width(m_hSprite, 3) * 3;
y = ScreenHeight/2 - SPR_Height(m_hSprite,3)/2;
SPR_DrawAdditive(3, x, y, NULL);
x = ScreenWidth / 2 - SPR_Width( m_hSprite, 3 ) * 3;
y = ScreenHeight / 2 - SPR_Height( m_hSprite,3 ) / 2;
SPR_DrawAdditive( 3, x, y, NULL );
m_fAttackLeft = max( 0, m_fAttackLeft - fFade );
} else
@ -377,36 +374,34 @@ int CHudHealth::DrawPain(float flTime)
return 1;
}
int CHudHealth::DrawDamage(float flTime)
int CHudHealth::DrawDamage( float flTime )
{
int r, g, b, a;
int i;
int i, r, g, b, a;
DAMAGE_IMAGE *pdmg;
if (!m_bitsDamage)
if( !m_bitsDamage )
return 1;
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
a = (int)( fabs(sin(flTime*2)) * 256.0);
ScaleColors(r, g, b, a);
a = (int)( fabs( sin( flTime * 2 ) ) * 256.0 );
ScaleColors( r, g, b, a );
// check for bits that should be expired
for ( i = 0; i < NUM_DMG_TYPES; i++ )
for( i = 0; i < NUM_DMG_TYPES; i++ )
{
if ( m_bitsDamage & giDmgFlags[i] )
if( m_bitsDamage & giDmgFlags[i] )
{
pdmg = &m_dmg[i];
// Draw all the items
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));
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 );
if ( pdmg->fExpire <= flTime // when the time has expired
if( pdmg->fExpire <= flTime // when the time has expired
&& a < 40 ) // and the flash is at the low point of the cycle
{
pdmg->fExpire = 0;
@ -415,10 +410,10 @@ int CHudHealth::DrawDamage(float flTime)
pdmg->x = pdmg->y = 0;
// move everyone above down
for (int j = 0; j < NUM_DMG_TYPES; j++)
for( int j = 0; j < NUM_DMG_TYPES; j++ )
{
pdmg = &m_dmg[j];
if ((pdmg->y) && (pdmg->y < y))
if( ( pdmg->y ) && ( pdmg->y < y ) )
pdmg->y += giDmgHeight;
}
@ -430,49 +425,47 @@ int CHudHealth::DrawDamage(float flTime)
return 1;
}
void CHudHealth::UpdateTiles(float flTime, long bitsDamage)
void CHudHealth::UpdateTiles( float flTime, long bitsDamage )
{
DAMAGE_IMAGE *pdmg;
// Which types are new?
long bitsOn = ~m_bitsDamage & bitsDamage;
for (int i = 0; i < NUM_DMG_TYPES; i++)
for( int i = 0; i < NUM_DMG_TYPES; i++ )
{
pdmg = &m_dmg[i];
// Is this one already on?
if (m_bitsDamage & giDmgFlags[i])
if( m_bitsDamage & giDmgFlags[i] )
{
pdmg->fExpire = flTime + DMG_IMAGE_LIFE; // extend the duration
if (!pdmg->fBaseline)
if( !pdmg->fBaseline )
pdmg->fBaseline = flTime;
}
// Are we just turning it on?
if (bitsOn & giDmgFlags[i])
if( bitsOn & giDmgFlags[i] )
{
// put this one at the bottom
pdmg->x = giDmgWidth/8;
pdmg->x = giDmgWidth / 8;
pdmg->y = ScreenHeight - giDmgHeight * 2;
pdmg->fExpire=flTime + DMG_IMAGE_LIFE;
// move everyone else up
for (int j = 0; j < NUM_DMG_TYPES; j++)
for( int j = 0; j < NUM_DMG_TYPES; j++ )
{
if (j == i)
if( j == i )
continue;
pdmg = &m_dmg[j];
if (pdmg->y)
if( pdmg->y )
pdmg->y -= giDmgHeight;
}
pdmg = &m_dmg[i];
}
}
}
}
// damage bits are only turned on here; they are turned off when the draw time has expired (in DrawDamage())
m_bitsDamage |= bitsDamage;

View File

@ -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
@ -23,6 +26,7 @@
#define DMG_IMAGE_NERVE 5
#define DMG_IMAGE_RAD 6
#define DMG_IMAGE_SHOCK 7
//tf defines
#define DMG_IMAGE_CALTROP 8
#define DMG_IMAGE_TRANQ 9
@ -46,12 +50,10 @@
#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death.
// time-based damage
//mask off TF-specific stuff too
#define DMG_TIMEBASED (~(0xff003fff)) // mask for time-based damage
#define DMG_DROWN (1 << 14) // Drowning
#define DMG_FIRSTTIMEBASED DMG_DROWN
@ -78,35 +80,33 @@
// TF Healing Additions for TakeHealth
#define DMG_IGNORE_MAXHEALTH DMG_IGNITE
// TF Redefines since we never use the originals
#define DMG_NAIL DMG_SLASH
#define DMG_NOT_SELF DMG_FREEZE
#define DMG_TRANQ DMG_MORTAR
#define DMG_CONCUSS DMG_SONIC
typedef struct
{
float fExpire;
float fBaseline;
int x, y;
} DAMAGE_IMAGE;
}DAMAGE_IMAGE;
//
//-----------------------------------------------------
//
class CHudHealth: public CHudBase
class CHudHealth : public CHudBase
{
public:
virtual int Init( void );
virtual int VidInit( void );
virtual int Draw(float fTime);
virtual int Draw( float fTime );
virtual void Reset( void );
int MsgFunc_Health(const char *pszName, int iSize, void *pbuf);
int MsgFunc_Damage(const char *pszName, int iSize, void *pbuf);
int MsgFunc_Health( const char *pszName, int iSize, void *pbuf );
int MsgFunc_Damage( const char *pszName, int iSize, void *pbuf );
int m_iHealth;
int m_HUD_dmg_bio;
int m_HUD_cross;
@ -119,9 +119,10 @@ private:
HSPRITE m_hDamage;
DAMAGE_IMAGE m_dmg[NUM_DMG_TYPES];
int m_bitsDamage;
int DrawPain(float fTime);
int DrawDamage(float fTime);
void CalcDamageDirection(vec3_t vecFrom);
void UpdateTiles(float fTime, long bits);
};
int m_bitsDamage;
int DrawPain( float fTime );
int DrawDamage( float fTime );
void CalcDamageDirection( vec3_t vecFrom );
void UpdateTiles( float fTime, long bits );
};
#endif // HEALTH_H

View File

@ -21,6 +21,7 @@ This file contains "stubs" of class member implementations so that we can predic
add in the functionality you need.
==========================
*/
#include "extdll.h"
#include "util.h"
#include "cbase.h"
@ -34,26 +35,27 @@ This file contains "stubs" of class member implementations so that we can predic
const Vector g_vecZero = Vector( 0, 0, 0 );
int gmsgWeapPickup = 0;
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
globalvars_t *gpGlobals;
ItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS];
void EMIT_SOUND_DYN(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch) { }
void EMIT_SOUND_DYN( edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch ) { }
// CBaseEntity Stubs
int CBaseEntity :: TakeHealth( float flHealth, int bitsDamageType ) { return 1; }
int CBaseEntity :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType ) { return 1; }
int CBaseEntity::TakeHealth( float flHealth, int bitsDamageType ) { return 1; }
int CBaseEntity::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 1; }
CBaseEntity *CBaseEntity::GetNextTarget( void ) { return NULL; }
int CBaseEntity::Save( CSave &save ) { return 1; }
int CBaseEntity::Restore( CRestore &restore ) { return 1; }
void CBaseEntity::SetObjectCollisionBox( void ) { }
int CBaseEntity :: Intersects( CBaseEntity *pOther ) { return 0; }
void CBaseEntity :: MakeDormant( void ) { }
int CBaseEntity :: IsDormant( void ) { return 0; }
BOOL CBaseEntity :: IsInWorld( void ) { return TRUE; }
int CBaseEntity::Intersects( CBaseEntity *pOther ) { return 0; }
void CBaseEntity::MakeDormant( void ) { }
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; }
int CBaseEntity::DamageDecal( int bitsDamageType ) { return -1; }
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 ) { }
void CBaseEntity::Activate( void ) { } //LRC
void CBaseEntity::InitMoveWith( void ) { } //LRC
@ -62,7 +64,7 @@ void CBaseEntity::AbsoluteNextThink( float time, BOOL correctSpeed ) { }//LRC
void CBaseEntity::ThinkCorrection( ) { }//LRC
// CBaseDelay Stubs
void CBaseDelay :: KeyValue( struct KeyValueData_s * ) { }
void CBaseDelay::KeyValue( struct KeyValueData_s * ) { }
int CBaseDelay::Restore( class CRestore & ) { return 1; }
int CBaseDelay::Save( class CSave & ) { return 1; }
@ -72,7 +74,7 @@ int CBaseAnimating::Save( class CSave & ) { return 1; }
// DEBUG Stubs
edict_t *DBG_EntOfVars( const entvars_t *pev ) { return NULL; }
void DBG_AssertFunction(BOOL fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage) { }
void DBG_AssertFunction( BOOL fExpr, const char *szExpr, const char *szFile, int szLine, const char *szMessage) { }
// UTIL_* Stubs
void UTIL_PrecacheOther( const char *szClassname ) { }
@ -90,7 +92,7 @@ void ClientPrint( entvars_t *client, int msg_dest, const char *msg_name, const c
// CBaseToggle Stubs
int CBaseToggle::Restore( class CRestore & ) { return 1; }
int CBaseToggle::Save( class CSave & ) { return 1; }
void CBaseToggle :: KeyValue( struct KeyValueData_s * ) { }
void CBaseToggle::KeyValue( struct KeyValueData_s * ) { }
STATE CBaseToggle::GetState( void ) { return STATE_ON; } //LRC
// CGrenade Stubs
@ -99,12 +101,12 @@ void CGrenade::Explode( Vector, Vector ) { }
void CGrenade::Explode( TraceResult *, int ) { }
void CGrenade::Killed( entvars_t *, int ) { }
void CGrenade::Spawn( void ) { }
CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ){ return 0; }
CGrenade *CGrenade::ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time ){ return 0; }
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity ){ return 0; }
void CGrenade::DetonateUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ){ }
void UTIL_Remove( CBaseEntity *pEntity ){ }
struct skilldata_t gSkillData;
struct skilldata_t gSkillData;
void UTIL_SetSize( entvars_t *pev, const Vector &vecMin, const Vector &vecMax ){ }
CBaseEntity *UTIL_FindEntityInSphere( CBaseEntity *pStartEntity, const Vector &vecCenter, float flRadius ){ return 0;}
@ -114,140 +116,139 @@ void CBeam::PointEntInit( const Vector &start, int endIndex ) { }
CBeam *CBeam::BeamCreate( const char *pSpriteName, int width ) { return NULL; }
void CSprite::Expand( float scaleSpeed, float fadeSpeed ) { }
CBaseEntity* CBaseMonster :: CheckTraceHullAttack( float flDist, int iDamage, int iDmgType ) { return NULL; }
void CBaseMonster :: Eat ( float flFullDuration ) { }
BOOL CBaseMonster :: FShouldEat ( void ) { return TRUE; }
void CBaseMonster :: BarnacleVictimBitten ( entvars_t *pevBarnacle ) { }
void CBaseMonster :: BarnacleVictimReleased ( void ) { }
void CBaseMonster :: Listen ( void ) { }
float CBaseMonster :: FLSoundVolume ( CSound *pSound ) { return 0.0; }
BOOL CBaseMonster :: FValidateHintType ( short sHint ) { return FALSE; }
void CBaseMonster :: Look ( int iDistance ) { }
int CBaseMonster :: ISoundMask ( void ) { return 0; }
CSound* CBaseMonster :: PBestSound ( void ) { return NULL; }
CSound* CBaseMonster :: PBestScent ( void ) { return NULL; }
float CBaseAnimating :: StudioFrameAdvance ( float flInterval ) { return 0.0; }
void CBaseMonster :: MonsterThink ( void ) { }
void CBaseMonster :: MonsterUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { }
int CBaseMonster :: IgnoreConditions ( void ) { return 0; }
void CBaseMonster :: RouteClear ( void ) { }
void CBaseMonster :: RouteNew ( void ) { }
BOOL CBaseMonster :: FRouteClear ( void ) { return FALSE; }
BOOL CBaseMonster :: FRefreshRoute ( void ) { return 0; }
CBaseEntity* CBaseMonster::CheckTraceHullAttack( float flDist, int iDamage, int iDmgType ) { return NULL; }
void CBaseMonster::Eat( float flFullDuration ) { }
BOOL CBaseMonster::FShouldEat( void ) { return TRUE; }
void CBaseMonster::BarnacleVictimBitten( entvars_t *pevBarnacle ) { }
void CBaseMonster::BarnacleVictimReleased( void ) { }
void CBaseMonster::Listen( void ) { }
float CBaseMonster::FLSoundVolume( CSound *pSound ) { return 0.0; }
BOOL CBaseMonster::FValidateHintType( short sHint ) { return FALSE; }
void CBaseMonster::Look( int iDistance ) { }
int CBaseMonster::ISoundMask( void ) { return 0; }
CSound *CBaseMonster::PBestSound( void ) { return NULL; }
CSound *CBaseMonster::PBestScent( void ) { return NULL; }
float CBaseAnimating::StudioFrameAdvance( float flInterval ) { return 0.0; }
void CBaseMonster::MonsterThink( void ) { }
void CBaseMonster::MonsterUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { }
int CBaseMonster::IgnoreConditions( void ) { return 0; }
void CBaseMonster::RouteClear( void ) { }
void CBaseMonster::RouteNew( void ) { }
BOOL CBaseMonster::FRouteClear( void ) { return FALSE; }
BOOL CBaseMonster::FRefreshRoute( void ) { return 0; }
BOOL CBaseMonster::MoveToEnemy( Activity movementAct, float waitTime ) { return FALSE; }
BOOL CBaseMonster::MoveToLocation( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; }
BOOL CBaseMonster::MoveToTarget( Activity movementAct, float waitTime ) { return FALSE; }
BOOL CBaseMonster::MoveToNode( Activity movementAct, float waitTime, const Vector &goal ) { return FALSE; }
int ShouldSimplify( int routeType ) { return TRUE; }
void CBaseMonster :: RouteSimplify( CBaseEntity *pTargetEnt ) { }
BOOL CBaseMonster :: FBecomeProne ( void ) { return TRUE; }
BOOL CBaseMonster :: CheckRangeAttack1 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckRangeAttack2 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckMeleeAttack1 ( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster :: CheckMeleeAttack2 ( float flDot, float flDist ) { return FALSE; }
void CBaseMonster :: CheckAttacks ( CBaseEntity *pTarget, float flDist ) { }
BOOL CBaseMonster :: FCanCheckAttacks ( void ) { return FALSE; }
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 ) { }
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 ) { }
int CBaseMonster :: RouteClassify( int iMoveFlag ) { return 0; }
BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEntity *pTarget ) { return FALSE; }
void CBaseMonster :: InsertWaypoint ( Vector vecLocation, int afMoveFlags ) { }
BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEnd, float flDist, CBaseEntity *pTargetEnt, Vector *pApex ) { return FALSE; }
void CBaseMonster :: Move ( float flInterval ) { }
BOOL CBaseMonster:: ShouldAdvanceRoute( float flWaypointDist ) { return FALSE; }
void CBaseMonster::RouteSimplify( CBaseEntity *pTargetEnt ) { }
BOOL CBaseMonster::FBecomeProne( void ) { return TRUE; }
BOOL CBaseMonster::CheckRangeAttack1( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster::CheckRangeAttack2( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster::CheckMeleeAttack1( float flDot, float flDist ) { return FALSE; }
BOOL CBaseMonster::CheckMeleeAttack2( float flDot, float flDist ) { return FALSE; }
void CBaseMonster::CheckAttacks( CBaseEntity *pTarget, float flDist ) { }
BOOL CBaseMonster::FCanCheckAttacks( void ) { return FALSE; }
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( 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 ) { }
int CBaseMonster::RouteClassify( int iMoveFlag ) { return 0; }
BOOL CBaseMonster::BuildRoute( const Vector &vecGoal, int iMoveFlag, CBaseEntity *pTarget ) { return FALSE; }
void CBaseMonster::InsertWaypoint( Vector vecLocation, int afMoveFlags ) { }
BOOL CBaseMonster::FTriangulate( const Vector &vecStart , const Vector &vecEnd, float flDist, CBaseEntity *pTargetEnt, Vector *pApex ) { return FALSE; }
void CBaseMonster::Move( float flInterval ) { }
BOOL CBaseMonster::ShouldAdvanceRoute( float flWaypointDist ) { return FALSE; }
void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, float flInterval ) { }
void CBaseMonster :: MonsterInit ( void ) { }
void CBaseMonster :: MonsterInitThink ( void ) { }
void CBaseMonster :: StartMonster ( void ) { }
void CBaseMonster :: MovementComplete( void ) { }
void CBaseMonster::MonsterInit( void ) { }
void CBaseMonster::MonsterInitThink( void ) { }
void CBaseMonster::StartMonster( void ) { }
void CBaseMonster::MovementComplete( void ) { }
int CBaseMonster::TaskIsRunning( void ) { return 0; }
int CBaseMonster::IRelationship ( CBaseEntity *pTarget ) { return 0; }
BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
BOOL CBaseMonster :: BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
CBaseEntity *CBaseMonster :: BestVisibleEnemy ( void ) { return NULL; }
BOOL CBaseMonster :: FInViewCone ( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseMonster :: FInViewCone ( Vector *pOrigin ) { return FALSE; }
BOOL CBaseEntity :: FVisible ( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseEntity :: FVisible ( const Vector &vecOrigin ) { return FALSE; }
void CBaseMonster :: MakeIdealYaw( Vector vecTarget ) { }
float CBaseMonster::FlYawDiff ( void ) { return 0.0; }
float CBaseMonster::ChangeYaw ( int yawSpeed ) { return 0; }
float CBaseMonster::VecToYaw ( Vector vecDir ) { return 0.0; }
int CBaseAnimating :: LookupActivity ( int activity ) { return 0; }
int CBaseAnimating :: LookupActivityHeaviest ( int activity ) { return 0; }
void CBaseMonster :: SetEyePosition ( void ) { }
int CBaseAnimating :: LookupSequence ( const char *label ) { return 0; }
void CBaseAnimating :: ResetSequenceInfo ( ) { }
BOOL CBaseAnimating :: GetSequenceFlags( ) { return FALSE; }
void CBaseAnimating :: DispatchAnimEvents ( float flInterval ) { }
void CBaseMonster :: HandleAnimEvent( MonsterEvent_t *pEvent ) { }
float CBaseAnimating :: SetBoneController ( int iController, float flValue ) { return 0.0; }
void CBaseAnimating :: InitBoneControllers ( void ) { }
float CBaseAnimating :: SetBlending ( int iBlender, float flValue ) { return 0; }
void CBaseAnimating :: GetBonePosition ( int iBone, Vector &origin, Vector &angles ) { }
void CBaseAnimating :: GetAttachment ( int iAttachment, Vector &origin, Vector &angles ) { }
int CBaseAnimating :: FindTransition( int iEndingSequence, int iGoalSequence, int *piDir ) { return -1; }
void CBaseAnimating :: GetAutomovement( Vector &origin, Vector &angles, float flInterval ) { }
void CBaseAnimating :: SetBodygroup( int iGroup, int iValue ) { }
int CBaseAnimating :: GetBodygroup( int iGroup ) { return 0; }
Vector CBaseMonster :: GetGunPosition( void ) { return g_vecZero; }
void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker ) { }
void CBaseEntity :: TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ) { }
void CBaseMonster :: MakeDamageBloodDecal ( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir ) { }
BOOL CBaseMonster :: FGetNodeRoute ( Vector vecDest ) { return TRUE; }
int CBaseMonster :: FindHintNode ( void ) { return NO_NODE; }
int CBaseMonster::IRelationship( CBaseEntity *pTarget ) { return 0; }
BOOL CBaseMonster::FindCover( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
BOOL CBaseMonster::BuildNearestRoute( Vector vecThreat, Vector vecViewOffset, float flMinDist, float flMaxDist ) { return FALSE; }
CBaseEntity *CBaseMonster::BestVisibleEnemy( void ) { return NULL; }
BOOL CBaseMonster::FInViewCone( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseMonster::FInViewCone( Vector *pOrigin ) { return FALSE; }
BOOL CBaseEntity::FVisible( CBaseEntity *pEntity ) { return FALSE; }
BOOL CBaseEntity::FVisible( const Vector &vecOrigin ) { return FALSE; }
void CBaseMonster::MakeIdealYaw( Vector vecTarget ) { }
float CBaseMonster::FlYawDiff( void ) { return 0.0; }
float CBaseMonster::ChangeYaw( int yawSpeed ) { return 0; }
float CBaseMonster::VecToYaw( Vector vecDir ) { return 0.0; }
int CBaseAnimating::LookupActivity( int activity ) { return 0; }
int CBaseAnimating::LookupActivityHeaviest( int activity ) { return 0; }
void CBaseMonster::SetEyePosition( void ) { }
int CBaseAnimating::LookupSequence( const char *label ) { return 0; }
void CBaseAnimating::ResetSequenceInfo() { }
BOOL CBaseAnimating::GetSequenceFlags() { return FALSE; }
void CBaseAnimating::DispatchAnimEvents( float flInterval ) { }
void CBaseMonster::HandleAnimEvent( MonsterEvent_t *pEvent ) { }
float CBaseAnimating::SetBoneController ( int iController, float flValue ) { return 0.0; }
void CBaseAnimating::InitBoneControllers ( void ) { }
float CBaseAnimating::SetBlending( int iBlender, float flValue ) { return 0; }
void CBaseAnimating::GetBonePosition( int iBone, Vector &origin, Vector &angles ) { }
void CBaseAnimating::GetAttachment( int iAttachment, Vector &origin, Vector &angles ) { }
int CBaseAnimating::FindTransition( int iEndingSequence, int iGoalSequence, int *piDir ) { return -1; }
void CBaseAnimating::GetAutomovement( Vector &origin, Vector &angles, float flInterval ) { }
void CBaseAnimating::SetBodygroup( int iGroup, int iValue ) { }
int CBaseAnimating::GetBodygroup( int iGroup ) { return 0; }
Vector CBaseMonster::GetGunPosition( void ) { return g_vecZero; }
void CBaseEntity::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ) { }
void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShooting, Vector vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker ) { }
void CBaseEntity::TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ) { }
void CBaseMonster::MakeDamageBloodDecal( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir ) { }
BOOL CBaseMonster::FGetNodeRoute( Vector vecDest ) { return TRUE; }
int CBaseMonster::FindHintNode( void ) { return NO_NODE; }
void CBaseMonster::ReportAIState( void ) { }
void CBaseMonster :: KeyValue( KeyValueData *pkvd ) { }
BOOL CBaseMonster :: FCheckAITrigger ( void ) { return FALSE; }
void CBaseMonster::KeyValue( KeyValueData *pkvd ) { }
BOOL CBaseMonster::FCheckAITrigger( void ) { return FALSE; }
int CBaseMonster :: CanPlaySequence( int interruptLevel ) { return FALSE; } //LRC - prototype changed
BOOL CBaseMonster :: FindLateralCover ( const Vector &vecThreat, const Vector &vecViewOffset ) { return FALSE; }
Vector CBaseMonster :: ShootAtEnemy( const Vector &shootOrigin ) { return g_vecZero; }
BOOL CBaseMonster :: FacingIdeal( void ) { return FALSE; }
BOOL CBaseMonster :: FCanActiveIdle ( void ) { return FALSE; }
BOOL CBaseMonster::FindLateralCover( const Vector &vecThreat, const Vector &vecViewOffset ) { return FALSE; }
Vector CBaseMonster::ShootAtEnemy( const Vector &shootOrigin ) { return g_vecZero; }
BOOL CBaseMonster::FacingIdeal( void ) { return FALSE; }
BOOL CBaseMonster::FCanActiveIdle( void ) { return FALSE; }
void CBaseMonster::PlaySentence( const char *pszSentence, float duration, float volume, float attenuation ) { }
void CBaseMonster::PlayScriptedSentence( const char *pszSentence, float duration, float volume, float attenuation, BOOL bConcurrent, CBaseEntity *pListener ) { }
void CBaseMonster::SentenceStop( void ) { }
void CBaseMonster::CorpseFallThink( void ) { }
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; }
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 ) { }
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( 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 ) { }
void CBaseMonster::FadeMonster( void ) { }
void CBaseMonster :: GibMonster( void ) { }
BOOL CBaseMonster :: HasHumanGibs( void ) { return FALSE; }
BOOL CBaseMonster :: HasAlienGibs( void ) { return FALSE; }
Activity CBaseMonster :: GetDeathActivity ( void ) { return ACT_DIE_HEADSHOT; }
MONSTERSTATE CBaseMonster :: GetIdealState ( void ) { return MONSTERSTATE_ALERT; }
Schedule_t* CBaseMonster :: GetScheduleOfType ( int Type ) { return NULL; }
Schedule_t *CBaseMonster :: GetSchedule ( void ) { return NULL; }
void CBaseMonster :: RunTask ( Task_t *pTask ) { }
void CBaseMonster :: StartTask ( Task_t *pTask ) { }
void CBaseMonster::GibMonster( void ) { }
BOOL CBaseMonster::HasHumanGibs( void ) { return FALSE; }
BOOL CBaseMonster::HasAlienGibs( void ) { return FALSE; }
Activity CBaseMonster::GetDeathActivity( void ) { return ACT_DIE_HEADSHOT; }
MONSTERSTATE CBaseMonster::GetIdealState( void ) { return MONSTERSTATE_ALERT; }
Schedule_t* CBaseMonster::GetScheduleOfType( int Type ) { return NULL; }
Schedule_t *CBaseMonster::GetSchedule( void ) { return NULL; }
void CBaseMonster::RunTask( Task_t *pTask ) { }
void CBaseMonster::StartTask( Task_t *pTask ) { }
Schedule_t *CBaseMonster::ScheduleFromName( const char *pName ) { return NULL;}
void CBaseMonster::BecomeDead( void ) {}
void CBaseMonster :: RunAI ( void ) {}
void CBaseMonster :: Killed( entvars_t *pevAttacker, int iGib ) {}
int CBaseMonster :: TakeHealth (float flHealth, int bitsDamageType) { return 0; }
int CBaseMonster :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
void CBaseMonster::RunAI( void ) {}
void CBaseMonster::Killed( entvars_t *pevAttacker, int iGib ) {}
int CBaseMonster::TakeHealth(float flHealth, int bitsDamageType) { return 0; }
int CBaseMonster::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
int CBaseMonster::Restore( class CRestore & ) { return 1; }
int CBaseMonster::Save( class CSave & ) { return 1; }
int TrainSpeed(int iSpeed, int iMax) { return 0; }
void CBasePlayer :: DeathSound( void ) { }
int CBasePlayer :: TakeHealth( float flHealth, int bitsDamageType ) { return 0; }
void CBasePlayer :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
int CBasePlayer :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
int TrainSpeed( int iSpeed, int iMax ) { return 0; }
void CBasePlayer::DeathSound( void ) { }
int CBasePlayer::TakeHealth( float flHealth, int bitsDamageType ) { return 0; }
void CBasePlayer::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) { }
int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { return 0; }
void CBasePlayer::PackDeadPlayerItems( void ) { }
void CBasePlayer::RemoveAllItems( BOOL removeSuit ) { }
void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim ) { }
@ -256,77 +257,78 @@ BOOL CBasePlayer::IsOnLadder( void ) { return FALSE; }
void CBasePlayer::PlayerDeathThink(void) { }
void CBasePlayer::StartDeathCam( void ) { }
void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) { }
void CBasePlayer::PlayerUse ( void ) { }
void CBasePlayer::PlayerUse( void ) { }
void CBasePlayer::Jump() { }
void CBasePlayer::Duck( ) { }
int CBasePlayer::Classify ( void ) { return 0; }
void CBasePlayer::Duck() { }
int CBasePlayer::Classify( void ) { return 0; }
void CBasePlayer::PreThink(void) { }
void CBasePlayer::CheckTimeBasedDamage() { }
void CBasePlayer :: UpdateGeigerCounter( void ) { }
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 ) { }
void CBasePlayer::Precache( void ) { }
int CBasePlayer::Save( CSave &save ) { return 0; }
void CBasePlayer::RenewItems(void) { }
void CBasePlayer::RenewItems( void ) { }
int CBasePlayer::Restore( CRestore &restore ) { return 0; }
void CBasePlayer::SelectNextItem( int iItem ) { }
BOOL CBasePlayer::HasWeapons( void ) { return FALSE; }
void CBasePlayer::SelectPrevItem( int iItem ) { }
CBaseEntity *FindEntityForward( CBaseEntity *pMe ) { return NULL; }
BOOL CBasePlayer :: FlashlightIsOn( void ) { return FALSE; }
void CBasePlayer :: FlashlightTurnOn( void ) { }
void CBasePlayer :: FlashlightTurnOff( void ) { }
void CBasePlayer :: ForceClientDllUpdate( void ) { }
void CBasePlayer::ImpulseCommands( ) { }
BOOL CBasePlayer::FlashlightIsOn( void ) { return FALSE; }
void CBasePlayer::FlashlightTurnOn( void ) { }
void CBasePlayer::FlashlightTurnOff( void ) { }
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; }
int CBasePlayer::GetAmmoIndex(const char *psz) { return -1; }
int CBasePlayer::GetAmmoIndex( const char *psz ) { return -1; }
void CBasePlayer::SendAmmoUpdate(void) { }
void CBasePlayer :: UpdateClientData( void ) { }
BOOL CBasePlayer :: FBecomeProne ( void ) { return TRUE; }
void CBasePlayer :: BarnacleVictimBitten ( entvars_t *pevBarnacle ) { }
void CBasePlayer :: BarnacleVictimReleased ( void ) { }
int CBasePlayer :: Illumination( void ) { return 0; }
void CBasePlayer :: EnableControl(BOOL fControl) { }
Vector CBasePlayer :: GetAutoaimVector( float flDelta ) { return g_vecZero; }
Vector CBasePlayer :: AutoaimDeflection( Vector &vecSrc, float flDist, float flDelta ) { return g_vecZero; }
void CBasePlayer :: ResetAutoaim( ) { }
void CBasePlayer :: SetCustomDecalFrames( int nFrames ) { }
int CBasePlayer :: GetCustomDecalFrames( void ) { return -1; }
void CBasePlayer::DropPlayerItem ( char *pszItemName ) { }
void CBasePlayer::UpdateClientData( void ) { }
BOOL CBasePlayer::FBecomeProne( void ) { return TRUE; }
void CBasePlayer::BarnacleVictimBitten( entvars_t *pevBarnacle ) { }
void CBasePlayer::BarnacleVictimReleased( void ) { }
int CBasePlayer::Illumination( void ) { return 0; }
void CBasePlayer::EnableControl( BOOL fControl ) { }
Vector CBasePlayer::GetAutoaimVector( float flDelta ) { return g_vecZero; }
Vector CBasePlayer::AutoaimDeflection( Vector &vecSrc, float flDist, float flDelta ) { return g_vecZero; }
void CBasePlayer::ResetAutoaim() { }
void CBasePlayer::SetCustomDecalFrames( int nFrames ) { }
int CBasePlayer::GetCustomDecalFrames( void ) { return -1; }
void CBasePlayer::DropPlayerItem( char *pszItemName ) { }
BOOL CBasePlayer::HasPlayerItem( CBasePlayerItem *pCheckItem ) { return FALSE; }
BOOL CBasePlayer :: SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; }
Vector CBasePlayer :: GetGunPosition( void ) { return g_vecZero; }
BOOL CBasePlayer::SwitchWeapon( CBasePlayerItem *pWeapon ) { return FALSE; }
Vector CBasePlayer::GetGunPosition( void ) { return g_vecZero; }
const char *CBasePlayer::TeamID( void ) { return ""; }
int CBasePlayer :: GiveAmmo( int iCount, char *szName, int iMax ) { return 0; }
int CBasePlayer::GiveAmmo( int iCount, const char *szName, int iMax ) { return 0; }
void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore ) { }
void CBasePlayer::AddPointsToTeam( int score, BOOL bAllowNegativeScore ) { }
void ClearMultiDamage(void) { }
void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker ) { }
void ClearMultiDamage( void ) { }
void ApplyMultiDamage( entvars_t *pevInflictor, entvars_t *pevAttacker ) { }
void AddMultiDamage( entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType) { }
void SpawnBlood(Vector vecSpot, int bloodColor, float flDamage) { }
void SpawnBlood( Vector vecSpot, int bloodColor, float flDamage ) { }
int DamageDecal( CBaseEntity *pEntity, int bitsDamageType ) { return 0; }
void DecalGunshot( TraceResult *pTrace, int iBulletType ) { }
void EjectBrass ( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype ) { }
void EjectBrass( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype ) { }
void AddAmmoNameToAmmoRegistry( const char *szAmmoname ) { }
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; }
void CBasePlayerItem :: SetObjectCollisionBox( void ) { }
void CBasePlayerItem :: FallInit( void ) { }
void CBasePlayerItem::FallThink ( void ) { }
float CBasePlayerWeapon::GetNextAttackDelay( float flTime ) { return flTime; }
void CBasePlayerItem::SetObjectCollisionBox( void ) { }
void CBasePlayerItem::FallInit( void ) { }
void CBasePlayerItem::FallThink( void ) { }
void CBasePlayerItem::Materialize( void ) { }
void CBasePlayerItem::AttemptToMaterialize( void ) { }
void CBasePlayerItem :: CheckRespawn ( void ) { }
CBaseEntity* CBasePlayerItem::Respawn( void ) { return NULL; }
void CBasePlayerItem::CheckRespawn( void ) { }
CBaseEntity *CBasePlayerItem::Respawn( void ) { return NULL; }
void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) { }
void CBasePlayerItem::DestroyItem( void ) { }
int CBasePlayerItem::AddToPlayer( CBasePlayer *pPlayer ) { return TRUE; }
@ -337,17 +339,17 @@ void CBasePlayerItem::AttachToPlayer ( CBasePlayer *pPlayer ) { }
int CBasePlayerWeapon::AddDuplicate( CBasePlayerItem *pOriginal ) { return 0; }
int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer ) { return FALSE; }
int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) { return 0; }
BOOL CBasePlayerWeapon :: AddPrimaryAmmo( int iCount, char *szName, int iMaxClip, int iMaxCarry ) { return TRUE; }
BOOL CBasePlayerWeapon :: AddSecondaryAmmo( int iCount, char *szName, int iMax ) { return TRUE; }
BOOL CBasePlayerWeapon :: IsUseable( void ) { return TRUE; }
BOOL CBasePlayerWeapon::AddPrimaryAmmo( int iCount, char *szName, int iMaxClip, int iMaxCarry ) { return TRUE; }
BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, char *szName, int iMax ) { return TRUE; }
BOOL CBasePlayerWeapon::IsUseable( void ) { return TRUE; }
int CBasePlayerWeapon::PrimaryAmmoIndex( void ) { return -1; }
int CBasePlayerWeapon::SecondaryAmmoIndex( void ) { return -1; }
int CBasePlayerWeapon::SecondaryAmmoIndex( void ) { return -1; }
void CBasePlayerAmmo::Spawn( void ) { }
CBaseEntity* CBasePlayerAmmo::Respawn( void ) { return this; }
void CBasePlayerAmmo::Materialize( void ) { }
void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther ) { }
void CBasePlayerAmmo::DefaultTouch( CBaseEntity *pOther ) { }
int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon ) { return 0; }
int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon ) { return 0; }
void CBasePlayerWeapon::RetireWeapon( void ) { }
void CSoundEnt::InsertSound ( int iType, const Vector &vecOrigin, int iVolume, float flDuration ) {}
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 ){}

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "../hud.h"
#include "../cl_util.h"
#include "event_api.h"
@ -38,8 +39,6 @@ void EV_HornetGunFire( struct event_args_s *args );
void EV_TripmineFire( struct event_args_s *args );
void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args );
}
@ -58,23 +57,23 @@ That was what we were going to do, but we ran out of time...oh well.
*/
void Game_HookEvents( void )
{
gEngfuncs.pfnHookEvent( "events/glock1.sc", EV_FireGlock1 );
gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 );
gEngfuncs.pfnHookEvent( "events/shotgun1.sc", EV_FireShotGunSingle );
gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble );
gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 );
gEngfuncs.pfnHookEvent( "events/mp52.sc", EV_FireMP52 );
gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython );
gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss );
gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss );
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust );
gEngfuncs.pfnHookEvent( "events/crowbar.sc", EV_Crowbar );
gEngfuncs.pfnHookEvent( "events/crossbow1.sc", EV_FireCrossbow );
gEngfuncs.pfnHookEvent( "events/crossbow2.sc", EV_FireCrossbow2 );
gEngfuncs.pfnHookEvent( "events/rpg.sc", EV_FireRpg );
gEngfuncs.pfnHookEvent( "events/egon_fire.sc", EV_EgonFire );
gEngfuncs.pfnHookEvent( "events/egon_stop.sc", EV_EgonStop );
gEngfuncs.pfnHookEvent( "events/firehornet.sc", EV_HornetGunFire );
gEngfuncs.pfnHookEvent( "events/tripfire.sc", EV_TripmineFire );
gEngfuncs.pfnHookEvent( "events/snarkfire.sc", EV_SnarkFire );
gEngfuncs.pfnHookEvent( "events/glock1.sc", EV_FireGlock1 );
gEngfuncs.pfnHookEvent( "events/glock2.sc", EV_FireGlock2 );
gEngfuncs.pfnHookEvent( "events/shotgun1.sc", EV_FireShotGunSingle );
gEngfuncs.pfnHookEvent( "events/shotgun2.sc", EV_FireShotGunDouble );
gEngfuncs.pfnHookEvent( "events/mp5.sc", EV_FireMP5 );
gEngfuncs.pfnHookEvent( "events/mp52.sc", EV_FireMP52 );
gEngfuncs.pfnHookEvent( "events/python.sc", EV_FirePython );
gEngfuncs.pfnHookEvent( "events/gauss.sc", EV_FireGauss );
gEngfuncs.pfnHookEvent( "events/gaussspin.sc", EV_SpinGauss );
gEngfuncs.pfnHookEvent( "events/train.sc", EV_TrainPitchAdjust );
gEngfuncs.pfnHookEvent( "events/crowbar.sc", EV_Crowbar );
gEngfuncs.pfnHookEvent( "events/crossbow1.sc", EV_FireCrossbow );
gEngfuncs.pfnHookEvent( "events/crossbow2.sc", EV_FireCrossbow2 );
gEngfuncs.pfnHookEvent( "events/rpg.sc", EV_FireRpg );
gEngfuncs.pfnHookEvent( "events/egon_fire.sc", EV_EgonFire );
gEngfuncs.pfnHookEvent( "events/egon_stop.sc", EV_EgonStop );
gEngfuncs.pfnHookEvent( "events/firehornet.sc", EV_HornetGunFire );
gEngfuncs.pfnHookEvent( "events/tripfire.sc", EV_TripmineFire );
gEngfuncs.pfnHookEvent( "events/snarkfire.sc", EV_SnarkFire );
}

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#include "../hud.h"
#include "../cl_util.h"
#include "../demo.h"
@ -30,7 +31,7 @@ extern BEAM *pBeam;
extern BEAM *pBeam2;
void HUD_GetLastOrg( float *org );
void UpdateBeams ( void )
void UpdateBeams( void )
{
vec3_t forward, vecSrc, vecEnd, origin, angles, right, up;
vec3_t view_ofs;
@ -47,32 +48,32 @@ void UpdateBeams ( void )
AngleVectors( angles, forward, right, up );
VectorCopy( origin, vecSrc );
VectorMA( vecSrc, 2048, forward, vecEnd );
gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true );
// Store off the old count
gEngfuncs.pEventAPI->EV_PushPMStates();
// Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );
gEngfuncs.pEventAPI->EV_SetSolidPlayers( idx - 1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
gEngfuncs.pEventAPI->EV_PopPMStates();
if ( pBeam )
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.1; // We keep it alive just a little bit forward in the future, just in case.
}
if ( pBeam2 )
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.1; // We keep it alive just a little bit forward in the future, just in case.
}
}
@ -85,6 +86,6 @@ Add game specific, client-side objects here
*/
void Game_AddObjects( void )
{
if ( pBeam && pBeam2 )
if( pBeam && pBeam2 )
UpdateBeams();
}

File diff suppressed because it is too large Load Diff

View File

@ -26,26 +26,29 @@
#include <string.h>
#include <stdio.h>
#include "parsemsg.h"
#include "hud_servers.h"
#include "demo.h"
#include "demo_api.h"
cvar_t *hud_textmode;
float g_hud_text_color[3];
extern client_sprite_t *GetSpriteList(client_sprite_t *pList, const char *psz, int iRes, int iCount);
extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz, int iRes, int iCount );
extern cvar_t *sensitivity;
cvar_t *cl_lw = NULL;
cvar_t *cl_viewbob = NULL;
void ShutdownInput (void);
void ShutdownInput( void );
//DECLARE_MESSAGE(m_Logo, Logo)
int __MsgFunc_Logo(const char *pszName, int iSize, void *pbuf)
//DECLARE_MESSAGE( m_Logo, Logo )
int __MsgFunc_Logo( const char *pszName, int iSize, void *pbuf )
{
return gHUD.MsgFunc_Logo(pszName, iSize, pbuf );
return gHUD.MsgFunc_Logo( pszName, iSize, pbuf );
}
//DECLARE_MESSAGE(m_Logo, Logo)
//DECLARE_MESSAGE( m_Logo, Logo )
//LRC
int __MsgFunc_HUDColor(const char *pszName, int iSize, void *pbuf)
{
@ -80,15 +83,15 @@ int __MsgFunc_SetSky(const char *pszName, int iSize, void *pbuf)
return 1;
}
int __MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
{
#ifdef ENGINE_DEBUG
CONPRINT("## ResetHUD\n");
#endif
return gHUD.MsgFunc_ResetHUD(pszName, iSize, pbuf );
return gHUD.MsgFunc_ResetHUD( pszName, iSize, pbuf );
}
int __MsgFunc_InitHUD(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
{
#ifdef ENGINE_DEBUG
CONPRINT("## InitHUD\n");
@ -97,38 +100,38 @@ int __MsgFunc_InitHUD(const char *pszName, int iSize, void *pbuf)
return 1;
}
int __MsgFunc_ViewMode(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
{
gHUD.MsgFunc_ViewMode( pszName, iSize, pbuf );
return 1;
}
int __MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf )
{
return gHUD.MsgFunc_SetFOV( pszName, iSize, pbuf );
}
int __MsgFunc_Concuss(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
{
return gHUD.MsgFunc_Concuss( pszName, iSize, pbuf );
}
int __MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
int __MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
{
return gHUD.MsgFunc_GameMode( pszName, iSize, pbuf );
}
// TFFree Command Menu
void __CmdFunc_OpenCommandMenu(void)
void __CmdFunc_OpenCommandMenu( void )
{
}
// TFC "special" command
void __CmdFunc_InputPlayerSpecial(void)
void __CmdFunc_InputPlayerSpecial( void )
{
}
void __CmdFunc_CloseCommandMenu(void)
void __CmdFunc_CloseCommandMenu( void )
{
}
@ -141,27 +144,27 @@ void __CmdFunc_ToggleServerBrowser( void )
}
// TFFree Command Menu Message Handlers
int __MsgFunc_ValClass(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_ValClass( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
int __MsgFunc_TeamNames(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_TeamNames( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
int __MsgFunc_Feign(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_Feign( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
int __MsgFunc_Detpack(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_Detpack( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
int __MsgFunc_VGUIMenu(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_VGUIMenu( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
@ -171,17 +174,17 @@ int __MsgFunc_MOTD(const char *pszName, int iSize, void *pbuf)
return 0;
}
*/
int __MsgFunc_BuildSt(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_BuildSt( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
int __MsgFunc_RandomPC(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_RandomPC( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
int __MsgFunc_ServerName(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_ServerName( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
@ -201,18 +204,18 @@ int __MsgFunc_TeamInfo(const char *pszName, int iSize, void *pbuf)
return 0;
}
*/
int __MsgFunc_Spectator(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_Spectator( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
int __MsgFunc_AllowSpec(const char *pszName, int iSize, void *pbuf)
int __MsgFunc_AllowSpec( const char *pszName, int iSize, void *pbuf )
{
return 0;
}
// This is called every time the DLL is loaded
void CHud :: Init( void )
void CHud::Init( void )
{
#ifdef ENGINE_DEBUG
CONPRINT("## CHud::Init\n");
@ -257,7 +260,7 @@ void CHud :: Init( void )
CVAR_CREATE( "hud_classautokill", "1", FCVAR_ARCHIVE | FCVAR_USERINFO ); // controls whether or not to suicide immediately on TF class switch
CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round
hud_textmode = CVAR_CREATE( "hud_textmode", "0", FCVAR_ARCHIVE );
hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE );
m_iLogo = 0;
m_iFOV = 0;
@ -268,12 +271,13 @@ void CHud :: Init( void )
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;
m_pShinySurface = NULL; //LRC
// Clear any old HUD list
if ( m_pHudList )
if( m_pHudList )
{
HUDLIST *pList;
while ( m_pHudList )
@ -309,26 +313,24 @@ void CHud :: Init( void )
m_Menu.Init();
MsgFunc_ResetHUD(0, 0, NULL );
MsgFunc_ResetHUD( 0, 0, NULL );
}
// CHud destructor
// cleans up memory allocated for m_rg* arrays
CHud :: ~CHud()
CHud::~CHud()
{
#ifdef ENGINE_DEBUG
CONPRINT("## CHud::destructor\n");
#endif
delete [] m_rghSprites;
delete [] m_rgrcRects;
delete [] m_rgszSpriteNames;
delete[] m_rghSprites;
delete[] m_rgrcRects;
delete[] m_rgszSpriteNames;
if ( m_pHudList )
if( m_pHudList )
{
HUDLIST *pList;
while ( m_pHudList )
while( m_pHudList )
{
pList = m_pHudList;
m_pHudList = m_pHudList->pNext;
@ -336,62 +338,60 @@ CHud :: ~CHud()
}
m_pHudList = NULL;
}
}
// GetSpriteIndex()
// searches through the sprite list loaded from hud.txt for a name matching SpriteName
// returns an index into the gHUD.m_rghSprites[] array
// returns 0 if sprite not found
int CHud :: GetSpriteIndex( const char *SpriteName )
int CHud::GetSpriteIndex( const char *SpriteName )
{
// look through the loaded sprite name list for SpriteName
for ( int i = 0; i < m_iSpriteCount; i++ )
for( int i = 0; i < m_iSpriteCount; i++ )
{
if ( strncmp( SpriteName, m_rgszSpriteNames + (i * MAX_SPRITE_NAME_LENGTH), MAX_SPRITE_NAME_LENGTH ) == 0 )
if( strncmp( SpriteName, m_rgszSpriteNames + ( i * MAX_SPRITE_NAME_LENGTH), MAX_SPRITE_NAME_LENGTH ) == 0 )
return i;
}
return -1; // invalid sprite
}
void CHud :: VidInit( void )
void CHud::VidInit( void )
{
#ifdef ENGINE_DEBUG
CONPRINT("## CHud::VidInit\n");
#endif
int j;
m_scrinfo.iSize = sizeof(m_scrinfo);
GetScreenInfo(&m_scrinfo);
GetScreenInfo( &m_scrinfo );
// ----------
// Load Sprites
// ---------
// m_hsprFont = LoadSprite("sprites/%d_font.spr");
//m_hsprFont = LoadSprite("sprites/%d_font.spr");
m_hsprLogo = 0;
m_hsprCursor = 0;
if (ScreenWidth < 640)
if( ScreenWidth < 640 )
m_iRes = 320;
else
m_iRes = 640;
// Only load this once
if ( !m_pSpriteList )
if( !m_pSpriteList )
{
// we need to load the hud.txt, and all sprites within
m_pSpriteList = SPR_GetList("sprites/hud.txt", &m_iSpriteCountAllRes);
m_pSpriteList = SPR_GetList( "sprites/hud.txt", &m_iSpriteCountAllRes );
if (m_pSpriteList)
if( m_pSpriteList )
{
int j;
// count the number of sprites of the appropriate res
m_iSpriteCount = 0;
client_sprite_t *p = m_pSpriteList;
for ( j = 0; j < m_iSpriteCountAllRes; j++ )
for( j = 0; j < m_iSpriteCountAllRes; j++ )
{
if ( p->iRes == m_iRes )
if( p->iRes == m_iRes )
m_iSpriteCount++;
p++;
}
@ -403,13 +403,13 @@ void CHud :: VidInit( void )
p = m_pSpriteList;
int index = 0;
for ( j = 0; j < m_iSpriteCountAllRes; j++ )
for( j = 0; j < m_iSpriteCountAllRes; j++ )
{
if ( p->iRes == m_iRes )
if( p->iRes == m_iRes )
{
char sz[256];
sprintf(sz, "sprites/%s.spr", p->szSprite);
m_rghSprites[index] = SPR_Load(sz);
sprintf( sz, "sprites/%s.spr", p->szSprite );
m_rghSprites[index] = SPR_Load( sz );
m_rgrcRects[index] = p->rc;
strncpy( &m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH], p->szName, MAX_SPRITE_NAME_LENGTH );
@ -425,14 +425,37 @@ void CHud :: VidInit( void )
// we have already have loaded the sprite reference from hud.txt, but
// we need to make sure all the sprites have been loaded (we've gone through a transition, or loaded a save game)
client_sprite_t *p = m_pSpriteList;
int index = 0;
for ( int j = 0; j < m_iSpriteCountAllRes; j++ )
// count the number of sprites of the appropriate res
m_iSpriteCount = 0;
for( j = 0; j < m_iSpriteCountAllRes; j++ )
{
if ( p->iRes == m_iRes )
if( p->iRes == m_iRes )
m_iSpriteCount++;
p++;
}
delete[] m_rghSprites;
delete[] m_rgrcRects;
delete[] m_rgszSpriteNames;
// allocated memory for sprite handle arrays
m_rghSprites = new HSPRITE[m_iSpriteCount];
m_rgrcRects = new wrect_t[m_iSpriteCount];
m_rgszSpriteNames = new char[m_iSpriteCount * MAX_SPRITE_NAME_LENGTH];
p = m_pSpriteList;
int index = 0;
for( j = 0; j < m_iSpriteCountAllRes; j++ )
{
if( p->iRes == m_iRes )
{
char sz[256];
sprintf( sz, "sprites/%s.spr", p->szSprite );
m_rghSprites[index] = SPR_Load(sz);
m_rghSprites[index] = SPR_Load( sz );
m_rgrcRects[index] = p->rc;
strncpy( &m_rgszSpriteNames[index * MAX_SPRITE_NAME_LENGTH], p->szName, MAX_SPRITE_NAME_LENGTH );
index++;
}
@ -465,7 +488,7 @@ void CHud :: VidInit( void )
m_Particle.VidInit(); // (LRC) -- 30/08/02 November235: Particles to Order
}
int CHud::MsgFunc_Logo(const char *pszName, int iSize, void *pbuf)
int CHud::MsgFunc_Logo( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -493,29 +516,28 @@ COM_FileBase
============
*/
// Extracts the base name of a file (no path, no extension, assumes '/' as path separator)
void COM_FileBase ( const char *in, char *out)
void COM_FileBase ( const char *in, char *out )
{
int len, start, end;
len = strlen( in );
// scan backward for '.'
end = len - 1;
while ( end && in[end] != '.' && in[end] != '/' && in[end] != '\\' )
while( end && in[end] != '.' && in[end] != '/' && in[end] != '\\' )
end--;
if ( in[end] != '.' ) // no '.', copy to end
end = len-1;
if( in[end] != '.' ) // no '.', copy to end
end = len - 1;
else
end--; // Found ',', copy to left of '.'
// Scan backward for '/'
start = len-1;
while ( start >= 0 && in[start] != '/' && in[start] != '\\' )
start = len - 1;
while( start >= 0 && in[start] != '/' && in[start] != '\\' )
start--;
if ( in[start] != '/' && in[start] != '\\' )
if( in[start] != '/' && in[start] != '\\' )
start = 0;
else
start++;
@ -525,6 +547,7 @@ void COM_FileBase ( const char *in, char *out)
// Copy partial string
strncpy( out, &in[start], len );
// Terminate it
out[len] = 0;
}
@ -538,13 +561,13 @@ HUD_IsGame
int HUD_IsGame( const char *game )
{
const char *gamedir;
char gd[ 1024 ];
char gd[1024];
gamedir = gEngfuncs.pfnGetGameDirectory();
if ( gamedir && gamedir[0] )
if( gamedir && gamedir[0] )
{
COM_FileBase( gamedir, gd );
if ( !stricmp( gd, game ) )
if( !stricmp( gd, game ) )
return 1;
}
return 0;
@ -559,27 +582,27 @@ Returns last FOV
*/
float HUD_GetFOV( void )
{
if ( gEngfuncs.pDemoAPI->IsRecording() )
if( gEngfuncs.pDemoAPI->IsRecording() )
{
// Write it
int i = 0;
unsigned char buf[ 100 ];
unsigned char buf[100];
// Active
*( float * )&buf[ i ] = g_lastFOV;
i += sizeof( float );
*(float *)&buf[i] = g_lastFOV;
i += sizeof(float);
Demo_WriteBuffer( TYPE_ZOOM, i, buf );
}
if ( gEngfuncs.pDemoAPI->IsPlayingback() )
if( gEngfuncs.pDemoAPI->IsPlayingback() )
{
g_lastFOV = g_demozoom;
}
return g_lastFOV;
}
int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
int CHud::MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -587,12 +610,12 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
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 )
if( cl_lw && cl_lw->value )
return 1;
g_lastFOV = newfov;
if ( newfov == 0 )
if( newfov == 0 )
{
m_iFOV = def_fov;
}
@ -604,7 +627,7 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
// the clients fov is actually set in the client data update section of the hud
// Set a new sensitivity
if ( m_iFOV == def_fov )
if( m_iFOV == def_fov )
{
// reset to saved sensitivity
m_flMouseSensitivity = 0;
@ -618,24 +641,23 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
return 1;
}
void CHud::AddHudElem(CHudBase *phudelem)
void CHud::AddHudElem( CHudBase *phudelem )
{
HUDLIST *pdl, *ptemp;
//phudelem->Think();
//phudelem->Think();
if (!phudelem)
if( !phudelem )
return;
pdl = (HUDLIST *)malloc(sizeof(HUDLIST));
if (!pdl)
pdl = (HUDLIST *)malloc( sizeof(HUDLIST) );
if( !pdl )
return;
memset(pdl, 0, sizeof(HUDLIST));
memset( pdl, 0, sizeof(HUDLIST) );
pdl->p = phudelem;
if (!m_pHudList)
if( !m_pHudList )
{
m_pHudList = pdl;
return;
@ -643,7 +665,7 @@ void CHud::AddHudElem(CHudBase *phudelem)
ptemp = m_pHudList;
while (ptemp->pNext)
while( ptemp->pNext )
ptemp = ptemp->pNext;
ptemp->pNext = pdl;
@ -653,5 +675,3 @@ float CHud::GetSensitivity( void )
{
return m_flMouseSensitivity;
}

View File

@ -19,7 +19,9 @@
//
// CHud handles the message, calculation, and drawing the HUD
//
#pragma once
#ifndef HUD_H
#define HUD_H
#define FOG_LIMIT 30000
#define RGB_YELLOWISH 0x00FFA000 //255,160,0
#define RGB_REDISH 0x00FF1010 //255,160,0
@ -36,7 +38,8 @@
#define HUDELEM_ACTIVE 1
typedef struct {
typedef struct
{
int x, y;
} POSITION;
@ -44,16 +47,16 @@ enum
{
MAX_PLAYERS = 64,
MAX_TEAMS = 64,
MAX_TEAM_NAME = 16,
MAX_TEAM_NAME = 16
};
typedef struct {
unsigned char r,g,b,a;
typedef struct
{
unsigned char r, g, b, a;
} RGBA;
typedef struct cvar_s cvar_t;
#define HUD_ACTIVE 1
#define HUD_INTERMISSION 2
@ -71,43 +74,40 @@ public:
int m_type;
int m_iFlags; // active, moving,
virtual ~CHudBase() {}
virtual int Init( void ) {return 0;}
virtual int VidInit( void ) {return 0;}
virtual int Draw(float flTime) {return 0;}
virtual void Think(void) {return;}
virtual void Reset(void) {return;}
virtual int Init( void ) { return 0; }
virtual int VidInit( void ) { return 0; }
virtual int Draw( float flTime ) { return 0; }
virtual void Think( void ) { return; }
virtual void Reset( void ) { return; }
virtual void InitHUDData( void ) {} // called every time a server is connected to
};
struct HUDLIST {
struct HUDLIST
{
CHudBase *p;
HUDLIST *pNext;
};
//
//-----------------------------------------------------
#include "hud_spectator.h"
#define _cdecl
//
//-----------------------------------------------------
//
class CHudAmmo: public CHudBase
class CHudAmmo : public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
void Think(void);
void Reset(void);
int DrawWList(float flTime);
int MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf);
int MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf);
int MsgFunc_AmmoX(const char *pszName, int iSize, void *pbuf);
int Draw( float flTime );
void Think( void );
void Reset( void );
int DrawWList( float flTime );
int MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf );
int MsgFunc_WeaponList( const char *pszName, int iSize, void *pbuf );
int MsgFunc_AmmoX( const char *pszName, int iSize, void *pbuf );
int MsgFunc_AmmoPickup( const char *pszName, int iSize, void *pbuf );
int MsgFunc_WeapPickup( const char *pszName, int iSize, void *pbuf );
int MsgFunc_ItemPickup( const char *pszName, int iSize, void *pbuf );
@ -132,16 +132,14 @@ private:
float m_fFade;
RGBA m_rgba;
WEAPON *m_pWeapon;
int m_HUD_bucket0;
int m_HUD_bucket0;
int m_HUD_selection;
};
//
//-----------------------------------------------------
//
class CHudAmmoSecondary: public CHudBase
class CHudAmmoSecondary : public CHudBase
{
public:
int Init( void );
@ -177,29 +175,27 @@ class CHudGeiger: public CHudBase
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
int MsgFunc_Geiger(const char *pszName, int iSize, void *pbuf);
int Draw( float flTime );
int MsgFunc_Geiger( const char *pszName, int iSize, void *pbuf );
private:
int m_iGeigerRange;
};
//
//-----------------------------------------------------
//
class CHudTrain: public CHudBase
class CHudTrain : public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
int MsgFunc_Train(const char *pszName, int iSize, void *pbuf);
int Draw( float flTime );
int MsgFunc_Train( const char *pszName, int iSize, void *pbuf );
private:
HSPRITE m_hSprite;
int m_iPos;
};
//
@ -207,7 +203,6 @@ private:
//
// REMOVED: Vgui has replaced this.
//
class CHudMOTD : public CHudBase
{
public:
@ -215,20 +210,47 @@ public:
int VidInit( void );
int Draw( float flTime );
void Reset( void );
int MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf );
void Scroll( int dir );
void Scroll( float amount );
float scroll;
bool m_bShow;
int MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf );
protected:
static int MOTD_DISPLAY_TIME;
char m_szMOTD[ MAX_MOTD_LENGTH ];
char m_szMOTD[MAX_MOTD_LENGTH];
int m_iLines;
int m_iMaxLength;
};
class CHudScoreboard : public CHudBase
{
public:
int Init( void );
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
void UserCmd_ShowScores( void );
void UserCmd_HideScores( void );
int MsgFunc_ScoreInfo( const char *pszName, int iSize, void *pbuf );
int MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf );
int MsgFunc_TeamScore( const char *pszName, int iSize, void *pbuf );
int MsgFunc_TeamScores( const char *pszName, int iSize, void *pbuf );
int MsgFunc_TeamNames( const char *pszName, int iSize, void *pbuf );
void DeathMsg( int killer, int victim );
int m_iNumTeams;
int m_iLastKilledBy;
int m_fLastKillTime;
int m_iPlayerNum;
int m_iShowscoresHeld;
void GetAllPlayersInfo( void );
};
//
//-----------------------------------------------------
@ -246,10 +268,11 @@ public:
int MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf );
protected:
enum {
enum
{
MAX_STATUSTEXT_LENGTH = 128,
MAX_STATUSBAR_VALUES = 8,
MAX_STATUSBAR_LINES = 2,
MAX_STATUSBAR_LINES = 2
};
char m_szStatusText[MAX_STATUSBAR_LINES][MAX_STATUSTEXT_LENGTH]; // a text string describing how the status bar is to be drawn
@ -267,7 +290,8 @@ protected:
//
// REMOVED: Vgui has replaced this.
//
class CHudScoreboard: public CHudBase
/*
class CHudScoreboard : public CHudBase
{
public:
int Init( void );
@ -290,12 +314,13 @@ public:
int m_iShowscoresHeld;
void GetAllPlayersInfo( void );
private:
struct cvar_s *cl_showpacketloss;
};
*/
struct extra_player_info_t
struct extra_player_info_t
{
short frags;
short deaths;
@ -304,7 +329,7 @@ struct extra_player_info_t
char teamname[MAX_TEAM_NAME];
};
struct team_info_t
struct team_info_t
{
char name[MAX_TEAM_NAME];
short frags;
@ -318,11 +343,10 @@ struct team_info_t
int teamnumber;
};
extern hud_player_info_t g_PlayerInfoList[MAX_PLAYERS+1]; // player info from the engine
extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS+1]; // additional player info sent directly to the client dll
extern team_info_t g_TeamInfo[MAX_TEAMS+1];
extern int g_IsSpectator[MAX_PLAYERS+1];
extern hud_player_info_t g_PlayerInfoList[MAX_PLAYERS + 1]; // player info from the engine
extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS + 1]; // additional player info sent directly to the client dll
extern team_info_t g_TeamInfo[MAX_TEAMS + 1];
extern int g_IsSpectator[MAX_PLAYERS + 1];
//
//-----------------------------------------------------
@ -374,10 +398,9 @@ public:
int MsgFunc_SayText( const char *pszName, int iSize, void *pbuf );
void SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex = -1 );
void EnsureTextFitsInOneLineAndWrapIfHaveTo( int line );
friend class CHudSpectator;
friend class CHudSpectator;
private:
struct cvar_s * m_HUD_saytext;
struct cvar_s * m_HUD_saytext_time;
};
@ -385,25 +408,24 @@ private:
//
//-----------------------------------------------------
//
class CHudBattery: public CHudBase
class CHudBattery : public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
int MsgFunc_Battery(const char *pszName, int iSize, void *pbuf );
int Draw( float flTime );
int MsgFunc_Battery( const char *pszName, int iSize, void *pbuf );
private:
HSPRITE m_hSprite1;
HSPRITE m_hSprite2;
wrect_t *m_prc1;
wrect_t *m_prc2;
int m_iBat;
int m_iBat;
float m_fFade;
int m_iHeight; // width of the battery innards
int m_iHeight; // width of the battery innards
};
//
//-----------------------------------------------------
//
@ -412,11 +434,11 @@ class CHudFlashlight: public CHudBase
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
int Draw( float flTime );
void Reset( void );
int MsgFunc_Flashlight(const char *pszName, int iSize, void *pbuf );
int MsgFunc_FlashBat(const char *pszName, int iSize, void *pbuf );
int MsgFunc_Flashlight( const char *pszName, int iSize, void *pbuf );
int MsgFunc_FlashBat( const char *pszName, int iSize, void *pbuf );
private:
HSPRITE m_hSprite1;
HSPRITE m_hSprite2;
@ -425,10 +447,10 @@ private:
wrect_t *m_prc2;
wrect_t *m_prcBeam;
float m_flBat;
int m_iBat;
int m_fOn;
int m_iBat;
int m_fOn;
float m_fFade;
int m_iWidth; // width of the battery innards
int m_iWidth; // width of the battery innards
};
//
@ -469,31 +491,31 @@ struct message_parms_t
//-----------------------------------------------------
//
class CHudTextMessage: public CHudBase
class CHudTextMessage : public CHudBase
{
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 );
int MsgFunc_TextMsg(const char *pszName, int iSize, void *pbuf);
const char *LookupString( const char *msg_name, int *msg_dest = NULL );
int MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf );
};
//
//-----------------------------------------------------
//
class CHudMessage: public CHudBase
class CHudMessage : public CHudBase
{
public:
int Init( void );
int VidInit( void );
int Draw(float flTime);
int MsgFunc_HudText(const char *pszName, int iSize, void *pbuf);
int MsgFunc_GameTitle(const char *pszName, int iSize, void *pbuf);
int Draw( float flTime );
int MsgFunc_HudText( const char *pszName, int iSize, void *pbuf );
int MsgFunc_GameTitle( const char *pszName, int iSize, void *pbuf );
float FadeBlend( float fadein, float fadeout, float hold, float localTime );
int XPosition( float x, int width, int lineWidth );
int XPosition( float x, int width, int lineWidth );
int YPosition( float y, int height );
void MessageAdd( const char *pName, float time );
@ -519,28 +541,27 @@ private:
//
#define MAX_SPRITE_NAME_LENGTH 24
class CHudStatusIcons: public CHudBase
class CHudStatusIcons : public CHudBase
{
public:
int Init( void );
int VidInit( void );
void Reset( void );
int Draw(float flTime);
int MsgFunc_StatusIcon(const char *pszName, int iSize, void *pbuf);
int Draw( float flTime );
int MsgFunc_StatusIcon( const char *pszName, int iSize, void *pbuf );
enum {
enum
{
MAX_ICONSPRITENAME_LENGTH = MAX_SPRITE_NAME_LENGTH,
MAX_ICONSPRITES = 4,
MAX_ICONSPRITES = 4
};
//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
{
char szSpriteName[MAX_ICONSPRITENAME_LENGTH];
@ -604,7 +625,6 @@ private:
int m_iConcussionEffect;
public:
HSPRITE m_hsprCursor;
float m_flTime; // the current client time
float m_fOldTime; // the time at which the HUD was last redrawn
@ -624,12 +644,12 @@ public:
int m_iSkyMode; //LRC
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 DrawHudNumber( int x, int y, int iFlags, int iNumber, 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 GetNumWidth( int iNumber, int iFlags );
int DrawHudStringLen( const char *szIt );
void DrawDarkRectangle( int x, int y, int wide, int tall );
int m_iHUDColor; //LRC
@ -645,14 +665,13 @@ private:
public:
HSPRITE GetSprite( int index )
{
return (index < 0) ? 0 : m_rghSprites[index];
return ( index < 0 ) ? 0 : m_rghSprites[index];
}
wrect_t& GetSpriteRect( int index )
{
return m_rgrcRects[index];
}
int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array
@ -671,8 +690,8 @@ public:
CHudAmmoSecondary m_AmmoSecondary;
CHudTextMessage m_TextMessage;
CHudStatusIcons m_StatusIcons;
CHudScoreboard m_Scoreboard;
CHudMOTD m_MOTD;
CHudScoreboard m_Scoreboard;
CHudMOTD m_MOTD;
CHudParticle m_Particle; // (LRC) -- 30/08/02 November235: Particles to Order
void Init( void );
@ -685,13 +704,13 @@ public:
~CHud(); // destructor, frees allocated memory
// user messages
int _cdecl MsgFunc_Damage(const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_Logo(const char *pszName, int iSize, void *pbuf);
int _cdecl MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf);
int _cdecl MsgFunc_Damage( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_Logo( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf );
void _cdecl MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf );
void _cdecl MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf);
int _cdecl MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_HUDColor(const char *pszName, int iSize, void *pbuf); //LRC
@ -706,15 +725,15 @@ public:
int m_iWeaponBits;
int m_fPlayerDead;
int m_iIntermission;
int m_iNoConsolePrint;
// sprite indexes
int m_HUD_number_0;
int m_iNoConsolePrint;
void AddHudElem(CHudBase *p);
void AddHudElem( CHudBase *p );
float GetSensitivity();
};
extern CHud gHUD;
@ -724,4 +743,4 @@ extern int g_iTeamNumber;
extern int g_iUser1;
extern int g_iUser2;
extern int g_iUser3;
#endif

View File

@ -1,19 +1,18 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 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);
typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf );
#include "wrect.h"
#include "../engine/cdll_int.h"
extern cl_enginefunc_t gEngfuncs;
#endif

View File

@ -36,16 +36,16 @@ extern BEAM *pBeam2;
/// USER-DEFINED SERVER MESSAGE HANDLERS
int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
int CHud::MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf )
{
ASSERT( iSize == 0 );
// clear all hud data
HUDLIST *pList = m_pHudList;
while ( pList )
while( pList )
{
if ( pList->p )
if( pList->p )
pList->p->Reset();
pList = pList->pNext;
}
@ -63,14 +63,14 @@ int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
return 1;
}
void CAM_ToFirstPerson(void);
void CAM_ToFirstPerson( void );
void CHud :: MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
void CHud::MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf )
{
CAM_ToFirstPerson();
}
void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
void CHud::MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
{
// CONPRINT("MSG:InitHUD");
//LRC - clear the fog
@ -89,9 +89,9 @@ void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
// prepare all hud data
HUDLIST *pList = m_pHudList;
while (pList)
while( pList )
{
if ( pList->p )
if( pList->p )
pList->p->InitHUDData();
pList = pList->pNext;
}
@ -202,7 +202,7 @@ void CHud :: MsgFunc_SetSky( const char *pszName, int iSize, void *pbuf )
m_vecSkyPos.z = READ_COORD();
}
int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
int CHud::MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_Teamplay = READ_BYTE();
@ -210,38 +210,36 @@ int CHud :: MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHud :: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
int CHud::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
{
int armor, blood;
Vector from;
int i;
float count;
BEGIN_READ( pbuf, iSize );
armor = READ_BYTE();
blood = READ_BYTE();
for (i=0 ; i<3 ; i++)
for( i = 0; i < 3; i++)
from[i] = READ_COORD();
count = (blood * 0.5) + (armor * 0.5);
count = ( blood * 0.5 ) + ( armor * 0.5 );
if (count < 10)
if( count < 10 )
count = 10;
// TODO: kick viewangles, show damage visually
return 1;
}
int CHud :: MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
int CHud::MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
m_iConcussionEffect = READ_BYTE();
if (m_iConcussionEffect)
this->m_StatusIcons.EnableIcon("dmg_concuss",255,160,0);
if( m_iConcussionEffect )
this->m_StatusIcons.EnableIcon( "dmg_concuss", 255, 160, 0 );
else
this->m_StatusIcons.DisableIcon("dmg_concuss");
this->m_StatusIcons.DisableIcon( "dmg_concuss" );
return 1;
}

View File

@ -22,14 +22,13 @@
#define MAX_LOGO_FRAMES 56
int grgLogoFrame[MAX_LOGO_FRAMES] =
int grgLogoFrame[MAX_LOGO_FRAMES] =
{
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 12, 11, 10, 9, 8, 14, 15,
16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
29, 29, 29, 29, 29, 28, 27, 26, 25, 24, 30, 31
};
extern int g_iVisibleMouse;
float HUD_GetFOV( void );
@ -37,20 +36,20 @@ float HUD_GetFOV( void );
extern cvar_t *sensitivity;
// Think
void CHud::Think(void)
void CHud::Think( void )
{
int newfov;
HUDLIST *pList = m_pHudList;
while (pList)
while( pList )
{
if (pList->p->m_iFlags & HUD_ACTIVE)
if( pList->p->m_iFlags & HUD_ACTIVE )
pList->p->Think();
pList = pList->pNext;
}
newfov = HUD_GetFOV();
if ( newfov == 0 )
if( newfov == 0 )
{
m_iFOV = default_fov->value;
}
@ -60,22 +59,22 @@ void CHud::Think(void)
}
// the clients fov is actually set in the client data update section of the hud
// Set a new sensitivity
if ( m_iFOV == default_fov->value )
{
if( m_iFOV == default_fov->value )
{
// reset to saved sensitivity
m_flMouseSensitivity = 0;
}
else
{
{
// set a new sensitivity that is proportional to the change from the FOV default
m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)default_fov->value) * CVAR_GET_FLOAT("zoom_sensitivity_ratio");
}
// think about default fov
if ( m_iFOV == 0 )
{ // only let players adjust up in fov, and only if they are not overriden by something else
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 );
}
}
@ -90,7 +89,7 @@ extern int g_iFinalEndDist;
// Redraw
// step through the local data, placing the appropriate graphics & text as appropriate
// returns 1 if they've changed, 0 otherwise
int CHud :: Redraw( float flTime, int intermission )
int CHud::Redraw( float flTime, int intermission )
{
m_fOldTime = m_flTime; // save time of previous redraw
m_flTime = flTime;
@ -113,9 +112,9 @@ int CHud :: Redraw( float flTime, int intermission )
// if (g_fStartDist < g_iFinalStartDist) g_fStartDist = g_iFinalStartDist;
if (g_fEndDist < g_iFinalEndDist) g_fEndDist = g_iFinalEndDist;
}
// Clock was reset, reset delta
if ( m_flTimeDelta < 0 )
if( m_flTimeDelta < 0 )
m_flTimeDelta = 0;
// Bring up the scoreboard during intermission
@ -130,22 +129,22 @@ int CHud :: Redraw( float flTime, int intermission )
gViewPort->UpdateSpectatorPanel();
}
else if ( !m_iIntermission && intermission )
{
{
m_iIntermission = intermission;
gViewPort->HideCommandMenu();
gViewPort->HideVGUIMenu();
gViewPort->ShowScoreBoard();
gViewPort->UpdateSpectatorPanel();
// Take a screenshot if the client's got the cvar set
if ( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
m_flShotTime = flTime + 1.0; // Take a screenshot in a second
}
// Take a screenshot if the client's got the cvar set
if( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
m_flShotTime = flTime + 1.0; // Take a screenshot in a second
}
}*/
if (m_flShotTime && m_flShotTime < flTime)
if( m_flShotTime && m_flShotTime < flTime )
{
gEngfuncs.pfnClientCmd("snapshot\n");
gEngfuncs.pfnClientCmd( "snapshot\n" );
m_flShotTime = 0;
}
@ -153,21 +152,22 @@ int CHud :: Redraw( float flTime, int intermission )
// if no redrawing is necessary
// return 0;
if ( m_pCvarDraw->value )
if( m_pCvarDraw->value )
{
HUDLIST *pList = m_pHudList;
while (pList)
while( pList )
{
if ( !intermission )
if( !intermission )
{
if ( (pList->p->m_iFlags & HUD_ACTIVE) && !(m_iHideHUDDisplay & HIDEHUD_ALL) )
pList->p->Draw(flTime);
if ( ( pList->p->m_iFlags & HUD_ACTIVE ) && !( m_iHideHUDDisplay & HIDEHUD_ALL ) )
pList->p->Draw( flTime );
}
else
{ // it's an intermission, so only draw hud elements that are set to draw during intermissions
if ( pList->p->m_iFlags & HUD_INTERMISSION )
{
// it's an intermission, so only draw hud elements that are set to draw during intermissions
if( pList->p->m_iFlags & HUD_INTERMISSION )
pList->p->Draw( flTime );
}
@ -176,43 +176,43 @@ int CHud :: Redraw( float flTime, int intermission )
}
// are we in demo mode? do we need to draw the logo in the top corner?
if (m_iLogo)
if( m_iLogo )
{
int x, y, i;
if (m_hsprLogo == 0)
m_hsprLogo = LoadSprite("sprites/%d_logo.spr");
if( m_hsprLogo == 0 )
m_hsprLogo = LoadSprite( "sprites/%d_logo.spr" );
SPR_Set(m_hsprLogo, 250, 250, 250 );
x = SPR_Width(m_hsprLogo, 0);
SPR_Set( m_hsprLogo, 250, 250, 250 );
x = SPR_Width( m_hsprLogo, 0 );
x = ScreenWidth - x;
y = SPR_Height(m_hsprLogo, 0)/2;
y = SPR_Height( m_hsprLogo, 0 ) / 2;
// Draw the logo at 20 fps
int iFrame = (int)(flTime * 20) % MAX_LOGO_FRAMES;
int iFrame = (int)( flTime * 20 ) % MAX_LOGO_FRAMES;
i = grgLogoFrame[iFrame] - 1;
SPR_DrawAdditive(i, x, y, NULL);
SPR_DrawAdditive( i, x, y, NULL );
}
/*
if ( g_iVisibleMouse )
if( g_iVisibleMouse )
{
void IN_GetMousePos( int *mx, int *my );
int mx, my;
IN_GetMousePos( &mx, &my );
if (m_hsprCursor == 0)
if( m_hsprCursor == 0 )
{
char sz[256];
sprintf( sz, "sprites/cursor.spr" );
m_hsprCursor = SPR_Load( sz );
}
SPR_Set(m_hsprCursor, 250, 250, 250 );
SPR_Set( m_hsprCursor, 250, 250, 250 );
// Draw the logo at 20 fps
SPR_DrawAdditive( 0, mx, my, NULL );
}
@ -224,9 +224,9 @@ int CHud :: Redraw( float flTime, int intermission )
void ScaleColors( int &r, int &g, int &b, int a )
{
float x = (float)a / 255;
r = (int)(r * x);
g = (int)(g * x);
b = (int)(b * x);
r = (int)( r * x );
g = (int)( g * x );
b = (int)( b * x );
}
const unsigned char colors[8][3] =
@ -241,12 +241,12 @@ 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 )
{
gEngfuncs.pfnDrawSetTextColor( r / 255.0, g / 255.0, b / 255.0 );
return gEngfuncs.pfnDrawConsoleString( xpos, ypos, szIt );
return gEngfuncs.pfnDrawConsoleString( xpos, ypos, (char*) szIt );
}
// xash3d: reset unicode state
@ -265,7 +265,7 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g
g = colors[*szIt - '0'][1];
b = colors[*szIt - '0'][2];
if( !*(++szIt) )
return xpos;
return xpos;
}
int c = (unsigned int)(unsigned char)*szIt;
@ -275,7 +275,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++ )
@ -285,67 +318,55 @@ int CHud::DrawHudStringLen( char *szIt )
return l;
}
int CHud :: DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b )
int CHud::DrawHudNumberString( int xpos, int ypos, int iMinX, int iNumber, int r, int g, int b )
{
char szString[32];
sprintf( szString, "%d", iNumber );
return DrawHudStringReverse( xpos, ypos, iMinX, szString, r, g, b );
}
// 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 )
{
char *szIt;
// find the end of the string
for ( szIt = szString; *szIt != 0; szIt++ )
{ // we should count the length?
}
// iterate throug the string in reverse
for ( szIt--; szIt != (szString-1); szIt-- )
{
int next = xpos - gHUD.m_scrinfo.charWidths[ *szIt ]; // variable-width fonts look cool
if ( next < iMinX )
return xpos;
xpos = next;
TextMessageDrawChar( xpos, ypos, *szIt, r, g, b );
}
for( const char *szIt = szString; *szIt != 0; szIt++ )
xpos -= gHUD.m_scrinfo.charWidths[(unsigned char)*szIt];
if( xpos < iMinX )
xpos = iMinX;
DrawHudString( xpos, ypos, gHUD.m_scrinfo.iWidth, szString, r, g, b );
return xpos;
}
int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b)
int CHud::DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g, int b )
{
int iWidth = GetSpriteRect(m_HUD_number_0).right - GetSpriteRect(m_HUD_number_0).left;
int iWidth = GetSpriteRect( m_HUD_number_0 ).right - GetSpriteRect( m_HUD_number_0 ).left;
int k;
if (iNumber > 0)
if( iNumber > 0 )
{
// SPR_Draw 100's
if (iNumber >= 100)
if( iNumber >= 100 )
{
k = iNumber/100;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
k = iNumber / 100;
SPR_Set( GetSprite( m_HUD_number_0 + k ), r, g, b );
SPR_DrawAdditive( 0, x, y, &GetSpriteRect( m_HUD_number_0 + k ) );
x += iWidth;
}
else if (iFlags & (DHN_3DIGITS))
else if( iFlags & ( DHN_3DIGITS ) )
{
//SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth;
}
// SPR_Draw 10's
if (iNumber >= 10)
if( iNumber >= 10 )
{
k = (iNumber % 100)/10;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
k = ( iNumber % 100 ) / 10;
SPR_Set( GetSprite( m_HUD_number_0 + k ), r, g, b );
SPR_DrawAdditive( 0, x, y, &GetSpriteRect( m_HUD_number_0 + k ) );
x += iWidth;
}
else if (iFlags & (DHN_3DIGITS | DHN_2DIGITS))
else if( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) )
{
//SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth;
@ -353,61 +374,58 @@ int CHud :: DrawHudNumber( int x, int y, int iFlags, int iNumber, int r, int g,
// SPR_Draw ones
k = iNumber % 10;
SPR_Set(GetSprite(m_HUD_number_0 + k), r, g, b );
SPR_DrawAdditive(0, x, y, &GetSpriteRect(m_HUD_number_0 + k));
SPR_Set( GetSprite( m_HUD_number_0 + k ), r, g, b );
SPR_DrawAdditive( 0, x, y, &GetSpriteRect( m_HUD_number_0 + k ) );
x += iWidth;
}
else if (iFlags & DHN_DRAWZERO)
}
else if( iFlags & DHN_DRAWZERO )
{
SPR_Set(GetSprite(m_HUD_number_0), r, g, b );
SPR_Set( GetSprite( m_HUD_number_0 ), r, g, b );
// SPR_Draw 100's
if (iFlags & (DHN_3DIGITS))
if( iFlags & ( DHN_3DIGITS ) )
{
//SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth;
}
if (iFlags & (DHN_3DIGITS | DHN_2DIGITS))
if( iFlags & ( DHN_3DIGITS | DHN_2DIGITS ) )
{
//SPR_DrawAdditive( 0, x, y, &rc );
x += iWidth;
}
// SPR_Draw ones
SPR_DrawAdditive( 0, x, y, &GetSpriteRect(m_HUD_number_0));
SPR_DrawAdditive( 0, x, y, &GetSpriteRect( m_HUD_number_0 ) );
x += iWidth;
}
return x;
}
int CHud::GetNumWidth( int iNumber, int iFlags )
{
if (iFlags & (DHN_3DIGITS))
if( iFlags & ( DHN_3DIGITS ) )
return 3;
if (iFlags & (DHN_2DIGITS))
if( iFlags & ( DHN_2DIGITS ) )
return 2;
if (iNumber <= 0)
if( iNumber <= 0 )
{
if (iFlags & (DHN_DRAWZERO))
if( iFlags & ( DHN_DRAWZERO ) )
return 1;
else
return 0;
}
if (iNumber < 10)
if( iNumber < 10 )
return 1;
if (iNumber < 100)
if( iNumber < 100 )
return 2;
return 3;
}
void CHud::DrawDarkRectangle( int x, int y, int wide, int tall )

1226
cl_dll/hud_servers.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -33,9 +33,8 @@ void ServerPing( int server );
void ServerRules( int server );
void ServerPlayers( int server );
int ServersGetCount( void );
int ServersGetCount( void );
const char *ServersGetInfo( int server );
int ServersIsQuerying( void );
int ServersIsQuerying( void );
void SortServers( const char *fieldname );
#endif // HUD_SERVERSH
#endif // HUD_SERVERSH

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -17,16 +17,16 @@ public:
typedef struct request_s
{
struct request_s *next;
netadr_t remote_address;
int context;
netadr_t remote_address;
int context;
} request_t;
typedef struct server_s
{
struct server_s *next;
netadr_t remote_address;
char *info;
int ping;
struct server_s *next;
netadr_t remote_address;
char *info;
int ping;
} server_t;
CHudServers();
@ -34,9 +34,9 @@ public:
void Think( double time );
void QueryThink( void );
int isQuerying( void );
int isQuerying( void );
int LoadMasterAddresses( int maxservers, int *count, netadr_t *padr );
int LoadMasterAddresses( int maxservers, int *count, netadr_t *padr );
void RequestList( void );
void RequestBroadcastList( int clearpending );
@ -47,7 +47,7 @@ public:
void CancelRequest( void );
int CompareServers( server_t *p1, server_t *p2 );
int CompareServers( server_t *p1, server_t *p2 );
void ClearServerList( server_t **ppList );
void ClearRequestList( request_t **ppList );
@ -58,9 +58,9 @@ public:
request_t *FindRequest( int context, request_t *pList );
int ServerListSize( void );
int ServerListSize( void );
char *GetServerInfo( int server );
int GetServerCount( void );
int GetServerCount( void );
void SortServers( const char *fieldname );
void ListResponse( struct net_response_s *response );
@ -73,26 +73,25 @@ private:
server_t *GetServer( int server );
//
char m_szToken[ 1024 ];
int m_nRequesting;
int m_nDone;
char m_szToken[1024];
int m_nRequesting;
int m_nDone;
double m_dStarted;
double m_dStarted;
request_t *m_pServerList;
request_t *m_pActiveList;
server_t *m_pServers;
server_t *m_pServers;
int m_nServerCount;
int m_nServerCount;
int m_nActiveQueries;
int m_nQuerying;
double m_fElapsed;
int m_nActiveQueries;
int m_nQuerying;
double m_fElapsed;
request_t *m_pPingRequest;
request_t *m_pRulesRequest;
request_t *m_pPlayersRequest;
request_t *m_pPingRequest;
request_t *m_pRulesRequest;
request_t *m_pPlayersRequest;
};
#endif // HUD_SERVERS_PRIVH
#endif // HUD_SERVERS_PRIVH

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,23 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 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"
#define INSET_OFF 0
#define INSET_OFF 0
#define INSET_CHASE_FREE 1
#define INSET_IN_EYE 2
#define INSET_MAP_FREE 3
#define INSET_MAP_CHASE 4
#define MAX_SPEC_HUD_MESSAGES 8
#define MAX_SPEC_HUD_MESSAGES 8
#define OVERVIEW_TILE_SIZE 128 // don't change this
#define OVERVIEW_MAX_LAYERS 1
@ -30,23 +26,24 @@
// Purpose: Handles the drawing of the spectator stuff (camera & top-down map and all the things on it )
//-----------------------------------------------------------------------------
typedef struct overviewInfo_s {
typedef struct overviewInfo_s
{
char map[64]; // cl.levelname or empty
vec3_t origin; // center of map
float zoom; // zoom of map images
int layers; // how may layers do we have
int layers; // how may layers do we have
float layersHeights[OVERVIEW_MAX_LAYERS];
char layersImages[OVERVIEW_MAX_LAYERS][255];
qboolean rotated; // are map images rotated (90 degrees) ?
int insetWindowX;
int insetWindowY;
int insetWindowHeight;
int insetWindowWidth;
int insetWindowX;
int insetWindowY;
int insetWindowHeight;
int insetWindowWidth;
} overviewInfo_t;
typedef struct overviewEntity_s {
typedef struct overviewEntity_s
{
HSPRITE hSprite;
struct cl_entity_s * entity;
double killTime;
@ -58,55 +55,53 @@ class CHudSpectator : public CHudBase
{
public:
void Reset();
int ToggleInset(bool allowOff);
int ToggleInset( bool allowOff );
void CheckSettings();
void InitHUDData( void );
bool AddOverviewEntityToList( HSPRITE sprite, cl_entity_t * ent, double killTime);
void DeathMessage(int victim);
bool AddOverviewEntityToList( HSPRITE sprite, cl_entity_t * ent, double killTime );
void DeathMessage( int victim );
bool AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname );
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);
void SetModes(int iMainMode, int iInsetMode);
void HandleButtonsDown(int ButtonPressed);
void HandleButtonsUp(int ButtonPressed);
bool IsActivePlayer( cl_entity_t *ent );
void SetModes( int iMainMode, int iInsetMode );
void HandleButtonsDown( int ButtonPressed );
void HandleButtonsUp( int ButtonPressed );
void FindNextPlayer( bool bReverse );
void DirectorMessage( int iSize, void *pbuf );
void SetSpectatorStartPosition();
int Init();
int VidInit();
int Draw(float flTime);
int Draw( float flTime );
int m_iDrawCycle;
client_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES];
char m_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128];
int m_lastHudMessage;
client_textmessage_t m_HUDMessages[MAX_SPEC_HUD_MESSAGES];
char m_HUDMessageText[MAX_SPEC_HUD_MESSAGES][128];
int m_lastHudMessage;
overviewInfo_t m_OverviewData;
overviewEntity_t m_OverviewEntities[MAX_OVERVIEW_ENTITIES];
int m_iObserverFlags;
int m_iSpectatorNumber;
float m_mapZoom; // zoom the user currently uses
vec3_t m_mapOrigin; // origin where user rotates around
cvar_t * m_drawnames;
cvar_t * m_drawcone;
cvar_t * m_drawstatus;
cvar_t * m_autoDirector;
cvar_t * m_pip;
int m_iObserverFlags;
int m_iSpectatorNumber;
float m_mapZoom; // zoom the user currently uses
vec3_t m_mapOrigin; // origin where user rotates around
cvar_t *m_drawnames;
cvar_t *m_drawcone;
cvar_t *m_drawstatus;
cvar_t *m_autoDirector;
cvar_t *m_pip;
qboolean m_chatEnabled;
vec3_t m_cameraOrigin; // a help camera
vec3_t m_cameraAngles; // and it's angles
private:
vec3_t m_vPlayerPos[MAX_PLAYERS];
HSPRITE m_hsprPlayerBlue;
@ -121,12 +116,11 @@ private:
wrect_t m_crosshairRect;
struct model_s * m_MapSprite; // each layer image is saved in one sprite, where each tile is a sprite frame
struct model_s *m_MapSprite; // each layer image is saved in one sprite, where each tile is a sprite frame
float m_flNextObserverInput;
float m_zoomDelta;
float m_moveDelta;
int m_lastPrimaryObject;
int m_lastSecondaryObject;
int m_lastPrimaryObject;
int m_lastSecondaryObject;
};
#endif // SPECTATOR_H

View File

@ -29,11 +29,11 @@ extern float v_idlescale;
float in_fov;
extern void HUD_SetCmdBits( int bits );
int CHud::UpdateClientData(client_data_t *cdata, float time)
int CHud::UpdateClientData( client_data_t *cdata, float time )
{
memcpy(m_vecOrigin, cdata->origin, sizeof(vec3_t));
memcpy(m_vecAngles, cdata->viewangles, sizeof(vec3_t));
memcpy( m_vecOrigin, cdata->origin, sizeof(vec3_t) );
memcpy( m_vecAngles, cdata->viewangles, sizeof(vec3_t) );
m_iKeyBits = CL_ButtonBits( 0 );
m_iWeaponBits = cdata->iWeaponBits;
@ -42,7 +42,7 @@ int CHud::UpdateClientData(client_data_t *cdata, float time)
Think();
cdata->fov = m_iFOV;
v_idlescale = m_iConcussionEffect;
CL_ResetButtonBits( m_iKeyBits );
@ -50,5 +50,3 @@ int CHud::UpdateClientData(client_data_t *cdata, float time)
// return 1 if in anything in the client_data struct has been changed, 0 otherwise
return 1;
}

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -14,11 +14,10 @@
#include "const.h"
#include "camera.h"
#include "in_defs.h"
#include "exportdef.h"
float CL_KeyState (kbutton_t *key);
float CL_KeyState( kbutton_t *key );
extern "C"
extern "C"
{
void DLLEXPORT CAM_Think( void );
int DLLEXPORT CL_IsThirdPerson( void );
@ -66,15 +65,14 @@ cvar_t *c_mindistance;
// pitch, yaw, dist
vec3_t cam_ofs;
// In third person
int cam_thirdperson;
int cam_mousemove; //true if we are moving the cam with the mouse, False if not
int iMouseInUse=0;
int iMouseInUse = 0;
int cam_distancemove;
extern int mouse_x, mouse_y; //used to determine what the current x and y values are
int cam_old_mouse_x, cam_old_mouse_y; //holds the last ticks mouse movement
POINT cam_mouse;
POINT cam_mouse;
//-------------------------------------------------- Local Variables
static kbutton_t cam_pitchup, cam_pitchdown, cam_yawleft, cam_yawright;
@ -87,7 +85,6 @@ void CAM_ToFirstPerson(void);
void CAM_StartDistance(void);
void CAM_EndDistance(void);
//-------------------------------------------------- Local Functions
float MoveToward( float cur, float goal, float maxspeed )
@ -118,7 +115,6 @@ float MoveToward( float cur, float goal, float maxspeed )
}
}
// bring cur back into range
if( cur < 0 )
cur += 360.0;
@ -128,7 +124,6 @@ float MoveToward( float cur, float goal, float maxspeed )
return cur;
}
//-------------------------------------------------- Gobal Functions
typedef struct
@ -138,12 +133,12 @@ typedef struct
vec3_t mins2, maxs2; // size when clipping against mosnters
float *start, *end;
trace_t trace;
int type;
int type;
edict_t *passedict;
qboolean monsterclip;
} moveclip_t;
extern trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end);
extern trace_t SV_ClipMoveToEntity( edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end );
void DLLEXPORT CAM_Think( void )
{
@ -158,16 +153,14 @@ void DLLEXPORT CAM_Think( void )
#endif
vec3_t viewangles;
switch( (int) cam_command->value )
switch( (int)cam_command->value )
{
case CAM_COMMAND_TOTHIRDPERSON:
CAM_ToThirdPerson();
break;
case CAM_COMMAND_TOFIRSTPERSON:
CAM_ToFirstPerson();
break;
case CAM_COMMAND_NONE:
default:
break;
@ -175,113 +168,108 @@ void DLLEXPORT CAM_Think( void )
if( !cam_thirdperson )
return;
#ifdef LATER
if ( cam_contain->value )
if( cam_contain->value )
{
gEngfuncs.GetClientOrigin( origin );
ext[0] = ext[1] = ext[2] = 0.0;
}
#endif
camAngles[ PITCH ] = cam_idealpitch->value;
camAngles[ YAW ] = cam_idealyaw->value;
camAngles[PITCH] = cam_idealpitch->value;
camAngles[YAW] = cam_idealyaw->value;
dist = cam_idealdist->value;
//
//movement of the camera with the mouse
//
if (cam_mousemove)
if( cam_mousemove )
{
//get windows cursor position
GetCursorPos (&cam_mouse);
//get windows cursor position
GetCursorPos( &cam_mouse );
//check for X delta values and adjust accordingly
//eventually adjust YAW based on amount of movement
//don't do any movement of the cam using YAW/PITCH if we are zooming in/out the camera
if (!cam_distancemove)
{
//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)
if (cam_mouse.x>gEngfuncs.GetWindowCenterX())
//don't do any movement of the cam using YAW/PITCH if we are zooming in/out the camera
if( !cam_distancemove )
{
//if ((camAngles[YAW]>=225.0)||(camAngles[YAW]<135.0))
if (camAngles[YAW]<c_maxyaw->value)
//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)
if( cam_mouse.x>gEngfuncs.GetWindowCenterX() )
{
camAngles[ YAW ] += (CAM_ANGLE_MOVE)*((cam_mouse.x-gEngfuncs.GetWindowCenterX())/2);
//if( ( camAngles[YAW] >= 225.0 ) || ( camAngles[YAW] < 135.0 ) )
if( camAngles[YAW] < c_maxyaw->value )
{
camAngles[YAW] += CAM_ANGLE_MOVE * ( ( cam_mouse.x - gEngfuncs.GetWindowCenterX() ) / 2 );
}
if( camAngles[YAW] > c_maxyaw->value )
{
camAngles[YAW] = c_maxyaw->value;
}
}
if (camAngles[YAW]>c_maxyaw->value)
else if( cam_mouse.x<gEngfuncs.GetWindowCenterX() )
{
camAngles[YAW]=c_maxyaw->value;
//if( ( camAngles[YAW] <= 135.0 ) || ( camAngles[YAW] > 225.0 ) )
if( camAngles[YAW] > c_minyaw->value )
{
camAngles[YAW] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterX() - cam_mouse.x ) / 2 );
}
if( camAngles[YAW] < c_minyaw->value )
{
camAngles[YAW] = c_minyaw->value;
}
}
}
else if (cam_mouse.x<gEngfuncs.GetWindowCenterX())
{
//if ((camAngles[YAW]<=135.0)||(camAngles[YAW]>225.0))
if (camAngles[YAW]>c_minyaw->value)
{
camAngles[ YAW ] -= (CAM_ANGLE_MOVE)* ((gEngfuncs.GetWindowCenterX()-cam_mouse.x)/2);
}
if (camAngles[YAW]<c_minyaw->value)
{
camAngles[YAW]=c_minyaw->value;
}
}
//check for y delta values and adjust accordingly
//eventually adjust PITCH based on amount of movement
//also make sure camera is within bounds
if (cam_mouse.y>gEngfuncs.GetWindowCenterY())
{
if(camAngles[PITCH]<c_maxpitch->value)
//check for y delta values and adjust accordingly
//eventually adjust PITCH based on amount of movement
//also make sure camera is within bounds
if( cam_mouse.y>gEngfuncs.GetWindowCenterY() )
{
camAngles[PITCH] +=(CAM_ANGLE_MOVE)* ((cam_mouse.y-gEngfuncs.GetWindowCenterY())/2);
if( camAngles[PITCH] < c_maxpitch->value )
{
camAngles[PITCH] += CAM_ANGLE_MOVE * ( ( cam_mouse.y - gEngfuncs.GetWindowCenterY() ) / 2 );
}
if( camAngles[PITCH] > c_maxpitch->value )
{
camAngles[PITCH] = c_maxpitch->value;
}
}
if (camAngles[PITCH]>c_maxpitch->value)
else if( cam_mouse.y<gEngfuncs.GetWindowCenterY() )
{
camAngles[PITCH]=c_maxpitch->value;
if( camAngles[PITCH] > c_minpitch->value )
{
camAngles[PITCH] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterY() - cam_mouse.y ) / 2 );
}
if( camAngles[PITCH] < c_minpitch->value )
{
camAngles[PITCH] = c_minpitch->value;
}
}
}
else if (cam_mouse.y<gEngfuncs.GetWindowCenterY())
{
if (camAngles[PITCH]>c_minpitch->value)
{
camAngles[PITCH] -= (CAM_ANGLE_MOVE)*((gEngfuncs.GetWindowCenterY()-cam_mouse.y)/2);
}
if (camAngles[PITCH]<c_minpitch->value)
{
camAngles[PITCH]=c_minpitch->value;
}
}
//set old mouse coordinates to current mouse coordinates
//since we are done with the mouse
if ( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )
{
cam_old_mouse_x=cam_mouse.x*flSensitivity;
cam_old_mouse_y=cam_mouse.y*flSensitivity;
//set old mouse coordinates to current mouse coordinates
//since we are done with the mouse
if( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )
{
cam_old_mouse_x = cam_mouse.x * flSensitivity;
cam_old_mouse_y = cam_mouse.y * flSensitivity;
}
else
{
cam_old_mouse_x = cam_mouse.x;
cam_old_mouse_y = cam_mouse.y;
}
SetCursorPos( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() );
}
else
{
cam_old_mouse_x=cam_mouse.x;
cam_old_mouse_y=cam_mouse.y;
}
SetCursorPos (gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
}
}
//Nathan code here
if( CL_KeyState( &cam_pitchup ) )
camAngles[ PITCH ] += CAM_ANGLE_DELTA;
camAngles[PITCH] += CAM_ANGLE_DELTA;
else if( CL_KeyState( &cam_pitchdown ) )
camAngles[ PITCH ] -= CAM_ANGLE_DELTA;
camAngles[PITCH] -= CAM_ANGLE_DELTA;
if( CL_KeyState( &cam_yawleft ) )
camAngles[ YAW ] -= CAM_ANGLE_DELTA;
camAngles[YAW] -= CAM_ANGLE_DELTA;
else if( CL_KeyState( &cam_yawright ) )
camAngles[ YAW ] += CAM_ANGLE_DELTA;
camAngles[YAW] += CAM_ANGLE_DELTA;
if( CL_KeyState( &cam_in ) )
{
@ -289,44 +277,43 @@ void DLLEXPORT CAM_Think( void )
if( dist < CAM_MIN_DIST )
{
// If we go back into first person, reset the angle
camAngles[ PITCH ] = 0;
camAngles[ YAW ] = 0;
camAngles[PITCH] = 0;
camAngles[YAW] = 0;
dist = CAM_MIN_DIST;
}
}
else if( CL_KeyState( &cam_out ) )
dist += CAM_DIST_DELTA;
if (cam_distancemove)
if( cam_distancemove )
{
if (cam_mouse.y>gEngfuncs.GetWindowCenterY())
if( cam_mouse.y > gEngfuncs.GetWindowCenterY() )
{
if(dist<c_maxdistance->value)
if( dist < c_maxdistance->value )
{
dist +=CAM_DIST_DELTA * ((cam_mouse.y-gEngfuncs.GetWindowCenterY())/2);
dist += CAM_DIST_DELTA * ( ( cam_mouse.y - gEngfuncs.GetWindowCenterY() ) / 2);
}
if (dist>c_maxdistance->value)
if( dist > c_maxdistance->value )
{
dist=c_maxdistance->value;
dist = c_maxdistance->value;
}
}
else if (cam_mouse.y<gEngfuncs.GetWindowCenterY())
else if( cam_mouse.y < gEngfuncs.GetWindowCenterY() )
{
if (dist>c_mindistance->value)
if( dist > c_mindistance->value )
{
dist -= (CAM_DIST_DELTA)*((gEngfuncs.GetWindowCenterY()-cam_mouse.y)/2);
dist -= CAM_DIST_DELTA * ( ( gEngfuncs.GetWindowCenterY() - cam_mouse.y ) / 2 );
}
if (dist<c_mindistance->value)
if ( dist < c_mindistance->value )
{
dist=c_mindistance->value;
dist = c_mindistance->value;
}
}
//set old mouse coordinates to current mouse coordinates
//since we are done with the mouse
cam_old_mouse_x=cam_mouse.x*gHUD.GetSensitivity();
cam_old_mouse_y=cam_mouse.y*gHUD.GetSensitivity();
SetCursorPos (gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
cam_old_mouse_x = cam_mouse.x * gHUD.GetSensitivity();
cam_old_mouse_y = cam_mouse.y * gHUD.GetSensitivity();
SetCursorPos( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() );
}
#ifdef LATER
if( cam_contain->value )
@ -334,17 +321,17 @@ void DLLEXPORT CAM_Think( void )
// check new ideal
VectorCopy( origin, pnt );
AngleVectors( camAngles, camForward, camRight, camUp );
for (i=0 ; i<3 ; i++)
pnt[i] += -dist*camForward[i];
for( i = 0; i < 3; i++ )
pnt[i] += -dist * camForward[i];
// check line from r_refdef.vieworg to pnt
memset ( &clip, 0, sizeof ( moveclip_t ) );
memset( &clip, 0, sizeof(moveclip_t) );
clip.trace = SV_ClipMoveToEntity( sv.edicts, r_refdef.vieworg, ext, ext, pnt );
if( clip.trace.fraction == 1.0 )
{
// update ideal
cam_idealpitch->value = camAngles[ PITCH ];
cam_idealyaw->value = camAngles[ YAW ];
cam_idealpitch->value = camAngles[PITCH];
cam_idealyaw->value = camAngles[YAW];
cam_idealdist->value = dist;
}
}
@ -352,8 +339,8 @@ void DLLEXPORT CAM_Think( void )
#endif
{
// update ideal
cam_idealpitch->value = camAngles[ PITCH ];
cam_idealyaw->value = camAngles[ YAW ];
cam_idealpitch->value = camAngles[PITCH];
cam_idealyaw->value = camAngles[YAW];
cam_idealdist->value = dist;
}
@ -364,91 +351,136 @@ void DLLEXPORT CAM_Think( void )
if( cam_snapto->value )
{
camAngles[ YAW ] = cam_idealyaw->value + viewangles[ YAW ];
camAngles[ PITCH ] = cam_idealpitch->value + viewangles[ PITCH ];
camAngles[ 2 ] = cam_idealdist->value;
camAngles[YAW] = cam_idealyaw->value + viewangles[YAW];
camAngles[PITCH] = cam_idealpitch->value + viewangles[PITCH];
camAngles[2] = cam_idealdist->value;
}
else
{
if( camAngles[ YAW ] - viewangles[ YAW ] != cam_idealyaw->value )
camAngles[ YAW ] = MoveToward( camAngles[ YAW ], cam_idealyaw->value + viewangles[ YAW ], CAM_ANGLE_SPEED );
if( camAngles[YAW] - viewangles[YAW] != cam_idealyaw->value )
camAngles[YAW] = MoveToward( camAngles[YAW], cam_idealyaw->value + viewangles[YAW], CAM_ANGLE_SPEED );
if( camAngles[ PITCH ] - viewangles[ PITCH ] != cam_idealpitch->value )
camAngles[ PITCH ] = MoveToward( camAngles[ PITCH ], cam_idealpitch->value + viewangles[ PITCH ], CAM_ANGLE_SPEED );
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 )
camAngles[ 2 ] = cam_idealdist->value;
if( fabs( camAngles[2] - cam_idealdist->value ) < 2.0 )
camAngles[2] = cam_idealdist->value;
else
camAngles[ 2 ] += ( cam_idealdist->value - camAngles[ 2 ] ) / 4.0;
camAngles[2] += ( cam_idealdist->value - camAngles[2] ) / 4.0;
}
#ifdef LATER
if( cam_contain->value )
{
// Test new position
dist = camAngles[ ROLL ];
camAngles[ ROLL ] = 0;
dist = camAngles[ROLL];
camAngles[ROLL] = 0;
VectorCopy( origin, pnt );
AngleVectors( camAngles, camForward, camRight, camUp );
for (i=0 ; i<3 ; i++)
pnt[i] += -dist*camForward[i];
for( i = 0; i < 3; i++ )
pnt[i] += -dist * camForward[i];
// check line from r_refdef.vieworg to pnt
memset ( &clip, 0, sizeof ( moveclip_t ) );
memset( &clip, 0, sizeof(moveclip_t) );
ext[0] = ext[1] = ext[2] = 0.0;
clip.trace = SV_ClipMoveToEntity( sv.edicts, r_refdef.vieworg, ext, ext, pnt );
if( clip.trace.fraction != 1.0 )
return;
}
#endif
cam_ofs[ 0 ] = camAngles[ 0 ];
cam_ofs[ 1 ] = camAngles[ 1 ];
cam_ofs[ 2 ] = dist;
cam_ofs[0] = camAngles[0];
cam_ofs[1] = camAngles[1];
cam_ofs[2] = dist;
}
extern void KeyDown (kbutton_t *b); // HACK
extern void KeyUp (kbutton_t *b); // HACK
extern void KeyDown( kbutton_t *b ); // HACK
extern void KeyUp( kbutton_t *b ); // HACK
void CAM_PitchUpDown(void) { KeyDown( &cam_pitchup ); }
void CAM_PitchUpUp(void) { KeyUp( &cam_pitchup ); }
void CAM_PitchDownDown(void) { KeyDown( &cam_pitchdown ); }
void CAM_PitchDownUp(void) { KeyUp( &cam_pitchdown ); }
void CAM_YawLeftDown(void) { KeyDown( &cam_yawleft ); }
void CAM_YawLeftUp(void) { KeyUp( &cam_yawleft ); }
void CAM_YawRightDown(void) { KeyDown( &cam_yawright ); }
void CAM_YawRightUp(void) { KeyUp( &cam_yawright ); }
void CAM_InDown(void) { KeyDown( &cam_in ); }
void CAM_InUp(void) { KeyUp( &cam_in ); }
void CAM_OutDown(void) { KeyDown( &cam_out ); }
void CAM_OutUp(void) { KeyUp( &cam_out ); }
void CAM_PitchUpDown( void )
{
KeyDown( &cam_pitchup );
}
void CAM_ToThirdPerson(void)
{
void CAM_PitchUpUp( void )
{
KeyUp( &cam_pitchup );
}
void CAM_PitchDownDown( void )
{
KeyDown( &cam_pitchdown );
}
void CAM_PitchDownUp( void )
{
KeyUp( &cam_pitchdown );
}
void CAM_YawLeftDown( void )
{
KeyDown( &cam_yawleft );
}
void CAM_YawLeftUp( void )
{
KeyUp( &cam_yawleft );
}
void CAM_YawRightDown( void )
{
KeyDown( &cam_yawright );
}
void CAM_YawRightUp( void )
{
KeyUp( &cam_yawright );
}
void CAM_InDown( void )
{
KeyDown( &cam_in );
}
void CAM_InUp( void )
{
KeyUp( &cam_in );
}
void CAM_OutDown( void )
{
KeyDown( &cam_out );
}
void CAM_OutUp( void )
{
KeyUp( &cam_out );
}
void CAM_ToThirdPerson( void )
{
vec3_t viewangles;
#if !defined( _DEBUG )
if ( gEngfuncs.GetMaxClients() > 1 )
if( gEngfuncs.GetMaxClients() > 1 )
{
// no thirdperson in multiplayer.
return;
}
#endif
gEngfuncs.GetViewAngles( (float *)viewangles );
if( !cam_thirdperson )
{
cam_thirdperson = 1;
cam_ofs[ YAW ] = viewangles[ YAW ];
cam_ofs[ PITCH ] = viewangles[ PITCH ];
cam_ofs[ 2 ] = CAM_MIN_DIST;
cam_ofs[YAW] = viewangles[YAW];
cam_ofs[PITCH] = viewangles[PITCH];
cam_ofs[2] = CAM_MIN_DIST;
}
gEngfuncs.Cvar_SetValue( "cam_command", 0 );
}
void CAM_ToFirstPerson(void)
void CAM_ToFirstPerson( void )
{
cam_thirdperson = 0;
@ -482,19 +514,19 @@ void CAM_Init( void )
gEngfuncs.pfnAddCommand( "-camdistance", CAM_EndDistance );
gEngfuncs.pfnAddCommand( "snapto", CAM_ToggleSnapto );
cam_command = gEngfuncs.pfnRegisterVariable ( "cam_command", "0", 0 ); // tells camera to go to thirdperson
cam_snapto = gEngfuncs.pfnRegisterVariable ( "cam_snapto", "0", 0 ); // snap to thirdperson view
cam_idealyaw = gEngfuncs.pfnRegisterVariable ( "cam_idealyaw", "90", 0 ); // thirdperson yaw
cam_idealpitch = gEngfuncs.pfnRegisterVariable ( "cam_idealpitch", "0", 0 ); // thirperson pitch
cam_idealdist = gEngfuncs.pfnRegisterVariable ( "cam_idealdist", "64", 0 ); // thirdperson distance
cam_contain = gEngfuncs.pfnRegisterVariable ( "cam_contain", "0", 0 ); // contain camera to world
cam_command = gEngfuncs.pfnRegisterVariable( "cam_command", "0", 0 ); // tells camera to go to thirdperson
cam_snapto = gEngfuncs.pfnRegisterVariable( "cam_snapto", "0", 0 ); // snap to thirdperson view
cam_idealyaw = gEngfuncs.pfnRegisterVariable( "cam_idealyaw", "90", 0 ); // thirdperson yaw
cam_idealpitch = gEngfuncs.pfnRegisterVariable( "cam_idealpitch", "0", 0 ); // thirperson pitch
cam_idealdist = gEngfuncs.pfnRegisterVariable( "cam_idealdist", "64", 0 ); // thirdperson distance
cam_contain = gEngfuncs.pfnRegisterVariable( "cam_contain", "0", 0 ); // contain camera to world
c_maxpitch = gEngfuncs.pfnRegisterVariable ( "c_maxpitch", "90.0", 0 );
c_minpitch = gEngfuncs.pfnRegisterVariable ( "c_minpitch", "0.0", 0 );
c_maxyaw = gEngfuncs.pfnRegisterVariable ( "c_maxyaw", "135.0", 0 );
c_minyaw = gEngfuncs.pfnRegisterVariable ( "c_minyaw", "-135.0", 0 );
c_maxdistance = gEngfuncs.pfnRegisterVariable ( "c_maxdistance", "200.0", 0 );
c_mindistance = gEngfuncs.pfnRegisterVariable ( "c_mindistance", "30.0", 0 );
c_maxpitch = gEngfuncs.pfnRegisterVariable( "c_maxpitch", "90.0", 0 );
c_minpitch = gEngfuncs.pfnRegisterVariable( "c_minpitch", "0.0", 0 );
c_maxyaw = gEngfuncs.pfnRegisterVariable( "c_maxyaw", "135.0", 0 );
c_minyaw = gEngfuncs.pfnRegisterVariable( "c_minyaw", "-135.0", 0 );
c_maxdistance = gEngfuncs.pfnRegisterVariable( "c_maxdistance", "200.0", 0 );
c_mindistance = gEngfuncs.pfnRegisterVariable( "c_mindistance", "30.0", 0 );
}
void CAM_ClearStates( void )
@ -517,101 +549,100 @@ void CAM_ClearStates( void )
cam_snapto->value = 0;
cam_distancemove = 0;
cam_ofs[ 0 ] = 0.0;
cam_ofs[ 1 ] = 0.0;
cam_ofs[ 2 ] = CAM_MIN_DIST;
cam_ofs[0] = 0.0;
cam_ofs[1] = 0.0;
cam_ofs[2] = CAM_MIN_DIST;
cam_idealpitch->value = viewangles[ PITCH ];
cam_idealyaw->value = viewangles[ YAW ];
cam_idealpitch->value = viewangles[PITCH];
cam_idealyaw->value = viewangles[YAW];
cam_idealdist->value = CAM_MIN_DIST;
}
void CAM_StartMouseMove(void)
void CAM_StartMouseMove( void )
{
float flSensitivity;
//only move the cam with mouse if we are in third person.
if (cam_thirdperson)
if( cam_thirdperson )
{
//set appropriate flags and initialize the old mouse position
//variables for mouse camera movement
if (!cam_mousemove)
if( !cam_mousemove )
{
cam_mousemove=1;
iMouseInUse=1;
GetCursorPos (&cam_mouse);
cam_mousemove = 1;
iMouseInUse = 1;
GetCursorPos( &cam_mouse );
if ( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )
if( ( flSensitivity = gHUD.GetSensitivity() ) != 0 )
{
cam_old_mouse_x=cam_mouse.x*flSensitivity;
cam_old_mouse_y=cam_mouse.y*flSensitivity;
cam_old_mouse_x = cam_mouse.x * flSensitivity;
cam_old_mouse_y = cam_mouse.y * flSensitivity;
}
else
{
cam_old_mouse_x=cam_mouse.x;
cam_old_mouse_y=cam_mouse.y;
cam_old_mouse_x = cam_mouse.x;
cam_old_mouse_y = cam_mouse.y;
}
}
}
//we are not in 3rd person view..therefore do not allow camera movement
else
{
cam_mousemove=0;
iMouseInUse=0;
cam_mousemove = 0;
iMouseInUse = 0;
}
}
//the key has been released for camera movement
//tell the engine that mouse camera movement is off
void CAM_EndMouseMove(void)
void CAM_EndMouseMove( void )
{
cam_mousemove=0;
iMouseInUse=0;
cam_mousemove = 0;
iMouseInUse = 0;
}
//----------------------------------------------------------
//routines to start the process of moving the cam in or out
//using the mouse
//----------------------------------------------------------
void CAM_StartDistance(void)
void CAM_StartDistance( void )
{
//only move the cam with mouse if we are in third person.
if (cam_thirdperson)
if( cam_thirdperson )
{
//set appropriate flags and initialize the old mouse position
//variables for mouse camera movement
if (!cam_distancemove)
{
cam_distancemove=1;
cam_mousemove=1;
iMouseInUse=1;
GetCursorPos (&cam_mouse);
cam_old_mouse_x=cam_mouse.x*gHUD.GetSensitivity();
cam_old_mouse_y=cam_mouse.y*gHUD.GetSensitivity();
}
//set appropriate flags and initialize the old mouse position
//variables for mouse camera movement
if( !cam_distancemove )
{
cam_distancemove = 1;
cam_mousemove = 1;
iMouseInUse = 1;
GetCursorPos( &cam_mouse );
cam_old_mouse_x = cam_mouse.x * gHUD.GetSensitivity();
cam_old_mouse_y = cam_mouse.y * gHUD.GetSensitivity();
}
}
//we are not in 3rd person view..therefore do not allow camera movement
else
{
cam_distancemove=0;
cam_mousemove=0;
iMouseInUse=0;
{
cam_distancemove = 0;
cam_mousemove = 0;
iMouseInUse = 0;
}
}
//the key has been released for camera movement
//tell the engine that mouse camera movement is off
void CAM_EndDistance(void)
void CAM_EndDistance( void )
{
cam_distancemove=0;
cam_mousemove=0;
iMouseInUse=0;
cam_distancemove = 0;
cam_mousemove = 0;
iMouseInUse = 0;
}
int DLLEXPORT CL_IsThirdPerson( void )
{
return (cam_thirdperson ? 1 : 0) || (g_iUser1 && (g_iUser2 == gEngfuncs.GetLocalPlayer()->index) );
return ( cam_thirdperson ? 1 : 0 ) || ( g_iUser1 && ( g_iUser2 == gEngfuncs.GetLocalPlayer()->index ) );
}
void DLLEXPORT CL_CameraOffset( float *ofs )

View File

@ -1,13 +1,13 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright <EFBFBD> 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
@ -17,16 +17,16 @@
#define ROLL 2
#ifdef _WIN32
#define HSPRITE WINAPI_HSPRITE
#define HSPRITE HSPRITE_win32
#include <windows.h>
#undef HSPRITE
#else
typedef struct point_s{
typedef struct point_s
{
int x;
int y;
} POINT;
#define GetCursorPos(x)
#define SetCursorPos(x,y)
#endif
#endif

File diff suppressed because it is too large Load Diff

1607
cl_dll/input_goldsource.cpp Normal file

File diff suppressed because it is too large Load Diff

83
cl_dll/input_mouse.cpp Normal file
View File

@ -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();
}

79
cl_dll/input_mouse.h Normal file
View File

@ -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

View File

@ -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
#include "exportdef.h"
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 )
{
@ -135,7 +124,7 @@ void IN_ToggleButtons( float forwardmove, float sidemove )
}
}
void IN_ClientMoveEvent( float forwardmove, float sidemove )
void FWGSInput::IN_ClientMoveEvent( float forwardmove, float sidemove )
{
//gEngfuncs.Con_Printf("IN_MoveEvent\n");
@ -144,14 +133,14 @@ void IN_ClientMoveEvent( float forwardmove, float sidemove )
ac_movecount++;
}
void IN_ClientLookEvent( float relyaw, float relpitch )
void FWGSInput::IN_ClientLookEvent( float relyaw, float relpitch )
{
rel_yaw += relyaw;
rel_pitch += relpitch;
}
// Rotate camera and add move values to usercmd
void IN_Move( float frametime, usercmd_t *cmd )
void FWGSInput::IN_Move( float frametime, usercmd_t *cmd )
{
Vector viewangles;
bool fLadder = false;
@ -235,7 +224,7 @@ void IN_Move( float frametime, usercmd_t *cmd )
ac_movecount = 0;
}
extern "C" void DLLEXPORT IN_MouseEvent( int mstate )
void FWGSInput::IN_MouseEvent( int mstate )
{
static int mouse_oldbuttonstate;
// perform button actions
@ -257,37 +246,37 @@ extern "C" void DLLEXPORT IN_MouseEvent( int mstate )
// Stubs
extern "C" void DLLEXPORT IN_ClearStates( void )
void FWGSInput::IN_ClearStates( void )
{
//gEngfuncs.Con_Printf( "IN_ClearStates\n" );
}
extern "C" void DLLEXPORT IN_ActivateMouse( void )
void FWGSInput::IN_ActivateMouse( void )
{
//gEngfuncs.Con_Printf( "IN_ActivateMouse\n" );
}
extern "C" void DLLEXPORT IN_DeactivateMouse( void )
void FWGSInput::IN_DeactivateMouse( void )
{
//gEngfuncs.Con_Printf( "IN_DeactivateMouse\n" );
}
extern "C" void DLLEXPORT IN_Accumulate( void )
void FWGSInput::IN_Accumulate( void )
{
//gEngfuncs.Con_Printf( "IN_Accumulate\n" );
}
void IN_Commands( void )
void FWGSInput::IN_Commands( void )
{
//gEngfuncs.Con_Printf( "IN_Commands\n" );
}
void IN_Shutdown( void )
void FWGSInput::IN_Shutdown( void )
{
}
// Register cvars and reset data
void IN_Init( void )
void FWGSInput::IN_Init( void )
{
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE );
in_joystick = gEngfuncs.pfnRegisterVariable( "joystick", "0", FCVAR_ARCHIVE );

View File

@ -1,919 +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"
#define HSPRITE WINAPI_HSPRITE
#include "windows.h"
#undef HSPRITE
#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 (&current_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 (&current_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 ();
}

View File

@ -1,18 +1,16 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#pragma once
#if !defined( KBUTTONH )
#define KBUTTONH
#pragma once
typedef struct kbutton_s
{
int down[2]; // key nums holding it down
int state; // low bit is down state
int down[2]; // key nums holding it down
int state; // low bit is down state
} kbutton_t;
#endif // !KBUTTONH
#endif // !KBUTTONH

View File

@ -17,23 +17,22 @@
//
// generic menu handler
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include <string.h>
#include <stdio.h>
#define MAX_MENU_STRING 512
char g_szMenuString[MAX_MENU_STRING];
char g_szPrelocalisedMenuString[MAX_MENU_STRING];
int KB_ConvertString( char *in, char **ppout );
DECLARE_MESSAGE( m_Menu, ShowMenu );
DECLARE_MESSAGE( m_Menu, ShowMenu )
int CHudMenu :: Init( void )
int CHudMenu::Init( void )
{
gHUD.AddHudElem( this );
@ -44,31 +43,34 @@ int CHudMenu :: Init( void )
return 1;
}
void CHudMenu :: InitHUDData( void )
void CHudMenu::InitHUDData( void )
{
m_fMenuDisplayed = 0;
m_bitsValidSlots = 0;
Reset();
}
void CHudMenu :: Reset( void )
void CHudMenu::Reset( void )
{
g_szPrelocalisedMenuString[0] = 0;
m_fWaitingForMore = FALSE;
}
int CHudMenu :: VidInit( void )
int CHudMenu::VidInit( void )
{
return 1;
}
int CHudMenu :: Draw( float flTime )
int CHudMenu::Draw( float flTime )
{
int i;
// check for if menu is set to disappear
if ( m_flShutoffTime > 0 )
if( m_flShutoffTime > 0 )
{
if ( m_flShutoffTime <= gHUD.m_flTime )
{ // times up, shutoff
if( m_flShutoffTime <= gHUD.m_flTime )
{
// times up, shutoff
m_fMenuDisplayed = 0;
m_iFlags &= ~HUD_ACTIVE;
return 1;
@ -77,40 +79,38 @@ int CHudMenu :: Draw( float flTime )
// don't draw the menu if the scoreboard is being shown
// draw the menu, along the left-hand side of the screen
// count the number of newlines
int nlc = 0;
int i;
for ( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
for( i = 0; i < MAX_MENU_STRING && g_szMenuString[i] != '\0'; i++ )
{
if ( g_szMenuString[i] == '\n' )
if( g_szMenuString[i] == '\n' )
nlc++;
}
// center it
int y = (ScreenHeight/2) - ((nlc/2)*12) - 40; // make sure it is above the say text
int y = ( ScreenHeight / 2 ) - ( ( nlc / 2 ) * 12 ) - 40; // make sure it is above the say text
int x = 20;
i = 0;
while ( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' )
while( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' )
{
gHUD.DrawHudString( x, y, 320, g_szMenuString + i, 255, 255, 255 );
y += 12;
while ( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' && g_szMenuString[i] != '\n' )
while( i < MAX_MENU_STRING && g_szMenuString[i] != '\0' && g_szMenuString[i] != '\n' )
i++;
if ( g_szMenuString[i] == '\n' )
if( g_szMenuString[i] == '\n' )
i++;
}
return 1;
}
// selects an item from the menu
void CHudMenu :: SelectMenuItem( int menu_item )
void CHudMenu::SelectMenuItem( int menu_item )
{
// if menu_item is in a valid slot, send a menuselect command to the server
if ( (menu_item > 0) && (m_bitsValidSlots & (1 << (menu_item-1))) )
if( ( menu_item > 0 ) && ( m_bitsValidSlots & ( 1 << ( menu_item - 1 ) ) ) )
{
char szbuf[32];
sprintf( szbuf, "menuselect %d\n", menu_item );
@ -122,7 +122,6 @@ void CHudMenu :: SelectMenuItem( int menu_item )
}
}
// Message handler for ShowMenu message
// takes four values:
// short: a bitfield of keys that are valid input
@ -130,7 +129,7 @@ void CHudMenu :: SelectMenuItem( int menu_item )
// byte : a boolean, TRUE if there is more string yet to be received before displaying the menu, FALSE if it's the last string
// string: menu string to display
// if this message is never received, then scores will simply be the combined totals of the players.
int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
{
char *temp = NULL;
@ -140,31 +139,35 @@ int CHudMenu :: MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
int DisplayTime = READ_CHAR();
int NeedMore = READ_BYTE();
if ( DisplayTime > 0 )
if( DisplayTime > 0 )
m_flShutoffTime = DisplayTime + gHUD.m_flTime;
else
m_flShutoffTime = -1;
if ( m_bitsValidSlots )
if( m_bitsValidSlots )
{
if ( !m_fWaitingForMore ) // this is the start of a new menu
if( !m_fWaitingForMore ) // this is the start of a new menu
{
strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING );
}
else
{ // append to the current menu string
strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen(g_szPrelocalisedMenuString) );
{
// append to the current menu string
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)
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 ) );
if( !NeedMore )
{
// we have the whole string, so we can localise it now
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 ) )
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 );
}
}

View File

@ -29,20 +29,20 @@ 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)
int CHudMessage::Init( void )
{
HOOK_MESSAGE( HudText );
HOOK_MESSAGE( GameTitle );
gHUD.AddHudElem(this);
gHUD.AddHudElem( this );
Reset();
return 1;
};
}
int CHudMessage::VidInit( void )
{
@ -50,35 +50,33 @@ int CHudMessage::VidInit( void )
m_HUD_title_life = gHUD.GetSpriteIndex( "title_life" );
return 1;
};
}
void CHudMessage::Reset( void )
{
memset( m_pMessages, 0, sizeof( m_pMessages[0] ) * maxHUDMessages );
memset( m_startTime, 0, sizeof( m_startTime[0] ) * maxHUDMessages );
memset( m_pMessages, 0, sizeof(m_pMessages[0]) * maxHUDMessages );
memset( m_startTime, 0, sizeof(m_startTime[0]) * maxHUDMessages );
m_gameTitleTime = 0;
m_pGameTitle = NULL;
}
float CHudMessage::FadeBlend( float fadein, float fadeout, float hold, float localTime )
{
float fadeTime = fadein + hold;
float fadeBlend;
if ( localTime < 0 )
if( localTime < 0 )
return 0;
if ( localTime < fadein )
if( localTime < fadein )
{
fadeBlend = 1 - ((fadein - localTime) / fadein);
fadeBlend = 1 - ( ( fadein - localTime ) / fadein );
}
else if ( localTime > fadeTime )
else if( localTime > fadeTime )
{
if ( fadeout > 0 )
fadeBlend = 1 - ((localTime - fadeTime) / fadeout);
if( fadeout > 0 )
fadeBlend = 1 - ( ( localTime - fadeTime ) / fadeout );
else
fadeBlend = 0;
}
@ -89,42 +87,41 @@ float CHudMessage::FadeBlend( float fadein, float fadeout, float hold, float loc
}
int CHudMessage::XPosition( float x, int width, int totalWidth )
int CHudMessage::XPosition( float x, int width, int totalWidth )
{
int xPos;
if ( x == -1 )
if( x == -1 )
{
xPos = (ScreenWidth - width) / 2;
xPos = ( ScreenWidth - width ) / 2;
}
else
{
if ( x < 0 )
xPos = (1.0 + x) * ScreenWidth - totalWidth; // Alight right
if( x < 0 )
xPos = ( 1.0 + x ) * ScreenWidth - totalWidth; // Alight right
else
xPos = x * ScreenWidth;
}
if ( xPos + width > ScreenWidth )
if( xPos + width > ScreenWidth )
xPos = ScreenWidth - width;
else if ( xPos < 0 )
else if( xPos < 0 )
xPos = 0;
return xPos;
}
int CHudMessage::YPosition( float y, int height )
{
int yPos;
if ( y == -1 ) // Centered?
yPos = (ScreenHeight - height) * 0.5;
if( y == -1 ) // Centered?
yPos = ( ScreenHeight - height ) * 0.5;
else
{
// Alight bottom?
if ( y < 0 )
yPos = (1.0 + y) * ScreenHeight - height; // Alight bottom
yPos = ( 1.0 + y ) * ScreenHeight - height; // Alight bottom
else // align top
yPos = y * ScreenHeight;
}
@ -137,7 +134,6 @@ int CHudMessage::YPosition( float y, int height )
return yPos;
}
void CHudMessage::MessageScanNextChar( void )
{
int srcRed, srcGreen, srcBlue, destRed = 0, destGreen = 0, destBlue = 0;
@ -156,10 +152,9 @@ void CHudMessage::MessageScanNextChar( void )
destRed = destGreen = destBlue = 0;
blend = m_parms.fadeBlend;
break;
case 2:
m_parms.charTime += m_parms.pMessage->fadein;
if ( m_parms.charTime > m_parms.time )
if( m_parms.charTime > m_parms.time )
{
srcRed = srcGreen = srcBlue = 0;
blend = 0; // pure source
@ -185,23 +180,22 @@ void CHudMessage::MessageScanNextChar( void )
}
break;
}
if ( blend > 255 )
if( blend > 255 )
blend = 255;
else if ( blend < 0 )
else if( blend < 0 )
blend = 0;
m_parms.r = ((srcRed * (255-blend)) + (destRed * blend)) >> 8;
m_parms.g = ((srcGreen * (255-blend)) + (destGreen * blend)) >> 8;
m_parms.b = ((srcBlue * (255-blend)) + (destBlue * blend)) >> 8;
m_parms.r = ( ( srcRed * ( 255 - blend ) ) + ( destRed * blend ) ) >> 8;
m_parms.g = ( ( srcGreen * (255 - blend ) ) + ( destGreen * blend ) ) >> 8;
m_parms.b = ( ( srcBlue * ( 255 - blend ) ) + ( destBlue * blend ) ) >> 8;
if ( m_parms.pMessage->effect == 1 && m_parms.charTime != 0 )
if( m_parms.pMessage->effect == 1 && m_parms.charTime != 0 )
{
if ( m_parms.x >= 0 && m_parms.y >= 0 && (m_parms.x + gHUD.m_scrinfo.charWidths[ m_parms.text ]) <= ScreenWidth )
if( m_parms.x >= 0 && m_parms.y >= 0 && ( m_parms.x + gHUD.m_scrinfo.charWidths[m_parms.text] ) <= ScreenWidth )
TextMessageDrawChar( m_parms.x, m_parms.y, m_parms.text, m_parms.pMessage->r2, m_parms.pMessage->g2, m_parms.pMessage->b2 );
}
}
void CHudMessage::MessageScanStart( void )
{
switch( m_parms.pMessage->effect )
@ -212,14 +206,14 @@ void CHudMessage::MessageScanStart( void )
m_parms.fadeTime = m_parms.pMessage->fadein + m_parms.pMessage->holdtime;
if ( m_parms.time < m_parms.pMessage->fadein )
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.0 / m_parms.pMessage->fadein ) * 255 );
}
else if ( m_parms.time > m_parms.fadeTime )
else if( m_parms.time > m_parms.fadeTime )
{
if ( m_parms.pMessage->fadeout > 0 )
m_parms.fadeBlend = (((m_parms.time - m_parms.fadeTime) / m_parms.pMessage->fadeout) * 255);
if( m_parms.pMessage->fadeout > 0 )
m_parms.fadeBlend = ( ( ( m_parms.time - m_parms.fadeTime ) / m_parms.pMessage->fadeout) * 255);
else
m_parms.fadeBlend = 255; // Pure dest (off)
}
@ -227,15 +221,14 @@ void CHudMessage::MessageScanStart( void )
m_parms.fadeBlend = 0; // Pure source (on)
m_parms.charTime = 0;
if ( m_parms.pMessage->effect == 1 && (rand()%100) < 10 )
if( m_parms.pMessage->effect == 1 && ( rand() % 100 ) < 10 )
m_parms.charTime = 1;
break;
case 2:
m_parms.fadeTime = (m_parms.pMessage->fadein * m_parms.length) + m_parms.pMessage->holdtime;
if ( m_parms.time > m_parms.fadeTime && m_parms.pMessage->fadeout > 0 )
m_parms.fadeBlend = (((m_parms.time - m_parms.fadeTime) / m_parms.pMessage->fadeout) * 255);
m_parms.fadeBlend = ( ( ( m_parms.time - m_parms.fadeTime ) / m_parms.pMessage->fadeout ) * 255 );
else
m_parms.fadeBlend = 0;
break;
@ -257,12 +250,12 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
length = 0;
width = 0;
m_parms.totalWidth = 0;
while ( *pText )
while( *pText )
{
if ( *pText == '\n' )
if( *pText == '\n' )
{
m_parms.lines++;
if ( width > m_parms.totalWidth )
if( width > m_parms.totalWidth )
m_parms.totalWidth = width;
width = 0;
}
@ -272,8 +265,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
length++;
}
m_parms.length = length;
m_parms.totalHeight = (m_parms.lines * gHUD.m_scrinfo.iCharHeight);
m_parms.totalHeight = ( m_parms.lines * gHUD.m_scrinfo.iCharHeight );
m_parms.y = YPosition( pMessage->y, m_parms.totalHeight );
pText = pMessage->pMessage;
@ -282,11 +274,11 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
MessageScanStart();
for ( i = 0; i < m_parms.lines; i++ )
for( i = 0; i < m_parms.lines; i++ )
{
m_parms.lineLength = 0;
m_parms.width = 0;
while ( *pText && *pText != '\n' )
while( *pText && *pText != '\n' )
{
unsigned char c = *pText;
line[m_parms.lineLength] = c;
@ -299,13 +291,13 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
m_parms.x = XPosition( pMessage->x, m_parms.width, m_parms.totalWidth );
for ( j = 0; j < m_parms.lineLength; j++ )
for( j = 0; j < m_parms.lineLength; j++ )
{
m_parms.text = line[j];
int next = m_parms.x + gHUD.m_scrinfo.charWidths[ m_parms.text ];
int next = m_parms.x + gHUD.m_scrinfo.charWidths[m_parms.text];
MessageScanNextChar();
if ( m_parms.x >= 0 && m_parms.y >= 0 && next <= ScreenWidth )
if( m_parms.x >= 0 && m_parms.y >= 0 && next <= ScreenWidth )
TextMessageDrawChar( m_parms.x, m_parms.y, m_parms.text, m_parms.r, m_parms.g, m_parms.b );
m_parms.x = next;
}
@ -314,62 +306,60 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
}
}
int CHudMessage::Draw( float fTime )
{
int i, drawn;
client_textmessage_t *pMessage;
float endTime;
float endTime = 0.0f;
drawn = 0;
if ( m_gameTitleTime > 0 )
if( m_gameTitleTime > 0 )
{
float localTime = gHUD.m_flTime - m_gameTitleTime;
float brightness;
// Maybe timer isn't set yet
if ( m_gameTitleTime > gHUD.m_flTime )
if( m_gameTitleTime > gHUD.m_flTime )
m_gameTitleTime = gHUD.m_flTime;
if ( localTime > (m_pGameTitle->fadein + m_pGameTitle->holdtime + m_pGameTitle->fadeout) )
if( localTime > ( m_pGameTitle->fadein + m_pGameTitle->holdtime + m_pGameTitle->fadeout ) )
m_gameTitleTime = 0;
else
{
brightness = FadeBlend( m_pGameTitle->fadein, m_pGameTitle->fadeout, m_pGameTitle->holdtime, localTime );
int halfWidth = gHUD.GetSpriteRect(m_HUD_title_half).right - gHUD.GetSpriteRect(m_HUD_title_half).left;
int fullWidth = halfWidth + gHUD.GetSpriteRect(m_HUD_title_life).right - gHUD.GetSpriteRect(m_HUD_title_life).left;
int fullHeight = gHUD.GetSpriteRect(m_HUD_title_half).bottom - gHUD.GetSpriteRect(m_HUD_title_half).top;
int halfWidth = gHUD.GetSpriteRect( m_HUD_title_half ).right - gHUD.GetSpriteRect( m_HUD_title_half ).left;
int fullWidth = halfWidth + gHUD.GetSpriteRect( m_HUD_title_life ).right - gHUD.GetSpriteRect( m_HUD_title_life ).left;
int fullHeight = gHUD.GetSpriteRect( m_HUD_title_half ).bottom - gHUD.GetSpriteRect( m_HUD_title_half ).top;
int x = XPosition( m_pGameTitle->x, fullWidth, fullWidth );
int y = YPosition( m_pGameTitle->y, fullHeight );
SPR_Set( gHUD.GetSprite( m_HUD_title_half ), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect( m_HUD_title_half ) );
SPR_Set( gHUD.GetSprite(m_HUD_title_half), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );
SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(m_HUD_title_half) );
SPR_Set( gHUD.GetSprite(m_HUD_title_life), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );
SPR_DrawAdditive( 0, x + halfWidth, y, &gHUD.GetSpriteRect(m_HUD_title_life) );
SPR_Set( gHUD.GetSprite( m_HUD_title_life ), brightness * m_pGameTitle->r1, brightness * m_pGameTitle->g1, brightness * m_pGameTitle->b1 );
SPR_DrawAdditive( 0, x + halfWidth, y, &gHUD.GetSpriteRect( m_HUD_title_life ) );
drawn = 1;
}
}
// Fixup level transitions
for ( i = 0; i < maxHUDMessages; i++ )
for( i = 0; i < maxHUDMessages; i++ )
{
// Assume m_parms.time contains last time
if ( m_pMessages[i] )
if( m_pMessages[i] )
{
pMessage = m_pMessages[i];
if ( m_startTime[i] > gHUD.m_flTime )
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
}
}
for ( i = 0; i < maxHUDMessages; i++ )
for( i = 0; i < maxHUDMessages; i++ )
{
if ( m_pMessages[i] )
if( m_pMessages[i] )
{
pMessage = m_pMessages[i];
@ -380,14 +370,14 @@ int CHudMessage::Draw( float fTime )
case 1:
endTime = m_startTime[i] + pMessage->fadein + pMessage->fadeout + pMessage->holdtime;
break;
// Fade in is per character in scanning messages
case 2:
endTime = m_startTime[i] + (pMessage->fadein * strlen( pMessage->pMessage )) + pMessage->fadeout + pMessage->holdtime;
endTime = m_startTime[i] + ( pMessage->fadein * strlen( pMessage->pMessage ) ) + pMessage->fadeout + pMessage->holdtime;
break;
}
if ( fTime <= endTime )
if( fTime <= endTime )
{
float messageTime = fTime - m_startTime[i];
@ -410,29 +400,28 @@ int CHudMessage::Draw( float fTime )
// Remember the time -- to fix up level transitions
m_parms.time = gHUD.m_flTime;
// Don't call until we get another message
if ( !drawn )
if( !drawn )
m_iFlags &= ~HUD_ACTIVE;
return 1;
}
void CHudMessage::MessageAdd( const char *pName, float time )
{
int i,j;
int i, j;
client_textmessage_t *tempMessage;
for ( i = 0; i < maxHUDMessages; i++ )
for( i = 0; i < maxHUDMessages; i++ )
{
if ( !m_pMessages[i] )
if( !m_pMessages[i] )
{
// Trim off a leading # if it's there
if ( pName[0] == '#' )
tempMessage = TextMessageGet( pName+1 );
if( pName[0] == '#' )
tempMessage = TextMessageGet( pName + 1 );
else
tempMessage = TextMessageGet( pName );
// If we couldnt find it in the titles.txt, just create it
if ( !tempMessage )
if( !tempMessage )
{
g_pCustomMessage.effect = 2;
g_pCustomMessage.r1 = g_pCustomMessage.g1 = g_pCustomMessage.b1 = g_pCustomMessage.a1 = 100;
@ -453,18 +442,18 @@ void CHudMessage::MessageAdd( const char *pName, float time )
tempMessage = &g_pCustomMessage;
}
for ( j = 0; j < maxHUDMessages; j++ )
for( j = 0; j < maxHUDMessages; j++ )
{
if ( m_pMessages[j] )
if( m_pMessages[j] )
{
// is this message already in the list
if ( !strcmp( tempMessage->pMessage, m_pMessages[j]->pMessage ) )
if( !strcmp( tempMessage->pMessage, m_pMessages[j]->pMessage ) )
{
return;
}
// 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.0001 )
{
if ( fabs( tempMessage->x - m_pMessages[j]->x ) < 0.0001 )
{
@ -481,7 +470,6 @@ void CHudMessage::MessageAdd( const char *pName, float time )
}
}
int CHudMessage::MsgFunc_HudText( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
@ -489,48 +477,47 @@ int CHudMessage::MsgFunc_HudText( const char *pszName, int iSize, void *pbuf )
char *pString = READ_STRING();
MessageAdd( pString, gHUD.m_flTime );
// Remember the time -- to fix up level transitions
m_parms.time = gHUD.m_flTime;
// Turn on drawing
if ( !(m_iFlags & HUD_ACTIVE) )
if( !( m_iFlags & HUD_ACTIVE ) )
m_iFlags |= HUD_ACTIVE;
return 1;
}
int CHudMessage::MsgFunc_GameTitle( const char *pszName, int iSize, void *pbuf )
{
m_pGameTitle = TextMessageGet( "GAMETITLE" );
if ( m_pGameTitle != NULL )
if( m_pGameTitle != NULL )
{
m_gameTitleTime = gHUD.m_flTime;
// Turn on drawing
if ( !(m_iFlags & HUD_ACTIVE) )
if( !( m_iFlags & HUD_ACTIVE ) )
m_iFlags |= HUD_ACTIVE;
}
return 1;
}
void CHudMessage::MessageAdd(client_textmessage_t * newMessage )
void CHudMessage::MessageAdd( client_textmessage_t * newMessage )
{
m_parms.time = gHUD.m_flTime;
// Turn on drawing
if ( !(m_iFlags & HUD_ACTIVE) )
if( !( m_iFlags & HUD_ACTIVE ) )
m_iFlags |= HUD_ACTIVE;
for ( int i = 0; i < maxHUDMessages; i++ )
for( int i = 0; i < maxHUDMessages; i++ )
{
if ( !m_pMessages[i] )
if( !m_pMessages[i] )
{
m_pMessages[i] = newMessage;
m_startTime[i] = gHUD.m_flTime;
return;
}
}
}

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -9,6 +9,7 @@
#include "cl_util.h"
#include "cl_entity.h"
#include "triangleapi.h"
#include "overview.h"
// these are included for the math functions
#include "com_model.h"
@ -33,8 +34,8 @@ int CHudOverview::Init()
//-----------------------------------------------------------------------------
int CHudOverview::VidInit()
{
m_hsprPlayer = gEngfuncs.pfnSPR_Load("sprites/ring.spr");
m_hsprViewcone = gEngfuncs.pfnSPR_Load("sprites/camera.spr");
m_hsprPlayer = gEngfuncs.pfnSPR_Load( "sprites/ring.spr" );
m_hsprViewcone = gEngfuncs.pfnSPR_Load( "sprites/camera.spr" );
return 1;
}
@ -44,40 +45,42 @@ int CHudOverview::VidInit()
// Input : flTime -
// intermission -
//-----------------------------------------------------------------------------
int CHudOverview::Draw(float flTime)
int CHudOverview::Draw( float flTime )
{
#if 0
// only draw in overview mode
if (!gEngfuncs.Overview_GetOverviewState())
if( !gEngfuncs.Overview_GetOverviewState() )
return 1;
// make sure we have player info
gViewPort->GetAllPlayersInfo();
//gViewPort->GetAllPlayersInfo();
gHUD.m_Scoreboard.GetAllPlayersInfo();
// calculate player size on the overview
int x1, y1, x2, y2;
float v0[3]={0,0,0}, v1[3]={64,64,0};
gEngfuncs.Overview_WorldToScreen(v0, &x1, &y1);
gEngfuncs.Overview_WorldToScreen(v1, &x2, &y2);
float scale = abs(x2 - x1);
float v0[3] = { 0.0f }, v1[3] = { 64.0f, 64.0f };
gEngfuncs.Overview_WorldToScreen( v0, &x1, &y1 );
gEngfuncs.Overview_WorldToScreen( v1, &x2, &y2 );
float scale = abs( x2 - x1 );
// loop through all the players and draw them on the map
for (int i = 1; i < MAX_PLAYERS; i++)
for( int i = 1; i < MAX_PLAYERS; i++ )
{
cl_entity_t *pl = gEngfuncs.GetEntityByIndex(i);
cl_entity_t *pl = gEngfuncs.GetEntityByIndex( i );
if (pl && pl->player && pl->curstate.health > 0 && pl->curstate.solid != SOLID_NOT)
if( pl && pl->player && pl->curstate.health > 0 && pl->curstate.solid != SOLID_NOT )
{
int x, y, z = 0;
float v[3]={pl->origin[0], pl->origin[1], 0};
gEngfuncs.Overview_WorldToScreen(v, &x, &y);
float v[3] = { pl->origin[0], pl->origin[1], 0 };
gEngfuncs.Overview_WorldToScreen( v, &x, &y );
// hack in some team colors
float r, g, bc;
if (g_PlayerExtraInfo[i].teamnumber == 1)
if( g_PlayerExtraInfo[i].teamnumber == 1 )
{
r = 0.0f; g = 0.0f; bc = 1.0f;
}
else if (g_PlayerExtraInfo[i].teamnumber == 2)
else if( g_PlayerExtraInfo[i].teamnumber == 2 )
{
r = 1.0f; g = 0.0f; bc = 0.0f;
}
@ -88,50 +91,50 @@ int CHudOverview::Draw(float flTime)
}
// set the current texture
gEngfuncs.pTriAPI->SpriteTexture((struct model_s *)gEngfuncs.GetSpritePointer(m_hsprPlayer), 0);
gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprPlayer ), 0 );
// additive render mode
gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd);
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
// no culling
gEngfuncs.pTriAPI->CullFace(TRI_NONE);
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
// draw a square
gEngfuncs.pTriAPI->Begin(TRI_QUADS);
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
// set the color to be that of the team
gEngfuncs.pTriAPI->Color4f(r, g, bc, 1.0f);
gEngfuncs.pTriAPI->Color4f( r, g, bc, 1.0f );
// calculate rotational matrix
vec3_t a, b, angles;
float rmatrix[3][4]; // transformation matrix
VectorCopy(pl->angles, angles);
VectorCopy( pl->angles, angles );
angles[0] = 0.0f;
angles[1] += 90.f;
angles[1] = -angles[1];
angles[2] = 0.0f;
AngleMatrix(angles, rmatrix);
AngleMatrix( angles, rmatrix );
a[2] = 0;
a[0] = -scale; a[1] = -scale;
VectorTransform(a, rmatrix , b );
VectorTransform( a, rmatrix, b );
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
gEngfuncs.pTriAPI->Vertex3f(x + b[0], y + b[1], z);
gEngfuncs.pTriAPI->Vertex3f( x + b[0], y + b[1], z );
a[0]=-scale; a[1] = scale;
VectorTransform(a, rmatrix , b );
a[0] = -scale; a[1] = scale;
VectorTransform( a, rmatrix, b );
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z);
a[0]=scale; a[1] = scale;
VectorTransform(a, rmatrix , b );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z);
gEngfuncs.pTriAPI->Vertex3f( x + b[0], y + b[1], z );
a[0]=scale; a[1] = -scale;
VectorTransform(a, rmatrix , b );
a[0] = scale; a[1] = scale;
VectorTransform( a, rmatrix, b );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f( x + b[0], y + b[1], z );
a[0] = scale; a[1] = -scale;
VectorTransform( a, rmatrix, b );
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z);
gEngfuncs.pTriAPI->Vertex3f( x + b[0], y + b[1], z );
// finish up
gEngfuncs.pTriAPI->End();
@ -139,11 +142,11 @@ int CHudOverview::Draw(float flTime)
// draw the players name and health underneath
char string[256];
sprintf(string, "%s (%i%%)", g_PlayerInfoList[i].name, pl->curstate.health);
DrawConsoleString(x, y + (1.1 * scale), string);
sprintf( string, "%s (%i%%)", g_PlayerInfoList[i].name, pl->curstate.health );
DrawConsoleString( x, y + ( 1.1 * scale ), string );
}
}
#endif
return 1;
}
@ -152,9 +155,9 @@ int CHudOverview::Draw(float flTime)
//-----------------------------------------------------------------------------
void CHudOverview::InitHUDData()
{
// this block would force the spectator view to be on
// gEngfuncs.Overview_SetDrawOverview( 1 );
// gEngfuncs.Overview_SetDrawInset( 0 );
//this block would force the spectator view to be on
//gEngfuncs.Overview_SetDrawOverview( 1 );
//gEngfuncs.Overview_SetDrawInset( 0 );
}
#endif
#endif

View File

@ -1,14 +1,13 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 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
@ -19,13 +18,11 @@ public:
int Init();
int VidInit();
int Draw(float flTime);
int Draw( float flTime );
void InitHUDData( void );
private:
HSPRITE m_hsprPlayer;
HSPRITE m_hsprViewcone;
};
#endif // OVERVIEW_H

View File

@ -15,6 +15,7 @@
//
// parsemsg.cpp
//
typedef unsigned char byte;
#define true 1
@ -31,28 +32,27 @@ void BEGIN_READ( void *buf, int size )
gpBuf = (byte*)buf;
}
int READ_CHAR( void )
{
int c;
if (giRead + 1 > giSize)
int c;
if( giRead + 1 > giSize )
{
giBadRead = true;
return -1;
}
c = (signed char)gpBuf[giRead];
giRead++;
return c;
}
int READ_BYTE( void )
{
int c;
if (giRead+1 > giSize)
int c;
if( giRead + 1 > giSize )
{
giBadRead = true;
return -1;
@ -66,18 +66,18 @@ int READ_BYTE( void )
int READ_SHORT( void )
{
int c;
if (giRead+2 > giSize)
int c;
if( giRead + 2 > giSize )
{
giBadRead = true;
return -1;
}
c = (short)( gpBuf[giRead] + ( gpBuf[giRead+1] << 8 ) );
c = (short)( gpBuf[giRead] + ( gpBuf[giRead + 1] << 8 ) );
giRead += 2;
return c;
}
@ -86,21 +86,20 @@ int READ_WORD( void )
return READ_SHORT();
}
int READ_LONG( void )
{
int c;
if (giRead+4 > giSize)
int c;
if( giRead + 4 > giSize )
{
giBadRead = true;
return -1;
}
c = gpBuf[giRead] + (gpBuf[giRead + 1] << 8) + (gpBuf[giRead + 2] << 16) + (gpBuf[giRead + 3] << 24);
c = gpBuf[giRead] + ( gpBuf[giRead + 1] << 8 ) + ( gpBuf[giRead + 2] << 16 ) + ( gpBuf[giRead + 3] << 24 );
giRead += 4;
return c;
}
@ -108,59 +107,58 @@ float READ_FLOAT( void )
{
union
{
byte b[4];
float f;
int l;
byte b[4];
float f;
int l;
} dat;
dat.b[0] = gpBuf[giRead];
dat.b[1] = gpBuf[giRead+1];
dat.b[2] = gpBuf[giRead+2];
dat.b[3] = gpBuf[giRead+3];
giRead += 4;
// dat.l = LittleLong (dat.l);
return dat.f;
dat.b[0] = gpBuf[giRead];
dat.b[1] = gpBuf[giRead + 1];
dat.b[2] = gpBuf[giRead + 2];
dat.b[3] = gpBuf[giRead + 3];
giRead += 4;
//dat.l = LittleLong( dat.l );
return dat.f;
}
char* READ_STRING( void )
{
static char string[2048];
int l,c;
static char string[2048];
int l, c;
string[0] = 0;
l = 0;
do
{
if ( giRead+1 > giSize )
if( giRead+1 > giSize )
break; // no more characters
c = READ_CHAR();
if (c == -1 || c == 0)
c = READ_BYTE();
if( c == -1 || c == 0 )
break;
string[l] = c;
l++;
} while (l < sizeof(string)-1);
}while( l < sizeof(string) - 1 );
string[l] = 0;
return string;
}
float READ_COORD( void )
{
return (float)(READ_SHORT() * (1.0/8));
return (float)( READ_SHORT() * ( 1.0 / 8 ) );
}
float READ_ANGLE( void )
{
return (float)(READ_CHAR() * (360.0/256));
return (float)( READ_CHAR() * ( 360.0 / 256 ) );
}
float READ_HIRESANGLE( void )
{
return (float)(READ_SHORT() * (360.0/65536));
return (float)( READ_SHORT() * ( 360.0 / 65536 ) );
}

View File

@ -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

View File

@ -1,107 +1,107 @@
client dll readme.txt
-------------------------
This file details the structure of the half-life client dll, and
how it communicates with the half-life game engine.
Engine callback functions:
Drawing functions:
HSPRITE SPR_Load( char *picname );
Loads a sprite into memory, and returns a handle to it.
int SPR_Frames( HSPRITE sprite );
Returns the number of frames stored in the specified sprite.
int SPR_Height( HSPRITE x, int frame )
Returns the height, in pixels, of a sprite at the specified frame.
Returns 0 is the frame number or the sprite handle is invalid.
int SPR_Width( HSPRITE x, int f )
Returns the width, in pixels, of a sprite at the specified frame.
Returns 0 is the frame number or the sprite handle is invalid.
int SPR_Set( HSPRITE sprite, int r, int g, int b );
Prepares a sprite about to be drawn. RBG color values are applied to the sprite at this time.
void SPR_Draw( int frame, int x, int y );
Precondition: SPR_Set has already been called for a sprite.
Draws the currently active sprite to the screen, at position (x,y), where (0,0) is
the top left-hand corner of the screen.
void SPR_DrawHoles( int frame, int x, int y );
Precondition: SPR_Set has already been called for a sprite.
Draws the currently active sprite to the screen. Color index #255 is treated as transparent.
void SPR_DrawAdditive( int frame, int x, int y );
Precondition: SPR_Set has already been called for a sprite.
Draws the currently active sprite to the screen, adding it's color values to the background.
void SPR_EnableScissor( int x, int y, int width, int height );
Creates a clipping rectangle. No pixels will be drawn outside the specified area. Will
stay in effect until either the next frame, or SPR_DisableScissor is called.
void SPR_DisableScissor( void );
Disables the effect of an SPR_EnableScissor call.
int IsHighRes( void );
returns 1 if the res mode is 640x480 or higher; 0 otherwise.
int ScreenWidth( void );
returns the screen width, in pixels.
int ScreenHeight( void );
returns the screen height, in pixels.
// Sound functions
void PlaySound( char *szSound, int volume )
plays the sound 'szSound' at the specified volume. Loads the sound if it hasn't been cached.
If it can't find the sound, it displays an error message and plays no sound.
void PlaySound( int iSound, int volume )
Precondition: iSound has been precached.
Plays the sound, from the precache list.
// Communication functions
void SendClientCmd( char *szCmdString );
sends a command to the server, just as if the client had typed the szCmdString at the console.
char *GetPlayerName( int entity_number );
returns a pointer to a string, that contains the name of the specified client.
Returns NULL if the entity_number is not a client.
DECLARE_MESSAGE(), HOOK_MESSAGE()
These two macros bind the message sending between the entity DLL and the client DLL to
the CHud object.
HOOK_MESSAGE( message_name )
This is used inside CHud::Init(). It calls into the engine to hook that message
from the incoming message stream.
Precondition: There must be a function of name UserMsg_message_name declared
for CHud. Eg, CHud::UserMsg_Health() must be declared if you want to
use HOOK_MESSAGE( Health );
DECLARE_MESSAGE( message_name )
For each HOOK_MESSAGE you must have an equivalent DECLARE_MESSAGE. This creates
a function which passes the hooked messages into the CHud object.
HOOK_COMMAND(), DECLARE_COMMAND()
These two functions declare and hook console commands into the client dll.
HOOK_COMMAND( char *command, command_name )
Whenever the user types the 'command' at the console, the function 'command_name'
will be called.
Precondition: There must be a function of the name UserCmd_command_name declared
for CHud. Eg, CHud::UserMsg_ShowScores() must be declared if you want to
use HOOK_COMMAND( "+showscores", ShowScores );
DECLARE_COMMAND( command_name )
For each HOOK_COMMAND you must have an equivelant DECLARE_COMMAND. This creates
a function which passes the hooked commands into the CHud object.
client dll readme.txt
-------------------------
This file details the structure of the half-life client dll, and
how it communicates with the half-life game engine.
Engine callback functions:
Drawing functions:
HSPRITE SPR_Load( char *picname );
Loads a sprite into memory, and returns a handle to it.
int SPR_Frames( HSPRITE sprite );
Returns the number of frames stored in the specified sprite.
int SPR_Height( HSPRITE x, int frame )
Returns the height, in pixels, of a sprite at the specified frame.
Returns 0 is the frame number or the sprite handle is invalid.
int SPR_Width( HSPRITE x, int f )
Returns the width, in pixels, of a sprite at the specified frame.
Returns 0 is the frame number or the sprite handle is invalid.
int SPR_Set( HSPRITE sprite, int r, int g, int b );
Prepares a sprite about to be drawn. RBG color values are applied to the sprite at this time.
void SPR_Draw( int frame, int x, int y );
Precondition: SPR_Set has already been called for a sprite.
Draws the currently active sprite to the screen, at position (x,y), where (0,0) is
the top left-hand corner of the screen.
void SPR_DrawHoles( int frame, int x, int y );
Precondition: SPR_Set has already been called for a sprite.
Draws the currently active sprite to the screen. Color index #255 is treated as transparent.
void SPR_DrawAdditive( int frame, int x, int y );
Precondition: SPR_Set has already been called for a sprite.
Draws the currently active sprite to the screen, adding it's color values to the background.
void SPR_EnableScissor( int x, int y, int width, int height );
Creates a clipping rectangle. No pixels will be drawn outside the specified area. Will
stay in effect until either the next frame, or SPR_DisableScissor is called.
void SPR_DisableScissor( void );
Disables the effect of an SPR_EnableScissor call.
int IsHighRes( void );
returns 1 if the res mode is 640x480 or higher; 0 otherwise.
int ScreenWidth( void );
returns the screen width, in pixels.
int ScreenHeight( void );
returns the screen height, in pixels.
// Sound functions
void PlaySound( char *szSound, int volume )
plays the sound 'szSound' at the specified volume. Loads the sound if it hasn't been cached.
If it can't find the sound, it displays an error message and plays no sound.
void PlaySound( int iSound, int volume )
Precondition: iSound has been precached.
Plays the sound, from the precache list.
// Communication functions
void SendClientCmd( char *szCmdString );
sends a command to the server, just as if the client had typed the szCmdString at the console.
char *GetPlayerName( int entity_number );
returns a pointer to a string, that contains the name of the specified client.
Returns NULL if the entity_number is not a client.
DECLARE_MESSAGE(), HOOK_MESSAGE()
These two macros bind the message sending between the entity DLL and the client DLL to
the CHud object.
HOOK_MESSAGE( message_name )
This is used inside CHud::Init(). It calls into the engine to hook that message
from the incoming message stream.
Precondition: There must be a function of name UserMsg_message_name declared
for CHud. Eg, CHud::UserMsg_Health() must be declared if you want to
use HOOK_MESSAGE( Health );
DECLARE_MESSAGE( message_name )
For each HOOK_MESSAGE you must have an equivalent DECLARE_MESSAGE. This creates
a function which passes the hooked messages into the CHud object.
HOOK_COMMAND(), DECLARE_COMMAND()
These two functions declare and hook console commands into the client dll.
HOOK_COMMAND( char *command, command_name )
Whenever the user types the 'command' at the console, the function 'command_name'
will be called.
Precondition: There must be a function of the name UserCmd_command_name declared
for CHud. Eg, CHud::UserMsg_ShowScores() must be declared if you want to
use HOOK_COMMAND( "+showscores", ShowScores );
DECLARE_COMMAND( command_name )
For each HOOK_COMMAND you must have an equivelant DECLARE_COMMAND. This creates
a function which passes the hooked commands into the CHud object.

View File

@ -35,17 +35,17 @@ extern float *GetClientColor( int clientIndex );
#define LINE_START 10
static float SCROLL_SPEED = 5;
static char g_szLineBuffer[ MAX_LINES + 1 ][ MAX_CHARS_PER_LINE ];
static float *g_pflNameColors[ MAX_LINES + 1 ];
static int g_iNameLengths[ MAX_LINES + 1 ];
static char g_szLineBuffer[MAX_LINES + 1][MAX_CHARS_PER_LINE];
static float *g_pflNameColors[MAX_LINES + 1];
static int g_iNameLengths[MAX_LINES + 1];
static float flScrollTime = 0; // the time at which the lines next scroll up
static int Y_START = 0;
static int line_height = 0;
DECLARE_MESSAGE( m_SayText, SayText );
DECLARE_MESSAGE( m_SayText, SayText )
int CHudSayText :: Init( void )
int CHudSayText::Init( void )
{
gHUD.AddHudElem( this );
@ -53,7 +53,7 @@ int CHudSayText :: Init( void )
InitHUDData();
m_HUD_saytext = gEngfuncs.pfnRegisterVariable( "hud_saytext", "1", 0 );
m_HUD_saytext = gEngfuncs.pfnRegisterVariable( "hud_saytext", "1", 0 );
m_HUD_saytext_time = gEngfuncs.pfnRegisterVariable( "hud_saytext_time", "5", 0 );
m_iFlags |= HUD_INTERMISSION; // is always drawn during an intermission
@ -61,20 +61,18 @@ int CHudSayText :: Init( void )
return 1;
}
void CHudSayText :: InitHUDData( void )
void CHudSayText::InitHUDData( void )
{
memset( g_szLineBuffer, 0, sizeof g_szLineBuffer );
memset( g_pflNameColors, 0, sizeof g_pflNameColors );
memset( g_iNameLengths, 0, sizeof g_iNameLengths );
}
int CHudSayText :: VidInit( void )
int CHudSayText::VidInit( void )
{
return 1;
}
int ScrollTextUp( void )
{
ConsolePrint( g_szLineBuffer[0] ); // move the first line into the console buffer
@ -84,7 +82,7 @@ int ScrollTextUp( void )
memmove( &g_iNameLengths[0], &g_iNameLengths[1], sizeof(g_iNameLengths) - sizeof(g_iNameLengths[0]) );
g_szLineBuffer[MAX_LINES-1][0] = 0;
if ( g_szLineBuffer[0][0] == ' ' ) // also scroll up following lines
if( g_szLineBuffer[0][0] == ' ' ) // also scroll up following lines
{
g_szLineBuffer[0][0] = 2;
return 1 + ScrollTextUp();
@ -93,43 +91,43 @@ int ScrollTextUp( void )
return 1;
}
int CHudSayText :: Draw( float flTime )
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 );
if ( flScrollTime <= flTime )
if( flScrollTime <= flTime )
{
if ( *g_szLineBuffer[0] )
if( *g_szLineBuffer[0] )
{
flScrollTime = flTime + m_HUD_saytext_time->value;
// push the console up
ScrollTextUp();
}
else
{ // buffer is empty, just disable drawing of this section
{
// buffer is empty, just disable drawing of this section
m_iFlags &= ~HUD_ACTIVE;
}
}
for ( int i = 0; i < MAX_LINES; i++ )
for( int i = 0; i < MAX_LINES; i++ )
{
if ( *g_szLineBuffer[i] )
if( *g_szLineBuffer[i] )
{
if ( *g_szLineBuffer[i] == 2 && g_pflNameColors[i] )
if( *g_szLineBuffer[i] == 2 && g_pflNameColors[i] )
{
// it's a saytext string
static char buf[MAX_PLAYER_NAME_LENGTH+32];
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], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) );
buf[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 );
@ -146,30 +144,31 @@ int CHudSayText :: Draw( float flTime )
y += line_height;
}
return 1;
}
int CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf )
int CHudSayText::MsgFunc_SayText( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int client_index = READ_BYTE(); // the client who spoke the message
SayTextPrint( READ_STRING(), iSize - 1, client_index );
return 1;
}
void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex )
void CHudSayText::SayTextPrint( const char *pszBuf, int iBufSize, int clientIndex )
{
int i;
ConsolePrint( pszBuf );
// find an empty string slot
for ( i = 0; i < MAX_LINES; i++ )
for( i = 0; i < MAX_LINES; i++ )
{
if ( ! *g_szLineBuffer[i] )
if( !( *g_szLineBuffer[i] ) )
break;
}
if ( i == MAX_LINES )
if( i == MAX_LINES )
{
// force scroll buffer up
ScrollTextUp();
@ -180,30 +179,30 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
g_pflNameColors[i] = NULL;
// if it's a say message, search for the players name in the string
if ( *pszBuf == 2 && clientIndex > 0 )
if( *pszBuf == 2 && clientIndex > 0 )
{
GetPlayerInfo( clientIndex, &g_PlayerInfoList[clientIndex] );
const char *pName = g_PlayerInfoList[clientIndex].name;
if ( pName )
if( pName )
{
const char *nameInString = strstr( pszBuf, pName );
if ( nameInString )
if( nameInString )
{
g_iNameLengths[i] = strlen( pName ) + (nameInString - pszBuf);
g_iNameLengths[i] = strlen( pName ) + ( nameInString - pszBuf );
g_pflNameColors[i] = GetClientColor( clientIndex );
}
}
}
strncpy( g_szLineBuffer[i], pszBuf, max(iBufSize -1, MAX_CHARS_PER_LINE-1) );
strncpy( g_szLineBuffer[i], pszBuf, max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) );
// make sure the text fits in one line
EnsureTextFitsInOneLineAndWrapIfHaveTo( i );
// Set scroll time
if ( i == 0 )
if( i == 0 )
{
flScrollTime = gHUD.m_flTime + m_HUD_saytext_time->value;
}
@ -211,56 +210,57 @@ void CHudSayText :: SayTextPrint( const char *pszBuf, int iBufSize, int clientIn
m_iFlags |= HUD_ACTIVE;
PlaySound( "misc/talk.wav", 1 );
if ( ScreenHeight >= 480 )
if( ScreenHeight >= 480 )
Y_START = ScreenHeight - 60;
else
Y_START = ScreenHeight - 45;
Y_START -= (line_height * (MAX_LINES+1));
Y_START -= ( line_height * ( MAX_LINES + 1 ) );
}
void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
void CHudSayText::EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
{
int line_width = 0;
GetConsoleStringSize( g_szLineBuffer[line], &line_width, &line_height );
if ( (line_width + LINE_START) > MAX_LINE_WIDTH )
{ // string is too long to fit on line
if( ( line_width + LINE_START ) > MAX_LINE_WIDTH )
{
// string is too long to fit on line
// scan the string until we find what word is too long, and wrap the end of the sentence after the word
int length = LINE_START;
int tmp_len = 0;
char *last_break = NULL;
for ( char *x = g_szLineBuffer[line]; *x != 0; x++ )
for( char *x = g_szLineBuffer[line]; *x != 0; x++ )
{
// check for a color change, if so skip past it
if ( x[0] == '/' && x[1] == '(' )
if( x[0] == '/' && x[1] == '(' )
{
x += 2;
// skip forward until past mode specifier
while ( *x != 0 && *x != ')' )
x++;
if ( *x != 0 )
if( *x != 0 )
x++;
if ( *x == 0 )
if( *x == 0 )
break;
}
char buf[2];
buf[1] = 0;
if ( *x == ' ' && x != g_szLineBuffer[line] ) // store each line break, except for the very first character
if( *x == ' ' && x != g_szLineBuffer[line] ) // store each line break, except for the very first character
last_break = x;
buf[0] = *x; // get the length of the current character
GetConsoleStringSize( buf, &tmp_len, &line_height );
length += tmp_len;
if ( length > MAX_LINE_WIDTH )
{ // needs to be broken up
if ( !last_break )
last_break = x-1;
if( length > MAX_LINE_WIDTH )
{
// needs to be broken up
if( !last_break )
last_break = x - 1;
x = last_break;
@ -268,33 +268,33 @@ void CHudSayText :: EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
int j;
do
{
for ( j = 0; j < MAX_LINES; j++ )
for( j = 0; j < MAX_LINES; j++ )
{
if ( ! *g_szLineBuffer[j] )
if( !( *g_szLineBuffer[j] ) )
break;
}
if ( j == MAX_LINES )
if( j == MAX_LINES )
{
// need to make more room to display text, scroll stuff up then fix the pointers
int linesmoved = ScrollTextUp();
line -= linesmoved;
last_break = last_break - (sizeof(g_szLineBuffer[0]) * linesmoved);
last_break = last_break - ( sizeof(g_szLineBuffer[0]) * linesmoved );
}
}
while ( j == MAX_LINES );
while( j == MAX_LINES );
// copy remaining string into next buffer, making sure it starts with a space character
if ( (char)*last_break == (char)' ' )
if( (char)*last_break == (char)' ' )
{
int linelen = strlen(g_szLineBuffer[j]);
int remaininglen = strlen(last_break);
int linelen = strlen( g_szLineBuffer[j] );
int remaininglen = strlen( last_break );
if ( (linelen - remaininglen) <= MAX_CHARS_PER_LINE )
if( ( linelen - remaininglen ) <= MAX_CHARS_PER_LINE )
strcat( g_szLineBuffer[j], last_break );
}
else
{
if ( (strlen(g_szLineBuffer[j]) - strlen(last_break) - 2) < MAX_CHARS_PER_LINE )
if ( ( strlen( g_szLineBuffer[j] ) - strlen( last_break ) - 2 ) < MAX_CHARS_PER_LINE )
{
strcat( g_szLineBuffer[j], " " );
strcat( g_szLineBuffer[j], last_break );

View File

@ -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;
@ -90,7 +92,7 @@ We have a minimum width of 1-320 - we could have the field widths scale with it?
// X positions
// relative to the side of the scoreboard
#define NAME_RANGE_MIN 20
#define NAME_RANGE_MIN -100
#define NAME_RANGE_MAX 145
#define KILLS_RANGE_MIN 130
#define KILLS_RANGE_MAX 170
@ -143,21 +145,22 @@ int CHudScoreboard::Draw( float fTime )
int xpos = NAME_RANGE_MIN + xpos_rel;
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 );
FAR_RIGHT += 125;
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;
@ -272,7 +275,7 @@ int CHudScoreboard::Draw( float fTime )
}
// 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 +283,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 +303,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
@ -337,7 +340,7 @@ 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;
FAR_RIGHT += 125;
// draw the players, in order, and restricted to team if set
while( 1 )
@ -400,7 +403,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
}
// 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 +411,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 +438,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

View File

@ -15,11 +15,10 @@
//
// $NoKeywords: $
//=============================================================================
#define HSPRITE WINAPI_HSPRITE
#include <windows.h>
#include <dsound.h>
#include <mmsystem.h>
#undef HSPRITE
#include "r_studioint.h"
extern engine_studio_api_t IEngineStudio;
@ -30,9 +29,9 @@ extern engine_studio_api_t IEngineStudio;
#define ENGINE_LAUNCHER_API_VERSION 1
LPDIRECTSOUND lpDS = NULL;
LPDIRECTSOUNDBUFFER lpDSBuf = NULL;
LPHWAVEOUT lpHW = NULL;
LPDIRECTSOUND lpDS = NULL;
LPDIRECTSOUNDBUFFER lpDSBuf = NULL;
LPHWAVEOUT lpHW = NULL;
static HMODULE hEngine = 0;
@ -118,10 +117,10 @@ int Eng_LoadFunctions( HMODULE hMod )
engine_api_func pfnEngineAPI;
pfnEngineAPI = ( engine_api_func )GetProcAddress( hMod, "Sys_EngineAPI" );
if ( !pfnEngineAPI )
if( !pfnEngineAPI )
return 0;
if ( !(*pfnEngineAPI)( ENGINE_LAUNCHER_API_VERSION, sizeof( engine_api_t ), &engineapi ) )
if( !(*pfnEngineAPI)( ENGINE_LAUNCHER_API_VERSION, sizeof( engine_api_t ), &engineapi ) )
return 0;
// All is okay
@ -134,11 +133,11 @@ int Eng_LoadFunctions( HMODULE hMod )
void LoadSoundAPIs( void )
{
hEngine = ::LoadLibrary( IEngineStudio.IsHardware() ? "hw.dll" : "sw.dll" );
if ( hEngine )
if( hEngine )
{
if ( Eng_LoadFunctions( hEngine ) )
if( Eng_LoadFunctions( hEngine ) )
{
if ( engineapi.S_GetDSPointer && engineapi.S_GetWAVPointer )
if( engineapi.S_GetDSPointer && engineapi.S_GetWAVPointer )
{
engineapi.S_GetDSPointer(&lpDS, &lpDSBuf);
lpHW = (HWAVEOUT FAR *)engineapi.S_GetWAVPointer();
@ -157,7 +156,7 @@ void ShutdownSoundAPIs( void )
FreeLibrary( hEngine );
hEngine = 0;
}
lpDS = 0;
lpDSBuf = 0;
lpHW = 0;

View File

@ -15,6 +15,7 @@
//
// status_icons.cpp
//
#include "hud.h"
#include "cl_util.h"
#include "const.h"
@ -25,7 +26,7 @@
#include "parsemsg.h"
#include "event_api.h"
DECLARE_MESSAGE( m_StatusIcons, StatusIcon );
DECLARE_MESSAGE( m_StatusIcons, StatusIcon )
int CHudStatusIcons::Init( void )
{
@ -40,7 +41,6 @@ int CHudStatusIcons::Init( void )
int CHudStatusIcons::VidInit( void )
{
return 1;
}
@ -53,24 +53,24 @@ void CHudStatusIcons::Reset( void )
// Draw status icons along the left-hand side of the screen
int CHudStatusIcons::Draw( float flTime )
{
if (gEngfuncs.IsSpectateOnly())
if( gEngfuncs.IsSpectateOnly() )
return 1;
// find starting position to draw from, along right-hand side of screen
int x = 5;
int y = ScreenHeight / 2;
// loop through icon list, and draw any valid icons drawing up from the middle of screen
for ( int i = 0; i < MAX_ICONSPRITES; i++ )
for( int i = 0; i < MAX_ICONSPRITES; i++ )
{
if ( m_IconList[i].spr )
if( m_IconList[i].spr )
{
y -= ( m_IconList[i].rc.bottom - m_IconList[i].rc.top ) + 5;
SPR_Set( m_IconList[i].spr, m_IconList[i].r, m_IconList[i].g, m_IconList[i].b );
SPR_DrawAdditive( 0, x, y, &m_IconList[i].rc );
}
}
return 1;
}
@ -87,7 +87,7 @@ int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *p
int ShouldEnable = READ_BYTE();
char *pszIconName = READ_STRING();
if ( ShouldEnable )
if( ShouldEnable )
{
int r = READ_BYTE();
int g = READ_BYTE();
@ -104,28 +104,29 @@ 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;
// check to see if the sprite is in the current list
for ( i = 0; i < MAX_ICONSPRITES; i++ )
for( i = 0; i < MAX_ICONSPRITES; i++ )
{
if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
if( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
break;
}
if ( i == MAX_ICONSPRITES )
if( i == MAX_ICONSPRITES )
{
// icon not in list, so find an empty slot to add to
for ( i = 0; i < MAX_ICONSPRITES; i++ )
for( i = 0; i < MAX_ICONSPRITES; i++ )
{
if ( !m_IconList[i].spr )
if( !m_IconList[i].spr )
break;
}
}
// if we've run out of space in the list, overwrite the first icon
if ( i == MAX_ICONSPRITES )
if( i == MAX_ICONSPRITES )
{
i = 0;
}
@ -141,19 +142,19 @@ void CHudStatusIcons::EnableIcon( char *pszIconName, unsigned char red, unsigned
strcpy( m_IconList[i].szSpriteName, pszIconName );
// Hack: Play Timer sound when a grenade icon is played (in 0.8 seconds)
if ( strstr(m_IconList[i].szSpriteName, "grenade") )
if( strstr(m_IconList[i].szSpriteName, "grenade") )
{
cl_entity_t *pthisplayer = gEngfuncs.GetLocalPlayer();
gEngfuncs.pEventAPI->EV_PlaySound( pthisplayer->index, pthisplayer->origin, CHAN_STATIC, "weapons/timer.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
}
}
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++ )
for( int i = 0; i < MAX_ICONSPRITES; i++ )
{
if ( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
if( !stricmp( m_IconList[i].szSpriteName, pszIconName ) )
{
// clear the item from the list
memset( &m_IconList[i], 0, sizeof(icon_sprite_t) );

View File

@ -26,15 +26,15 @@
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE( m_StatusBar, StatusText );
DECLARE_MESSAGE( m_StatusBar, StatusValue );
DECLARE_MESSAGE( m_StatusBar, StatusText )
DECLARE_MESSAGE( m_StatusBar, StatusValue )
#define STATUSBAR_ID_LINE 1
float *GetClientColor( int clientIndex );
extern float g_ColorYellow[3];
int CHudStatusBar :: Init( void )
int CHudStatusBar::Init( void )
{
gHUD.AddHudElem( this );
@ -48,19 +48,18 @@ int CHudStatusBar :: Init( void )
return 1;
}
int CHudStatusBar :: VidInit( void )
int CHudStatusBar::VidInit( void )
{
// Load sprites here
return 1;
}
void CHudStatusBar :: Reset( void )
void CHudStatusBar::Reset( void )
{
int i = 0;
m_iFlags &= ~HUD_ACTIVE; // start out inactive
for ( i = 0; i < MAX_STATUSBAR_LINES; i++ )
for( i = 0; i < MAX_STATUSBAR_LINES; i++ )
m_szStatusText[i][0] = 0;
memset( m_iStatusValues, 0, sizeof m_iStatusValues );
@ -71,11 +70,10 @@ void CHudStatusBar :: Reset( void )
m_pflNameColors[i] = g_ColorYellow;
}
void CHudStatusBar :: ParseStatusString( int line_num )
void CHudStatusBar::ParseStatusString( int line_num )
{
// localise string first
char szBuffer[MAX_STATUSTEXT_LENGTH];
memset( szBuffer, 0, sizeof szBuffer );
char szBuffer[MAX_STATUSTEXT_LENGTH] = {0};
gHUD.m_TextMessage.LocaliseTextString( m_szStatusText[line_num], szBuffer, MAX_STATUSTEXT_LENGTH );
// parse m_szStatusText & m_iStatusValues into m_szStatusBar
@ -85,29 +83,31 @@ void CHudStatusBar :: ParseStatusString( int line_num )
char *src_start = src, *dst_start = dst;
while ( *src != 0 )
while( *src != 0 )
{
while ( *src == '\n' )
while( *src == '\n' )
src++; // skip over any newlines
if ( ((src - src_start) >= MAX_STATUSTEXT_LENGTH) || ((dst - dst_start) >= MAX_STATUSTEXT_LENGTH) )
if( ( ( src - src_start ) >= MAX_STATUSTEXT_LENGTH ) || ( ( dst - dst_start ) >= MAX_STATUSTEXT_LENGTH ) )
break;
int index = atoi( src );
// should we draw this line?
if ( (index >= 0 && index < MAX_STATUSBAR_VALUES) && (m_iStatusValues[index] != 0) )
{ // parse this line and append result to the status bar
if( ( index >= 0 && index < MAX_STATUSBAR_VALUES ) && ( m_iStatusValues[index] != 0 ) )
{
// parse this line and append result to the status bar
while ( *src >= '0' && *src <= '9' )
src++;
if ( *src == '\n' || *src == 0 )
if( *src == '\n' || *src == 0 )
continue; // no more left in this text line
// copy the text, char by char, until we hit a % or a \n
while ( *src != '\n' && *src != 0 )
while( *src != '\n' && *src != 0 )
{
if ( *src != '%' )
{ // just copy the character
if( *src != '%' )
{
// just copy the character
*dst = *src;
dst++, src++;
}
@ -126,20 +126,20 @@ void CHudStatusBar :: ParseStatusString( int line_num )
// move over descriptor, then get and move over the index
index = atoi( ++src );
while ( *src >= '0' && *src <= '9' )
while( *src >= '0' && *src <= '9' )
src++;
if ( index >= 0 && index < MAX_STATUSBAR_VALUES )
if( index >= 0 && index < MAX_STATUSBAR_VALUES )
{
int indexval = m_iStatusValues[index];
// get the string to substitute in place of the %XX
char szRepString[MAX_PLAYER_NAME_LENGTH];
switch ( valtype )
switch( valtype )
{
case 'p': // player name
GetPlayerInfo( indexval, &g_PlayerInfoList[indexval] );
if ( g_PlayerInfoList[indexval].name != NULL )
if( g_PlayerInfoList[indexval].name != NULL )
{
strncpy( szRepString, g_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH );
m_pflNameColors[line_num] = GetClientColor( indexval );
@ -148,7 +148,6 @@ void CHudStatusBar :: ParseStatusString( int line_num )
{
strcpy( szRepString, "******" );
}
break;
case 'i': // number
sprintf( szRepString, "%d", indexval );
@ -157,7 +156,7 @@ void CHudStatusBar :: ParseStatusString( int line_num )
szRepString[0] = 0;
}
for ( char *cp = szRepString; *cp != 0 && ((dst - dst_start) < MAX_STATUSTEXT_LENGTH); cp++, dst++ )
for( char *cp = szRepString; *cp != 0 && ( ( dst - dst_start ) < MAX_STATUSTEXT_LENGTH ); cp++, dst++ )
*dst = *cp;
}
}
@ -166,17 +165,17 @@ void CHudStatusBar :: ParseStatusString( int line_num )
else
{
// skip to next line of text
while ( *src != 0 && *src != '\n' )
while( *src != 0 && *src != '\n' )
src++;
}
}
}
int CHudStatusBar :: Draw( float fTime )
int CHudStatusBar::Draw( float fTime )
{
if ( m_bReparseString )
if( m_bReparseString )
{
for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ )
for( int i = 0; i < MAX_STATUSBAR_LINES; i++ )
{
m_pflNameColors[i] = g_ColorYellow;
ParseStatusString( i );
@ -184,10 +183,10 @@ int CHudStatusBar :: Draw( float fTime )
m_bReparseString = FALSE;
}
int Y_START = ScreenHeight - YRES(32 + 4);
int Y_START = ScreenHeight - YRES( 32 + 4 );
// Draw the status bar lines
for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ )
for( int i = 0; i < MAX_STATUSBAR_LINES; i++ )
{
int TextHeight, TextWidth;
GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight );
@ -196,13 +195,13 @@ int CHudStatusBar :: Draw( float fTime )
int y = Y_START - ( 4 + TextHeight * i ); // draw along bottom of screen
// let user set status ID bar centering
if ( (i == STATUSBAR_ID_LINE) && CVAR_GET_FLOAT("hud_centerid") )
if( ( i == STATUSBAR_ID_LINE ) && CVAR_GET_FLOAT( "hud_centerid" ) )
{
x = max( 0, max(2, (ScreenWidth - TextWidth)) / 2 );
y = (ScreenHeight / 2) + (TextHeight*CVAR_GET_FLOAT("hud_centerid"));
x = max( 0, max( 2, ( ScreenWidth - TextWidth ) ) / 2 );
y = ( ScreenHeight / 2 ) + ( TextHeight * CVAR_GET_FLOAT( "hud_centerid" ) );
}
if ( m_pflNameColors[i] )
if( m_pflNameColors[i] )
DrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] );
DrawConsoleString( x, y, m_szStatusBar[i] );
@ -223,19 +222,19 @@ int CHudStatusBar :: Draw( float fTime )
// if StatusValue[slotnum] != 0, the following string is drawn, upto the next newline - otherwise the text is skipped upto next newline
// %pX, where X is an integer, will substitute a player name here, getting the player index from StatusValue[X]
// %iX, where X is an integer, will substitute a number here, getting the number from StatusValue[X]
int CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *pbuf )
int CHudStatusBar::MsgFunc_StatusText( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int line = READ_BYTE();
if ( line < 0 || line >= MAX_STATUSBAR_LINES )
if( line < 0 || line >= MAX_STATUSBAR_LINES )
return 1;
strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH );
m_szStatusText[line][MAX_STATUSTEXT_LENGTH-1] = 0; // ensure it's null terminated ( strncpy() won't null terminate if read string too long)
m_szStatusText[line][MAX_STATUSTEXT_LENGTH - 1] = 0; // ensure it's null terminated ( strncpy() won't null terminate if read string too long)
if ( m_szStatusText[0] == 0 )
if( m_szStatusText[0] == 0 )
m_iFlags &= ~HUD_ACTIVE;
else
m_iFlags |= HUD_ACTIVE; // we have status text, so turn on the status bar
@ -249,17 +248,17 @@ int CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *p
// accepts two values:
// byte: index into the status value array
// short: value to store
int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf )
int CHudStatusBar::MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
int index = READ_BYTE();
if ( index < 1 || index >= MAX_STATUSBAR_VALUES )
if( index < 1 || index >= MAX_STATUSBAR_VALUES )
return 1; // index out of range
m_iStatusValues[index] = READ_SHORT();
m_bReparseString = TRUE;
return 1;
}

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright <EFBFBD> 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -18,31 +18,31 @@ AngleMatrix
====================
*/
void AngleMatrix (const float *angles, float (*matrix)[4] )
void AngleMatrix( const float *angles, float (*matrix)[4] )
{
float angle;
float sr, sp, sy, cr, cp, cy;
angle = angles[YAW] * (M_PI*2 / 360);
sy = sin(angle);
cy = cos(angle);
angle = angles[PITCH] * (M_PI*2 / 360);
sp = sin(angle);
cp = cos(angle);
angle = angles[ROLL] * (M_PI*2 / 360);
sr = sin(angle);
cr = cos(angle);
float angle;
float sr, sp, sy, cr, cp, cy;
angle = angles[YAW] * ( M_PI*2 / 360 );
sy = sin( angle );
cy = cos( angle );
angle = angles[PITCH] * ( M_PI*2 / 360 );
sp = sin( angle );
cp = cos( angle );
angle = angles[ROLL] * ( M_PI*2 / 360 );
sr = sin( angle );
cr = cos( angle );
// matrix = (YAW * PITCH) * ROLL
matrix[0][0] = cp*cy;
matrix[1][0] = cp*sy;
matrix[0][0] = cp * cy;
matrix[1][0] = cp * sy;
matrix[2][0] = -sp;
matrix[0][1] = sr*sp*cy+cr*-sy;
matrix[1][1] = sr*sp*sy+cr*cy;
matrix[2][1] = sr*cp;
matrix[0][2] = (cr*sp*cy+-sr*-sy);
matrix[1][2] = (cr*sp*sy+-sr*cy);
matrix[2][2] = cr*cp;
matrix[0][1] = sr * sp * cy + cr * -sy;
matrix[1][1] = sr * sp * sy + cr * cy;
matrix[2][1] = sr * cp;
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;
@ -54,14 +54,14 @@ VectorCompare
====================
*/
int VectorCompare (const float *v1, const float *v2)
int VectorCompare( const float *v1, const float *v2 )
{
int i;
for (i=0 ; i<3 ; i++)
if (v1[i] != v2[i])
int i;
for( i = 0; i < 3; i++ )
if( v1[i] != v2[i] )
return 0;
return 1;
}
@ -71,7 +71,7 @@ CrossProduct
====================
*/
void CrossProduct (const float *v1, const float *v2, float *cross)
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];
@ -84,7 +84,7 @@ VectorTransform
====================
*/
void VectorTransform (const float *in1, float in2[3][4], float *out)
void VectorTransform( const float *in1, float in2[3][4], float *out )
{
out[0] = DotProduct(in1, in2[0]) + in2[0][3];
out[1] = DotProduct(in1, in2[1]) + in2[1][3];
@ -97,7 +97,7 @@ ConcatTransforms
================
*/
void ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
void ConcatTransforms( float in1[3][4], float in2[3][4], float out[3][4] )
{
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
in1[0][2] * in2[2][0];
@ -135,24 +135,24 @@ AngleQuaternion
*/
void AngleQuaternion( float *angles, vec4_t quaternion )
{
float angle;
float sr, sp, sy, cr, cp, cy;
float angle;
float sr, sp, sy, cr, cp, cy;
// FIXME: rescale the inputs to 1/2 angle
angle = angles[2] * 0.5;
sy = sin(angle);
cy = cos(angle);
sy = sin( angle );
cy = cos( angle );
angle = angles[1] * 0.5;
sp = sin(angle);
cp = cos(angle);
sp = sin( angle );
cp = cos( angle );
angle = angles[0] * 0.5;
sr = sin(angle);
cr = cos(angle);
sr = sin( angle );
cr = cos( angle );
quaternion[0] = sr*cp*cy-cr*sp*sy; // X
quaternion[1] = cr*sp*cy+sr*cp*sy; // Y
quaternion[2] = cr*cp*sy-sr*sp*cy; // Z
quaternion[3] = cr*cp*cy+sr*sp*sy; // W
quaternion[0] = sr * cp * cy - cr * sp * sy; // X
quaternion[1] = cr * sp * cy + sr * cp * sy; // Y
quaternion[2] = cr * cp * sy - sr * sp * cy; // Z
quaternion[3] = cr * cp * cy + sr * sp * sy; // W
}
/*
@ -164,42 +164,43 @@ QuaternionSlerp
void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )
{
int i;
float omega, cosom, sinom, sclp, sclq;
float omega, cosom, sinom, sclp, sclq;
// decide if one of the quaternions is backwards
float a = 0;
float b = 0;
for (i = 0; i < 4; i++)
for( i = 0; i < 4; i++ )
{
a += (p[i]-q[i])*(p[i]-q[i]);
b += (p[i]+q[i])*(p[i]+q[i]);
a += ( p[i] - q[i] ) * ( p[i] - q[i] );
b += ( p[i] + q[i] ) * ( p[i] + q[i] );
}
if (a > b)
if(a > b)
{
for (i = 0; i < 4; i++)
for( i = 0; i < 4; i++ )
{
q[i] = -q[i];
}
}
cosom = p[0]*q[0] + p[1]*q[1] + p[2]*q[2] + p[3]*q[3];
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.0 + cosom ) > 0.000001 )
{
if ((1.0 - cosom) > 0.000001)
if( ( 1.0 - cosom ) > 0.000001 )
{
omega = acos( cosom );
sinom = sin( omega );
sclp = sin( (1.0 - t)*omega) / sinom;
sclq = sin( t*omega ) / sinom;
sclp = sin( ( 1.0 - t ) * omega ) / sinom;
sclq = sin( t * omega ) / sinom;
}
else
{
sclp = 1.0 - t;
sclq = t;
}
for (i = 0; i < 4; i++) {
for( i = 0; i < 4; i++ )
{
qt[i] = sclp * p[i] + sclq * q[i];
}
}
@ -209,9 +210,9 @@ 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));
for (i = 0; i < 3; i++)
sclp = sin( ( 1.0 - t ) * ( 0.5 * M_PI ) );
sclq = sin( t * ( 0.5 * M_PI ) );
for( i = 0; i < 3; i++ )
{
qt[i] = sclp * p[i] + sclq * qt[i];
}
@ -248,4 +249,4 @@ MatrixCopy
void MatrixCopy( float in[3][4], float out[3][4] )
{
memcpy( out, in, sizeof( float ) * 3 * 4 );
}
}

View File

@ -1,15 +1,13 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright <EFBFBD> 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
@ -25,16 +23,15 @@
#define ROLL 2
#endif
#define FDotProduct( a, b ) (fabs((a[0])*(b[0])) + fabs((a[1])*(b[1])) + fabs((a[2])*(b[2])))
#define FDotProduct( a, b ) ( fabs( ( a[0] ) * ( b[0] ) ) + fabs( ( a[1] ) * ( b[1] ) ) + fabs( ( a[2] ) * ( b[2] ) ) )
void AngleMatrix (const float *angles, float (*matrix)[4] );
int VectorCompare (const float *v1, const float *v2);
void CrossProduct (const float *v1, const float *v2, float *cross);
void VectorTransform (const float *in1, float in2[3][4], float *out);
void ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
void AngleMatrix( const float *angles, float (*matrix)[4] );
int VectorCompare( const float *v1, const float *v2 );
void CrossProduct( const float *v1, const float *v2, float *cross );
void VectorTransform( const float *in1, float in2[3][4], float *out );
void ConcatTransforms( float in1[3][4], float in2[3][4], float out[3][4] );
void MatrixCopy( float in[3][4], float out[3][4] );
void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] );
void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt );
void AngleQuaternion( float *angles, vec4_t quaternion );
#endif // STUDIO_UTIL_H
#endif // STUDIO_UTIL_H

View File

@ -26,9 +26,9 @@
#include <stdio.h>
#include "parsemsg.h"
DECLARE_MESSAGE( m_TextMessage, TextMsg );
DECLARE_MESSAGE( m_TextMessage, TextMsg )
int CHudTextMessage::Init(void)
int CHudTextMessage::Init( void )
{
HOOK_MESSAGE( TextMsg );
@ -37,7 +37,7 @@ int CHudTextMessage::Init(void)
Reset();
return 1;
};
}
// Searches through the string for any msg names (indicated by a '#')
// any found are looked up in titles.txt and the new message substituted
@ -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 == '#' )
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;
}
@ -60,7 +61,7 @@ char *CHudTextMessage::LocaliseTextString( const char *msg, char *dst_buffer, in
// lookup msg name in titles.txt
client_textmessage_t *clmsg = TextMessageGet( word_buf );
if ( !clmsg || !(clmsg->pMessage) )
if( !clmsg || !( clmsg->pMessage ) )
{
src = word_start;
*dst = *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,45 +91,46 @@ 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 )
if( !msg )
return "";
// '#' character indicates this is a reference to a string in titles.txt, and not the string itself
if ( msg[0] == '#' )
if( msg[0] == '#' )
{
// this is a message name, so look up the real message
client_textmessage_t *clmsg = TextMessageGet( msg+1 );
client_textmessage_t *clmsg = TextMessageGet( msg + 1 );
if ( !clmsg || !(clmsg->pMessage) )
return (char*)msg; // lookup failed, so return the original string
if ( msg_dest )
if( !clmsg || !(clmsg->pMessage) )
return msg; // lookup failed, so return the original string
if( msg_dest )
{
// check to see if titles.txt info overrides msg destination
// if clmsg->effect is less than 0, then clmsg->effect holds -1 * message_destination
if ( clmsg->effect < 0 ) //
if( clmsg->effect < 0 ) //
*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;
{
// nothing special about this message, so just return the same string
return msg;
}
}
void StripEndNewlineFromString( char *str )
{
int s = strlen( str ) - 1;
if ( str[s] == '\n' || str[s] == '\r' )
if( str[s] == '\n' || str[s] == '\r' )
str[s] = 0;
}
@ -137,8 +138,8 @@ void StripEndNewlineFromString( char *str )
// returns a pointer to str
char* ConvertCRtoNL( char *str )
{
for ( char *ch = str; *ch != 0; ch++ )
if ( *ch == '\r' )
for( char *ch = str; *ch != 0; ch++ )
if( *ch == '\r' )
*ch = '\n';
return str;
}
@ -161,45 +162,39 @@ int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf
int msg_dest = READ_BYTE();
static char szBuf[6][128];
char *msg_text = LookupString( READ_STRING(), &msg_dest );
msg_text = strcpy( szBuf[0], msg_text );
#define MSG_BUF_SIZE 128
char szBuf[6][MSG_BUF_SIZE];
strncpy( szBuf[0], LookupString( READ_STRING(), &msg_dest ), MSG_BUF_SIZE - 1 );
szBuf[0][MSG_BUF_SIZE - 1] = '\0';
for( int i = 1; i <= 4; i++ )
{
// keep reading strings and using C format strings for subsituting the strings into the localised text string
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 )
switch( msg_dest )
{
case HUD_PRINTCENTER:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
CenterPrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTNOTIFY:
psz[0] = 1; // mark this message to go into the notify buffer
sprintf( psz+1, msg_text, sstr1, sstr2, sstr3, sstr4 );
snprintf( psz + 1, MSG_BUF_SIZE - 1, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
ConsolePrint( ConvertCRtoNL( psz ) );
break;
case HUD_PRINTTALK:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), MSG_BUF_SIZE );
break;
case HUD_PRINTCONSOLE:
sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
snprintf( psz, MSG_BUF_SIZE, szBuf[0], szBuf[1], szBuf[2], szBuf[3], szBuf[4] );
ConsolePrint( ConvertCRtoNL( psz ) );
break;
}

View File

@ -362,7 +362,6 @@ enum
// Silent Spy Feign
#define TF_SPY_SILENTDIE 199
/*==================================================*/
/* Defines for the ENGINEER's Building ability */
/*==================================================*/
@ -458,28 +457,28 @@ enum
// HL-compatible weapon numbers
#define WEAPON_HOOK 1
#define WEAPON_BIOWEAPON (WEAPON_HOOK+1)
#define WEAPON_MEDIKIT (WEAPON_HOOK+2)
#define WEAPON_SPANNER (WEAPON_HOOK+3)
#define WEAPON_AXE (WEAPON_HOOK+4)
#define WEAPON_SNIPER_RIFLE (WEAPON_HOOK+5)
#define WEAPON_AUTO_RIFLE (WEAPON_HOOK+6)
#define WEAPON_TF_SHOTGUN (WEAPON_HOOK+7)
#define WEAPON_SUPER_SHOTGUN (WEAPON_HOOK+8)
#define WEAPON_NAILGUN (WEAPON_HOOK+9)
#define WEAPON_SUPER_NAILGUN (WEAPON_HOOK+10)
#define WEAPON_GRENADE_LAUNCHER (WEAPON_HOOK+11)
#define WEAPON_FLAMETHROWER (WEAPON_HOOK+12)
#define WEAPON_ROCKET_LAUNCHER (WEAPON_HOOK+13)
#define WEAPON_INCENDIARY (WEAPON_HOOK+14)
#define WEAPON_ASSAULT_CANNON (WEAPON_HOOK+16)
#define WEAPON_LIGHTNING (WEAPON_HOOK+17)
#define WEAPON_DETPACK (WEAPON_HOOK+18)
#define WEAPON_TRANQ (WEAPON_HOOK+19)
#define WEAPON_LASER (WEAPON_HOOK+20)
#define WEAPON_PIPEBOMB_LAUNCHER (WEAPON_HOOK+21)
#define WEAPON_KNIFE (WEAPON_HOOK+22)
#define WEAPON_BENCHMARK (WEAPON_HOOK+23)
#define WEAPON_BIOWEAPON (WEAPON_HOOK + 1)
#define WEAPON_MEDIKIT (WEAPON_HOOK + 2)
#define WEAPON_SPANNER (WEAPON_HOOK + 3)
#define WEAPON_AXE (WEAPON_HOOK + 4)
#define WEAPON_SNIPER_RIFLE (WEAPON_HOOK + 5)
#define WEAPON_AUTO_RIFLE (WEAPON_HOOK + 6)
#define WEAPON_TF_SHOTGUN (WEAPON_HOOK + 7)
#define WEAPON_SUPER_SHOTGUN (WEAPON_HOOK + 8)
#define WEAPON_NAILGUN (WEAPON_HOOK + 9)
#define WEAPON_SUPER_NAILGUN (WEAPON_HOOK + 10)
#define WEAPON_GRENADE_LAUNCHER (WEAPON_HOOK + 11)
#define WEAPON_FLAMETHROWER (WEAPON_HOOK + 12)
#define WEAPON_ROCKET_LAUNCHER (WEAPON_HOOK + 13)
#define WEAPON_INCENDIARY (WEAPON_HOOK + 14)
#define WEAPON_ASSAULT_CANNON (WEAPON_HOOK + 16)
#define WEAPON_LIGHTNING (WEAPON_HOOK + 17)
#define WEAPON_DETPACK (WEAPON_HOOK + 18)
#define WEAPON_TRANQ (WEAPON_HOOK + 19)
#define WEAPON_LASER (WEAPON_HOOK + 20)
#define WEAPON_PIPEBOMB_LAUNCHER (WEAPON_HOOK + 21)
#define WEAPON_KNIFE (WEAPON_HOOK + 22)
#define WEAPON_BENCHMARK (WEAPON_HOOK + 23)
/*==================================================*/
/* New Weapon Related Defines */
@ -509,7 +508,7 @@ enum
// Detpack
#define WEAP_DETPACK_DISARMTIME 3 // Time it takes to disarm a Detpack
#define WEAP_DETPACK_SETTIME 3 // Time it takes to set a Detpack
#define WEAP_DETPACK_SIZE 700 // Explosion Size
#define WEAP_DETPACK_SIZE 700 // Explosion Size
#define WEAP_DETPACK_GOAL_SIZE 1500 // Explosion Size for goal triggering
#define WEAP_DETPACK_BITS_NO 12 // Bits that detpack explodes into
@ -519,15 +518,15 @@ enum
// Grenades
#define GR_PRIMETIME 3
#define GR_CALTROP_PRIME 0.5
#define GR_TYPE_NONE 0
#define GR_TYPE_NORMAL 1
#define GR_TYPE_CONCUSSION 2
#define GR_TYPE_NAIL 3
#define GR_TYPE_MIRV 4
#define GR_TYPE_NAPALM 5
//#define GR_TYPE_FLARE 6
#define GR_TYPE_GAS 7
#define GR_TYPE_EMP 8
#define GR_TYPE_NONE 0
#define GR_TYPE_NORMAL 1
#define GR_TYPE_CONCUSSION 2
#define GR_TYPE_NAIL 3
#define GR_TYPE_MIRV 4
#define GR_TYPE_NAPALM 5
//#define GR_TYPE_FLARE 6
#define GR_TYPE_GAS 7
#define GR_TYPE_EMP 8
#define GR_TYPE_CALTROP 9
//#define GR_TYPE_FLASH 10
@ -542,8 +541,8 @@ enum
// Defines for Concussion Grenade
#define GR_CONCUSS_TIME 0.25
#define GR_CONCUSS_DEC 10
#define MEDIUM_PING 150
#define HIGH_PING 200
#define MEDIUM_PING 150
#define HIGH_PING 200
// Defines for the Gas Grenade
#define GR_HALLU_TIME 0.3
@ -551,7 +550,7 @@ enum
#define GR_HALLU_DEC 2.5
// Defines for the BioInfection
#define BIO_JUMP_RADIUS 128 // The distance the bioinfection can jump between players
#define BIO_JUMP_RADIUS 128 // The distance the bioinfection can jump between players
/*==================================================*/
/* New Items */
@ -1382,8 +1381,5 @@ public:
void Spawn( void );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
};
#endif // TF_DEFS_ONLY
#endif // __TF_DEFS_H

View File

@ -24,59 +24,56 @@
#include <stdio.h>
#include "parsemsg.h"
DECLARE_MESSAGE(m_Train, Train )
DECLARE_MESSAGE( m_Train, Train )
int CHudTrain::Init(void)
int CHudTrain::Init( void )
{
HOOK_MESSAGE( Train );
m_iPos = 0;
m_iFlags = 0;
gHUD.AddHudElem(this);
gHUD.AddHudElem( this );
return 1;
};
}
int CHudTrain::VidInit(void)
int CHudTrain::VidInit( void )
{
m_hSprite = 0;
return 1;
};
}
int CHudTrain::Draw(float fTime)
int CHudTrain::Draw( float fTime )
{
if ( !m_hSprite )
m_hSprite = LoadSprite("sprites/%d_train.spr");
if( !m_hSprite )
m_hSprite = LoadSprite( "sprites/%d_train.spr" );
if (m_iPos)
if( m_iPos )
{
int r, g, b, x, y;
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
SPR_Set(m_hSprite, r, g, b );
SPR_Set( m_hSprite, r, g, b );
// This should show up to the right and part way up the armor number
y = ScreenHeight - SPR_Height(m_hSprite,0) - gHUD.m_iFontHeight;
x = ScreenWidth/3 + SPR_Width(m_hSprite,0)/4;
SPR_DrawAdditive( m_iPos - 1, x, y, NULL);
y = ScreenHeight - SPR_Height( m_hSprite, 0 ) - gHUD.m_iFontHeight;
x = ScreenWidth / 3 + SPR_Width( m_hSprite, 0 ) / 4;
SPR_DrawAdditive( m_iPos - 1, x, y, NULL );
}
return 1;
}
int CHudTrain::MsgFunc_Train(const char *pszName, int iSize, void *pbuf)
int CHudTrain::MsgFunc_Train( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pbuf, iSize );
// update Train data
m_iPos = READ_BYTE();
if (m_iPos)
if( m_iPos )
m_iFlags |= HUD_ACTIVE;
else
m_iFlags &= ~HUD_ACTIVE;

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -18,8 +18,6 @@
#include "triangleapi.h"
#include "particlemgr.h"
#include "exportdef.h"
extern "C"
{
void DLLEXPORT HUD_DrawNormalTriangles( void );
@ -140,7 +138,7 @@ void Draw_Triangles( void )
// Load it up with some bogus data
player = gEngfuncs.GetLocalPlayer();
if ( !player )
if( !player )
return;
org = player->origin;
@ -148,7 +146,7 @@ void Draw_Triangles( void )
org.x += 50;
org.y += 50;
if (gHUD.m_hsprCursor == 0)
if( gHUD.m_hsprCursor == 0 )
{
char sz[256];
//LRCT sprintf( sz, "sprites/cursor.spr" );
@ -156,11 +154,11 @@ void Draw_Triangles( void )
gHUD.m_hsprCursor = SPR_Load( sz );
}
if ( !gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( gHUD.m_hsprCursor ), 0 ))
if( !gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *)gEngfuncs.GetSpritePointer( gHUD.m_hsprCursor ), 0 ) )
{
return;
}
// Create a triangle, sigh
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
@ -187,7 +185,6 @@ void Draw_Triangles( void )
gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
}
#endif
void BlackFog ( void )
@ -221,7 +218,6 @@ Non-transparent triangles-- add them here
void DLLEXPORT HUD_DrawNormalTriangles( void )
{
gHUD.m_Spectator.DrawOverview();
#if defined( TEST_IT )
// Draw_Triangles();
#endif

View File

@ -30,104 +30,106 @@
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
vec3_t vec3_origin( 0, 0, 0 );
extern vec3_t vec3_origin;
double sqrt(double x);
#ifdef _MSC_VER
vec3_t vec3_origin;
#endif
float Length(const float *v)
double sqrt( double x );
float Length( const float *v )
{
int i;
int i;
float length;
length = 0;
for (i=0 ; i< 3 ; i++)
length += v[i]*v[i];
length = sqrt (length); // FIXME
for( i = 0; i < 3; i++ )
length += v[i] * v[i];
length = sqrt( length ); // FIXME
return length;
}
void VectorAngles( const float *forward, float *angles )
{
float tmp, yaw, pitch;
if (forward[1] == 0 && forward[0] == 0)
float tmp, yaw, pitch;
if( forward[1] == 0 && forward[0] == 0 )
{
yaw = 0;
if (forward[2] > 0)
if( forward[2] > 0 )
pitch = 90;
else
pitch = 270;
}
else
{
yaw = (atan2(forward[1], forward[0]) * 180 / M_PI);
if (yaw < 0)
yaw = ( atan2( forward[1], forward[0]) * 180 / M_PI );
if( yaw < 0 )
yaw += 360;
tmp = sqrt (forward[0]*forward[0] + forward[1]*forward[1]);
pitch = (atan2(forward[2], tmp) * 180 / M_PI);
if (pitch < 0)
tmp = sqrt( forward[0] * forward[0] + forward[1] * forward[1] );
pitch = ( atan2( forward[2], tmp ) * 180 / M_PI );
if( pitch < 0 )
pitch += 360;
}
angles[0] = pitch;
angles[1] = yaw;
angles[2] = 0;
}
float VectorNormalize (float *v)
float VectorNormalize( float *v )
{
float length, ilength;
float length, ilength;
length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
length = sqrt (length); // FIXME
length = v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
length = sqrt( length ); // FIXME
if (length)
if( length )
{
ilength = 1/length;
ilength = 1 / length;
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
}
return length;
return length;
}
void VectorInverse ( float *v )
void VectorInverse( float *v )
{
v[0] = -v[0];
v[1] = -v[1];
v[2] = -v[2];
}
void VectorScale (const float *in, float scale, float *out)
void VectorScale( const float *in, float scale, float *out )
{
out[0] = in[0]*scale;
out[1] = in[1]*scale;
out[2] = in[2]*scale;
out[0] = in[0] * scale;
out[1] = in[1] * scale;
out[2] = in[2] * scale;
}
void VectorMA (const float *veca, float scale, const float *vecb, float *vecc)
void VectorMA( const float *veca, float scale, const float *vecb, float *vecc )
{
vecc[0] = veca[0] + scale*vecb[0];
vecc[1] = veca[1] + scale*vecb[1];
vecc[2] = veca[2] + scale*vecb[2];
vecc[0] = veca[0] + scale * vecb[0];
vecc[1] = veca[1] + scale * vecb[1];
vecc[2] = veca[2] + scale * vecb[2];
}
HSPRITE LoadSprite(const char *pszName)
HSPRITE LoadSprite( const char *pszName )
{
int i;
char sz[256];
char sz[256];
if (ScreenWidth < 640)
if( ScreenWidth < 640 )
i = 320;
else
i = 640;
sprintf(sz, pszName, i);
sprintf( sz, pszName, i );
return SPR_Load(sz);
return SPR_Load( sz );
}

View File

@ -15,6 +15,9 @@
// Vector.h
// A subset of the extdll.h in the project HL Entity DLL
//
#pragma once
#ifndef UTIL_VECTOR_H
#define UTIL_VECTOR_H
// Misc C-runtime library headers
#include "stdio.h"
@ -22,8 +25,8 @@
#include "math.h"
// 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 unsigned int func_t; //
typedef int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h
//=========================================================
@ -33,21 +36,21 @@ typedef float vec_t; // needed before including progdefs.h
class Vector2D
{
public:
inline Vector2D(void) { }
inline Vector2D(float X, float Y) { x = X; y = Y; }
inline Vector2D operator+(const Vector2D& v) const { return Vector2D(x+v.x, y+v.y); }
inline Vector2D operator-(const Vector2D& v) const { return Vector2D(x-v.x, y-v.y); }
inline Vector2D operator*(float fl) const { return Vector2D(x*fl, y*fl); }
inline Vector2D operator/(float fl) const { return Vector2D(x/fl, y/fl); }
inline float Length(void) const { return (float)sqrt(x*x + y*y ); }
inline Vector2D( void ) { }
inline Vector2D( float X, float Y ) { x = X; y = Y; }
inline Vector2D operator+( const Vector2D& v ) const { return Vector2D(x+v.x, y+v.y); }
inline Vector2D operator-( const Vector2D& v ) const { return Vector2D(x-v.x, y-v.y); }
inline Vector2D operator*( float fl ) const { return Vector2D(x*fl, y*fl); }
inline Vector2D operator/( float fl ) const { return Vector2D(x/fl, y/fl); }
inline Vector2D Normalize ( void ) const
inline float Length( void ) const { return (float)sqrt(x*x + y*y ); }
inline Vector2D Normalize( void ) const
{
Vector2D vec2;
float flLen = Length();
if ( flLen == 0 )
if( flLen == 0 )
{
return Vector2D( (float)0, (float)0 );
}
@ -61,61 +64,67 @@ public:
vec_t x, y;
};
inline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y ); }
inline Vector2D operator*(float fl, const Vector2D& v) { return v * fl; }
inline float DotProduct( const Vector2D& a, const Vector2D& b ) { return( a.x * b.x + a.y * b.y ); }
inline Vector2D operator*( float fl, const Vector2D& v ) { return v * fl; }
//=========================================================
// 3D Vector
//=========================================================
class Vector // same data-layout as engine's vec3_t,
{ // which is a vec_t[3]
{ //which is a vec_t[3]
public:
// Construction/destruction
inline Vector(void) { }
inline Vector(float X, float Y, float Z) { x = X; y = Y; z = Z; }
inline Vector(double X, double Y, double Z) { x = (float)X; y = (float)Y; z = (float)Z; }
inline Vector(int X, int Y, int Z) { x = (float)X; y = (float)Y; z = (float)Z; }
inline Vector(const Vector& v) { x = v.x; y = v.y; z = v.z; }
inline Vector(float rgfl[3]) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; }
inline Vector( void ) { }
inline Vector( float X, float Y, float Z ) { x = X; y = Y; z = Z; }
inline Vector( double X, double Y, double Z ) { x = (float)X; y = (float)Y; z = (float)Z; }
inline Vector( int X, int Y, int Z ) { x = (float)X; y = (float)Y; z = (float)Z; }
inline Vector( const Vector& v ) { x = v.x; y = v.y; z = v.z; }
inline Vector( float rgfl[3] ) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; }
// Operators
inline Vector operator-(void) const { return Vector(-x,-y,-z); }
inline int operator==(const Vector& v) const { return x==v.x && y==v.y && z==v.z; }
inline int operator!=(const Vector& v) const { return !(*this==v); }
inline Vector operator+(const Vector& v) const { return Vector(x+v.x, y+v.y, z+v.z); }
inline Vector operator-(const Vector& v) const { return Vector(x-v.x, y-v.y, z-v.z); }
inline Vector operator*(float fl) const { return Vector(x*fl, y*fl, z*fl); }
inline Vector operator/(float fl) const { return Vector(x/fl, y/fl, z/fl); }
inline Vector operator-( void ) const { return Vector( -x, -y, -z ); }
inline int operator==( const Vector& v ) const { return x == v.x && y == v.y && z == v.z; }
inline int operator!=( const Vector& v ) const { return !( *this == v ); }
inline Vector operator+( const Vector& v ) const { return Vector( x + v.x, y + v.y, z + v.z ); }
inline Vector operator-( const Vector& v ) const { return Vector( x - v.x, y - v.y, z - v.z ); }
inline Vector operator*( float fl ) const { return Vector( x * fl, y * fl, z * fl ); }
inline Vector operator/( float fl ) const { return Vector( x / fl, y / fl, z / fl ); }
// Methods
inline void CopyToArray(float* rgfl) const { rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; }
inline float Length(void) const { return (float)sqrt(x*x + y*y + z*z); }
operator float *() { return &x; } // Vectors will now automatically convert to float * when needed
operator const float *() const { return &x; } // Vectors will now automatically convert to float * when needed
inline Vector Normalize(void) const
inline void CopyToArray( float* rgfl ) const { rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; }
inline float Length( void ) const { return (float)sqrt( x * x + y * y + z * z); }
operator float *() { return &x; } // Vectors will now automatically convert to float * when needed
operator const float *() const { return &x; } // Vectors will now automatically convert to float * when needed
inline Vector Normalize( void ) const
{
float flLen = Length();
if (flLen == 0) return Vector(0,0,1); // ????
if( flLen == 0 ) return Vector( 0, 0, 1); // ????
flLen = 1 / flLen;
return Vector(x * flLen, y * flLen, z * flLen);
return Vector( x * flLen, y * flLen, z * flLen );
}
inline Vector2D Make2D ( void ) const
inline Vector2D Make2D( void ) const
{
Vector2D Vec2;
Vector2D Vec2;
Vec2.x = x;
Vec2.y = y;
return Vec2;
}
inline float Length2D(void) const { return (float)sqrt(x*x + y*y); }
inline float Length2D( void ) const
{
return (float)sqrt( x * x + y * y );
}
// Members
vec_t x, y, z;
};
inline Vector operator*(float fl, const Vector& v) { return v * fl; }
inline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); }
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 ); }
inline Vector operator*( float fl, const Vector& v ) { return v * fl; }
inline float DotProduct( const Vector& a, const Vector& b) { return( a.x * b.x + a.y * b.y + a.z * b.z ); }
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

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@ -11,5 +11,4 @@
void V_StartPitchDrift( void );
void V_StopPitchDrift( void );
#endif // !VIEWH
#endif // !VIEWH

View File

@ -12,31 +12,29 @@
* without written permission from Valve LLC.
*
****/
#if !defined ( BEAMDEFH )
#define BEAMDEFH
#ifdef _WIN32
#pragma once
#endif
#ifndef BEAMDEF_H
#define BEAMDEF_H
#define FBEAM_STARTENTITY 0x00000001
#define FBEAM_ENDENTITY 0x00000002
#define FBEAM_FADEIN 0x00000004
#define FBEAM_FADEOUT 0x00000008
#define FBEAM_SINENOISE 0x00000010
#define FBEAM_SOLID 0x00000020
#define FBEAM_SHADEIN 0x00000040
#define FBEAM_SHADEOUT 0x00000080
#define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet?
#define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet?
#define FBEAM_ISACTIVE 0x40000000
#define FBEAM_FOREVER 0x80000000
#define FBEAM_ENDENTITY 0x00000002
#define FBEAM_FADEIN 0x00000004
#define FBEAM_FADEOUT 0x00000008
#define FBEAM_SINENOISE 0x00000010
#define FBEAM_SOLID 0x00000020
#define FBEAM_SHADEIN 0x00000040
#define FBEAM_SHADEOUT 0x00000080
#define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet?
#define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet?
#define FBEAM_ISACTIVE 0x40000000
#define FBEAM_FOREVER 0x80000000
typedef struct beam_s BEAM;
struct beam_s
{
BEAM *next;
int type;
int flags;
int type;
int flags;
vec3_t source;
vec3_t target;
vec3_t delta;
@ -50,13 +48,13 @@ struct beam_s
float speed;
float frameRate;
float frame;
int segments;
int startEntity;
int endEntity;
int modelIndex;
int frameCount;
struct model_s *pFollowModel;
int segments;
int startEntity;
int endEntity;
int modelIndex;
int frameCount;
struct model_s *pFollowModel;
struct particle_s *particles;
};
#endif
#endif//BEAMDEF_H

246
common/bspfile.h Normal file
View File

@ -0,0 +1,246 @@
/*
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.
*/
#pragma once
#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

View File

@ -12,104 +12,94 @@
* without written permission from Valve LLC.
*
****/
// cl_entity.h
#if !defined( CL_ENTITYH )
#define CL_ENTITYH
#ifdef _WIN32
#pragma once
#endif
#ifndef CL_ENTITY_H
#define CL_ENTITY_H
typedef struct efrag_s
{
struct mleaf_s *leaf;
struct efrag_s *leafnext;
struct mleaf_s *leaf;
struct efrag_s *leafnext;
struct cl_entity_s *entity;
struct efrag_s *entnext;
struct efrag_s *entnext;
} efrag_t;
typedef struct
{
byte mouthopen; // 0 = mouth closed, 255 = mouth agape
byte sndcount; // counter for running average
int sndavg; // running average
byte mouthopen; // 0 = mouth closed, 255 = mouth agape
byte sndcount; // counter for running average
int sndavg; // running average
} mouth_t;
typedef struct
{
float prevanimtime;
float sequencetime;
byte prevseqblending[2];
vec3_t prevorigin;
vec3_t prevangles;
float prevanimtime;
float sequencetime;
byte prevseqblending[2];
vec3_t prevorigin;
vec3_t prevangles;
int prevsequence;
float prevframe;
int prevsequence;
float prevframe;
byte prevcontroller[4];
byte prevblending[2];
byte prevcontroller[4];
byte prevblending[2];
} latchedvars_t;
typedef struct
{
// Time stamp for this movement
float animtime;
float animtime;
vec3_t origin;
vec3_t angles;
vec3_t origin;
vec3_t angles;
} position_history_t;
typedef struct cl_entity_s cl_entity_t;
#define HISTORY_MAX 64 // Must be power of 2
#define HISTORY_MAX 64 // Must be power of 2
#define HISTORY_MASK ( HISTORY_MAX - 1 )
#if !defined( ENTITY_STATEH )
#include "entity_state.h"
#endif
#if !defined( PROGS_H )
#include "progs.h"
#endif
#include "event_args.h"
struct cl_entity_s
{
int index; // Index into cl_entities ( should match actual slot, but not necessarily )
int index; // Index into cl_entities ( should match actual slot, but not necessarily )
qboolean player; // True if this entity is a "player"
qboolean player; // True if this entity is a "player"
entity_state_t baseline; // The original state from which to delta during an uncompressed message
entity_state_t prevstate; // The state information from the penultimate message received from the server
entity_state_t curstate; // The state information from the last message received from server
entity_state_t baseline; // The original state from which to delta during an uncompressed message
entity_state_t prevstate; // The state information from the penultimate message received from the server
entity_state_t curstate; // The state information from the last message received from server
int current_position; // Last received history update index
position_history_t ph[ HISTORY_MAX ]; // History of position and angle updates for this player
int current_position; // Last received history update index
position_history_t ph[HISTORY_MAX]; // History of position and angle updates for this player
mouth_t mouth; // For synchronizing mouth movements.
mouth_t mouth; // For synchronizing mouth movements.
latchedvars_t latched; // Variables used by studio model rendering routines
latchedvars_t latched; // Variables used by studio model rendering routines
// Information based on interplocation, extrapolation, prediction, or just copied from last msg received.
//
float lastmove;
float lastmove;
// Actual render position and angles
vec3_t origin;
vec3_t angles;
vec3_t origin;
vec3_t angles;
// Attachment points
vec3_t attachment[4];
vec3_t attachment[4];
// Other entity local information
int trivial_accept;
int trivial_accept;
struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model
struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split
struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model
struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split
float syncbase; // for client-side animations -- used by obsolete alias animation system, remove?
int visframe; // last frame this entity was found in an active leaf
colorVec cvFloorColor;
float syncbase; // for client-side animations -- used by obsolete alias animation system, remove?
int visframe; // last frame this entity was found in an active leaf
colorVec cvFloorColor;
};
#endif // !CL_ENTITYH
#endif//CL_ENTITY_H

View File

@ -1,82 +1,59 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
/*
com_model.h - cient model structures
Copyright (C) 2010 Uncle Mike
// com_model.h
#if !defined( COM_MODEL_H )
#define COM_MODEL_H
#if defined( _WIN32 )
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.
*/
#pragma once
#endif
#ifndef COM_MODEL_H
#define COM_MODEL_H
#define STUDIO_RENDER 1
#define STUDIO_EVENTS 2
#include "bspfile.h" // we need some declarations from it
#define MAX_CLIENTS 32
#define MAX_EDICTS 900
typedef vec_t vec2_t[2];
typedef vec_t vec4_t[4];
#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
/*
==============================================================================
#define ALIAS_Z_CLIP_PLANE 5
ENGINE MODEL FORMAT
==============================================================================
*/
#define STUDIO_RENDER 1
#define STUDIO_EVENTS 2
// 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 ZISCALE ((float)0x8000)
#define ZISCALE ((float)0x8000)
#define CACHE_SIZE 32 // used to align key data structures
#define MIPLEVELS 4
#define VERTEXSIZE 7
#define MAXLIGHTMAPS 4
#define NUM_AMBIENTS 4 // automatic ambient sounds
// model types
typedef enum
{
mod_brush,
mod_sprite,
mod_alias,
mod_studio
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; // 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];
vec3_t normal;
float dist;
byte type; // for fast side tests
byte signbits; // signx + (signy<<1) + (signz<<1)
byte pad[2];
} mplane_t;
typedef struct
@ -93,246 +70,291 @@ typedef struct
typedef struct texture_s
{
char name[16];
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;
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
} 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
short minmaxs[6]; // for bounding box culling
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
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
short dx; // Offsets into surface texture (in texture coordinates, so we don't need floats)
short dy;
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
short texture; // Decal texture
byte scale; // Pixel scale
byte flags; // Decal flags
byte flags; // Decal flags FDECAL_*
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; // wil be a negative contents number
int visframe; // node needs to be traversed if current
int contents;
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;
// leaf specific
byte *compressed_vis;
struct efrag_s *efrags;
msurface_t **firstmarksurface;
int nummarksurfaces;
int key; // BSP sequence number for leaf's contents
int nummarksurfaces;
byte *compressed_pas;
byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t;
struct msurface_s
typedef struct msurface_s
{
int visframe; // should be drawn when node is crossed
int visframe; // should be drawn when node is crossed
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 dlightbits; // dynamically generated. Indicates if the surface illumination
// is modified by an animated light.
mplane_t *plane; // pointer to shared plane
int flags; // see SURF_ #defines
mplane_t *plane; // pointer to shared plane
int flags; // see SURF_ #defines
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
// surface generation data
struct surfcache_s *cachespots[MIPLEVELS];
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
short texturemins[2]; // smallest s/t position on the surface.
short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces
short texturemins[2];
short extents[2];
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;
int light_s, light_t; // gl lightmap coordinates
glpoly_t *polys; // multiple if warped
struct msurface_s *texturechain;
mtexinfo_t *texinfo;
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
decal_t *pdecals;
};
} msurface_t;
typedef struct
typedef struct msurfmesh_s
{
int planenum;
short children[2]; // negative numbers are contents
} dclipnode_t;
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;
typedef struct hull_s
{
dclipnode_t *clipnodes;
mplane_t *planes;
int firstclipnode;
int lastclipnode;
dclipnode_t *clipnodes;
mplane_t *planes;
int firstclipnode;
int lastclipnode;
vec3_t clip_mins;
vec3_t clip_maxs;
} hull_t;
#if !defined( CACHE_USER ) && !defined( QUAKEDEF_H )
#ifndef CACHE_USER
#define CACHE_USER
typedef struct cache_user_s
{
void *data;
void *data; // extradata
} cache_user_t;
#endif
typedef struct model_s
{
char name[ MAX_MODEL_NAME ];
qboolean needload; // bmodels and sprites don't cache normally
char name[64]; // model name
qboolean needload; // bmodels and sprites don't cache normally
modtype_t type;
int numframes;
synctype_t synctype;
int flags;
// shared modelinfo
modtype_t type; // model type
int numframes; // sprite's framecount
byte *mempool; // private mempool (was synctype)
int flags; // hl compatibility
//
// volume occupied by the model
//
vec3_t mins, maxs;
//
vec3_t mins, maxs; // bounding box at angles '0 0 0'
float radius;
// brush model
int firstmodelsurface;
int nummodelsurfaces;
//
// brush model
//
int firstmodelsurface, nummodelsurfaces;
int numsubmodels;
dmodel_t *submodels; // or studio animations
int numsubmodels;
dmodel_t *submodels;
int numplanes;
mplane_t *planes;
int numplanes;
mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs;
int numleafs; // number of visible leafs, not counting 0
struct mleaf_s *leafs;
int numvertexes;
mvertex_t *vertexes;
int numvertexes;
mvertex_t *vertexes;
int numedges;
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
{
// 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 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
int ping;
int packet_loss;
// skin information
char model[MAX_QPATH];
char model[64];
int topcolor;
int bottomcolor;
@ -341,11 +363,50 @@ 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;
#endif // #define COM_MODEL_H
//
// sprite representation in memory
//
typedef enum { SPR_SINGLE = 0, SPR_GROUP, SPR_ANGLED } spriteframetype_t;
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

View File

@ -12,17 +12,15 @@
* without written permission from Valve LLC.
*
****/
#if !defined( CON_NPRINTH )
#define CON_NPRINTH
#ifdef _WIN32
#pragma once
#endif
#ifndef CON_NPRINT_H
#define CON_NPRINT_H
typedef struct con_nprint_s
{
int index; // Row #
int index; // Row #
float time_to_live; // # of seconds before it dissappears
float color[ 3 ]; // RGB colors ( 0.0 -> 1.0 scale )
float color[3]; // RGB colors ( 0.0 -> 1.0 scale )
} con_nprint_t;
void Con_NPrintf( int idx, char *fmt, ... );

View File

@ -12,6 +12,7 @@
* without written permission from Valve LLC.
*
****/
#pragma once
#ifndef CONST_H
#define CONST_H
//
@ -20,103 +21,117 @@
// Most came from server.h
// edict->flags
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND (1<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
#define FL_WATERJUMP (1<<11) // player jumping out of water
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water
#define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND (1<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
#define FL_WATERJUMP (1<<11) // player jumping out of water
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water
#define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection
// UNDONE: Do we need these?
#define FL_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19)
#define FL_PROXY (1<<20) // This is a spectator proxy
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
#define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
#define FL_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19)
#define FL_PROXY (1<<20) // This is a spectator proxy
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
#define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
// Goes into globalvars_t.trace_flags
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
#define FTRACE_IGNORE_GLASS (1<<1) // traceline will be ignored entities with rendermode != kRenderNormal
// walkmove modes
#define WALKMOVE_NORMAL 0 // normal walkmove
#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type
#define WALKMOVE_CHECKONLY 2 // move, but don't touch triggers
#define WALKMOVE_NORMAL 0 // normal walkmove
#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type
#define WALKMOVE_CHECKONLY 2 // move, but don't touch triggers
// edict->movetype values
#define MOVETYPE_NONE 0 // never moves
#define MOVETYPE_NONE 0 // never moves
//#define MOVETYPE_ANGLENOCLIP 1
//#define MOVETYPE_ANGLECLIP 2
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // gravity/collisions
#define MOVETYPE_PUSH 7 // no clip to world, push and crush
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // gravity/collisions
#define MOVETYPE_PUSH 7 // no clip to world, push and crush
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
#define MOVETYPE_COMPOUND 14 // glue two entities together (simple movewith)
// edict->solid values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
#define SOLID_CUSTOM 5 // call external callbacks for tracing
// edict->deadflag values
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_RESPAWNABLE 3
#define DEAD_DISCARDBODY 4
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
// entity effects
#define EF_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_INVLIGHT 16 // get lighting from ceiling
#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_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_INVLIGHT 16 // get lighting from ceiling
#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
#define EF_REFLECTONLY (1<<25) // Entity will be drawing only in mirrors
#define EF_NOWATERCSG (1<<26) // Do not remove sides for func_water entity
#define EF_FULLBRIGHT (1<<27) // Just get fullbright
#define EF_NOSHADOW (1<<28) // ignore shadow for this entity
#define EF_MERGE_VISIBILITY (1<<29) // this entity allowed to merge vis (e.g. env_sky or portal camera)
#define EF_REQUEST_PHS (1<<30) // This entity requested phs bitvector instead of pvsbitvector in AddToFullPack calls
// g-cont. one reserved bit here for me
// entity flags
#define EFLAG_SLERP 1 // do studio interpolation of this entity
#define EFLAG_SLERP 1 // do studio interpolation of this entity
//
// temp entity events
//
#define TE_BEAMPOINTS 0 // beam effect between two points
#define TE_BEAMPOINTS 0 // beam effect between two points
// coord coord coord (start position)
// coord coord coord (end position)
// short (sprite index)
@ -129,7 +144,7 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMENTPOINT 1 // beam effect between point and entity
#define TE_BEAMENTPOINT 1 // beam effect between point and entity
// short (start entity)
// coord coord coord (end position)
// short (sprite index)
@ -142,10 +157,10 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_GUNSHOT 2 // particle effect plus ricochet sound
#define TE_GUNSHOT 2 // particle effect plus ricochet sound
// coord coord coord (position)
#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
@ -155,25 +170,26 @@
// The Explosion effect has some flags to control performance/aesthetic features:
#define TE_EXPLFLAG_NONE 0 // all flags clear makes default Half-Life explosion
#define TE_EXPLFLAG_NOADDITIVE 1 // sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)
#define TE_EXPLFLAG_NODLIGHTS 2 // do not render dynamic lights
#define TE_EXPLFLAG_NODLIGHTS 2 // do not render dynamic lights
#define TE_EXPLFLAG_NOSOUND 4 // do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles
#define TE_EXPLFLAG_DRAWALPHA 16 // sprite will be drawn alpha
#define TE_EXPLFLAG_ROTATE 32 // rotate the sprite randomly
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
// coord coord coord (position)
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
#define TE_TRACER 6 // tracer effect from point to point
#define TE_TRACER 6 // tracer effect from point to point
// coord, coord, coord (start)
// coord, coord, coord (end)
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
// coord, coord, coord (start)
// coord, coord, coord (end)
// byte (life in 0.1's)
@ -181,7 +197,7 @@
// byte (amplitude in 0.01's)
// short (sprite model index)
#define TE_BEAMENTS 8
#define TE_BEAMENTS 8
// short (start entity)
// short (end entity)
// short (sprite index)
@ -194,33 +210,33 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
// coord coord coord (position)
#define TE_LAVASPLASH 10 // Quake1 lava splash
#define TE_LAVASPLASH 10 // Quake1 lava splash
// coord coord coord (position)
#define TE_TELEPORT 11 // Quake1 teleport splash
#define TE_TELEPORT 11 // Quake1 teleport splash
// coord coord coord (position)
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
// coord coord coord (position)
// byte (starting color)
// byte (num colors)
#define TE_BSPDECAL 13 // Decal from the .BSP file
#define TE_BSPDECAL 13 // Decal from the .BSP file
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// short (texture index of precached decal texture name)
// short (entity index)
// [optional - only included if previous short is non-zero (not the world)] short (index of model of above entity)
#define TE_IMPLOSION 14 // tracers moving toward a point
#define TE_IMPLOSION 14 // tracers moving toward a point
// coord, coord, coord (position)
// byte (radius)
// byte (count)
// byte (life in 0.1's)
#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions
#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions
// coord, coord, coord (start)
// coord, coord, coord (end)
// short (sprite index)
@ -230,21 +246,21 @@
// byte (velocity along vector in 10's)
// byte (randomness of velocity in 10's)
#define TE_BEAM 16 // obsolete
#define TE_BEAM 16 // obsolete
#define TE_SPRITE 17 // additive sprite, plays 1 cycle
#define TE_SPRITE 17 // additive sprite, plays 1 cycle
// coord, coord, coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (brightness)
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end
// coord, coord, coord (start position)
// coord, coord, coord (end position)
// short (beam sprite index)
// short (end sprite index)
#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime
#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
@ -257,7 +273,7 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime
#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
@ -270,7 +286,7 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime
#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
@ -283,7 +299,7 @@
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving
#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving
// short (entity:attachment to follow)
// short (sprite index)
// byte (life in 0.1's)
@ -294,7 +310,7 @@
#define TE_GLOWSPRITE 23
// coord, coord, coord (pos) short (model index) byte (scale / 10)
#define TE_BEAMRING 24 // connect a beam ring to two entities
#define TE_BEAMRING 24 // connect a beam ring to two entities
// short (start entity)
// short (end entity)
// short (sprite index)
@ -313,11 +329,11 @@
// byte (color)
// short (count)
// short (base speed)
// short (ramdon velocity)
// short (random velocity)
#define TE_BEAMHOSE 26 // obsolete
#define TE_BEAMHOSE 26 // obsolete
#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect
#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect
// coord, coord, coord (pos)
// byte (radius in 10's)
// byte byte byte (color)
@ -325,7 +341,7 @@
// byte (life in 10's)
// byte (decay rate in 10's)
#define TE_ELIGHT 28 // point entity light, no world effect
#define TE_ELIGHT 28 // point entity light, no world effect
// short (entity:attachment to follow)
// coord coord coord (initial position)
// coord (radius)
@ -337,9 +353,8 @@
// short 1.2.13 x (-1 = center)
// short 1.2.13 y (-1 = center)
// byte Effect 0 = fade in/fade out
// 1 is flickery credits
// 2 is write out (training room)
// 1 is flickery credits
// 2 is write out (training room)
// 4 bytes r,g,b,a color1 (text color)
// 4 bytes r,g,b,a color2 (effect color)
// ushort 8.8 fadein time
@ -347,19 +362,19 @@
// ushort 8.8 hold time
// optional ushort 8.8 fxtime (time the highlight lags behing the leading text in effect 2)
// string text message (512 chars max sz string)
#define TE_LINE 30
// coord, coord, coord startpos
// coord, coord, coord endpos
#define TE_LINE 30
// coord, coord, coord startpos
// coord, coord, coord endpos
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_BOX 31
// coord, coord, coord boxmins
// coord, coord, coord boxmaxs
#define TE_BOX 31
// coord, coord, coord boxmins
// coord, coord, coord boxmaxs
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_KILLBEAM 99 // kill all beams attached to entity
#define TE_KILLBEAM 99 // kill all beams attached to entity
// short (entity)
#define TE_LARGEFUNNEL 100
@ -367,33 +382,33 @@
// short (sprite index)
// short (flags)
#define TE_BLOODSTREAM 101 // particle spray
#define TE_BLOODSTREAM 101 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds
#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds
// coord coord coord (start position)
// coord coord coord (end position)
#define TE_BLOOD 103 // particle spray
#define TE_BLOOD 103 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_DECAL 104 // Decal applied to a brush entity (not the world)
#define TE_DECAL 104 // Decal applied to a brush entity (not the world)
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name)
// short (entity index)
#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards
#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards
// short (entity)
// short (sprite index)
// byte (density)
#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits
#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// angle (initial yaw)
@ -401,14 +416,14 @@
// byte (bounce sound type)
// byte (life in 0.1's)
#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set
#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set
// coord, coord, coord (origin)
// coord (velocity)
// short (model index)
// short (count)
// byte (life in 0.1's)
#define TE_BREAKMODEL 108 // box of models or sprites
#define TE_BREAKMODEL 108 // box of models or sprites
// coord, coord, coord (position)
// coord, coord, coord (size)
// coord, coord, coord (velocity)
@ -418,12 +433,12 @@
// byte (life in 0.1 secs)
// byte (flags)
#define TE_GUNSHOTDECAL 109 // decal and ricochet sound
#define TE_GUNSHOTDECAL 109 // decal and ricochet sound
// coord, coord, coord (position)
// short (entity index???)
// byte (decal???)
#define TE_SPRITE_SPRAY 110 // spay of alpha sprites
#define TE_SPRITE_SPRAY 110 // spay of alpha sprites
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// short (sprite index)
@ -431,18 +446,18 @@
// byte (speed)
// byte (noise)
#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound.
#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound.
// coord, coord, coord (position)
// byte (scale in 0.1's)
#define TE_PLAYERDECAL 112 // ???
#define TE_PLAYERDECAL 112 // ???
// byte (playerindex)
// coord, coord, coord (position)
// short (entity???)
// byte (decal number???)
// [optional] short (model index???)
#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards
#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards
// coord, coord, coord (min start position)
// coord, coord, coord (max start position)
// coord (float height)
@ -450,7 +465,7 @@
// byte (count)
// coord (speed)
#define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards
#define TE_BUBBLETRAIL 114 // create alpha sprites along a line, float upwards
// coord, coord, coord (min start position)
// coord, coord, coord (max start position)
// coord (float height)
@ -458,34 +473,34 @@
// byte (count)
// coord (speed)
#define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent)
#define TE_BLOODSPRITE 115 // spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent)
// coord, coord, coord (position)
// short (sprite1 index)
// short (sprite2 index)
// byte (color)
// byte (scale)
#define TE_WORLDDECAL 116 // Decal applied to the world brush
#define TE_WORLDDECAL 116 // Decal applied to the world brush
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name)
#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush
#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name - 256)
#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256
#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name - 256)
// short (entity index)
#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent)
#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent)
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// short (modelindex)
// byte (life)
// byte (owner) projectile won't collide with owner (if owner == 0, projectile will hit any client).
#define TE_SPRAY 120 // Throws a shower of sprites or models
#define TE_SPRAY 120 // Throws a shower of sprites or models
// coord, coord, coord (position)
// coord, coord, coord (direction)
// short (modelindex)
@ -494,19 +509,19 @@
// byte (noise)
// byte (rendermode)
#define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!)
#define TE_PLAYERSPRITES 121 // sprites emit from a player's bounding box (ONLY use for players!)
// byte (playernum)
// short (sprite modelindex)
// byte (count)
// byte (variance) (0 = no variance in size) (10 = 10% variance in size)
#define TE_PARTICLEBURST 122 // very similar to lavasplash.
#define TE_PARTICLEBURST 122 // very similar to lavasplash.
// coord (origin)
// short (radius)
// byte (particle color)
// byte (duration * 10) (will be randomized a bit)
#define TE_FIREFIELD 123 // makes a field of fire.
#define TE_FIREFIELD 123 // makes a field of fire.
// coord (origin)
// short (radius) (fire is made in a square around origin. -radius, -radius to radius, radius)
// short (modelindex)
@ -517,26 +532,27 @@
// to keep network traffic low, this message has associated flags that fit into a byte:
#define TEFIRE_FLAG_ALLFLOAT 1 // all sprites will drift upwards as they animate
#define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance)
#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_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)
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
// byte (entity index of player)
// coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset )
// short (model index)
// short (life * 10 );
#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player.
#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player.
// byte (entity index of player)
#define TE_MULTIGUNSHOT 126 // much more compact shotgun message
#define TE_MULTIGUNSHOT 126 // much more compact shotgun message
// This message is used to make a client approximate a 'spray' of gunfire.
// Any weapon that fires more than one bullet per frame and fires in a bit of a spread is
// a good candidate for MULTIGUNSHOT use. (shotguns)
//
// NOTE: This effect makes the client do traces for each bullet, these client traces ignore
// entities that have studio models.Traces are 4096 long.
// entities that have studio models.Traces are 4096 long.
//
// coord (origin)
// coord (origin)
@ -549,7 +565,7 @@
// byte (count)
// byte (bullethole decal texture index)
#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization.
#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization.
// coord (origin)
// coord (origin)
// coord (origin)
@ -560,132 +576,141 @@
// byte ( color ) this is an index into an array of color vectors in the engine. (0 - )
// byte ( length * 10 )
#define MSG_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity)
#define MSG_ALL 2 // reliable to all
#define MSG_INIT 3 // write to the init string
#define MSG_PVS 4 // Ents in PVS of org
#define MSG_PAS 5 // Ents in PAS of org
#define MSG_PVS_R 6 // Reliable to PVS
#define MSG_PAS_R 7 // Reliable to PAS
#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped )
#define MSG_SPEC 9 // Sends to all spectator proxies
#define MSG_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity)
#define MSG_ALL 2 // reliable to all
#define MSG_INIT 3 // write to the init string
#define MSG_PVS 4 // Ents in PVS of org
#define MSG_PAS 5 // Ents in PAS of org
#define MSG_PVS_R 6 // Reliable to PVS
#define MSG_PAS_R 7 // Reliable to PAS
#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram ( could be dropped )
#define MSG_SPEC 9 // Sends to all spectator proxies
// contents of a spot in the world
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
/* These additional contents constants are defined in bspfile.h
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
// These additional contents constants are defined in bspfile.h
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
#define CONTENTS_TRANSLUCENT -15
*/
#define CONTENTS_LADDER -16
#define CONTENTS_LADDER -16
//LRC- New (long overdue) content types for Spirit
#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19
#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19
#define CONTENT_SPECIAL1 -20 //LRC - used by the particle systems
#define CONTENT_SPECIAL2 -21
#define CONTENT_SPECIAL3 -22
#define CONTENT_EMPTY -1
#define CONTENT_SOLID -2
#define CONTENT_WATER -3
#define CONTENT_SLIME -4
#define CONTENT_LAVA -5
#define CONTENT_SKY -6
#define CONTENT_EMPTY -1
#define CONTENT_SOLID -2
#define CONTENT_WATER -3
#define CONTENT_SLIME -4
#define CONTENT_LAVA -5
#define CONTENT_SKY -6
#define CONTENT_SOLID -2
// channels
#define CHAN_AUTO 0
#define CHAN_WEAPON 1
#define CHAN_VOICE 2
#define CHAN_VOICE 2
#define CHAN_ITEM 3
#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_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
#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_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
#define ATTN_NORM (float)0.8
#define ATTN_IDLE (float)2
#define ATTN_STATIC (float)1.25
#define ATTN_NONE 0
#define ATTN_NORM (float)0.8
#define ATTN_IDLE (float)2
#define ATTN_STATIC (float)1.25
// pitch values
#define PITCH_NORM 100 // non-pitch shifted
#define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
#define PITCH_HIGH 120
#define PITCH_NORM 100 // non-pitch shifted
#define PITCH_LOW 95 // other values are possible - 0-255, where 255 is very high
#define PITCH_HIGH 120
// volume values
#define VOL_NORM 1.0
#define VOL_NORM 1.0
// plats
#define PLAT_LOW_TRIGGER 1
#define PLAT_LOW_TRIGGER 1
// Trains
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
// buttons
#ifndef IN_BUTTONS_H
#include "in_buttons.h"
#endif
#define IN_ATTACK (1<<0)
#define IN_JUMP (1<<1)
#define IN_DUCK (1<<2)
#define IN_FORWARD (1<<3)
#define IN_BACK (1<<4)
#define IN_USE (1<<5)
#define IN_CANCEL (1<<6)
#define IN_LEFT (1<<7)
#define IN_RIGHT (1<<8)
#define IN_MOVELEFT (1<<9)
#define IN_MOVERIGHT (1<<10)
#define IN_ATTACK2 (1<<11)
#define IN_RUN (1<<12)
#define IN_RELOAD (1<<13)
#define IN_ALT1 (1<<14)
#define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down
// Break Model Defines
#define BREAK_TYPEMASK 0x4F
#define BREAK_GLASS 0x01
#define BREAK_METAL 0x02
#define BREAK_FLESH 0x04
#define BREAK_WOOD 0x08
#define BREAK_SMOKE 0x10
#define BREAK_TRANS 0x20
#define BREAK_CONCRETE 0x40
#define BREAK_TYPEMASK 0x4F
#define BREAK_GLASS 0x01
#define BREAK_METAL 0x02
#define BREAK_FLESH 0x04
#define BREAK_WOOD 0x08
#define BREAK_SMOKE 0x10
#define BREAK_TRANS 0x20
#define BREAK_CONCRETE 0x40
#define BREAK_2 0x80
// Colliding temp entity sounds
#define BOUNCE_GLASS BREAK_GLASS
#define BOUNCE_METAL BREAK_METAL
#define BOUNCE_FLESH BREAK_FLESH
#define BOUNCE_WOOD BREAK_WOOD
#define BOUNCE_SHRAP 0x10
#define BOUNCE_SHELL 0x20
#define BOUNCE_CONCRETE BREAK_CONCRETE
#define BOUNCE_SHOTSHELL 0x80
#define BOUNCE_GLASS BREAK_GLASS
#define BOUNCE_METAL BREAK_METAL
#define BOUNCE_FLESH BREAK_FLESH
#define BOUNCE_WOOD BREAK_WOOD
#define BOUNCE_SHRAP 0x10
#define BOUNCE_SHELL 0x20
#define BOUNCE_CONCRETE BREAK_CONCRETE
#define BOUNCE_SHOTSHELL 0x80
// Temp entity bounce sound types
#define TE_BOUNCE_NULL 0
#define TE_BOUNCE_SHELL 1
#define TE_BOUNCE_SHOTSHELL 2
#define TE_BOUNCE_SHOTSHELL 2
// Rendering constants
enum
{
kRenderNormal, // src
kRenderNormal, // src
kRenderTransColor, // c*a+dest*(1-a)
kRenderTransTexture, // src*a+dest*(1-a)
kRenderGlow, // src*a+dest -- No Z buffer checks
kRenderGlow, // src*a+dest -- No Z buffer checks
kRenderTransAlpha, // src*srca+dest*(1-srca)
kRenderTransAdd, // src*a+dest
kRenderWorldGlow // Same as kRenderGlow but not fixed size in screen space
};
enum
@ -714,31 +739,30 @@ enum
kRenderFxReflection, //LRC - draw a reflection under my feet
};
typedef unsigned int func_t;
typedef int string_t;
typedef unsigned int func_t;
typedef unsigned int string_t;
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned char byte;
typedef unsigned short word;
#define _DEF_BYTE_
#undef true
#undef false
#ifndef __cplusplus
typedef enum {false, true} qboolean;
typedef enum { false, true } qboolean;
#else
typedef int qboolean;
#endif
typedef struct
{
byte r, g, b;
byte r, g, b;
} color24;
typedef struct
{
unsigned r, g, b, a;
unsigned r, g, b, a;
} colorVec;
#ifdef _WIN32
@ -768,15 +792,14 @@ typedef struct
typedef struct
{
qboolean allsolid; // if true, plane is not valid
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater;
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
plane_t plane; // surface normal at impact
edict_t *ent; // entity the surface is on
int hitgroup; // 0 == generic, non zero is specific body part
vec3_t endpos; // final position
plane_t plane; // surface normal at impact
edict_t *ent; // entity the surface is on
int hitgroup; // 0 == generic, non zero is specific body part
} trace_t;
#endif
#endif//CONST_H

View File

@ -12,25 +12,28 @@
* without written permission from Valve LLC.
*
****/
#pragma once
#ifndef CVARDEF_H
#define CVARDEF_H
#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc
#define FCVAR_USERINFO (1<<1) // changes the client's info string
#define FCVAR_SERVER (1<<2) // notifies players when changed
#define FCVAR_EXTDLL (1<<3) // defined by external DLL
#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
#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_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc
#define FCVAR_USERINFO (1<<1) // changes the client's info string
#define FCVAR_SERVER (1<<2) // notifies players when changed
#define FCVAR_EXTDLL (1<<3) // defined by external DLL
#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
#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;
float value;
struct cvar_s *next;
} cvar_t;
#endif
#endif//CVARDEF_H

View File

@ -12,18 +12,16 @@
* without written permission from Valve LLC.
*
****/
#if !defined ( DEMO_APIH )
#define DEMO_APIH
#ifdef _WIN32
#pragma once
#endif
#ifndef DEMO_API_H
#define DEMO_API_H
typedef struct demo_api_s
{
int ( *IsRecording ) ( void );
int ( *IsPlayingback ) ( void );
int ( *IsTimeDemo ) ( void );
void ( *WriteBuffer ) ( int size, unsigned char *buffer );
int (*IsRecording)( void );
int (*IsPlayingback)( void );
int (*IsTimeDemo)( void );
void (*WriteBuffer)( int size, unsigned char *buffer );
} demo_api_t;
extern demo_api_t demoapi;

View File

@ -12,22 +12,20 @@
* without written permission from Valve LLC.
*
****/
#if !defined ( DLIGHTH )
#define DLIGHTH
#ifdef _WIN32
#pragma once
#endif
#ifndef DLIGHT_H
#define DLIGHT_H
typedef struct dlight_s
{
vec3_t origin;
float radius;
color24 color;
float die; // stop lighting after this time
float decay; // drop this each second
float minlight; // don't add when contributing less
vec3_t origin;
float radius;
color24 color;
float die; // stop lighting after this time
float decay; // drop this each second
float minlight; // don't add when contributing less
int key;
qboolean dark; // subtracts light instead of adding
qboolean dark; // subtracts light instead of adding
} dlight_t;
#endif
#endif//DLIGHT_H

View File

@ -12,11 +12,9 @@
* without written permission from Valve LLC.
*
****/
#if !defined( ENTITY_STATEH )
#define ENTITY_STATEH
#ifdef _WIN32
#pragma once
#endif
#ifndef ENTITY_STATE_H
#define ENTITY_STATE_H
// For entityType below
#define ENTITY_NORMAL (1<<0)
@ -29,39 +27,38 @@ typedef struct entity_state_s entity_state_t;
struct entity_state_s
{
// Fields which are filled in by routines outside of delta compression
int entityType;
int entityType;
// Index into cl_entities array for this entity.
int number;
int number;
float msg_time;
// Message number last time the player/entity state was updated.
int messagenum;
int messagenum;
// Fields which can be transitted and reconstructed over the network stream
// Fields which can be transitted and reconstructed over the network stream
vec3_t origin;
vec3_t angles;
int modelindex;
int sequence;
int modelindex;
int sequence;
float frame;
int colormap;
int colormap;
short skin;
short solid;
int effects;
int effects;
float scale;
byte eflags;
// Render information
int rendermode;
int renderamt;
color24 rendercolor;
int renderfx;
int movetype;
// Render information
int rendermode;
int renderamt;
color24 rendercolor;
int renderfx;
int movetype;
float animtime;
float framerate;
int body;
int body;
byte controller[4];
byte blending[4];
vec3_t velocity;
@ -70,48 +67,48 @@ struct entity_state_s
vec3_t mins;
vec3_t maxs;
int aiment;
int aiment;
// If owned by a player, the index of that player ( for projectiles ).
int owner;
int owner;
// Friction, for prediction.
float friction;
// Gravity multiplier
float gravity;
float gravity;
// PLAYER SPECIFIC
int team;
int playerclass;
int health;
qboolean spectator;
int weaponmodel;
int gaitsequence;
int team;
int playerclass;
int health;
qboolean spectator;
int weaponmodel;
int gaitsequence;
// If standing on conveyor, e.g.
vec3_t basevelocity;
// Use the crouched hull, or the regular player hull.
int usehull;
int usehull;
// Latched buttons last time state updated.
int oldbuttons;
int oldbuttons;
// -1 = in air, else pmove entity number
int onground;
int iStepLeft;
int onground;
int iStepLeft;
// How fast we are falling
float flFallVelocity;
float fov;
int weaponanim;
int weaponanim;
// Parametric movement overrides
vec3_t startpos;
vec3_t endpos;
float impacttime;
float starttime;
vec3_t startpos;
vec3_t endpos;
float impacttime;
float starttime;
// For mods
int iuser1;
int iuser2;
int iuser3;
int iuser4;
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
@ -126,68 +123,65 @@ struct entity_state_s
typedef struct clientdata_s
{
vec3_t origin;
vec3_t velocity;
vec3_t origin;
vec3_t velocity;
int viewmodel;
vec3_t punchangle;
int flags;
int waterlevel;
int watertype;
vec3_t view_ofs;
float health;
int viewmodel;
vec3_t punchangle;
int flags;
int waterlevel;
int watertype;
vec3_t view_ofs;
float health;
int bInDuck;
int weapons; // remove?
int bInDuck;
int weapons; // remove?
int flTimeStepSound;
int flDuckTime;
int flSwimTime;
int waterjumptime;
int flTimeStepSound;
int flDuckTime;
int flSwimTime;
int waterjumptime;
float maxspeed;
float maxspeed;
float fov;
int weaponanim;
float fov;
int weaponanim;
int m_iId;
int ammo_shells;
int ammo_nails;
int ammo_cells;
int ammo_rockets;
float m_flNextAttack;
int m_iId;
int ammo_shells;
int ammo_nails;
int ammo_cells;
int ammo_rockets;
float m_flNextAttack;
int tfstate;
int pushmsec;
int deadflag;
char physinfo[ MAX_PHYSINFO_STRING ];
int tfstate;
int pushmsec;
int deadflag;
char physinfo[MAX_PHYSINFO_STRING];
// For mods
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
} clientdata_t;
#include "weaponinfo.h"
typedef struct local_state_s
{
entity_state_t playerstate;
clientdata_t client;
weapon_data_t weapondata[ 32 ];
entity_state_t playerstate;
clientdata_t client;
weapon_data_t weapondata[64];
} local_state_t;
#endif // !ENTITY_STATEH
#endif//ENTITY_STATE_H

View File

@ -12,15 +12,14 @@
* without written permission from Valve LLC.
*
****/
// entity_types.h
#if !defined( ENTITY_TYPESH )
#define ENTITY_TYPESH
#pragma once
#ifndef ENTITY_TYPES_H
#define ENTITY_TYPES_H
#define ET_NORMAL 0
#define ET_PLAYER 1
#define ET_TEMPENTITY 2
#define ET_BEAM 3
// BMODEL or SPRITE that was split across BSP nodes
#define ET_FRAGMENTED 4
#define ET_BEAM 3
#define ET_FRAGMENTED 4 // BMODEL or SPRITE that was split across BSP nodes
#endif // !ENTITY_TYPESH
#endif//ENTITY_TYPES_H

Some files were not shown because too many files have changed in this diff Show More