explode.cpp

来自「是3D游戏一书中所讲的游戏引擎fly3D 包括fly3D引擎的源码及应用此引擎」· C++ 代码 · 共 86 行

CPP
86
字号
#include "..\..\lib\Fly3D.h"
#include "gamelib.h"

void explode::do_explode(vector& pos,vector& z,int fromplayer)
{
	if (directx->mpmode!=FLYMP_SERVER)
	{
	if (e)
		{
		exp_sphere *x=(exp_sphere *)e->clone();
		x->pos=pos;
		flyengine->activate(x);
		}
	if (s)
		{
		sprite_light *x=(sprite_light *)s->clone();
		x->pos=pos;
		x->align_z(z);
		flyengine->activate(x);
		}
	if (l)
		{
		light *x=(light *)l->clone();
		x->pos=pos;
		flyengine->activate(x);
		}
	if (ps)
		{
		particle_system *x=(particle_system *)ps->clone();
		x->pos=pos;
		x->align_z(z);
		flyengine->activate(x);
		}

	if (snd) 
		snd->add_sound_clone(&pos,0);
	}
	
	if (damage>0 && damageradius>0)
		flyengine->send_bsp_message(flyengine->bsp,pos,damageradius,FLYOBJM_DAMAGE,fromplayer,&damage);
}

int explode::get_custom_param_desc(int i,param_desc *pd)
{
	if (pd!=0)
	switch(i)
	{
		case 0:
			pd->type='f';
			pd->data=&damage;
			strcpy(pd->name,"damage");
			break;
		case 1:
			pd->type='f';
			pd->data=&damageradius;
			strcpy(pd->name,"damageradius");
			break;
		case 2:
			pd->type=TYPE_SPRITE_LIGHT;
			pd->data=&s;
			strcpy(pd->name,"sprite");
			break;
		case 3:
			pd->type=TYPE_LIGHT;
			pd->data=&l;
			strcpy(pd->name,"light");
			break;
		case 4:
			pd->type=TYPE_SOUND;
			pd->data=&snd;
			strcpy(pd->name,"sound");
			break;
		case 5:
			pd->type=TYPE_PARTICLE_SYSTEM;
			pd->data=&ps;
			strcpy(pd->name,"ps");
			break;
		case 6:
			pd->type=TYPE_EXP_SPHERE;
			pd->data=&e;
			strcpy(pd->name,"expsphere");
			break;
	}
	return 7;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?