void SubXP(int xp, bool quiet)
{
Weapon *weapon = &player->weapons[player->curWeapon];
bool leveled_down = false;

	weapon->xp -= xp;
	
	// leveling down...
	while(weapon->xp < 0)
	{
		if (weapon->level > 0)
		{
			weapon->level--;
			weapon->xp += weapon->max_xp[weapon->level];
			leveled_down = true;
		}
		else
		{
			weapon->xp = 0;
			break;
		}
	}
	
	if (player->curWeapon == WPN_SPUR)
		leveled_down = false;
	
	if (leveled_down && !quiet && !player->hide)
	{
		effect(player->CenterX(), player->CenterY(), EFFECT_LEVELDOWN);
	}
}
void Base_Effect_base_event2(PARTICLE* p) {
	if(p.alpha <= 1.000) {
		parted_temp_vec.x = 0.000;
		parted_temp_vec.y = 0.000;
		parted_temp_vec.z = 0.000;
		vec_add(parted_temp_vec,p.x);
		parted_temp2_vec.x = random(2.000)+(-1.000);
		parted_temp2_vec.y = random(2.000)+(-1.000);
		parted_temp2_vec.z = (1.000);
		if(!(total_frames % 25)) {
			p.skill_c += 3.000*time_step*6.25;
			if(p.skill_c >= 1){
				effect(New_child_child2,integer(p.skill_c),parted_temp_vec,parted_temp2_vec);
				p.skill_c -= integer(p.skill_c);
			}
		}
	}
	p.alpha = clamp(p.alpha-3.000* time_step,-1,100);
	if(p.size >= 11.000 || (p.skill_a & 2)) {
		p.skill_a |= 2;
		p.size -= 1.000* time_step;
	}
	if(p.size <= 3.000 || (p.skill_a & 4)) {
		p.skill_a |= 4;
		p.size += 1.000* time_step;
	}
	if(p.alpha < 0 || p.size < 0) p.lifespan = 0;
}
void emit_fountain1() {
	
	my._BEING_MANIPULATED = 0;
	
	my.emask |= ENABLE_CLICK;
	my.event = ObjectManipulationCore;
	
	var my_time;my_time = 0;
	var timetable_num;timetable_num = 0;
	var eff_frac; eff_frac = 0;
	wait(1);
	while(my) {
		my_time += time_step/16;
		if(my_time >= 0.000)my_time = 0;
		timetable_num = 1;
		parted_temp_vec.x = 0.000;
		parted_temp_vec.y = 0.000;
		parted_temp_vec.z = 0.000;
		vec_add(parted_temp_vec,my.x);
		eff_frac += 3.000*timetable_num*time_step*6.25;
		if(eff_frac >= 1){
			effect(Base_Effect3_base,integer(eff_frac),parted_temp_vec,nullvector);
			eff_frac -= integer(eff_frac);
		}
		wait(1);
	}
}
Exemple #4
0
BOOL crLottiUpdateFly (ENTITY* e)
{
	VECTOR v, w;
	
	vec_set(&w, e->crAccel);
	vec_scale(&w, time_step);
	vec_add(e->crSpeed, &w);
	
	vec_set(&v, e->crSpeed);
	vec_scale(&v, time_step);
	vec_add(e->x, &v);
	
	VECTOR feet;
	
	feet.x = feet.y = 0;
	feet.z = 0.5 * e->min_z;
	
	vec_rotate(feet, e->pan);
	vec_add(feet, e->x);
	
	ent_animate(e, "drown", 5 * total_ticks + e->crInit, ANM_CYCLE);
	
	effect(credits_fire, 2, feet, e->crSpeed);
	
	// explode near screen border

	VECTOR v;
	vec_set(&v, e->x);
	
	vec_to_screen(&v, camera);
	
	return (v.x < e->crPercent * screen_size.x || v.x > (1 - e->crPercent) * screen_size.x ||
	        v.y < e->crPercent * screen_size.y || v.y > (1 - e->crPercent) * screen_size.y);
}
void eff_expl_flash() {
	int i;
	set(me, BRIGHT | TRANSLUCENT | LIGHT | ZNEAR | PASSABLE);
	my.alpha = 50;
	my.roll = random(360);
	while(my.alpha < 100) {
		my.alpha += time_step * (random(20)+20);
		my.roll += time_step * sign(ang(my.roll));
		vec_fill ( my.scale_x, my.alpha/13 );
		wait(1);		
	}
	for(i=0; i<4; i++) {
		ent_create("explFlash01.tga", my.x, eff_expl_flash_2);
		you = ent_create("explFlash02.tga", my.x, eff_expl_flash_2);		
		if (i == 0) set(you, LIGHT);
	}
	for(i=0; i<5; i++) {
		ent_create ("explSmoke01.tga", my.x, eff_expl_smoke2);
	}
	effect(p_eff_expl_particle, 200, my.x, NULL);
	vec_add(my.scale_x, vector(3,3,3));
	ent_create("explSmoke02.tga", my.x, eff_expl_smoke);
	while(my.alpha > 0) {
		my.alpha -= time_step * 25;
		my.roll += time_step * sign(ang(my.roll));
		wait(1);
	} 
	ent_remove(me);
}
Exemple #6
0
int halo_impl::add(int x, int y, const std::string& image, const map_location& loc,
                   ORIENTATION orientation, bool infinite)
{
    const int id = halo_id++;
    animated<image::locator>::anim_description image_vector;
    std::vector<std::string> items = utils::square_parenthetical_split(image, ',');

    for(const std::string& item : items) {
        const std::vector<std::string>& sub_items = utils::split(item, ':');
        std::string str = item;
        int time = 100;

        if(sub_items.size() > 1) {
            str = sub_items.front();
            try {
                time = std::stoi(sub_items.back());
            } catch(std::invalid_argument) {
                ERR_DP << "Invalid time value found when constructing halo: " << sub_items.back() << "\n";
            }
        }
        image_vector.push_back(animated<image::locator>::frame_description(time,image::locator(str)));

    }
    haloes.insert(std::pair<int,effect>(id,effect(disp,x,y,image_vector,loc,orientation,infinite)));
    new_haloes.insert(id);
    if(haloes.find(id)->second.does_change() || !infinite) {
        changing_haloes.insert(id);
    }
    return id;
}
main(int ac,char *av[])
{
	ImageData *img,*outimg;
	int res;
	int x,y,mx,my;

	if(ac<3) {
		printf("パラメータが足りません");
		return;
	}

	// ファイルより画像データの読み込み
	res=readBMPfile(av[1],&img);
	if(res<0) {
		printf("画像が読めません");
		return;
	}

	// 結果格納用画像データ作成
	outimg=createImage(img->width,img->height,24);
	
	effect(img,outimg);

	writeBMPfile(av[2],outimg);
	disposeImage(img);
	disposeImage(outimg);

}
void player_particles()
{
	VECTOR particle_pos[3];
	vec_set (particle_pos.x, player.x);
	particle_pos.z += 70; // place the healing particles above the characters' heads		
	effect(particle_void, 1, particle_pos, nullvector);
}
Exemple #9
0
int halo_impl::add(int x, int y, const std::string& image, const map_location& loc,
		ORIENTATION orientation, bool infinite)
{
	const int id = halo_id++;
	animated<image::locator>::anim_description image_vector;
	std::vector<std::string> items = utils::square_parenthetical_split(image, ',');
	std::vector<std::string>::const_iterator itor = items.begin();
	for(; itor != items.end(); ++itor) {
		const std::vector<std::string>& items = utils::split(*itor, ':');
		std::string str;
		int time;

		if(items.size() > 1) {
			str = items.front();
			time = atoi(items.back().c_str());
		} else {
			str = *itor;
			time = 100;
		}
		image_vector.push_back(animated<image::locator>::frame_description(time,image::locator(str)));

	}
	haloes.insert(std::pair<int,effect>(id,effect(disp,x,y,image_vector,loc,orientation,infinite)));
	new_haloes.insert(id);
	if(haloes.find(id)->second.does_change() || !infinite) {
		changing_haloes.insert(id);
	}
	return id;
}
void emit_fire1() {
	
	my._BEING_MANIPULATED = 0;
	
	my.emask |= ENABLE_CLICK;
	my.event = ObjectManipulationCore;
	
	var my_time;my_time = 0;
	var timetable_num;timetable_num = 0;
	var eff_frac; eff_frac = 0;
	wait(1);
	while(my) {
		my_time += time_step/16;
		if(my_time >= 0.000)my_time = 0;
		timetable_num = 1;
		parted_temp_vec.x = random(20.000)+-10.000;
		parted_temp_vec.y = random(20.000)+-10.000;
		parted_temp_vec.z = random(5.098)+-0.098;
		vec_add(parted_temp_vec,my.x);
		parted_temp2_vec.x = random(0.600)+(-0.300);
		parted_temp2_vec.y = random(0.600)+(-0.300);
		parted_temp2_vec.z = random(0.239)+(0.261);
		eff_frac += 2.000*timetable_num*time_step*6.25;
		if(eff_frac >= 1){
			effect(Base_Effect_base2,integer(eff_frac),parted_temp_vec,parted_temp2_vec);
			eff_frac -= integer(eff_frac);
		}
		wait(1);
	}
}
main(int ac,char *av[])
{
	ImageData *img,*outimg;
	int res;
	int x,y,mx,my;

	if(ac<4) {
		printf("パ??ータが足りません");
		return;
	}


	res=readBMPfile(av[1],&img);
	if(res<0) {
		printf("画?が読めません");
		return;
	}


	outimg=createImage(img->width,img->height,24);
	
	effect(img,outimg,atoi(av[3]));

	writeBMPfile(av[2],outimg);
	disposeImage(img);
	disposeImage(outimg);

}
Exemple #12
0
void EffectView::editControls()
{
	if( m_subWindow )
	{
		if( !m_subWindow->isVisible() )
		{
			m_subWindow->show();
			m_subWindow->raise();
			effect()->controls()->setViewVisible( true );
		}
		else
		{
			m_subWindow->hide();
			effect()->controls()->setViewVisible( false );
		}
	}
}
Exemple #13
0
void EffectView::closeEffects()
{
	if( m_subWindow )
	{
		m_subWindow->hide();
	}
	effect()->controls()->setViewVisible( false );
}
Exemple #14
0
//Fonction qui calcule les dommages d'une attaque du pokemon 1 sur le pokemon 2, et l'affiche
int hit (Attaque att, Pokemon pok1, Pokemon pok2)
{
  //Divise par 2 pour contrer le fois 2 de effect
  int N = effect(pok2, att) * (pok1.ATK + att.Force) / (2 * pok2.DEF);
  printf("%s a utilise %s.\n", pok1.Nom, att.Nom);
  //Affiche l'efficacité de l'attaque
  if (effect(pok2, att) == 4)
    {
      printf("C'est tres efficace !\n");
    }
  else if (effect(pok2, att) == 1)
    {
      printf("Ce n'est pas tres efficace.\n");
    }
  printf("%s a pris %d points de dégats.\n\n", pok2.Nom, N);
  return(N);
}
Exemple #15
0
void ai_hey_spawner(Object *o)
{
	if (!o->state)
	{
		effect(o->x, o->y - (8<<CSF), EFFECT_HEY);
		o->state = 1;
	}
}
Exemple #16
0
bool Animation::isCandidateForAnimationOnCompositor(double playerPlaybackRate) const
{
    if (!effect()
        || !m_target
        || (m_target->renderStyle() && m_target->renderStyle()->hasMotionPath()))
        return false;

    return CompositorAnimations::instance()->isCandidateForAnimationOnCompositor(specifiedTiming(), *effect(), playerPlaybackRate);
}
Exemple #17
0
void ai_minicore_shot(Object *o)
{
	if (++o->timer2 > 150)
	{
		effect(o->CenterX(), o->CenterY(), EFFECT_FISHY);
		o->Delete();
	}
	
	ai_animate2(o);
}
Exemple #18
0
//Fonction attaque de l'AI qui cherche le minimum de dommage
Attaque att_AI_min (Pokemon pok1, Pokemon pok2)
{
  int i;
  int res = effect(pok2, pok1.Attaques[0]) * (pok1.ATK + pok1.Attaques[0].Force) / (2 * pok2.DEF);
  int j = 0;
  int hit = 0;
  //
  for (i = 1; i < 4; i++)
    {
      hit = effect(pok2, pok1.Attaques[i]) * (pok1.ATK + pok1.Attaques[i].Force) / (2 * pok2.DEF);
      if (min(res, hit) != res) 
	{
	  res = hit;
	  j = i;
	}
    }
  //Renvoie l'attaque la plus faible
  return(pok1.Attaques[j]);
}
Exemple #19
0
void ai_ironh_brick(Object *o)
{
	if (!o->state)
	{
		int r = random(0, 9);
		if (r == 9)
		{
			o->sprite = SPR_IRONH_BIGBRICK;
		}
		else
		{
			o->sprite = SPR_IRONH_BRICK;
			o->frame = r;
		}
		
		o->xinertia = random(0x100, 0x200);
		o->xinertia *= (o->dir == LEFT) ? -2 : 2;
		
		o->yinertia = random(-0x200, 0x200);
		o->state = 1;
	}
	
	// bounce off the walls
	if (o->yinertia < 0 && o->y <= (16<<CSF))
	{
		effect(o->CenterX(), o->y, EFFECT_BONKPLUS);
		o->yinertia = -o->yinertia;
	}
	
	if (o->yinertia > 0 && (o->Bottom() >= (239<<CSF)))
	{
		effect(o->CenterX(), o->Bottom(), EFFECT_BONKPLUS);
		o->yinertia = -o->yinertia;
	}
	
	
	if ((o->xinertia < 0 && (o->x < -0x2000)) ||\
		(o->x > (map.xsize * TILE_W) << CSF))
	{
		o->Delete();
	}
}
Exemple #20
0
void ScriptRunner::run() {
    uint8_t command;
    const uint8_t* pos = script;
    while (true) {
        command = *(pos++);
        if (command == CODE_END) {
            pos = script;
            break;
        }

        switch (command) {
        case CODE_RATE:
            runner.set_delay(*(pos++));
            break;
        case CODE_HSCROLL: {
            PString text(pos++);
            HScrollEffect effect(runner.get_display(), font_jiffy, text, true);
            runner.show(effect);
            pos += text.size();
        } break;
        case CODE_LEFT: {
            PString text(pos++);
            LeftEffect effect(runner.get_display(), font_jiffy, text);
            runner.show(effect);
            pos += text.size();
        } break;
        case CODE_SLEEP: {
            uint16_t cycles = *(pos++);
            cycles <<= 8;
            cycles |= *(pos++);
            cycles /= runner.get_delay();
            DelayEffect effect(runner.get_display(), cycles);
            runner.show(effect);
        } break;
        case CODE_BITMAP: {
            BitmapEffect effect(runner.get_display(), pos);
            runner.show(effect);
            pos += 32;
        } break;
        }
    }
}
Exemple #21
0
bool NyquistEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxString & path)
{
   NyquistEffect effect(path);
   if (effect.IsOk())
   {
      pm.RegisterPlugin(this, &effect);
      return true;
   }

   return false;
}
Exemple #22
0
void effEbBlood (VECTOR* pos, VECTOR* vecVel, var pSpeed, BOOL bInverse, int num, double scale)
{
	vec_normalize(vecVel, pSpeed);
	
	if (bInverse)
		vec_scale(vecVel, -1);
		
	g_effEbBloodScale = scale;
	
	effect(effEbBlood_p, num, pos, vecVel);
}
Exemple #23
0
void ai_black_lightning(Object *o)
{
	ANIMATE(0, 0, 1);
	o->yinertia = 0x1000;
	
	if (o->blockd)
	{
		effect(o->CenterX(), o->Bottom(), EFFECT_BOOMFLASH);
		SmokeXY(o->CenterX(), o->Bottom(), 3, o->Width()>>CSF, 4);
		o->Delete();
	}
Exemple #24
0
effect Creature::get_effect(efftype_id eff_id, body_part bp) const
{
    auto got_outer = effects.find(eff_id);
    if(got_outer != effects.end()) {
        auto got_inner = got_outer->second.find(bp);
        if (got_inner != got_outer->second.end()) {
            return got_inner->second;
        }
    }
    return effect();
}
void emit_fire2() {
	
	my._BEING_MANIPULATED = 0;
	
	my.emask |= ENABLE_CLICK;
	my.event = ObjectManipulationCore;
	
	var my_time;my_time = 0;
	var timetable_num;timetable_num = 0;
	var eff_frac; eff_frac = 0;
	wait(1);
	while(my) {
		my_time += time_step/16;
		if(my_time >= 0.000)my_time = 0;
		timetable_num = 1;
		parted_temp_vec.x = random(10.000)+-5.000;
		parted_temp_vec.y = random(10.000)+-5.000;
		parted_temp_vec.z = random(0.000)+0.000;
		vec_add(parted_temp_vec,my.x);
		if(!(total_frames % 2) && timetable_num) {
			eff_frac += 2.000*timetable_num*time_step*6.25;
			if(eff_frac >= 1){
				effect(Base_Effect4_base,integer(eff_frac),parted_temp_vec,nullvector);
				eff_frac -= integer(eff_frac);
			}
		}
		timetable_num = 1;
		parted_temp_vec.x = random(10.000)+-5.000;
		parted_temp_vec.y = random(10.000)+-5.000;
		parted_temp_vec.z = random(0.000)+0.000;
		vec_add(parted_temp_vec,my.x);
		if(!(total_frames % 8) && timetable_num) {
			eff_frac += 1.000*timetable_num*time_step*6.25;
			if(eff_frac >= 1){
				effect(New_effect1_base,integer(eff_frac),parted_temp_vec,nullvector);
				eff_frac -= integer(eff_frac);
			}
		}
		wait(1);
	}
}
void emit_doublehelix() {
	
	my._BEING_MANIPULATED = 0;
	
	my.emask |= ENABLE_CLICK;
	my.event = ObjectManipulationCore;
	
	var my_time;my_time = 0;
	var timetable_num;timetable_num = 0;
	var eff_frac; eff_frac = 0;
	wait(1);
	while(my) {
		my_time += time_step/16;
		if(my_time >= 0.000)my_time = 0;
		timetable_num = 1;
		parted_temp_vec.x = 20.000;
		parted_temp_vec.y = -20.000;
		parted_temp_vec.z = 0.000;
		vec_add(parted_temp_vec,my.x);
		if(!(total_frames % 3) && timetable_num) {
			eff_frac += 1.000*timetable_num*time_step*6.25;
			if(eff_frac >= 1){
				effect(Base_Effect_base3,integer(eff_frac),parted_temp_vec,nullvector);
				eff_frac -= integer(eff_frac);
			}
		}
		timetable_num = 1;
		parted_temp_vec.x = -20.000;
		parted_temp_vec.y = 20.000;
		parted_temp_vec.z = 0.000;
		vec_add(parted_temp_vec,my.x);
		if(!(total_frames % 3) && timetable_num) {
			eff_frac += 1.000*timetable_num*time_step*6.25;
			if(eff_frac >= 1){
				effect(Base_Effect1_base3,integer(eff_frac),parted_temp_vec,nullvector);
				eff_frac -= integer(eff_frac);
			}
		}
		wait(1);
	}
}
Exemple #27
0
void Effect::execute(const UnicodeString& args) {
    world::Manager* worldMan = world::Manager::getSingleton();

    boost::shared_ptr<world::IngameObject> sourceObj = boost::static_pointer_cast<world::IngameObject>(worldMan->getPlayer());

    boost::shared_ptr<world::IngameParticleEffect> effect(new world::IngameParticleEffect());
    if (ui::particles::XmlLoader::fromFile(args, effect)) {
        effect->setAtSource(sourceObj);
        effect->setShouldExplode(false);
        worldMan->addEffect(effect);
    }
}
Exemple #28
0
void ai_firewhirr_shot(Object *o)
{
    ANIMATE(1, 0, 2);
    o->x += (o->dir==LEFT) ? -0x200 : 0x200;

    if ((o->dir==LEFT && o->blockl) || (o->dir==RIGHT && o->blockr))
    {
        if (o->dir == RIGHT) o->x += o->Width();
        effect(o->x, o->CenterY(), EFFECT_FISHY);
        o->Delete();
    }
}
void CompressorGui::updateValues()
      {
      cg.rms->setValue(effect()->nvalue(0));
      cg.attack->setValue(effect()->nvalue(1));
      cg.release->setValue(effect()->nvalue(2));
      cg.threshold->setValue(effect()->nvalue(3));
      cg.ratio->setValue(effect()->nvalue(4));
      cg.knee->setValue(effect()->nvalue(5));
      cg.gain->setValue(effect()->nvalue(6));
      }
Exemple #30
0
//-------------------------------------------------------------------
// main
int
main(int argc, char* argv[])
{
    try
    {
        float* pBuffer[2];
        Cbmp bmp[2];

        if (argc != 5)
            throw "引数に以下を指定してください.\n" \
                " <入力ファイル1> <入力ファイル2> <出力ファイル> <重み付け[0.0-1.0]>";

        float weight = atof(argv[4]);
        if (weight<0.0f || weight>1.0f)
            throw "重み付けが[0.0-1.0]の範囲外.";

        bmp[0].loadFromFile(argv[1]);           // load bitmap
        bmp[1].loadFromFile(argv[2]);           // load bitmap

        if (bmp[0].getBitsPerPixcel() != 32)
            throw "32 ビット画像ファイルでない.";

        if ((bmp[0].getWidth() % 8) != 0)
            throw "横幅が8ピクセル単位でない.";

        if (bmp[0].getWidth() != bmp[1].getWidth() ||
                bmp[0].getHeight() != bmp[1].getHeight() ||
                    bmp[0].getBitsPerPixcel() != bmp[1].getBitsPerPixcel())
            throw "二つの画像のサイズや属性が異なる.";

        // print image size
        fprintf(stdout, "ビットマップサイズ= %d x %d, %d/pixel\n",
            bmp[0].getWidth(), bmp[0].getHeight(), bmp[0].getBitsPerPixcel());

        pBuffer[0] = toGrayscale(&bmp[0]);      // toGrayscale
        pBuffer[1] = toGrayscale(&bmp[1]);      // toGrayscale

        effect(pBuffer, &bmp[0], weight);

        cnvFormat(pBuffer[0], &bmp[0]);         // chang format

        SP_MM_FREE(pBuffer[0]);
        SP_MM_FREE(pBuffer[1]);

        bmp[0].saveToFile(argv[3]);             // save bitmap
    }
    catch (char *str)
    {
        fprintf(stderr, "error: %s\n", str);
    }

    return 0;
}