Page 1 of 1

MQtoSMTL Override Color Correction

Posted: Wed Nov 05, 2003 1:31 am
by MacroFiend
The color being passed to MQtoSMTL is (typically) an ARGB value ... SMTL uses standard RGB like a regular HTML doc, so we need to convert the ARGB value back to RGB before pushing it in to the the output line. I did this very simply right before the while loop. Also, to ensure that MQ doesn't simply default to white when there are other colors present and an override is passed, (like SuperWho which starts the string w/ a color change), I insert the override color before we start processing the input instead of only when there isn't a color set before it. Below is the code to be inserted to make these fixes.

Code: Select all

	int TotalColors=0; // this MUST be signed.[color=red]
	if (ColorOverride>0xFF000000) ColorOverride^=0xFF000000;

	// Always wrap the output in the default override color.
	pchar_out_string_position+=InsertColor(&out[pchar_out_string_position],ColorOverride);
	CurrentColor=ColorOverride;[/color]

	while(in[pchar_in_string_position]!=0 && pchar_out_string_position<maxlen)

Posted: Wed Nov 05, 2003 1:40 am
by MacroFiend
Sorry ... forgot to add this code removal in there. Since we are always applying the core coloring, we don't need to do it in the case section.

EQLib_Utilities.cpp - MQtoSMTL

Code: Select all

		default:
			out[pchar_out_string_position++]=in[pchar_in_string_position];
			break;

Posted: Wed Nov 05, 2003 8:39 am
by Lax
Color override was meant so that if the first character isn't a color, this would be the default color...

Posted: Wed Nov 05, 2003 9:11 am
by MacroFiend
And it would still work just that way if you define a color and don't close it until the end of the line. Since SMTL is a trimmed down version of HTML, you can nest <c > elements (which you already knew). If, for example, you used my code, /who concolor would show the whole line in the con color coded format while a regular /who would use the EQ defined /who color for everything except your explicitly defined brackets and special info (AFK, TRADER, GM, etc).

In any event, the XOr still needs to happen on the ARGB override value in order to get the real color from it. Otherwise, you end up with <c #FFxxxxxx> in the SMTL output which turns otherwise pretty colors all funky.

Posted: Wed Nov 05, 2003 9:13 am
by Lax
You're right about that, but I'll make it MQToSTML&=0xFFFFFF;

Posted: Thu Nov 06, 2003 12:44 am
by MacroFiend
Minor bug in your change to my code Lax. You are have ColorOverride&=0xFFFFFF to after you assign it to CurrentColor. Need to either AND them before the assignment or use CurrentColor&=0xFFFFFF.

Code: Select all

	ColorOverride&=0xFFFFFF;
	DWORD CurrentColor=ColorOverride;
or

Code: Select all

	DWORD CurrentColor=ColorOverride;
	CurrentColor&=0xFFFFFF;

Posted: Thu Nov 06, 2003 12:49 am
by Lax
Silly me.