A_SpawnItemEx for software brightmaps

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
vAethor
Posts: 93
Joined: Wed May 10, 2017 4:10 pm

A_SpawnItemEx for software brightmaps

Post by vAethor »

I'm making a project with a self-imposed limit of only software mode and 320 x 200, and may have worked out a way to simulate brightmaps without OpenGL, though I know it will only work on sprites.

What I have going is a base sprite of a character in armor I made in my drawing program, minus the glowing eyes, then I saved the glowing eyes part as a separate sprite that's basically a brightmap, then create a separate Decorate definition for it and spawn it on top of the base sprite at runtime. I looked at Brutal Doom and how the light flare was added on top of the lamps in-game.

My two graphics:
Image Image

It's supposed to make this:
Image

But when I run the map, the knight's eyes are still black, with no glow.

Here is my code:

Code: Select all

// Kyrdan knight actor (Simple actor replacement test)
actor KyrdanKnight : TechLamp replaces Techlamp
{
	Radius 20
	Height 56
	Scale 0.3
	States
	{
		Spawn:
		KYRD A -1
		TNT1 A  0 A_SpawnItemEx("KyrGlowmap", 0, 0, 0)
		Stop
	}
}

// The eye glow (software-friendly brightmap!)
// Still needs some fine-tuning though...
Actor KyrGlowmap
{
	// Copypasted from Brutal Doom "Flare_General"
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	+NOTONAUTOMAP
	renderstyle Add
	
	States
	{
		Spawn:
		KGLW A -1 Bright
		Stop
	}
}
I would post screenshots but I think this explains enough. But here's a PK3 of my project so far so you can look at it and maybe help me correct it:
https://drive.google.com/file/d/1xrXaKK ... sp=sharing
User avatar
hg82
Posts: 13
Joined: Thu Mar 22, 2018 11:40 am

Re: A_SpawnItemEx for software brightmaps

Post by hg82 »

Did you try to change the frame order of your actor?
As far as I know a frame duration of "-1" waits forever. So your brightmap will never be spawned.

I think it should be something like this:

Code: Select all

States
{
    Spawn:
        KYRD A 0 //can't use script calls on very first frame
        KYRD A 0 A_SpawnItemEx("KyrGlowmap", 0, 0, 0) //spawn the brightmap
        KYRD A -1 //wait forever
        Stop
 }
Also, I think the renderstyle needs to be put in double quotes

Code: Select all

RenderStyle "Add"
Just out of curiosity: How are planning to keey your brightmap always the same position as your actor?
I did a similar thing for fake shadows. I used the "A_warp" function with a pointer to the master - in this case your actor.
Worked pretty well for me.

EDIT: Just noticed that it's a static actor... Either way perhaps that information is helpful for other stuff you do.

Cheers
HG
vAethor
Posts: 93
Joined: Wed May 10, 2017 4:10 pm

Re: A_SpawnItemEx for software brightmaps

Post by vAethor »

Okay, the brightmap definitely spawned now, only problem is it's floating way above and seemingly in front of the knight with its current offset at 0, 0, 0, like this:
Image

I still don't exactly know what axis is up/down, left/right and front/back yet since I haven't really spawned stuff in 3D space that much yet, but I am glad to see it spawn at all.
Just out of curiosity: How are planning to keey your brightmap always the same position as your actor?
I did a similar thing for fake shadows. I used the "A_warp" function with a pointer to the master - in this case your actor.
Worked pretty well for me.

EDIT: Just noticed that it's a static actor... Either way perhaps that information is helpful for other stuff you do.
Hmm. My original plan was to use A_Warp since this knight will eventually be animated and move around, as he's going to be the player character in a TC I'll be making soon. But I know very little about A_Warp currently want wanted to see results right away, so I just used code I already know from Brutal Doom's tech lamp as a quick fix.

However, eventually I am going to really need to completely know the ins and outs of A_Warp, as my grand scheme is to create players and enemies composed of multiple actors for the head, body, arms, legs, etc. to both make animation easier and also to allow you more realistic damage mechanics when shooting/slashing a limb or the head. Yep, so this knight can hack enemies' limbs off with his plasma sword.

So if you could maybe give me some pointers towards A_Warp, first to spawn this brightmap then maybe so I can go further with what I set out to do, that would be highly appreciated.

Edit: It wasn't the coordinates being off at all, it was me forgetting to change the scale to 0.3 like the parent. 0, 0, 0 is perfectly fine, now the knight's eyes are in the proper place.
User avatar
hg82
Posts: 13
Joined: Thu Mar 22, 2018 11:40 am

Re: A_SpawnItemEx for software brightmaps

Post by hg82 »

Sorry for not replying...
I've been on a job the last 5 days.
I'll get back to it later. Just give me another day then I'll have the time to look into it and post it here.

EDIT: I replied in your other post: viewtopic.php?f=122&t=60106
Post Reply

Return to “Scripting”