I'm not sure if this goes here, and I'm very new to this C++ thing. (Doesn't everyone say that as their first post in a forum?)
I have been attempting to read the colors of elements externally in C#. I have the basics of the element colors down: Element default colors, as well as support for PROP_HOT_GLOW.
I apologize for anything that sounds odd or doesn't make sense (And my lack of common sense), I am more tired than I have been in a very long time. I honestly can't think straight. It would be miraculous if someone comes up with an answer I can understand before my meds wear off (so I can sleep).
All I want to do is, given an element and the properties, determine the resulting color. (Assuming the "No Special Effects" box is ticked)
So I am wondering how to get element-specific coloring rules, such as how WOOD turns blue when it is cold, and how ACID changes color based on its LIFE property.
I could copy and convert the element-specific rules for every element over to C#, but that sounds like a lot of work. I could learn C++ (I do want to learn it, after all), but I can imagine that taking more effort than copying and converting to C#.
Is there a way to do it without code?
Is there a way to run C++ code through a C# program? Googling this shows I can make a wrapper for it, but I think I might need to know C++ to do this, and I don't understand how TPT's source works.
Do any of you have advice or ideas?
@F03K (View Post) The element specific coloring rules are controlled through it's graphics update function. Are you reading the code or the exe?
I'm reading the code. That's probably the problem. I need to be running the code, or interpreting it. I don't know how to do either. Sure, compiling is a piece of cake, but I don't know how I should access the element-specific coloring rules. I have minimal experience with C++.
For example, in ACID.cpp, it gives this:
//#TPT-Directive ElementHeader Element_ACID static int graphics(GRAPHICS_FUNC_ARGS)
int Element_ACID::graphics(GRAPHICS_FUNC_ARGS)
{
int s = cpart->life;
if (s>75) s = 75; //These two should not be here.
if (s<49) s = 49;
s = (s-49)*3;
if (s==0) s = 1;
*colr += s*4;
*colg += s*1;
*colb += s*2;
*pixel_mode |= PMODE_BLUR;
return 0;
}
That means the ACID element has its color also based on its LIFE value.
Externally, (Currently through C#), I need a way to get these sets of rules so my external program can determine the color output color based on the element and the properties I give it.
The easiest way is probably to do something with C++, but then I need to learn it. I'm planning on learning it anyways, but I am impatient and obstinate.
It would be very hard to do programmiticlly with C#. You should learn C++, it's similar to C# (it just has somethings that are diffrent and it's a bit more complex) and you don't need to know too much to change/do whatever you want with this code.