Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Surface Face Flags problem.
Surface Face Flags problem.
2004-03-10, 3:44 AM #1
Hi!
I have a problem. I have a little Motion Blur Mod. As you know, 16-bit + 0x2 face flag on non adjoins result in a semi-HOM. Now, Problem when switching it off. The surfaces that started off with the 0x2 flags get cleared, and all windows aren't windows anymore...
Code:
# Motion Blur
#
# By Edward
symbols

message		startup
message		activated

int		i=0		local

surface		z		local

surface		face0		local
surface		face1		local
surface		face2		local
surface		face3		local
...
surface		face93		local
surface		face94		local
surface		face95		local
surface		face96		local
surface		face97		local
surface		face98		local
surface		face99		local
surface		face100		local

int		f=0		local

end
#
code
startup:
	for(f=0; f<=100; f=f+1)
		face0[f]==-1;
return;
activated:
	jkStringClear();
	jkStringConcatPlayerName(GetSourceRef());
	jkStringConcatAsciiString(" has turned Motion Blur ");
	if(i==0)
	{
		f=0;
		for(z=0; z<=GetSurfaceCount(); z=z+1)
		{
			if(GetFaceType(z) & 0x2) { face0[f]=z; f=f+1; }
			Setfacetype(z,0x2);
		}
		i=1;
		jkStringConcatAsciiString("ON!");
	}
	else
	{
		for(z=0; z<=GetSurfaceCount(); z=z+1)
		{
			for(f=0; f<=100; f=f+1)
			{
				if(face0[f]!=z) Clearfacetype(z,0x2);
			}
		}
		i=0;
		jkStringConcatAsciiString("OFF!");
	}
	jkStringOutput(-3, -1);
	jkStringClear();
return;
end

How should a go to 1, storing which are windows and which aren't and 2, restoring which were windows and which weren't?

[This message has been edited by Edward (edited March 10, 2004).]
Edward's Cognative Hazards
2004-03-10, 8:45 AM #2
One of the tools in the GBK Tools does this exact thing . . . unfortuanly I dont have access to that cog at the moment... So Ill just have to write a new one.


Code:
# 03/2004 gbk
Flags=0x240
Symbols
	Message Startup
	Message Activated

	Int I=0;
	Int Mode=0;
End
Code
Startup:
	# First things first...
	# Loop though all the surfs and pull off any 0x1 face flags
	For(I=0;I<=GetSurfaceCount();I=I+1)
		If(GetFaceType(I) && 0x1)
			ClearFaceType(I, 0x1);
Stop;

Activated:
	JKStringClear();
	JKStringConcatPlayerName(GetSourceRef());
	JKStringConcatAsciiString(" Has Turned Motion Blur ");

	If(!Mode) # If off....
	{
		Mode=1;
		For(I=0;I<=GetSurfaceCount();I=I+1)
		{
			If(GetFaceType(I) && 0x2)
				SetFaceType(I, 0x1); # Set 0x1 if window
			Else
				SetFaceType(I, 0x2);
		}
	JKStringConcatAsciiString("Off!");
	}

	Else
	{
		Mode=0;
		For(I=0;I<=GetSurfaceCount();I=I+1)
		{
			If(GetFaceType(I) && 0x1)
				ClearFaceType(I, 0x1); # Remove 0x1 if window.
			Else
				ClearFaceType(I, 0x2);
		}
	JKStringConcatAsciiString("On!");
	}
	JKStringOutput(-3, -1);
Stop;
End


I mimicked your print strings. . . . and thats about it.

You problem was simple - you were trying to store the values of 0x2 surfs, and were only able to allot 100 of them. Most levels have far, far more than 100 surfaces, so the cog would quickly get overrun.


My cog simply attaches the 0x1 face flag if the surf is a window, and then checks for said flag when its time to turn the effect off. Fairly simple.


Unfortunatly, I am not the cogger I once was . . . I did all that from scratch and from memory, so theres no telling if itll actully work; but you can get the basic idea of what you need to do.


Credit me. [http://forums.massassi.net/html/biggrin.gif]

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-03-10, 10:12 AM #3
Thank you, that helped. I didn't use your COG, but I took the essentials (Set/Clear/GetFaceFlags(z,0x10), yes I chose a 10. Just incase of future problems...). But you have been credited as:
Quote:
<font face="Verdana, Arial" size="2">And I quote
# With the help of GBK
</font>


/Edward
Edward's Cognative Hazards
2004-03-11, 7:18 AM #4
Ok. Just be sure to add the cog flag at the top, otherwise the cog will affect all players in MP....

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-03-11, 10:20 PM #5
Now this was wierd... In custom levels, when I turn off the Motion Blur, the surfaces that were suposed to be translucent, don't stay translucent. the 0x10 face flag doesn't seem to get stored. Should I try a 0x40000000 surface flag?

/Edward
Edward's Cognative Hazards
2004-03-12, 6:18 AM #6
Yeah, any type of flag that doesnt have any effect.. Thats why I used the 0x1 face flag.

------------------
The future is here, and all bets are off.

[This message has been edited by GBK (edited March 12, 2004).]
And when the moment is right, I'm gonna fly a kite.
2004-03-12, 9:21 AM #7
HA! Just realised what my problem was. In startup, I had copied the off code exactly. So, all faces with no 0x10, were cleared of translucency. DUH!

But, now there are new problems... There are those adjoins that MUSTN'T be translucent for certain effects to work. E.G. slashable grates. How do I tell if the face is an adjoin and then leave the face flags alone if it is?

/Edward
Edward's Cognative Hazards
2004-03-12, 10:58 AM #8
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Edward:
...How do I tell if the face is an adjoin and then leave the face flags alone if it is?</font>


Code:
If(GetAdjoinFlags && 0x80)
{
//Do something...
}
Else
{
//Do something else...
}


The 0x80 adjoin flag is given to all adjoins at startup, so if you find that flag on a surface, chances are its an adjoin.


Having said that, I would suggest *not* skipping adjoins. Doing so would ruin the motion blur effect.

------------------
The future is here, and all bets are off.
And when the moment is right, I'm gonna fly a kite.
2004-03-19, 8:07 PM #9
Wait... what? Motion blur? Using hom? What?

------------------
"I was driving along listening to the radio, when Judas Priest comes on. It was 'You've got another thing coming.' All of a sudden, I enter 'VICE CITY RAMAGE MODE' and nearly ran some guy over"
- ]-[ellequin
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2004-03-19, 10:31 PM #10
Quote:
<font face="Verdana, Arial" size="2">Originally posted by jEDIkIRBY:
Wait... what? Motion blur? Using hom? What?

</font>


Didn't you know? Using the 0x2 face flag on a surface that AIN'T an adjoin will cause a semi-HOM. But only in 16-bit. You know HOM, things aren't redrawn. Well, semi-Hom will cause things to not redraw immediately, and will fade away. 50% of the image will change each frame. Interesting discovery, eh?

/Edward
Edward's Cognative Hazards
2004-03-20, 8:00 AM #11
You think using this idea, maybe someone could be able to make a new force speed cog that has a trail (afterimage) behind the player like JO has?

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.

↑ Up to the top!