Decoration Sound

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
MDenham
Posts: 161
Joined: Sun Oct 14, 2007 2:23 am

Post by MDenham »

Zajo wrote:That does not help. All the same. There is another problem - the sprite seems to be offset from the center of the actor. When I move around it, it's quite visible. When near a wall, from one angle it looks like away, and from another angle it's in the wall (not drawing). Hmmm. I'm really stuck.
This is normal behavior if your sprite is wider than the object actually is.

It starts drawing the sprite from the left edge of your view of the object and continues to the right; combined with the fact that actors are square, and therefore the angle you're viewing the object at changes the effective width of the object (cardinal directions are narrower than secondary directions [NE/NW/etc.] by ~41%), this leads to the situation you're dealing with.

Also, the issue with the torch appearing in the same Z position no matter the height is probably because your torch is running into the ceiling, and so is being forced down. :D

BTW, is your torch sprite 16x80?
User avatar
Zajo
Posts: 88
Joined: Sun Apr 23, 2006 7:00 am

Post by Zajo »

MDenham wrote:Also, the issue with the torch appearing in the same Z position no matter the height is probably because your torch is running into the ceiling, and so is being forced down. :D
Yeah, that was the problem. Thanks.
MDenham wrote:This is normal behavior if your sprite is wider than the object actually is. It starts drawing the sprite from the left edge of your view of the object and continues to the right; combined with the fact that actors are square, and therefore the angle you're viewing the object at changes the effective width of the object (cardinal directions are narrower than secondary directions [NE/NW/etc.] by ~41%), this leads to the situation you're dealing with.
The sprite is 16 pixels wide. The actor's radius is 8. This is right, right? So how to deal with the problem?
MDenham
Posts: 161
Joined: Sun Oct 14, 2007 2:23 am

Post by MDenham »

Zajo wrote:
MDenham wrote:This is normal behavior if your sprite is wider than the object actually is. It starts drawing the sprite from the left edge of your view of the object and continues to the right; combined with the fact that actors are square, and therefore the angle you're viewing the object at changes the effective width of the object (cardinal directions are narrower than secondary directions [NE/NW/etc.] by ~41%), this leads to the situation you're dealing with.
The sprite is 16 pixels wide. The actor's radius is 8. This is right, right? So how to deal with the problem?
This may just be general wonkiness of the sprite engine in general, then.

The best suggestion I can give in this case is to move it a little further away from the wall. It'll still look wrong from some angles if it's meant to look like it's attached to the wall, but at least it won't disappear anymore.

(And yes, if the sprite is 16 pixels wide, the actor's radius should be 8.)

Another idea: have you checked the offsets for your sprites? (The "it draws from the left edge" that I said... meh, I was wrong. It's "the X offset given is drawn at the center".)
User avatar
Enjay
 
 
Posts: 27274
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Post by Enjay »

With +NOGRAVITY you set that actor's Z height in your map editor. You give the thing a z coordinate that is the number of units above the floor it is placed on. If you want an actor to be 64 units above the floor, then you set the z coord at 64 - regardless of whether the floor it is on is at 0, -512, +1024, whatever.

However, it sounds like this, and your other problem might be that you have not offset your sprites. As a default import, the sprite is probably aligned at 0,0. This means that the top left of the sprite is aligned with the bottom centre of the thing. This, in turn, makes the thing look as if it is off to one side and pushed down into the floor. Symmetrical actors usually have an x offset of half their width and a y offset of their full (or almost full) height. A program like XWE will let you set offsets.

Image
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Post by Kinsie »

Another way of doing looping sounds is:
A_PlaySoundEx("mysoundname", "Body", 1)
User avatar
Zajo
Posts: 88
Joined: Sun Apr 23, 2006 7:00 am

Post by Zajo »

Thanks a lot, guys.
Enjay wrote:With +NOGRAVITY you set that actor's Z height in your map editor. You give the thing a z coordinate that is the number of units above the floor it is placed on. If you want an actor to be 64 units above the floor, then you set the z coord at 64 - regardless of whether the floor it is on is at 0, -512, +1024, whatever.
I pretty understand this. My question was whether I could avoid setting it in editor.
Enjay wrote:However, it sounds like this, and your other problem might be that you have not offset your sprites. As a default import, the sprite is probably aligned at 0,0. This means that the top left of the sprite is aligned with the bottom centre of the thing. This, in turn, makes the thing look as if it is off to one side and pushed down into the floor. Symmetrical actors usually have an x offset of half their width and a y offset of their full (or almost full) height. A program like XWE will let you set offsets.
The problem is that I use the PK3 structure, not WAD.
Kinsie wrote:Another way of doing looping sounds is:
A_PlaySoundEx("mysoundname", "Body", 1)
Yeah, thanks.
User avatar
.+:icytux:+.
Posts: 2661
Joined: Thu May 17, 2007 1:53 am
Location: Finland

Post by .+:icytux:+. »

Zajo wrote:The problem is that I use the PK3 structure, not WAD.
but you can open and edit pk3's in xwe...

but i dont see why having loose sprites in a pk3... i have only seen pk3's used for having 2 or more wads in the same pakage.. so maybe having the sprites in a wad and then open the wad into the pk3...
User avatar
Zajo
Posts: 88
Joined: Sun Apr 23, 2006 7:00 am

Post by Zajo »

What do you mean by opening the wad into the pk3?
User avatar
.+:icytux:+.
Posts: 2661
Joined: Thu May 17, 2007 1:53 am
Location: Finland

Post by .+:icytux:+. »

well.. if your using XWE it should be Entry>Load>(then the wad you want)
MDenham
Posts: 161
Joined: Sun Oct 14, 2007 2:23 am

Post by MDenham »

Also, since you're using a PK3, you might want to look into (if you aren't already) using PNGs for your sprites and then using SetPNG to fix up their offsets.
User avatar
Zajo
Posts: 88
Joined: Sun Apr 23, 2006 7:00 am

Post by Zajo »

MDenham wrote:Also, since you're using a PK3, you might want to look into (if you aren't already) using PNGs for your sprites and then using SetPNG to fix up their offsets.
I am using PNGs. That sounds much clearer to me. I can't find the program, though.
User avatar
Unknown_Assassin
Posts: 2468
Joined: Wed Apr 12, 2006 5:17 pm
Location: Where dead carcasses lie
Contact:

Post by Unknown_Assassin »

.+:icytux:+. wrote: but you can open and edit pk3's in xwe...
As I recall, you can only open pk3 files in SLumped.
User avatar
Enjay
 
 
Posts: 27274
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Post by Enjay »

Both XWE and SLumped allow you to set sprite offsets - in PNG form or Doom graphics form - using a GUI rather than setpng which is a command line tool. However, if you want it, got to Graf's download page.

http://grafzahl.drdteam.org/index.php?page=topic&id=230

Also, there is no reason for the "pk3" format to work any better or worse than the WAD format as far as keeping sprite offset information is concerned. Both formats require offsets to be set and both formats can store graphics that have them set. How, for example, do you think all the sprites in the KDiZD "pk3" manged to show up correctly? ;)
User avatar
Zajo
Posts: 88
Joined: Sun Apr 23, 2006 7:00 am

Post by Zajo »

Whoooa! I got it working finally. Thank you guys. You're pretty careful. Now my torch is drawing correctly and playing the sound just as I want.
User avatar
farhaven
Posts: 82
Joined: Sun Feb 25, 2007 2:01 pm
Location: NRW, Germany

Post by farhaven »

that sprite problem sounds like you have the wrong offsets set for the sprites. These usually are half of the x and half of the y size of the sprite
Post Reply

Return to “General”