Menus overhaul #14

Merged
dkanus merged 30 commits from :somechanges into master 2022-01-23 22:14:51 +03:00
4 changed files with 259 additions and 206 deletions
Showing only changes of commit 2b164b56df - Show all commits

View File

@ -1,27 +1,64 @@
class NiceGUISettings extends Settings_Tabs;
//var automated GUIButton skillButtonA;
var array<string> ForceProjItems;
var automated moCheckBox ch_WeapManagement;
var automated moCheckBox ch_AltSwitches;
var automated moCheckBox ch_DispCounters;
var automated moCheckBox ch_DisWeapProgress;
var automated moCheckBox ch_ShowHLMessages;
var automated moCheckBox ch_CancelFire;
var automated moCheckBox ch_CancelSwitching;
var automated moCheckBox ch_CancelNades;
var automated moCheckBox ch_CancelAiming;
var automated moCheckBox ch_ReloadWontWork;
var automated GUISectionBackground bg_WEAP;
var automated GUISectionBackground bg_RELOAD;
function InitComponent(GUIController MyController, GUIComponent MyOwner){
super.InitComponent(MyController, MyOwner);
}
function InternalOnLoadINI(GUIComponent sender, string s){
local NicePlayerController nicePlayer;
nicePlayer = NicePlayerController(PlayerOwner());
if(nicePlayer == none)
return;
switch(sender){
// GENERAL WEAPON SETTINGS
var automated GUISectionBackground bg_WEAP;
var automated moCheckBox ch_WeapManagement;
var automated moCheckBox ch_AltSwitches;
var automated moCheckBox ch_DispCounters;
var automated moCheckBox ch_DisWeapProgress;
var automated moCheckBox ch_ShowHLMessages;
// WEAPON RELOAD SETTINGS
var automated GUISectionBackground bg_RELOAD;
var automated moCheckBox ch_CancelFire;
var automated moCheckBox ch_CancelSwitching;
var automated moCheckBox ch_CancelNades;
var automated moCheckBox ch_CancelAiming;
var automated moCheckBox ch_ReloadWontWork;
// RANDOM SETTINGS
var automated GUISectionBackground bg_RANDOM;
var automated MoComboBox mo_ZedHPBars;
function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
super.InitComponent(MyController, MyOwner);
mo_ZedHPBars.AddItem("Big Zeds");
mo_ZedHPBars.AddItem("All Zeds");
mo_ZedHPBars.AddItem("Disable");
// GENERAL WEAPON SETTINGS
bg_WEAP.ManageComponent(ch_WeapManagement);
bg_WEAP.ManageComponent(ch_AltSwitches);
bg_WEAP.ManageComponent(ch_DispCounters);
bg_WEAP.ManageComponent(ch_DisWeapProgress);
bg_WEAP.ManageComponent(ch_ShowHLMessages);
// WEAPON RELOAD SETTINGS
bg_RELOAD.ManageComponent(ch_CancelFire);
bg_RELOAD.ManageComponent(ch_CancelSwitching);
bg_RELOAD.ManageComponent(ch_CancelNades);
bg_RELOAD.ManageComponent(ch_CancelAiming);
bg_RELOAD.ManageComponent(ch_ReloadWontWork);
// RANDOM SETTINGS
bg_RANDOM.ManageComponent(mo_ZedHPBars);
}
function InternalOnLoadINI(GUIComponent sender, string s)
{
local NicePlayerController nicePlayer;
nicePlayer = NicePlayerController(PlayerOwner());
if (nicePlayer == none)
return;
switch(sender)
{
case ch_WeapManagement:
ch_WeapManagement.Checked(nicePlayer.bNiceWeaponManagement);
break;
@ -52,15 +89,23 @@ function InternalOnLoadINI(GUIComponent sender, string s){
case ch_ReloadWontWork:
ch_ReloadWontWork.Checked(nicePlayer.bFlagUseServerReload);
break;
}
case mo_ZedHPBars:
mo_ZedHPBars.SetIndex(nicePlayer.ZedHPBarStyle);
break;
}
}
function InternalOnChange(GUIComponent Sender){
local NicePlayerController nicePlayer;
super.InternalOnChange(Sender);
nicePlayer = NicePlayerController(PlayerOwner());
if(nicePlayer == none)
return;
switch(sender){
function InternalOnChange(GUIComponent Sender)
{
local NicePlayerController nicePlayer;
super.InternalOnChange(Sender);
nicePlayer = NicePlayerController(PlayerOwner());
if (nicePlayer == none)
return;
switch(sender)
{
case ch_WeapManagement:
nicePlayer.bNiceWeaponManagement = ch_WeapManagement.IsChecked();
break;
@ -91,191 +136,174 @@ function InternalOnChange(GUIComponent Sender){
case ch_ReloadWontWork:
nicePlayer.ServerSetUseServerReload(ch_ReloadWontWork.IsChecked());
break;
}
nicePlayer.ClientSaveConfig();
case mo_ZedHPBars:
nicePlayer.ZedHPBarStyle = mo_ZedHPBars.GetIndex();
log(">>> nicePlayer.ZedHPBarStyle = " $ mo_ZedHPBars.GetIndex());
break;
}
nicePlayer.ClientSaveConfig();
}
// size = (x=0.0125, y=0.0) ; (w=1.0, h=0.865)
// tab order
defaultproperties
{
Begin Object Class=moCheckBox Name=WeaponManagement
CaptionWidth=0.955000
Caption="Nice weapon management"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=WeaponManagement.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, NicePack will use it's own system to manage weapon switching"
WinTop=0.050000
WinLeft=0.012500
WinWidth=0.278000
TabOrder=4
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_WeapManagement=WeaponManagement
// GENERAL WEAPON SETTINGS
Begin Object Class=GUISectionBackground Name=WEAPBG
Caption="General weapon settings"
WinTop=0.012500
WinWidth=0.495000
WinHeight=0.287500
RenderWeight=0.100100
// OnPreDraw=WeaponsBG.InternalPreDraw
OnPreDraw=WEAPBG.InternalPreDraw
End Object
bg_WEAP=WEAPBG
Begin Object Class=moCheckBox Name=AltSwitches
CaptionWidth=0.955000
Caption="Alt fire switches modes"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=AltSwitches.InternalOnCreateComponent
IniOption="@Internal"
Hint="Assault-rifle only; if enabled - alt fire button switches between fire modes, otherwise - acts as an alt fire"
WinTop=0.100000
WinLeft=0.012500
WinWidth=0.278000
TabOrder=6
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_AltSwitches=AltSwitches
Begin Object Class=moCheckBox Name=WeaponManagement
Caption="Nice weapon management"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=WeaponManagement.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, NicePack will use it's own system to manage weapon switching"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_WeapManagement=WeaponManagement
Begin Object Class=moCheckBox Name=DispCounters
CaptionWidth=0.955000
Caption="Display counters"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=DispCounters.InternalOnCreateComponent
IniOption="@Internal"
Hint="Toggles display of the various counters used by skills"
WinTop=0.150000
WinLeft=0.012500
WinWidth=0.278000
TabOrder=7
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_DispCounters=DispCounters
Begin Object Class=moCheckBox Name=AltSwitches
Caption="Alt fire switches modes"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=AltSwitches.InternalOnCreateComponent
IniOption="@Internal"
Hint="Assault-rifle only; if enabled - alt fire button switches between fire modes, otherwise - acts as an alt fire"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_AltSwitches=AltSwitches
Begin Object Class=moCheckBox Name=DispWeapProgress
CaptionWidth=0.955000
Caption="Display weapon progress"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=DispWeapProgress.InternalOnCreateComponent
IniOption="@Internal"
Hint="Displays weapon progress rate, however it's defined by a skill that's using this functionality"
WinTop=0.200000
WinLeft=0.012500
WinWidth=0.278000
TabOrder=8
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_DisWeapProgress=DispWeapProgress
Begin Object Class=moCheckBox Name=DispCounters
Caption="Display counters"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=DispCounters.InternalOnCreateComponent
IniOption="@Internal"
Hint="Toggles display of the various counters used by skills"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_DispCounters=DispCounters
Begin Object Class=moCheckBox Name=ShowHLMessages
CaptionWidth=0.955000
Caption="Show Hardcore Level messages"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=ShowHLMessages.InternalOnCreateComponent
IniOption="@Internal"
Hint="Enable to be notified each time Hardcore Level is changed"
WinTop=0.300000
WinLeft=0.012500
WinWidth=0.278000
TabOrder=9
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_ShowHLMessages=ShowHLMessages
Begin Object Class=moCheckBox Name=DispWeapProgress
Caption="Display weapon progress"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=DispWeapProgress.InternalOnCreateComponent
IniOption="@Internal"
Hint="Displays weapon progress rate, however it's defined by a skill that's using this functionality"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_DisWeapProgress=DispWeapProgress
Begin Object Class=moCheckBox Name=CancelFire
CaptionWidth=0.955000
Caption="Cancel reload by shooting"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=CancelFire.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, you'll be able to cancel reload of converted weapons by shooting (when you have ammo)"
WinTop=0.050000
WinLeft=0.517500
WinWidth=0.287000
TabOrder=11
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_CancelFire=CancelFire
Begin Object Class=moCheckBox Name=ShowHLMessages
Caption="Show Hardcore Level messages"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=ShowHLMessages.InternalOnCreateComponent
IniOption="@Internal"
Hint="Enable to be notified each time Hardcore Level is changed"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_ShowHLMessages=ShowHLMessages
Begin Object Class=moCheckBox Name=CancelSwitching
CaptionWidth=0.955000
Caption="Cancel reload by switching weapons"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=CancelSwitching.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, you'll be able to cancel reload of converted weapons by switching to different weapon"
WinTop=0.100000
WinLeft=0.517500
WinWidth=0.287000
TabOrder=12
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_CancelSwitching=CancelSwitching
// WEAPON RELOAD SETTINGS
Begin Object Class=GUISectionBackground Name=RELOADBG
Caption="Weapon reload settings"
WinTop=0.012500
WinLeft=0.505000
WinWidth=0.495000
WinHeight=0.287500
RenderWeight=0.100100
// OnPreDraw=WeaponsBG.InternalPreDraw
OnPreDraw=RELOADBG.InternalPreDraw
End Object
bg_RELOAD=RELOADBG
Begin Object Class=moCheckBox Name=CancelNades
CaptionWidth=0.955000
Caption="Cancel reload by throwing grenades"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=CancelNades.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, you'll be able to cancel reload of converted weapons by throwing a grenade"
WinTop=0.150000
WinLeft=0.517500
WinWidth=0.287000
TabOrder=13
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_CancelNades=CancelNades
Begin Object Class=moCheckBox Name=CancelFire
Caption="Cancel reload by shooting"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=CancelFire.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, you'll be able to cancel reload of converted weapons by shooting (when you have ammo)"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_CancelFire=CancelFire
Begin Object Class=moCheckBox Name=CancelAiming
CaptionWidth=0.955000
Caption="Cancel reload by aiming"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=CancelAiming.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, you'll be able to cancel reload of converted weapons by going into iron sights (when you have ammo)"
WinTop=0.200000
WinLeft=0.517500
WinWidth=0.287000
TabOrder=14
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_CancelAiming=CancelAiming
Begin Object Class=moCheckBox Name=CancelSwitching
Caption="Cancel reload by switching weapons"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=CancelSwitching.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, you'll be able to cancel reload of converted weapons by switching to different weapon"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_CancelSwitching=CancelSwitching
Begin Object Class=moCheckBox Name=ServerReload
CaptionWidth=0.955000
Caption="My reload doesn't work"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=ServerReload.InternalOnCreateComponent
IniOption="@Internal"
Hint="Check this option ONLY in case converted weapons don't reload at all for you; this option should fix the problem, but then latency will affect both reload and active reload"
WinTop=0.250000
WinLeft=0.517500
WinWidth=0.287000
TabOrder=15
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_ReloadWontWork=ServerReload
Begin Object Class=moCheckBox Name=CancelNades
Caption="Cancel reload by throwing grenades"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=CancelNades.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, you'll be able to cancel reload of converted weapons by throwing a grenade"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_CancelNades=CancelNades
Begin Object Class=GUISectionBackground Name=WEAPBG
Caption="General weapon settings"
WinTop=0.012500
WinWidth=0.495000
WinHeight=0.287500
RenderWeight=0.100100
OnPreDraw=WeaponsBG.InternalPreDraw
End Object
bg_WEAP=WEAPBG
Begin Object Class=moCheckBox Name=CancelAiming
Caption="Cancel reload by aiming"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=CancelAiming.InternalOnCreateComponent
IniOption="@Internal"
Hint="If checked, you'll be able to cancel reload of converted weapons by going into iron sights (when you have ammo)"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_CancelAiming=CancelAiming
Begin Object Class=GUISectionBackground Name=RELOADBG
Caption="Weapon reload settings"
WinTop=0.012500
WinLeft=0.505000
WinWidth=0.495000
WinHeight=0.287500
RenderWeight=0.100100
OnPreDraw=WeaponsBG.InternalPreDraw
End Object
bg_RELOAD=RELOADBG
}
Begin Object Class=moCheckBox Name=ServerReload
Caption="My reload doesn't work"
ComponentClassName="ScrnBalanceSrv.ScrnGUICheckBoxButton"
OnCreateComponent=ServerReload.InternalOnCreateComponent
IniOption="@Internal"
Hint="Check this option ONLY in case converted weapons don't reload at all for you; this option should fix the problem, but then latency will affect both reload and active reload"
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
ch_ReloadWontWork=ServerReload
// RANDOM SETTINGS
Begin Object Class=GUISectionBackground Name=randbg
Caption="Random settings"
WinTop=0.300000
WinWidth=0.495000
WinHeight=0.287500
WinLeft=0.505000
RenderWeight=0.100100
// OnPreDraw=WeaponsBG.InternalPreDraw
OnPreDraw=randbg.InternalPreDraw
End Object
bg_RANDOM=randbg
Begin Object class=moComboBox Name=zedhbarpmethod
bReadOnly=true
CaptionWidth=0.000000
Caption="Zed health bars"
Hint="Choose what health bars you want to see"
OnCreateComponent=zedhbarpmethod.InternalOnCreateComponent
OnChange=NiceGUISettings.InternalOnChange
OnLoadINI=NiceGUISettings.InternalOnLoadINI
End Object
mo_ZedHPBars=zedhbarpmethod
}

View File

@ -2,6 +2,8 @@ class NicePlayerController extends ScrnPlayerController
config(NiceUser)
dependson(NicePack)
dependson(NiceFire);
var globalconfig int ZedHPBarStyle; // 0 - big zeds, 1 - all, 2 - disabled
var globalconfig int nicePlayerInfoVersionNumber;
// These are values stored in a settings file
var globalconfig bool bDebug;

View File

@ -285,20 +285,38 @@ static function int GetInvincibilityDuration(KFPlayerReplicationInfo KFPRI){
static function int GetInvincibilitySafeMisses(KFPlayerReplicationInfo KFPRI){
return 0;
}
static function SpecialHUDInfo(KFPlayerReplicationInfo KFPRI, Canvas C){
static function SpecialHUDInfo(KFPlayerReplicationInfo KFPRI, Canvas C)
{
local KFMonster KFEnemy;
local HUDKillingFloor HKF;
local int i, hp;
local float MaxDistanceSquared;
MaxDistanceSquared = 640000;
MaxDistanceSquared *= GetHealthBarsDistanceMulti(KFPRI)**2;
HKF = HUDKillingFloor(C.ViewPort.Actor.myHUD);
if(HKF == none || C.ViewPort.Actor.Pawn == none || MaxDistanceSquared <= 0)
if (HKF == none || C.ViewPort.Actor.Pawn == none || MaxDistanceSquared <= 0)
return;
foreach C.ViewPort.Actor.DynamicActors(class'KFMonster', KFEnemy){
if(KFEnemy.Health > 0 && (!KFEnemy.Cloaked() || KFEnemy.bZapped || KFEnemy.bSpotted) && VSizeSquared(KFEnemy.Location - C.ViewPort.Actor.Pawn.Location) < MaxDistanceSquared)
// read and use player settings
// 0 - big zeds, 1 - all, 2 - disabled
i = NicePlayerController(C.ViewPort.actor).ZedHPBarStyle;
if (i == 2)
return;
else if (i == 1)
hp = 0;
else
hp = 1000;
foreach C.ViewPort.Actor.DynamicActors(class'KFMonster', KFEnemy)
{
if (KFEnemy.Health > hp && (!KFEnemy.Cloaked() || KFEnemy.bZapped || KFEnemy.bSpotted) && VSizeSquared(KFEnemy.Location - C.ViewPort.Actor.Pawn.Location) < MaxDistanceSquared)
HKF.DrawHealthBar(C, KFEnemy, KFEnemy.Health, KFEnemy.HealthMax , 50.0);
}
}
// Is player standing still?
static function bool IsStandingStill(KFPlayerReplicationInfo KFPRI){
if(KFPRI != none && PlayerController(KFPRI.Owner) != none && PlayerController(KFPRI.Owner).Pawn != none && VSize(PlayerController(KFPRI.Owner).Pawn.Velocity) > 0.0)

View File

@ -158,7 +158,12 @@ function SpawnTwoShots()
{
local vector X,Y,Z, FireStart;
local rotator FireRotation;
if( Controller!=none && KFDoorMover(Controller.Target)!=none )
// check this from the very start to prevent any log spam
if (Controller == none || IsInState('ZombieDying'))
return;
if (KFDoorMover(Controller.Target)!=none )
{
Controller.Target.TakeDamage(22,Self,Location,vect(0,0,0),Class'DamTypeVomit');
return;