Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SRHUDKillingFloor extends HUD_StoryMode
- dependson(SRPlayerReplicationInfo);
- ...
- //NEW
- var Texture Noob_Crosshair;
- var() config bool bShowDamages;
- struct DamageInfo
- {
- var int Damage;
- var float HitTime;
- var Vector HitLocation;
- var byte DamTypeNum;
- var float RandX, RandY;
- var color FontColor;
- };
- const DAMAGEPOPUP_COUNT = 32;
- var DamageInfo DamagePopups[32];
- var int NextDamagePopupIndex;
- var() config byte DamagePopupFont;
- var() config float DamagePopupFadeOutTime;
- ...
- var() Material CrosshairTexture;
- ...
- simulated function DrawHud(Canvas C)
- {
- ...
- if ( KFPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).bViewingMatineeCinematic )
- {
- PassStyle = STY_Alpha;
- DrawCinematicHUD(C);
- }
- if ( bShowNotification )
- DrawPopupNotification(C);
- if(((PlayerOwner != none) && SRPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo) != none) && SRPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).bShowDamage)
- {
- DrawDamage(C);
- }
- if(((PlayerOwner != none) && SRPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo) != none) && SRPlayerReplicationInfo(PlayerOwner.PlayerReplicationInfo).bUseNoobCross)
- {
- DrawNoobCrosshair(C);
- }
- }
- ...
- simulated function ShowDamage(int Damage, float HitTime, Vector HitLocation, byte DamTypeNum, bool Crit)
- {
- local Color C;
- DamagePopups[NextDamagePopupIndex].Damage = Damage;
- DamagePopups[NextDamagePopupIndex].HitTime = HitTime;
- DamagePopups[NextDamagePopupIndex].DamTypeNum = DamTypeNum;
- DamagePopups[NextDamagePopupIndex].HitLocation = HitLocation;
- DamagePopups[NextDamagePopupIndex].RandX = 2.0 * FRand();
- DamagePopups[NextDamagePopupIndex].RandY = 1.0 * FRand();
- C.A = 255;
- if(DamTypeNum == 1)
- {
- C.R = 0;
- C.G = 100;
- C.B = 255;
- }
- if(DamTypeNum == 2)
- {
- C.R = 206;
- C.G = 103;
- C.B = 0;
- }
- if(Damage >= 500)
- {
- C.R = 0;
- C.G = 206;
- C.B = 0;
- }
- if(Damage >= 175)
- {
- C.R = 206;
- C.G = 206;
- C.B = 0;
- }
- if(Damage > 0)
- {
- C.R = 206;
- C.G = 64;
- C.B = 64;
- }
- else
- {
- C.R = 127;
- C.G = 127;
- C.B = 127;
- }
- DamagePopups[NextDamagePopupIndex].FontColor = C;
- if(++ NextDamagePopupIndex >= 32)
- {
- NextDamagePopupIndex = 0;
- }
- }
- simulated function DrawDamage(Canvas C)
- {
- local int i;
- local float TimeSinceHit;
- local vector CameraLocation, CamDir;
- local rotator CameraRotation;
- local vector HBScreenPos;
- local float TextWidth, TextHeight, x;
- C.GetCameraLocation(CameraLocation, CameraRotation);
- CamDir = vector(CameraRotation);
- if ( C.ClipX <= 800 )
- DamagePopupFont = 7;
- else if ( C.ClipX <= 1024 )
- DamagePopupFont = 6;
- else if ( C.ClipX < 1400 )
- DamagePopupFont = 5;
- else if ( C.ClipX < 1700 )
- DamagePopupFont = 4;
- else
- DamagePopupFont = 3;
- C.Font = LoadFont(DamagePopupFont);
- for( i=0; i < 32; i++ )
- {
- Log("Inside FOR Loop");
- TimeSinceHit = Level.TimeSeconds - DamagePopups[i].HitTime;
- Log("Inside FOR Loop 1");
- if(TimeSinceHit > DamagePopupFadeOutTime || (Normal(DamagePopups[i].HitLocation - CameraLocation) dot Normal(CamDir) < 0.1))
- Log("Inside FOR Loop 2");
- //continue;
- Log("4");
- HBScreenPos = C.WorldToScreen(DamagePopups[i].HitLocation);
- C.StrLen(DamagePopups[i].damage, TextWidth, TextHeight);
- //draw just on the hit location
- HBScreenPos.Y -= TextHeight/2;
- HBScreenPos.X -= TextWidth/2;
- Log("5");
- //let numbers to fly up
- HBScreenPos.Y -= TimeSinceHit * TextHeight * DamagePopups[i].RandY;
- x = Sin(2*Pi * TimeSinceHit/DamagePopupFadeOutTime) * TextWidth * DamagePopups[i].RandX;
- Log("6");
- // odd numbers start to flying to the right side, even - left
- // So in situations of decapitaion player could see both damages
- if ( i % 2 == 0)
- x *= -1.0;
- Log("7");
- HBScreenPos.X += x;
- Log("8");
- C.DrawColor = DamagePopups[i].FontColor;
- C.DrawColor.A = 255 * cos(0.5*Pi * TimeSinceHit/DamagePopupFadeOutTime);
- Log("9");
- C.SetPos( HBScreenPos.X, HBScreenPos.Y);
- C.DrawText(DamagePopups[i].damage);
- Log("10");
- }
- }
- ...
- defaultproperties
- {
- // CROSSHAIR TEXTURE
- Noob_Crosshair=Texture'Weps2.Throwing_KnifeV2_T.HL2Crosshair'
- DamagePopupFadeOutTime=1.50
- DamagePopupFont=4
- bShowDamages=True
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement