static void ARX_INTERFACE_RenderCursorInternal(bool flag) { if(SelectSpellTargetCursorRender()) { return; } if(!(flag || (!BLOCK_PLAYER_CONTROLS && PLAYER_INTERFACE_HIDE_COUNT))) { return; } if(!SPECIAL_DRAGINTER_RENDER) GRenderer->SetCulling(Renderer::CullNone); if(COMBINE || COMBINEGOLD) { if(SpecialCursor == CURSOR_INTERACTION_ON) SpecialCursor = CURSOR_COMBINEON; else SpecialCursor = CURSOR_COMBINEOFF; } if(!SPECIAL_DRAGINTER_RENDER) { if(FlyingOverIO || DRAGINTER) { fHighLightAng += (float)(framedelay*0.5); if(fHighLightAng > 90.f) fHighLightAng = 90.f; float fHLight = 100.f * glm::sin(glm::radians(fHighLightAng)); iHighLight = checked_range_cast<int>(fHLight); } else { fHighLightAng = 0.f; iHighLight = 0; } } if( SpecialCursor || !PLAYER_MOUSELOOK_ON || DRAGINTER || (FlyingOverIO && PLAYER_MOUSELOOK_ON && !g_cursorOverBook && (eMouseState != MOUSE_IN_NOTE) && (FlyingOverIO->ioflags & IO_ITEM) && (FlyingOverIO->gameFlags & GFLAG_INTERACTIVITY) && (config.input.autoReadyWeapon == false)) || (MAGICMODE && PLAYER_MOUSELOOK_ON) ) { CANNOT_PUT_IT_HERE=0; float ag=player.angle.getYaw(); if(ag > 180) ag = ag - 360; float drop_miny=(float)(g_size.center().y)-g_size.center().y*(ag*( 1.0f / 70 )); if( DANAEMouse.y > drop_miny && DRAGINTER && !InInventoryPos(DANAEMouse) && !g_cursorOverBook ) { if(!Manage3DCursor(DRAGINTER, true)) CANNOT_PUT_IT_HERE = -1; if(SPECIAL_DRAGINTER_RENDER) { CANNOT_PUT_IT_HERE=0; return; } } else { CANNOT_PUT_IT_HERE = -1; } if(SPECIAL_DRAGINTER_RENDER) return; Vec2f mousePos = Vec2f(DANAEMouse); if(SpecialCursor && !DRAGINTER) { if((COMBINE && COMBINE->inv) || COMBINEGOLD) { if(TRUE_PLAYER_MOUSELOOK_ON && (config.input.autoReadyWeapon)) { mousePos = MemoMouse; } TextureContainer * tc; if(COMBINEGOLD) tc = GoldCoinsTC[5]; else tc = COMBINE->inv; Vec2f size(tc->m_dwWidth, tc->m_dwHeight); if(SpecialCursor == CURSOR_COMBINEON) { EERIEDrawBitmap(Rectf(mousePos, size.x, size.y), .00001f, tc, Color::white); if(FlyingOverIO && (FlyingOverIO->ioflags & IO_BLACKSMITH)) { float v=ARX_DAMAGES_ComputeRepairPrice(COMBINE,FlyingOverIO); if(v > 0.f) { long t = v; Vec2f nuberOffset = Vec2f(-16, -10); ARX_INTERFACE_DrawNumber(mousePos + nuberOffset, t, 6, Color::cyan); } } } else { EERIEDrawBitmap(Rectf(mousePos, size.x, size.y), 0.00001f, tc, Color(255, 170, 102, 255)); } } TextureContainer * surf; switch(SpecialCursor) { case CURSOR_REDIST: surf = cursorRedist; break; case CURSOR_COMBINEOFF: surf = cursorTargetOff; mousePos.x -= 16.f; mousePos.y -= 16.f; break; case CURSOR_COMBINEON: surf = cursorTargetOn; arx_assert(surf); mousePos.x -= 16.f; mousePos.y -= 16.f; break; case CURSOR_FIREBALLAIM: { surf = cursorTargetOn; arx_assert(surf); Vec2i size = Vec2i(surf->m_dwWidth, surf->m_dwHeight); mousePos.x = 320.f - size.x / 2.f; mousePos.y = 280.f - size.y / 2.f; break; } case CURSOR_INTERACTION_ON: cursorAnimatedHand.update1(); surf = cursorAnimatedHand.getCurrentTexture(); break; default: cursorAnimatedHand.update2(); surf = cursorAnimatedHand.getCurrentTexture(); break; } arx_assert(surf); if(SpecialCursor == CURSOR_REDIST) { EERIEDrawBitmap(Rectf(mousePos, surf->m_dwWidth * g_sizeRatio.x, surf->m_dwHeight * g_sizeRatio.y), 0.f, surf, Color::white); Vec2f textPos = Vec2f(DANAEMouse); textPos += Vec2f(6, 11) * g_sizeRatio; std::stringstream ss; ss << std::setw(3) << lCursorRedistValue; ARX_TEXT_Draw(hFontInBook, textPos, ss.str(), Color::black); } else { EERIEDrawBitmap(Rectf(mousePos, surf->m_dwWidth, surf->m_dwHeight), 0.f, surf, Color::white); } SpecialCursor = 0; } else { if( !(player.Current_Movement & PLAYER_CROUCH) && !BLOCK_PLAYER_CONTROLS && GInput->actionPressed(CONTROLS_CUST_MAGICMODE) && ARXmenu.currentmode == AMCM_OFF ) { if(!MAGICMODE) { if(player.Interface & INTER_MAP) { ARX_INTERFACE_BookClose(); // Forced Closing } MAGICMODE = true; } TextureContainer * surf = cursorMagic; Vec2f pos = Vec2f(DANAEMouse); if(TRUE_PLAYER_MOUSELOOK_ON) { pos = MemoMouse; } Vec2f size(surf->m_dwWidth, surf->m_dwHeight); pos += -size * 0.5f; EERIEDrawBitmap(Rectf(pos, size.x, size.y), 0.f, surf, Color::white); } else { if(MAGICMODE) { ARX_SOUND_Stop(SND_MAGIC_DRAW); MAGICMODE = false; } if(DRAGINTER && DRAGINTER->inv) { TextureContainer * tc = DRAGINTER->inv; TextureContainer * haloTc = NULL; if(NeedHalo(DRAGINTER)) haloTc = DRAGINTER->inv->getHalo();//>_itemdata->halo_tc; Color color = (DRAGINTER->poisonous && DRAGINTER->poisonous_count != 0) ? Color::green : Color::white; Vec2f pos = mousePos; if(TRUE_PLAYER_MOUSELOOK_ON && config.input.autoReadyWeapon) { pos = MemoMouse; } Rectf rect(pos, tc->m_dwWidth, tc->m_dwHeight); if(!(DRAGINTER->ioflags & IO_MOVABLE)) { EERIEDrawBitmap(rect, .00001f, tc, color); if((DRAGINTER->ioflags & IO_ITEM) && DRAGINTER->_itemdata->count != 1) { Vec2f nuberOffset = Vec2f(2.f, 13.f); ARX_INTERFACE_DrawNumber(pos + nuberOffset, DRAGINTER->_itemdata->count, 3, Color::white); } } else { if((InInventoryPos(DANAEMouse) || InSecondaryInventoryPos(DANAEMouse)) || CANNOT_PUT_IT_HERE != -1) { EERIEDrawBitmap(rect, .00001f, tc, color); } } //cross not over inventory icon if( CANNOT_PUT_IT_HERE && (eMouseState != MOUSE_IN_INVENTORY_ICON) && !InInventoryPos(DANAEMouse) && !InSecondaryInventoryPos(DANAEMouse) && !ARX_INTERFACE_MouseInBook()) { TextureContainer * tcc = cursorMovable; if(CANNOT_PUT_IT_HERE == -1) tcc = cursorThrowObject; if(tcc && tcc != tc) // to avoid movable double red cross... EERIEDrawBitmap(Rectf(Vec2f(pos.x + 16, pos.y), tcc->m_dwWidth, tcc->m_dwHeight), 0.00001f, tcc, Color::white); } if(haloTc) { ARX_INTERFACE_HALO_Draw(DRAGINTER, tc, haloTc, pos); } } else { cursorAnimatedHand.update2(); TextureContainer * surf = cursorAnimatedHand.getCurrentTexture(); if(surf) { EERIEDrawBitmap(Rectf(mousePos, surf->m_dwWidth, surf->m_dwHeight), 0.f, surf, Color::white); } } } } } else { //mode system shock if(SPECIAL_DRAGINTER_RENDER) return; if( TRUE_PLAYER_MOUSELOOK_ON && config.video.showCrosshair && !(player.Interface & (INTER_COMBATMODE | INTER_NOTE | INTER_MAP))) { cursorAnimatedHand.reset(); TextureContainer * surf = cursorCrossHair; arx_assert(surf); GRenderer->SetRenderState(Renderer::AlphaBlending, true); GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); float POSX = g_size.center().x - surf->m_dwWidth * .5f; float POSY = g_size.center().y - surf->m_dwHeight * .5f; EERIEDrawBitmap(Rectf(Vec2f(POSX, POSY), surf->m_dwWidth, surf->m_dwHeight), 0.f, surf, Color3f::gray(.5f).to<u8>()); GRenderer->SetRenderState(Renderer::AlphaBlending, false); } } }
//----------------------------------------------------------------------------- void PlayerInventoryHud::ARX_INTERFACE_DrawInventory(size_t bag, Vec2i i) { fDecPulse += framedelay * 0.5f; Vec2f anchorPos = anchorPosition(); const Vec2f pos = anchorPos + Vec2f(i.x, i.y); Rectf rect = Rectf(pos + Vec2f(0.f, -(5 * m_scale)), m_bagBackgroundSize.x * m_scale, m_bagBackgroundSize.y * m_scale); EERIEDrawBitmap(rect, 0.001f, m_heroInventory, Color::white); for(size_t y = 0; y < INVENTORY_Y; y++) { for(size_t x = 0; x < INVENTORY_X; x++) { Entity *io = inventory[bag][x][y].io; if(!io || !inventory[bag][x][y].show) continue; TextureContainer *tc = io->inv; TextureContainer *tc2 = NULL; if(NeedHalo(io)) tc2 = io->inv->getHalo(); if(!tc) continue; const Vec2f p = pos + Vec2f(x, y) * (m_slotSize * m_scale) + (m_slotSpacing * m_scale); Color color = (io->poisonous && io->poisonous_count != 0) ? Color::green : Color::white; Rectf rect(p, tc->m_size.x * m_scale, tc->m_size.y * m_scale); // TODO use alpha blending so this will be anti-aliased even w/o alpha to coverage EERIEDrawBitmap(rect, 0.001f, tc, color); Color overlayColor = Color::black; if(io == FlyingOverIO) overlayColor = Color::white; else if(io->ioflags & IO_CAN_COMBINE) overlayColor = Color3f::gray(glm::abs(glm::cos(glm::radians(fDecPulse)))).to<u8>(); if(overlayColor != Color::black) { GRenderer->SetBlendFunc(Renderer::BlendSrcAlpha, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); EERIEDrawBitmap(rect, 0.001f, tc, overlayColor); GRenderer->SetRenderState(Renderer::AlphaBlending, false); } if(tc2) { ARX_INTERFACE_HALO_Render(io->halo.color, io->halo.flags, tc2, p, Vec2f(m_scale)); } if((io->ioflags & IO_ITEM) && io->_itemdata->count != 1) ARX_INTERFACE_DrawNumber(p, io->_itemdata->count, 3, Color::white, m_scale); } } }
void SecondaryInventoryHud::draw() { const INVENTORY_DATA * inventory = TSecondaryInventory; if(!inventory) return; bool _bSteal = (player.Interface & INTER_STEAL) != 0; arx_assert(m_defaultBackground); ingame_inventory = m_defaultBackground; if(inventory->io && !inventory->io->inventory_skin.empty()) { res::path file = "graph/interface/inventory" / inventory->io->inventory_skin; TextureContainer * tc = TextureContainer::LoadUI(file); if(tc) ingame_inventory = tc; } Rectf rect = Rectf(Vec2f(m_fadePosition * m_scale, 0.f), m_size.x * m_scale, m_size.y * m_scale); EERIEDrawBitmap(rect, 0.001f, ingame_inventory, Color::white); for(long y = 0; y < inventory->m_size.y; y++) { for(long x = 0; x < inventory->m_size.x; x++) { Entity *io = inventory->slot[x][y].io; if(!io) continue; bool bItemSteal = false; TextureContainer *tc = io->m_icon; TextureContainer *tc2 = NULL; if(NeedHalo(io)) tc2 = io->m_icon->getHalo(); if(_bSteal) { if(!ARX_PLAYER_CanStealItem(io)) { bItemSteal = true; tc = m_canNotSteal; tc2 = NULL; } } if(tc && (inventory->slot[x][y].show || bItemSteal)) { UpdateGoldObject(io); Vec2f p = Vec2f( (m_fadePosition * m_scale) + (float)x*(32 * m_scale) + (2 * m_scale), (float)y*(32 * m_scale) + (13 * m_scale) ); Vec2f size = Vec2f(tc->size()); Color color = (io->poisonous && io->poisonous_count!=0) ? Color::green : Color::white; Rectf rect(p, size.x * m_scale, size.y * m_scale); // TODO use alpha blending so this will be anti-aliased even w/o alpha to coverage EERIEDrawBitmap(rect, 0.001f, tc, color); Color overlayColor = Color::black; if(!bItemSteal && (io==FlyingOverIO)) overlayColor = Color::white; else if(!bItemSteal && (io->ioflags & IO_CAN_COMBINE)) { overlayColor = Color3f::gray(glm::abs(glm::cos(glm::radians(fDecPulse)))).to<u8>(); } if(overlayColor != Color::black) { GRenderer->SetBlendFunc(BlendSrcAlpha, BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); EERIEDrawBitmap(rect, 0.001f, tc, overlayColor); GRenderer->SetRenderState(Renderer::AlphaBlending, false); } if(tc2) { ARX_INTERFACE_HALO_Draw(io, tc, tc2, p, Vec2f(m_scale)); } if((io->ioflags & IO_ITEM) && io->_itemdata->count != 1) ARX_INTERFACE_DrawNumber(p, io->_itemdata->count, 3, Color::white, m_scale); } } } if(!(player.Interface & INTER_COMBATMODE) && (player.Interface & INTER_MINIBACK)) { if(TSecondaryInventory) { Entity *temp = TSecondaryInventory->io; if(temp && !(temp->ioflags & IO_SHOP) && !(temp == ioSteal)) { m_pickAllButton.draw(); } m_closeButton.draw(); } } }