FireExtinguisher Generator Pitch

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Post Reply
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

FireExtinguisher Generator Pitch

Post by Cybernetic pig »

Why does the Extinguisher spray/particle generator not follow the player's view rotation on the z axis/pitch/up & down?

Code: Select all

// spew halon gas
		rot = Pawn(Owner).ViewRotation;
		loc = Vector(rot) * Owner.CollisionRadius;
		loc.Z += Owner.CollisionHeight * 0.9;
		loc += Owner.Location;
		gen = Spawn(class'ProjectileGenerator', None,, loc, rot);
		if (gen != None)
		{
			gen.ProjectileClass = class'HalonGas';
			gen.SetBase(Owner);
			gen.LifeSpan = 4;
			gen.ejectSpeed = 320;//300;
			gen.projectileLifeSpan = 1.5; //2.0;
			gen.frequency = 0.3; //0.13;   //CyberP: modded values
			gen.checkTime = 0.03; //0.06;
			gen.bAmbientSound = True;
			gen.DrawScale = 2.0;
			gen.AmbientSound = sound'SteamVent'; 
			gen.SoundVolume = 192;
			gen.SoundPitch = 32;
		}
Should be simple enough. I see no problem here.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: FireExtinguisher Generator Pitch

Post by Hanfling »

Sorry, took the chance to clean up the class a bit for legacy usage in RF yesterday but got caught by other things. However the rotation of the ProjectileGenerator is smagically updated (i guess by setting base in FireExtinguisher). However this seems to copy over the Rotation of the PlayerPawn and not the ViewRotation. I have not yet tested the code, added some other cleanups and comments, however see if it works, if not, the comments should give you a heads up whats happening there (and why this shit is in dire need for a rewrite from scratch). So any feedback is appreciated.

Code: Select all

//=============================================================================
// RevisionProjectileGenerator.
//
// Cybernetic pig: Why does the Extinguisher spray/particle generator
//                 not follow the player's view rotation on the z axis/pitch/up & down?
//
// General Note:   FireExtinguisher should be a Weapon and spawn the shit itself,
//                 so don't worry that much about this class as it gets rewritten anyway.
//                 The current form sucks in network anyway.
// 
// TODO
//  * Each part of code should have it's own ProjectileGenerator generator subclass 
//    with the right settings in defaultprops, so these don't need to get replicated,
//    which often fails and also this step cleans up code.
//    (although I have to admit that igniting yourself with the fire extinguisher in
//     network play is pretty much the best bug ever).
//  * Make the same move as in HX to make an own native Effects baseclass which extends Actor,
//    so it can be native, and i can use GetOptimizedRepList() to replicate the rotation
//    even if DrawType==DT_Sprite.
//  * Use or add an Unreal Timer event like SpeechTimer() and let C++ handle check
//    when it is called or if it's visible or soon to be visible.
//  * Use RenderIterator when possible (e.g. when it's just an effect)
//  * Use bNetTemporary projectiles. 
//=============================================================================
class RevisionProjectileGenerator extends Effects;

var() float Frequency;               // what's the chance of spewing an actor every checkTime seconds
var() float EjectSpeed;              // how fast do the actors get ejected
var() class<Actor> ProjectileClass;  // class to project
var() float ProjectileLifeSpan;      // how long each projectile lives
var() bool bTriggered;               // start by triggering?
var() float SpewTime;                // how long do I spew after I am triggered?
var() bool bRandomEject;             // random eject velocity vector
var() float CheckTime;               // how often should I spit out particles?
var() Sound SpawnSound;              // sound to play when spawned
var() float SpawnSoundRadius;        // radius of sound
var() bool bAmbientSound;            // play the ambient sound?
var() int NumPerSpawn;               // number of particles to spawn per puff
var() Name AttachTag;                // attach us to this actor
var() bool bSpewUnseen;              // spew stuff when players can't see us
var() float WaitTime;                // amount of time between bursts
var() bool bOnlyOnce;				         // fire projectiles one time only
var() bool bInitiallyOn;			       // if triggered, start on instead of off

var bool bSpewing;					         // am I spewing? REV HAN: Rep needed?
var bool bFrozen;					           // are we out of the player's sight?
var float Period;
var float Time;

// ----------------------------------------------------------------------------
// Replication.
// ----------------------------------------------------------------------------

replication
{
	// Server to client
	reliable if ( Role==ROLE_Authority )
		Frequency, EjectSpeed, ProjectileClass, ProjectileLifeSpan, bTriggered, SpewTime,
		bRandomEject, CheckTime, SpawnSound, SpawnSoundRadius, bAmbientSound, NumPerSpawn,
		AttachTag, bSpewUnseen, WaitTime, bOnlyOnce, bInitiallyOn;
}

// ----------------------------------------------------------------------------
// PostBeginPlay()
// ----------------------------------------------------------------------------

function PostBeginPlay() // Should probably be simulated.
{
	local Actor A;

	Super.PostBeginPlay();

	if ( bTriggered && !bInitiallyOn )
		bSpewing = False;

	// Attach us to the actor that was tagged
	if ( AttachTag != '' )
	{
		foreach AllActors( class'Actor', A, AttachTag )
		{
			if ( A!=None )
			{
				SetOwner(A);
				SetBase(A);
			}
		}
	}
}

// ----------------------------------------------------------------------------
// Trigger()
// ----------------------------------------------------------------------------

function Trigger(Actor Other, Pawn EventInstigator)
{
	Super.Trigger(Other, EventInstigator);

	// If we are spewing, turn us off.
	if ( bSpewing )
	{
		bSpewing = False;
		Period   = 0;
		Time     = 0;

		if ( bAmbientSound && AmbientSound!=None )
			SoundVolume = 0;
	}
	// Otherwise, turn us on.
	else if ( !bOnlyOnce )
	{
		bSpewing = True;
		Period   = 0;
		Time     = 0;

		if ( bAmbientSound && AmbientSound!=None )
			SoundVolume = 255;
	}
}

// ----------------------------------------------------------------------------
// Tick()
// ----------------------------------------------------------------------------

simulated function Tick( float DeltaTime )
{
	local int    i, j;
	local int    Count;
	local Actor  Spawnee;
	local float  Speed;
	local float  TimeVal;
	local Vector Dir;

	Super.Tick(DeltaTime);

	// If the owner that I'm attached to is dead, kill me. - REV_HAN: Sucks.
	if ( AttachTag!='' && Owner==None )
		Destroy();

	// Update timers
	Time   += DeltaTime;
	Period += DeltaTime;

	// REV HAN: Both should be merged. (And i would really like to have a tenary operator).
	// If we're spewing and it's time to stop, stop.
	if ( bSpewing )
	{
		if ( SpewTime>0 )
		{
			if ( Period>=SpewTime )
			{
				Period   = 0;
				Time     = 0;
				bSpewing = False;
			}
		}
		else
			Period = 0;
	}
	// If we're not spewing and it's time to start, start.
	else if ( !bOnlyOnce )
	{
		if ( WaitTime>0 )
		{
			if ( Period>=WaitTime )
			{
				Period   = 0;
				Time     = 0;
				bSpewing = True;
			}
		}
		else
			Period = 0;
	}

	// CNN - remove optimizaions to fix strange behavior of PlayerCanSeeMe()
/*
	// Should we freeze the spewage?
	if ( bSpewUnseen )
		bFrozen = False;
	else if (PlayerCanSeeMe())
		bFrozen = False;
	else
		bFrozen = True;
*/

	// Are we spewing? Is it not time to start spewing?
	if ( !bSpewing || bFrozen || Time<CheckTime )
		return;

	// How many projectiles must we spew?
	if (CheckTime > 0)
	{
		Count = int(Time/CheckTime);
		Time -= Count*CheckTime;
	}
	else
	{
		Count = 1;
		Time  = 0;
	}
	TimeVal = time;

	// Sanity check
	if (Count > 5)
		Count = 5;

	// If frequency < 1, make spewage random
	if ( FRand()<=Frequency )
	{
		// REV_HAN: This should probably be in projectiles startup code,
		//          although this seems to be problematic in network play.
		//          (see: http://www.oldunreal.com/cgi-bin/yabb2/YaBB.pl?num=1421911644)
		if ( SpawnSound!=None ) 
			PlaySound( SpawnSound, SLOT_Misc,,, SpawnSoundRadius );

	// Spawn an appropriate number of projectiles
	for ( i=0; i<Count*NumPerSpawn; i++ )  // (Number of spews for this tick)*(Number of spawns per spew)
	{
		// Wayyy down upon the Spawnee river...
		// REV_HAN: Basic problem for FireExinguishers:
		//  * Having player as base probably accounts for the magic rotation update.
		//    However, this seem to just updates the Rotation, and *NOT* the ViewRotation.
		//    Probably in previous versions of the game the PlayerPawn.Rotation.Pitch was changed
		//    (there were some lines hinting this, and player was Pitched for NM_ListenServer in convos too).
		Spawnee = Spawn( ProjectileClass, Owner );

		if (Spawnee != None)
		{
			if ( bRandomEject )
				Dir = VRand();
			// REV_HAN: Account for ViewRotation on pawns.
			else if ( Base!= None && Base.bIsPawn )
				Dir = Vector(Pawn(Base).ViewRotation);
			else
				Dir = Vector(Rotation);

			Speed = EjectSpeed;
			if ( bRandomEject )
				Speed *= FRand();

			Spawnee.SetRotation( Rotator(Dir) );
			Spawnee.Velocity     = Speed*Dir;
			Spawnee.Acceleration = Dir;
			Spawnee.SetLocation( Location + Spawnee.Velocity*TimeVal );

			if ( ProjectileLifeSpan>0 )
				Spawnee.LifeSpan = ProjectileLifeSpan;
			}
		}
	}
	TimeVal += CheckTime*Count*NumPerSpawn;
}

// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------

defaultproperties
{
	Frequency=1.000000
	EjectSpeed=300.000000
	ProjectileClass=Class'DeusEx.Fireball'
	checkTime=0.250000
	SpawnSoundRadius=1024.000000
	NumPerSpawn=1
	bInitiallyOn=True
	bSpewing=True
	bHidden=True
	bDirectional=True
	DrawType=DT_Sprite
	Texture=Texture'Engine.S_Inventory'
	CollisionRadius=40.000000
	CollisionHeight=40.000000
}

I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: FireExtinguisher Generator Pitch

Post by Cybernetic pig »

Hey, thanks. I'll let you know how it goes.

Also, what can you tell me about input types and key inputs in general? Seems mostly all handled natively, although there are instances of suitable hacky opportunities to add new functionality.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: FireExtinguisher Generator Pitch

Post by Hanfling »

Cybernetic pig wrote:Also, what can you tell me about input types and key inputs in general?
The whole input system plain sucks.

Mouse input is even worse.

Thats all.

In DeusEx even more then other legacy Unreal Engine 1 titles. In general UE1 on windows this is caused by shitty WinDrv package. For DeusEx things get even worse by even more shitty Window related input handling and probably shitty Ion changes to UnrealScript input handling. However, started slightly working on porting the ancient but reliable Linux SDLDrv to a plattform independent SDL2Drv. Primary motivation was that I don't need to work around WinDrv in KHG as it was quite different for 219 Builds (Like pretty much everything even compared to 224) which gets me always a black screen when not in GlideDrv fullscreen, the secondary motivation is to get the knowledge to start someday on a QtDrv, QtWindow and maybe even a QtEd, as UnrealEd is pretty much nothing more then a GUI with not much logic in there, which either uses the EditorEngines interface but for most stuff just passes text commands between EditorEngine and GUI. But this will be a very long way, but sadly nowaday an even more required way. However the SDL2Drv might turn out rather good regarding input and would probably be a real (intermediate) solution to the mouse input related problems and not just some hooking and hacking as seen in another laucher. However it'll lack most or all of the special outside windows. (e.g. Preferences Window or EditActor, etc.). But probaly it will at least have a Splash Screen and maybe a (limited) LogWindow. SDL is no Windowing toolkit, and trying to add Windows there is just wasted time better spent working on a QtDrv. But as this won't matter at all when your are just playing, and can still use the old WinDrv for developing (where the input problems are no big deal either).

For DeusEx specific plans is to replace Extension.InputExt with a RF class, as this just seems like some small input wrapper which should be easy to replace. Any further plans depend on having that done and getting some insight in messed up input shit.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: FireExtinguisher Generator Pitch

Post by Cybernetic pig »

Hanfling wrote: In DeusEx even more then other legacy Unreal Engine 1 titles. In general UE1 on windows this is caused by shitty WinDrv package. For DeusEx things get even worse by even more shitty Window related input handling and probably shitty Ion changes to UnrealScript input handling. However, started slightly working on porting the ancient but reliable Linux SDLDrv to a plattform independent SDL2Drv. Primary motivation was that I don't need to work around WinDrv in KHG as it was quite different for 219 Builds (Like pretty much everything even compared to 224) which gets me always a black screen when not in GlideDrv fullscreen, the secondary motivation is to get the knowledge to start someday on a QtDrv, QtWindow and maybe even a QtEd, as UnrealEd is pretty much nothing more then a GUI with not much logic in there, which either uses the EditorEngines interface but for most stuff just passes text commands between EditorEngine and GUI. But this will be a very long way, but sadly nowaday an even more required way. However the SDL2Drv might turn out rather good regarding input and would probably be a real (intermediate) solution to the mouse input related problems and not just some hooking and hacking as seen in another laucher. However it'll lack most or all of the special outside windows. (e.g. Preferences Window or EditActor, etc.). But probaly it will at least have a Splash Screen and maybe a (limited) LogWindow. SDL is no Windowing toolkit, and trying to add Windows there is just wasted time better spent working on a QtDrv. But as this won't matter at all when your are just playing, and can still use the old WinDrv for developing (where the input problems are no big deal either).
For DeusEx specific plans is to replace Extension.InputExt with a RF class, as this just seems like some small input wrapper which should be easy to replace. Any further plans depend on having that done and getting some insight in messed up input shit.
Too much engineer-speak for me to comprehend everything here.

Anyway, the extinguisher works great, thank you very much.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: FireExtinguisher Generator Pitch

Post by Hanfling »

Cybernetic pig wrote:Anyway, the extinguisher works great, thank you very much.
Thanks for testing. :)
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: FireExtinguisher Generator Pitch

Post by Hanfling »

Found some comments regarding input in headers:

Extension\Inc\ExtInput.h

Code: Select all

		UBOOL PreProcess(EInputKey iKey, EInputAction state, FLOAT delta=0.0) { return (TRUE); } // HACK HACK HACK!
		UBOOL Process(FOutputDevice &out, EInputKey iKey, EInputAction state, FLOAT delta=0.0);
		UBOOL Key(EInputKey iKey);  // MEGA-BOOGER!!
Extension\Inc\ExtRoot.h

Code: Select all

		virtual UBOOL HandleKeyboard(TCHAR key);  // MEGA-BOOGER
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
zirdukukko
UNATCO
Posts: 217
Joined: Wed Dec 06, 2023 7:42 am

Re: FireExtinguisher Generator Pitch

Post by zirdukukko »

We notion it really is a good idea to publish could anyone was initially having issues searching for however , My organization is a bit of dubious just have always been allowed to insert leaders together with contact regarding at this point. ufa1688
jubalhenry
UNATCO
Posts: 110
Joined: Wed Oct 11, 2023 1:19 pm

Re: FireExtinguisher Generator Pitch

Post by jubalhenry »

It is a fantastic write-up, Thank you regarding offering myself these records. Retain submitting. thegiftio
jubalhenry
UNATCO
Posts: 110
Joined: Wed Oct 11, 2023 1:19 pm

Re: FireExtinguisher Generator Pitch

Post by jubalhenry »

When i stunned while using the research people meant to makes unique post awesome. Superb pastime! TURKEY VISA FROM YEMEN
Holly
Thug
Posts: 12
Joined: Mon Feb 19, 2024 6:18 am

Re: FireExtinguisher Generator Pitch

Post by Holly »

Craving a flame-grilled burger? Look no further than theburgerskingmenu.com for all your Burger King cravings. With a mouthwatering selection of burgers, sides, and drinks, is your one-stop destination for satisfying your hunger with delicious fast food.
zirdukukko
UNATCO
Posts: 217
Joined: Wed Dec 06, 2023 7:42 am

Re: FireExtinguisher Generator Pitch

Post by zirdukukko »

Frequent goes to here i will discuss the obvious way to appreciate it on your attempt, which often is why Now i am viewing the internet site day-to-day, in search of completely new, useful facts. Quite a few, many thanks! 먹튀검증사이트
muzammilseo89540
UNATCO
Posts: 230
Joined: Tue Dec 19, 2023 7:35 am

Re: FireExtinguisher Generator Pitch

Post by muzammilseo89540 »

I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. forex robot
oggy12
UNATCO
Posts: 195
Joined: Mon Dec 18, 2023 10:48 am

Re: FireExtinguisher Generator Pitch

Post by oggy12 »

Thanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work. forex robot
muzammilseo89540
UNATCO
Posts: 230
Joined: Tue Dec 19, 2023 7:35 am

Re: FireExtinguisher Generator Pitch

Post by muzammilseo89540 »

Good artcile, but it would be better if in future you can share more about this subject. Keep posting. forex robot
Post Reply