Orbital Angles 1.2 (FKA Horizontal Sprite Angles)

Post your example zscripts/ACS scripts/etc here.

Orbital Angles 1.2 (FKA Horizontal Sprite Angles)

Postby Pixel Eater » Sun Sep 02, 2018 9:34 pm

OrbitalAngles1.2.pk3
(79.03 KiB) Downloaded 26 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 allExpand view
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 10:38 pm, edited 2 times in total.
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: Horizontal Sprite Angles 1.1

Postby Pixel Eater » Thu Sep 06, 2018 10:55 pm

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 allExpand view
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
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: Orbital Angles 1.2 (FKA Horizontal Sprite Angles)

Postby Pixel Eater » Sat Sep 15, 2018 11:07 pm

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:
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: Orbital Angles 1.2 (FKA Horizontal Sprite Angles)

Postby Drake Raider » Thu Oct 25, 2018 7:41 pm

SmoothDoom+This may be madness.
User avatar
Drake Raider
Currently working on Blanket Doom
 
Joined: 18 Jul 2008
Location: Plane of thought.


Return to Script Library

Who is online

Users browsing this forum: No registered users and 1 guest