Merge pull request #112 from SanyaSho/fixes

Fixes (x2)
This commit is contained in:
nillerusr 2022-08-20 00:05:05 +03:00 committed by GitHub
commit 1f0ae521d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 85 additions and 48 deletions

View File

@ -135,7 +135,7 @@ void CHudFlashlight::Paint()
surface()->DrawSetTextPos( m_IconX, m_IconY );
surface()->DrawUnicodeChar( pState );
// Don't draw the progress bar is we're fully charged
// Don't draw the progress bar if we're fully charged
if ( bIsOn == false && chunkCount == enabledChunks )
return;

View File

@ -17,6 +17,8 @@ extern ConVar cl_forwardspeed;
extern ConVar cl_upspeed;
extern ConVar default_fov;
extern IMatSystemSurface *g_pMatSystemSurface;
#ifdef ANDROID
#define TOUCH_DEFAULT "1"
#else
@ -39,6 +41,8 @@ ConVar touch_grid_count( "touch_grid_count", "50", FCVAR_ARCHIVE, "touch grid co
ConVar touch_grid_enable( "touch_grid_enable", "1", FCVAR_ARCHIVE, "enable touch grid" );
ConVar touch_precise_amount( "touch_precise_amount", "0.5", FCVAR_ARCHIVE, "sensitivity multiplier for precise-look" );
ConVar touch_button_info( "touch_button_info", "0", FCVAR_ARCHIVE );
#define boundmax( num, high ) ( (num) < (high) ? (num) : (high) )
#define boundmin( num, low ) ( (num) >= (low) ? (num) : (low) )
#define bound( low, num, high ) ( boundmin( boundmax(num, high), low ))
@ -141,7 +145,7 @@ CON_COMMAND( touch_addbutton, "add native touch button" )
Msg( "Usage: touch_addbutton <name> <texture> <command> [<x1> <y1> <x2> <y2> [ r g b a ] ]\n" );
}
CON_COMMAND( touch_removebutton, "add native touch button" )
CON_COMMAND( touch_removebutton, "remove native touch button" )
{
if( args.ArgC() > 1 )
gTouch.RemoveButton( args[1] );
@ -149,7 +153,7 @@ CON_COMMAND( touch_removebutton, "add native touch button" )
Msg( "Usage: touch_removebutton <name>\n" );
}
CON_COMMAND( touch_settexture, "add native touch button" )
CON_COMMAND( touch_settexture, "set button texture" )
{
if( args.ArgC() >= 3 )
{
@ -232,6 +236,15 @@ CON_COMMAND( touch_loaddefaults, "generate config from defaults" )
{
gTouch.ResetToDefaults();
}
CON_COMMAND( touch_setgridcolor, "change grid color" )
{
if( args.ArgC() >= 5 )
gTouch.gridcolor = rgba_t( Q_atoi( args[1] ), Q_atoi( args[2] ), Q_atoi( args[3] ), Q_atoi( args[4] ) );
else
Msg( "Usage: touch_setgridcolor <r> <g> <b> <a>\n" );
}
/*
CON_COMMAND( touch_roundall, "round all buttons coordinates to grid" )
{
@ -294,6 +307,7 @@ void CTouchControls::ResetToDefaults()
{
rgba_t color(255, 255, 255, 155);
char buf[MAX_PATH];
gridcolor = rgba_t(255, 0, 0, 50);
RemoveButtons();
@ -351,6 +365,7 @@ void CTouchControls::Init()
mouse_events = 0;
move_start_x = move_start_y = 0.0f;
m_flPreviousYaw = m_flPreviousPitch = 0.f;
gridcolor = rgba_t(255, 0, 0, 50);
showtexture = hidetexture = resettexture = closetexture = joytexture = 0;
configchanged = false;
@ -463,7 +478,7 @@ void CTouchControls::Paint( )
if( state == state_edit )
{
vgui::surface()->DrawSetColor(255, 0, 0, 200);
vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a*3); // 255, 0, 0, 200 <- default here
float x,y;
for( x = 0.0f; x < 1.0f; x += GRID_X )
@ -471,6 +486,7 @@ void CTouchControls::Paint( )
for( y = 0.0f; y < 1.0f; y += GRID_Y )
vgui::surface()->DrawLine( 0, screen_h*y, screen_w, screen_h*y );
}
CUtlLinkedList<CTouchButton*>::iterator it;
@ -487,7 +503,16 @@ void CTouchControls::Paint( )
if( state == state_edit && !(btn->flags & TOUCH_FL_NOEDIT) )
{
vgui::surface()->DrawSetColor(255, 0, 0, 50);
if( touch_button_info.GetInt() )
{
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h, 255, 255, 255, 255, "N: %s", btn->name ); // name
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+10, 255, 255, 255, 255, "T: %s", btn->texturefile ); // texture
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+20, 255, 255, 255, 255, "C: %s", btn->command ); // command
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+30, 255, 255, 255, 255, "F: %i", btn->flags ); // flags
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+40, 255, 255, 255, 255, "RGBA: %d %d %d %d", btn->color.r, btn->color.g, btn->color.b, btn->color.a );// color
}
vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a); // 255, 0, 0, 50 <- default here
vgui::surface()->DrawFilledRect( btn->x1*screen_w, btn->y1*screen_h, btn->x2*screen_w, btn->y2*screen_h );
}
}
@ -795,7 +820,7 @@ void CTouchControls::EnableTouchEdit(bool enable)
resize_finger = move_finger = look_finger = wheel_finger = -1;
move_button = NULL;
configchanged = true;
AddButton( "close_edit", "vgui/touch/back", "touch_disableedit", 0.010000, 0.837778, 0.080000, 0.980000, rgba_t(255,255,255,255), 0, 1.f, TOUCH_FL_NOEDIT );
AddButton( "close_edit", "vgui/touch/back", "touch_disableedit", 0.020000, 0.800000, 0.100000, 0.977778, rgba_t(255,255,255,255), 0, 1.f, TOUCH_FL_NOEDIT );
}
else
{
@ -848,6 +873,9 @@ void CTouchControls::WriteConfig()
filesystem->FPrintf( f, "\n// grid settings\n" );
filesystem->FPrintf( f, "touch_grid_count \"%d\"\n", touch_grid_count.GetInt() );
filesystem->FPrintf( f, "touch_grid_enable \"%d\"\n", touch_grid_enable.GetInt() );
filesystem->FPrintf( f, "touch_setgridcolor \"%d\" \"%d\" \"%d\" \"%d\"\n", gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a );
filesystem->FPrintf( f, "touch_button_info \"%d\"\n", touch_button_info.GetInt() );
/*
filesystem->FPrintf( f, "\n// global overstroke (width, r, g, b, a)\n" );
filesystem->FPrintf( f, "touch_set_stroke %d %d %d %d %d\n", touch.swidth, touch.scolor[0], touch.scolor[1], touch.scolor[2], touch.scolor[3] );

View File

@ -193,6 +193,7 @@ public:
float screen_h, screen_w;
float forward, side, movecount;
float yaw, pitch;
rgba_t gridcolor;
private:
bool initialized = false;

View File

@ -125,20 +125,20 @@ void CDebugOverlay::Paint()
if (pCurrText->bUseOrigin)
{
if (!debugoverlay->ScreenPosition( pCurrText->origin, screenPos ))
if (!debugoverlay->ScreenPosition( pCurrText->origin, screenPos ))
{
float xPos = screenPos[0];
float yPos = screenPos[1]+ (pCurrText->lineOffset*13); // Line spacing;
g_pMatSystemSurface->DrawColoredText( m_hFont, xPos, yPos, r, g, b, a, pCurrText->text );
g_pMatSystemSurface->DrawColoredText( m_hFont, xPos, yPos, r, g, b, a, "%s", pCurrText->text );
}
}
else
{
if (!debugoverlay->ScreenPosition( pCurrText->flXPos,pCurrText->flYPos, screenPos ))
{
if (!debugoverlay->ScreenPosition( pCurrText->flXPos,pCurrText->flYPos, screenPos ))
{
float xPos = screenPos[0];
float yPos = screenPos[1]+ (pCurrText->lineOffset*13); // Line spacing;
g_pMatSystemSurface->DrawColoredText( m_hFont, xPos, yPos, r, g, b, a, pCurrText->text );
g_pMatSystemSurface->DrawColoredText( m_hFont, xPos, yPos, r, g, b, a, "%s", pCurrText->text );
}
}
}

View File

@ -24,11 +24,7 @@ class VPlane;
// near and far Z it uses to render the world.
#ifndef HL1_CLIENT_DLL
#define VIEW_NEARZ 7
#else
#define VIEW_NEARZ 3
#endif
//#define VIEW_FARZ 28400

View File

@ -1257,7 +1257,7 @@ int CAI_AssaultBehavior::TranslateSchedule( int scheduleType )
break;
case SCHED_HOLD_RALLY_POINT:
if( HasCondition(COND_NO_PRIMARY_AMMO) | HasCondition(COND_LOW_PRIMARY_AMMO) )
if( HasCondition(COND_NO_PRIMARY_AMMO) || HasCondition(COND_LOW_PRIMARY_AMMO) )
{
return SCHED_RELOAD;
}

View File

@ -5336,7 +5336,7 @@ public:
{
const char *target = "", *action = "Use";
variant_t value;
int delay = 0;
float delay = 0;
target = STRING( AllocPooledString(command.Arg( 1 ) ) );

View File

@ -3007,6 +3007,8 @@ void CNPC_Manhack::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r
}
else
{
m_pPrevOwner.Set( GetOwnerEntity() );
// Suppress collisions between the manhack and the player; we're currently bumping
// almost certainly because it's not purely a physics object.
SetOwnerEntity( pPhysGunUser );
@ -3022,8 +3024,10 @@ void CNPC_Manhack::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t r
//-----------------------------------------------------------------------------
void CNPC_Manhack::OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Reason )
{
SetOwnerEntity( m_pPrevOwner.Get() );
// Stop suppressing collisions between the manhack and the player
SetOwnerEntity( NULL );
m_pPrevOwner.Set( NULL );
m_bHeld = false;

View File

@ -254,6 +254,7 @@ private:
CSprite *m_pLightGlow;
CHandle<SmokeTrail> m_hSmokeTrail;
CHandle<CBaseEntity> m_pPrevOwner;
int m_iPanel1;
int m_iPanel2;

View File

@ -19,9 +19,9 @@
#define SLAM_SPRITE "sprites/redglow1.vmt"
ConVar sk_plr_dmg_satchel ( "sk_plr_dmg_satchel","0");
ConVar sk_npc_dmg_satchel ( "sk_npc_dmg_satchel","0");
ConVar sk_satchel_radius ( "sk_satchel_radius","0");
ConVar sk_plr_dmg_satchel ( "sk_plr_dmg_satchel","150"); // commented lines in hl2/skill.cfg
ConVar sk_npc_dmg_satchel ( "sk_npc_dmg_satchel","75");
ConVar sk_satchel_radius ( "sk_satchel_radius","150");
BEGIN_DATADESC( CSatchelCharge )
@ -73,15 +73,14 @@ void CSatchelCharge::Spawn( void )
SetThink( &CSatchelCharge::SatchelThink );
SetNextThink( gpGlobals->curtime + 0.1f );
m_flDamage = sk_plr_dmg_satchel.GetFloat();
m_DmgRadius = sk_satchel_radius.GetFloat();
m_takedamage = DAMAGE_YES;
m_iHealth = 1;
SetGravity( UTIL_ScaleForGravity( 560 ) ); // slightly lower gravity
SetFriction( 1.0 );
SetSequence( 1 );
SetDamage( 150 );
SetDamage( sk_plr_dmg_satchel.GetFloat() );
SetDamageRadius( sk_satchel_radius.GetFloat() );
m_bIsAttached = false;
m_bInAir = true;
@ -118,7 +117,7 @@ void CSatchelCharge::CreateEffects( void )
//-----------------------------------------------------------------------------
void CSatchelCharge::InputExplode( inputdata_t &inputdata )
{
ExplosionCreate( GetAbsOrigin() + Vector( 0, 0, 16 ), GetAbsAngles(), GetThrower(), GetDamage(), 200,
ExplosionCreate( GetAbsOrigin() + Vector( 0, 0, 16 ), GetAbsAngles(), GetThrower(), GetDamage(), GetDamageRadius(),
SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE, 0.0f, this);
UTIL_Remove( this );

View File

@ -18,9 +18,9 @@
extern const char* g_pModelNameLaser;
ConVar sk_plr_dmg_tripmine ( "sk_plr_dmg_tripmine","0");
ConVar sk_npc_dmg_tripmine ( "sk_npc_dmg_tripmine","0");
ConVar sk_tripmine_radius ( "sk_tripmine_radius","0");
ConVar sk_plr_dmg_tripmine ( "sk_plr_dmg_tripmine","150"); // commented values in hl2/skill.cfg
ConVar sk_npc_dmg_tripmine ( "sk_npc_dmg_tripmine","125");
ConVar sk_tripmine_radius ( "sk_tripmine_radius","200");
LINK_ENTITY_TO_CLASS( npc_tripmine, CTripmineGrenade );
@ -59,22 +59,19 @@ void CTripmineGrenade::Spawn( void )
SetSolid( SOLID_BBOX );
SetModel( "models/Weapons/w_slam.mdl" );
IPhysicsObject *pObject = VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, true );
IPhysicsObject *pObject = VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, true );
pObject->EnableMotion( false );
SetCollisionGroup( COLLISION_GROUP_WEAPON );
SetCycle( 0.0f );
m_nBody = 3;
m_flDamage = sk_plr_dmg_tripmine.GetFloat();
m_DmgRadius = sk_tripmine_radius.GetFloat();
ResetSequenceInfo( );
m_flPlaybackRate = 0;
UTIL_SetSize(this, Vector( -4, -4, -2), Vector(4, 4, 2));
m_flPowerUp = gpGlobals->curtime + 2.0;
SetThink( &CTripmineGrenade::PowerupThink );
SetNextThink( gpGlobals->curtime + 0.2 );
@ -83,7 +80,8 @@ void CTripmineGrenade::Spawn( void )
m_iHealth = 1;
EmitSound( "TripmineGrenade.Place" );
SetDamage ( 200 );
SetDamage( sk_plr_dmg_tripmine.GetFloat() );
SetDamageRadius( sk_tripmine_radius.GetFloat() );
// Tripmine sits at 90 on wall so rotate back to get m_vecDir
QAngle angles = GetAbsAngles();
@ -268,7 +266,7 @@ void CTripmineGrenade::DelayDeathThink( void )
UTIL_TraceLine ( GetAbsOrigin() + m_vecDir * 8, GetAbsOrigin() - m_vecDir * 64, MASK_SOLID, this, COLLISION_GROUP_NONE, & tr);
UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );
ExplosionCreate( GetAbsOrigin() + m_vecDir * 8, GetAbsAngles(), m_hOwner, GetDamage(), 200,
ExplosionCreate( GetAbsOrigin() + m_vecDir * 8, GetAbsAngles(), m_hOwner, GetDamage(), GetDamageRadius(),
SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE, 0.0f, this);
UTIL_Remove( this );

View File

@ -242,8 +242,8 @@ void CPhysicsHook::LevelInitPreEntity()
physenv->EnableConstraintNotify( true ); // callback when an object gets deleted that is attached to a constraint
physenv->SetObjectEventHandler( &g_Collisions );
physenv->SetSimulationTimestep( DEFAULT_TICK_INTERVAL ); // 15 ms per tick
physenv->SetSimulationTimestep( gpGlobals->interval_per_tick ); // 15 ms per tick
// HL Game gravity, not real-world gravity
physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) );
g_PhysAverageSimTime = 0;
@ -1606,7 +1606,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
float totalTime = 0.f;
g_Collisions.BufferTouchEvents( true );
float full = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL );
physenv->Simulate( gpGlobals->interval_per_tick );
full = engine->Time() - full;
float lastTime = full;
@ -1623,7 +1623,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
PhysForceEntityToSleep( ents[j], ents[j]->VPhysicsGetObject() );
}
float start = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL );
physenv->Simulate( gpGlobals->interval_per_tick );
float end = engine->Time();
float elapsed = end - start;

View File

@ -62,7 +62,7 @@ void CSoundscapeSystem::AddSoundscapeFile( const char *filename )
MEM_ALLOC_CREDIT();
// Open the soundscape data file, and abort if we can't
KeyValues *pKeyValuesData = new KeyValues( filename );
if ( filesystem->LoadKeyValues( *pKeyValuesData, IFileSystem::TYPE_SOUNDSCAPE, filename, "GAME" ) )
if ( pKeyValuesData->LoadFromFile( filesystem, filename, "GAME" ) )
{
// parse out all of the top level sections and save their names
KeyValues *pKeys = pKeyValuesData;
@ -137,7 +137,7 @@ bool CSoundscapeSystem::Init()
}
KeyValues *manifest = new KeyValues( SOUNDSCAPE_MANIFEST_FILE );
if ( filesystem->LoadKeyValues( *manifest, IFileSystem::TYPE_SOUNDSCAPE, SOUNDSCAPE_MANIFEST_FILE, "GAME" ) )
if( manifest->LoadFromFile( filesystem, SOUNDSCAPE_MANIFEST_FILE, "GAME" ) )
{
for ( KeyValues *sub = manifest->GetFirstSubKey(); sub != NULL; sub = sub->GetNextKey() )
{

View File

@ -408,7 +408,7 @@ bool CBaseEntity::KeyValue( const char *szKeyName, const char *szValue )
}
// Do this so inherited classes looking for 'angles' don't have to bother with 'angle'
return KeyValue( szKeyName, szBuf );
return KeyValue( "angles", szBuf );
}
// NOTE: Have to do these separate because they set two values instead of one

View File

@ -727,6 +727,11 @@ void CHL2MPRules::DeathNotice( CBasePlayer *pVictim, const CTakeDamageInfo &info
killer_weapon_name = "physics";
}
if ( strstr( killer_weapon_name, "physbox" ) )
{
killer_weapon_name = "physics";
}
if ( strcmp( killer_weapon_name, "prop_combine_ball" ) == 0 )
{
killer_weapon_name = "combine_ball";
@ -1277,4 +1282,4 @@ const char *CHL2MPRules::GetChatFormat( bool bTeamOnly, CBasePlayer *pPlayer )
return pszFormat;
}
#endif
#endif

View File

@ -359,6 +359,11 @@ void CMissile::ShotDown( void )
//-----------------------------------------------------------------------------
void CMissile::DoExplosion( void )
{
//Fix GetAbsOrigin().z+1 in gamerules.cpp:349
Vector origin = GetAbsOrigin();
origin.z -= 1;
SetAbsOrigin( origin );
// Explode
ExplosionCreate( GetAbsOrigin(), GetAbsAngles(), GetOwnerEntity(), GetDamage(), GetDamage() * 2,
SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSMOKE, 0.0f, this);
@ -452,7 +457,7 @@ void CMissile::IgniteThink( void )
{
SetMoveType( MOVETYPE_FLY );
SetModel("models/weapons/w_missile.mdl");
UTIL_SetSize( this, vec3_origin, vec3_origin );
//UTIL_SetSize( this, vec3_origin, vec3_origin ); //This cause weird no damage dealing on stairs
RemoveSolidFlags( FSOLID_NOT_SOLID );
//TODO: Play opening sound

View File

@ -303,9 +303,9 @@ bool CWeapon_SLAM::AnyUndetonatedCharges(void)
void CWeapon_SLAM::StartSatchelDetonate()
{
if ( GetActivity() != ACT_SLAM_DETONATOR_IDLE && GetActivity() != ACT_SLAM_THROW_IDLE )
if ( GetActivity() != ACT_SLAM_DETONATOR_IDLE && GetActivity() != ACT_SLAM_THROW_IDLE && !m_bDetonatorArmed )
return;
// -----------------------------------------
// Play detonate animation
// -----------------------------------------
@ -313,7 +313,7 @@ void CWeapon_SLAM::StartSatchelDetonate()
{
SendWeaponAnim(ACT_SLAM_DETONATOR_DETONATE);
}
else if (m_tSlamState == SLAM_SATCHEL_ATTACH)
else if (m_tSlamState == SLAM_SATCHEL_ATTACH || m_tSlamState == SLAM_TRIPMINE_READY)
{
SendWeaponAnim(ACT_SLAM_STICKWALL_DETONATE);
}