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.
tnmTextureSwapControl
Re: tnmTextureSwapControl
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]?
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]?
Re: tnmTextureSwapControl
I want to change them during game, so I guess dynamically.
Re: tnmTextureSwapControl
Can you paste the relevant parts of tnm/your code?
Re: tnmTextureSwapControl
And tnmTextureController?
Re: tnmTextureSwapControl
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
Chief Poking Manager of TNM
I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
Re: tnmTextureSwapControl
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.
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.