void EnterIMPBeginScreen( void ) { // reset all variables memset( pFullNameString, 0, sizeof( pFullNameString ) ); memset( pNickNameString, 0, sizeof( pNickNameString ) ); // if we are not restarting...then copy over name, set cursor and array positions if( iCurrentProfileMode != IMP__REGISTRY ) { wcscpy( pFullNameString, pFullName ); wcscpy( pNickNameString, pNickName ); uiFullNameCharacterPosition = wcslen( pFullNameString ); uiNickNameCharacterPosition = wcslen( pNickNameString ); uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); // set gender too bGenderFlag = fCharacterIsMale; } else { uiNickNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; uiFullNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; uiFullNameCharacterPosition = 0; uiNickNameCharacterPosition = 0; bGenderFlag = -1; } ubTextEnterMode =0; // draw name if any fNewCharInString = TRUE; // render the screen on entry RenderIMPBeginScreen( ); if( fFinishedCharGeneration ) { ubTextEnterMode = 5; } else { fFirstIMPAttribTime = TRUE; } // create mouse regions CreateIMPBeginScreenMouseRegions( ); // create buttons needed for begin screen CreateIMPBeginScreenButtons( ); return; }
//Kris: //This is a new function which duplicates the older "yellow info boxes" that //are common throughout the editor. This draws the yellow box with the indentation //look. void DrawEditorInfoBox( UINT16 *str, UINT32 uiFont, UINT16 x, UINT16 y, UINT16 w, UINT16 h ) { UINT16 usFillColorDark, usFillColorLight, usFillColorBack; UINT16 x2, y2; UINT16 usStrWidth; x2 = x + w; y2 = y + h; usFillColorDark = Get16BPPColor(FROMRGB(24, 61, 81)); usFillColorLight = Get16BPPColor(FROMRGB(136, 138, 135)); usFillColorBack = Get16BPPColor(FROMRGB(250, 240, 188)); ColorFillVideoSurfaceArea(ButtonDestBuffer, x, y, x2, y2, usFillColorDark); ColorFillVideoSurfaceArea(ButtonDestBuffer, x + 1, y + 1, x2, y2, usFillColorLight); ColorFillVideoSurfaceArea(ButtonDestBuffer, x + 1, y + 1, x2 - 1, y2 - 1, usFillColorBack); usStrWidth = StringPixLength( str, uiFont ); if( usStrWidth > w ) { //the string is too long, so use the wrapped method y += 1; DisplayWrappedString( x, y, w, 2, uiFont, FONT_BLACK, str, FONT_BLACK, TRUE, CENTER_JUSTIFIED ); return; } //center the string vertically and horizontally. SetFont( uiFont ); SetFontForeground( FONT_BLACK ); SetFontShadow( FONT_BLACK ); x += (w - (UINT16)StringPixLength( str, uiFont )) / 2; y += (h - (UINT16)GetFontHeight( uiFont)) / 2; mprintf( x, y, L"%s", str ); InvalidateRegion( x, y, x2, y2 ); }
void RenderDoorLockInfo() { INT16 i, xp, yp; INT16 sScreenX, sScreenY; CHAR16 str[ 50 ]; for( i = 0; i < gubNumDoors; i++ ) { GetGridNoScreenPos( DoorTable[ i ].sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY > (2 * iScreenHeightOffset + 390) ) continue; if( DoorTable[ i ].ubLockID != 255 ) swprintf( str, L"%S", LockTable[ DoorTable[ i ].ubLockID ].ubEditorName ); else swprintf( str, iRenderDoorLockInfoText[0] ); xp = sScreenX - 10; yp = sScreenY - 40; DisplayWrappedString( xp, yp, 60, 2, FONT10ARIAL, FONT_LTKHAKI, str, FONT_BLACK, TRUE, CENTER_JUSTIFIED ); if( DoorTable[ i ].ubTrapID ) { SetFont( FONT10ARIAL ); SetFontForeground( FONT_RED ); SetFontShadow( FONT_NEARBLACK ); switch( DoorTable[ i ].ubTrapID ) { case EXPLOSION: swprintf( str, iRenderDoorLockInfoText[1] ); break; case ELECTRIC: swprintf( str, iRenderDoorLockInfoText[2] ); break; case SIREN: swprintf( str, iRenderDoorLockInfoText[3] ); break; case SILENT_ALARM: swprintf( str, iRenderDoorLockInfoText[4] ); break; case SUPER_ELECTRIC: swprintf( str, iRenderDoorLockInfoText[5] ); break; // WANNE: Fix a vanilla glitch in the editor: The text for the brothel siren trap was missing. // Fixed by Tron (Stracciatella): Revision: 6253 case BROTHEL_SIREN: swprintf( str, iRenderDoorLockInfoText[6] ); break; } xp = sScreenX + 20 - StringPixLength( str, FONT10ARIAL ) / 2; yp = sScreenY; mprintf( xp, yp, str ); swprintf( str, iRenderDoorLockInfoText[7], DoorTable[ i ].ubTrapLevel ); xp = sScreenX + 20 - StringPixLength( str, FONT10ARIAL ) / 2; mprintf( xp, yp+10, str ); } } }
void RenderDoorLockInfo() { INT16 i, xp, yp; INT16 sScreenX, sScreenY; UINT16 str[ 50 ]; for( i = 0; i < gubNumDoors; i++ ) { GetGridNoScreenPos( DoorTable[ i ].sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY > 390 ) continue; if( DoorTable[ i ].ubLockID != 255 ) swprintf( str, L"%S", LockTable[ DoorTable[ i ].ubLockID ].ubEditorName ); else swprintf( str, L"No Lock ID" ); xp = sScreenX - 10; yp = sScreenY - 40; DisplayWrappedString( xp, yp, 60, 2, FONT10ARIAL, FONT_LTKHAKI, str, FONT_BLACK, TRUE, CENTER_JUSTIFIED ); if( DoorTable[ i ].ubTrapID ) { SetFont( FONT10ARIAL ); SetFontForeground( FONT_RED ); SetFontShadow( FONT_NEARBLACK ); switch( DoorTable[ i ].ubTrapID ) { case EXPLOSION: swprintf( str, L"Explosion Trap" ); break; case ELECTRIC: swprintf( str, L"Electric Trap" ); break; case SIREN: swprintf( str, L"Siren Trap" ); break; case SILENT_ALARM: swprintf( str, L"Silent Alarm" ); break; case SUPER_ELECTRIC: swprintf( str, L"Super Electric Trap" ); break; } xp = sScreenX + 20 - StringPixLength( str, FONT10ARIAL ) / 2; yp = sScreenY; mprintf( xp, yp, str ); swprintf( str, L"Trap Level %d", DoorTable[ i ].ubTrapLevel ); xp = sScreenX + 20 - StringPixLength( str, FONT10ARIAL ) / 2; mprintf( xp, yp+10, str ); } } }
void DropDownBase::Init(UINT16 sX, UINT16 sY) { mfMouseRegionsCreated = FALSE; musStartX = sX; musStartY = sY; mSelectedEntry = min(mSelectedEntry, mEntryVector.size() - 1); mNumDisplayedEntries = min(DROPDOWN_REGIONS, mEntryVector.size() ); mFirstShownEntry = max(0, min(mFirstShownEntry, mEntryVector.size() - 1 - mNumDisplayedEntries)); musWidth = 0; UINT8 size = mEntryVector.size(); for( UINT8 i = 0; i < size; ++i) { musWidth = max(musWidth, StringPixLength ( mEntryVector[i].second, DEF_DROPDOWN_FONT )); } // account for a bit of space let and right musWidth += 2 * CITY_NAME_OFFSET; musUpArrowX = musStartX + musWidth; musUpArrowY = musStartY + 2; musFontHeight = GetFontHeight( DEF_DROPDOWN_FONT ); // does not work on init of static objects, as the fonts do not yet exist! }
void DisplayItemStatistics() { BOOLEAN fUseSelectedItem; INT16 usItemIndex; CHAR16 pItemName[SIZE_ITEM_NAME]; INVTYPE *pItem; if( !eInfo.fActive ) { return; } //If there is nothing else currently highlited by the mouse, use the selected item. fUseSelectedItem = eInfo.sHilitedItemIndex == -1 || eInfo.sHilitedItemIndex == eInfo.sSelItemIndex; SetFont( SMALLCOMPFONT ); SetFontForeground( (UINT8)(fUseSelectedItem ? FONT_LTRED : FONT_YELLOW) ); //Extract all of the item information. if( !eInfo.pusItemIndex ) return; usItemIndex = eInfo.pusItemIndex[ fUseSelectedItem ? eInfo.sSelItemIndex : eInfo.sHilitedItemIndex ]; pItem = &Item[ usItemIndex ]; LoadItemInfo( usItemIndex, pItemName, NULL ); mprintf( iScreenWidthOffset + 50 - StringPixLength( pItemName , SMALLCOMPFONT )/2, 2 * iScreenHeightOffset + 403, pItemName ); mprintf( iScreenWidthOffset + 2, 2 * iScreenHeightOffset + 410, pDisplayItemStatisticsTex[0]); mprintf( iScreenWidthOffset + 2, 2 * iScreenHeightOffset + 420, pDisplayItemStatisticsTex[1]); mprintf( iScreenWidthOffset + 2, 2 * iScreenHeightOffset + 430, pDisplayItemStatisticsTex[2]); mprintf( iScreenWidthOffset + 2, 2 * iScreenHeightOffset + 440, pDisplayItemStatisticsTex[3]); mprintf( iScreenWidthOffset + 2, 2 * iScreenHeightOffset + 450, pDisplayItemStatisticsTex[4]); }
void RenderBriefingRoomEnter() { UINT16 i, idText, usPosY; UINT16 usHeight; HVOBJECT hContentButtonHandle; UINT16 usWidth=0; HVOBJECT hHandle; DrawBriefingRoomEnterDefaults(); DrawBriefingRoomEnterLogoAim(); ShadowVideoSurfaceRect( FRAME_BUFFER, BRIEFINGROOM_MISSION_LOCATION_BOX_X+BRIEFINGROOM_MISSION_LOCATION_BOX_SHADOW_GAP+150, BRIEFINGROOM_MISSION_LOCATION_BOX_Y + 13 + BRIEFINGROOM_MISSION_LOCATION_BOX_SHADOW_GAP - 227 , BRIEFINGROOM_MISSION_LOCATION_BOX_X + 400 + BRIEFINGROOM_MISSION_LOCATION_BOX_SHADOW_GAP, BRIEFINGROOM_MISSION_LOCATION_BOX_Y + BRIEFINGROOM_MISSION_LOCATION_BOX_SHADOW_GAP-42); DisplayWrappedString(BRIEFINGROOM_MISSION_BOX_DESC_X + 150, BRIEFINGROOM_MISSION_BOX_DESC_Y - 210, BRIEFINGROOM_MISSION_BOX_TEXT_WIDTH, 6, BRIEFINGROOM_MISSION_BOX_FONT, BRIEFINGROOM_MISSION_BOX_COLOR, pSectorPageText[6], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); GetVideoObject(&hContentButtonHandle, guiContentButtonBriefingRoomEnter); usHeight = GetFontHeight(BRIEFINGROOM_MISSION_FONT12ARIAL); usPosY = BRIEFINGROOM_MISSION_CONTENTBUTTON_Y + 120; for(i=0; i<BRIEFINGROOM_MISSION_BUTTONS_DEF; i++) { idText = i + 16; BltVideoObject(FRAME_BUFFER, hContentButtonHandle, 0,BRIEFINGROOM_MISSION_TOC_X+120, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); usWidth = StringPixLength(pMenuStrings[idText], BRIEFINGROOM_MISSION_FONT12ARIAL); DrawTextToScreen(pMenuStrings[idText], BRIEFINGROOM_MISSION_TOC_X+120, (UINT16)(usPosY + BRIEFINGROOM_MISSION_TOC_Y+10), BRIEFINGROOM_MISSION_BUTTON_SIZE_X, BRIEFINGROOM_MISSION_FONT12ARIAL, BRIEFINGROOM_MISSION_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); usPosY += BRIEFINGROOM_MISSION_TOC_GAP_Y; } // get the video object GetVideoObject(&hHandle, guiBRIEFINGROOM_MISSIONACTIVATIONINDENT); // blt to sX, sY relative to upper left corner BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + 100, LAPTOP_SCREEN_WEB_UL_Y + 240 , VO_BLT_SRCTRANSPARENCY,NULL); DisplayBriefingRoomEnterSlogan(); DisplayBriefingRoomEnterCopyright(); RenderWWWProgramTitleBar( ); // render the activation string //------------- DisplayPlayerActivationBriefingRoomEnterString( ); //------------- InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); }
void RenderEditorInfo( ) { wchar_t FPSText[ 50 ]; static INT32 iSpewWarning = 0; INT16 iMapIndex; SetFont( FONT12POINT1 ); SetFontForeground( FONT_BLACK ); SetFontBackground( FONT_BLACK ); //Display the mapindex position if( GetMouseMapPos( &iMapIndex ) ) swprintf( FPSText, L" (%d) ", iMapIndex ); else swprintf( FPSText, L" " ); mprintfEditor( (UINT16)(50-StringPixLength( FPSText, FONT12POINT1 )/2), 463, FPSText ); switch( iCurrentTaskbar ) { case TASK_OPTIONS: if( !gfWorldLoaded || giCurrentTilesetID < 0 ) mprintf( 260, 445, L"No map currently loaded." ); else mprintf( 260, 445, L"File: %S, Current Tileset: %s", gubFilename, gTilesets[ giCurrentTilesetID ].zName ); break; case TASK_TERRAIN: if( gusSelectionType == LINESELECTION ) swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, 220, 430, 60, 30 ); swprintf( FPSText, L"%d%%", gusSelectionDensity ); DrawEditorInfoBox( FPSText, FONT12POINT1, 310, 430, 40, 30 ); break; case TASK_ITEMS: RenderEditorItemsInfo(); UpdateItemStatsPanel(); break; case TASK_BUILDINGS: UpdateBuildingsInfo(); if( gusSelectionType == LINESELECTION ) swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, 530, 430, 60, 30 ); break; case TASK_MERCS: UpdateMercsInfo(); break; case TASK_MAPINFO: UpdateMapInfo(); if( gusSelectionType == LINESELECTION ) swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, 440, 430, 60, 30 ); break; } }
BOOLEAN InitTocMenu() { UINT16 i, usPosY; UINT16 usHeight; UINT16 usWidth=0; CHAR16 sText[400]; UINT8 ubLocInFile[] = { IN_THE_BEGINNING, THE_ISLAND_METAVIRA, GUS_TARBALLS, WORD_FROM_FOUNDER, INCORPORATION}; HVOBJECT hContentButtonHandle; GetVideoObject(&hContentButtonHandle, guiContentButton); usHeight = GetFontHeight(AIM_HISTORY_TOC_TEXT_FONT); usPosY = AIM_HISTORY_CONTENTBUTTON_Y; for(i=0; i<NUM_AIM_HISTORY_PAGES; i++) { if(!g_bUseXML_Strings) { UINT32 uiStartLoc = AIM_HISTORY_LINE_SIZE * ubLocInFile[i]; LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); } else { Loc::GetString(Loc::AIM_HISTORY, L"Line", ubLocInFile[i], sText, 400); } usWidth = StringPixLength(sText, AIM_HISTORY_TOC_TEXT_FONT); //if the mouse regions havent been inited, init them if( !gfInToc ) { //Mouse region for the history toc buttons MSYS_DefineRegion( &gSelectedHistoryTocMenuRegion[i], AIM_HISTORY_TOC_X, usPosY, (UINT16)(AIM_HISTORY_TOC_X + AIM_CONTENTBUTTON_WIDTH), (UINT16)(usPosY + AIM_CONTENTBUTTON_HEIGHT), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectHistoryTocMenuRegionCallBack); MSYS_AddRegion(&gSelectedHistoryTocMenuRegion[i]); MSYS_SetRegionUserData( &gSelectedHistoryTocMenuRegion[i], 0, i+1); } BltVideoObject(FRAME_BUFFER, hContentButtonHandle, 0,AIM_HISTORY_TOC_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); DrawTextToScreen(sText, AIM_HISTORY_TOC_X, (UINT16)(usPosY + AIM_HISTORY_TOC_Y), AIM_CONTENTBUTTON_WIDTH, AIM_HISTORY_TOC_TEXT_FONT, AIM_HISTORY_TOC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); usPosY += AIM_HISTORY_TOC_GAP_Y; } gfInToc = TRUE; return(TRUE); }
void ResetActivationBriefingRoomEnterStringTextBox(void) { // Reset activation text box for (int i = 0; i < iStringBriefingRoomEnterPos; i++) { pPlayerBriefingRoomEnterActivationString[i] = 0; } iStringBriefingRoomEnterPos = 0; uiCursorBriefingRoomEnterPosition = StringPixLength( pPlayerBriefingRoomEnterActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; DisplayPlayerActivationBriefingRoomEnterString(); DisplayActivationBriefingRoomEnterStringCursor(); }
void DropDownBase::Display() { if( !mfMouseRegionsCreated ) return; HVOBJECT hArrowHandle; //Display the background for the drop down window ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX, musStartY, musStartX + musWidth + musArrowWidth, musStartY + DEF_SCROLL_ARROW_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); // top Display2Line2ShadowHorizontal( musStartX, musStartY, musStartX + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow ); // left Display2Line2ShadowVertical( musStartX, musStartY+2, musStartY + DEF_SCROLL_ARROW_HEIGHT - 1, mColorLine, mColorLineShadow ); // right between text and arrow Display2Line2ShadowVertical( musStartX + musWidth - 4, musStartY+2, musStartY + DEF_SCROLL_ARROW_HEIGHT - 1, mColorLine, mColorLineShadow ); // bottom Display2Line2ShadowHorizontal( musStartX, musStartY + DEF_SCROLL_ARROW_HEIGHT - 4, musStartX + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow ); // right Display2Line2ShadowVertical( musStartX + musWidth + musArrowWidth - 4, musStartY, musStartY + DEF_SCROLL_ARROW_HEIGHT - 3, mColorLine, mColorLineShadow ); DrawTopEntry(); //get and display the up and down arrows GetVideoObject(&hArrowHandle, muiGoldArrowImages); //top arrow BltVideoObject(FRAME_BUFFER, hArrowHandle, 0, musUpArrowX, musUpArrowY, VO_BLT_SRCTRANSPARENCY,NULL); // Set region help text if ( StringPixLength ( mHelpText, DEF_DROPDOWN_FONT ) > 0 ) { SetRegionFastHelpText( &mBubbleHelpRegion, mHelpText ); SetRegionHelpEndCallback( &mBubbleHelpRegion, MSYS_NO_CALLBACK ); } InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); // display dropped region if necessary Display_Drop(); }
//A specialized mprint function that'll restore the editor panel underneath the //string before rendering the string. This is obviously only useful for drawing text //in the editor taskbar. void mprintfEditor(INT16 x, INT16 y, UINT16 *pFontString, ...) { va_list argptr; wchar_t string[512]; UINT16 uiStringLength, uiStringHeight; Assert( pFontString != NULL ); va_start( argptr, pFontString ); // Set up variable argument pointer vswprintf( string, pFontString, argptr); // process gprintf string (get output str) va_end( argptr ); uiStringLength = StringPixLength( string, FontDefault ); uiStringHeight = GetFontHeight( FontDefault ); ClearTaskbarRegion( x, y, (INT16)(x+uiStringLength), (INT16)(y+uiStringHeight) ); mprintf( x, y, string ); }
void DisplaySubmitClaimPage() { wchar_t sText[800]; UINT16 usNewLineOffset = 0; UINT16 usPosX; usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; //Display the title slogan GetInsuranceText( INS_SNGL_SUBMITTING_CLAIM, sText ); DrawTextToScreen( sText, INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); //Display the title slogan GetInsuranceText( INS_MLTI_U_CAN_REST_ASSURED, sText ); usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; GetInsuranceText( INS_MLTI_HAD_U_HIRED_AN_INDIVIDUAL, sText ); usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; //display the BIG FRAUD GetInsuranceText( INS_SNGL_FRAUD, sText ); DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, (UINT16)(usNewLineOffset-1), INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_BIG, INS_INFO_FRAUD_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usPosX = INS_INFO_FIRST_PARAGRAPH_X + StringPixLength( sText, INS_FONT_BIG ) + 2; GetInsuranceText( INS_MLTI_WE_RESERVE_THE_RIGHT, sText ); usNewLineOffset += DisplayWrappedString( usPosX, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); GetInsuranceText( INS_MLTI_SHOULD_THERE_BE_GROUNDS, sText ); usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; GetInsuranceText( INS_MLTI_SHOULD_SUCH_A_SITUATION, sText ); usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; }
void RenderPopupMenu() { UINT16 usX, usY; UINT8 ubColumn, ubEntry, ubCounter; UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; UINT16 usLineColor; UINT16 usStringWidth; UINT16 usStart; //Draw the menu ColorFillVideoSurfaceArea(FRAME_BUFFER, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, Get16BPPColor(FROMRGB(128, 128, 128) ) ); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); usLineColor = Get16BPPColor( FROMRGB( 64, 64, 64 ) ); RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, usLineColor, pDestBuf ); if( gPopup.ubColumns > 1 ) { //draw a vertical line between each column usStart = gPopup.usLeft + gPopup.ubColumnWidth[ 0 ]; for( ubColumn = 1; ubColumn < gPopup.ubColumns; ubColumn++ ) { LineDraw( TRUE, usStart, gPopup.usTop, usStart, gPopup.usBottom, usLineColor, pDestBuf ); } usStart += (UINT16)gPopup.ubColumnWidth[ ubColumn ]; } UnLockVideoSurface( FRAME_BUFFER ); //Set up the text attributes. SetFont( gPopup.usFont); SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); usX = gPopup.usLeft + 1; ubCounter = 0; usStart = gPopup.usLeft; for( ubColumn = 0; ubColumn < gPopup.ubColumns; ubColumn++ ) { for( ubEntry = 0; ubEntry < gPopup.ubMaxEntriesPerColumn; ubEntry++ ) { if( ubCounter >= gPopup.ubNumEntries ) return; //done //Calc current string's width in pixels. Adding 14 pixels which is the width of //two padded gPopup.usFont spaces not stored in the string. usStringWidth = 14 + StringPixLength( GetPopupMenuString( ubCounter ), gPopup.usFont ); //Horizontally center the string inside the popup menu usX = usStart + ( gPopup.ubColumnWidth[ ubColumn ] - usStringWidth ) / 2; usY = gPopup.usTop + 1 + ubEntry * gusEntryHeight; if( ubCounter == gPopup.ubSelectedIndex - 1 ) { //This is the highlighted menu entry. SetFontForeground( FONT_MCOLOR_LTBLUE ); mprintf( usX, usY, L" %s ", GetPopupMenuString( ubCounter ) ); SetFontForeground( FONT_MCOLOR_WHITE ); } else { mprintf( usX, usY, L" %s ", GetPopupMenuString( ubCounter ) ); } ubCounter++; } usStart += gPopup.ubColumnWidth[ ubColumn ]; } }
void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection ) { UINT16 usX, usY; UINT16 usMenuHeight; UINT16 usMenuWidth = 0; UINT16 usCurrStrWidth; UINT8 ubColumn, ubEntry; UINT8 ubCounter; GUI_BUTTON *button; //calculate the location of the menu based on the button position. //This also calculates the menu's direction based on position. gPopup.usFont = (UINT16)SMALLFONT1; gusEntryHeight = GetFontHeight( gPopup.usFont ); button = ButtonList[ iButtonID ]; MSYS_DisableRegion( &gBottomPanalRegion ); switch( ubDirection ) { case DIR_UPRIGHT: usX = button->Area.RegionTopLeftX; usY = button->Area.RegionTopLeftY; break; case DIR_UPLEFT: usX = button->Area.RegionBottomRightX; usY = button->Area.RegionTopLeftY; break; case DIR_DOWNRIGHT: usX = button->Area.RegionTopLeftX; usY = button->Area.RegionBottomRightY; break; case DIR_DOWNLEFT: usX = button->Area.RegionBottomRightX; usY = button->Area.RegionBottomRightY; break; } //Decipher the popupMenuID switch( ubPopupMenuID ) { case CHANGETSET_POPUP: //change tileset gPopup.ubNumEntries = NUM_TILESETS; break; case OWNERSHIPGROUP_POPUP: case CHANGECIVGROUP_POPUP: gPopup.ubNumEntries = NUM_CIV_GROUPS; break; case SCHEDULEACTION_POPUP: gPopup.ubNumEntries = NUM_SCHEDULE_ACTIONS; break; case ACTIONITEM_POPUP: gPopup.ubNumEntries = NUM_ACTIONITEMS; break; default: return; } gPopup.usFont = (UINT16)SMALLFONT1; gusEntryHeight = GetFontHeight( gPopup.usFont ); button = ButtonList[ iButtonID ]; MSYS_DisableRegion( &gBottomPanalRegion ); gPopup.ubPopupMenuID = ubPopupMenuID; gPopup.ubSelectedIndex = 0; gPopup.ubActiveType = POPUP_ACTIVETYPE_NOT_YET_DETERMINED; gPopup.fActive = TRUE; fWaitingForLButtonRelease = FALSE; gPopup.fUseKeyboardInfoUntilMouseMoves = FALSE; //Initialize the last mouse position to be out of bounds. gPopup.usLastMouseX = 1000; gPopup.usLastMouseY = 1000; //clear the column widths. for( ubColumn = 0; ubColumn < MAX_COLUMNS; ubColumn++ ) gPopup.ubColumnWidth[ ubColumn ] = 0; //1) Calc total entry height of the popup region. gPopup.ubColumns = 1; gPopup.ubMaxEntriesPerColumn = gPopup.ubNumEntries; usMenuHeight = gPopup.ubNumEntries * gusEntryHeight + 3; while( usMenuHeight >= usY && ( ubDirection == DIR_UPLEFT || ubDirection == DIR_UPRIGHT ) || 480-usMenuHeight >= usY && ( ubDirection == DIR_DOWNLEFT || ubDirection == DIR_DOWNRIGHT ) ) { //menu has too many entries. Increase the number of columns until the height is //less than the max height. gPopup.ubMaxEntriesPerColumn = (gPopup.ubNumEntries+gPopup.ubColumns)/(gPopup.ubColumns+1); usMenuHeight = gPopup.ubMaxEntriesPerColumn * gusEntryHeight + 3; gPopup.ubColumns++; } //now we have the number of columns as well as the max number of entries per column, and //the total menu height. //We now calculate the total width of the menu as well as the max width of each column. ubCounter = 0; usMenuWidth = 0; for( ubColumn = 0; ubColumn < gPopup.ubColumns; ubColumn++ ) { for( ubEntry = 0; ubEntry < gPopup.ubMaxEntriesPerColumn; ubEntry++ ) { if( ubCounter >= gPopup.ubNumEntries ) break; //done (don't want to process undefined entries...) usCurrStrWidth = 16 + StringPixLength( GetPopupMenuString( ubCounter ) , gPopup.usFont ); if( usCurrStrWidth > gPopup.ubColumnWidth[ ubColumn ] ) { gPopup.ubColumnWidth[ ubColumn ] = (UINT8)usCurrStrWidth; } ubCounter++; } usMenuWidth += gPopup.ubColumnWidth[ ubColumn ]; } //Calculate popup menu boundaries based on direction from argument point. switch( ubDirection ) { case DIR_UPRIGHT: gPopup.usLeft = usX; gPopup.usTop = usY - usMenuHeight - 1; gPopup.usRight = usX + usMenuWidth; gPopup.usBottom = usY - 1; break; case DIR_UPLEFT: gPopup.usLeft = usX - usMenuWidth; gPopup.usTop = usY - usMenuHeight - 1; gPopup.usRight = usX; gPopup.usBottom = usY - 1; break; case DIR_DOWNRIGHT: gPopup.usLeft = usX; gPopup.usTop = usY + 1; gPopup.usRight = usX + usMenuWidth; gPopup.usBottom = usY + usMenuHeight + 1; break; case DIR_DOWNLEFT: gPopup.usLeft = usX - usMenuWidth; gPopup.usTop = usY + 1; gPopup.usRight = usX; gPopup.usBottom = usY + usMenuHeight + 1; break; } MSYS_DefineRegion( &popupRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGHEST, CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); RenderPopupMenu(); }
//Because loading and saving the map takes a few seconds, we want to post a message //on the screen and then update it which requires passing the screen back to the main loop. //When we come back for the next frame, we then actually save or load the map. So this //process takes two full screen cycles. UINT32 ProcessFileIO() { INT16 usStartX, usStartY; UINT8 ubNewFilename[50]; switch( gbCurrentFileIOStatus ) { case INITIATE_MAP_SAVE: //draw save message StartFrameBufferRender( ); SaveFontSettings(); SetFont( HUGEFONT ); SetFontForeground( FONT_LTKHAKI ); SetFontShadow( FONT_DKKHAKI ); SetFontBackground( 0 ); swprintf( zOrigName, L"Saving map: %s", gzFilename ); usStartX = 320 - StringPixLength( zOrigName, LARGEFONT1 ) / 2; usStartY = 180 - GetFontHeight( LARGEFONT1 ) / 2; mprintf( usStartX, usStartY, zOrigName ); InvalidateScreen( ); EndFrameBufferRender( ); gbCurrentFileIOStatus = SAVING_MAP; return LOADSAVE_SCREEN; case SAVING_MAP: //save map sprintf( ubNewFilename, "%S", gzFilename ); RaiseWorldLand(); if( gfShowPits ) RemoveAllPits(); OptimizeSchedules(); if ( !SaveWorld( ubNewFilename ) ) { if( gfErrorCatch ) { InitErrorCatchDialog(); return EDIT_SCREEN; } return ERROR_SCREEN; } if( gfShowPits ) AddAllPits(); SetGlobalSectorValues( gzFilename ); if( gfGlobalSummaryExists ) UpdateSectorSummary( gzFilename, gfUpdateSummaryInfo ); iCurrentAction = ACTION_NULL; gbCurrentFileIOStatus = IOSTATUS_NONE; gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; fEnteringLoadSaveScreen = TRUE; RestoreFontSettings(); if( gfErrorCatch ) { InitErrorCatchDialog(); return EDIT_SCREEN; } if( gMapInformation.ubMapVersion != gubMinorMapVersion ) ScreenMsg( FONT_MCOLOR_RED, MSG_ERROR, L"Map data has just been corrupted!!! What did you just do? KM : 0" ); return EDIT_SCREEN; case INITIATE_MAP_LOAD: //draw load message SaveFontSettings(); gbCurrentFileIOStatus = LOADING_MAP; if( gfEditMode && iCurrentTaskbar == TASK_MERCS ) IndicateSelectedMerc( SELECT_NO_MERC ); SpecifyItemToEdit( NULL, -1 ); return LOADSAVE_SCREEN; case LOADING_MAP: //load map DisableUndo(); sprintf( ubNewFilename, "%S", gzFilename ); RemoveMercsInSector( ); if( !LoadWorld( ubNewFilename ) ) { //Want to override crash, so user can do something else. EnableUndo(); SetPendingNewScreen( LOADSAVE_SCREEN ); gbCurrentFileIOStatus = IOSTATUS_NONE; gfGlobalError = FALSE; gfLoadError = TRUE; //RemoveButton( iTempButton ); CreateMessageBox( L" Error loading file. Try another filename?" ); return LOADSAVE_SCREEN; } SetGlobalSectorValues( gzFilename ); RestoreFontSettings(); //Load successful, update necessary information. //ATE: Any current mercs are transfered here... //UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); AddSoldierInitListTeamToWorld( ENEMY_TEAM, 255 ); AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 ); AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 ); AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); iCurrentAction = ACTION_NULL; gbCurrentFileIOStatus = IOSTATUS_NONE; if( !gfCaves && !gfBasement ) { gusLightLevel = 12; if( ubAmbientLightLevel != 4 ) { ubAmbientLightLevel = 4; LightSetBaseLevel( ubAmbientLightLevel ); } } else gusLightLevel = (UINT16)(EDITOR_LIGHT_MAX - ubAmbientLightLevel ); gEditorLightColor = gpLightColors[ 0 ]; gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; fEnteringLoadSaveScreen = TRUE; InitJA2SelectionWindow(); ShowEntryPoints(); EnableUndo(); RemoveAllFromUndoList(); SetEditorSmoothingMode( gMapInformation.ubEditorSmoothingType ); if( gMapInformation.ubEditorSmoothingType == SMOOTHING_CAVES ) AnalyseCaveMapForStructureInfo(); AddLockedDoorCursors(); gubCurrRoomNumber = gubMaxRoomNumber; UpdateRoofsView(); UpdateWallsView(); ShowLightPositionHandles(); SetMercTeamVisibility( ENEMY_TEAM, gfShowEnemies ); SetMercTeamVisibility( CREATURE_TEAM, gfShowCreatures ); SetMercTeamVisibility( MILITIA_TEAM, gfShowRebels ); SetMercTeamVisibility( CIV_TEAM, gfShowCivilians ); BuildItemPoolList(); if( gfShowPits ) AddAllPits(); if( iCurrentTaskbar == TASK_MAPINFO ) { //We have to temporarily remove the current textinput mode, //update the disabled text field values, then restore the current //text input fields. SaveAndRemoveCurrentTextInputMode(); UpdateMapInfoFields(); RestoreSavedTextInputMode(); } return EDIT_SCREEN; } gbCurrentFileIOStatus = IOSTATUS_NONE; return LOADSAVE_SCREEN; }
void HandleTextEvent( UINT32 uiKey ) { // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen // or delete it switch( uiKey ) { case ( BACKSPACE ): if( iStringPos >= 0 ) { if( iStringPos > 0 ) { // decrement iStringPosition iStringPos-=1; } // null out char pPlayerActivationString[iStringPos ] = 0; // move back cursor uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; // string has been altered, redisplay fNewCharInActivationString = TRUE; } break; default: if( uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' ) { // if the current string position is at max or great, do nothing if( iStringPos >= 6 ) { break; } else { if(iStringPos < 0 ) { iStringPos = 0; } // valid char, capture and convert to CHAR16 pPlayerActivationString[iStringPos] = ( CHAR16 )uiKey; // null out next char position pPlayerActivationString[iStringPos + 1] = 0; // move cursor position ahead uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; // increment string position iStringPos +=1; // string has been altered, redisplay fNewCharInActivationString = TRUE; } } break; } return; }
void DisplayAlumniOldMercPopUp() { UINT8 i,ubNumLines=11; //17 UINT16 usPosY, usTextPosY; UINT8 ubFontHeight, ubNumDescLines; HVOBJECT hAlumniPopUpHandle; HVOBJECT hDoneHandle; HVOBJECT hFacePaneHandle; HVOBJECT hFaceHandle; // WRAPPED_STRING *pFirstWrappedString, *pTempWrappedString; UINT16 usHeight = GetFontHeight(AIM_ALUMNI_POPUP_FONT); wchar_t sName[AIM_ALUMNI_NAME_SIZE]; wchar_t sDesc[AIM_ALUMNI_DECRIPTION_SIZE]; UINT32 uiStartLoc; UINT16 usStringPixLength; GetVideoObject(&hAlumniPopUpHandle, guiAlumniPopUp); GetVideoObject(&hDoneHandle, guiDoneButton); GetVideoObject(&hFacePaneHandle, guiPopUpPic); GetVideoObject(&hFaceHandle, guiOldAim); ubFontHeight = (UINT8)GetFontHeight(AIM_ALUMNI_POPUP_FONT); //Load the description uiStartLoc = AIM_ALUMNI_FILE_RECORD_SIZE * gubDrawOldMerc + AIM_ALUMNI_FULL_NAME_SIZE; LoadEncryptedDataFromFile(AIM_ALUMNI_FILE, sDesc, uiStartLoc, AIM_ALUMNI_DECRIPTION_SIZE); usStringPixLength = StringPixLength( sDesc, AIM_ALUMNI_POPUP_FONT); ubNumDescLines = (UINT8) (usStringPixLength / AIM_POPUP_TEXT_WIDTH); ubNumLines += ubNumDescLines; usTextPosY = AIM_POPUP_Y + 5; usPosY = AIM_POPUP_Y; //draw top line of the popup background ShadowVideoSurfaceRect( FRAME_BUFFER, AIM_POPUP_X+AIM_POPUP_SHADOW_GAP, usPosY+AIM_POPUP_SHADOW_GAP, AIM_POPUP_X + AIM_POPUP_WIDTH+AIM_POPUP_SHADOW_GAP, usPosY + AIM_POPUP_SECTION_HEIGHT+AIM_POPUP_SHADOW_GAP-1); BltVideoObject(FRAME_BUFFER, hAlumniPopUpHandle, 0,AIM_POPUP_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); //draw mid section of the popup background usPosY += AIM_POPUP_SECTION_HEIGHT; for(i=0; i<ubNumLines; i++) { ShadowVideoSurfaceRect( FRAME_BUFFER, AIM_POPUP_X+AIM_POPUP_SHADOW_GAP, usPosY+AIM_POPUP_SHADOW_GAP, AIM_POPUP_X + AIM_POPUP_WIDTH+AIM_POPUP_SHADOW_GAP, usPosY + AIM_POPUP_SECTION_HEIGHT+AIM_POPUP_SHADOW_GAP-1); BltVideoObject(FRAME_BUFFER, hAlumniPopUpHandle, 1,AIM_POPUP_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); usPosY += AIM_POPUP_SECTION_HEIGHT; } //draw the bottom line and done button ShadowVideoSurfaceRect( FRAME_BUFFER, AIM_POPUP_X+AIM_POPUP_SHADOW_GAP, usPosY+AIM_POPUP_SHADOW_GAP, AIM_POPUP_X + AIM_POPUP_WIDTH+AIM_POPUP_SHADOW_GAP, usPosY + AIM_POPUP_SECTION_HEIGHT+AIM_POPUP_SHADOW_GAP-1); BltVideoObject(FRAME_BUFFER, hAlumniPopUpHandle, 2,AIM_POPUP_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); BltVideoObject(FRAME_BUFFER, hDoneHandle, 0,AIM_ALUMNI_DONE_X, usPosY-AIM_ALUMNI_DONE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); DrawTextToScreen(AimAlumniText[AIM_ALUMNI_DONE], (UINT16)(AIM_ALUMNI_DONE_X+1), (UINT16)(usPosY-AIM_ALUMNI_DONE_HEIGHT+3), AIM_ALUMNI_DONE_WIDTH, AIM_ALUMNI_POPUP_NAME_FONT, AIM_ALUMNI_POPUP_NAME_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); CreateDestroyDoneMouseRegion(usPosY); ///blt face panale and the mecs fce BltVideoObject(FRAME_BUFFER, hFacePaneHandle, 0,AIM_ALUMNI_FACE_PANEL_X, AIM_ALUMNI_FACE_PANEL_Y, VO_BLT_SRCTRANSPARENCY,NULL); BltVideoObject(FRAME_BUFFER, hFaceHandle, gubDrawOldMerc, AIM_ALUMNI_FACE_PANEL_X+1, AIM_ALUMNI_FACE_PANEL_Y+1, VO_BLT_SRCTRANSPARENCY,NULL); //Load and display the name // uiStartLoc = AIM_ALUMNI_NAME_SIZE * gubDrawOldMerc; // LoadEncryptedDataFromFile(AIM_ALUMNI_NAME_FILE, sName, uiStartLoc, AIM_ALUMNI_NAME_SIZE); uiStartLoc = AIM_ALUMNI_FILE_RECORD_SIZE * gubDrawOldMerc; LoadEncryptedDataFromFile( AIM_ALUMNI_FILE, sName, uiStartLoc, AIM_ALUMNI_FULL_NAME_SIZE ); DrawTextToScreen(sName, AIM_ALUMNI_POPUP_NAME_X, AIM_ALUMNI_POPUP_NAME_Y, 0, AIM_ALUMNI_POPUP_NAME_FONT, AIM_ALUMNI_POPUP_NAME_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); //Display the description DisplayWrappedString(AIM_ALUMNI_POPUP_DESC_X, AIM_ALUMNI_POPUP_DESC_Y, AIM_POPUP_TEXT_WIDTH, 2, AIM_ALUMNI_POPUP_FONT, AIM_ALUMNI_POPUP_COLOR, sDesc, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); }
//Because loading and saving the map takes a few seconds, we want to post a message //on the screen and then update it which requires passing the screen back to the main loop. //When we come back for the next frame, we then actually save or load the map. So this //process takes two full screen cycles. UINT32 ProcessFileIO() { INT16 usStartX, usStartY; CHAR8 ubNewFilename[50]; BOOLEAN fAltMap;//dnl ch31 150909 switch( gbCurrentFileIOStatus ) { case INITIATE_MAP_SAVE: //draw save message StartFrameBufferRender( ); SaveFontSettings(); SetFont( HUGEFONT ); SetFontForeground( FONT_LTKHAKI ); SetFontShadow( FONT_DKKHAKI ); SetFontBackground( 0 ); swprintf( zOrigName, L"Saving map: %s", gzFilename ); usStartX = iScreenWidthOffset + 320 - StringPixLength( zOrigName, LARGEFONT1 ) / 2; usStartY = iScreenHeightOffset + 180 - GetFontHeight( LARGEFONT1 ) / 2; mprintf( usStartX, usStartY, zOrigName ); InvalidateScreen( ); EndFrameBufferRender( ); gbCurrentFileIOStatus = SAVING_MAP; return LOADSAVE_SCREEN; case SAVING_MAP: //save map sprintf( ubNewFilename, "%S", gzFilename ); RaiseWorldLand(); if( gfShowPits ) RemoveAllPits(); OptimizeSchedules(); ShowHighGround(4);//dnl ch41 210909 //dnl ch33 091009 BOOLEAN fRet; if(gfVanillaMode && iNewMapWorldRows == OLD_WORLD_ROWS && iNewMapWorldCols == OLD_WORLD_COLS) fRet = SaveWorld(ubNewFilename, VANILLA_MAJOR_MAP_VERSION, VANILLA_MINOR_MAP_VERSION); else fRet = SaveWorld(ubNewFilename); if(!fRet) { //dnl ch37 150909 gfSaveError = TRUE; if(gfErrorCatch) { InitErrorCatchDialog(); return(EDIT_SCREEN); } gbCurrentFileIOStatus = IOSTATUS_NONE; CreateMessageBox((STR16)(_BS(L" Error saving ") << (const char*)ubNewFilename << L" file. Try another filename? " << _BS::wget).c_str() ); return(guiCurrentScreen); } if( gfShowPits ) AddAllPits(); GetSectorFromFileName(gzFilename, gWorldSectorX, gWorldSectorY, gbWorldSectorZ, fAltMap);//dnl ch31 140909 if( gfGlobalSummaryExists ) UpdateSectorSummary( gzFilename, gfUpdateSummaryInfo ); else//dnl ch30 150909 ReEvaluateWorld(ubNewFilename); iCurrentAction = ACTION_NULL; gbCurrentFileIOStatus = IOSTATUS_NONE; gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; fEnteringLoadSaveScreen = TRUE; RestoreFontSettings(); if( gfErrorCatch ) { InitErrorCatchDialog(); return EDIT_SCREEN; } fNewMapSaved = TRUE; return EDIT_SCREEN; case INITIATE_MAP_LOAD: //draw load message SaveFontSettings(); gbCurrentFileIOStatus = LOADING_MAP; if( gfEditMode && iCurrentTaskbar == TASK_MERCS ) IndicateSelectedMerc( SELECT_NO_MERC ); SpecifyItemToEdit( NULL, -1 ); return LOADSAVE_SCREEN; case LOADING_MAP: //load map DisableUndo(); sprintf( ubNewFilename, "%S", gzFilename ); RemoveMercsInSector( ); // Want to override crash, so user can do something else. if(!ReEvaluateWorld(ubNewFilename) || !LoadWorld(ubNewFilename))//dnl ch36 140909 { EnableUndo(); gbCurrentFileIOStatus = IOSTATUS_NONE; gfGlobalError = FALSE; gfLoadError = TRUE; CreateMessageBox((STR16)(_BS(L" Error loading ") << (const char*)ubNewFilename << L" file. Try another filename? " << _BS::wget).c_str()); return(guiCurrentScreen); } //ADB these are NOT set yet! but they need to be, duh CompileWorldMovementCosts(); GetSectorFromFileName(gzFilename, gWorldSectorX, gWorldSectorY, gbWorldSectorZ, fAltMap);//dnl ch31 140909 RestoreFontSettings(); //Load successful, update necessary information. //ATE: Any current mercs are transfered here... //UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); AddSoldierInitListTeamToWorld( ENEMY_TEAM, 255 ); AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 ); AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 ); AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); iCurrentAction = ACTION_NULL; gbCurrentFileIOStatus = IOSTATUS_NONE; if( !gfCaves && !gfBasement ) { gusLightLevel = 12; if( ubAmbientLightLevel != 4 ) { ubAmbientLightLevel = 4; LightSetBaseLevel( ubAmbientLightLevel ); } } else gusLightLevel = (UINT16)(EDITOR_LIGHT_MAX - ubAmbientLightLevel ); gEditorLightColor = gpLightColors[ 0 ]; gfRenderWorld = TRUE; gfRenderTaskbar = TRUE; fEnteringLoadSaveScreen = TRUE; InitJA2SelectionWindow(); ShowEntryPoints(); EnableUndo(); RemoveAllFromUndoList(); SetEditorSmoothingMode( gMapInformation.ubEditorSmoothingType ); if( gMapInformation.ubEditorSmoothingType == SMOOTHING_CAVES ) AnalyseCaveMapForStructureInfo(); AddLockedDoorCursors(); gubCurrRoomNumber = gubMaxRoomNumber; UpdateRoofsView(); UpdateWallsView(); ShowLightPositionHandles(); SetMercTeamVisibility( ENEMY_TEAM, gfShowEnemies ); SetMercTeamVisibility( CREATURE_TEAM, gfShowCreatures ); SetMercTeamVisibility( MILITIA_TEAM, gfShowRebels ); SetMercTeamVisibility( CIV_TEAM, gfShowCivilians ); BuildItemPoolList(); gpItemPool = NULL;//dnl ch26 210909 fShowHighGround = FALSE;//dnl ch2 210909 fRaiseWorld = FALSE;//dnl ch3 210909 ShowHighGround(4);//dnl ch41 210909 SetRenderCenter(WORLD_COLS/2, WORLD_ROWS/2);//dnl ch43 280909 if( gfShowPits ) AddAllPits(); if( iCurrentTaskbar == TASK_MAPINFO ) { //We have to temporarily remove the current textinput mode, //update the disabled text field values, then restore the current //text input fields. SaveAndRemoveCurrentTextInputMode(); UpdateMapInfoFields(); RestoreSavedTextInputMode(); } return EDIT_SCREEN; } gbCurrentFileIOStatus = IOSTATUS_NONE; return LOADSAVE_SCREEN; }
UINT32 MPChatScreenHandle( ) { InputAtom InputEvent; if ( gfNewChatBox ) { // If in game screen.... if ( ( gfStartedFromGameScreen )||( gfStartedFromMapScreen ) ) { //UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; //UINT8 *pDestBuf, *pSrcBuf; if( gfStartedFromGameScreen ) { HandleTacticalUILoseCursorFromOtherScreen( ); } else { HandleMAPUILoseCursorFromOtherScreen( ); } gfStartedFromGameScreen = FALSE; gfStartedFromMapScreen = FALSE; } gfNewChatBox = FALSE; return( MP_CHAT_SCREEN ); } UnmarkButtonsDirty( ); // Render the box! if ( gChatBox.fRenderBox ) { // Render the Background ( this includes the text string) RenderMercPopUpBoxFromIndex( gChatBox.iBoxId, gChatBox.sX, gChatBox.sY, FRAME_BUFFER ); UINT16 usWidth = StringPixLength( gzMPChatboxText[0], CHATBOX_FONT_TITLE ); int usPosY = 0; int usPosX = 0; usPosY = gChatBox.sY + 10; usPosX = gChatBox.sX + ((gChatBox.usWidth - usWidth) / 2); DrawTextToScreen( gzMPChatboxText[0], usPosX, usPosY, usWidth, CHATBOX_FONT_TITLE, CHATBOX_FONT_COLOR, DEFAULT_SHADOW, FALSE, CENTER_JUSTIFIED | TEXT_SHADOWED ); // Render the toggle button strings for(UINT8 cnt=0; cnt<NUM_CHAT_TOGGLES; cnt++) { GUI_BUTTON* btn = ButtonList[ guiChatToggles[ cnt ] ]; usPosX = btn->XLoc + 12 + 10; usPosY = btn->YLoc; usWidth = StringPixLength( gzMPChatToggleText[ cnt ], CHATBOX_FONT_TOGGLE ); DrawTextToScreen( gzMPChatToggleText[ cnt ], usPosX, usPosY, usWidth, CHATBOX_FONT_TOGGLE, CHATBOX_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); } if (gIncludeChatLog) { // draw chatbox HVOBJECT hHandle; // get and blt panel GetVideoObject(&hHandle, guiCHATLOGIMG ); BltVideoObject( FRAME_BUFFER , hHandle, 0, gChatMessageLogRegion.iLeft, gChatMessageLogRegion.iTop, VO_BLT_SRCTRANSPARENCY,NULL ); BltVideoObject( FRAME_BUFFER , hHandle, 1, gChatMessageLogRegion.iRight+CHATBOX_SLIDER_GAP, gChatMessageLogRegion.iTop, VO_BLT_SRCTRANSPARENCY,NULL ); // draw slider DisplayChatLogScrollBarSlider( ); // draw chat log text DisplayStringsInChatLogMessageList(); } } MarkButtonsDirty(); EnableDisableChatLogScrollButtonsAndRegions(); // Render buttons RenderButtons( ); // render text boxes //SaveFontSettings(); SetFontDestBuffer( FRAME_BUFFER, gChatTextBoxRegion.iLeft , gChatTextBoxRegion.iTop , gChatTextBoxRegion.iRight , gChatTextBoxRegion.iBottom, FALSE ); RenderAllTextFields(); // textbox system call SetFontDestBuffer( FRAME_BUFFER, 0 , 0 , SCREEN_WIDTH , SCREEN_HEIGHT , FALSE ); //RestoreFontSettings(); EndFrameBufferRender( ); // carter, need key shortcuts for clearing up message boxes // Check for esc bool bHandled; while (DequeueEvent(&InputEvent) == TRUE) { bHandled = false; if(InputEvent.usEvent == KEY_DOWN ) { if( ( InputEvent.usParam == ESC ) ) { // Exit messagebox gChatBox.bHandled = MSG_BOX_RETURN_NO; memset(gszChatBoxInputString,0,sizeof(CHAR16)*255); bHandled = true; } if( InputEvent.usParam == ENTER ) { // retrieve the string from the text box Get16BitStringFromField( 0, gszChatBoxInputString, 255 ); // these indexes are based on the order created // Exit messagebox gChatBox.bHandled = MSG_BOX_RETURN_OK; bHandled = true; } // OJW - 20090403 - add better key control UINT8 ubDesiredMessageIndex; UINT8 ubNumMessages; ubNumMessages = GetRangeOfChatLogMessages(); if ( ubNumMessages > MAX_CHATLOG_MESSAGES ) { if (InputEvent.usParam == PGUP) { //move up a page ChatScreenMsgScrollUp( MAX_CHATLOG_MESSAGES ); bHandled = true; } if (InputEvent.usParam == PGDN) { // move down a page ChatScreenMsgScrollDown( MAX_CHATLOG_MESSAGES ); bHandled = true; } if (InputEvent.usParam == HOME) { // move to the beginning ChangeCurrentChatScreenMessageIndex( 0 ); bHandled = true; } if (InputEvent.usParam == END) { // move to end ubDesiredMessageIndex = ubNumMessages - MAX_CHATLOG_MESSAGES; ChangeCurrentChatScreenMessageIndex( ubDesiredMessageIndex ); bHandled = true; } } } // send to text box if (!bHandled) HandleTextInput( &InputEvent ); } if ( gChatBox.bHandled ) { SetRenderFlags( RENDER_FLAG_FULL ); return( ExitChatBox( gChatBox.bHandled ) ); } return( MP_CHAT_SCREEN ); }
BOOLEAN EnterAimSort() { VOBJECT_DESC VObjectDesc; UINT8 ubCurNumber=0; UINT16 ubWidth; AimSortCheckBoxLoc[0] = AIM_SORT_SORT_BY_X + 9; AimSortCheckBoxLoc[1] = AIM_SORT_SORT_BY_Y + 34; AimSortCheckBoxLoc[2] = AIM_SORT_SORT_BY_X + 9; AimSortCheckBoxLoc[3] = AIM_SORT_SORT_BY_Y + 47; AimSortCheckBoxLoc[4] = AIM_SORT_SORT_BY_X + 9; AimSortCheckBoxLoc[5] = AIM_SORT_SORT_BY_Y + 60; AimSortCheckBoxLoc[6] = AIM_SORT_SORT_BY_X + 105; AimSortCheckBoxLoc[7] = AIM_SORT_SORT_BY_Y + 34; AimSortCheckBoxLoc[8] = AIM_SORT_SORT_BY_X + 105; AimSortCheckBoxLoc[9] = AIM_SORT_SORT_BY_Y + 47; AimSortCheckBoxLoc[10] = AIM_SORT_SORT_BY_X + 105; AimSortCheckBoxLoc[11] = AIM_SORT_SORT_BY_Y + 60; AimSortCheckBoxLoc[12] = AIM_SORT_SORT_BY_X + 201; AimSortCheckBoxLoc[13] = AIM_SORT_SORT_BY_Y + 34; AimSortCheckBoxLoc[14] = AIM_SORT_SORT_BY_X + 201; AimSortCheckBoxLoc[15] = AIM_SORT_SORT_BY_Y + 47; AimSortCheckBoxLoc[16] = AIM_SORT_SORT_BY_X + 201; AimSortCheckBoxLoc[17] = AIM_SORT_SORT_BY_Y + 60; AimSortCheckBoxLoc[18] = AIM_SORT_SORT_BY_X + 297; AimSortCheckBoxLoc[19] = AIM_SORT_SORT_BY_Y + 34; AimSortCheckBoxLoc[20] = AIM_SORT_SORT_BY_X + 297; AimSortCheckBoxLoc[21] = AIM_SORT_SORT_BY_Y + 47; AimSortCheckBoxLoc[22] = AIM_SORT_SORT_BY_X + 297; AimSortCheckBoxLoc[23] = AIM_SORT_SORT_BY_Y + 60; AimSortCheckBoxLoc[24] = AIM_SORT_SORT_BY_X + 9; AimSortCheckBoxLoc[25] = AIM_SORT_SORT_BY_Y + 21; //Ascending & Descending Check Box AimSortCheckBoxLoc[26] = AIM_SORT_SORT_BY_X + 372; AimSortCheckBoxLoc[27] = AIM_SORT_SORT_BY_Y + 4; AimSortCheckBoxLoc[28] = AIM_SORT_SORT_BY_X + 372; AimSortCheckBoxLoc[29] = AIM_SORT_SORT_BY_Y + 17; InitAimDefaults(); // load the SortBy box graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\SortBy.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSortByBox)); // load the ToAlumni graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_TOALUMNI ); CHECKF(AddVideoObject(&VObjectDesc, &guiToAlumni)); // load the ToMugShots graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_TOMUGSHOTS ); CHECKF(AddVideoObject(&VObjectDesc, &guiToMugShots)); // load the ToStats graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_TOSTATS ); CHECKF(AddVideoObject(&VObjectDesc, &guiToStats)); // load the SelectLight graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\SelectLight.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSelectLight)); //** Mouse Regions ** //Mouse region for the ToMugShotRegion MSYS_DefineRegion( &gSelectedToMugShotRegion, AIM_SORT_TO_MUGSHOTS_X, AIM_SORT_TO_MUGSHOTS_Y, (AIM_SORT_TO_MUGSHOTS_X + AIM_SORT_TO_MUGSHOTS_SIZE), (AIM_SORT_TO_MUGSHOTS_Y + AIM_SORT_TO_MUGSHOTS_SIZE), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectToMugShotRegionCallBack ); MSYS_AddRegion(&gSelectedToMugShotRegion); //Mouse region for the ToStatsRegion MSYS_DefineRegion( &gSelectedToStatsRegion, AIM_SORT_TO_STATS_X, AIM_SORT_TO_STATS_Y, (AIM_SORT_TO_STATS_X + AIM_SORT_TO_STATS_SIZE), (AIM_SORT_TO_STATS_Y + AIM_SORT_TO_STATS_SIZE), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectToStatsRegionCallBack ); MSYS_AddRegion(&gSelectedToStatsRegion); //Mouse region for the ToArchiveRegion MSYS_DefineRegion( &gSelectedToArchiveRegion, AIM_SORT_TO_ALUMNI_X, AIM_SORT_TO_ALUMNI_Y, (AIM_SORT_TO_ALUMNI_X + AIM_SORT_TO_ALUMNI_SIZE), (AIM_SORT_TO_ALUMNI_Y + AIM_SORT_TO_ALUMNI_SIZE), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectToArchiveRegionCallBack ); MSYS_AddRegion(&gSelectedToArchiveRegion); //CURSOR_WWW MSYS_NO_CURSOR ubCurNumber = 0; //Mouse region for the Price Check Box ubWidth = StringPixLength( AimSortText[PRICE], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; MSYS_DefineRegion( &gSelectedPriceBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectPriceBoxRegionCallBack ); MSYS_AddRegion(&gSelectedPriceBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[EXPERIENCE], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Experience Check Box MSYS_DefineRegion( &gSelectedExpBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectExpBoxRegionCallBack ); MSYS_AddRegion(&gSelectedExpBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMARKSMANSHIP], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Markmanship Check Box MSYS_DefineRegion( &gSelectedMarkBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMarkBoxRegionCallBack ); MSYS_AddRegion(&gSelectedMarkBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMECHANICAL], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MECHANICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Mechanical Check Box MSYS_DefineRegion( &gSelectedMechanicalBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMechanicalBoxRegionCallBack ); MSYS_AddRegion(&gSelectedMechanicalBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMEXPLOSIVES], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MECHANICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Explosive Check Box MSYS_DefineRegion( &gSelectedExplosiveBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectExplosiveBoxRegionCallBack ); MSYS_AddRegion(&gSelectedExplosiveBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMEDICAL], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MECHANICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Medical Check Box MSYS_DefineRegion( &gSelectedMedicalBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMedicalBoxRegionCallBack ); MSYS_AddRegion(&gSelectedMedicalBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMHEALTH], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_HEALTH_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Health Check Box MSYS_DefineRegion( &gSelectedHealthBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectHealthBoxRegionCallBack ); MSYS_AddRegion(&gSelectedHealthBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMAGILITY], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_HEALTH_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Agility Check Box MSYS_DefineRegion( &gSelectedAgilityBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectAgilityBoxRegionCallBack ); MSYS_AddRegion(&gSelectedAgilityBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMDEXTERITY], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_HEALTH_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Dexterity Check Box MSYS_DefineRegion( &gSelectedDexterityBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectDexterityBoxRegionCallBack ); MSYS_AddRegion(&gSelectedDexterityBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMSTRENGTH], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_STRENGTH_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Strength Check Box MSYS_DefineRegion( &gSelectedStrengthBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectStrengthBoxRegionCallBack ); MSYS_AddRegion(&gSelectedStrengthBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMLEADERSHIP], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_STRENGTH_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Leadership Check Box MSYS_DefineRegion( &gSelectedLeadershipBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectLeadershipBoxRegionCallBack ); MSYS_AddRegion(&gSelectedLeadershipBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMWISDOM], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_STRENGTH_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Wisdom Check Box MSYS_DefineRegion( &gSelectedWisdomBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectWisdomBoxRegionCallBack ); MSYS_AddRegion(&gSelectedWisdomBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[NAME], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_NAME_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Name Check Box MSYS_DefineRegion( &gSelectedNameBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectNameBoxRegionCallBack ); MSYS_AddRegion(&gSelectedNameBoxRegion); ubCurNumber+=2; ubWidth = AimSortCheckBoxLoc[ ubCurNumber ] - StringPixLength( AimSortText[ASCENDING], AIM_SORT_FONT_SORT_TEXT) - 6; //Mouse region for the Ascend Check Box MSYS_DefineRegion( &gSelectedAscendBoxRegion, ubWidth , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)(AimSortCheckBoxLoc[ ubCurNumber ] + AIM_SORT_CHECKBOX_SIZE), (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectAscendBoxRegionCallBack ); MSYS_AddRegion(&gSelectedAscendBoxRegion); ubCurNumber+=2; ubWidth = AimSortCheckBoxLoc[ ubCurNumber ] - StringPixLength( AimSortText[DESCENDING], AIM_SORT_FONT_SORT_TEXT) - 6; //Mouse region for the Descend Check Box MSYS_DefineRegion( &gSelectedDescendBoxRegion, ubWidth, AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)(AimSortCheckBoxLoc[ ubCurNumber ] + AIM_SORT_CHECKBOX_SIZE), (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectDescendBoxRegionCallBack ); MSYS_AddRegion(&gSelectedDescendBoxRegion); InitAimMenuBar(); RenderAimSort(); return( TRUE ); }
void HandleBeginScreenTextEvent( UINT32 uiKey ) { // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen // or delete it switch( uiKey ) { case ( BACKSPACE ): switch( ubTextEnterMode ) { case( FULL_NAME_MODE ): if( uiFullNameCharacterPosition >= 0 ) { // decrement StringPosition if( uiFullNameCharacterPosition > 0) { uiFullNameCharacterPosition-=1; } // null out char pFullNameString[uiFullNameCharacterPosition] = 0; // move cursor back by sizeof char uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); // string has been altered, redisplay fNewCharInString = TRUE; } break; case ( NICK_NAME_MODE ): if( uiNickNameCharacterPosition >= 0 ) { // decrement StringPosition if( uiNickNameCharacterPosition > 0 ) uiNickNameCharacterPosition-=1; // null out char pNickNameString[uiNickNameCharacterPosition] = 0; // move cursor back by sizeof char uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); // string has been altered, redisplay fNewCharInString = TRUE; } break; } break; default: if( uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' || uiKey == ' ' ) { // if the current string position is at max or great, do nothing switch( ubTextEnterMode ) { case( FULL_NAME_MODE ): if( uiFullNameCharacterPosition >= MAX_FULL_NAME ) { break; } else { if(uiFullNameCharacterPosition < 1 ) { uiFullNameCharacterPosition = 0; } // make sure we haven't moved too far if( ( uiFullNameCursorPosition + StringPixLength( &( ( CHAR16 )uiKey ), FONT14ARIAL ) ) > FULL_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X) { // do nothing for now, when pop up is in place, display break; } // valid char, capture and convert to CHAR16 pFullNameString[uiFullNameCharacterPosition] = ( CHAR16 )uiKey; // null out next char position pFullNameString[uiFullNameCharacterPosition + 1] = 0; // move cursor position ahead uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); // increment string position uiFullNameCharacterPosition +=1; // string has been altered, redisplay fNewCharInString = TRUE; } break; case ( NICK_NAME_MODE ): if( uiNickNameCharacterPosition >= MAX_NICK_NAME ) { break; } else { if(uiNickNameCharacterPosition == -1) { uiNickNameCharacterPosition = 0; } // make sure we haven't moved too far if( ( uiNickNameCursorPosition + StringPixLength( &( ( CHAR16 )uiKey ), FONT14ARIAL ) ) > NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X ) { // do nothing for now, when pop up is in place, display break; } // valid char, capture and convert to CHAR16 pNickNameString[uiNickNameCharacterPosition] = ( CHAR16 )uiKey; // null out next char position pNickNameString[uiNickNameCharacterPosition + 1] = 0; // move cursor position ahead uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); // increment string position uiNickNameCharacterPosition +=1; // string has been altered, redisplay fNewCharInString = TRUE; } break; } } break; } return; }
void RenderSelectedItemBlownUp() { UINT32 uiVideoObjectIndex; HVOBJECT hVObject; INT16 sScreenX, sScreenY, xp, yp; ITEM_POOL *pItemPool; UINT16 szItemName[ SIZE_ITEM_NAME ]; INT32 i; INT16 sWidth, sHeight, sOffsetX, sOffsetY; GetGridNoScreenPos( gsItemGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY > 340 ) return; //Display the enlarged item graphic uiVideoObjectIndex = GetInterfaceGraphicForItem( &Item[ gpItem->usItem ] ); GetVideoObject( &hVObject, uiVideoObjectIndex ); sWidth = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usWidth; sOffsetX = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetX; xp = sScreenX + (40 - sWidth - sOffsetX*2) / 2; sHeight = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usHeight; sOffsetY = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetY; yp = sScreenY + (20 - sHeight - sOffsetY*2) / 2; BltVideoObjectOutlineFromIndex( FRAME_BUFFER, uiVideoObjectIndex, Item[ gpItem->usItem ].ubGraphicNum, xp, yp, Get16BPPColor(FROMRGB(0, 140, 170)), TRUE ); //Display the item name above it SetFont( FONT10ARIAL ); SetFontForeground( FONT_YELLOW ); SetFontShadow( FONT_NEARBLACK ); if( gpItem->usItem == ACTION_ITEM || gpItem->usItem == SWITCH ) { BuildTriggerName( gpItem, szItemName ); } else if( Item[ gpItem->usItem ].usItemClass == IC_KEY ) { swprintf( szItemName, L"%S", LockTable[ gpItem->ubKeyID ].ubEditorName ); } else { LoadItemInfo( gpItem->usItem, szItemName, NULL ); } xp = sScreenX - (StringPixLength( szItemName, FONT10ARIAL ) - 40) / 2; yp -= 10; mprintf( xp, yp, szItemName ); if( gpItem->usItem == ACTION_ITEM ) { UINT16 *pStr; pStr = GetActionItemName( gpItem ); xp = sScreenX - (StringPixLength( pStr, FONT10ARIALBOLD ) - 40) / 2; yp += 10; SetFont( FONT10ARIALBOLD ); SetFontForeground( FONT_LTKHAKI ); mprintf( xp, yp, pStr ); SetFontForeground( FONT_YELLOW ); } //Count the number of items in the current pool, and display that. i = 0; GetItemPool( gsItemGridNo, &pItemPool, 0 ); Assert( pItemPool ); while( pItemPool ) { i++; pItemPool = pItemPool->pNext; } xp = sScreenX; yp = sScreenY + 10; mprintf( xp, yp, L"%d", i ); //If the item is hidden, render a blinking H (just like DG) if( gWorldItems[ gpItemPool->iItemIndex ].bVisible == HIDDEN_ITEM || gWorldItems[ gpItemPool->iItemIndex ].bVisible == BURIED ) { SetFont( FONT10ARIALBOLD ); if( GetJA2Clock() % 1000 > 500 ) { SetFontForeground( 249 ); } mprintf( sScreenX + 16, sScreenY + 7, L"H" ); InvalidateRegion( sScreenX + 16, sScreenY + 7, sScreenX + 24, sScreenY + 27 ); } }
INT16 WFStringPixLength( STR16 string,INT32 UseFont ) { return( StringPixLength( string, UseFont ) ); }
INT32 DoChatBox( bool bIncludeChatLog, const STR16 zString, UINT32 uiExitScreen, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) { VSURFACE_DESC vs_desc; UINT16 usTextBoxWidth; UINT16 usTextBoxHeight; UINT16 usYMargin; SGPRect aRect; UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; UINT8 *pDestBuf, *pSrcBuf; INT16 sButtonX, sButtonY; UINT8 ubMercBoxBackground = BASIC_MERC_POPUP_BACKGROUND, ubMercBoxBorder = BASIC_MERC_POPUP_BORDER; UINT8 ubFontColor, ubFontShadowColor; UINT16 usCursor; INT32 iId = -1; // clear the ouput string memset(gszChatBoxInputString,0,sizeof(CHAR16)*255); gIncludeChatLog = bIncludeChatLog; GetMousePos( &pOldMousePosition ); if (bIncludeChatLog) usYMargin = CHATBOX_Y_MARGIN_LOG; else usYMargin = CHATBOX_Y_MARGIN_NOLOG; //this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer gfDontOverRideSaveBuffer = TRUE; SetCurrentCursorFromDatabase( CURSOR_NORMAL ); if( gChatBox.BackRegion.uiFlags & MSYS_REGION_EXISTS ) { return( 0 ); } // set style ubMercBoxBackground = DIALOG_MERC_POPUP_BACKGROUND; ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER; // Add button images gChatBox.iButtonImages = LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,0,-1,1,-1 ); ubFontColor = CHATBOX_FONT_COLOR; ubFontShadowColor = DEFAULT_SHADOW; usCursor = CURSOR_NORMAL; // Use default! aRect.iTop = 0; aRect.iLeft = 0; aRect.iBottom = SCREEN_HEIGHT; aRect.iRight = SCREEN_WIDTH; // Set some values! //gChatBox.usFlags = usFlags; gChatBox.uiExitScreen = uiExitScreen; gChatBox.ExitCallback = ReturnCallback; gChatBox.fRenderBox = TRUE; gChatBox.bHandled = 0; // Init message box if (bIncludeChatLog) // we need a string just long enough to give 1 line, but max length of the box, we render the chatlog over this string so well never see it. DONT DELETE ANY SPACES gChatBox.iBoxId = PrepareMercPopupBox( iId, ubMercBoxBackground, ubMercBoxBorder, L"A string that will be hidden, ", CHATBOX_WIDTH, CHATBOX_X_MARGIN, usYMargin, CHATBOX_Y_MARGIN_BOTTOM, &usTextBoxWidth, &usTextBoxHeight ); else gChatBox.iBoxId = PrepareMercPopupBox( iId, ubMercBoxBackground, ubMercBoxBorder, zString, CHATBOX_WIDTH, CHATBOX_X_MARGIN, usYMargin, CHATBOX_Y_MARGIN_BOTTOM, &usTextBoxWidth, &usTextBoxHeight ); if( gChatBox.iBoxId == -1 ) { #ifdef JA2BETAVERSION AssertMsg( 0, "Failed in DoMessageBox(). Probable reason is because the string was too large to fit in max message box size." ); #endif return 0; } // Save height,width gChatBox.usWidth = usTextBoxWidth; gChatBox.usHeight = usTextBoxHeight; // Determine position ( centered in rect ) gChatBox.sX = (INT16)( ( ( ( aRect.iRight - aRect.iLeft ) - usTextBoxWidth ) / 2 ) + aRect.iLeft ); gChatBox.sY = (INT16)( ( ( ( aRect.iBottom - aRect.iTop ) - usTextBoxHeight ) / 2 ) + aRect.iTop ); if ( guiCurrentScreen == GAME_SCREEN ) { gfStartedFromGameScreen = TRUE; } if ( (fInMapMode == TRUE ) ) { // fMapExitDueToMessageBox = TRUE; gfStartedFromMapScreen = TRUE; fMapPanelDirty = TRUE; } // Set pending screen SetPendingNewScreen( MP_CHAT_SCREEN); // Init save buffer vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; vs_desc.usWidth = usTextBoxWidth; vs_desc.usHeight = usTextBoxHeight; vs_desc.ubBitDepth = 16; if( AddVideoSurface( &vs_desc, &gChatBox.uiSaveBuffer) == FALSE ) { return( - 1 ); } //Save what we have under here... pDestBuf = LockVideoSurface( gChatBox.uiSaveBuffer, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES); Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0 , 0, gChatBox.sX , gChatBox.sY, usTextBoxWidth, usTextBoxHeight ); UnLockVideoSurface( gChatBox.uiSaveBuffer ); UnLockVideoSurface( FRAME_BUFFER ); // Create top-level mouse region MSYS_DefineRegion( &(gChatBox.BackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, usCursor, MSYS_NO_CALLBACK, ChatBoxClickCallback ); // Add region MSYS_AddRegion(&(gChatBox.BackRegion) ); // findout if cursor locked, if so, store old params and store, restore when done if( IsCursorRestricted() ) { fCursorLockedToArea = TRUE; GetRestrictedClipCursor( &ChatBoxRestrictedCursorRegion ); FreeMouseCursor( ); } // vars for positioning controls on the chatbox int usPosX = 0; int usPosY = gChatBox.sY + GetFontHeight(CHATBOX_FONT_TITLE) + CHATBOX_Y_GAP + 5; if (bIncludeChatLog) { // CREATE BUTTONS AND IMAGES FOR CHATLOG VOBJECT_DESC VObjectDesc; // will create buttons for interface bottom VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP( "INTERFACE\\mpchatbox.sti", VObjectDesc.ImageFile ); if( !AddVideoObject( &VObjectDesc, &guiCHATLOGIMG ) ) Assert( false ); gChatMessageLogRegion.iTop = usPosY; gChatMessageLogRegion.iLeft = gChatBox.sX + (CHATBOX_X_MARGIN / 2); gChatMessageLogRegion.iBottom = usPosY + CHATBOX_LOG_HEIGHT; gChatMessageLogRegion.iRight = gChatMessageLogRegion.iLeft + CHATBOX_LOG_WIDTH; // SETUP SCROLLING AREA BOUNDS CHATLOG_SCROLL_AREA_START_Y = gChatMessageLogRegion.iTop+20; CHATLOG_SCROLL_AREA_END_Y = gChatMessageLogRegion.iBottom-20; CHATLOG_SCROLL_AREA_HEIGHT = ( CHATLOG_SCROLL_AREA_END_Y - CHATLOG_SCROLL_AREA_START_Y + 1 ); CHATLOG_SCROLL_AREA_START_X = gChatMessageLogRegion.iRight + CHATBOX_SLIDER_GAP + 1; CHATLOG_SCROLL_AREA_END_X = gChatMessageLogRegion.iRight + CHATBOX_SLIDER_GAP + 1 + CHAT_SLIDER_WIDTH; CHATLOG_SCROLL_AREA_WIDTH = ( CHATLOG_SCROLL_AREA_END_X - CHATLOG_SCROLL_AREA_START_X + 1 ); CHAT_SLIDER_BAR_RANGE = ( CHATLOG_SCROLL_AREA_HEIGHT - CHAT_SLIDER_HEIGHT ); LoadChatLogSliderBar(); // Load Scroll button images guiChatLogScrollButtonsImage[ CHAT_SCROLL_MESSAGE_UP ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,11,4,-1,6,-1 ); guiChatLogScrollButtonsImage[ CHAT_SCROLL_MESSAGE_DOWN ]= LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti" ,12,5,-1,7,-1 ); // Create buttons guiChatLogScrollButtons[ CHAT_SCROLL_MESSAGE_UP ] = QuickCreateButton( guiChatLogScrollButtonsImage[ CHAT_SCROLL_MESSAGE_UP ], gChatMessageLogRegion.iRight + CHATBOX_SLIDER_GAP + 2 , gChatMessageLogRegion.iTop + 1 , BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageUpChatLogCallback); guiChatLogScrollButtons[ CHAT_SCROLL_MESSAGE_DOWN ] = QuickCreateButton( guiChatLogScrollButtonsImage[ CHAT_SCROLL_MESSAGE_DOWN ], gChatMessageLogRegion.iRight + CHATBOX_SLIDER_GAP + 2, gChatMessageLogRegion.iBottom - 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageDownChatLogCallback); usPosY = gChatBox.sY + CHATBOX_Y_MARGIN_LOG + (CHATBOX_Y_GAP * 2) + GetFontHeight(FONT12ARIAL) + 5; // END CREATE CHATLOG } else usPosY = gChatBox.sY + CHATBOX_Y_MARGIN_NOLOG + (CHATBOX_Y_GAP * 2) + GetFontHeight(FONT12ARIAL); // get the middle of the box UINT16 middleBox = ( usTextBoxWidth / 2 ); // CREATE SEND TO ALLIES / ALL TOGGLES // send to all int toggleWidth = 32 + StringPixLength( gzMPChatToggleText[ 0 ], CHATBOX_FONT_TOGGLE ); usPosX = gChatBox.sX + ((middleBox - toggleWidth)/2); guiChatToggles[ 0 ] = CreateCheckBoxButton( usPosX, usPosY, "INTERFACE\\OptionsCheckBoxes_12x12.sti", MSYS_PRIORITY_HIGHEST, BtnChatTogglesCallback ); MSYS_SetBtnUserData( guiChatToggles[ 0 ], 0, 0 ); // send to allies toggleWidth = 32 + StringPixLength( gzMPChatToggleText[ 1 ], CHATBOX_FONT_TOGGLE ); usPosX = gChatBox.sX + middleBox + ((middleBox - toggleWidth)/2); guiChatToggles[ 1 ] = CreateCheckBoxButton( usPosX, usPosY, "INTERFACE\\OptionsCheckBoxes_12x12.sti", MSYS_PRIORITY_HIGHEST, BtnChatTogglesCallback ); MSYS_SetBtnUserData( guiChatToggles[ 1 ], 0, 1 ); usPosY += CHATBOX_TOGGLE_HEIGHT + CHATBOX_Y_GAP; // SET DEFAULT FLAGGED if (gbChatSendToAll) ButtonList[ guiChatToggles[ 0 ] ]->uiFlags |= BUTTON_CLICKED_ON; else ButtonList[ guiChatToggles[ 1 ] ]->uiFlags |= BUTTON_CLICKED_ON; // END CREATE TOGGLES // CREATE TEXT INPUT BOX InitTextInputMode(); // API call to initialise text input mode for this screen // does not mean we are inputting text right away // Player Name field SetTextInputCursor( CUROSR_IBEAM_WHITE ); SetTextInputFont( (UINT16) FONT12ARIALFIXEDWIDTH ); //FONT12ARIAL //FONT12ARIALFIXEDWIDTH Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 0, 0, 0) ) ); SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) ); SetTextInputRegularColors( FONT_WHITE, 2 ); SetTextInputHilitedColors( 2, FONT_WHITE, FONT_WHITE ); SetCursorColor( Get16BPPColor(FROMRGB(255, 255, 255) ) ); usPosX = gChatBox.sX + (CHATBOX_X_MARGIN / 2); //Add Player Name textbox AddTextInputField( usPosX , usPosY , usTextBoxWidth - CHATBOX_X_MARGIN, 20, MSYS_PRIORITY_HIGH+2, gszChatBoxInputString, 255, INPUTTYPE_ASCII );//23 gChatTextBoxRegion.iTop = usPosY; gChatTextBoxRegion.iLeft = usPosX; gChatTextBoxRegion.iBottom = usPosY+20; gChatTextBoxRegion.iRight = usPosX+usTextBoxWidth - CHATBOX_X_MARGIN; // exit text input mode in this screen and clean up text boxes SetActiveField( 0 ); usPosY += CHATBOX_INPUT_HEIGHT + CHATBOX_Y_GAP; // END CREATE TEXT INPUT BOX // CREATE OK AND CANCEL BUTTONS // get the button width UINT16 btnWidth = GetChatBoxButtonWidth( gChatBox.iButtonImages ); // Create OK Button sButtonX = middleBox + ((middleBox - btnWidth)/2); sButtonY = usTextBoxHeight - CHATBOX_BUTTON_HEIGHT - 10; gChatBox.uiOKButton = CreateIconAndTextButton( gChatBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, CHATBOX_FONT_COLOR, ubFontShadowColor, CHATBOX_FONT_COLOR, ubFontShadowColor, TEXT_CJUSTIFIED, (INT16)(gChatBox.sX + sButtonX ), (INT16)(gChatBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKChatBoxCallback ); SetButtonCursor(gChatBox.uiOKButton, usCursor); ForceButtonUnDirty( gChatBox.uiOKButton ); // move the mouse over the ok button if( gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] == FALSE ) { SimulateMouseMovement( ( gChatBox.sX + sButtonX + 27 ), ( gChatBox.sY + sButtonY + 10) ); } // Create Cancel Button sButtonX = ((middleBox - btnWidth)/2); sButtonY = usTextBoxHeight - CHATBOX_BUTTON_HEIGHT - 10; gChatBox.uiNOButton = CreateIconAndTextButton( gChatBox.iButtonImages, pMessageStrings[ MSG_CANCEL ], FONT10ARIAL, CHATBOX_FONT_COLOR, ubFontShadowColor, CHATBOX_FONT_COLOR, ubFontShadowColor, TEXT_CJUSTIFIED, (INT16)(gChatBox.sX + sButtonX ), (INT16)(gChatBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)CancelChatBoxCallback ); SetButtonCursor(gChatBox.uiNOButton, usCursor); ForceButtonUnDirty( gChatBox.uiNOButton ); // END CREATE BUTTONS #if 0 gChatBox.fWasPaused = GamePaused(); if (!gChatBox.fWasPaused) { InterruptTime(); PauseGame(); LockPauseState( 1 ); // Pause timers as well.... PauseTime( TRUE ); } #endif // Save mouse restriction region... GetRestrictedClipCursor( &gOldCursorLimitRectangle ); FreeMouseCursor( ); gfNewChatBox = TRUE; gfInChatBox = TRUE; return( iId ); }
void EnterIMPPrejudice( void ) { RenderProfileBackGround(); giIMPPrejudiceFinishButtonImage = LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); giIMPPrejudiceFinishButton = CreateIconAndTextButton( giIMPPrejudiceFinishButtonImage, pImpButtonText[ 24 ], FONT12ARIAL, FONT_WHITE, DEFAULT_SHADOW, FONT_WHITE, DEFAULT_SHADOW, TEXT_CJUSTIFIED, LAPTOP_SCREEN_UL_X + ( 350 ), LAPTOP_SCREEN_WEB_UL_Y + ( 340 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPrejudiceFinishCallback ); SetButtonCursor( giIMPPrejudiceFinishButton, CURSOR_WWW); UINT16 usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOULOOK], FONT12ARIAL ) + 10; UINT16 usY = LAPTOP_SCREEN_WEB_UL_Y + 43; ////////////////// DropDown_Appearance ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_Appearance; for(UINT8 i = 0; i < NUM_APPEARANCES; ++i) entryvecDropDown_Appearance.push_back( std::make_pair(i, szAppearanceText[i]) ); DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().SetEntries(entryvecDropDown_Appearance); DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_APPEARANCE] ); DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().Create(usX, usY); ////////////////// DropDown_Appearance ////////////////////////// usX = DropDownTemplate<DROPDOWNNR_APPEARANCE>::getInstance().GetLastX() + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_ANDAPPEARANCEIS], FONT12ARIAL ) + 20; ////////////////// DropDown_AppearanceCare ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_AppearanceCare; for(UINT8 i = 0; i < NUM_CARELEVELS; ++i) entryvecDropDown_AppearanceCare.push_back( std::make_pair(i, szCareLevelText[i]) ); DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().SetEntries(entryvecDropDown_AppearanceCare); DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_APPEARANCECARE] ); DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) ); DropDownTemplate<DROPDOWNNR_APPEARANCECARE>::getInstance().Create(usX, usY); ////////////////// DropDown_AppearanceCare ////////////////////////// usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOUHAVE], FONT12ARIAL ) + 10; usY += DROPDOWN_MARKUP_Y; ////////////////// DropDown_Refinement ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_Refinement; for(UINT8 i = 0; i < NUM_REFINEMENT; ++i) entryvecDropDown_Refinement.push_back( std::make_pair(i, szRefinementText[i]) ); DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().SetEntries(entryvecDropDown_Refinement); DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_REFINEMENT] ); DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().Create(usX, usY); ////////////////// DropDown_Refinement ////////////////////////// usX = DropDownTemplate<DROPDOWNNR_REFINEMENT>::getInstance().GetLastX() + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_ANDCARE], FONT12ARIAL ) + 20; ////////////////// DropDownTemplate<DROPDOWNNR_REFINEMENTCARE> ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_RefinementCare; for(UINT8 i = 0; i < NUM_CARELEVELS; ++i) entryvecDropDown_RefinementCare.push_back( std::make_pair(i, szCareLevelText[i]) ); DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().SetEntries(entryvecDropDown_RefinementCare); DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_REFINEMENTCARE] ); DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) ); DropDownTemplate<DROPDOWNNR_REFINEMENTCARE>::getInstance().Create(usX, usY); ////////////////// DropDownTemplate<DROPDOWNNR_REFINEMENTCARE> ////////////////////////// usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], FONT12ARIAL ) + 10; usY += DROPDOWN_MARKUP_Y; ////////////////// DropDownTemplate<DROPDOWNNR_NATIONALITY> ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_Nationality; for(UINT8 i = 0; i < NUM_NATIONALITIES; ++i) entryvecDropDown_Nationality.push_back( std::make_pair(i, szNationalityText[i]) ); DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().SetEntries(entryvecDropDown_Nationality); DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_NATIONALITY] ); DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().Create(usX, usY); ////////////////// DropDownTemplate<DROPDOWNNR_NATIONALITY> ////////////////////////// usX = DropDownTemplate<DROPDOWNNR_NATIONALITY>::getInstance().GetLastX() + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_ADHATEEVERYONE], FONT12ARIAL ) + 20; ////////////////// DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY> ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_HatedNationality; // we can also hate no nation at all... entryvecDropDown_HatedNationality.push_back( std::make_pair(-1, szNationalityText_Special[1]) ); for(UINT8 i = 0; i < NUM_NATIONALITIES; ++i) entryvecDropDown_HatedNationality.push_back( std::make_pair(i, szNationalityText[i]) ); DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY>::getInstance().SetEntries(entryvecDropDown_HatedNationality); DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_HATEDNATIONALITY] ); DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY>::getInstance().Create(usX, usY); ////////////////// DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY> ////////////////////////// usX = DropDownTemplate<DROPDOWNNR_HATEDNATIONALITY>::getInstance().GetLastX() + 5; ////////////////// DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE> ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_HatedNationalityCare; for(UINT8 i = 0; i < NUM_CARELEVELS; ++i) entryvecDropDown_HatedNationalityCare.push_back( std::make_pair(i, szCareLevelText[i]) ); DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE>::getInstance().SetEntries(entryvecDropDown_HatedNationalityCare); DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_HATEDNATIONALITYCARE] ); DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) ); DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE>::getInstance().Create(usX, usY); ////////////////// DropDownTemplate<DROPDOWNNR_HATEDNATIONALITYCARE> ////////////////////////// usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], FONT12ARIAL ) + 10; usY += DROPDOWN_MARKUP_Y; ////////////////// DropDownTemplate<DROPDOWNNR_RACIST> ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_Racist; for(UINT8 i = 0; i < NUM_RACIST; ++i) entryvecDropDown_Racist.push_back( std::make_pair(i, szRacistText[i]) ); DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().SetEntries(entryvecDropDown_Racist); DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_RACIST] ); DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) ); DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().Create(usX, usY); ////////////////// DropDownTemplate<DROPDOWNNR_RACIST> ////////////////////////// usX = DropDownTemplate<DROPDOWNNR_RACIST>::getInstance().GetLastX() + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_RACISTAGAINSTNON], FONT12ARIAL ) + 10; ////////////////// DropDownTemplate<DROPDOWNNR_RACE> ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_Race; for(UINT8 i = 0; i < NUM_RACES; ++i) entryvecDropDown_Race.push_back( std::make_pair(i, szRaceText[i]) ); DropDownTemplate<DROPDOWNNR_RACE>::getInstance().SetEntries(entryvecDropDown_Race); DropDownTemplate<DROPDOWNNR_RACE>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_RACE] ); DropDownTemplate<DROPDOWNNR_RACE>::getInstance().Create(usX, usY); ////////////////// DropDownTemplate<DROPDOWNNR_RACE> ////////////////////////// usX = LAPTOP_SCREEN_UL_X + 5 + StringPixLength ( szPersonalityDisplayText[PERSONALITYTEXT_YOUARE], FONT12ARIAL ) + 10; usY += DROPDOWN_MARKUP_Y; ////////////////// DropDownTemplate<DROPDOWNNR_SEXIST> ////////////////////////// std::vector<std::pair<INT16, STR16> > entryvecDropDown_Sexist; for(UINT8 i = 0; i < NUM_SEXIST; ++i) entryvecDropDown_Sexist.push_back( std::make_pair(i, szSexistText[i]) ); DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().SetEntries(entryvecDropDown_Sexist); DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().SetHelpText( szPersonalityHelpText[DROPDOWNNR_SEXIST] ); DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().SetColorLine( Get16BPPColor( FROMRGB( 38, 191, 60 ) ) ); DropDownTemplate<DROPDOWNNR_SEXIST>::getInstance().Create(usX, usY); ////////////////// DropDownTemplate<DROPDOWNNR_SEXIST> ////////////////////////// }
void RenderEditorInfo( ) { CHAR16 FPSText[ 50 ]; static INT32 iSpewWarning = 0; INT32 iMapIndexD; //dnl ch52 091009 SetFont(FONT12ARIAL); SetFontShadow(FONT_NEARBLACK); SetFontForeground(FONT_GRAY2); SetFontBackground(FONT_BLACK); //dnl ch1 101009 Display the mapindex position if(GetMouseMapPos(&iMapIndexD)) { INT16 sGridX, sGridY; GetMouseXY(&sGridX, &sGridY); swprintf(FPSText, L"%4d %4d %6d ", sGridX, sGridY, iMapIndexD); } else swprintf(FPSText, L" "); mprintfEditor( (UINT16)(iScreenWidthOffset + 50-StringPixLength( FPSText, FONT12POINT1 )/2), 2 * iScreenHeightOffset + 463, FPSText ); switch( iCurrentTaskbar ) { case TASK_OPTIONS: mprintf(iScreenWidthOffset+71+15, SCREEN_HEIGHT-117, iRenderEditorInfoText[0]);//dnl ch33 160909 if( !gfWorldLoaded || giCurrentTilesetID < 0 ) mprintf( iScreenWidthOffset + 260, 2 * iScreenHeightOffset + 445, iRenderEditorInfoText[1] ); else mprintf( iScreenWidthOffset + 260, 2 * iScreenHeightOffset + 445, iRenderEditorInfoText[2], gubFilename, gTilesets[ giCurrentTilesetID ].zName ); // TODO.MAP mprintf(iScreenWidthOffset+20, SCREEN_HEIGHT-40, iRenderEditorInfoText[3]); UpdateOptions(); break; case TASK_TERRAIN: // WANNE: Comment this two lines, because we always get an exception here. //if( gusSelectionType == LINESELECTION ) // swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 220, 2 * iScreenHeightOffset + 430, 60, 30 ); swprintf( FPSText, L"%d%%", gusSelectionDensity ); DrawEditorInfoBox( FPSText, FONT12POINT1, iScreenWidthOffset + 310, 2 * iScreenHeightOffset + 430, 40, 30 ); break; case TASK_ITEMS: RenderEditorItemsInfo(); UpdateItemStatsPanel(); break; case TASK_BUILDINGS: UpdateBuildingsInfo(); // WANNE: Comment this two lines, because we always get an exception here. //if( gusSelectionType == LINESELECTION ) // swprintf( wszSelType[LINESELECTION], L"%d", gusSelectionWidth ); DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 430, 60, 30 ); break; case TASK_MERCS: UpdateMercsInfo(); #ifdef JA113DEMO DisableButton (iEditorButton[ MERCS_CIVILIANTOGGLE ]); DisableButton (iEditorButton[ MERCS_CIVILIAN ]); #endif break; case TASK_MAPINFO: UpdateMapInfo(); // WANNE: EDITOR: Comment this two lines, because we always get an exception here! //if( gusSelectionType == LINESELECTION ) // swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 440, 2 * iScreenHeightOffset + 430, 60, 30 ); break; } }
BOOLEAN EnterAimSort() { VOBJECT_DESC VObjectDesc; UINT8 ubCurNumber=0; UINT16 ubWidth; UINT8 i; //Everytime into Aim Sort, reset array. for(i=0; i<MAX_NUMBER_MERCS; i++) { AimMercArray[i] = i; } InitAimDefaults(); // load the SortBy box graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\SortBy.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSortByBox)); // load the ToAlumni graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_TOALUMNI ); CHECKF(AddVideoObject(&VObjectDesc, &guiToAlumni)); // load the ToMugShots graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_TOMUGSHOTS ); CHECKF(AddVideoObject(&VObjectDesc, &guiToMugShots)); // load the ToStats graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; GetMLGFilename( VObjectDesc.ImageFile, MLG_TOSTATS ); CHECKF(AddVideoObject(&VObjectDesc, &guiToStats)); // load the SelectLight graphic and add it VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; FilenameForBPP("LAPTOP\\SelectLight.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiSelectLight)); //** Mouse Regions ** //Mouse region for the ToMugShotRegion MSYS_DefineRegion( &gSelectedToMugShotRegion, AIM_SORT_TO_MUGSHOTS_X, AIM_SORT_TO_MUGSHOTS_Y, (AIM_SORT_TO_MUGSHOTS_X + AIM_SORT_TO_MUGSHOTS_SIZE), (AIM_SORT_TO_MUGSHOTS_Y + AIM_SORT_TO_MUGSHOTS_SIZE), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectToMugShotRegionCallBack ); MSYS_AddRegion(&gSelectedToMugShotRegion); //Mouse region for the ToStatsRegion MSYS_DefineRegion( &gSelectedToStatsRegion, AIM_SORT_TO_STATS_X, AIM_SORT_TO_STATS_Y, (AIM_SORT_TO_STATS_X + AIM_SORT_TO_STATS_SIZE), (AIM_SORT_TO_STATS_Y + AIM_SORT_TO_STATS_SIZE), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectToStatsRegionCallBack ); MSYS_AddRegion(&gSelectedToStatsRegion); //Mouse region for the ToArhciveRegion MSYS_DefineRegion( &gSelectedToArchiveRegion, AIM_SORT_TO_ALUMNI_X, AIM_SORT_TO_ALUMNI_Y, (AIM_SORT_TO_ALUMNI_X + AIM_SORT_TO_ALUMNI_SIZE), (AIM_SORT_TO_ALUMNI_Y + AIM_SORT_TO_ALUMNI_SIZE), MSYS_PRIORITY_HIGH, CURSOR_WWW, MSYS_NO_CALLBACK, SelectToArchiveRegionCallBack ); MSYS_AddRegion(&gSelectedToArchiveRegion); //CURSOR_WWW MSYS_NO_CURSOR ubCurNumber = 0; //Mouse region for the Price Check Box ubWidth = StringPixLength( AimSortText[PRICE], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; MSYS_DefineRegion( &gSelectedPriceBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectPriceBoxRegionCallBack ); MSYS_AddRegion(&gSelectedPriceBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[EXPERIENCE], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Experience Check Box MSYS_DefineRegion( &gSelectedExpBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectExpBoxRegionCallBack ); MSYS_AddRegion(&gSelectedExpBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMARKSMANSHIP], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_PRICE_TEXT_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Markmanship Check Box MSYS_DefineRegion( &gSelectedMarkBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMarkBoxRegionCallBack ); MSYS_AddRegion(&gSelectedMarkBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMEDICAL], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MEDICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Medical Check Box MSYS_DefineRegion( &gSelectedMedicalBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMedicalBoxRegionCallBack ); MSYS_AddRegion(&gSelectedMedicalBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[EXPLOSIVES], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MEDICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Explosive Check Box MSYS_DefineRegion( &gSelectedExplosiveBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectExplosiveBoxRegionCallBack ); MSYS_AddRegion(&gSelectedExplosiveBoxRegion); ubCurNumber+=2; ubWidth = StringPixLength( AimSortText[AIMMECHANICAL], AIM_SORT_FONT_SORT_TEXT) + AimSortCheckBoxLoc[ ubCurNumber ] + (AIM_SORT_MEDICAL_X - AimSortCheckBoxLoc[ ubCurNumber ]) - 3; //Mouse region for the Mechanical Check Box MSYS_DefineRegion( &gSelectedMechanicalBoxRegion, AimSortCheckBoxLoc[ ubCurNumber ] , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)ubWidth, (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectMechanicalBoxRegionCallBack ); MSYS_AddRegion(&gSelectedMechanicalBoxRegion); ubCurNumber+=2; ubWidth = AimSortCheckBoxLoc[ ubCurNumber ] - StringPixLength( AimSortText[ASCENDING], AIM_SORT_FONT_SORT_TEXT) - 6; //Mouse region for the Ascend Check Box MSYS_DefineRegion( &gSelectedAscendBoxRegion, ubWidth , AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)(AimSortCheckBoxLoc[ ubCurNumber ] + AIM_SORT_CHECKBOX_SIZE), (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectAscendBoxRegionCallBack ); MSYS_AddRegion(&gSelectedAscendBoxRegion); ubCurNumber+=2; ubWidth = AimSortCheckBoxLoc[ ubCurNumber ] - StringPixLength( AimSortText[DESCENDING], AIM_SORT_FONT_SORT_TEXT) - 6; //Mouse region for the Descend Check Box MSYS_DefineRegion( &gSelectedDescendBoxRegion, ubWidth, AimSortCheckBoxLoc[ubCurNumber + 1] , (UINT16)(AimSortCheckBoxLoc[ ubCurNumber ] + AIM_SORT_CHECKBOX_SIZE), (UINT16)(AimSortCheckBoxLoc[ ubCurNumber + 1 ] + AIM_SORT_CHECKBOX_SIZE), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, SelectDescendBoxRegionCallBack ); MSYS_AddRegion(&gSelectedDescendBoxRegion); InitAimMenuBar(); RenderAimSort(); return( TRUE ); }