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 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 ); } }
void RenderMapEntryPointsAndLights() { INT16 sGridNo; INT16 sScreenX, sScreenY; INT32 i; if( gfSummaryWindowActive ) return; SetFont( FONT10ARIAL ); SetFontForeground( FONT_YELLOW ); SetFontShadow( FONT_NEARBLACK ); sGridNo = gMapInformation.sNorthGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"North Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sWestGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"West Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sEastGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"East Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sSouthGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"South Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sCenterGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"Center Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sIsolatedGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"Isolated Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } //Do the lights now. for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) { if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE ) { sGridNo = LightSprites[ i ].iY * WORLD_COLS + LightSprites[ i ].iX; GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= -50 && sScreenY < 300 && sScreenX >= -40 && sScreenX < 640 ) { if( LightSprites[ i ].uiFlags & LIGHT_PRIMETIME ) DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_ORANGE, L"Prime", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); else if( LightSprites[ i ].uiFlags & LIGHT_NIGHTTIME ) DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_RED, L"Night", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); else DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_YELLOW, L"24Hour", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } } }
/////////////////////////////// Trait Selection //////////////////////////////////////////// void TraitSelection::Setup( UINT32 aVal ) { Destroy(); SOLDIERTYPE * pSoldier = NULL; GetSoldier( &pSoldier, gusSelectedSoldier ); if ( pSoldier == NULL ) return; SetupPopup("TraitSelection"); POPUP_OPTION *pOption; CHAR16 pStr[300]; // create entries for the sub-menus for each trait const UINT8 num = 2; UINT8 traitarray[num]; traitarray[0] = RADIO_OPERATOR_NT; traitarray[1] = VARIOUSSKILLS; for ( int i = 0; i < num; ++i) { swprintf( pStr, gzMercSkillTextNew[traitarray[i]] ); pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Setup_SkillSelection, traitarray[i] ) ); // if we cannot perform this skill, grey it out if ( !HAS_SKILL_TRAIT(pSoldier, traitarray[i]) ) { // Set this option off. pOption->setAvail(new popupCallbackFunction<bool,void*>( &Popup_OptionOff, NULL )); } GetPopup()->addOption( *pOption ); } // cancel option swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_TraitSelection, 0 ) ); GetPopup()->addOption( *pOption ); // grab soldier's x,y screen position INT16 sX, sY; // sevenfm: changed TraitsMenu position from soldier to mouse //GetSoldierScreenPos( pSoldier, &sX, &sY ); GetGridNoScreenPos( sTraitsMenuTargetGridNo, gsInterfaceLevel, &sX, &sY ); if( sX < 0 ) sX = 0; if( sY < 0 ) sY = 0; usTraitMenuPosX = sX + 30; usTraitMenuPosY = sY; if ( ( usTraitMenuPosX + 400 ) > SCREEN_WIDTH ) usTraitMenuPosX = SCREEN_WIDTH - 400; if ( ( usTraitMenuPosY + 130 ) > SCREEN_HEIGHT ) usTraitMenuPosY = SCREEN_HEIGHT - 190; SetPos(usTraitMenuPosX, usTraitMenuPosY); }
void RenderMapEntryPointsAndLights() { INT32 sGridNo; INT16 sScreenX, sScreenY; INT32 i; if( gfSummaryWindowActive ) return; SetFont( FONT10ARIAL ); SetFontForeground( FONT_YELLOW ); SetFontShadow( FONT_NEARBLACK ); sGridNo = gMapInformation.sNorthGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, iRenderMapEntryPointsAndLightsText[0], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sWestGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, iRenderMapEntryPointsAndLightsText[1], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sEastGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, iRenderMapEntryPointsAndLightsText[2], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sSouthGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= ( - 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, iRenderMapEntryPointsAndLightsText[3], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sCenterGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, iRenderMapEntryPointsAndLightsText[4], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } sGridNo = gMapInformation.sIsolatedGridNo; if( sGridNo != -1 ) { GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, iRenderMapEntryPointsAndLightsText[5], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } //Do the lights now. for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) { if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE ) { // Check for light out of bounds. This actually happens in Drassen. if (LightSprites[ i ].iY < 0 || LightSprites[ i ].iY > WORLD_ROWS || LightSprites[ i ].iX < 0 || LightSprites[ i ].iX > WORLD_COLS) { LightSprites[ i ].uiFlags &= (~LIGHT_SPR_ACTIVE); continue; } sGridNo = LightSprites[ i ].iY * WORLD_COLS + LightSprites[ i ].iX; GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= (- 50) && sScreenY < (2 * iScreenHeightOffset + 300) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) { if( LightSprites[ i ].uiFlags & LIGHT_PRIMETIME ) DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_ORANGE, iRenderMapEntryPointsAndLightsText[6], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); else if( LightSprites[ i ].uiFlags & LIGHT_NIGHTTIME ) DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_RED, iRenderMapEntryPointsAndLightsText[7], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); else DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_YELLOW, iRenderMapEntryPointsAndLightsText[8], FONT_BLACK, TRUE, CENTER_JUSTIFIED ); } } } }