VERC: FatBoy Mode Last edited 2 months ago2018-07-12 08:51:13 UTC by Penguinboy Penguinboy

In Unreal Tournament, there was a mutator called FatBoy mode in which killers got fat on the profits and the losers suffered from serious malnutrition. Well, I'll grant that it was not particularly great but it was certainly one of the more original and amusing concepts. This article explains how you add the effect to Half-life.

Luckily for you there is not a lot (I use that term lightly) that you have to do in the way of coding since Half-Life's good old engine can do most of it for you. All you have to do is get it to do it. The only time Half-Life actually uses this code is for the electric shell effect (OP4 Shock Rifle Hit, Sven-coop's electric crowbar, TFC's glowing flag, DMC's Frozen-Quad-Invuln, etc.).

What the engine does in this case is it first draws the model normally, then instead of discarding it, it replaces all the textures with the electric affect, makes the textures swirl, makes it transparent, finally makes it fatter than the original and draws it over the normal model, phew. This gives you a lovely electric shield effect, which is what we are going to steal.

All the code for this is in the SDK except for the Fattening code, which is just typical , so all we have to do is to reproduce the electric effect without the original rendering, without the texture replacement, without the swirling and without the transparency.

Anyway first things first. We need to tell the machine which entities to fatten and by how much, all we have to do is to copy the electric effect.

We'll just use renderfx and renderamt . Unfortunately a strange bug means that if renderamt is negative then it will be sent to the client as 255. To get round this we just have two renderfx s, one to make fat and one to make thin.

Open ..commonconst.h in cl_dll (or straight dll , but we'll be using cl_dll for the time being) and scroll down to the definitions of the kRenders (Line 708). Add these to the end:
     kRenderFxFatness,               // Make me fat
     kRenderFxThinness,               // Make me thin
Then open up StudioModelRenderer.cpp and scroll down to StudioRenderModel( ) (Line 1579) and replace:
          StudioRenderFinal( );
          if ( !IEngineStudio.IsHardware() )
          {
               gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
          }
     }
     else
     {
          StudioRenderFinal( );
with:
          StudioRenderFinal( );
          if ( !IEngineStudio.IsHardware() )
          {
               gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
          }
     }
     else if ( m_pCurrentEntity->curstate.renderfx == kRenderFxFatness
               || m_pCurrentEntity->curstate.renderfx == kRenderFxThinness )
     {
          int origrend = m_pCurrentEntity->curstate.renderfx;
          if ( origrend == kRenderFxThinness )
               m_pCurrentEntity->curstate.renderamt*=-1;

          m_pCurrentEntity->curstate.renderfx = kRenderFxGlowShell;
          m_pCurrentEntity->curstate.rendercolor.r = 255;
          m_pCurrentEntity->curstate.rendercolor.g = 255;
          m_pCurrentEntity->curstate.rendercolor.b = 255;
          gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
          StudioRenderFinal( );
          m_pCurrentEntity->curstate.renderfx = origrend;
          if ( origrend == kRenderFxThinness )
               m_pCurrentEntity->curstate.renderamt*=-1;

          return;
     }
     else
     {
          StudioRenderFinal( );
All done, now you need to recompile cl_dll and dll and you have the ability to make any entity a FatBoy.

Now you won't notice any change because you haven't programmed anything to be fat but the use of this little tool can be useful, you can do the Fatboy mutator, you can give scientists a bit of variety in appearance, make a pineapple looking grenade, make a sort of console lookin' thingey with a fat tripmine, insect-like thin snarks, the possibilities are endless.

However let's just do something mindless to start so open up dll and let's start by making all the scientists spawn randomly fat/thin. Open up scientist.cpp and scroll down to Spawn() (Line 682).

Add this:
     if ( RANDOM_LONG( 0, 1 ) )
     {
          pev->renderfx = kRenderFxFatness;
          pev->renderamt = 100;
     }
     else
     {
          pev->renderfx = kRenderFxThinness;
          pev->renderamt = 20;
     }
Compile and Laugh.
c1a00010.jpgc1a00010.jpg
This article was originally published on the Valve Editing Resource Collective (VERC).
TWHL only archives articles from defunct websites. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

You must log in to post a comment. You can login or register a new account.