Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
Page 2 of 2 1 2
#4342410 - 03/06/17 07:29 PM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Apr 2002
Posts: 12,497
MrJelly Offline
Veteran
MrJelly  Offline
Veteran

Joined: Apr 2002
Posts: 12,497
Montagnac, L'Herault, France
Ralf's version with a long line shortened for this post:
Code
if (pTarget->Type->Smoke)
{
	if (dist < 1 MILES || dist < 2 MILES && pTarget->Type->SmokeOffsetX > 6  || dist < 4 MILES && (pTarget->Type->SmokeOffsetX > 30 || pTarget->Type->SmokeOffsetX == 10)) 
	{
		if (!(pTarget->Status & TAR_DESTROYED))
		{
			if (!(pTarget->Type->TargetType & TAR_TYPE_MGO)) 
			{
				if (smoke_counter%17==0)
				{
					smoke_counter = 0;
					start_size = 1.0f * ((pTarget->Type->SmokeOffsetX + 1)>>1);
					create_smoke(SPT_SMOKE0, pTarget->X, pTarget->Y, pTarget->Z + pTarget->Type->SmokeOffsetZ + (pTarget->Type->SmokeOffsetX<<4).......
					if (pTarget->Type->SmokeOffsetX > 10)
					{
						create_fire(pTarget->X, pTarget->Y, pTarget->Z, start_size);
					}
					smoke_counter ++;
				}
			}
		}
	}
}


The long line begins "create_smoke(SPT_SMOKE0," so in this code he is setting the smoke sprite, and therefore the colour was fixed.
In full it reads

create_smoke(SPT_SMOKE0, pTarget->X, pTarget->Y, pTarget->Z + pTarget->Type->SmokeOffsetZ + (pTarget->Type->SmokeOffsetX<<4), start_size, 0.8f, 0.001f * (pTarget->Type->SmokeOffsetX), -0.01f/(pTarget->Type->SmokeOffsetX), ((pTarget->Type->SmokeOffsetX + 1)>>1), 0, FALSE);

My problem with this code is that he is using SmokeOffsetX and SmokeOffsetZ values to create effects and losing their basic purpose for positioning the smoke.
I will find a way of creating fire independently of these values. My goal was to have a factory with a chimney which has smoke coming out smile


Fly EAW online at GameRanger: GameRanger Site

FaceBook Pages
UAW 160 downloads
EAW Club

Mark Twain: I am quite sure now that often, very often, in matters concerning religion and politics a man's reasoning powers are not above the monkey's.

I am now of an age at which I no longer need to suffer fools gladly
Inline advert (2nd and 3rd post)

#4342449 - 03/06/17 10:41 PM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Aug 2000
Posts: 7,427
Moggy Offline
EAW Old Timer and Bodger
Moggy  Offline
EAW Old Timer and Bodger
Hotshot

Joined: Aug 2000
Posts: 7,427
A slit trench at RAF Gravesend
It is possible with Ralf's original to have either white, grey, or black smoke

In tmodXX.dat:

Quote

1. smoke > 0 (8 = grey smoke, 11 = black smoke, 14 = white smoke)


I agree it would be best to use the smokeoffset values for their original purpose to be able to exactly position the smoke.

#4342508 - 03/07/17 07:55 AM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Apr 2002
Posts: 12,497
MrJelly Offline
Veteran
MrJelly  Offline
Veteran

Joined: Apr 2002
Posts: 12,497
Montagnac, L'Herault, France
Out of the sprite table we have this:

SPT_SMOKE0, // 8 grey smoke
SPT_SMOKE0A, // 9 grey smoke, alpha masked
SPT_TRAIL0, //10 grey smoke trail
SPT_SMOKE1, //11 black smoke
SPT_SMOKE1A, //12 black smoke, alpha masked
SPT_TRAIL1, //13 black smoke trail
SPT_SMOKE2, //14 white smoke
SPT_SMOKE2A, //15 white smoke, alpha masked

In his code Ralf specified "SPT_SMOKE0" which is 8 and grey smoke.
You can also see the "SPT_SMOKE1" and "SPT_SMOKE2" for black and white smoke, 11 and 14 respectively.
I do not think that the "Smoke" setting in the TModXYZ.dat file is the sprite number, but I will check further smile


Fly EAW online at GameRanger: GameRanger Site

FaceBook Pages
UAW 160 downloads
EAW Club

Mark Twain: I am quite sure now that often, very often, in matters concerning religion and politics a man's reasoning powers are not above the monkey's.

I am now of an age at which I no longer need to suffer fools gladly
#4342515 - 03/07/17 08:49 AM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Apr 2002
Posts: 12,497
MrJelly Offline
Veteran
MrJelly  Offline
Veteran

Joined: Apr 2002
Posts: 12,497
Montagnac, L'Herault, France
I have related the fire to the "Smoke" value, which also affects the size of the smoke.
Above 50 there is fire
The screenies are for 50, 51 and the max of 255
I could include a random factor to produce sprite values of 8, 11 or 14 to vary the smoke colour.



Attached Files 004.jpg005.jpg006.jpg

Fly EAW online at GameRanger: GameRanger Site

FaceBook Pages
UAW 160 downloads
EAW Club

Mark Twain: I am quite sure now that often, very often, in matters concerning religion and politics a man's reasoning powers are not above the monkey's.

I am now of an age at which I no longer need to suffer fools gladly
#4342519 - 03/07/17 10:28 AM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Apr 2002
Posts: 12,497
MrJelly Offline
Veteran
MrJelly  Offline
Veteran

Joined: Apr 2002
Posts: 12,497
Montagnac, L'Herault, France
My new code
Code
if (pTarget->Type->Smoke)
{
	smoke_sprite = 14;   // white 
	if (pTarget->Type->Smoke > 17)  smoke_sprite = 8; // grey
	if (pTarget->Type->Smoke > 33)  smoke_sprite = 11;  //black
	if (pTarget->Type->Smoke > 50)  smoke_sprite = 8+ 3*(get_random()%3);  // mixed, with fire
						
		if (!(pTarget->Status & TAR_DESTROYED))
		{
			if (!(pTarget->Type->TargetType & TAR_TYPE_MGO)) 
			{						
				if (smoke_counter%17==0)
				{
					smoke_counter = 0;
					start_size = 2; 
					create_smoke(smoke_sprite, pTarget->X, pTarget->Y, pTarget->Z + pTarget->Type->SmokeOffsetZ, start_size, 0.8f, 0.001f * (pTarget->Type->Smoke), -0.01f/(pTarget->Type->Smoke), ((pTarget->Type->Smoke + 1)>>1), 0, FALSE);
					
					if (pTarget->Type->Smoke > 50) 											
					create_fire(pTarget->X, pTarget->Y, pTarget->Z, pTarget->Type->Smoke);	
				}
				smoke_counter ++;
			}
		}				
}

It uses the smoke value to determine the colour
It starts with white smoke, but if it is bigger than 17 it uses grey smoke. Then if it is bigger than 33 it uses black smoke.
If it is bigger than 50, it uses mixed smoke, and this condition also generates the fire.

The values in the four pics were 17, 20, 35 and 51

Attached Files 007.jpg008.jpg009.jpg0099.jpg
Last edited by MrJelly; 03/07/17 10:37 AM. Reason: Pics added

Fly EAW online at GameRanger: GameRanger Site

FaceBook Pages
UAW 160 downloads
EAW Club

Mark Twain: I am quite sure now that often, very often, in matters concerning religion and politics a man's reasoning powers are not above the monkey's.

I am now of an age at which I no longer need to suffer fools gladly
#4342520 - 03/07/17 10:59 AM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Apr 2002
Posts: 12,497
MrJelly Offline
Veteran
MrJelly  Offline
Veteran

Joined: Apr 2002
Posts: 12,497
Montagnac, L'Herault, France
.... and Ralf was mistaken if he believed that the smoke value (his 8, 11 or 14) related to the sprite number and hence the colour frown


Fly EAW online at GameRanger: GameRanger Site

FaceBook Pages
UAW 160 downloads
EAW Club

Mark Twain: I am quite sure now that often, very often, in matters concerning religion and politics a man's reasoning powers are not above the monkey's.

I am now of an age at which I no longer need to suffer fools gladly
#4342526 - 03/07/17 12:08 PM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Apr 2002
Posts: 12,497
MrJelly Offline
Veteran
MrJelly  Offline
Veteran

Joined: Apr 2002
Posts: 12,497
Montagnac, L'Herault, France
What I have been working on for me is the railway rendering code.
The old "train32.ter" is a 256*256 picture and the exe was programmed to use the top 256 x 32 area in order to render the track.
All sorts of things are involved, but I have an axe which reads a file for a factor (f = 1 to 8) which applies to the current section being drawn.
It now reads the top 256 x (32 x f) so it can read 256 x 32, or 256 x 64, or .............256 x 256 using the whole picture.

The files I have been working with are a dummy blank 256x256 "train32.ter" file which serves as a base for a corresponding "train32.BMP" file

The screenie is one where the factor is 8. The train is rendered in the middle, and the whole width is shown.
The other pic is the "train32.BMP" converted to JPG for posting.

Where I am heading is to have wider roads for vehicle convoys, the trains are fine smile

Attached Files 001.jpg000.jpg

Fly EAW online at GameRanger: GameRanger Site

FaceBook Pages
UAW 160 downloads
EAW Club

Mark Twain: I am quite sure now that often, very often, in matters concerning religion and politics a man's reasoning powers are not above the monkey's.

I am now of an age at which I no longer need to suffer fools gladly
#4342536 - 03/07/17 12:57 PM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Apr 2002
Posts: 12,497
MrJelly Offline
Veteran
MrJelly  Offline
Veteran

Joined: Apr 2002
Posts: 12,497
Montagnac, L'Herault, France
The factor file "TrainSet.mpf" reads like this:

8
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1


Sections with a flag exactly divisible by 5 are rendered, so the values correspond to section flags of 00, 05, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, and 95.
The flag is a two digit value so 95 is the last one exactly divisible by 5
The section in the screenshot was flagged as 0, so the first value (8) was used..

That combination of a dummy ter/tpc file and the real "BMP" file is wonderful- it makes editing so easy smile


Fly EAW online at GameRanger: GameRanger Site

FaceBook Pages
UAW 160 downloads
EAW Club

Mark Twain: I am quite sure now that often, very often, in matters concerning religion and politics a man's reasoning powers are not above the monkey's.

I am now of an age at which I no longer need to suffer fools gladly
#4342542 - 03/07/17 01:35 PM Re: More 160 Dunkirk [Re: Moggy]  
Joined: Apr 2002
Posts: 12,497
MrJelly Offline
Veteran
MrJelly  Offline
Veteran

Joined: Apr 2002
Posts: 12,497
Montagnac, L'Herault, France
Here is a quick shot with a hastily made road BMP graphic and factor = 2 wink

Attached Files 000.jpg

Fly EAW online at GameRanger: GameRanger Site

FaceBook Pages
UAW 160 downloads
EAW Club

Mark Twain: I am quite sure now that often, very often, in matters concerning religion and politics a man's reasoning powers are not above the monkey's.

I am now of an age at which I no longer need to suffer fools gladly
Page 2 of 2 1 2

Moderated by  RacerGT 

Quick Search
Recent Articles
Support SimHQ

If you shop on Amazon use this Amazon link to support SimHQ
.
Social


Recent Topics
Carnival Cruise Ship Fire....... Again
by F4UDash4. 03/26/24 05:58 PM
Baltimore Bridge Collapse
by F4UDash4. 03/26/24 05:51 PM
The Oldest WWII Veterans
by F4UDash4. 03/24/24 09:21 PM
They got fired after this.
by Wigean. 03/20/24 08:19 PM
Grown ups joke time
by NoFlyBoy. 03/18/24 10:34 PM
Anyone Heard from Nimits?
by F4UDash4. 03/18/24 10:01 PM
RIP Gemini/Apollo astronaut Tom Stafford
by semmern. 03/18/24 02:14 PM
10 years after 3/8/2014
by NoFlyBoy. 03/17/24 10:25 AM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0