void StealIconGui::updateInput() { // steal if(player.Interface & INTER_STEAL) { if(m_rect.contains(Vec2f(DANAEMouse))) { eMouseState = MOUSE_IN_STEAL_ICON; cursorSetInteraction(); if(eeMouseDown1()) { ARX_INVENTORY_OpenClose(ioSteal); if(player.Interface & (INTER_INVENTORY | INTER_INVENTORYALL)) { ARX_SOUND_PlayInterface(SND_BACKPACK, Random::getf(0.9f, 1.1f)); } if(SecondaryInventory) { SendIOScriptEvent(entities.player(), ioSteal, SM_STEAL); bForceEscapeFreeLook = true; lOldTruePlayerMouseLook = !TRUE_PLAYER_MOUSELOOK_ON; } } if(DRAGINTER == NULL) { return; } } } }
void CurrentTorchIconGui::updateInput() { if(player.torch) { if(m_rect.contains(Vec2f(DANAEMouse))) { eMouseState = MOUSE_IN_TORCH_ICON; cursorSetInteraction(); if(!DRAGINTER && !PLAYER_MOUSELOOK_ON && DRAGGING) { Entity * io = player.torch; player.torch->show = SHOW_FLAG_IN_SCENE; ARX_SOUND_PlaySFX(SND_TORCH_END); ARX_SOUND_Stop(SND_TORCH_LOOP); player.torch = NULL; lightHandleGet(torchLightHandle)->exist = 0; io->ignition = 1; Set_DragInter(io); } else { if(eeMouseDoubleClick1() && !COMBINE) { COMBINE = player.torch; } if(eeMouseUp2()) { ARX_PLAYER_ClickedOnTorch(player.torch); TRUE_PLAYER_MOUSELOOK_ON = false; } } } } }
void BookIconGui::updateInput() { m_isSelected = m_rect.contains(Vec2f(DANAEMouse)); if(m_isSelected) { cursorSetInteraction(); if(eeMouseDown1()) { g_playerBook.toggle(); } return; } }
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 LevelUpIconGui::updateInput() { if(!m_visible) return; m_isSelected = m_rect.contains(Vec2f(DANAEMouse)); if(m_isSelected) { cursorSetInteraction(); if(eeMouseDown1()) { g_playerBook.open(); } } }
void PrecastSpellsGui::PrecastSpellIconSlot::updateInput() { if(m_rect.contains(Vec2f(DANAEMouse))) { cursorSetInteraction(); if(eeMouseUp1()) { if(Precast[m_precastIndex.handleData()].typ >= 0) { ARX_SPEECH_Add(spellicons[Precast[m_precastIndex.handleData()].typ].name); } } if(eeMouseDoubleClick1()) { ARX_SPELLS_Precast_Launch(m_precastIndex); } } }
void ActiveSpellsGui::ActiveSpellIconSlot::updateInput(const Vec2f & mousePos) { if(!m_abortable) return; if(m_rect.contains(mousePos)) { cursorSetInteraction(); if(eeMouseUp1()) { if(spells[spellIndex]->m_type >= 0) { ARX_SPEECH_Add(spellicons[spells[spellIndex]->m_type].name); } } if(eeMouseDoubleClick1()) { ARX_SOUND_PlaySFX(SND_MAGIC_FIZZLE); spells.endSpell(spells[spellIndex]); } } }
void PurseIconGui::updateInput() { m_isSelected = false; // gold if(player.gold > 0) { m_isSelected = m_rect.contains(Vec2f(DANAEMouse)); if(m_isSelected) { cursorSetInteraction(); if( player.gold > 0 && !GInput->actionPressed(CONTROLS_CUST_MAGICMODE) && !COMBINE && !COMBINEGOLD && eeMouseDoubleClick1() ) { COMBINEGOLD = true; } if(!DRAGINTER) return; } } }
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 ARX_INTERFACE_ManageOpenedBook_Finish(const Vec2f & mousePos, Rectf rect, float scale) { RenderState baseState = render3D().depthTest(false).fog(false); Vec3f pos = Vec3f(0.f, 0.f, 2100.f); EERIE_LIGHT * light = lightHandleGet(torchLightHandle); EERIE_LIGHT tl = *light; light->pos = Vec3f(500.f, -1960.f, 1590.f); light->m_exists = true; light->rgb = Color3f(0.6f, 0.7f, 0.9f); light->intensity = 1.8f; light->fallstart = 4520.f; light->fallend = light->fallstart + 600.f; RecalcLight(light); Camera * oldcam = g_camera; g_culledDynamicLights[0] = light; g_culledDynamicLightsCount = 1; Vec2i tmpPos(0); GRenderer->SetAntialiasing(true); float wave = timeWaveSin(g_platformTime.frameStart(), PlatformDurationMsf(1256.6370614f)); float ptDelta = toMs(g_platformTime.lastFrameDuration()); Camera bookcam; bookcam.angle = Anglef(); bookcam.m_pos = Vec3f(0.f); bookcam.focal = 500.f; bookcam.cdepth = 2200.f; for(size_t i = 0; i < RUNE_COUNT; i++) { if(!gui::necklace.runes[i]) continue; EERIE_3DOBJ * rune = gui::necklace.runes[i]; Vec2i projectionCenter = Vec2i(rect.topLeft() + (Vec2f(285, 36) + Vec2f(tmpPos) * Vec2f(45, 64)) * scale); PrepareCamera(&bookcam, Rect(rect), projectionCenter); if(player.hasRune((Rune)i)) { Anglef angle; if(rune->angle.getYaw() != 0.f) { if(rune->angle.getYaw() > 300.f) { rune->angle.setYaw(300.f); } angle.setYaw(wave * rune->angle.getYaw() * (1.0f / 40)); } rune->angle.setYaw(rune->angle.getYaw() - ptDelta * 0.2f); if(rune->angle.getYaw() < 0.f) rune->angle.setYaw(0.f); // Now draw the rune TransformInfo t2(pos, glm::quat_cast(toRotationMatrix(angle))); DrawEERIEInter(rune, t2, NULL, false, 0.f); Rectf runeBox = UpdateBbox2d(*rune).toRect(); PopAllTriangleListOpaque(baseState); tmpPos.x++; if(tmpPos.x > 4) { tmpPos.x = 0; tmpPos.y++; } // TODO this is a workaround for vertexClipPositions being relative to viewport Vec2f mousePosInViewport = mousePos - rect.topLeft(); // Checks for Mouse floating over a rune... if(runeBox.contains(mousePosInViewport)) { bool r = false; for(size_t j = 0; j < rune->facelist.size(); j++) { float n = PtIn2DPolyProj(rune->vertexClipPositions, &rune->facelist[j], mousePosInViewport.x, mousePosInViewport.y); if(n != 0.f) { r = true; break; } } if(r) { TransformInfo t(pos, glm::quat_cast(toRotationMatrix(angle))); DrawEERIEInter(rune, t, NULL, false, 0.f); rune->angle.setYaw(rune->angle.getYaw() + ptDelta * 2.f); PopAllTriangleListOpaque(baseState.blendAdditive()); cursorSetInteraction(); if(eeMouseDown1()) { PlayerBookDrawRune((Rune)i); } } } TransformInfo t1(pos, quat_identity()); DrawEERIEInter(gui::necklace.lacet, t1, NULL, false, 0.f); PopAllTriangleListOpaque(baseState); } } *light = tl; PrepareCamera(oldcam, g_size); GRenderer->SetAntialiasing(false); }
void BackpackIconGui::updateInput() { static PlatformInstant flDelay = 0; // Check for backpack Icon if(m_rect.contains(Vec2f(DANAEMouse))) { if(eeMouseUp1() && playerInventory.insert(DRAGINTER)) { ARX_SOUND_PlayInterface(SND_INVSTD); Set_DragInter(NULL); } } if(m_rect.contains(Vec2f(DANAEMouse)) || flDelay != 0) { eMouseState = MOUSE_IN_INVENTORY_ICON; cursorSetInteraction(); if(eeMouseDoubleClick1()) { ARX_SOUND_PlayInterface(SND_BACKPACK, Random::getf(0.9f, 1.1f)); playerInventory.optimize(); flDelay = 0; } else if(eeMouseDown1() || flDelay != 0) { if(flDelay == 0) { flDelay = g_platformTime.frameStart(); return; } else { if(g_platformTime.frameStart() - flDelay < PlatformDurationMs(300)) { return; } else { flDelay = 0; } } if(player.Interface & INTER_INVENTORYALL) { ARX_SOUND_PlayInterface(SND_BACKPACK, Random::getf(0.9f, 1.1f)); g_playerInventoryHud.close(); } else { bInverseInventory = !bInverseInventory; lOldTruePlayerMouseLook = TRUE_PLAYER_MOUSELOOK_ON; } } else if(eeMouseDown2()) { g_playerBook.close(); ARX_INVENTORY_OpenClose(NULL); if(player.Interface & INTER_INVENTORYALL) { g_playerInventoryHud.close(); } else { if(player.Interface & INTER_INVENTORY) { ARX_SOUND_PlayInterface(SND_BACKPACK, Random::getf(0.9f, 1.1f)); g_playerInventoryHud.close(); bInventorySwitch = true; } else { ARX_SOUND_PlayInterface(SND_BACKPACK, Random::getf(0.9f, 1.1f)); player.Interface |= INTER_INVENTORYALL; g_playerInventoryHud.resetPos(); ARX_INTERFACE_NoteClose(); if(TRUE_PLAYER_MOUSELOOK_ON) { WILLRETURNTOFREELOOK = true; } } } TRUE_PLAYER_MOUSELOOK_ON = false; } if(DRAGINTER == NULL) return; } }