Raised This Month: $ Target: $400
 0% 

Questions on "message_begin()"


Post New Thread Reply   
 
Thread Tools Display Modes
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-15-2020 , 10:09   Re: Questions on "message_begin()"
Reply With Quote #11

Quote:
ther approach will be constantly broadcasting this message on a "thinking forward".
After looking through the regamedll source code, noticed that this is how CS handles the smoke grenade. By doing the same, you may get rid of the bug.

Code:
void CGrenade::SG_Smoke()
{
	int iMaxSmokePuffs = 100;
	float flSmokeInterval;

	if (UTIL_PointContents(pev->origin) == CONTENTS_WATER)
	{
		UTIL_Bubbles(pev->origin - Vector(64, 64, 64), pev->origin + Vector(64, 64, 64), 100);
	}
	else
	{
		Vector origin, angle;
		real_t x_old, y_old, R_angle;

		UTIL_MakeVectors(pev->angles);

		origin = gpGlobals->v_forward * RANDOM_FLOAT(3, 8);

		flSmokeInterval = RANDOM_FLOAT(1.5f, 3.5f) * iMaxSmokePuffs;

		R_angle = m_angle / (180.00433335 / M_PI);

		x_old = Q_cos(real_t(R_angle));
		y_old = Q_sin(real_t(R_angle));

		angle.x = origin.x * x_old - origin.y * y_old;
		angle.y = origin.x * y_old + origin.y * x_old;

		m_angle = (m_angle + 30) % 360;

		PLAYBACK_EVENT_FULL(0, nullptr, m_usEvent, 0, pev->origin, m_vSmokeDetonate, angle.x, angle.y, flSmokeInterval, 4, m_bLightSmoke, 6);
	}

	if (m_SGSmoke <= 20)
	{
		pev->nextthink = gpGlobals->time + 1.0f;
		SetThink(&CGrenade::SG_Smoke);
		m_SGSmoke++;
	}
	else
	{
		pev->effects |= EF_NODRAW;

		if (TheBots)
		{
			TheBots->RemoveGrenade(this);
		}
		UTIL_Remove(this);
	}
}
https://github.com/s1lentq/ReGameDLL...enade.cpp#L480
__________________








CrazY. is offline
bobii
Junior Member
Join Date: Dec 2020
Old 12-19-2020 , 04:10   Re: Questions on "message_begin()"
Reply With Quote #12

Thank you CraZy for your comment. You are right only way to get around seems to be thinking forward. But I found it introduces other issues.

If you use "TE_SMOKE" message it seems to be working fine. The down side with that is whole smoke looks 2D and rotates with the player looking at it. It is some sort of a fake 3-D effect. This plugin works with "TE_SMOKE" https://forums.alliedmods.net/showthread.php?t=310350

"TE_FIREFIELD" message I am trying to use on the other hand looks pretty nice very much 3-D effect. The problem with TE_FIREFIELD if there is more than one smoke in the field of view only one of them gets properly visualized the others are displayed partially or not at all seems to be randomly decided by the client.

So the next question is: is it really TE_FIREFIELD causes this or could there be smth else?
I attach my modified code using Unreal Smoke as a base.
Attached Files
File Type: sma Get Plugin or Get Source (CloudSmoke.sma - 52 views - 10.2 KB)
bobii is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-19-2020 , 06:26   Re: Questions on "message_begin()"
Reply With Quote #13

I guess the smoke sprite is rotating to face the player because its type is set to VP_PARALLEL. I'm not sure but if you edit the sprite and set the type to ORIENTED it will stop rotating. To edit the sprite, use Sprite Explorer.
__________________









Last edited by CrazY.; 12-19-2020 at 06:27.
CrazY. is offline
bobii
Junior Member
Join Date: Dec 2020
Old 12-19-2020 , 09:18   Re: Questions on "message_begin()"
Reply With Quote #14

No that does not solve the problem. TE_SMOKE is like a line and TE_FIREFIELD is like a cube or a sphere. If you make the sprite ORIENTED it appears as a line with TE_SMOKE. That's why if you look at sprites in UnrealSmoke those are PARALLEL_ORIENTED.
bobii is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode