www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tomb Raider Next Generation Level Editor

Reply
 
Thread Tools
Old 20-01-17, 18:30   #171
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 1,991
Default

How did you compute slow color change with layers?

I mean, for example

RGBstart= 100/25/59 = $64/$19/$3B = $64193B = 6560059
RGBmiddle should be = 50/12/29 =$32/$0C/$1D = $320C1D = 3279901
RGBstop= 0/0/0

But
6560059 / 2 = 3280029 = $320C9D = $32/$0C/$9D = 50/12/157.

Edit:
I checked the trigger with the log, using "10 seconds from 0/0/255 to 255/0/0".
This is what I got:

Code:
Frame      Field      Color (calculated manually in Windows calculator)
81	255		0 0 255
82	254		0 0 254


376	16384004	250 0 4
377	16449539	251 0 3
378	16515074	252 0 2
379	16580609	253 0 1
380	16646144	254 0 0
381	16711680	255 0 0
Which means you were able to split the big decimal number into three little decimal numbers, to control the sequence.
How did you do that?


--------
EDIT:
One more thing. Colors from ColorRGB ( Get (enumGET.COLOR_RGB, ItemIndex, 0); ) works in Blue-Green-Red way...
I mean 59/25/100 = $3B/$19/$64 = $3B1964 = 6560059

Last edited by AkyV; 21-01-17 at 12:56.
AkyV is online now   Reply With Quote
Old 21-01-17, 22:15   #172
Paolone
Explorer
 
Join Date: Apr 2007
Posts: 655
Default

Quote:
Originally Posted by AkyV View Post

Which means you were able to split the big decimal number into three little decimal numbers, to control the sequence.
How did you do that?
It's for matters like this that it exist also the "float" numeric type.
A float number could have a decimal point.
So you can, in a progressive action, decide to increase a number only by 0.01 (for instance) for game cycle, in this way the integer part will be increased very slowly.
If you see, in the variables of progressive action you have also the chance to see the fields like "float" in VetArgFloat[] array.
In this way you can set first three value as "current rgb value" for red, green, blue and other three values like "increments" for each value.
for instance:
Code:
	StrProgressiveAction *pAction;
	BYTE Red, Green, Blue;

	// set gradient of start color:
	pAction->VetArgFloat[0]= 255.0f; // start red
	pAction->VetArgFloat[1]= 128.0f;  // start green
	pAction->VetArgFloat[2]= 0.0f;  // start blue
	// set increments to change each gradient
	pAction->VetArgFloat[3] = -0.01f;  // inc for red
	pAction->VetArgFloat[4] = -0.005f; // inc for green
	pAction->VetArgFloat[5] = 0.1f;  // inc for blue

	// then, while the progressive action is running we'll change the current color using the inrements:
	pAction->VetArgFloat[0] += pAction->VetArgFloat[3];
	pAction->VetArgFloat[1] += pAction->VetArgFloat[4];
	pAction->VetArgFloat[2] += pAction->VetArgFloat[5];

	// when you need to use current color, we'll have to convert the float values to "int" or "byte"
	// but this happens simply copying the float value in some int or byte variable
	Red = (BYTE) pAction->VetArgFloat[0];
	Green = (BYTE) pAction->VetArgFloat[1];
	Blue = (BYTE) pAction->VetArgFloat[2];
Quote:
One more thing. Colors from ColorRGB ( Get (enumGET.COLOR_RGB, ItemIndex, 0); ) works in Blue-Green-Red way...
I mean 59/25/100 = $3B/$19/$64 = $3B1964 = 6560059
It's true, that was a lapsus that I discovered only once did a lot of commands using that rgb format, so I let in that way, and then I used a little conversion, in run-time, to fix that weird sorting.
Paolone is offline   Reply With Quote
Old Yesterday, 00:55   #173
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 1,991
Default

Quote:
Originally Posted by Paolone View Post
In this way you can set first three value as "current rgb value" for red, green, blue and other three values like "increments" for each value.
for instance:
Thank you, but this explanation is not enough.
I mean, it is okay, only if ColorRGB is a "mine" script command, but it is not. Not "my parameters" or "my customize". If I refer to a ColorRGB, then I can refer to a single number like 16711680, not 255/0/0. Or one of the callbacks/functions is useable to call/convert a trng.dll (not dynamical) script command value in that "three arguments" way?
(Naturally I'd like to have a similar procedure in "mine" login, that is why I say that.)

I mean, even if I do that R/G/B progressive action, then I need a conversion to turn that 16711680-like number into a 255/0/0-like number, then, after the first frame (like 254/1/1 or something) I need another conversion into a 16646144-like number. And this is what I need to repeat till the end of the action.
I mean, color fields have a 16711680-like number, but ColorRGB has 255/0/0-like numbers. It is not a problem, if I refer directly to a ColorRGB with Get (enumGET.COLOR_RGB, ItemIndex, 0), the conversion (though, in BGR mode) will be done automatically. But in an action like this I have no other ColorRGB than the first and the last one, inner color values (254/1/1 and such) will be calculated only inside the progressive action.

So, after all, the question is now how to convert 16711680 to 255/0/0. and how to convert 255/0/0 to 16711680?

Like F291. That turns 255/0/0 to 16711680, but only in Current Value. Naturally I wouldn't t like to use ngle numerical variables now, plus, the conversion should work even in the other way.

Code:
	// when you need to use current color, we'll have to convert the float values to "int" or "byte"
	// but this happens simply copying the float value in some int or byte variable
	Red = (BYTE) pAction->VetArgFloat[0];
	Green = (BYTE) pAction->VetArgFloat[1];
	Blue = (BYTE) pAction->VetArgFloat[2];
Oh, wait, you tell here those three rows are enough for a 255/0/0 to 16711680 conversion? I try it right away.
However, it is still not totally clear. I mean, how the engine will know that Red variable is red color of a color feature (like layer1 color or whatever else), Green is green, Blue is blue?
For example, Trng.pGlobTomb4->pDatiVariabili->ColoreLayer1 is for layer 1, must be one "int", not three "bytes" (or "ints").

Code:
	// set gradient of start color:
	pAction->VetArgFloat[0]= 255.0f; // start red
	pAction->VetArgFloat[1]= 128.0f;  // start green
	pAction->VetArgFloat[2]= 0.0f;  // start blue
Besides, I need these starting values from the actual value of the feature. That 255.0f is defined by me, not coming from a feature variable.

And naturally at the end of the action I need a reference to a ColorRGB, "if VetArgFloat[0] <= red of ColorRGB then AXN_FREE".

(Note: once I used a division: "X / 1.2" in a code, not using 1.2f. Does it matter? I mean, the code worked succesfully without that "f". X was not a custom variable, but a reference to a ngle memory variable: *Trng.pGlobTomb4->pVetCodeMemory[9].pShort / 1.2, the dash speed.)

Quote:
It's true, that was a lapsus that I discovered only once did a lot of commands using that rgb format, so I let in that way, and then I used a little conversion, in run-time, to fix that weird sorting.
I don't have that conversion, so I need to tell the level builder to type the number in those ColorRGB commands in Blue-Green-Red way.
So this is the second question. I mean, how to convert ColorRGB command values in the proper (RGB) way?

-----------------
ELSE:
SDK2 tutorial is too much for me for the time being, but I am curious, so I had a look at it.
I was a bit surprised because I found functions I couldn't find in the Function collection, like cbProc... and DrawSprite2D.

Last edited by AkyV; Today at 10:28.
AkyV is online now   Reply With Quote
Old Today, 00:55   #174
Delta
Historian
 
Delta's Avatar
 
Join Date: Jul 2007
Location: Italy
Posts: 263
Default

I'd like to have more control on the menus, is it possible to make a trigger that opens/closes Save, Load or Options menu without stop the game (like in the title)?
And how can i stop the game with another trigger like you did for the show text trigger (waiting for escape)?

Last edited by Delta; Today at 09:51.
Delta is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

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



All times are GMT. The time now is 10:35.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.