コード例 #1
0
ファイル: Particle.c プロジェクト: allohakdan/flurry
__private_extern__ void InitParticle(Particle *p)
{
//	float tempx,tempy;
	int r1,r2;
	p->oldz = RandFlt(2500.0f,22500.0f);
//	do
//	{
		r1 = rand();
		r2 = rand();
		p->oldx = ((float) (r1 % (int) info->sys_glWidth) - info->sys_glWidth * 0.5f) / 
								(info->sys_glWidth / p->oldz);
		p->oldy = (info->sys_glHeight * 0.5f - (float) (r2 % (int) info->sys_glHeight)) / 
								(info->sys_glWidth / p->oldz);
//		tempx = (oldx * info->sys_glWidth / 75.0f) + info->sys_glWidth/2.0f;
//		tempy = (oldy * info->sys_glWidth / 75.0f) + info->sys_glHeight/2.0f;
//	} while (fabs(tempx) < info->sys_glWidth + 100.0 && fabs(tempy) < info->sys_glHeight + 100.0);
	p->deltax = 0.0f;
	p->deltay = 0.0f;
	p->deltaz = (float) -starSpeed;
	p->x = p->oldx + p->deltax;
	p->y = p->oldy + p->deltay;
	p->z = p->oldz + p->deltaz;
	p->r = RandFlt(0.125f,1.0f);
	p->g = RandFlt(0.125f,1.0f);
	p->b = RandFlt(0.125f,1.0f);
	p->animFrame = 0;
}
コード例 #2
0
ファイル: Star.cpp プロジェクト: jiangxilong/haiku
/* Construction/Destruction */
void InitStar(Star *s)
{
	int i;
	for (i=0;i<3;i++) {
		s->position[i] = RandFlt(-10000.0, 10000.0);
	}
	s->rotSpeed = RandFlt(0.4, 0.9);
	s->mystery = RandFlt(0.0, 10.0);
}
コード例 #3
0
ファイル: Spark.c プロジェクト: allohakdan/flurry
__private_extern__ void InitSpark(Spark *s)
{
	int i;
	for (i=0;i<3;i++)
	{
		s->position[i] = RandFlt(-100.0, 100.0);
	}
}
コード例 #4
0
ファイル: Flurry32.cpp プロジェクト: plecong/flurry32
flurry_info_t *new_flurry_info(global_info_t *global, int streams, ColorModes colour, float thickness, float speed, double bf)
{
	int i,k;
	flurry_info_t *flurry = (flurry_info_t *)malloc(sizeof(flurry_info_t));

	if (!flurry) return NULL;

	flurry->flurryRandomSeed = RandFlt(0.0, 300.0);

	flurry->dframe = 0;
	flurry->fOldTime = 0;
	flurry->fTime = TimeInSecondsSinceStart() + flurry->flurryRandomSeed;
	flurry->fDeltaTime = flurry->fTime - flurry->fOldTime;

	flurry->numStreams = streams;
	flurry->streamExpansion = thickness;
	flurry->currentColorMode = colour;
	flurry->briteFactor = bf;

	flurry->s = (SmokeV*)malloc(sizeof(SmokeV));
	InitSmoke(flurry->s);

	flurry->star = (Star*)malloc(sizeof(Star));
	InitStar(flurry->star);

	flurry->star->rotSpeed = speed;

	for (i = 0; i < MAX_SPARKS; i++)
	{
		flurry->spark[i] = (Spark*)malloc(sizeof(Spark));
		InitSpark(flurry->spark[i]);
		flurry->spark[i]->mystery = 1800 * (i + 1) / 13; /* 100 * (i + 1) / (flurry->numStreams + 1); */
		UpdateSpark(global, flurry, flurry->spark[i]);
	}

	for (i = 0; i < NUMSMOKEPARTICLES / 4; i++) {
		for (k = 0; k < 4; k++) {
			flurry->s->p[i].dead.i[k] = 1;
		}
	}

	flurry->next = NULL;

	return flurry;
}
コード例 #5
0
ファイル: Spark.cpp プロジェクト: yunxiaoxiao110/haiku
void
InitSpark(Spark* s)
{
    for (int i = 0; i < 3; i++)
        s->position[i] = RandFlt(-100.0, 100.0);
}