Esempio n. 1
0
	void Framework::update(){

		OStringStream o;
		o << "aho" << endl; //const char*
		char ts[ 3 ];
		ts[ 0 ] = 'O';
		ts[ 1 ] = 'K';
		ts[ 2 ] = '\0';
		o << ts << endl; //char*
		o << string( "baka" ) << endl; //string
		o << RefString( "tonma" ) << endl; //RefString
		o << 'a' << endl; //char
		o << '\n'; //char ( new-line )
		o << static_cast< char >( -74 ) << endl; //char (out of range )
		o << static_cast< char >( 14 ) << endl; //char (out of range )
		o << static_cast< unsigned char >( 99 ) << endl; //unsigned char
		o << static_cast< short >( -9999 ) << endl; //short
		o << static_cast< unsigned short >( 65534 ) << endl; //unsigned short
		o << static_cast< int >( -2012345678 ) << endl; //int
		o << static_cast< unsigned >( 4012345678 ) << endl; //unsigned

		o.precision( 7 );
		o << 50.00000000000 << endl;
		o << 0.09999999999f << endl;
		o << 0.0399999999f << endl;
		o << 1.f << endl; //float ( 1 )
		o << 1.5f << endl; //float ( 1 )
		o << 1.75f << endl; //float ( 1 )
		o << 152423.f << endl; //float ( 1 )
		o << -123456789.f * 1000000.f << endl; //float (big)
		o << -1.23456789f * 0.000000001f << endl; //float (small)
//		o.precision( 15 );
		o << -1.23456789f * 0.000000001f << endl; //float (small)
o << -134.56712839f << endl;
o << -0.056712839f << endl;
		o << 0.0 << endl; //float +0
		o << -0.0 << endl; //float -0
		o << sqrtf( -1.f ) << endl; //float NaN
		o << -1e30f * 1e30f << endl; //float +Inf
		o << 1e-30f * 1e-30f << endl; //float -Denorm
		o << -numeric_limits< float >::max() << endl; //float max
		o << numeric_limits< float >::min() << endl; //float min

		o << -123456789.0 * 1000000.0 << endl; //double (big)
		o << -1.234567890 * 0.000000001 << endl; //double (small)
		o << 0.0 << endl; //double +0
		o << -0.0 << endl; //double -0
		o << sqrt( -1.0 ) << endl; //double NaN
		o << -1e300 * 1e300 << endl; //double +Inf
		o << 1e-300 * 1e-300 << endl; //double -Denorm
		o << -numeric_limits< double >::max() << endl; //double max

		Array< char > out;
		o.get( &out );
		cout << &out[ 0 ] << endl;

		cout << o << endl;

		requestEnd();
	}
Esempio n. 2
0
	void Framework::update(){
		if ( !Sequence::Parent::instance() ){
			Sequence::Parent::create();
			setFrameRate( 60 );
		}
		Sequence::Parent::instance()->update();
		//終了判定(qが押されたか、マウスで×ボタンが叩かれたか)
		if ( isKeyOn( 'q' ) ){
			requestEnd();
		}
		if ( isEndRequested() ){
			Sequence::Parent::destroy();
		}
	}
Esempio n. 3
0
	void Framework::update(){
		if ( !gRootSequence ){
			gRootSequence = new Sequence::Parent();
		}
		//フレームレート調整
		setFrameRate( 60 ); //一回呼べばいいのだが面倒なので呼んでしまう。

		if ( gCounter % 60 == 0 ){ //60フレームに一回フレームレート表示
			cout << " FrameRate:" << frameRate() << endl;
		}
		++gCounter;

		gRootSequence->update();

		//終了判定(qが押されたか、マウスで×ボタンが叩かれたか)
		if ( isKeyOn( 'q' ) ){
			requestEnd();
		}
		if ( isEndRequested() ){
			SAFE_DELETE( gRootSequence );
		}
	}
Esempio n. 4
0
void RuneOfGuardingSpell::Update() {
	
	EERIE_LIGHT * light = lightHandleGet(m_light);
	if(light) {
		float fa = Random::getf(0.85f, 1.0f);
		light->intensity = 0.7f + 2.3f * fa;
		light->fallend = 350.f;
		light->fallstart = 150.f;
		light->rgb = Color3f(1.0f, 0.2f, 0.2f);
		light->creationTime = g_gameTime.now();
		light->duration = GameDurationMs(200);
	}
	
	Vec3f pos = m_pos + Vec3f(0.f, -20.f, 0.f);
	
	RenderMaterial mat;
	mat.setDepthTest(true);
	mat.setBlendType(RenderMaterial::Additive);
	
	Anglef stiteangle;
	Color3f stitecolor;
	
	float stiteangleb = m_elapsed / GameDurationMs(100);
	stiteangle.setPitch(0);
	stiteangle.setRoll(0);
	
	stiteangle.setYaw(stiteangleb * 0.1f);
	stitecolor = Color3f(0.4f, 0.4f, 0.6f);
	float scale = std::sin(m_elapsed / GameDurationMsf(66.6666666f));
	Vec3f stitescale = Vec3f(1.f, -0.1f, 1.f);
	
	Draw3DObject(slight, stiteangle, pos, stitescale, stitecolor, mat);
	
	stiteangle.setYaw(stiteangleb);
	stitecolor = Color3f(0.6f, 0.f, 0.f);
	stitescale = Vec3f(2.f) * (1.f + 0.01f * scale);
	
	Draw3DObject(ssol, stiteangle, pos, stitescale, stitecolor, mat);
	
	stitecolor = Color3f(0.6f, 0.3f, 0.45f);
	stitescale = Vec3f(1.8f) * (1.f + 0.02f * scale);
	
	Draw3DObject(srune, stiteangle, pos, stitescale, stitecolor, mat);
	
	for(int n = 0; n < 4; n++) {
		
		PARTICLE_DEF * pd = createParticle();
		if(!pd) {
			break;
		}
		
		pd->ov = pos + arx::randomOffsetXZ(40.f);
		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);
	}
	
	
	
	Sphere sphere = Sphere(m_pos, std::max(m_level * 15.f, 50.f));
	if(CheckAnythingInSphere(sphere, m_caster, CAS_NO_SAME_GROUP | CAS_NO_BACKGROUND_COL | CAS_NO_ITEM_COL
	                                           | CAS_NO_FIX_COL | CAS_NO_DEAD_COL)) {
		spawnFireHitParticle(m_pos, 0);
		PolyBoomAddScorch(m_pos);
		LaunchFireballBoom(m_pos, m_level);
		DoSphericDamage(Sphere(m_pos, 30.f * m_level), 4.f * m_level,
		                DAMAGE_AREA, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MAGICAL, m_caster);
		ARX_SOUND_PlaySFX(g_snd.SPELL_RUNE_OF_GUARDING_END, &m_pos);
		requestEnd();
	}
}
Esempio n. 5
0
void SummonCreatureSpell::Update() {
	
	if(g_gameTime.isPaused()) {
		return;
	}
	
	if(m_elapsed <= GameDurationMs(4000)) {
		if(Random::getf() > 0.7f) {
			Vec3f pos = m_fissure.m_eSrc;
			MakeCoolFx(pos);
		}
		
		m_fissure.Update(g_gameTime.lastFrameDuration());
		m_fissure.Render();
		
		m_requestSummon = true;
		m_summonedEntity = EntityHandle();

	} else if(m_requestSummon) {
		lightHandleDestroy(m_light);
		
		m_requestSummon = false;
		ARX_SOUND_PlaySFX(SND_SPELL_ELECTRIC, &m_targetPos);
		
		Cylinder phys = Cylinder(m_targetPos, 50, -200);
		
		float anything = CheckAnythingInCylinder(phys, NULL, CFLAG_JUST_TEST);
		
		if(glm::abs(anything) < 30) {
			
			long tokeep;
			res::path cls;
			if(m_megaCheat) {
				if(Random::getf() > 0.5f) {
					tokeep = -1;
					cls = "graph/obj3d/interactive/npc/wrat_base/wrat_base";
				} else {
					tokeep = 0;
					cls = "graph/obj3d/interactive/npc/y_mx/y_mx";
				}
			} else if(Random::getf() > 0.997f || (sp_max && Random::getf() > 0.8f)
			   || (cur_mr >= 3 && Random::getf() > 0.3f)) {
				tokeep = 0;
				cls = "graph/obj3d/interactive/npc/y_mx/y_mx";
			} else if(Random::getf() > 0.997f || (cur_rf >= 3 && Random::getf() > 0.8f)
			   || (cur_mr >= 3 && Random::getf() > 0.3f)) {
				tokeep = -1;
				cls = "graph/obj3d/interactive/npc/wrat_base/wrat_base";
			} else if(m_level >= 9) {
				tokeep = 1;
				cls = "graph/obj3d/interactive/npc/demon/demon";
			} else if(Random::getf() > 0.98f) {
				tokeep = -1;
				cls = "graph/obj3d/interactive/npc/wrat_base/wrat_base";
			} else {
				tokeep = 0;
				cls = "graph/obj3d/interactive/npc/chicken_base/chicken_base";
			}
			
			Entity * io = AddNPC(cls, -1, IO_IMMEDIATELOAD);
			if(!io) {
				cls = "graph/obj3d/interactive/npc/chicken_base/chicken_base";
				tokeep = 0;
				io = AddNPC(cls, -1, IO_IMMEDIATELOAD);
			}
			
			if(io) {
				RestoreInitialIOStatusOfIO(io);
				
				io->summoner = m_caster;
				
				io->scriptload = 1;
				
				if(tokeep == 1) {
					io->ioflags |= IO_NOSAVE;
				}
				
				io->pos = phys.origin;
				SendInitScriptEvent(io);
				
				if(tokeep < 0) {
					io->scale = 1.65f;
					io->physics.cyl.radius = 25;
					io->physics.cyl.height = -43;
					io->speed_modif = 1.f;
				}
				
				SendIOScriptEvent(entities.get(m_caster), io, SM_SUMMONED);
				
				for(long j = 0; j < 3; j++) {
					Vec3f pos = m_fissure.m_eSrc;
					pos += arx::randomVec3f() * 100.f;
					pos += Vec3f(-50.f, 50.f, -50.f);
					
					MakeCoolFx(pos);
				}
				
				if(tokeep == 1) {
					m_summonedEntity = io->index();
				} else {
					m_summonedEntity = EntityHandle();
				}
				
			}
		}
		
	} else if(m_summonedEntity == EntityHandle()) {
		requestEnd();
	}
	
}