Skip to content

Commit

Permalink
v0.0.7 beta #1 (#60)
Browse files Browse the repository at this point in the history
* Revert QCVM changes

* improve throwing a bit

* fix warnings and autoformat

* Fix compilation under MSYS2/MinGW

* Refactoring

* Massively speed up compilation speed thanks to PCH

* WIP flick reload

* Fix flick direction

* Fix flick reload

* Improve throwing

* Remove test code

* Improved forcce grab reliability a bit

* Some minor fixes
  • Loading branch information
vittorioromeo authored Aug 30, 2022
1 parent ba03aa4 commit 0a66331
Show file tree
Hide file tree
Showing 88 changed files with 3,202 additions and 2,082 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Quake/quakespasm
[Rr]elease/
x64/
build/
build2/
[Bb]in/
[Oo]bj/

Expand Down
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(quakevr VERSION 0.0.5 LANGUAGES CXX)
project(quakevr VERSION 0.0.7 LANGUAGES CXX)

set(source_list
"Quake/bgmusic.cpp"
Expand Down Expand Up @@ -58,6 +58,8 @@ set(source_list
"Quake/pr_edict.cpp"
"Quake/pr_exec.cpp"
"Quake/pr_ext.cpp"
"Quake/qcvm.cpp"
"Quake/quakeglm_qvec3.cpp"
"Quake/quakeglm.cpp"
"Quake/r_alias.cpp"
"Quake/r_brush.cpp"
Expand Down Expand Up @@ -91,6 +93,7 @@ set(source_list
"Quake/sv_move.cpp"
"Quake/sv_phys.cpp"
"Quake/sv_user.cpp"
"Quake/util.cpp"
"Quake/view.cpp"
"Quake/vr_cvars.cpp"
"Quake/vr_showfn.cpp"
Expand Down Expand Up @@ -129,6 +132,11 @@ endif()
add_executable(${QUAKEVR_TARGET_NAME} "${source_list}")
set_target_properties(${QUAKEVR_TARGET_NAME} PROPERTIES LINKER_LANGUAGE CXX)

target_precompile_headers(
${QUAKEVR_TARGET_NAME} PRIVATE
"Quake/pch.hpp"
)

target_compile_features(${QUAKEVR_TARGET_NAME} PUBLIC cxx_std_17)
target_compile_options(${QUAKEVR_TARGET_NAME}
PRIVATE -Wall -Wextra -Wno-missing-field-initializers -Wpedantic -Wimplicit-fallthrough
Expand Down Expand Up @@ -189,6 +197,11 @@ set_property(TARGET ${QUAKEVR_TARGET_NAME} PROPERTY CXX_STANDARD 17)

include(FindOpenGL)

find_package(Boost 1.36.0 REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()

if (WIN32)
set(SDL2_LIBRARIES
"C:/OHWorkspace/quakevr/Windows/SDL2/lib64/SDL2main.lib"
Expand Down
15 changes: 15 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "clang_cl_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
4 changes: 4 additions & 0 deletions QC/client.qc
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,10 @@ void() PutClientInServer =
VRSetMainHandGrabbingBit(self, FALSE);
VRSetMainHandPrevGrabbingBit(self, FALSE);
VRSet2HAiming(self, FALSE);
VRSetOffHandReloadFlickingBit(self, FALSE);
VRSetOffHandPrevReloadFlickingBit(self, FALSE);
VRSetMainHandReloadFlickingBit(self, FALSE);
VRSetMainHandPrevReloadFlickingBit(self, FALSE);

self.offhand_forcegrabbing = FALSE;
self.mainhand_forcegrabbing = FALSE;
Expand Down
4 changes: 4 additions & 0 deletions QC/frikbot/bot_fight.qc
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ void() bot_setvrfields =
VRSetMainHandGrabbingBit(self, TRUE);
VRSetMainHandPrevGrabbingBit(self, TRUE);
VRSet2HAiming(self, FALSE);
VRSetOffHandReloadFlickingBit(self, TRUE);
VRSetOffHandPrevReloadFlickingBit(self, TRUE);
VRSetMainHandReloadFlickingBit(self, TRUE);
VRSetMainHandPrevReloadFlickingBit(self, TRUE);
}

void() bot_shoot =
Expand Down
6 changes: 6 additions & 0 deletions QC/items.qc
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,11 @@ AMMO

void() ammo_touch =
{
if (self.model == string_null || self.solid == SOLID_NOT)
{
return;
}

entity stemp;

if(self.weapon == AID_SHELLS)
Expand Down Expand Up @@ -1575,6 +1580,7 @@ void() DropBackpack =
item.handtouch = BackpackTouch;

MakeGrabbable(item);
item.solid = SOLID_NOT_BUT_TOUCHABLE;

item.flags |= FL_FORCEGRABBABLE;

Expand Down
Binary file modified QC/pak11.pak
Binary file not shown.
24 changes: 14 additions & 10 deletions QC/vr_defs.qc
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,20 @@ float QVR_VRFORCEGRABMODE_INSTANT = 3;
// Flags for VR bits: `vrbits0`
// ----------------------------------------------------------------------------

float QVR_VRBITS0_TELEPORTING = VRUTIL_POWER_OF_TWO(0);
float QVR_VRBITS0_OFFHAND_GRABBING = VRUTIL_POWER_OF_TWO(1);
float QVR_VRBITS0_OFFHAND_PREVGRABBING = VRUTIL_POWER_OF_TWO(2);
float QVR_VRBITS0_MAINHAND_GRABBING = VRUTIL_POWER_OF_TWO(3);
float QVR_VRBITS0_MAINHAND_PREVGRABBING = VRUTIL_POWER_OF_TWO(4);
float QVR_VRBITS0_2H_AIMING = VRUTIL_POWER_OF_TWO(5);
float QVR_VRBITS0_OFFHAND_RELOADING = VRUTIL_POWER_OF_TWO(6);
float QVR_VRBITS0_OFFHAND_PREVRELOADING = VRUTIL_POWER_OF_TWO(7);
float QVR_VRBITS0_MAINHAND_RELOADING = VRUTIL_POWER_OF_TWO(8);
float QVR_VRBITS0_MAINHAND_PREVRELOADING = VRUTIL_POWER_OF_TWO(9);
float QVR_VRBITS0_TELEPORTING = VRUTIL_POWER_OF_TWO(0);
float QVR_VRBITS0_OFFHAND_GRABBING = VRUTIL_POWER_OF_TWO(1);
float QVR_VRBITS0_OFFHAND_PREVGRABBING = VRUTIL_POWER_OF_TWO(2);
float QVR_VRBITS0_MAINHAND_GRABBING = VRUTIL_POWER_OF_TWO(3);
float QVR_VRBITS0_MAINHAND_PREVGRABBING = VRUTIL_POWER_OF_TWO(4);
float QVR_VRBITS0_2H_AIMING = VRUTIL_POWER_OF_TWO(5);
float QVR_VRBITS0_OFFHAND_RELOADING = VRUTIL_POWER_OF_TWO(6);
float QVR_VRBITS0_OFFHAND_PREVRELOADING = VRUTIL_POWER_OF_TWO(7);
float QVR_VRBITS0_MAINHAND_RELOADING = VRUTIL_POWER_OF_TWO(8);
float QVR_VRBITS0_MAINHAND_PREVRELOADING = VRUTIL_POWER_OF_TWO(9);
float QVR_VRBITS0_OFFHAND_RELOADFLICKING = VRUTIL_POWER_OF_TWO(10);
float QVR_VRBITS0_OFFHAND_PREVRELOADFLICKING = VRUTIL_POWER_OF_TWO(11);
float QVR_VRBITS0_MAINHAND_RELOADFLICKING = VRUTIL_POWER_OF_TWO(12);
float QVR_VRBITS0_MAINHAND_PREVRELOADFLICKING = VRUTIL_POWER_OF_TWO(13);

//
//
Expand Down
23 changes: 19 additions & 4 deletions QC/vr_handgrabutil.qc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ void(entity xEntPlayer,
float xLastGrabTime,
float* xOutLastGrabTime,
float xLastReleaseTime,
float* xOutLastReleaseTime)
float* xOutLastReleaseTime,
float xCurrReloadFlickingBit,
float xPrevReloadFlickingBit)
VR_HandGrabUtil_Impl_UpdateStateForHand =
{
if(!xPrevBit && xCurrBit) // Rising edge (grab)
Expand Down Expand Up @@ -66,7 +68,9 @@ void(entity xEntPlayer) VR_HandGrabUtil_UpdateState =
xEntPlayer.offhand_lastgrabtime,
&xEntPlayer.offhand_lastgrabtime,
xEntPlayer.offhand_lastreleasetime,
&xEntPlayer.offhand_lastreleasetime
&xEntPlayer.offhand_lastreleasetime,
VRGetOffHandReloadFlickingBit(xEntPlayer),
VRGetOffHandPrevReloadFlickingBit(xEntPlayer)
);

VR_HandGrabUtil_Impl_UpdateStateForHand(
Expand All @@ -77,11 +81,12 @@ void(entity xEntPlayer) VR_HandGrabUtil_UpdateState =
xEntPlayer.mainhand_lastgrabtime,
&xEntPlayer.mainhand_lastgrabtime,
xEntPlayer.mainhand_lastreleasetime,
&xEntPlayer.mainhand_lastreleasetime
&xEntPlayer.mainhand_lastreleasetime,
VRGetMainHandReloadFlickingBit(xEntPlayer),
VRGetMainHandPrevReloadFlickingBit(xEntPlayer)
);
}


float(entity xEntPlayer, float xHand) VR_HandGrabUtil_IsHandGrabbing =
{
return VRIsEntHandGrabbingBit(xEntPlayer, xHand);
Expand Down Expand Up @@ -111,3 +116,13 @@ float(entity xEntPlayer, float xHand) VR_HandGrabUtil_StoppedHandGrabbing =
return VRIsEntHandPrevGrabbingBit(xEntPlayer, xHand) &&
!VRIsEntHandGrabbingBit(xEntPlayer, xHand);
}

float(entity xEntPlayer, float xHand) VR_HandGrabUtil_IsHandReloadFlicking =
{
return VRIsEntHandReloadFlickingBit(xEntPlayer, xHand);
}

float(entity xEntPlayer, float xHand) VR_HandGrabUtil_IsHandPrevReloadFlicking =
{
return VRIsEntHandPrevReloadFlickingBit(xEntPlayer, xHand);
}
58 changes: 58 additions & 0 deletions QC/vr_util.qc
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,17 @@ float(entity e, float xHand) VRGetEntForceGrabbing =
else return e.mainhand_forcegrabbing;
}

float(entity e, float xHand) VRIsEntHandReloadFlickingBit =
{
if(xHand == cVR_OffHand) return VRGetOffHandReloadFlickingBit(e);
else return VRGetMainHandReloadFlickingBit(e);
}

float(entity e, float xHand) VRIsEntHandPrevReloadFlickingBit =
{
if(xHand == cVR_OffHand) return VRGetOffHandPrevReloadFlickingBit(e);
else return VRGetMainHandPrevReloadFlickingBit(e);
}

void(entity e, float xHand, float v) VRSetEntForceGrabbing =
{
Expand Down Expand Up @@ -480,6 +491,26 @@ float(entity ent) VRGetMainHandPrevReloadingBit =
return VRHasBit(ent.vrbits0, QVR_VRBITS0_MAINHAND_PREVRELOADING);
}

float(entity ent) VRGetOffHandReloadFlickingBit =
{
return VRHasBit(ent.vrbits0, QVR_VRBITS0_OFFHAND_RELOADFLICKING);
}

float(entity ent) VRGetOffHandPrevReloadFlickingBit =
{
return VRHasBit(ent.vrbits0, QVR_VRBITS0_OFFHAND_PREVRELOADFLICKING);
}

float(entity ent) VRGetMainHandReloadFlickingBit =
{
return VRHasBit(ent.vrbits0, QVR_VRBITS0_MAINHAND_RELOADFLICKING);
}

float(entity ent) VRGetMainHandPrevReloadFlickingBit =
{
return VRHasBit(ent.vrbits0, QVR_VRBITS0_MAINHAND_PREVRELOADFLICKING);
}


void(entity ent, float value) VRSetTeleporting =
{
Expand Down Expand Up @@ -531,6 +562,26 @@ void(entity ent, float value) VRSetMainHandPrevReloadingBit =
ent.vrbits0 = VRSetBit(ent.vrbits0, QVR_VRBITS0_MAINHAND_PREVRELOADING, value);
}

void(entity ent, float value) VRSetOffHandReloadFlickingBit =
{
ent.vrbits0 = VRSetBit(ent.vrbits0, QVR_VRBITS0_OFFHAND_RELOADFLICKING, value);
}

void(entity ent, float value) VRSetOffHandPrevReloadFlickingBit =
{
ent.vrbits0 = VRSetBit(ent.vrbits0, QVR_VRBITS0_OFFHAND_PREVRELOADFLICKING, value);
}

void(entity ent, float value) VRSetMainHandReloadFlickingBit =
{
ent.vrbits0 = VRSetBit(ent.vrbits0, QVR_VRBITS0_MAINHAND_RELOADFLICKING, value);
}

void(entity ent, float value) VRSetMainHandPrevReloadFlickingBit =
{
ent.vrbits0 = VRSetBit(ent.vrbits0, QVR_VRBITS0_MAINHAND_PREVRELOADFLICKING, value);
}

float() VRIsWeaponReloadingEnabled =
{
return (cvar_hget(cvarh_vr_reload_mode) != QVR_RELOADMODE_NONE) &&
Expand All @@ -543,3 +594,10 @@ float(entity ent, float xHand) VRIsWeaponReloadingEnabledFor =
VRIsWeaponReloadingEnabled() &&
WeaponIdToSupportsReload(VRGetWeapon(xHand));
}

float(entity ent, float xHand) VRIsWeaponReloadFlickingEnabledFor =
{
return ent.ishuman &&
VRIsWeaponReloadingEnabled() &&
WeaponIdToSupportsReloadFlicking(VRGetWeapon(xHand));
}
20 changes: 20 additions & 0 deletions QC/vr_weaponutil.qc
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,26 @@ float(float wid) WeaponIdToSupportsReload =
return -1;
}

float(float wid) WeaponIdToSupportsReloadFlicking =
{
if(wid == WID_FIST) { return FALSE; }
if(wid == WID_GRAPPLE) { return FALSE; }
if(wid == WID_AXE) { return FALSE; }
if(wid == WID_MJOLNIR) { return FALSE; }
if(wid == WID_SHOTGUN) { return FALSE; }
if(wid == WID_SUPER_SHOTGUN) { return TRUE; }
if(wid == WID_NAILGUN) { return FALSE; }
if(wid == WID_SUPER_NAILGUN) { return FALSE; }
if(wid == WID_GRENADE_LAUNCHER) { return FALSE; }
if(wid == WID_PROXIMITY_GUN) { return FALSE; }
if(wid == WID_ROCKET_LAUNCHER) { return FALSE; }
if(wid == WID_LIGHTNING) { return FALSE; }
if(wid == WID_LASER_CANNON) { return FALSE; }

ASSERT(FALSE);
return -1;
}

float(float wid) WeaponIdToBaseClipSize =
{
if(wid == WID_FIST) { return 0; }
Expand Down
Binary file modified QC/vrprogs.dat
Binary file not shown.
Loading

0 comments on commit 0a66331

Please sign in to comment.