// add string to the map screen message list void AddStringToMapScreenMessageList( STR16 pString, UINT16 usColor, UINT32 uiFont, BOOLEAN fStartOfNewString, UINT8 ubPriority ) { UINT8 ubSlotIndex = 0; ScrollStringStPtr pStringSt = NULL; pStringSt = MemAlloc(sizeof(ScrollStringSt)); SetString(pStringSt, pString); SetStringColor(pStringSt, usColor); pStringSt->uiFont = uiFont; pStringSt->fBeginningOfNewString = fStartOfNewString; pStringSt->uiFlags = ubPriority; pStringSt->iVideoOverlay = -1; // next/previous are not used, it's strictly a wraparound queue SetStringNext(pStringSt, NULL); SetStringPrev(pStringSt, NULL); // Figure out which queue slot index we're going to use to store this // If queue isn't full, this is easy, if is is full, we'll re-use the oldest slot // Must always keep the wraparound in mind, although this is easy enough with a static, fixed-size queue. // always store the new message at the END index // check if slot is being used, if so, clear it up if( gMapScreenMessageList[ gubEndOfMapScreenMessageList ] != NULL ) { MemFree( gMapScreenMessageList[ gubEndOfMapScreenMessageList ]->pString16 ); MemFree( gMapScreenMessageList[ gubEndOfMapScreenMessageList ] ); } // store the new message there gMapScreenMessageList[ gubEndOfMapScreenMessageList ] = pStringSt; // increment the end gubEndOfMapScreenMessageList = ( gubEndOfMapScreenMessageList + 1 ) % 256; // if queue is full, end will now match the start if ( gubEndOfMapScreenMessageList == gubStartOfMapScreenMessageList ) { // if that's so, increment the start gubStartOfMapScreenMessageList = ( gubStartOfMapScreenMessageList + 1 ) % 256; } }
CTWScriptEdit::CTWScriptEdit() { m_chComment = 1; m_bCaseSensitive = FALSE; m_bChangeCase = TRUE; SetStringQuotes(L"\""); SetKeywordColor(RGB(0,0,255), FALSE); SetConstantColor(RGB(0,0,0), TRUE); SetCommentColor(RGB(0,128,0), FALSE); SetNumberColor(RGB(255,0,255), FALSE); SetStringColor(RGB(255,0,255), FALSE); m_bInForcedChange = FALSE; m_changeType = ctUndo; m_crOldSel.cpMin = m_crOldSel.cpMax = 0; }
ScrollStringStPtr AddString(STR16 pString, UINT16 usColor, UINT32 uiFont, BOOLEAN fStartOfNewString, UINT8 ubPriority ) { // add a new string to the list of strings ScrollStringStPtr pStringSt=NULL; pStringSt=MemAlloc(sizeof(ScrollStringSt)); SetString(pStringSt, pString); SetStringColor(pStringSt, usColor); pStringSt->uiFont = uiFont; pStringSt -> fBeginningOfNewString = fStartOfNewString; pStringSt -> uiFlags = ubPriority; SetStringNext(pStringSt, NULL); SetStringPrev(pStringSt, NULL); pStringSt->iVideoOverlay=-1; // now add string to map screen strings //AddStringToMapScreenMessageList(pString, usColor, uiFont, fStartOfNewString, ubPriority ); return (pStringSt); }