Skip to content

Commit

Permalink
Replace InstaGibPlus Strings With VersionInfo Data
Browse files Browse the repository at this point in the history
  • Loading branch information
Deaod committed Apr 10, 2024
1 parent fb91081 commit ed8cdb3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Classes/ClientSettings.uc
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ simulated function CreateCrosshairLayers() {
}
}

simulated function CheckConfig() {
simulated function CheckConfig(string PackageBaseName) {
local int i;
local string PackageName;

PackageName = class'StringUtils'.static.GetPackage();

for (i = 0; i < arraycount(sHitSound); i++) {
if (Left(sHitSound[i], 12) ~= "InstaGibPlus") {
sHitSound[i] = string(Sound'HitSound'.Outer.Name)$Mid(sHitSound[i], InStr(sHitSound[i], "."));
if (Left(sHitSound[i], Len(PackageBaseName)) ~= PackageBaseName) {
sHitSound[i] = class'StringUtils'.static.GetPackage()$Mid(sHitSound[i], InStr(sHitSound[i], "."));
}
if (sHitSound[i] == "" && sHitSound[i] != default.sHitSound[i]) {
sHitSound[i] = default.sHitSound[i];
Expand Down
15 changes: 10 additions & 5 deletions Classes/UTPure.uc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var bbPlayerReplicationInfo SkinIndexToPRIMap[64];

var IGPlus_GameEventChain GameEventChain;
var StringUtils StringUtils;
var Info VersionInfo;

var Object SettingsHelper;
var ServerSettings Settings;
Expand Down Expand Up @@ -69,11 +70,11 @@ function PreBeginPlay()

function PrintVersionInfo() {
local string LongStr;
LongStr = class'VersionInfo'.default.PackageBaseName@class'VersionInfo'.default.PackageVersion;
LongStr = VersionInfo.GetPropertyText("PackageBaseName")@VersionInfo.GetPropertyText("PackageVersion");

if (Len(LongStr) > 20) {
xxLog("#"$StringUtils.CenteredString(class'VersionInfo'.default.PackageBaseName, 29, " ")$"#");
LongStr = class'VersionInfo'.default.PackageVersion;
xxLog("#"$StringUtils.CenteredString(VersionInfo.GetPropertyText("PackageBaseName"), 29, " ")$"#");
LongStr = VersionInfo.GetPropertyText("PackageVersion");
}

xxLog("#"$StringUtils.CenteredString(LongStr, 29, " ")$"#");
Expand Down Expand Up @@ -125,11 +126,15 @@ function PostBeginPlay()
local string ServPacks, curMLHPack, sTag, fullpack;
local int XC_Version;
local string MapName;
local class<Info> VersionInfoClass;

Super.PostBeginPlay();

InitializeSettings();

VersionInfoClass = class<Info>(DynamicLoadObject(class'StringUtils'.static.GetPackage()$".VersionInfo", class'class', true));
VersionInfo = Spawn(VersionInfoClass);

xxLog("");
xxLog("###############################");
PrintVersionInfo();
Expand Down Expand Up @@ -183,7 +188,7 @@ function PostBeginPlay()
{

// Verify that the PlayerPack Package is in ServerPackages
curMLHPack = Settings.PlayerPacks[i]$"H"$class'VersionInfo'.default.PackageVersion;
curMLHPack = Settings.PlayerPacks[i]$"H"$VersionInfo.GetPropertyText("PackageVersion");
fullpack = curMLHPack$"."$Settings.PlayerPacks[i]$"LoginHandler";
if (Instr(CAPS(ServPacks), Caps(Chr(34)$curMLHPack$Chr(34))) != -1)
{
Expand Down Expand Up @@ -853,7 +858,7 @@ function Mutate(string MutateString, PlayerPawn Sender)

if (MutateString ~= "CheatInfo")
{
Sender.ClientMessage("This server is running "$class'VersionInfo'.default.PackageBaseName@class'VersionInfo'.default.PackageVersion);
Sender.ClientMessage("This server is running "$VersionInfo.GetPropertyText("PackageBaseName")@VersionInfo.GetPropertyText("PackageVersion"));
if (Settings.bUTPureEnabled)
{
Settings.DumpServerSettings(Sender);
Expand Down
8 changes: 7 additions & 1 deletion Classes/bbCHSpectator.uc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var rotator LastTargetViewRotation;
var rotator LastRotation;
var Actor LastViewTarget;

var Info VersionInfo;
var Object ClientSettingsHelper;
var ClientSettings Settings;

Expand Down Expand Up @@ -151,7 +152,7 @@ simulated function InitSettings() {
if (Settings == none) {
ClientSettingsHelper = new(none, 'InstaGibPlus') class'Object';
Settings = new(ClientSettingsHelper, 'ClientSettings') class'ClientSettings';
Settings.CheckConfig();
Settings.CheckConfig(VersionInfo.GetPropertyText("PackageBaseName"));
Log("Loaded Settings!", 'IGPlus');
}
}
Expand Down Expand Up @@ -301,11 +302,16 @@ event PlayerTick( float DeltaTime )

event PostBeginPlay()
{
local class<Info> VersionInfoClass;

ForEach AllActors(Class'UTPure', zzUTPure)
break;

Super.PostBeginPlay();

VersionInfoClass = class<Info>(DynamicLoadObject(class'StringUtils'.static.GetPackage()$".VersionInfo", class'class', true));
VersionInfo = Spawn(VersionInfoClass);

InitSettings();
}

Expand Down
27 changes: 17 additions & 10 deletions Classes/bbPlayer.uc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ var IGPlus_ServerMove IGPlus_ServerMove_FreeList;
var Utilities Utils;
var StringUtils StringUtils;
var bbPlayerStatics PlayerStatics;
var Info VersionInfo;

struct IGPlus_ForcedSettings_Entry {
var int Mode;
Expand Down Expand Up @@ -684,7 +685,7 @@ simulated function Touch( actor Other )
{
if (zzUTPure.Settings.ShowTouchedPackage)
{
ClientMessage(class'StringUtils'.static.PackageOfObject(Other));
ClientMessage(StringUtils.PackageOfObject(Other));
}

if ((Other.IsA('Kicker') && Other.Class.Name != 'NN_Kicker')) {
Expand Down Expand Up @@ -923,21 +924,25 @@ simulated function InitSettings() {
}

if (Settings == none) {
ClientSettingsHelper = new(none, 'InstaGibPlus') class'Object'; // object name = INI file name
ClientSettingsHelper = new(none, StringUtils.StringToName(VersionInfo.GetPropertyText("PackageBaseName"))) class'Object'; // object name = INI file name
Settings = new(ClientSettingsHelper, 'ClientSettings') class'ClientSettings'; // object name = Section name
Settings.CheckConfig();
Settings.CheckConfig(VersionInfo.GetPropertyText("PackageBaseName"));
Log("Loaded Settings!", 'IGPlus');
}
}

event PostBeginPlay()
{
local int TickRate;
local class<Info> VersionInfoClass;

Super.PostBeginPlay();

Utils = new(none) class'Utilities';
StringUtils = class'StringUtils'.static.Instance();
PlayerStatics = Spawn(class'bbPlayerStatics');
VersionInfoClass = class<Info>(DynamicLoadObject(StringUtils.GetPackage()$".VersionInfo", class'class', true));
VersionInfo = Spawn(VersionInfoClass);
IGPlus_SavedInputChain = Spawn(class'IGPlus_SavedInputChain');
IGPlus_InputReplicationBuffer = new class'IGPlus_DataBuffer';

Expand Down Expand Up @@ -969,9 +974,13 @@ event PostBeginPlay()
// called after PostBeginPlay on net client
simulated event PostNetBeginPlay()
{
local class<Info> VersionInfoClass;

Utils = new(none) class'Utilities';
StringUtils = class'StringUtils'.static.Instance();
PlayerStatics = Spawn(class'bbPlayerStatics');
VersionInfoClass = class<Info>(DynamicLoadObject(StringUtils.GetPackage()$".VersionInfo", class'class', true));
VersionInfo = Spawn(VersionInfoClass);
IGPlus_SavedInputChain = Spawn(class'IGPlus_SavedInputChain');
IGPlus_InputReplicationBuffer = new class'IGPlus_DataBuffer';

Expand Down Expand Up @@ -1023,11 +1032,14 @@ function ServerSetDodgeSettings(float MaxTime, float MinTime) {

event Possess()
{
local class<Info> VersionInfoClass;
local Kicker K;

Utils = new(none) class'Utilities';
StringUtils = new(none) class'StringUtils';
StringUtils = class'StringUtils'.static.Instance();
PlayerStatics = Spawn(class'bbPlayerStatics');
VersionInfoClass = class<Info>(DynamicLoadObject(StringUtils.GetPackage()$".VersionInfo", class'class', true));
VersionInfo = Spawn(VersionInfoClass);

InitSettings();

Expand Down Expand Up @@ -1164,12 +1176,7 @@ event Possess()
}

function string IGPlus_DetermineLogoVersionText() {
local class<Info> VersionInfoClass;
local Info VersionInfoObj;

VersionInfoClass = class<Info>(DynamicLoadObject(class'StringUtils'.static.GetPackage()$".VersionInfo", class'class', true));
VersionInfoObj = Spawn(VersionInfoClass);
return VersionInfoObj.GetPropertyText("PackageBaseName")@VersionInfoObj.GetPropertyText("PackageVersion");
return VersionInfo.GetPropertyText("PackageBaseName")@VersionInfo.GetPropertyText("PackageVersion");
}

function bool IGPlus_DetermineDualButtonSwitchSetting() {
Expand Down

0 comments on commit ed8cdb3

Please sign in to comment.