SmallWeapons View Mutator>?!

Search, find and discuss about Mutators!

SmallWeapons View Mutator>?!

Postby ~{kRiD}~ » Sun Nov 04, 2018 2:10 am

Okay so there's this mod i found called "SmallWeapons" which replaces stock ut weps with a "smaller scale" weapon class. Inside the weapons class are new functions,
Spoiler: show
simulated function vector CalcDrawOffsetSmall();
{
local vector DrawOffset, WeaponBob;
local Pawn PawnOwner;

PawnOwner = Pawn(Owner);
DrawOffset = ((0.01 * PlayerViewOffset) >> PawnOwner.ViewRotation);

if ( (Level.NetMode == NM_DedicatedServer)
|| ((Level.NetMode == NM_ListenServer) && (Owner.RemoteRole == ROLE_AutonomousProxy)) )
DrawOffset += (PawnOwner.BaseEyeHeight * vect(0,0,1));
else
{
DrawOffset += (PawnOwner.EyeHeight * vect(0,0,1));
WeaponBob = BobDamping * PawnOwner.WalkBob;
WeaponBob.Z = (0.45 + 0.55 * BobDamping) * PawnOwner.WalkBob.Z;
DrawOffset += WeaponBob;
}
return DrawOffset;
}


Spoiler: show
simulated event RenderOverlays(canvas Canvas);
{
local PlayerPawn PlayerOwner;
local int realhand;

if ( (bMuzzleFlash > 0) && !Level.bDropDetail )
MFTexture = MuzzleFlashVariations[Rand(5)];
PlayerOwner = PlayerPawn(Owner);
if ( PlayerOwner != None )
{
if ( PlayerOwner.DesiredFOV != PlayerOwner.DefaultFOV )
return;
realhand = PlayerOwner.Handedness;
if ( (Level.NetMode == NM_Client) && (realHand == 2) )
{
bHideWeapon = true;
return;
}
if ( !bHideWeapon )
{
if ( Mesh == mesh'AutoML' )
PlayerOwner.Handedness = 1;
else if ( bIsSlave || (SlaveEnforcer != None) )
PlayerOwner.Handedness = -1;
}
}
if ( (PlayerOwner == None) || (PlayerOwner.Handedness == 0) )
{
if ( AnimSequence == 'Shot2' )
{
FlashO = -2 * Default.FlashO;
FlashY = Default.FlashY * 2.5;
}
else
{
FlashO = 1.9 * Default.FlashO;
FlashY = Default.FlashY;
}
}
else if ( AnimSequence == 'Shot2' )
{
FlashO = Default.FlashO * 0.3;
FlashY = Default.FlashY * 2.5;
}
else
{
FlashO = Default.FlashO;
FlashY = Default.FlashY;
}
if ( !bHideWeapon && ( (SlaveEnforcer != None) || bIsSlave ) )
{
if ( PlayerOwner == None )
bMuzzleFlash = 0;

SuperRenderOverlays(Canvas);
if ( SlaveEnforcer != None )
{
if ( SlaveEnforcer.bBringingUp )
{
SlaveEnforcer.bBringingUp = false;
SlaveEnforcer.PlaySelect();
}
SlaveEnforcer.RenderOverlays(Canvas);
}
}
else
SuperRenderOverlays(Canvas);

if ( PlayerOwner != None )
PlayerOwner.Handedness = realhand;
}


Spoiler: show
simulated function SuperRenderOverlays( canvas Canvas );
{
local rotator NewRot;
local bool bPlayerOwner;
local int Hand;
local PlayerPawn PlayerOwner;

if ( bHideWeapon || (Owner == None) )
return;

PlayerOwner = PlayerPawn(Owner);

if ( PlayerOwner != None )
{
if ( PlayerOwner.DesiredFOV != PlayerOwner.DefaultFOV )
return;
bPlayerOwner = true;
Hand = PlayerOwner.Handedness;

if ( (Level.NetMode == NM_Client) && (Hand == 2) )
{
bHideWeapon = true;
return;
}
}

if ( !bPlayerOwner || (PlayerOwner.Player == None) )
Pawn(Owner).WalkBob = vect(0,0,0);

if ( (bMuzzleFlash > 0) && bDrawMuzzleFlash && Level.bHighDetailMode && (MFTexture != None) )
{
MuzzleScale = Default.MuzzleScale * Canvas.ClipX/640.0;
if ( !bSetFlashTime )
{
bSetFlashTime = true;
FlashTime = Level.TimeSeconds + FlashLength;
}
else if ( FlashTime < Level.TimeSeconds )
bMuzzleFlash = 0;
if ( bMuzzleFlash > 0 )
{
if ( Hand == 0 )
Canvas.SetPos(Canvas.ClipX/2 - 0.5 * MuzzleScale * FlashS + Canvas.ClipX * (-0.2 * Default.FireOffset.Y * FlashO), Canvas.ClipY/2 - 0.5 * MuzzleScale * FlashS + Canvas.ClipY * (FlashY + FlashC));
else
Canvas.SetPos(Canvas.ClipX/2 - 0.5 * MuzzleScale * FlashS + Canvas.ClipX * (Hand * Default.FireOffset.Y * FlashO), Canvas.ClipY/2 - 0.5 * MuzzleScale * FlashS + Canvas.ClipY * FlashY);

Canvas.Style = 3;
Canvas.DrawIcon(MFTexture, MuzzleScale);
Canvas.Style = 1;
}
}
else
bSetFlashTime = false;

SetLocation( Owner.Location + CalcDrawOffsetSmall() );
NewRot = Pawn(Owner).ViewRotation;

if ( Hand == 0 )
newRot.Roll = -2 * Default.Rotation.Roll;
else
newRot.Roll = Default.Rotation.Roll * Hand;

setRotation(newRot);
Canvas.DrawActor(self, false);
}


and then the master mutato class withCheckReplacement to replace weapon classes....

would there be an easier way to do this? I would like to re-create for my custom weapons mod and also, possibly have it compatible with any other custom weapons mod .....
Image
User avatar
~{kRiD}~
Average
 
Posts: 50
Joined: Sun Jan 20, 2013 7:26 pm

Re: SmallWeapons View Mutator>?!

Postby JackGriffin » Sun Nov 04, 2018 3:06 am

You can alter the scale of the displayed weapons pretty easily but it's going to look like shit if you care at all about details. In order to do this correctly you really need to dig into the weapon code itself and make the changes there. Then you can also account for the projectiles coming from where they need to be and the smoke effects, etc being in the right spot. To me it's illusion-breaking when this isn't accurate.
"You damn kids, back in my time we made the items, maps and games ourselves with an unwieldy engine using counter-intuitive crash-prone tools and we liked it so much we built communities around this which nowadays look like cults because they're quasi-parallel societies based on the same old games." -Hellkeeper
User avatar
JackGriffin
Godlike
 
Posts: 3723
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Hack coder


Return to Mutators

Who is online

Users browsing this forum: No registered users and 1 guest