HIT Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: What graphical effects can be added without exteral DLLs?  (Read 1490 times)

0 Members and 1 Guest are viewing this topic.

Captain B.O

  • Headcrab
  • ***
  • Offline Offline
  • Posts: 32
    • View Profile
What graphical effects can be added without exteral DLLs?
« on: August 28, 2010, 10:37:17 AM »

I was wondering what enhancements and effects can be added to Half-Life without needing things like a new opengl32.dll, cgGL.dll etc. It would be nice to have small things (e.g rudimentary physics, perhaps some shaders) whilst keeping everything within the mod folder. I dunno why, but that would make it all seem more old-school (in a good way) than using things like CG. I remember seeing on (sniffle) Chatbear that someone called SysOp (if you don't know who he is, you shouldn't be here ;)) made some simple physics just by modifying the func_pushable code. I don't think there was ever a video of it but he said that things like weapons taking the angle of the floor and things rolling down slopes are possible. Unfortunatley I think the link was dead and obviously now it will be gone for good.

Anyone been able to do anything like this?


  • The zxeno prophet
  • Gargantua
  • *******
  • Offline Offline
  • Posts: 521
  • Coding furiously
    • View Profile
Re: What graphical effects can be added without exteral DLLs?
« Reply #1 on: August 28, 2010, 11:01:44 AM »

The physic stuff is not related to the engine, in fact if I remember properly there is already a piece of commented code that do simple physic on the falling weapons

For the rest, since the stencil buffer ain't activated, you are pretty much limited to particles


  • Administrator
  • Gonarch
  • *******
  • Offline Offline
  • Posts: 1755
    • View Profile
    • HL-Improvement
Re: What graphical effects can be added without exteral DLLs?
« Reply #2 on: August 29, 2010, 11:25:13 AM »

Physics are definitely possible, as are high resolution textures.

I did have the code for aligning objects to slopes, so it definitely is possible, although it was removed once we added physx support.

All you do is replace
Code: [Select]
// lie flat
//          pev->angles.x = 0;
//          pev->angles.z = 0;

in CBasePlayerItem::FallThink() with

Code: [Select]
          TraceResult tr;

          // look down directly to know the surface we're lying.
          UTIL_TraceLine( pev->origin,
               pev->origin - Vector(0,0,10), ignore_monsters, edict(), &tr );

#ifndef M_PI
#define M_PI 3.14159265358979
#define ang2rad (2 * M_PI / 360)

          if ( tr.flFraction < 1.0 )
               Vector angdir = Vector(
                    cos(pev->angles.y * ang2rad) * cos(pev->angles.x * ang2rad),
                    sin(pev->angles.y * ang2rad) * cos(pev->angles.x * ang2rad),
                    -sin(pev->angles.x * ang2rad));
               Vector angdiry = Vector(
                    sin(pev->angles.y * ang2rad) * cos(pev->angles.x * ang2rad),
                    cos(pev->angles.y * ang2rad) * cos(pev->angles.x * ang2rad),                     -sin(pev->angles.x * ang2rad));

               pev->angles = UTIL_VecToAngles(
                    angdir - DotProduct(angdir, tr.vecPlaneNormal) * tr.vecPlaneNormal);
               pev->angles.z = -UTIL_VecToAngles(
                    angdiry - DotProduct(angdiry, tr.vecPlaneNormal) *

#undef ang2rad

This can also work with dead bodies and other objects.