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

Add torch sound to new torch

Recommended Posts

I've got the Doom 64 sprites in my WAD and I've been slowly but surely adapting different features of Cosmetic Doom into it. The problem I'm faced with now is how to take the ambient sound of Cosmetic Doom's torches and attach them to the Doom 64 sprites. I've added this line: activesound "props/fire" and then placed A_LoopActiveSound where I thought it might be appropriate, but there aren't as many options with the Doom 64 torch. I've also placed the SNDINFO stuff from Cosmetic Doom into my WAD's SNDINFO lump and added the sounds to my WAD. Here are the two side-by-side--or, you know, top-to-bottom:

actor ShortRedTorch2 replaces ShortRedTorch
{
translation "192:207=168:184","240:247=185:191" //blue to red
height 45
radius 6
scale .5
activesound "props/fire"
+RANDOMIZE
+SOLID
states
{
Spawn:
STRB A 0 bright
STRB A 0 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
STRB B 4 bright A_LoopActiveSound
STRB C 0 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
STRB D 4 bright A_LoopActiveSound
STRB E 0 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
STRB F 4 bright A_LoopActiveSound
STRB G 0 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
STRB H 4 bright A_LoopActiveSound
STRB I 0 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
STRB J 4 bright A_LoopActiveSound
STRB K 0 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
STRB L 4 bright A_LoopActiveSound
STRB M 0 bright
loop
}
}

actor 64ShortRedTorch : ShortRedTorch replaces ShortRedTorch
{
RenderStyle Translucent
Alpha 0.6
Scale 0.75
States
{
Spawn:
TRED F 0 bright
TRED F 0 bright A_SpawnItemEx ("ShortTorchStick",0,0,0,0,0,0,0,0)
TRED FGHIJ 5 bright
Goto Spawn+2

Share this post


Link to post

Does A_LoopActiveSound really need to be called back and back again and again and over and over? I'd think that the following code should be enough:

      Spawn:
            STRB A 0 Bright NoDelay A_LoopActiveSound
            STRB ABCDEFGHIJKLM 4 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
            Loop

Share this post


Link to post

I think I should have been more specific--I'm trying to take the active sound and attach it to TRED. STRB is the sprite from Cosmetic Doom. It looks like you know what to do, but I think I provided less than enough information.

Share this post


Link to post

I think I'm doing it wrong, though, because I tried that. It's not as simple as replacing every "STRB" with a "TRED", is it? I'm assuming that instead of A-M I want to make it just F-J...and then do I want to still alternate from 0-4?

Share this post


Link to post
rabidrage said:

It's not as simple as replacing every "STRB" with a "TRED", is it?

Unless I'm missing something, I think the principle is correct.

I'm assuming that instead of A-M I want to make it just F-J...

Yes.

and then do I want to still alternate from 0-4?

Try it as Gez said, just with "TRED FGHIJ" instead of "STRB ABCDEFGHIJKLM". You also won't need the A_SpawnItemEx("RedFlare,...) part, I suppose. And maybe remove the additional properties of ShortRedTorch2 if you don't want them (translation, radius atd.), I thought this was a matter of course.

Basically just add the "activesound "props/fire"" to the definition of 64ShortRedTorch and put A_LoopActiveSound in the spawn state like it is in Gez's example.

Share this post


Link to post

Well this doesn't do it:

actor 64ShortRedTorch : ShortRedTorch replaces ShortRedTorch
{
RenderStyle Translucent
Alpha 0.6
Scale 0.75
activesound "props/fire"
States
{
Spawn:
TRED F 0 bright A_loopactivesound
TRED FGHIJ 5 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
loop
Goto Spawn+2
}
}

I am in over my head!

Share this post


Link to post

Maybe I know what's the deal. If the very first frame after the actor is spawned contains an action, the action is not performed. You need one more state before "TRED F 0 bright A_loopactivesound". Make it "TRED F 0 bright", for example.

EDIT: No I was wrong, sorry. You call "loop" before "Goto Spawn+2", which makes the latter redundant, and the code keeps looping the sound part too.

Share this post


Link to post

Yeah, unless it has the NoDelay flag. But it doesn't really matter when it loops back to it.

actor 64ShortRedTorch : ShortRedTorch replaces ShortRedTorch
{
      RenderStyle Translucent
      Alpha 0.6
      Scale 0.75
      ActiveSound "props/fire"
      States
      {
      Spawn:
            TRED F 0 bright
            TRED F 0 bright A_SpawnItemEx ("ShortTorchStick")
            TRED F 0 bright A_LoopActiveSound
            TRED FGHIJ 5 bright
            Goto Spawn+3
      }
}

Share this post


Link to post

Okay--this almost works. I would have known sooner, but I have a really convoluted setup between a WAD and a PK3 and it's easy to upset the whole thing (chalk it up to gross inexperience). I say "almost" because they don't light up the room at all. I'm guessing I need to put the red flare back in, and I tried it after the first entry, like this:

actor 64ShortRedTorch : ShortRedTorch replaces ShortRedTorch
{
RenderStyle Translucent
Alpha 0.6
Scale 0.75
ActiveSound "props/fire"
States
{
Spawn:
TRED F 0 bright A_SpawnItemEx("RedFlare", 0, 0, 33, 0, 0, 0, 0, 0)
TRED F 0 bright A_SpawnItemEx ("ShortTorchStick")
TRED F 0 bright A_LoopActiveSound
TRED FGHIJ 5 bright
Goto Spawn+3
}
}

It didn't bring it back. Now what?

Share this post


Link to post

Either add the NoDelay keyword to the first state, or insert an empty state first.


Technical explanation: Doom executes a state's codepointer when the actor enters that state. This is where it gets very subtle: when an actor is spawned, it doesn't enter the spawn state, it appears in it. So the spawn state's codepointer isn't run, because there was no state change. It will be run if the actor leaves the state and then enters it again. Something as simple as:

      Spawn:
            FOOB A 1 A_DoSomething
            Loop
is enough. It leaves the state to reenter it, but there is nominally, a state change.

ZDoom added the NoDelay keyword which allows actors to execute the codepointer from the state they were spawned in. It's not a default behavior because nobody wanted to speculate what weird problems could be caused by a blanket change.

Share this post


Link to post

Okay--it is now perfect with this code:

actor 64ShortRedTorch : ShortRedTorch replaces ShortRedTorch
{
RenderStyle Translucent
Alpha 0.6
Scale 0.75
ActiveSound "props/fire"
States
{
Spawn:
TRED F 0 bright NoDelay
TRED F 0 bright A_SpawnItemEx("RedFlare", 0, 0, 59, 0, 0, 0, 0, 0)
TRED F 0 bright A_SpawnItemEx ("ShortTorchStick")
TRED F 0 bright A_LoopActiveSound
TRED FGHIJ 5 bright
Goto Spawn+3
}
}

I had to take into account that I still wanted it to be the 64 torch, and that it's culling information from other files out of Cosmetic Doom. Once I had it all arranged properly and everything pointed the right way, it worked. Now I just have to carry over this success to the other torches!

Share this post


Link to post

rabidrage said:
TRED F 0 bright NoDelay
TRED F 0 bright A_SpawnItemEx("RedFlare", 0, 0, 59, 0, 0, 0, 0, 0)
Heh, you've kind of over-engineered this part, you did both things that Gez suggested where one could be enough. Either one of these options would be sufficient in that place:
TRED F 0 bright
TRED F 0 bright A_SpawnItemEx("RedFlare", 0, 0, 59, 0, 0, 0, 0, 0)
or just
TRED F 0 bright NoDelay A_SpawnItemEx("RedFlare", 0, 0, 59, 0, 0, 0, 0, 0)
It's working of course, I say this just so that you realize. :)

Share this post


Link to post

No, this is important, thanks. I don't exactly come from a coding background, so I'm sure there will be a ton of junk in my final product. I figure I'll stop modding stuff once the map is complete so I don't get too carried away. Of course, I could also try to make it into a megawad...

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
×