// Allows scrollable events on the screen while you play the game.
// Worthless Bums 2012.


// Updates the scrolling event log position based on current screen resolution.
function updateScrollingEventLogPosition ()
{//echo("updateScrollingEventLogPosition()");
	%x = 16;
	%y = getWord($Game::Resolution, 1) - getWord(partiallyOpaquePanel.extent, 1) + 24;
	partiallyOpaquePanel.setPosition(%x, %y);
}
// Update scrolling event extent based on resolution.
function updateScrollingEventLogExtent ()
{//echo("updateScrollingEventLogExtent()");
return;
	/*eventScroller.extent = (getWord($Game::Resolution, 0) / 2.5) SPC 70;
	eventLog.extent = (getWord($Game::Resolution, 0) / 2.5) SPC 700;*/
}
// Gets the last message in the log.
function getLastLogMessage ()
{//echo("getLastLogMessage()");
	return $chatLog[0];
}
// Gets the first message in the log.
function getFirstLogMessage ()
{//echo("getFirstLogMessage()");
	return $chatLog[$eventLogMaxMessages - 1];
}
// Updates the event text.
function updateEventText (%eventText)
{//echo("updateEventText()");
//return;		// Disabled for now!
	for (%i = $eventLogMaxMessages; %i > -1; %i--)					
	{
		$chatLog[%i] = $chatLog[%i - 1];
	}
	$chatLog[0] = %eventText;
	drawTextLog();
}
// Draws the event text.
function drawTextLog ()							// If so then this is function Steam_Marines+0x580dd !
{//echo("drawTextLog()");
	%messageLogString = "";
	for (%i = $eventLogMaxMessages; %i > -1; %i--)
	{
		%messageLogString = %messageLogString NL $chatLog[%i - 1];
	}
	eventLog.setText(%messageLogString);
	eventScroller.schedule(20, "scrollToBottom");
}
// Clears the event log. Useful when entering a new level.
function clearLog ()
{//echo("clearLog()");
	%maxLogEvents = 50;
	for (%i = %maxLogEvents; %i > -1; %i--)
	{
		$chatLog[%i] = "";					// The chat log holds up to five messages at once.
	}
	drawTextLog();
}