Ejemplo n.º 1
0
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;
		}
	}
}
Ejemplo n.º 2
0
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);
		}
	}
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
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]);
		}
	}
}
Ejemplo n.º 5
0
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);
		}
	}
}
Ejemplo n.º 6
0
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();
			}
		}
	}
	
}
Ejemplo n.º 7
0
//-----------------------------------------------------------------------------
// ARX Menu Rendering Func
// returns false if no menu needs to be displayed
//-----------------------------------------------------------------------------
bool ARX_Menu_Render() {
	
	if(ARXmenu.currentmode == AMCM_OFF)
		return false;

	bool br = Menu2_Render();

	if(br)
		return br;

	if(ARXmenu.currentmode == AMCM_OFF)
		return false;


	GRenderer->Clear(Renderer::ColorBuffer | Renderer::DepthBuffer);
	
	FLYING_OVER = 0;

	//-------------------------------------------------------------------------

	if(ARXmenu.currentmode == AMCM_NEWQUEST && ARXmenu.mda) {
		
		GRenderer->SetRenderState(Renderer::Fog, false);
		GRenderer->SetRenderState(Renderer::AlphaBlending, false);

		if(ARXmenu.mda->BookBackground != NULL) {
			GRenderer->SetRenderState(Renderer::AlphaBlending, false);
			GRenderer->SetRenderState(Renderer::Fog, false);
			GRenderer->SetRenderState(Renderer::DepthWrite, false);
			GRenderer->SetRenderState(Renderer::DepthTest, false);

			EERIEDrawBitmap2(Rectf(Vec2f(0, 0), g_size.width(), g_size.height()), 0.9f, ARXmenu.mda->BookBackground, Color::white);
		}

		BOOKZOOM = 1;

		ARX_INTERFACE_ManageOpenedBook();


		if(ARXmenu.mda) {
			long DONE = 0;

			if(player.Skill_Redistribute == 0 && player.Attribute_Redistribute == 0)
				DONE = 1;
			
			if(!ARXmenu.mda->flyover[FLYING_OVER].empty() ) //=ARXmenu.mda->flyover[FLYING_OVER];
			{
				if(FLYING_OVER != OLD_FLYING_OVER) {

					float fRandom = rnd() * 2;

					int t = checked_range_cast<int>(fRandom);

					pTextManage->Clear();
					OLD_FLYING_OVER = FLYING_OVER;
					UNICODE_ARXDrawTextCenteredScroll(hFontInGame,
						(g_size.width() * 0.5f),
						12,
						(g_size.center().x) * 0.82f,
						ARXmenu.mda->flyover[FLYING_OVER],
						Color(232 + t, 204 + t, 143 + t),
						1000,
						0.01f,
						2);
				}
			} else {
				OLD_FLYING_OVER = -1;
			}
			
			Vec2f pos;
			pos.x = 0;
			pos.y = 313 * g_sizeRatio.y + (g_size.height() - 313 * g_sizeRatio.y) * 0.70f;
			
			Vec2f size = g_sizeRatio;
			size *= 100;
			
			Color color = Color::none;

			//---------------------------------------------------------------------
			// Button QUICK GENERATION
			pos.x = (g_size.width() - (513 * g_sizeRatio.x)) * 0.5f;
			
			const Rectf quickGenerateButtonMouseTestRect(
				pos,
				size.x,
				size.y
			);
			
			if(quickGenerateButtonMouseTestRect.contains(Vec2f(DANAEMouse))) {
				SpecialCursor = CURSOR_INTERACTION_ON;
				FLYING_OVER = BUTTON_QUICK_GENERATION;

				if(eeMousePressed1());
				else if (eeMouseUp1())
				{
					QUICK_MOD++;
					int iSkin = player.skin;
					ARX_SOUND_PlayMenu(SND_MENU_CLICK);

					if(bQuickGenFirstClick) {
						ARX_PLAYER_MakeAverageHero();
						bQuickGenFirstClick = false;
					} else {
						ARX_PLAYER_QuickGeneration();
					}

					player.skin = checked_range_cast<char>(iSkin);
				}

				color = Color(255, 255, 255);
			}
			else
				color = Color(232, 204, 143);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_quickgen, static_cast<long>(pos.x), static_cast<long>(pos.y), color);

			//---------------------------------------------------------------------
			// Button SKIN
			pos.x = g_size.width() * 0.5f;
			
			const Rectf skinButtonMouseTestRect(
				pos,
				size.x,
				size.y
			);
			
			if(skinButtonMouseTestRect.contains(Vec2f(DANAEMouse))) {
				SpecialCursor = CURSOR_INTERACTION_ON;
				FLYING_OVER = BUTTON_SKIN;

				if(eeMouseUp1()) {
					SKIN_MOD++;
					BOOKZOOM = 1;
					ARX_SOUND_PlayMenu(SND_MENU_CLICK);
					player.skin++;

					if(player.skin > 3)
						player.skin = 0;

					ARX_PLAYER_Restore_Skin();
				}

				color = Color(255, 255, 255);
			}
			else
				color = Color(232, 204, 143);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_skin, static_cast<long>(pos.x), static_cast<long>(pos.y), color);

			//---------------------------------------------------------------------
			// Button DONE
			pos.x = g_size.width() - (g_size.width() - 513 * g_sizeRatio.x) * 0.5f - 40 * g_sizeRatio.x;
			
			const Rectf doneButtonMouseTestRect(
				pos,
				size.x,
				size.y
			);
			
			if(doneButtonMouseTestRect.contains(Vec2f(DANAEMouse))) {
				if(DONE)
					SpecialCursor = CURSOR_INTERACTION_ON;

				FLYING_OVER = BUTTON_DONE;

				if(DONE && eeMouseUp1()) {
					if(SKIN_MOD == 8 && QUICK_MOD == 10) {
						SKIN_MOD = -2;
					} else if(SKIN_MOD == -1) {
						ARX_PLAYER_MakeSpHero();
						player.skin = 4;
						ARX_PLAYER_Restore_Skin();
						SKIN_MOD = 0;
						SP_HEAD = 1;
					} else {
						if(SP_HEAD) {
							player.skin = 4;
							ARX_PLAYER_Restore_Skin();
							SP_HEAD = 0;
						}

						ARX_SOUND_PlayMenu(SND_MENU_CLICK);

						bFadeInOut = true;		//fade out
						bFade = true;			//active le fade
						iFadeAction = AMCM_OFF;
					}
				} else {
					if(DONE)
						color = Color(255, 255, 255);
					else
						color = Color(192, 192, 192);
				}
			} else {
				if(DONE)
					color = Color(232, 204, 143);
				else
					color = Color(192, 192, 192);
			}

			if(SKIN_MOD < 0)
				color = Color(255, 0, 255);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_done, static_cast<long>(pos.x), static_cast<long>(pos.y), color);
		}
	}

	EERIE_LIGHT * light = lightHandleGet(torchLightHandle);
	light->pos.x = 0.f + GInput->getMousePosAbs().x - (g_size.width() >> 1);
	light->pos.y = 0.f + GInput->getMousePosAbs().y - (g_size.height() >> 1);

	if(pTextManage) {
		pTextManage->Update(framedelay);
		pTextManage->Render();
	}

	if(ARXmenu.currentmode != AMCM_CREDITS)
		ARX_INTERFACE_RenderCursor(true);

	if(ARXmenu.currentmode == AMCM_NEWQUEST) {
		if(ProcessFadeInOut(bFadeInOut, 0.1f)) {
			switch(iFadeAction) {
				case AMCM_OFF:
					arxtime.resume();
					ARX_MENU_NEW_QUEST_Clicked_QUIT();
					iFadeAction = -1;
					bFade = false;
					fFadeInOut = 0.f;

					if(pTextManage)
						pTextManage->Clear();

					break;
			}
		}
	}

	return true;
}
Ejemplo n.º 8
0
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;
	}
}