예제 #1
0
//*************************************************************************************
// Entity * FlyingOverObject(EERIE_S2D * pos)
//-------------------------------------------------------------------------------------
// FUNCTION/RESULT:
//   Returns IO under cursor, be it in inventories or in scene
//   Returns NULL if no IO under cursor
//*************************************************************************************
Entity * FlyingOverObject(const Vec2s & pos)
{
	Entity* io = NULL;

	// TODO do this properly!
	if(player.torch && eMouseState == MOUSE_IN_TORCH_ICON) {
		return player.torch;
	}
	
	if((io = GetFromInventory(pos)) != NULL)
		return io;

	if(InInventoryPos(pos))
		return NULL;

	if((io = InterClick(pos)) != NULL)
		return io;

	return NULL;
}
예제 #2
0
Entity * FlyingOverObject(const Vec2s & pos) {
	
	// TODO do this properly!
	if(player.torch && eMouseState == MOUSE_IN_TORCH_ICON) {
		return player.torch;
	}
	
	if(Entity * entity = GetFromInventory(pos).first) {
		return entity;
	}
	
	if(InInventoryPos(pos)) {
		return NULL;
	}
	
	if(Entity * entity = InterClick(pos)) {
		return entity;
	}
	
	return NULL;
}
예제 #3
0
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);
		}
	}
}