Skip to content

Commit

Permalink
[major] Better config support for textures
Browse files Browse the repository at this point in the history
  • Loading branch information
Vel-San committed May 2, 2021
1 parent 0011d55 commit 5adcfdc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
13 changes: 13 additions & 0 deletions Config/MovieAdsRemover_Config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[MovieAdsRemover.MovieAdsRemover]
# Removes the 'Movies' section completely
bCompletelyDisable=true
# Replace the movies with a texture image that you can specify below
bReplaceWithTexture=true
# Texture Class Name
# All textures MUST be of dimension 1024/1024. Please Up-scale or Down-scale before you
# Import to KF-SDK. In-game they will automatically be downscaled to fit view of w=320 h=240
; sTextureName=MARTex.AT_FirePlace # This is just an Image
sTextureName=MARTex.Doro.Blood_a01 # This is an actual GIF
# Texture Dimensions
iW=320
iH=240
15 changes: 10 additions & 5 deletions MovieAdsRemover/Classes/CustomLobbyMenu.uc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Class CustomLobbyMenu extends LobbyMenu DependsOn(MovieAdsRemover);

var texture ImgTex;
var string ImgName;
var MovieAdsRemover MutRef;

function InitComponent(GUIController MyC, GUIComponent MyO)
Expand Down Expand Up @@ -47,10 +49,16 @@ function DrawPerk(Canvas Canvas)
Canvas.SetPos(0.066797 * Canvas.ClipX + 5, 0.325208 * Canvas.ClipY + 30);
X = Canvas.ClipX / 1024; // X & Y scale

if(!MutRef.bCompletelyDisable)
if(!MutRef.bCompletelyDisable || MutRef.bReplaceWithTexture)
{
AdBackground.WinWidth = 320 * X + 10;
AdBackground.WinHeight = 240 * X + 37;

// Show Canvas + Img
ImgName = MutRef.sTextureName;
ImgTex = texture(DynamicLoadObject(ImgName, class'texture', true));
Canvas.DrawTile(ImgTex, 320 * X, 240 * X,
0, 0, MutRef.iW, MutRef.iH);
}
else
{
Expand All @@ -61,10 +69,7 @@ function DrawPerk(Canvas Canvas)
AdBackground.RenderWeight=0;
}

// TODO: Add support for texture loading
/*Canvas.DrawTile(XXXX TEXTURE HERE, 320 * X, 240 * X,
0, 0, 320, 240);
*/

}

if ( KFPlayerController(PlayerOwner()) == none || KFPlayerController(PlayerOwner()).SelectedVeterancy == none ||
Expand Down
12 changes: 8 additions & 4 deletions MovieAdsRemover/Classes/MovieAdsRemover.uc
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@

class MovieAdsRemover extends Mutator Config(MovieAdsRemover_Config);

#exec OBJ LOAD FILE=MARTex.utx

// Config Vars
var config bool bCompletelyDisable;
var config bool bCompletelyDisable, bReplaceWithTexture;
var config string sTextureName;
var config int iW, iH;

// Local Vars
var MovieAdsRemover Mut;

replication
{
unreliable if (Role == ROLE_Authority)
bCompletelyDisable,
bCompletelyDisable,bReplaceWithTexture,
sTextureName;
}

// Initialization
simulated function PostBeginPlay()
{
local int i;

// Pointer To self
Mut = self;
default.Mut = self;
class'MovieAdsRemover'.default.Mut = self;

// Make sure Clients also download the Texture Package
AddToPackageMap("MARTex.utx");
}

simulated function Tick(float DeltaTime) {
Expand Down
Binary file added Textures/MARTex.utx
Binary file not shown.

0 comments on commit 5adcfdc

Please sign in to comment.