Browse Source

Merge remote-tracking branch 'origin/travis' into residual_point

residual_point
Night Owl 7 years ago
parent
commit
9d4fb6353e
  1. 18
      .travis.yml
  2. 1
      CMakeLists.txt
  3. 121
      README.md
  4. 15
      cl_dll/Android.mk
  5. 14
      cl_dll/CMakeLists.txt
  6. 4
      cl_dll/GameStudioModelRenderer.h
  7. 4
      cl_dll/GameStudioModelRenderer_Sample.h
  8. 12
      cl_dll/Makefile
  9. 4
      cl_dll/StudioModelRenderer.h
  10. 2
      cl_dll/ammo.h
  11. 4
      cl_dll/ammohistory.h
  12. 2
      cl_dll/camera.h
  13. 77
      cl_dll/cdll_int.cpp
  14. 18
      cl_dll/cl_dll.dsp
  15. 4
      cl_dll/cl_dll.h
  16. 6
      cl_dll/cl_util.h
  17. 4
      cl_dll/com_weapons.h
  18. 84
      cl_dll/compile.bat
  19. 2
      cl_dll/demo.h
  20. 1
      cl_dll/ev_hldm.h
  21. 1
      cl_dll/eventscripts.h
  22. 4
      cl_dll/health.h
  23. 4
      cl_dll/hud.h
  24. 2
      cl_dll/hud_iface.h
  25. 8
      cl_dll/hud_redraw.cpp
  26. 4
      cl_dll/hud_spectator.h
  27. 2
      cl_dll/in_defs.h
  28. 1607
      cl_dll/input_goldsource.cpp
  29. 83
      cl_dll/input_mouse.cpp
  30. 79
      cl_dll/input_mouse.h
  31. 41
      cl_dll/input_xash3d.cpp
  32. 901
      cl_dll/inputw32.cpp
  33. 3
      cl_dll/kbutton.h
  34. 2
      cl_dll/overview.h
  35. 4
      cl_dll/parsemsg.h
  36. 4
      cl_dll/studio_util.h
  37. 6
      cl_dll/util_vector.h
  38. 2
      common/beamdef.h
  39. 2
      common/bspfile.h
  40. 2
      common/cl_entity.h
  41. 2
      common/com_model.h
  42. 1
      common/con_nprint.h
  43. 3
      common/const.h
  44. 1
      common/cvardef.h
  45. 2
      common/demo_api.h
  46. 2
      common/dlight.h
  47. 1
      common/entity_state.h
  48. 2
      common/entity_types.h
  49. 2
      common/event_api.h
  50. 1
      common/event_args.h
  51. 2
      common/event_flags.h
  52. 2
      common/gameinfo.h
  53. 2
      common/hltv.h
  54. 2
      common/ivoicetweak.h
  55. 2
      common/lightstyle.h
  56. 5
      common/mathlib.h
  57. 4
      common/net_api.h
  58. 2
      common/netadr.h
  59. 2
      common/particledef.h
  60. 2
      common/pmtrace.h
  61. 2
      common/qfont.h
  62. 2
      common/r_efx.h
  63. 3
      common/r_studioint.h
  64. 2
      common/ref_params.h
  65. 2
      common/render_api.h
  66. 2
      common/screenfade.h
  67. 2
      common/studio_event.h
  68. 2
      common/triangleapi.h
  69. 2
      common/usercmd.h
  70. 2
      common/wadfile.h
  71. 2
      common/weaponinfo.h
  72. 2
      common/wrect.h
  73. 4
      dlls/Makefile
  74. 2
      dlls/activity.h
  75. 5
      dlls/activitymap.h
  76. 1
      dlls/animation.h
  77. 2
      dlls/basemonster.h
  78. 2
      dlls/bigmomma.cpp
  79. 3
      dlls/cbase.h
  80. 2
      dlls/cdll_dll.h
  81. 1
      dlls/client.h
  82. 121
      dlls/compile.bat
  83. 1
      dlls/decals.h
  84. 1
      dlls/doors.h
  85. 8
      dlls/effects.cpp
  86. 3
      dlls/effects.h
  87. 3
      dlls/explode.h
  88. 1
      dlls/exportdef.h
  89. 3
      dlls/extdll.h
  90. 2
      dlls/flyingmonster.h
  91. 5
      dlls/func_break.h
  92. 6
      dlls/func_tank.cpp
  93. 2
      dlls/game.h
  94. 5
      dlls/gamerules.h
  95. 1
      dlls/hgrunt.cpp
  96. 5
      dlls/hornet.h
  97. 1
      dlls/items.h
  98. 2
      dlls/lights.cpp
  99. 1
      dlls/monsters.h
  100. 4
      dlls/mortar.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

18
.travis.yml

@ -5,10 +5,20 @@ compiler:
os: os:
- linux - linux
- osx - osx
sudo: true addons:
apt:
packages:
- gcc-multilib
- g++-multilib
before_script: before_script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gcc-multilib g++-multilib; fi - curl http://libsdl.org/release/SDL2-devel-2.0.7-mingw.tar.gz | tar xzf -
- mv SDL2-2.0.7/i686-w64-mingw32/include/SDL2 cl_dll/
script: script:
- mkdir -p build && cd build - mkdir -p build && cd build
- cmake ../ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VOICEMGR=0 && make -j3 && rm -rf * - cmake ../ -DCMAKE_C_FLAGS="-O2 -pipe -DNDEBUG -march=nocona -fvisibility=hidden -fomit-frame-pointer" -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined -Wl,--strip-all" -DGOLDSOURCE_SUPPORT=1 -DUSE_VOICEMGR=0 && make -j3
- cmake ../ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" -DUSE_VOICEMGR=1 && make -j3 && rm -rf * - mkdir -p gamelibs/cl_dlls
- mkdir -p gamelibs/dlls
- cp cl_dll/libclient.* gamelibs/cl_dlls
- cp dlls/libserver.* gamelibs/dlls
- tar -J -cf gamelibs.txz gamelibs
- curl --upload-file gamelibs.txz https://transfer.sh/gamelibs.txz

1
CMakeLists.txt

@ -31,6 +31,7 @@ option(USE_VGUI2 "Enable VGUI2. UNDONE" OFF)
option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) option(USE_VOICEMGR "Enable VOICE MANAGER." OFF)
option(BUILD_CLIENT "Build client dll" ON) option(BUILD_CLIENT "Build client dll" ON)
option(BUILD_SERVER "Build server dll" ON) option(BUILD_SERVER "Build server dll" ON)
option(GOLDSOURCE_SUPPORT "Build goldsource compatible client library" OFF)
#----------------- #-----------------
# MAIN BUILD CODE \ # MAIN BUILD CODE \

121
README.md

@ -6,22 +6,41 @@ Half-Life SDK for Xash3D & GoldSource with some fixes.
### CMake as most universal way ### CMake as most universal way
``` mkdir build && cd build
mkdir build && cd build cmake ../
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. 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: See below, if CMake is not suitable for you:
### Windows ### 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 TODO
### Linux ### Linux
TODO (cd dlls && make)
(cd cl_dll && make)
### OS X ### OS X
@ -29,14 +48,94 @@ TODO
### FreeBSD ### FreeBSD
``` (cd dlls && gmake CXX=clang++ CC=clang)
cd dlls (cd cl_dll && gmake CXX=clang++ CC=clang)
gmake CXX=clang++ CC=clang
cd ../cl_dll
gmake CXX=clang++ CC=clang
```
### Android ### Android
Just typical `ndk-build`. 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.

15
cl_dll/Android.mk

@ -68,6 +68,8 @@ SRCS+=./hud_spectator.cpp
SRCS+=./hud_update.cpp SRCS+=./hud_update.cpp
SRCS+=./in_camera.cpp SRCS+=./in_camera.cpp
SRCS+=./input.cpp SRCS+=./input.cpp
SRCS+=./input_goldsource.cpp
SRCS+=./input_mouse.cpp
#SRCS+=./inputw32.cpp #SRCS+=./inputw32.cpp
SRCS+=./menu.cpp SRCS+=./menu.cpp
SRCS+=./message.cpp SRCS+=./message.cpp
@ -89,7 +91,8 @@ SRCS+=./view.cpp
SRCS+=./input_xash3d.cpp SRCS+=./input_xash3d.cpp
SRCS+=./scoreboard.cpp SRCS+=./scoreboard.cpp
SRCS+=./MOTD.cpp SRCS+=./MOTD.cpp
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -I../utils/false_vgui/include
DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM -w DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM -w
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \ LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
@ -97,9 +100,17 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
$(LOCAL_PATH)/../engine \ $(LOCAL_PATH)/../engine \
$(LOCAL_PATH)/../game_shared \ $(LOCAL_PATH)/../game_shared \
$(LOCAL_PATH)/../dlls \ $(LOCAL_PATH)/../dlls \
$(LOCAL_PATH)/../pm_shared $(LOCAL_PATH)/../pm_shared \
$(LOCAL_PATH)/../utils/false_vgui/include
LOCAL_CFLAGS += $(DEFINES) $(INCLUDES) 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) LOCAL_SRC_FILES := $(SRCS) $(SRCS_C)
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

14
cl_dll/CMakeLists.txt

@ -26,6 +26,12 @@ project (CLDLL)
set (CLDLL_LIBRARY client) 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 -DCROWBAR_IDLE_ANIM -w") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -DCROWBAR_IDLE_ANIM -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(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
set (CLDLL_SOURCES set (CLDLL_SOURCES
@ -70,7 +76,9 @@ set (CLDLL_SOURCES
hud_update.cpp hud_update.cpp
in_camera.cpp in_camera.cpp
input.cpp input.cpp
#SRCS+=./inputw32.cpp input_goldsource.cpp
input_mouse.cpp
input_xash3d.cpp
menu.cpp menu.cpp
message.cpp message.cpp
overview.cpp overview.cpp
@ -88,10 +96,10 @@ set (CLDLL_SOURCES
tri.cpp tri.cpp
util.cpp util.cpp
view.cpp view.cpp
input_xash3d.cpp
scoreboard.cpp scoreboard.cpp
MOTD.cpp) MOTD.cpp)
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public)
include_directories (. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include)
if(USE_VOICEMGR) if(USE_VOICEMGR)
#set(CLDLL_SOURCES #set(CLDLL_SOURCES

4
cl_dll/GameStudioModelRenderer.h

@ -5,11 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined( GAMESTUDIOMODELRENDERER_H ) #if !defined( GAMESTUDIOMODELRENDERER_H )
#define GAMESTUDIOMODELRENDERER_H #define GAMESTUDIOMODELRENDERER_H
#if defined( _WIN32 )
#pragma once
#endif
/* /*
==================== ====================

4
cl_dll/GameStudioModelRenderer_Sample.h

@ -5,11 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined( GAMESTUDIOMODELRENDERER_H ) #if !defined( GAMESTUDIOMODELRENDERER_H )
#define GAMESTUDIOMODELRENDERER_H #define GAMESTUDIOMODELRENDERER_H
#if defined( _WIN32 )
#pragma once
#endif
/* /*
==================== ====================

12
cl_dll/Makefile

@ -45,7 +45,8 @@ SRCS+=./hud_spectator.cpp
SRCS+=./hud_update.cpp SRCS+=./hud_update.cpp
SRCS+=./in_camera.cpp SRCS+=./in_camera.cpp
SRCS+=./input.cpp SRCS+=./input.cpp
#SRCS+=./inputw32.cpp SRCS+=./input_mouse.cpp
SRCS+=./input_goldsource.cpp
SRCS+=./menu.cpp SRCS+=./menu.cpp
SRCS+=./message.cpp SRCS+=./message.cpp
SRCS+=./overview.cpp SRCS+=./overview.cpp
@ -66,15 +67,18 @@ SRCS+=./view.cpp
SRCS+=./input_xash3d.cpp SRCS+=./input_xash3d.cpp
SRCS+=./scoreboard.cpp SRCS+=./scoreboard.cpp
SRCS+=./MOTD.cpp SRCS+=./MOTD.cpp
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -I../utils/false_vgui/include
DEFINES = -Wno-write-strings -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL DEFINES = -Wno-write-strings -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL
CFLAGS = -m32 CFLAGS = -m32
OBJS = $(SRCS:.cpp=.o) $(SRCS_C:.c=.o) OBJS = $(SRCS:.cpp=.o) $(SRCS_C:.c=.o)
LIBS=-lm LIBS=-lm
ifeq ($(GOLDSOURCE_SUPPORT),1)
DEFINES += -DGOLDSOURCE_SUPPORT
endif
ifeq ($(shell uname -s),Linux) ifeq ($(shell uname -s),Linux)
LIBS=$(LIBS) -ldl LIBS += -ldl
endif endif
%.o : %.c %.o : %.c
@ -83,7 +87,7 @@ endif
%.o : %.cpp %.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@ $(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@
client.so : $(OBJS) client.so : $(OBJS)
$(CXX) $(OBJS) -o client.so -shared -Wl,--no-undefined -fPIC $(LIBS) $(CXX) $(CFLAGS) $(OBJS) -o client.so -shared -Wl,--no-undefined -fPIC $(LIBS)
clean: clean:
$(RM) $(OBJS) $(RM) $(OBJS)

4
cl_dll/StudioModelRenderer.h

@ -5,11 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined ( STUDIOMODELRENDERER_H ) #if !defined ( STUDIOMODELRENDERER_H )
#define STUDIOMODELRENDERER_H #define STUDIOMODELRENDERER_H
#if defined( _WIN32 )
#pragma once
#endif
/* /*
==================== ====================

2
cl_dll/ammo.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef __AMMO_H__ #ifndef __AMMO_H__
#define __AMMO_H__ #define __AMMO_H__

4
cl_dll/ammohistory.h

@ -15,6 +15,9 @@
// //
// ammohistory.h // ammohistory.h
// //
#pragma once
#ifndef AMMOHISTORY_H
#define AMMOHISTORY_H
// this is the max number of items in each bucket // this is the max number of items in each bucket
#define MAX_WEAPON_POSITIONS MAX_WEAPON_SLOTS #define MAX_WEAPON_POSITIONS MAX_WEAPON_SLOTS
@ -137,3 +140,4 @@ public:
}; };
extern HistoryResource gHR; extern HistoryResource gHR;
#endif // AMMOHISTORY_H

2
cl_dll/camera.h

@ -7,7 +7,7 @@
// Camera.h -- defines and such for a 3rd person camera // Camera.h -- defines and such for a 3rd person camera
// NOTE: must include quakedef.h first // NOTE: must include quakedef.h first
#pragma once
#ifndef _CAMERA_H_ #ifndef _CAMERA_H_
#define _CAMERA_H_ #define _CAMERA_H_

77
cl_dll/cdll_int.cpp

@ -23,6 +23,12 @@
#include "netadr.h" #include "netadr.h"
#include "parsemsg.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" extern "C"
{ {
#include "pm_shared.h" #include "pm_shared.h"
@ -177,6 +183,46 @@ int *HUD_GetRect( void )
return extent; 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 HUD_VidInit
@ -190,7 +236,25 @@ so the HUD can reinitialize itself.
int DLLEXPORT HUD_VidInit( void ) int DLLEXPORT HUD_VidInit( void )
{ {
gHUD.VidInit(); 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; return 1;
} }
@ -270,7 +334,13 @@ Called by engine every frame that client .dll is loaded
*/ */
void DLLEXPORT HUD_Frame( double time ) 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
} }
/* /*
@ -305,3 +375,8 @@ void DLLEXPORT HUD_MobilityInterface( mobile_engfuncs_t *gpMobileEngfuncs )
return; return;
gMobileEngfuncs = gpMobileEngfuncs; gMobileEngfuncs = gpMobileEngfuncs;
} }
bool isXashFWGS()
{
return gMobileEngfuncs != NULL;
}

18
cl_dll/cl_dll.dsp

@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 1 # PROP Ignore_Export_Lib 1
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\utils\vgui\include" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\utils\false_vgui\include" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /YX /FD /c
# SUBTRACT CPP /Z<none> # SUBTRACT CPP /Z<none>
# ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@ -80,7 +80,7 @@ SOURCE="$(InputPath)"
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /G5 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\dlls" /I "..\common" /I "..\pm_shared" /I "..\engine" /I "..\utils\vgui\include" /I "..\game_shared" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /FR /YX /FD /c # ADD CPP /nologo /G5 /MTd /W3 /Gm /GR /GX /ZI /Od /I "..\dlls" /I "..\common" /I "..\pm_shared" /I "..\engine" /I "..\utils\false_vgui\include" /I "..\game_shared" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"
@ -300,7 +300,15 @@ SOURCE=.\input.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\inputw32.cpp SOURCE=.\input_goldsource.cpp
# End Source File
# Begin Source File
SOURCE=.\input_mouse.cpp
# End Source File
# Begin Source File
SOURCE=.\input_xash3d.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -513,6 +521,10 @@ SOURCE=.\in_defs.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\input_mouse.h
# End Source File
# Begin Source File
SOURCE=..\common\itrackeruser.h SOURCE=..\common\itrackeruser.h
# End Source File # End Source File
# Begin Source File # Begin Source File

4
cl_dll/cl_dll.h

@ -25,6 +25,9 @@
// - Drawing the HUD graphics every frame // - Drawing the HUD graphics every frame
// - Handling the custum HUD-update packets // - Handling the custum HUD-update packets
// //
#pragma once
#ifndef CL_DLL_H
#define CL_DLL_H
typedef unsigned char byte; typedef unsigned char byte;
typedef unsigned short word; typedef unsigned short word;
typedef float vec_t; typedef float vec_t;
@ -48,3 +51,4 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
extern cl_enginefunc_t gEngfuncs; extern cl_enginefunc_t gEngfuncs;
#include "../engine/mobility_int.h" #include "../engine/mobility_int.h"
extern mobile_engfuncs_t *gMobileEngfuncs; extern mobile_engfuncs_t *gMobileEngfuncs;
#endif

6
cl_dll/cl_util.h

@ -15,7 +15,8 @@
// //
// cl_util.h // cl_util.h
// //
#ifndef CL_UTIL_H
#define CL_UTIL_H
#include "exportdef.h" #include "exportdef.h"
#include "cvardef.h" #include "cvardef.h"
@ -179,3 +180,6 @@ inline void UnpackRGB( int &r, int &g, int &b, unsigned long ulRGB )\
} }
HSPRITE LoadSprite( const char *pszName ); HSPRITE LoadSprite( const char *pszName );
bool isXashFWGS();
#endif

4
cl_dll/com_weapons.h

@ -7,11 +7,9 @@
// com_weapons.h // com_weapons.h
// Shared weapons common function prototypes // Shared weapons common function prototypes
#pragma once
#if !defined( COM_WEAPONSH ) #if !defined( COM_WEAPONSH )
#define COM_WEAPONSH #define COM_WEAPONSH
#ifdef _WIN32
#pragma once
#endif
#include "hud_iface.h" #include "hud_iface.h"

84
cl_dll/compile.bat

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

2
cl_dll/demo.h

@ -5,9 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined( DEMOH ) #if !defined( DEMOH )
#define DEMOH #define DEMOH
#pragma once
// Types of demo messages we can write/parse // Types of demo messages we can write/parse
enum enum

1
cl_dll/ev_hldm.h

@ -5,6 +5,7 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined ( EV_HLDMH ) #if !defined ( EV_HLDMH )
#define EV_HLDMH #define EV_HLDMH

1
cl_dll/eventscripts.h

@ -6,6 +6,7 @@
//============================================================================= //=============================================================================
// eventscripts.h // eventscripts.h
#pragma once
#if !defined ( EVENTSCRIPTSH ) #if !defined ( EVENTSCRIPTSH )
#define EVENTSCRIPTSH #define EVENTSCRIPTSH

4
cl_dll/health.h

@ -12,6 +12,9 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef HEALTH_H
#define HEALTH_H
#define DMG_IMAGE_LIFE 2 // seconds that image is up #define DMG_IMAGE_LIFE 2 // seconds that image is up
@ -122,3 +125,4 @@ private:
void CalcDamageDirection( vec3_t vecFrom ); void CalcDamageDirection( vec3_t vecFrom );
void UpdateTiles( float fTime, long bits ); void UpdateTiles( float fTime, long bits );
}; };
#endif // HEALTH_H

4
cl_dll/hud.h

@ -20,6 +20,9 @@
// CHud handles the message, calculation, and drawing the HUD // CHud handles the message, calculation, and drawing the HUD
// //
#pragma once
#ifndef HUD_H
#define HUD_H
#define RGB_YELLOWISH 0x00FFFFFF //255,255,255 #define RGB_YELLOWISH 0x00FFFFFF //255,255,255
#define RGB_REDISH 0x00FF1010 //255,160,0 #define RGB_REDISH 0x00FF1010 //255,160,0
#define RGB_GREENISH 0x0000A000 //0,160,0 #define RGB_GREENISH 0x0000A000 //0,160,0
@ -677,3 +680,4 @@ extern int g_iTeamNumber;
extern int g_iUser1; extern int g_iUser1;
extern int g_iUser2; extern int g_iUser2;
extern int g_iUser3; extern int g_iUser3;
#endif

2
cl_dll/hud_iface.h

@ -5,9 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined( HUD_IFACEH ) #if !defined( HUD_IFACEH )
#define HUD_IFACEH #define HUD_IFACEH
#pragma once
#include "exportdef.h" #include "exportdef.h"

8
cl_dll/hud_redraw.cpp

@ -235,6 +235,8 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, const char *szIt, int r,
int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b ) int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b )
{ {
if (isXashFWGS())
{
// xash3d: reset unicode state // xash3d: reset unicode state
gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 ); gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 );
@ -256,8 +258,12 @@ int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g
int c = (unsigned int)(unsigned char)*szIt; int c = (unsigned int)(unsigned char)*szIt;
xpos += gEngfuncs.pfnVGUI2DrawCharacterAdditive( xpos, ypos, c, r, g, b, 0 ); xpos += gEngfuncs.pfnVGUI2DrawCharacterAdditive( xpos, ypos, c, r, g, b, 0 );
} }
return xpos; return xpos;
}
else
{
return gHUD.DrawHudString(xpos, ypos, iMaxX, szIt, r, g, b);
}
} }
int CHud::DrawHudStringLen( const char *szIt ) int CHud::DrawHudStringLen( const char *szIt )

4
cl_dll/hud_spectator.h

@ -5,9 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#ifndef SPECTATOR_H
#define SPECTATOR_H
#pragma once #pragma once
#ifndef HUD_SPECTATOR_H
#define HUD_SPECTATOR_H
#include "cl_entity.h" #include "cl_entity.h"

2
cl_dll/in_defs.h

@ -5,9 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined( IN_DEFSH ) #if !defined( IN_DEFSH )
#define IN_DEFSH #define IN_DEFSH
#pragma once
// up / down // up / down
#define PITCH 0 #define PITCH 0

1607
cl_dll/input_goldsource.cpp

File diff suppressed because it is too large Load Diff

83
cl_dll/input_mouse.cpp

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

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

41
cl_dll/input_xash3d.cpp

@ -3,14 +3,9 @@
#include "cvardef.h" #include "cvardef.h"
#include "kbutton.h" #include "kbutton.h"
#include "keydefs.h" #include "keydefs.h"
cvar_t *sensitivity; #include "input_mouse.h"
cvar_t *in_joystick; extern cvar_t *sensitivity;
#define PITCH 0 extern cvar_t *in_joystick;
#define YAW 1
#define ROLL 2
extern "C" void DLLEXPORT IN_ClientMoveEvent( float forwardmove, float sidemove );
extern "C" void DLLEXPORT IN_ClientLookEvent( float relyaw, float relpitch );
extern kbutton_t in_strafe; extern kbutton_t in_strafe;
extern kbutton_t in_mlook; extern kbutton_t in_mlook;
@ -37,12 +32,6 @@ extern cvar_t *cl_movespeedkey;
cvar_t *cl_laddermode; 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 F 1U<<0 // Forward
#define B 1U<<1 // Back #define B 1U<<1 // Back
#define L 1U<<2 // Left #define L 1U<<2 // Left
@ -55,7 +44,7 @@ float rel_pitch;
#define IMPULSE_UP 4 #define IMPULSE_UP 4
int CL_IsDead( void ); int CL_IsDead( void );
Vector dead_viewangles(0, 0, 0); extern Vector dead_viewangles;
void IN_ToggleButtons( float forwardmove, float sidemove ) 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"); //gEngfuncs.Con_Printf("IN_MoveEvent\n");
@ -144,14 +133,14 @@ void IN_ClientMoveEvent( float forwardmove, float sidemove )
ac_movecount++; ac_movecount++;
} }
void IN_ClientLookEvent( float relyaw, float relpitch ) void FWGSInput::IN_ClientLookEvent( float relyaw, float relpitch )
{ {
rel_yaw += relyaw; rel_yaw += relyaw;
rel_pitch += relpitch; rel_pitch += relpitch;
} }
// Rotate camera and add move values to usercmd // 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; Vector viewangles;
bool fLadder = false; bool fLadder = false;
@ -235,7 +224,7 @@ void IN_Move( float frametime, usercmd_t *cmd )
ac_movecount = 0; ac_movecount = 0;
} }
extern "C" void DLLEXPORT IN_MouseEvent( int mstate ) void FWGSInput::IN_MouseEvent( int mstate )
{ {
static int mouse_oldbuttonstate; static int mouse_oldbuttonstate;
// perform button actions // perform button actions
@ -257,37 +246,37 @@ extern "C" void DLLEXPORT IN_MouseEvent( int mstate )
// Stubs // Stubs
extern "C" void DLLEXPORT IN_ClearStates( void ) void FWGSInput::IN_ClearStates( void )
{ {
//gEngfuncs.Con_Printf( "IN_ClearStates\n" ); //gEngfuncs.Con_Printf( "IN_ClearStates\n" );
} }
extern "C" void DLLEXPORT IN_ActivateMouse( void ) void FWGSInput::IN_ActivateMouse( void )
{ {
//gEngfuncs.Con_Printf( "IN_ActivateMouse\n" ); //gEngfuncs.Con_Printf( "IN_ActivateMouse\n" );
} }
extern "C" void DLLEXPORT IN_DeactivateMouse( void ) void FWGSInput::IN_DeactivateMouse( void )
{ {
//gEngfuncs.Con_Printf( "IN_DeactivateMouse\n" ); //gEngfuncs.Con_Printf( "IN_DeactivateMouse\n" );
} }
extern "C" void DLLEXPORT IN_Accumulate( void ) void FWGSInput::IN_Accumulate( void )
{ {
//gEngfuncs.Con_Printf( "IN_Accumulate\n" ); //gEngfuncs.Con_Printf( "IN_Accumulate\n" );
} }
void IN_Commands( void ) void FWGSInput::IN_Commands( void )
{ {
//gEngfuncs.Con_Printf( "IN_Commands\n" ); //gEngfuncs.Con_Printf( "IN_Commands\n" );
} }
void IN_Shutdown( void ) void FWGSInput::IN_Shutdown( void )
{ {
} }
// Register cvars and reset data // Register cvars and reset data
void IN_Init( void ) void FWGSInput::IN_Init( void )
{ {
sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE ); sensitivity = gEngfuncs.pfnRegisterVariable( "sensitivity", "3", FCVAR_ARCHIVE );
in_joystick = gEngfuncs.pfnRegisterVariable( "joystick", "0", FCVAR_ARCHIVE ); in_joystick = gEngfuncs.pfnRegisterVariable( "joystick", "0", FCVAR_ARCHIVE );

901
cl_dll/inputw32.cpp

@ -1,901 +0,0 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// in_win.c -- windows 95 mouse and joystick code
// 02/21/97 JCB Added extended DirectInput code to support external controllers.
#include "hud.h"
#include "cl_util.h"
#include "camera.h"
#include "kbutton.h"
#include "cvardef.h"
#include "usercmd.h"
#include "const.h"
#include "camera.h"
#include "in_defs.h"
#include "../engine/keydefs.h"
//#include "view.h"
#include "windows.h"
#define MOUSE_BUTTON_COUNT 5
// Set this to 1 to show mouse cursor. Experimental
int g_iVisibleMouse = 0;
extern "C"
{
void DLLEXPORT IN_ActivateMouse( void );
void DLLEXPORT IN_DeactivateMouse( void );
void DLLEXPORT IN_MouseEvent( int mstate );
void DLLEXPORT IN_Accumulate( void );
void DLLEXPORT IN_ClearStates( void );
}
extern cl_enginefunc_t gEngfuncs;
extern int iMouseInUse;
extern kbutton_t in_strafe;
extern kbutton_t in_mlook;
extern kbutton_t in_speed;
extern kbutton_t in_jlook;
extern cvar_t *m_pitch;
extern cvar_t *m_yaw;
extern cvar_t *m_forward;
extern cvar_t *m_side;
extern cvar_t *lookstrafe;
extern cvar_t *lookspring;
extern cvar_t *cl_pitchdown;
extern cvar_t *cl_pitchup;
extern cvar_t *cl_yawspeed;
extern cvar_t *cl_sidespeed;
extern cvar_t *cl_forwardspeed;
extern cvar_t *cl_pitchspeed;
extern cvar_t *cl_movespeedkey;
// mouse variables
cvar_t *m_filter;
cvar_t *sensitivity;
int mouse_buttons;
int mouse_oldbuttonstate;
POINT current_pos;
int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum;
static int restore_spi;
static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1};
static int mouseactive;
int mouseinitialized;
static int mouseparmsvalid;
static int mouseshowtoggle = 1;
// joystick defines and variables
// where should defines be moved?
#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick
#define JOY_RELATIVE_AXIS 0x00000010 // control like a mouse, spinner, trackball
#define JOY_MAX_AXES 6 // X, Y, Z, R, U, V
#define JOY_AXIS_X 0
#define JOY_AXIS_Y 1
#define JOY_AXIS_Z 2
#define JOY_AXIS_R 3
#define JOY_AXIS_U 4
#define JOY_AXIS_V 5
enum _ControlList
{
AxisNada = 0,
AxisForward,
AxisLook,
AxisSide,
AxisTurn
};
DWORD dwAxisFlags[JOY_MAX_AXES] =
{
JOY_RETURNX,
JOY_RETURNY,
JOY_RETURNZ,
JOY_RETURNR,
JOY_RETURNU,
JOY_RETURNV
};
DWORD dwAxisMap[JOY_MAX_AXES];
DWORD dwControlMap[JOY_MAX_AXES];
PDWORD pdwRawValue[JOY_MAX_AXES];
// none of these cvars are saved over a session
// this means that advanced controller configuration needs to be executed
// each time. this avoids any problems with getting back to a default usage
// or when changing from one controller to another. this way at least something
// works.
cvar_t *in_joystick;
cvar_t *joy_name;
cvar_t *joy_advanced;
cvar_t *joy_advaxisx;
cvar_t *joy_advaxisy;
cvar_t *joy_advaxisz;
cvar_t *joy_advaxisr;
cvar_t *joy_advaxisu;
cvar_t *joy_advaxisv;
cvar_t *joy_forwardthreshold;
cvar_t *joy_sidethreshold;
cvar_t *joy_pitchthreshold;
cvar_t *joy_yawthreshold;
cvar_t *joy_forwardsensitivity;
cvar_t *joy_sidesensitivity;
cvar_t *joy_pitchsensitivity;
cvar_t *joy_yawsensitivity;
cvar_t *joy_wwhack1;
cvar_t *joy_wwhack2;
int joy_avail, joy_advancedinit, joy_haspov;
DWORD joy_oldbuttonstate, joy_oldpovstate;
int joy_id;
DWORD joy_flags;
DWORD joy_numbuttons;
static JOYINFOEX ji;
/*
===========
Force_CenterView_f
===========
*/
void Force_CenterView_f( void )
{
vec3_t viewangles;
if( !iMouseInUse )
{
gEngfuncs.GetViewAngles( (float *)viewangles );
viewangles[PITCH] = 0;
gEngfuncs.SetViewAngles( (float *)viewangles );
}
}
/*
===========
IN_ActivateMouse
===========
*/
void DLLEXPORT IN_ActivateMouse( void )
{
if( mouseinitialized )
{
if( mouseparmsvalid )
restore_spi = SystemParametersInfo( SPI_SETMOUSE, 0, newmouseparms, 0 );
mouseactive = 1;
}
}
/*
===========
IN_DeactivateMouse
===========
*/
void DLLEXPORT IN_DeactivateMouse( void )
{
if( mouseinitialized )
{
if( restore_spi )
SystemParametersInfo( SPI_SETMOUSE, 0, originalmouseparms, 0 );
mouseactive = 0;
}
}
/*
===========
IN_StartupMouse
===========
*/
void IN_StartupMouse( void )
{
if( gEngfuncs.CheckParm( "-nomouse", NULL ) )
return;
mouseinitialized = 1;
mouseparmsvalid = SystemParametersInfo( SPI_GETMOUSE, 0, originalmouseparms, 0 );
if( mouseparmsvalid )
{
if( gEngfuncs.CheckParm( "-noforcemspd", NULL ) )
newmouseparms[2] = originalmouseparms[2];
if( gEngfuncs.CheckParm( "-noforcemaccel", NULL ) )
{
newmouseparms[0] = originalmouseparms[0];
newmouseparms[1] = originalmouseparms[1];
}
if( gEngfuncs.CheckParm( "-noforcemparms", NULL ) )
{
newmouseparms[0] = originalmouseparms[0];
newmouseparms[1] = originalmouseparms[1];
newmouseparms[2] = originalmouseparms[2];
}
}
mouse_buttons = MOUSE_BUTTON_COUNT;
}
/*
===========
IN_Shutdown
===========
*/
void IN_Shutdown( void )
{
IN_DeactivateMouse ();
}
/*
===========
IN_GetMousePos
Ask for mouse position from engine
===========
*/
void IN_GetMousePos( int *mx, int *my )
{
gEngfuncs.GetMousePosition( mx, my );
}
/*
===========
IN_ResetMouse
FIXME: Call through to engine?
===========
*/
void IN_ResetMouse( void )
{
SetCursorPos ( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() );
}
/*
===========
IN_MouseEvent
===========
*/
void DLLEXPORT IN_MouseEvent( int mstate )
{
int i;
if( iMouseInUse || g_iVisibleMouse )
return;
// perform button actions
for( i = 0; i < mouse_buttons; i++ )
{
if( ( mstate & ( 1 << i ) ) &&
!( mouse_oldbuttonstate & ( 1 << i ) ) )
{
gEngfuncs.Key_Event( K_MOUSE1 + i, 1 );
}
if( !( mstate & ( 1 << i ) ) &&
( mouse_oldbuttonstate & ( 1 << i ) ) )
{
gEngfuncs.Key_Event( K_MOUSE1 + i, 0 );
}
}
mouse_oldbuttonstate = mstate;
}
/*
===========
IN_MouseMove
===========
*/
void IN_MouseMove( float frametime, usercmd_t *cmd )
{
int mx, my;
vec3_t viewangles;
gEngfuncs.GetViewAngles( (float *)viewangles );
//jjb - this disbles normal mouse control if the user is trying to
// move the camera, or if the mouse cursor is visible or if we're in intermission
if( !iMouseInUse && !g_iVisibleMouse && !gHUD.m_iIntermission )
{
GetCursorPos( &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 ();
}

3
cl_dll/kbutton.h

@ -4,10 +4,9 @@
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined( KBUTTONH ) #if !defined( KBUTTONH )
#define KBUTTONH #define KBUTTONH
#pragma once
typedef struct kbutton_s typedef struct kbutton_s
{ {

2
cl_dll/overview.h

@ -5,9 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#ifndef OVERVIEW_H #ifndef OVERVIEW_H
#define OVERVIEW_H #define OVERVIEW_H
#pragma once
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Handles the drawing of the top-down map and all the things on it // Purpose: Handles the drawing of the top-down map and all the things on it

4
cl_dll/parsemsg.h

@ -15,6 +15,9 @@
// //
// parsemsg.h // parsemsg.h
// //
#pragma once
#ifndef PARSEMSG_H
#define PARSEMSG_H
#define ASSERT( x ) #define ASSERT( x )
@ -30,6 +33,7 @@ float READ_COORD( void );
float READ_ANGLE( void ); float READ_ANGLE( void );
float READ_HIRESANGLE( void ); float READ_HIRESANGLE( void );
#endif // PARSEMSG_H

4
cl_dll/studio_util.h

@ -5,11 +5,9 @@
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================
#pragma once
#if !defined( STUDIO_UTIL_H ) #if !defined( STUDIO_UTIL_H )
#define STUDIO_UTIL_H #define STUDIO_UTIL_H
#if defined( WIN32 )
#pragma once
#endif
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h

6
cl_dll/util_vector.h

@ -15,6 +15,9 @@
// Vector.h // Vector.h
// A subset of the extdll.h in the project HL Entity DLL // 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 // Misc C-runtime library headers
#include "stdio.h" #include "stdio.h"
@ -23,7 +26,7 @@
// Header file containing definition of globalvars_t and entvars_t // Header file containing definition of globalvars_t and entvars_t
typedef unsigned int func_t; // typedef unsigned int func_t; //
typedef unsigned int string_t; // from engine's pr_comp.h; typedef int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h typedef float vec_t; // needed before including progdefs.h
//========================================================= //=========================================================
@ -124,3 +127,4 @@ inline float DotProduct( const Vector& a, const Vector& b) { return( a.x * b.x +
inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x ); } 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 #define vec3_t Vector
#endif // UTIL_VECTOR_H

2
common/beamdef.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef BEAMDEF_H #ifndef BEAMDEF_H
#define BEAMDEF_H #define BEAMDEF_H

2
common/bspfile.h

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#pragma once
#ifndef BSPFILE_H #ifndef BSPFILE_H
#define BSPFILE_H #define BSPFILE_H

2
common/cl_entity.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef CL_ENTITY_H #ifndef CL_ENTITY_H
#define CL_ENTITY_H #define CL_ENTITY_H

2
common/com_model.h

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#pragma once
#ifndef COM_MODEL_H #ifndef COM_MODEL_H
#define COM_MODEL_H #define COM_MODEL_H

1
common/con_nprint.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef CON_NPRINT_H #ifndef CON_NPRINT_H
#define CON_NPRINT_H #define CON_NPRINT_H

3
common/const.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef CONST_H #ifndef CONST_H
#define CONST_H #define CONST_H
// //
@ -733,7 +734,7 @@ enum
}; };
typedef unsigned int func_t; typedef unsigned int func_t;
typedef unsigned int string_t; typedef int string_t;
typedef unsigned char byte; typedef unsigned char byte;
typedef unsigned short word; typedef unsigned short word;

1
common/cvardef.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef CVARDEF_H #ifndef CVARDEF_H
#define CVARDEF_H #define CVARDEF_H

2
common/demo_api.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef DEMO_API_H #ifndef DEMO_API_H
#define DEMO_API_H #define DEMO_API_H

2
common/dlight.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef DLIGHT_H #ifndef DLIGHT_H
#define DLIGHT_H #define DLIGHT_H

1
common/entity_state.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef ENTITY_STATE_H #ifndef ENTITY_STATE_H
#define ENTITY_STATE_H #define ENTITY_STATE_H

2
common/entity_types.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef ENTITY_TYPES_H #ifndef ENTITY_TYPES_H
#define ENTITY_TYPES_H #define ENTITY_TYPES_H

2
common/event_api.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef EVENT_API_H #ifndef EVENT_API_H
#define EVENT_API_H #define EVENT_API_H

1
common/event_args.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef EVENT_ARGS_H #ifndef EVENT_ARGS_H
#define EVENT_ARGS_H #define EVENT_ARGS_H

2
common/event_flags.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef EVENT_FLAGS_H #ifndef EVENT_FLAGS_H
#define EVENT_FLAGS_H #define EVENT_FLAGS_H

2
common/gameinfo.h

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#pragma once
#ifndef GAMEINFO_H #ifndef GAMEINFO_H
#define GAMEINFO_H #define GAMEINFO_H

2
common/hltv.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef HLTV_H #ifndef HLTV_H
#define HLTV_H #define HLTV_H

2
common/ivoicetweak.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef IVOICETWEAK_H #ifndef IVOICETWEAK_H
#define IVOICETWEAK_H #define IVOICETWEAK_H

2
common/lightstyle.h

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#pragma once
#ifndef LIGHTSTYLE_H #ifndef LIGHTSTYLE_H
#define LIGHTSTYLE_H #define LIGHTSTYLE_H

5
common/mathlib.h

@ -13,7 +13,9 @@
* *
****/ ****/
// mathlib.h // mathlib.h
#pragma once
#ifndef MATHLIB_H
#define MATHLIB_H
#include <math.h> #include <math.h>
typedef float vec_t; typedef float vec_t;
@ -98,3 +100,4 @@ float anglemod(float a);
) \ ) \
: \ : \
BoxOnPlaneSide( (emins), (emaxs), (p))) BoxOnPlaneSide( (emins), (emaxs), (p)))
#endif // MATHLIB_H

4
common/net_api.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef NET_API_H #ifndef NET_API_H
#define NET_API_H #define NET_API_H
@ -94,4 +94,4 @@ typedef struct net_api_s
void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize ); void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize );
} net_api_t; } net_api_t;
#endif//NET_APIH #endif // NET_APIH

2
common/netadr.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef NETADR_H #ifndef NETADR_H
#define NETADR_H #define NETADR_H

2
common/particledef.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef PARTICLEDEF_H #ifndef PARTICLEDEF_H
#define PARTICLEDEF_H #define PARTICLEDEF_H

2
common/pmtrace.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef PM_TRACE_H #ifndef PM_TRACE_H
#define PM_TRACE_H #define PM_TRACE_H

2
common/qfont.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef QFONT_H #ifndef QFONT_H
#define QFONT_H #define QFONT_H

2
common/r_efx.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef R_EFX_H #ifndef R_EFX_H
#define R_EFX_H #define R_EFX_H

3
common/r_studioint.h

@ -12,8 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef R_STUDIOINT_H #ifndef R_STUDIOINT_H
#define R_STUDIOINT_H #define R_STUDIOINT_H

2
common/ref_params.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef REF_PARAMS_H #ifndef REF_PARAMS_H
#define REF_PARAMS_H #define REF_PARAMS_H

2
common/render_api.h

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#pragma once
#ifndef RENDER_API_H #ifndef RENDER_API_H
#define RENDER_API_H #define RENDER_API_H

2
common/screenfade.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef SCREENFADE_H #ifndef SCREENFADE_H
#define SCREENFADE_H #define SCREENFADE_H

2
common/studio_event.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef STUDIO_EVENT_H #ifndef STUDIO_EVENT_H
#define STUDIO_EVENT_H #define STUDIO_EVENT_H

2
common/triangleapi.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef TRIANGLEAPI_H #ifndef TRIANGLEAPI_H
#define TRIANGLEAPI_H #define TRIANGLEAPI_H

2
common/usercmd.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef USERCMD_H #ifndef USERCMD_H
#define USERCMD_H #define USERCMD_H

2
common/wadfile.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef WADFILE_H #ifndef WADFILE_H
#define WADFILE_H #define WADFILE_H

2
common/weaponinfo.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef WEAPONINFO_H #ifndef WEAPONINFO_H
#define WEAPONINFO_H #define WEAPONINFO_H

2
common/wrect.h

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#pragma once
#ifndef WRECT_H #ifndef WRECT_H
#define WRECT_H #define WRECT_H

4
dlls/Makefile

@ -129,13 +129,13 @@ OBJ = \
$(DLL_OBJDIR)/multiplay_gamerules.o \ $(DLL_OBJDIR)/multiplay_gamerules.o \
$(DLL_OBJDIR)/nihilanth.o \ $(DLL_OBJDIR)/nihilanth.o \
$(DLL_OBJDIR)/nodes.o \ $(DLL_OBJDIR)/nodes.o \
$(DLL_OBJDIR)/observer.cpp \^M $(DLL_OBJDIR)/observer.o \
$(DLL_OBJDIR)/osprey.o \ $(DLL_OBJDIR)/osprey.o \
$(DLL_OBJDIR)/pathcorner.o \ $(DLL_OBJDIR)/pathcorner.o \
$(DLL_OBJDIR)/plane.o \ $(DLL_OBJDIR)/plane.o \
$(DLL_OBJDIR)/plats.o \ $(DLL_OBJDIR)/plats.o \
$(DLL_OBJDIR)/player.o \ $(DLL_OBJDIR)/player.o \
$(DLL_OBJDIR)/playermonster.o \^M $(DLL_OBJDIR)/playermonster.o \
$(DLL_OBJDIR)/python.o \ $(DLL_OBJDIR)/python.o \
$(DLL_OBJDIR)/rat.o \ $(DLL_OBJDIR)/rat.o \
$(DLL_OBJDIR)/roach.o \ $(DLL_OBJDIR)/roach.o \

2
dlls/activity.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef ACTIVITY_H #ifndef ACTIVITY_H
#define ACTIVITY_H #define ACTIVITY_H

5
dlls/activitymap.h

@ -12,7 +12,9 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef ACTIVITYMAP_H
#define ACTIVITYMAP_H
#define _A( a ) { a, #a } #define _A( a ) { a, #a }
activity_map_t activity_map[] = activity_map_t activity_map[] =
@ -95,3 +97,4 @@ _A( ACT_FLINCH_LEFTLEG ),
_A( ACT_FLINCH_RIGHTLEG ), _A( ACT_FLINCH_RIGHTLEG ),
{ 0, NULL } { 0, NULL }
}; };
#endif // ACTIVITYMAP_H

1
dlls/animation.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef ANIMATION_H #ifndef ANIMATION_H
#define ANIMATION_H #define ANIMATION_H

2
dlls/basemonster.h

@ -12,7 +12,7 @@
* use or distribution of this code by or to any unlicensed person is illegal. * use or distribution of this code by or to any unlicensed person is illegal.
* *
****/ ****/
#pragma once
#ifndef BASEMONSTER_H #ifndef BASEMONSTER_H
#define BASEMONSTER_H #define BASEMONSTER_H

2
dlls/bigmomma.cpp

@ -49,7 +49,7 @@ public:
virtual int Restore( CRestore &restore ); virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[]; static TYPEDESCRIPTION m_SaveData[];
int m_preSequence; string_t m_preSequence;
}; };
LINK_ENTITY_TO_CLASS( info_bigmomma, CInfoBM ) LINK_ENTITY_TO_CLASS( info_bigmomma, CInfoBM )

3
dlls/cbase.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef CBASE_H #ifndef CBASE_H
#define CBASE_H #define CBASE_H
/* /*
@ -439,7 +440,7 @@ class CBaseDelay : public CBaseEntity
{ {
public: public:
float m_flDelay; float m_flDelay;
int m_iszKillTarget; string_t m_iszKillTarget;
virtual void KeyValue( KeyValueData *pkvd ); virtual void KeyValue( KeyValueData *pkvd );
virtual int Save( CSave &save ); virtual int Save( CSave &save );

2
dlls/cdll_dll.h

@ -16,7 +16,7 @@
// cdll_dll.h // cdll_dll.h
// this file is included by both the game-dll and the client-dll, // this file is included by both the game-dll and the client-dll,
#pragma once
#ifndef CDLL_DLL_H #ifndef CDLL_DLL_H
#define CDLL_DLL_H #define CDLL_DLL_H

1
dlls/client.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef CLIENT_H #ifndef CLIENT_H
#define CLIENT_H #define CLIENT_H

121
dlls/compile.bat

@ -0,0 +1,121 @@
@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
set SOURCES=agrunt.cpp^
airtank.cpp^
aflock.cpp^
animating.cpp^
animation.cpp^
apache.cpp^
barnacle.cpp^
barney.cpp^
bigmomma.cpp^
bloater.cpp^
bmodels.cpp^
bullsquid.cpp^
buttons.cpp^
cbase.cpp^
client.cpp^
combat.cpp^
controller.cpp^
crossbow.cpp^
crowbar.cpp^
defaultai.cpp^
doors.cpp^
effects.cpp^
egon.cpp^
explode.cpp^
flyingmonster.cpp^
func_break.cpp^
func_tank.cpp^
game.cpp^
gamerules.cpp^
gargantua.cpp^
gauss.cpp^
genericmonster.cpp^
ggrenade.cpp^
globals.cpp^
glock.cpp^
gman.cpp^
h_ai.cpp^
h_battery.cpp^
h_cine.cpp^
h_cycler.cpp^
h_export.cpp^
handgrenade.cpp^
hassassin.cpp^
headcrab.cpp^
healthkit.cpp^
hgrunt.cpp^
hornet.cpp^
hornetgun.cpp^
houndeye.cpp^
ichthyosaur.cpp^
islave.cpp^
items.cpp^
leech.cpp^
lights.cpp^
maprules.cpp^
monstermaker.cpp^
monsters.cpp^
monsterstate.cpp^
mortar.cpp^
mp5.cpp^
multiplay_gamerules.cpp^
nihilanth.cpp^
nodes.cpp^
observer.cpp^
osprey.cpp^
pathcorner.cpp^
plane.cpp^
plats.cpp^
player.cpp^
playermonster.cpp^
python.cpp^
rat.cpp^
roach.cpp^
rpg.cpp^
satchel.cpp^
schedule.cpp^
scientist.cpp^
scripted.cpp^
shotgun.cpp^
singleplay_gamerules.cpp^
skill.cpp^
sound.cpp^
soundent.cpp^
spectator.cpp^
squadmonster.cpp^
squeakgrenade.cpp^
subs.cpp^
talkmonster.cpp^
teamplay_gamerules.cpp^
tempmonster.cpp^
tentacle.cpp^
triggers.cpp^
tripmine.cpp^
turret.cpp^
util.cpp^
weapons.cpp^
world.cpp^
xen.cpp^
zombie.cpp^
../pm_shared/pm_debug.c ../pm_shared/pm_math.c ../pm_shared/pm_shared.c
set DEFINES=/DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR
set LIBS=user32.lib
set OUTNAME=hl.dll
set DEBUG=/debug
cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% %DEBUG% /def:".\hl.def"
echo -- Compile done. Cleaning...
del *.obj *.exp *.lib *.ilk
echo -- Done.

1
dlls/decals.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef DECALS_H #ifndef DECALS_H
#define DECALS_H #define DECALS_H

1
dlls/doors.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef DOORS_H #ifndef DOORS_H
#define DOORS_H #define DOORS_H

8
dlls/effects.cpp

@ -380,8 +380,8 @@ public:
void BeamUpdateVars( void ); void BeamUpdateVars( void );
int m_active; int m_active;
int m_iszStartEntity; string_t m_iszStartEntity;
int m_iszEndEntity; string_t m_iszEndEntity;
float m_life; float m_life;
int m_boltWidth; int m_boltWidth;
int m_noiseAmplitude; int m_noiseAmplitude;
@ -389,7 +389,7 @@ public:
int m_speed; int m_speed;
float m_restrike; float m_restrike;
int m_spriteTexture; int m_spriteTexture;
int m_iszSpriteName; string_t m_iszSpriteName;
int m_frameStart; int m_frameStart;
float m_radius; float m_radius;
@ -2181,6 +2181,8 @@ public:
void CItemSoda::Precache( void ) void CItemSoda::Precache( void )
{ {
PRECACHE_MODEL( "models/can.mdl" );
PRECACHE_SOUND( "weapons/g_bounce3.wav" );
} }
LINK_ENTITY_TO_CLASS( item_sodacan, CItemSoda ) LINK_ENTITY_TO_CLASS( item_sodacan, CItemSoda )

3
dlls/effects.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef EFFECTS_H #ifndef EFFECTS_H
#define EFFECTS_H #define EFFECTS_H
@ -321,7 +322,7 @@ public:
static TYPEDESCRIPTION m_SaveData[]; static TYPEDESCRIPTION m_SaveData[];
CSprite *m_pSprite; CSprite *m_pSprite;
int m_iszSpriteName; string_t m_iszSpriteName;
Vector m_firePosition; Vector m_firePosition;
}; };
#endif //EFFECTS_H #endif //EFFECTS_H

3
dlls/explode.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef EXPLODE_H #ifndef EXPLODE_H
#define EXPLODE_H #define EXPLODE_H
@ -26,4 +27,4 @@ extern DLL_GLOBAL short g_sModelIndexFireball;
extern DLL_GLOBAL short g_sModelIndexSmoke; extern DLL_GLOBAL short g_sModelIndexSmoke;
extern void ExplosionCreate( const Vector &center, const Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage ); extern void ExplosionCreate( const Vector &center, const Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage );
#endif //EXPLODE_H #endif // EXPLODE_H

1
dlls/exportdef.h

@ -1,3 +1,4 @@
#pragma once
#ifndef EXPORTDEF_H #ifndef EXPORTDEF_H
#define EXPORTDEF_H #define EXPORTDEF_H
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__

3
dlls/extdll.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef EXTDLL_H #ifndef EXTDLL_H
#define EXTDLL_H #define EXTDLL_H
@ -69,7 +70,7 @@ typedef int BOOL;
// Header file containing definition of globalvars_t and entvars_t // Header file containing definition of globalvars_t and entvars_t
typedef unsigned int func_t; typedef unsigned int func_t;
typedef unsigned int string_t; // from engine's pr_comp.h; typedef int string_t; // from engine's pr_comp.h;
typedef float vec_t; // needed before including progdefs.h typedef float vec_t; // needed before including progdefs.h
// Vector class // Vector class

2
dlls/flyingmonster.h

@ -13,7 +13,7 @@
* *
****/ ****/
// Base class for flying monsters. This overrides the movement test & execution code from CBaseMonster // Base class for flying monsters. This overrides the movement test & execution code from CBaseMonster
#pragma once
#ifndef FLYINGMONSTER_H #ifndef FLYINGMONSTER_H
#define FLYINGMONSTER_H #define FLYINGMONSTER_H

5
dlls/func_break.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef FUNC_BREAK_H #ifndef FUNC_BREAK_H
#define FUNC_BREAK_H #define FUNC_BREAK_H
@ -84,7 +85,7 @@ public:
Explosions m_Explosion; Explosions m_Explosion;
int m_idShard; int m_idShard;
float m_angle; float m_angle;
int m_iszGibModel; string_t m_iszGibModel;
int m_iszSpawnObject; string_t m_iszSpawnObject;
}; };
#endif // FUNC_BREAK_H #endif // FUNC_BREAK_H

6
dlls/func_tank.cpp

@ -120,14 +120,14 @@ protected:
Vector m_barrelPos; // Length of the freakin barrel Vector m_barrelPos; // Length of the freakin barrel
float m_spriteScale; // Scale of any sprites we shoot float m_spriteScale; // Scale of any sprites we shoot
int m_iszSpriteSmoke; string_t m_iszSpriteSmoke;
int m_iszSpriteFlash; string_t m_iszSpriteFlash;
TANKBULLET m_bulletType; // Bullet type TANKBULLET m_bulletType; // Bullet type
int m_iBulletDamage; // 0 means use Bullet type's default damage int m_iBulletDamage; // 0 means use Bullet type's default damage
Vector m_sightOrigin; // Last sight of target Vector m_sightOrigin; // Last sight of target
int m_spread; // firing spread int m_spread; // firing spread
int m_iszMaster; // Master entity (game_team_master or multisource) string_t m_iszMaster; // Master entity (game_team_master or multisource)
}; };
TYPEDESCRIPTION CFuncTank::m_SaveData[] = TYPEDESCRIPTION CFuncTank::m_SaveData[] =

2
dlls/game.h

@ -12,7 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef GAME_H #ifndef GAME_H
#define GAME_H #define GAME_H

5
dlls/gamerules.h

@ -15,7 +15,9 @@
//========================================================= //=========================================================
// GameRules // GameRules
//========================================================= //=========================================================
#pragma once
#ifndef GAMERULES_H
#define GAMERULES_H
//#include "weapons.h" //#include "weapons.h"
//#include "items.h" //#include "items.h"
class CBasePlayerItem; class CBasePlayerItem;
@ -361,3 +363,4 @@ protected:
}; };
extern DLL_GLOBAL CGameRules *g_pGameRules; extern DLL_GLOBAL CGameRules *g_pGameRules;
#endif // GAMERULES_H

1
dlls/hgrunt.cpp

@ -806,6 +806,7 @@ void CHGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
} }
} }
break;
default: default:
CSquadMonster::HandleAnimEvent( pEvent ); CSquadMonster::HandleAnimEvent( pEvent );
break; break;

5
dlls/hornet.h

@ -15,7 +15,9 @@
//========================================================= //=========================================================
// Hornets // Hornets
//========================================================= //=========================================================
#pragma once
#ifndef HORNET_H
#define HORNET_H
//========================================================= //=========================================================
// Hornet Defines // Hornet Defines
//========================================================= //=========================================================
@ -55,3 +57,4 @@ public:
int m_iHornetType; int m_iHornetType;
float m_flFlySpeed; float m_flFlySpeed;
}; };
#endif // HORNET_H

1
dlls/items.h

@ -12,6 +12,7 @@
* without written permission from Valve LLC. * without written permission from Valve LLC.
* *
****/ ****/
#pragma once
#ifndef ITEMS_H #ifndef ITEMS_H
#define ITEMS_H #define ITEMS_H

2
dlls/lights.cpp

@ -38,7 +38,7 @@ public:
private: private:
int m_iStyle; int m_iStyle;
int m_iszPattern; string_t m_iszPattern;
}; };
LINK_ENTITY_TO_CLASS( light, CLight ) LINK_ENTITY_TO_CLASS( light, CLight )

1
dlls/monsters.h

@ -12,6 +12,7 @@
* use or distribution of this code by or to any unlicensed person is illegal. * use or distribution of this code by or to any unlicensed person is illegal.
* *
****/ ****/
#pragma once
#ifndef MONSTERS_H #ifndef MONSTERS_H
#include "skill.h" #include "skill.h"
#define MONSTERS_H #define MONSTERS_H

4
dlls/mortar.cpp

@ -45,8 +45,8 @@ public:
void EXPORT FieldUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); void EXPORT FieldUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
int m_iszXController; string_t m_iszXController;
int m_iszYController; string_t m_iszYController;
float m_flSpread; float m_flSpread;
float m_flDelay; float m_flDelay;
int m_iCount; int m_iCount;

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

Loading…
Cancel
Save