tnmTextureSwapControl

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Post Reply
User avatar
Bogie
UNATCO
Posts: 201
Joined: Fri Jul 10, 2015 1:23 am
Location: Canada

tnmTextureSwapControl

Post by Bogie »

In the TNM SDK, there are a couple of classes related to texture swapping, I seem to have been able to get them into my mod. Unfortunately however, Upon starting up the level test, All mover brushes and additive brushes disappear, and my controls lock up. I figured out how it worked, and I really want to use this to simulate a set of servers shutting down (I made custom textures and everything). Could someone possibly help me?

Oh yeah, and GoldenEar's back.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: tnmTextureSwapControl

Post by Hanfling »

I don't know what TNM did there. However textures for bsp geo are basically stored at two locations: On the FPolys and on the FBspSurf.

For non Movers:
If you change FPolys textures, you need to rebuild the map so FBspSurfs get updated.
If you change on FBspSurfs and rebuild the map, they are gone.

For Movers:
Movers use some sort of dynamic bsp system, which is done at load time ingame. So basically what is on the FBspSurfs is gets thrown away and just what is on FPolys it does matter.

Do you want to change the dynamic at runtime or just generally replace them [in editor]?
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
User avatar
Bogie
UNATCO
Posts: 201
Joined: Fri Jul 10, 2015 1:23 am
Location: Canada

Re: tnmTextureSwapControl

Post by Bogie »

I want to change them during game, so I guess dynamically.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: tnmTextureSwapControl

Post by Hanfling »

Can you paste the relevant parts of tnm/your code?
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
User avatar
Bogie
UNATCO
Posts: 201
Joined: Fri Jul 10, 2015 1:23 am
Location: Canada

Re: tnmTextureSwapControl

Post by Bogie »

Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: tnmTextureSwapControl

Post by Hanfling »

And tnmTextureController?
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
User avatar
Jonas
Off Topic Productions
Off Topic Productions
Posts: 14224
Joined: Sat Apr 24, 2004 9:21 pm
Location: Hafnia

Re: tnmTextureSwapControl

Post by Jonas »

Code: Select all

//this is the master class for all tnm scripted texture infos (I'm calling them controllers)
//	NVShacker 2/20/07
class tnmTextureController extends Info
	abstract;

var() ScriptedTexture SlaveTexture;
var bool bSwapNextRender;
var Texture swapBuffer;

//on beginplay we bind the slave texture to us and draw the first texture
simulated function BeginPlay() 
{ 
	if(slaveTexture != None)
	{
		slaveTexture.NotifyActor = Self;
		DrawInitialTexture();
	}
	else
		Destroy(); //without swapTexture our existence is meaningless! meaningless I say!
}

//subclasses can override this to draw the texture initially seen
simulated function DrawInitialTexture()
{
	return; //do nothing
}

//get rid of the slave's ref to us
simulated function Destroyed() 
{ 
	if(slaveTexture != None) 
		slaveTexture.NotifyActor = None;
}

//swaps the currently drawn texture for nexTex on next render
simulated function ChangeTex(Texture newTex)
{
	bSwapNextRender=true;
	swapBuffer=newTex;
}

//we do our texture replacing here
simulated event RenderTexture(ScriptedTexture T)
{
	local Texture S; //for the sake of readability
	if(bSwapNextRender)
	{
		S=swapBuffer; //Source
		T.Palette=S.Palette;
//		T.DrawTile(0, 0, T.USize, T.VSize, 0, 0, S.USize, S.VSize, S, false);
		T.ReplaceTexture(S);
	}
	return;
}

defaultproperties
{
     RemoteRole=ROLE_SimulatedProxy
     bAlwaysRelevant=True
}
Jonas Wæver
Chief Poking Manager of TNM

I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: tnmTextureSwapControl

Post by Hanfling »

Nice approach, never noticed that ReplaceTexture(). Sadly it just copies over the uncompressed top level MipMap.

However make sure:
* The texture you applied to the level is a ScriptedTexture.
* The USize/VSize of the texture your want to replace and the source texture match.
* The (uncompressed) texture format of both textures is 1 byte per pixel (e.g. TEXF_P8).

If that still doesn't work start adding some debug output to crucial functions (RenderTexture, etc.) to especially find out if NotifyActor was set.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Post Reply