Пример #1
0
void ChangeLevelIconGui::update(const Rectf & parent) {
	m_rect = createChild(parent, Anchor_TopRight, m_size * m_scale, Anchor_TopRight);
	
	float wave = timeWaveSin(g_gameTime.now(), GameDurationMsf(314.159f));
	m_intensity = 0.9f - wave * 0.5f + Random::getf(0.f, 0.1f);
	m_intensity = glm::clamp(m_intensity, 0.f, 1.f);
}
Пример #2
0
void NegateMagicSpell::Update() {
	
	LaunchAntiMagicField();
	
	if(m_target == EntityHandle_Player) {
		m_pos = player.basePosition();
	} else {
		Entity * target = entities.get(m_target);
		if(target) {
			m_pos = target->pos;
		}
	}
	
	Vec3f stitepos = m_pos - Vec3f(0.f, 10.f, 0.f);
	
	RenderMaterial mat;
	mat.setLayer(RenderMaterial::Decal);
	mat.setDepthTest(true);
	mat.setTexture(tex_sol);
	mat.setBlendType(RenderMaterial::Additive);
	
	for(int i = 0; i < 360; i++) {
		float t = Random::getf();
		if(t < 0.04f) {
			
			PARTICLE_DEF * pd = createParticle();
			if(!pd) {
				break;
			}
			
			pd->ov = stitepos + arx::randomOffsetXZ(150.f);
			pd->move = Vec3f(0.f, Random::getf(-3.f, 0.f), 0.f);
			pd->siz = 0.3f;
			pd->tolive = Random::getu(2000, 4000);
			pd->tc = tex_p2;
			pd->m_flags = FADE_IN_AND_OUT | ROTATING | DISSIPATING | SUBSTRACT;
			pd->m_rotation = 0.0000001f;
		}
	}
	
	float rot = timeWaveSaw(g_gameTime.now(), GameDurationMs(18000)) * 360.f;
	
	Anglef stiteangle(0.f, -rot, 0.f);
	float scalediff = timeWaveSin(g_gameTime.now(), GameDurationMsf(1570.79632f));
	
	{
	Color3f stitecolor = Color3f::gray(.4f);
	Vec3f stitescale = Vec3f(3.f + 0.5f * scalediff);
	Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
	}
	
	{
	Color3f stitecolor = Color3f(.5f, 0.f, .5f);
	Vec3f stitescale = Vec3f(3.1f + 0.2f * scalediff);
	Draw3DObject(ssol, stiteangle, stitepos, stitescale, stitecolor, mat);
	}
}
Пример #3
0
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);
	
}
Пример #4
0
void RepelUndeadSpell::Update() {
	
	Vec3f pos = entities[m_target]->pos;
	
	float rot;
	if(m_target == EntityHandle_Player) {
		rot = player.angle.getYaw();
	} else {
		rot = entities[m_target]->angle.getYaw();
	}
	
	m_pos = pos;
	m_yaw = rot;
	
	RenderMaterial mat;
	mat.setDepthTest(true);
	mat.setBlendType(RenderMaterial::Additive);
	
	Anglef  eObjAngle;

	eObjAngle.setYaw(m_yaw);
	eObjAngle.setPitch(0);
	eObjAngle.setRoll(0);
	
	float wave = timeWaveSin(g_gameTime.now(), GameDurationMsf(6283.185307f));
	
	float vv = (1.f + wave) * 0.5f + 1.1f;
	
	Draw3DObject(ssol, eObjAngle, m_pos + Vec3f(0.f, -5.f, 0.f), Vec3f(vv), Color3f(0.6f, 0.6f, 0.8f), mat);
	
	vv *= 100.f;
	
	for(int n = 0; n < 4; n++) {
		
		PARTICLE_DEF * pd = createParticle();
		if(!pd) {
			break;
		}
		
		// XXX was this supposed to be sphericalRand ?
		Vec2f d = arx::diskRand(vv);
		
		pd->ov = m_pos + Vec3f(d.x, 0.f, d.y);
		pd->move = arx::linearRand(Vec3f(-0.8f, -4.f, -0.8f), Vec3f(0.8f, 0.f, 0.8f));
		pd->scale = Vec3f(-0.1f);
		pd->tolive = Random::getu(2600, 3200);
		pd->tc = tex_p2;
		pd->siz = 0.3f;
		pd->rgb = Color3f(.4f, .4f, .6f);
	}
	
	EERIE_LIGHT * light = dynLightCreate(m_light);
	if(light) {
		light->intensity = 2.3f;
		light->fallend = 350.f;
		light->fallstart = 150.f;
		light->rgb = Color3f(0.8f, 0.8f, 1.f);
		light->pos = m_pos + Vec3f(0.f, -50.f, 0.f);
		light->duration = GameDurationMs(200);
		light->creationTime = g_gameTime.now();
	}
	
	if (m_target == EntityHandle_Player)
		ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos);
}