void DrawMagicSightInterface() { if(eyeball.exist == 1 || !Flying_Eye) return; GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendInvSrcColor); float col = 0.75f + PULSATE * (1.f/20); if(col > 1.f) col = 1.f; if(eyeball.exist < 0) { col = (float)(-eyeball.exist) * (1.f/100); } else if(eyeball.exist > 2) { col = 1.f - eyeball.size.x; } EERIEDrawBitmap(Rectf(g_size), 0.0001f, Flying_Eye, Color3f::gray(col).to<u8>()); if(MagicSightFader > 0.f) { col = MagicSightFader; EERIEDrawBitmap(Rectf(g_size), 0.0001f, NULL, Color3f::gray(col).to<u8>()); MagicSightFader -= Original_framedelay * (1.f/400); if(MagicSightFader < 0.f) MagicSightFader = 0.f; } GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); }
void ARX_DAMAGE_Show_Hit_Blood() { Color color; static float Last_Blood_Pos = 0.f; static long duration; if(Blood_Pos > 2.f) { // end of blood flash Blood_Pos = 0.f; duration = 0; } else if (Blood_Pos > 1.f) { GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendSrcColor); GRenderer->SetRenderState(Renderer::AlphaBlending, true); GRenderer->SetRenderState(Renderer::DepthWrite, false); if(player.poison > 1.f) color = Color3f(Blood_Pos - 1.f, 1.f, Blood_Pos - 1.f).to<u8>(); else color = Color3f(1.f, Blood_Pos - 1.f, Blood_Pos - 1.f).to<u8>(); EERIEDrawBitmap(Rectf(g_size), 0.00009f, NULL, color); GRenderer->SetRenderState(Renderer::DepthWrite, true); GRenderer->SetRenderState(Renderer::AlphaBlending, false); } else if(Blood_Pos > 0.f) { GRenderer->SetBlendFunc(Renderer::BlendZero, Renderer::BlendSrcColor); GRenderer->SetRenderState(Renderer::AlphaBlending, true); GRenderer->SetRenderState(Renderer::DepthWrite, false); if(player.poison > 1.f) color = Color3f(1.f - Blood_Pos, 1.f, 1.f - Blood_Pos).to<u8>(); else color = Color3f(1.f, 1.f - Blood_Pos, 1.f - Blood_Pos).to<u8>(); EERIEDrawBitmap(Rectf(g_size), 0.00009f, NULL, color); GRenderer->SetRenderState(Renderer::AlphaBlending, false); GRenderer->SetRenderState(Renderer::DepthWrite, true); } if(Blood_Pos > 0.f) { if(Blood_Pos > 1.f) { if(Last_Blood_Pos <= 1.f) { Blood_Pos = 1.0001f; duration = 0; } if(duration > Blood_Duration) Blood_Pos += (float)framedelay * ( 1.0f / 300 ); duration += static_cast<long>(framedelay); } else Blood_Pos += (float)framedelay * ( 1.0f / 40 ); } Last_Blood_Pos = Blood_Pos; }
void DrawImproveVisionInterface() { if(ombrignon) { float mod = 0.6f + PULSATE * 0.35f; EERIEDrawBitmap(Rectf(g_size), 0.0001f, ombrignon, Color3f((0.5f+PULSATE*( 1.0f / 10 ))*mod,0.f,0.f).to<u8>()); } }
void CurrentTorchIconGui::draw() { if(!isVisible()) return; EERIEDrawBitmap(m_rect, 0.001f, m_tex, Color::white); }
void ActiveSpellsGui::ActiveSpellIconSlot::draw() { if(!m_flicker) return; EERIEDrawBitmap(m_rect, 0.01f, m_tc, m_color); }
void ManageFade() { arxtime.update(); // TODO can this really become negative ? long tim = long(arxtime.now_ul() - FADESTART); if(tim <= 0) return; float Visibility = tim / (float)FADEDURATION; if(FADEDIR > 0) Visibility = 1.f - Visibility; if(Visibility > 1.f) Visibility = 1.f; if(Visibility < 0.f) { FADEDIR = 0; return; } LAST_FADEVALUE=Visibility; GRenderer->SetBlendFunc(BlendSrcAlpha, BlendInvSrcAlpha); GRenderer->SetRenderState(Renderer::DepthWrite, false); GRenderer->SetRenderState(Renderer::AlphaBlending, true); Color color = Color4f(FADECOLOR, Visibility).to<u8>(); EERIEDrawBitmap(Rectf(g_size), 0.0001f, NULL, color); GRenderer->SetRenderState(Renderer::AlphaBlending, false); GRenderer->SetRenderState(Renderer::DepthWrite, true); }
void CheckboxWidget::render(bool mouseOver) { m_label->render(mouseOver); TextureContainer * texture = (m_checked ? m_textureOn : m_textureOff); Color color = m_enabled ? Color::white : Color::gray(0.25f); UseRenderState state(render2D().blendAdditive()); EERIEDrawBitmap(m_button, 0.f, texture, color); if(mouseOver) { EERIEDrawBitmap(m_button, 0.f, texture, color); } }
void MassLightningStrikeSpell::Launch() { spells.endByType(SPELL_MASS_LIGHTNING_STRIKE); m_duration = 5000; // TODO probably never read m_soundEffectPlayed = false; float beta; if(m_caster == PlayerEntityHandle) { m_pos = player.pos + Vec3f(0.f, 150.f, 0.f); beta = player.angle.getPitch(); } else { Entity * io = entities[m_caster]; m_pos = io->pos + Vec3f(0.f, -20.f, 0.f); beta = io->angle.getPitch(); } m_pos += angleToVectorXZ(beta) * 500.f; long minDuration = long(500 * m_level); long maxDuration = 0; int number = glm::clamp(int(m_level), 1, 10); float ft = 360.0f / (float)number; for(int i = 0; i < number; i++) { Vec3f target = m_pos + angleToVectorXZ(i * ft) * 500.0f; long duration = minDuration + Random::get(0, 5000); maxDuration = std::max(maxDuration, duration); CLightning * lightning = new CLightning(); lightning->m_isMassLightning = true; lightning->m_fDamage = 2; lightning->Create(m_pos, target); lightning->SetDuration(duration); pTab.push_back(lightning); } m_duration = maxDuration + 1000; m_light = GetFreeDynLight(); if(lightHandleIsValid(m_light)) { EERIE_LIGHT * light = lightHandleGet(m_light); light->intensity = 1.8f; light->fallend = 850.f; light->fallstart = 500.f; light->rgb = Color3f::red; // Color3f(1.f, 0.75f, 0.75f); light->pos = m_pos; } ARX_SOUND_PlaySFX(SND_SPELL_LIGHTNING_START); m_snd_loop = ARX_SOUND_PlaySFX(SND_SPELL_LIGHTNING_LOOP, &m_pos, 1.f, ARX_SOUND_PLAY_LOOPED); // Draws White Flash on Screen GRenderer->SetBlendFunc(BlendOne, BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); EERIEDrawBitmap(Rectf(g_size), 0.00009f, NULL, Color::white); GRenderer->SetRenderState(Renderer::AlphaBlending, false); }
void MemorizedRunesHud::draw() { if(!(CurrSpellSymbol || player.SpellToMemorize.bSpell)) { return; } Vec2f pos = m_rect.topLeft(); for(int i = 0; i < 6; i++) { bool bHalo = false; if(SpellSymbol[i] != RUNE_NONE) { if(SpellSymbol[i] == player.SpellToMemorize.iSpellSymbols[i]) { bHalo = true; } else { player.SpellToMemorize.iSpellSymbols[i] = SpellSymbol[i]; for(int j = i + 1; j < 6; j++) { player.SpellToMemorize.iSpellSymbols[j] = RUNE_NONE; } } } if(player.SpellToMemorize.iSpellSymbols[i] != RUNE_NONE) { Vec2f size = Vec2f(32.f, 32.f) * m_scale; Rectf rect = Rectf(pos, size.x, size.y); TextureContainer * tc = gui::necklace.pTexTab[player.SpellToMemorize.iSpellSymbols[i]]; if(bHalo) { ARX_INTERFACE_HALO_Render(Color3f(0.2f, 0.4f, 0.8f), HALO_ACTIVE, tc->getHalo(), pos, Vec2f(m_scale)); } EERIEDrawBitmap(rect, 0, tc, Color::white); if(!player.hasRune(player.SpellToMemorize.iSpellSymbols[i])) { UseRenderState state(render2D().blend(BlendInvDstColor, BlendOne).alphaCutout()); EERIEDrawBitmap(rect, 0, cursorMovable, Color3f::gray(.8f).to<u8>()); } pos.x += 32 * m_scale; } } if(g_gameTime.now() - player.SpellToMemorize.lTimeCreation > GameDurationMs(30000)) { player.SpellToMemorize.bSpell = false; } }
void DrawImproveVisionInterface() { if(ombrignon) { float mod = 0.6f + PULSATE * 0.35f; Color3f color = Color3f((0.5f + PULSATE * 0.1f) * mod, 0.f, 0.f); UseRenderState state(render2D().blendAdditive()); EERIEDrawBitmap(Rectf(g_size), 0.0001f, ombrignon, color.to<u8>()); } }
void DrawImproveVisionInterface() { if(ombrignon) { float mod = 0.6f + PULSATE * 0.35f; UseRenderState state(render2D().blendAdditive()); EERIEDrawBitmap(Rectf(g_size), 0.0001f, ombrignon, Color::red * ((0.5f + PULSATE * 0.1f) * mod)); } }
void MecanismIcon::draw() { if(m_nbToDraw >= 3) { return; } UseRenderState state(render2D().blendAdditive()); EERIEDrawBitmap(m_rect, 0.01f, m_tex, m_color); }
void HitStrengthGauge::draw() { { UseRenderState state(render2D().blendAdditive()); EERIEDrawBitmap(m_rect, 0.0001f, m_fullTex, Color3f::gray(m_intensity).to<u8>()); } EERIEDrawBitmap(m_rect, 0.0001f, m_emptyTex, Color::white); if(m_flashActive && player.m_skillFull.etheralLink >= 40) { float j = 1.0f - m_flashIntensity; Color col = (j < 0.5f) ? Color3f(j * 2.f, 1.f, 0.f).to<u8>() : Color3f(1.f, m_flashIntensity, 0.f).to<u8>(); UseRenderState state(render2D().blendAdditive()); EERIEDrawBitmap(m_hitRect, 0.0001f, m_hitTex, col); } }
void MenuCursor::DrawOneCursor(const Vec2s & mousePos) { if(!GInput->isMouseInWindow()) { return; } UseTextureState textureState(getInterfaceTextureFilter(), TextureStage::WrapClamp); float scale = getInterfaceScale(config.interface.cursorScale, config.interface.cursorScaleInteger); EERIEDrawBitmap(Rectf(Vec2f(mousePos), m_size.x * scale, m_size.y * scale), 0.00000001f, scursor[m_currentFrame], Color::white); }
void ChangeLevelIconGui::draw() { if(!isVisible()) return; EERIEDrawBitmap(m_rect, 0.0001f, m_tex, Color3f::gray(m_intensity).to<u8>()); if(m_rect.contains(Vec2f(DANAEMouse))) { cursorSetInteraction(); if(eeMouseUp1()) { CHANGE_LEVEL_ICON = ChangeLevelNow; } } }
void MenuWindow::render() { if(!m_currentPage) { return; } // Draw backgound and border { UseRenderState state(render2D().blend(BlendZero, BlendInvSrcColor)); EERIEDrawBitmap(Rectf(m_pos, RATIO_X(m_background->m_size.x), RATIO_Y(m_background->m_size.y)), 0, m_background, Color::white); } EERIEDrawBitmap(Rectf(m_pos, RATIO_X(m_border->m_size.x), RATIO_Y(m_border->m_size.y)), 0, m_border, Color::white); m_currentPage->render(); if(g_debugInfo == InfoPanelGuiDebug) { m_currentPage->drawDebug(); } }
void ScreenArrows::draw() { if(!config.input.borderTurning) { return; } UseRenderState state(render2D().blendAdditive()); Color lcolor = Color3f::gray(.5f).to<u8>(); EERIEDrawBitmap(m_left, 0.01f, m_arrowLeftTex, lcolor); EERIEDrawBitmapUVs(m_right, .01f, m_arrowLeftTex, lcolor, Vec2f(1.f, 0.f), Vec2f(0.f, 0.f), Vec2f(1.f, 1.f), Vec2f(0.f, 1.f)); EERIEDrawBitmapUVs(m_top, .01f, m_arrowLeftTex, lcolor, Vec2f(0.f, 1.f), Vec2f(0.f, 0.f), Vec2f(1.f, 1.f), Vec2f(1.f, 0.f)); EERIEDrawBitmapUVs(m_bottom, .01f, m_arrowLeftTex, lcolor, Vec2f(1.f, 1.f), Vec2f(1.f, 0.f), Vec2f(0.f, 1.f), Vec2f(0.f, 0.f)); }
void CheckMr() { if(cur_mr == 3) { if(GRenderer && Mr_tc) { Vec2f pos = Vec2f(g_size.topRight()) + Vec2f(-128.f * g_sizeRatio.x, 0.f); Vec2f size = Vec2f(128.f, 128.f) * g_sizeRatio; Rectf rect = Rectf(pos, size.x, size.y); UseRenderState state(render2D().blendAdditive()); EERIEDrawBitmap(rect, 0.0001f, Mr_tc, Color::gray(0.5f + PULSATE * 0.1f)); } else { Mr_tc = TextureContainer::LoadUI("graph/particles/(fx)_mr"); } } }
static bool SelectSpellTargetCursorRender() { if( !SPECIAL_DRAGINTER_RENDER && LOOKING_FOR_SPELL_TARGET ) { ArxDuration elapsed = arxtime.now() - LOOKING_FOR_SPELL_TARGET_TIME; if(elapsed > ArxDurationMs(7000)) { ARX_SOUND_PlaySFX(SND_MAGIC_FIZZLE, &player.pos); ARX_SPELLS_CancelSpellTarget(); } TextureContainer * surf; if(FlyingOverIO && (((LOOKING_FOR_SPELL_TARGET & 1) && (FlyingOverIO->ioflags & IO_NPC)) || ((LOOKING_FOR_SPELL_TARGET & 2) && (FlyingOverIO->ioflags & IO_ITEM))) ){ surf = cursorTargetOn; if(eeMouseUp1()) { ARX_SPELLS_LaunchSpellTarget(FlyingOverIO); } } else { surf = cursorTargetOff; if(GInput->actionPressed(CONTROLS_CUST_MAGICMODE)) { ARX_SOUND_PlaySFX(SND_MAGIC_FIZZLE, &player.pos); ARX_SPELLS_CancelSpellTarget(); } } Vec2f pos = Vec2f(DANAEMouse); if(TRUE_PLAYER_MOUSELOOK_ON) { pos = MemoMouse; } Vec2f texSize = Vec2f(surf->size()); pos += -texSize * 0.5f; EERIEDrawBitmap(Rectf(pos, texSize.x, texSize.y), 0.f, surf, Color::white); return true; } return false; }
void CheckMr() { if(cur_mr == 3) { if(GRenderer && Mr_tc) { Vec2f pos = Vec2f(g_size.topRight()); pos += Vec2f(-128.f * g_sizeRatio.x, 0.f); Vec2f size = Vec2f(128.f, 128.f); size *= g_sizeRatio; Rectf rect = Rectf(pos, size.x, size.y); EERIEDrawBitmap(rect, 0.0001f, Mr_tc, Color3f::gray(0.5f + PULSATE * (1.0f/10)).to<u8>()); } else { Mr_tc = TextureContainer::LoadUI("graph/particles/(fx)_mr"); } } }
static void ARX_INTERFACE_ShowLogo(TextureContainer * logo) { if(logo == NULL) { return; } GRenderer->Clear(Renderer::ColorBuffer); UseRenderState state(render2D().noBlend()); UseTextureState textureState(TextureStage::FilterLinear, TextureStage::WrapClamp); Vec2f size = Vec2f(logo->size()); Vec2f pos = Vec2f(g_size.center()) - size / 2.f; EERIEDrawBitmap(Rectf(pos, size.x, size.y), 0.001f, logo, Color::white); }
void QuickSaveIconGui::draw() { if(m_remainingTime == 0) { return; } UseRenderState state(render2D().blend(BlendSrcColor, BlendOne).alphaCutout()); // Flash the icon twice, starting at about 0.7 opacity float step = 1.f - (m_remainingTime / m_duration); float alpha = std::min(1.f, 0.6f * (std::sin(step * (7.f / 2.f * glm::pi<float>())) + 1.f)); TextureContainer * tex = TextureContainer::LoadUI("graph/interface/icons/menu_main_save"); arx_assert(tex); Vec2f size = Vec2f(tex->size()); EERIEDrawBitmap(Rectf(Vec2f(0, 0), size.x, size.y), 0.f, tex, Color::gray(alpha)); }
void ThumbnailCursor::render() { if(m_renderTexture) { Vec2f offset = Vec2f(0, 0); if(DANAEMouse.y + config.interface.thumbnailSize.y > g_size.height()) { offset.y -= config.interface.thumbnailSize.y; } Vec2f pos = Vec2f(DANAEMouse) + offset; Rectf rect = Rectf(pos, config.interface.thumbnailSize.x, config.interface.thumbnailSize.y); EERIEDrawBitmap(rect, 0.001f, m_loadTexture, Color::white); drawLineRectangle(rect, 0.01f, Color::white); m_renderTexture = NULL; } }
static void ARX_SPEECH_Render() { long igrec = 14; Vec2i sSize = hFontInBook->getTextSize("p"); sSize.y *= 3; int iEnd = igrec + sSize.y; for(size_t i = 0; i < MAX_SPEECH; i++) { if(speech[i].timecreation == 0 || speech[i].text.empty()) { continue; } Rectf rect( Vec2f(120 * g_sizeRatio.x - 16 * minSizeRatio(), igrec), 16 * minSizeRatio(), 16 * minSizeRatio() ); GRenderer->SetRenderState(Renderer::AlphaBlending, true); GRenderer->SetBlendFunc(Renderer::BlendSrcAlpha, Renderer::BlendInvSrcAlpha); EERIEDrawBitmap(rect, .00001f, arx_logo_tc, Color::white); igrec += ARX_UNICODE_DrawTextInRect(hFontInBook, Vec2f(120.f * g_sizeRatio.x, igrec), 500 * g_sizeRatio.x, ' ' + speech[i].text, Color::white, NULL); if(igrec > iEnd && !isLastSpeech(i)) { ARX_SPEECH_MoveUp(); break; } } GRenderer->SetRenderState(Renderer::AlphaBlending, false); }
void PlayerInventoryHud::draw() { if(player.Interface & INTER_INVENTORY) { if(player.bag) { ARX_INTERFACE_DrawInventory(g_currentInventoryBag, Vec2i_ZERO); CalculateInventoryCoordinates(); if(g_currentInventoryBag > 0) { Rectf rect = Rectf(m_arrowsAnchor, 32.f * m_scale, 32.f * m_scale); EERIEDrawBitmap(rect, 0.001f, m_heroInventoryUp, Color::white); if(rect.contains(Vec2f(DANAEMouse))) { GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); SpecialCursor=CURSOR_INTERACTION_ON; EERIEDrawBitmap(rect, 0.001f, m_heroInventoryUp, Color::white); GRenderer->SetRenderState(Renderer::AlphaBlending, false); SpecialCursor=CURSOR_INTERACTION_ON; if(eeMouseDown1() || (eeMouseUp1() && DRAGINTER)) { previousBag(); } } } if(g_currentInventoryBag < player.bag-1) { Rectf rect = Rectf(m_arrowsAnchor + Vec2f(0.f, 32.f + 5.f) * m_scale, 32.f * m_scale, 32.f * m_scale); EERIEDrawBitmap(rect, 0.001f, m_heroInventoryDown, Color::white); if(rect.contains(Vec2f(DANAEMouse))) { GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); GRenderer->SetRenderState(Renderer::AlphaBlending, true); EERIEDrawBitmap(rect, 0.001f, m_heroInventoryDown, Color::white); GRenderer->SetRenderState(Renderer::AlphaBlending, false); SpecialCursor=CURSOR_INTERACTION_ON; if(eeMouseDown1() || (eeMouseUp1() && DRAGINTER)) { nextBag(); } } } } } else if((player.Interface & INTER_INVENTORYALL) || bInventoryClosing) { Vec2f anchorPos = anchorPosition(); //TODO see about these coords, might be calculated once only const float fBag = (player.bag-1) * (-121 * m_scale); const float fOffsetY = (121 * m_scale); int iOffsetY = checked_range_cast<int>(fBag + fOffsetY); int posx = checked_range_cast<int>(anchorPos.x); int posy = checked_range_cast<int>(anchorPos.y + ((-3.f + 25 - 32) * m_scale)); for(int i = 0; i < player.bag; i++) { Vec2f pos1 = Vec2f(posx + (45 * m_scale), static_cast<float>(posy + iOffsetY)); Vec2f pos2 = Vec2f(posx + (m_bagBackgroundSize.x * m_scale)*0.5f + (-16 * m_scale), posy+iOffsetY + (-5 * m_scale)); Vec2f pos3 = Vec2f(posx + (m_bagBackgroundSize.x * m_scale) + ((-45-32) * m_scale), posy+iOffsetY + (-15 * m_scale)); TextureContainer * tex = m_heroInventoryLink; EERIEDrawBitmap(Rectf(pos1, tex->m_size.x, tex->m_size.y), 0.001f, tex, Color::white); EERIEDrawBitmap(Rectf(pos2, tex->m_size.x, tex->m_size.y), 0.001f, tex, Color::white); EERIEDrawBitmap(Rectf(pos3, tex->m_size.x, tex->m_size.y), 0.001f, tex, Color::white); iOffsetY += checked_range_cast<int>(fOffsetY); } iOffsetY = checked_range_cast<int>(fBag); for(short i = 0; i < player.bag; i++) { ARX_INTERFACE_DrawInventory(i, Vec2i(0, iOffsetY)); iOffsetY += checked_range_cast<int>(fOffsetY); } } }
//----------------------------------------------------------------------------- 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); } } }
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 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(); } } }
void CharacterCreation::render() { arx_assert(ARXmenu.mode() == Mode_CharacterCreation); GRenderer->Clear(Renderer::ColorBuffer); //------------------------------------------------------------------------- arx_assert(BookBackground); { UseRenderState state(render2D()); EERIEDrawBitmap(Rectf(Vec2f(0, 0), g_size.width(), g_size.height()), 0.9f, BookBackground, Color::white); g_playerBook.stats.manageNewQuest(); bool DONE = (player.Skill_Redistribute == 0 && player.Attribute_Redistribute == 0); Color color = Color::none; Rectf book = g_playerBook.getArea(); Vec2f spacing = Vec2f(20.f, 30.f) * minSizeRatio(); Vec2f quickGenerateButtonSize(hFontMenu->getTextSize(str_button_quickgen).size()); Rectf quickGenerateButton(book.bottomLeft() + Vec2f(0.f, spacing.y), quickGenerateButtonSize.x, quickGenerateButtonSize.y); Vec2f doneButtonSize(hFontMenu->getTextSize(str_button_done).size()); Rectf doneButton(book.bottomRight() + Vec2f(-doneButtonSize.x, spacing.y), doneButtonSize.x, doneButtonSize.y); Vec2f skinButtonSize(hFontMenu->getTextSize(str_button_skin).size()); Rectf skinButton((quickGenerateButton.centerRight() + doneButton.centerLeft() - skinButtonSize) / 2.f, skinButtonSize.x, skinButtonSize.y); if(quickGenerateButton.right > skinButton.left - spacing.x) { quickGenerateButton.move(skinButton.left - spacing.x - quickGenerateButton.right, 0.f); } if(doneButton.left < skinButton.right + spacing.x) { doneButton.move(skinButton.right + spacing.x - doneButton.left, 0.f); } // Button QUICK GENERATION if(quickGenerateButton.contains(Vec2f(DANAEMouse))) { cursorSetInteraction(); if(!eeMousePressed1() && eeMouseUp1()) { m_cheatQuickGenButtonClickCount++; int iSkin = player.skin; ARX_SOUND_PlayMenu(g_snd.MENU_CLICK); if(bQuickGenFirstClick) { ARX_PLAYER_MakeAverageHero(); bQuickGenFirstClick = false; } else { ARX_PLAYER_QuickGeneration(); } player.skin = checked_range_cast<char>(iSkin); } characterCreationAddDescription(m_desc_quickgen); color = Color::white; } else { color = Color(232, 204, 143); } ARX_UNICODE_DrawTextInRect(hFontMenu, quickGenerateButton.topLeft(), 999999, str_button_quickgen, color); // Button SKIN if(skinButton.contains(Vec2f(DANAEMouse))) { cursorSetInteraction(); if(eeMouseUp1()) { m_cheatSkinButtonClickCount++; ARX_SOUND_PlayMenu(g_snd.MENU_CLICK); player.skin++; if(player.skin > 3) { player.skin = 0; } ARX_PLAYER_Restore_Skin(); } characterCreationAddDescription(m_desc_skin); color = Color::white; } else { color = Color::rgb(0.91f, 0.8f, 0.56f); } ARX_UNICODE_DrawTextInRect(hFontMenu, skinButton.topLeft(), 999999, str_button_skin, color); // Button DONE if(doneButton.contains(Vec2f(DANAEMouse))) { if(DONE) cursorSetInteraction(); if(DONE && eeMouseUp1()) { if(m_cheatSkinButtonClickCount == 8 && m_cheatQuickGenButtonClickCount == 10) { m_cheatSkinButtonClickCount = -2; } else if(m_cheatSkinButtonClickCount == -1) { ARX_PLAYER_MakeSpHero(); player.skin = 4; ARX_PLAYER_Restore_Skin(); m_cheatSkinButtonClickCount = 0; SP_HEAD = 1; } else { if(SP_HEAD) { player.skin = 4; ARX_PLAYER_Restore_Skin(); SP_HEAD = 0; } ARX_SOUND_PlayMenu(g_snd.MENU_CLICK); MenuFader_start(Fade_In, Mode_InGame); } } else { if(DONE) { color = Color::white; } else { color = Color::gray(0.75f); } } characterCreationAddDescription(m_desc_done); } else { if(DONE) { color = Color(232, 204, 143); } else { color = Color::gray(0.75f); } } if(m_cheatSkinButtonClickCount < 0) { color = Color::magenta; } ARX_UNICODE_DrawTextInRect(hFontMenu, doneButton.topLeft(), 999999, str_button_done, color); } EERIE_LIGHT * light = lightHandleGet(torchLightHandle); light->pos.x = 0.f + GInput->getMousePosition().x - (g_size.width() >> 1); light->pos.y = 0.f + GInput->getMousePosition().y - (g_size.height() >> 1); if(pTextManage) { pTextManage->Update(g_platformTime.lastFrameDuration()); pTextManage->Render(); } ARX_INTERFACE_RenderCursor(true); if(MenuFader_process()) { if(iFadeAction == Mode_InGame) { ARX_MENU_NEW_QUEST_Clicked_QUIT(); MenuFader_reset(); if(pTextManage) { pTextManage->Clear(); } } } }
void MiniMap::drawDetectedEntities(int showLevel, float startX, float startY, float zoom) { float caseX = zoom / ((float)MINIMAP_MAX_X); float caseY = zoom / ((float)MINIMAP_MAX_Z); float ratio = zoom / 250.f; if(!m_pTexDetect) { m_pTexDetect = TextureContainer::Load("graph/particles/flare"); } // Computes playerpos float ofx = m_miniOffsetX[m_currentLevel]; float ofx2 = m_levels[showLevel].m_ratioX; float ofy = m_miniOffsetY[m_currentLevel]; float ofy2 = m_levels[showLevel].m_ratioY; GRenderer->SetRenderState(Renderer::AlphaBlending, true); GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne); const EntityManager &ents = *m_entities; // for convenience for(size_t lnpc = 1; lnpc < ents.size(); lnpc++) { Entity * npc = ents[lnpc]; if(!npc || !(npc->ioflags & IO_NPC)) { continue; // only NPCs can be detected } if(npc->_npcdata->life < 0.f) { continue; // don't show dead NPCs } if((npc->gameFlags & GFLAG_MEGAHIDE) || npc->show != SHOW_FLAG_IN_SCENE) { continue; // don't show hidden NPCs } if(npc->_npcdata->fDetect < 0) { continue; // don't show undetectable NPCs } if(player.Full_Skill_Etheral_Link < npc->_npcdata->fDetect) { continue; // the player doesn't have enough skill to detect this NPC } float fpx = startX + ((npc->pos.x - 100 + ofx - ofx2) * ( 1.0f / 100 ) * caseX + m_miniOffsetX[m_currentLevel] * ratio * m_modX) / m_modX; float fpy = startY + ((m_mapMaxY[showLevel] - ofy - ofy2) * ( 1.0f / 100 ) * caseY - (npc->pos.z + 200 + ofy - ofy2) * ( 1.0f / 100 ) * caseY + m_miniOffsetY[m_currentLevel] * ratio * m_modZ) / m_modZ; float d = fdist(Vec2f(m_player->pos.x, m_player->pos.z), Vec2f(npc->pos.x, npc->pos.z)); if(d > 800 || fabs(ents.player()->pos.y - npc->pos.y) > 250.f) { continue; // the NPC is too far away to be detected } float col = 1.f; if(d > 600.f) { col = 1.f - (d - 600.f) * ( 1.0f / 200 ); } fpx *= Xratio; fpy *= Yratio; EERIEDrawBitmap(fpx, fpy, 5.f * ratio, 5.f * ratio, 0, m_pTexDetect, Color3f(col, 0, 0).to<u8>()); } GRenderer->SetRenderState(Renderer::AlphaBlending, false); }