Change hand model; Allow hand model adjustment; Move weapon adustments to pak

This commit is contained in:
Petr Bartos 2024-04-16 19:19:52 +02:00
parent bea98592d2
commit 2844b21186
10 changed files with 71 additions and 6 deletions

View file

@ -3885,10 +3885,47 @@ void CG_AddViewHand( playerState_t *ps ) {
memset( &handEnt, 0, sizeof(refEntity_t) );
CG_CalculateVROffHandPosition( handEnt.origin, angles );
float scale = 1.0f;
char offhand_adjustment[256];
trap_Cvar_VariableStringBuffer("vr_offhand_adjustment", offhand_adjustment, 256);
if (strlen(offhand_adjustment) > 0) {
vec3_t adjust, offset, temp_offset;
VectorClear(adjust);
VectorClear(offset);
VectorClear(temp_offset);
sscanf(offhand_adjustment, "%f,%f,%f,%f,%f,%f,%f", &scale,
&(temp_offset[0]), &(temp_offset[1]), &(temp_offset[2]),
&(adjust[PITCH]), &(adjust[YAW]), &(adjust[ROLL]));
VectorScale(temp_offset, scale, offset);
if (cgVR->right_handed)
{
//yaw needs to go in the other direction as left handed model is reversed
adjust[YAW] *= -1.0f;
}
//Adjust angles for hand models that aren't aligned very well
matrix4x4 m1, m2, m3;
vec3_t zero;
VectorClear(zero);
Matrix4x4_CreateFromEntity(m1, angles, zero, 1.0);
Matrix4x4_CreateFromEntity(m2, adjust, zero, 1.0);
Matrix4x4_Concat(m3, m1, m2);
Matrix4x4_ConvertToEntity(m3, angles, zero);
//Now move weapon closer to proper origin
vec3_t forward, right, up;
AngleVectors( angles, forward, right, up );
VectorMA( handEnt.origin, offset[2], forward, handEnt.origin );
VectorMA( handEnt.origin, offset[1], up, handEnt.origin );
if (cgVR->right_handed) {
VectorMA(handEnt.origin, offset[0], right, handEnt.origin);
} else {
VectorMA(handEnt.origin, -offset[0], right, handEnt.origin);
}
}
vec3_t axis[3];
AnglesToAxis(angles, handEnt.axis);
for ( int i = 0; i < 3; i++ ) {
VectorScale( handEnt.axis[i], (cgVR->right_handed || i != 1) ? 1.0f : -1.0f, handEnt.axis[i] );
VectorScale( handEnt.axis[i], (cgVR->right_handed || i != 1) ? scale : -scale, handEnt.axis[i] );
}
handEnt.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON | RF_MINLIGHT | RF_VIEWWEAPON;

View file

@ -2006,9 +2006,10 @@ void Com_Init( char *commandLine ) {
Cbuf_AddText( "exec autoexec.cfg\n" );
//Execute to overwrite additional vr models location with our desired adjustments
Cbuf_AddText( "exec models_vr.cfg\n" );
//Execute to overwrite weapon locations with our desired adjustments
Cbuf_AddText( "exec weapons_vr.cfg\n" );
//Execute last to allow user adjustment of weapon models if they have something else to use
Cbuf_AddText( "exec weapons_user.cfg\n" );

View file

@ -4570,6 +4570,9 @@ static void UI_RunMenuScript( char **args ) {
Controls_SetDefaults();
trap_Cvar_Set( "com_introPlayed", "1" );
trap_Cvar_Set( "com_recommendedSet", "1" ); // NERVE - SMF
trap_Cmd_ExecuteText( EXEC_NOW, "exec models_vr.cfg\n" );
trap_Cmd_ExecuteText( EXEC_NOW, "exec weapons_vr.cfg\n" );
trap_Cmd_ExecuteText( EXEC_NOW, "exec weapons_user.cfg\n" );
trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
// end from MP
} else if ( Q_stricmp( name, "getCDKey" ) == 0 ) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -0,0 +1,4 @@
// Offes for other VR models
// Values are: scale,right,up,forward,pitch,yaw,roll
seta vr_offhand_adjustment "1,-1,-1,-1,0,0,0"

View file

@ -147,6 +147,20 @@ itemDef {
decoration
}
itemDef {
name none
type ITEM_TYPE_TEXT
rect 0 260 640 40
text "LennyGuy20"
forecolor 1 1 1 1
textscale .3
textalign ITEM_ALIGN_CENTER
textalignx 320
textaligny 10
visible 1
decoration
}
itemDef {
name none
type ITEM_TYPE_TEXT

View file

@ -237,9 +237,6 @@ import static android.system.Os.setenv;
//Copy the command line params file
copy_asset("/sdcard/RTCWQuest", "commandline.txt", false);
//Copy the weapon adjustment config
copy_asset("/sdcard/RTCWQuest/Main", "weapons_vr.cfg", false);
//and the demo version - if required
copy_asset("/sdcard/RTCWQuest/Main", "pak0.pk3", false);
@ -248,7 +245,7 @@ import static android.system.Os.setenv;
//and some additional vr assets
copy_asset("/sdcard/RTCWQuest/Main", "z_vr_assets.pk3", true);
// (also delete pak from previous version)
// (delete asset pak from previous version)
File oldAssetPak = new File("/sdcard/RTCWQuest/Main/z_rtcwquest_vrmenu.pk3");
if (oldAssetPak.exists()) {
try {
@ -257,6 +254,15 @@ import static android.system.Os.setenv;
e.printStackTrace();
}
}
// (weapon adjustment was moved to pak, users can still use weapons_user.cfg to re-adjust)
File oldWeaponAdjustment = new File("/sdcard/RTCWQuest/Main/weapons_vr.cfg");
if (oldWeaponAdjustment.exists()) {
try {
oldWeaponAdjustment.delete();
} catch (Exception e) {
e.printStackTrace();
}
}
//and the venom scripting improvements pak (thank-you _HELLBARON_ !!)
copy_asset("/sdcard/RTCWQuest/Main", "sp_vpak8.pk3", false);