by Sajt » Tue Mar 30, 2010 8:12 pm
First decide whether crouching should involve moving the top of the bbox down (probably the first thing that comes to mind), or tucking in the bottom of the bbox. From what it feels like, (or what I remember it feeling like last time I played it,) Half-Life does something like the latter, which allows you to jump, tuck your legs in and land on a higher ledge. (If you are standing on the ground when this happens, though, you should move the player down too, or he will tuck his legs in then fall.)
Quake3's (and probably Quake2's) specific behaviour requires +jump to be merged with +moveup, and +crouch (or what have you) with +movedown. In SV_PlayerPhysics, check movement_z to determine whether to jump or crouch. Therefore, jump and crouch can cancel each other out, so while crouching, you can hold jump to briefly stand up.
When you uncrouch, do a walkmove or (in DP) an in-place tracebox, to make sure that there is room to uncrouch, before setsizeing back to normal.
Then you have to lerp view_ofs_z, historically done in QC but CSQC would be better.
You will need to use a non-Q1BSP map format, yes, if you want crouching to be of any practical use. Q2BSP and Q3BSP don't use hulls at all, HLBSP (and possibly Hexen2's BSP format?) add an extra hull for crouching. Years ago I was working on an extended Q1BSP format for DarkPlaces which allowed up to 16 user-defined hulls (among other features) but never finished it. So Q3BSP and HLBSP are your two best bets.
Last edited by
Sajt on Tue Mar 30, 2010 11:35 pm, edited 3 times in total.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.