[Decorate] Teleport glitter

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

[Decorate] Teleport glitter

Post by The Ultimate DooMer »

I was wondering about this: is it possible to recreate Heretic's teleport glitter in decorate without inheriting from it's states?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Not directly. The acceleration can't be recreated properly. Do you need more than 2 types?
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

I'm trying to make one that is solid, but one that disappears after a certain time.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

You can experiment with ThrustThingZ to accelerate the glitter. It won't look exactly the same but that doesn't probably matter, does it?
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

I was hoping to preserve the Heretic effect (which looked sorta 3D) but it looks like I'm gonna have to create a normal 2D sprite instead :/
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Operating System Version (Optional): Tumbleweed x64
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Post by Hirogen2 »

Well Heretic's one looks 3D because it uses like 3 or 4 glitters (=things) per teleporter, I would not see any problem with scripting that the four glitters rise asynchronically.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Actually, it doesn't. The generator just spawns the glitter at random positions:

Code: Select all

void A_SpawnTeleGlitter (AActor *actor)
{
	AActor *mo;
	fixed_t x = actor->x+((pr_teleg()&31)-16)*FRACUNIT;
	fixed_t y = actor->y+((pr_teleg()&31)-16)*FRACUNIT;

	mo = Spawn<ATeleGlitter1> (x, y,
		actor->Sector->floorplane.ZatPoint (actor->x, actor->y));
	mo->momz = FRACUNIT/4;
}
User avatar
Bio Hazard
Posts: 4019
Joined: Fri Aug 15, 2003 8:15 pm
Location: ferret ~/C/ZDL $
Contact:

Post by Bio Hazard »

Iyaa! That can be simplified!

Code: Select all

void A_SpawnTeleGlitter(AActor *actor){
	AActor *mo = Spawn<ATeleGlitter1>(
		(actor->x+((pr_teleg()&31)-16)*FRACUNIT),
		(actor->y+((pr_teleg()&31)-16)*FRACUNIT),
		actor->Sector->floorplane.ZatPoint(actor->x,actor->y)
	);
	mo->momz = FRACUNIT/4;
}
Saves sizeof(fixed_t)*2 bytes!
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

The original code doesn't create any stack variables. It holds both in a register - and is more readable. There's no need to killoughize this code to the point of unreadability. Compilers have optimizers for a good reason.

And what's the point in saving stack anyway?
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

I created a 2D column instead but at least I got the feature working.
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Operating System Version (Optional): Tumbleweed x64
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Post by Hirogen2 »

Bio Hazard wrote:Iyaa! That can be simplified!

Code: Select all

void A_SpawnTeleGlitter(AActor *actor){
	AActor *mo = Spawn<ATeleGlitter1>(
		(actor->x+((pr_teleg()&31)-16)*FRACUNIT),
		(actor->y+((pr_teleg()&31)-16)*FRACUNIT),
		actor->Sector->floorplane.ZatPoint(actor->x,actor->y)
	);
	mo->momz = FRACUNIT/4;
}
Saves sizeof(fixed_t)*2 bytes!
This can, I think, be crushed even more, of course sacrificing readabilitz:

Code: Select all

	Spawn<ATeleGlitter1>(
		(actor->x+((pr_teleg()&31)-16)*FRACUNIT),
		(actor->y+((pr_teleg()&31)-16)*FRACUNIT),
		actor->Sector->floorplane.ZatPoint(actor->x,actor->y)
	)->momz = FRACUNIT/4;
Saving even the 'mo' variable...
And what's the point in saving stack anyway?
Ask the Linux kernel people on why they try to enforce "4K stacks" instead of larger ones (8K).
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

But still saving no stack at all. The compiler needs the same amount of registers for all versions.
User avatar
Bio Hazard
Posts: 4019
Joined: Fri Aug 15, 2003 8:15 pm
Location: ferret ~/C/ZDL $
Contact:

Post by Bio Hazard »

Maybe it's just me but I find it more readable when everything is crushed. Less stuff to keep track of.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

I find it more readable when it is structured. Less stuff to keep track of at the same time!
User avatar
Doomguy0505
Posts: 625
Joined: Tue Mar 29, 2005 4:53 am
Contact:

Post by Doomguy0505 »

Why don't you use sprites instead
Locked

Return to “Editing (Archive)”