Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
garrettlynch

What are switches?

Recommended Posts

Hi

I'm trying to understand how basic switches go from red to green when triggered. Reading this:

http://www.doomlegends.com/emporium/tutorials/sprite_basics.html

I guess there is a similarity with sprites because switches seem to use the naming convention as well. So for example, the switch on level E1M1 of Doom looks like its called SW1STRTN and it's counterpart SW2STRTN. I can see these in Eureka but not in XWE for some reason - in XWE I can only see SW1S0 and SW1S1. What are switches? Are they sprites, patches or something else? If I add a new switch, images called SW5S0 and SW5S1, will these work as expected (just because of how they are named) or is there something I need to do to them that registers them as a sequence?

thanks in advance
Garrett

Share this post


Link to post

Switches are pairs of regular textures hardcoded to swap when "used".

First you should understand how textures work. SW1S0 is a patch, SW1STRTN is a texture. Textures are composed of patches via TEXTURE1 and TEXTURE2 lumps.

Advanced source ports allow you to define your own switch pairs. In vanilla Doom, you can only replace existing textures.

Share this post


Link to post
Da Werecat said:

Switches are pairs of regular textures hardcoded to swap when "used".

First you should understand how textures work. SW1S0 is a patch, SW1STRTN is a texture. Textures are composed of patches via TEXTURE1 and TEXTURE2 lumps.

Advanced source ports allow you to define your own switch pairs. In vanilla Doom, you can only replace existing textures.


Ok I understand enough to get what I wanted working by modifying SW1STRTN. I tried to make my own switch from scratch in XWE by creating two texture entries in TEXTURE1 as follows:

SW1WHITE (texture)
GL-WT (background patch for wall and yes it is saved as a flat)
SW1S0 (the red switch patch)

SW2WHITE (texture)
GL-WT (background patch for wall and yes it is saved as a flat)
SW1S1 (the green switch patch)

but this seemed not to work - SW1WHITE appears as a texture but it does not change to SW2WHITE when triggered. It would be useful to know if I'm just missing a last step or if it just can't be done in XWE.

Thanks
Garrett

Share this post


Link to post

The list of textures that can be used as switches is hardcoded. It's not a magical convention like SW1BLAH is automatically associated to SW2BLAH to make a working switch (except in Doomsday).

The list of switch textures is this one:

1       SW1BRCOM    SW2BRCOM    
1       SW1BRN1     SW2BRN1     
1       SW1BRN2     SW2BRN2     
1       SW1BRNGN    SW2BRNGN    
1       SW1BROWN    SW2BROWN    
1       SW1COMM     SW2COMM     
1       SW1COMP     SW2COMP     
1       SW1DIRT     SW2DIRT     
1       SW1EXIT     SW2EXIT     
1       SW1GRAY     SW2GRAY     
1       SW1GRAY1    SW2GRAY1    
1       SW1METAL    SW2METAL    
1       SW1PIPE     SW2PIPE     
1       SW1SLAD     SW2SLAD     
1       SW1STARG    SW2STARG    
1       SW1STON1    SW2STON1    
1       SW1STON2    SW2STON2    
1       SW1STONE    SW2STONE    
1       SW1STRTN    SW2STRTN    
2       SW1BLUE     SW2BLUE     
2       SW1CMT      SW2CMT      
2       SW1GARG     SW2GARG     
2       SW1GSTON    SW2GSTON    
2       SW1HOT      SW2HOT      
2       SW1LION     SW2LION     
2       SW1SATYR    SW2SATYR    
2       SW1SKIN     SW2SKIN     
2       SW1VINE     SW2VINE     
2       SW1WOOD     SW2WOOD     
3       SW1PANEL    SW2PANEL    
3       SW1ROCK     SW2ROCK     
3       SW1MET2     SW2MET2     
3       SW1WDMET    SW2WDMET    
3       SW1BRIK     SW2BRIK     
3       SW1MOD1     SW2MOD1     
3       SW1ZIM      SW2ZIM      
3       SW1STON6    SW2STON6    
3       SW1TEK      SW2TEK      
3       SW1MARB     SW2MARB     
3       SW1SKULL    SW2SKULL    
1: available in all versions of Doom
2: not available in shareware Doom
3: only available in Doom II/Final Doom
They're marked this way so that the engine will not freak out if it doesn't find the texture for a switch.

If you want more switches than that, you will need either to cheat by putting several switches on a single switch texture (and then you use offsets to get the one you want), or to use port-specific features. The most widely supported is Boom's SWITCHES lump. You can create one with SLADE 3 (Archive->New->SWITCHES) and then add more switches to them as you want.

Share this post


Link to post

Gez beats me to it, but I'm posting this anyway.

As Da Werecat said, switches are hardcoded particular pairs of TEXTURE1/2 entries (names). You cannot simply add new by making a texture starting with SW1 and SW2 - that's purely a naming convention of Doom's creators, there's no code checking for that.

There are certain workarounds though. For example you can modify an existing switch texture in TEXTURE1 to look as you wish. SLADE3 editor allows quite a comfortable editing of TEXTURE entries, I'm not familiar with XWE (but can recommend using SLADE3).

If you're making a Boom-compatible map, you can take advantage of SWITCHES lump to define your own textures. For ZDoom-specific wad editing, there's even simpler way using ANIMDEFS. Both act like scripting languages in a text based form which you can put to your wad (SWITCHES needs more complicated care though).

Share this post


Link to post

Many thanks for the list Gez. I only need one switch I think so modifying a default is fine. Just wanted to know if the way I did it wasn't going to cause me problems - still on a learning curve.

Many thanks.

Share this post


Link to post

If your map is for Doom II, there are three switches that are not used and are defined as copies of SWxBRCOM in Doom II. They are SWxSTARG, SWxSTON2, and SWxSTONE. So you can redefine them without losing any actual texture.
http://doomwiki.org/wiki/Switch

Share this post


Link to post

I strongly recommend against using XWE, especially if you're new to modding Doom (seems like you are). I can understand why veterans used to it still using it, but if you're new, it's best not to form bad habits.

XWE has not been touched for seven years (because its codebase is an unmaintainable mess), messes with your registry unless you tell it not to, sometimes alters wads just by opening them, can corrupt them, is slow and buggy, etc.

Slade on the other hand is actively maintained by multiple talented people, is stable and fast, handles WADs very carefully, and has plenty of editing features that XWE doesn't, especially ones useful for editing for modern source ports. For example, don't expect XWE to understand ZDoom's texture format, as it was created after XWE was abandoned.

Point is, avoid XWE like the plague, because it is one.

Share this post


Link to post
TimeOfDeath said:

Smaller download, supports different games, and bothers Gez. ;)

Doesn't bother me. You're old enough to know how XWE can screw stuff up and so you should know how to prevent disasters. (Like not having the wad open in Doom Builder at the same time, not opening in XWE a wad that was edited with Slumped before, etc.) and you also know how to get it to work with your Windows despite the various changes that make it hard to use on Windows newer than Win XP.

Newbies, though. They're probably using Windows 7 or 8, unaware of XWE's little quirks what with always writing to disk, and running into problems.

Share this post


Link to post

Do both Slade and Doom Builder have file change detection (i.e. when you come back, it detects that the wad was changed by someone else and asks you)? Because if they don't, it becomes a bit risky to have them both open the same wad.

Tango said:

is there any advantage to using XWE over Slade 3?

I experienced some difficulties in Slade with converting WAV sounds to Doom sound, that worked well in XWE. Other than that, Slade is just the right answer. Avoid XWE especially if you have to deal with Doom texture sets.

Share this post


Link to post

If you use the 2nd switch texture (SW2BRCOM) in your wad, the switch will go the opposite way (from green to red instead of red to green).
This makes it possible turn something off, instead of the switch
only looking like was turning on.

Share this post


Link to post

>is there any advantage to using XWE over Slade 3?

For me yes, yep I'm new to modding but I'm on OSX with no access to to Windows at the moment. XWE is really easy to convert using wine. I've been told that Slade can be built for OSX but it doesn't look easy. Converting XWE takes (literally) 2 minutes. I only use it for importing things and then I do my level editing in Eureka.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×