Orbital Angles 1.2 (FKA Horizontal Sprite Angles)

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Orbital Angles 1.2 (FKA Horizontal Sprite Angles)

Post by Pixel Eater »

OrbitalAngles1.2.pk3
(79.03 KiB) Downloaded 218 times
Currently for OpenGL only.

This gives a simple way to add 3 dimensional sprite angles to actors. All it requires is some artwork! An additional 66 angles are covered giving a total of 82.
Included are definitions for Doom's monsters and generic placeholder sprites to demonstrate the functionality of the script.

In order for it to work you need to define new states (names shown below) in your actor which contain the 4-letter names of the sprites you wish to add. Then an actor (FullSprites2 for example) must be spawned in the BeginPlay() event. There are a few to choose from depending on your needs and can be found in the root directory of the mod.
Note: FullSprites1 gives a 45 degree sprite above and below, FullSprites2 gives 30 and 60 degrees instead. Both have a top and bottom sprite as well.

Here's an example definition, using actor inheritance:

Code: Select all

class HorizAvile : Archvile Replaces Archvile
{
	States
	{
	Up1Sprite:
		CIRC # 1 ;
	Up2Sprite:
		CIR2 # 1 ;
	TopSprite:
		TANG # 1 ;
		
	Dn1Sprite:
		CIRC # 1 ;
	Dn2Sprite:
		CIR2 # 1 ;
	BotSprite:
		BANG # 1 ;
	}
	
	override void BeginPlay()
	{
		Super.BeginPlay() ;
		
		A_SpawnItemEx( "FullSprites2", flags: SXF_SETMASTER | SXF_ABSOLUTEANGLE
		| SXF_TRANSFERPITCH | SXF_TRANSFERSPRITEFRAME | SXF_TRANSFERTRANSLATION
		| SXF_TRANSFERSCALE | SXF_TRANSFERSTENCILCOL | SXF_TRANSFERALPHA
		| SXF_TRANSFERRENDERSTYLE );
	}
}
Copying this into a ZScript file adds the extra angles to an Archvile. To add your own sprites instead of circles and arrows, change the 4-letter names to reflect those of your imported sprite files. Make sure to include the script containing the spawnable actor (ie. FullSprites2.zc) in your project, follow the internal directions on what needs renaming... and that's it!

Here's an old, ugly video to watch: Clicky
Spoiler: History
Last edited by Pixel Eater on Sat Sep 15, 2018 9:38 pm, edited 2 times in total.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Horizontal Sprite Angles 1.1

Post by Pixel Eater »

An update because the code had some redundancy and illogical flow. I was suddenly getting stuttering which seemed too coincidental but now it's gone.

I also found that the Pain Elemental's Lost Souls were getting stuck because they didn't agree with the way I grab the master actor's spriteIDs. So I've given them a dedicated script file (LSoulMain.zc) that must have the IDs set internally. It's a bit brute-forcish but doesn't reduce efficiency- it just means more effort to update a second file with any future improvements.

This time there are some extra scripts (though not used) which can be mixed and matched with among the different actors. Say if you don't want to create bottom sprites for your character or decoration and don't want the bobbing effect when idle/walking, you can direct it's definition to use the TopOnlyNoBob actor, like such:

Code: Select all

class HorizZomb : ZombieMan Replaces ZombieMan
{
	States
	{
	TopSprite:
		TANG # 1 ;
	}
	
	override void BeginPlay()
	{
		Super.BeginPlay() ;
		
		A_SpawnItemEx( "TopOnlyNoBob", flags: SXF_SETMASTER | SXF_ABSOLUTEANGLE
		| SXF_TRANSFERPITCH | SXF_TRANSFERSPRITEFRAME | SXF_TRANSFERTRANSLATION
		| SXF_TRANSFERSCALE | SXF_TRANSFERSTENCILCOL | SXF_TRANSFERALPHA
		| SXF_TRANSFERRENDERSTYLE );
	}
}
Another thing I should mention is that it's recommended to rename what you can to avoid conflicts. Instructions are included within.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Orbital Angles 1.2 (FKA Horizontal Sprite Angles)

Post by Pixel Eater »

Here's an update (and logical name change) to give more angles than just top and bottom. It can now show either 45 degrees or 30/60 degrees above and below the regular sprites. That can be combined with GZDoom's 16 rotations per frame, giving 82 total angles... though you'd be crazy to want that many! :wink:

To demonstrate the new angles there are circular sprites (purple and green) as placeholders. They change brightness depending on the angle you're looking from- Green is black from the front, purple is white and vice versa. Testing with these simplified sprites gives me only basic information so real world feedback would be greatly appreciated :geek:
Drake Raider
Posts: 474
Joined: Fri Jul 18, 2008 12:27 pm

Re: Orbital Angles 1.2 (FKA Horizontal Sprite Angles)

Post by Drake Raider »

SmoothDoom+This may be madness.
Post Reply

Return to “Script Library”