Beispiel #1
0
/*------------------------------------------------------------------------
*
* PROTOTYPE  :  void NG_FXBlast(SGScript *pInf, V3XOVI *OVI)
*
* DESCRIPTION :
*
*/
void NG_FXBlast(SGScript *pInf, V3XOVI *OVI)
{
    int i, x, f=0;
    SGEffect *p;
    V3XMESH *obj = OVI->mesh;
    V3XVECTOR v;
    i = (int)(xSHRD(OVI->ORI->global_rayon, 3)+2);
	if (i>MAX_BLASTS)
		i=MAX_BLASTS;
    for (;i!=0;i--)
    {
        x = sysRand(obj->numVerts);
        V3XVector_ApplyMatrixTrans(v, obj->vertex[x], obj->matrix.Matrix);
        if (!f)
			v = obj->matrix.v.Pos;
        p=  NG_FXNew(&v, FX_IMPACT, 4, pInf, 1, OVI);
        if (p)
        {
            if (!f)
            {
                p->Sphere = NG_GetFreeSphere();
                p->radius = CST_ZERO;
                f = 1;
            }
            p->Step[1] = p->Step[0] = sysRand(p->Sprite->maxItem);
            p->Size = OVI->ORI->global_rayon / 2;
        }
    }
}
Beispiel #2
0
/*------------------------------------------------------------------------
*
* PROTOTYPE  :  void NG_FXDebris(SGScript *pInf, V3XOVI *OVI)
*
* DESCRIPTION :
*
*/
void NG_FXDebris(SGScript *pInf, V3XOVI *OVI)
{
    int i, x;
    SGEffect *p;
    V3XMESH *obj = OVI->mesh;
    V3XVECTOR v;
    i = (int32_t)((xSHRD(OVI->ORI->global_rayon, 3))+2);
    if (i>MAX_DEBRIS)
		i=MAX_DEBRIS;
    for (;i!=0;i--)
    {
        x = sysRand(obj->numVerts);
        V3XVector_ApplyMatrixTrans(v, obj->vertex[x], obj->matrix.Matrix);
        p = NG_FXNew(&v, FX_DEBRIS, 8, pInf, 1, OVI);
        if (p)
        {
            p->Step[1] = p->Step[0]= sysRand(p->Sprite->maxItem);
            p->Size = OVI->ORI->global_rayon / 8;
            if (p->Size < 256*g_SGSettings.WorldUnit)
				p->Size = 256*g_SGSettings.WorldUnit;
        }
    }
}
Beispiel #3
0
void sndUpdateMusic( BNX_GAME *game, BNX_BOOL change )
{
	BNX_INT32	newMusic;

	if ( cfgGetMusic() == BNX_FALSE )
	{
		return;
	}

	if ( Mix_PlayingMusic() == 0 )
	{
		if ( change == BNX_TRUE )
		{
			do
			{
				newMusic = sysRand( cSndMaxMusic-1 );
			} while( _Snd.curMusic == newMusic );
			
			_Snd.curMusic = newMusic;
		}

		sndPlayMusic( _Snd.curMusic );
	}
}
Beispiel #4
0
/*------------------------------------------------------------------------
*
* PROTOTYPE  :  SGEffect *NG_FXNew(V3XVECTOR *pos, int type, int lop, SGScript *pInf, int kp, V3XOVI *OVI)
*
* DESCRIPTION :
*
*/
SGEffect *NG_FXNew(V3XVECTOR *pos, int type, int lop, SGScript *pInf, int kp, V3XOVI *OVI)
{
	int bAllowTrsp = 1; // (GX.View.Flags&GX_CAPS_BACKBUFFERINVIDEO)==0;
    SGEffect *p, *EJ=NULL;
    int i, f=0;
    for (p=g_SGGame.pExpl, i=g_SGGame.numEffects;(i>0) && (f!=1);p++, i--)
    {
        if (p->Dispo)
        {
            int transpa= 0;
            OVI->state|=V3XSTATE_MATRIXUPDATE;
            p->Step[0] = p->Step[1] = 0;
            p->Nloop = lop;
            p->Sphere = NULL;
            p->type = type;
            p->OVI = OVI;
            p->Size = OVI->ORI->global_rayon;
            p->Dispo = 0;
            p->LastFrame = V3X.Time.ms;
            p->PlaySample = 1;
            if (kp)
            {
                p->keep = *pos;
                if (kp==1)
                {
                    p->useKeep = 1;
                }
                else
                {
                    p->useKeep = 0;
                    p->Size*=(float)(1<<(kp-1));
                }
                p->pos = &p->keep;
            }
			else
				p->pos = pos;
            EJ = p;
            f = 1;
            switch(p->type)
			{
                case FX_FINISH:
					p->FxCode = pInf->StartSound-1;
					p->Sprite = g_pspFX[pInf->FinisHim-1];
					SYS_ASSERT(p->Sprite);
					p->Size*=2;
					p->FadeStart = p->Sprite->maxItem;
					transpa = 1;
				break;
                case FX_SMOKE:
					p->angle.x = 0;
					p->angle.y = sysRand(4096);
					p->angle.z = sysRand(4096);
					{
						V3XMESH *obj = OVI->mesh;
						int x = sysRand(obj->numVerts);
						V3XVector_ApplyMatrixTrans(p->cent, obj->vertex[x], obj->matrix.Matrix);
					}
                case FX_SMOKE2:
					p->Sprite = g_pspFX[0];
					SYS_ASSERT(p->Sprite);
					p->FxCode = -1;
					p->FadeStart = 0;
					transpa = 1;
                break;
                case FX_CUSTOM:
					NG_FXAvary(OVI, pInf);
					transpa = 1;
                case FX_IMPACT:
					if (!pInf->ExplodeMode)
					{
						p->Dispo = 1;
						EJ = NULL;
						transpa = 0;
						p->FadeStart = 0;
					}
					else
					{
						p->Sprite = g_pspFX[pInf->ExplodeMode-1];
						SYS_ASSERT(p->Sprite);
						p->FxCode = pInf->SoundExplode-1;
						p->FadeStart = p->Sprite->maxItem/2;
						p->Size/= 2;
						transpa = 1;
						p->Light = 128;
					}
                break;
                case FX_WARPIN:
					p->FxCode = pInf->SoundAppear-1;
					p->Sprite = g_pspFX[pInf->AppearMode-1];
					SYS_ASSERT(p->Sprite);
					if (p->OVI->state&V3XSTATE_HIDDEN)
						p->Size*=4;
					p->OVI->state^=V3XSTATE_HIDDEN;
					p->Light = 255;
					p->FadeStart = p->Sprite->maxItem;
					transpa = 1;
                break;
                case FX_DEBRIS:
					p->FxCode = -1;
					p->Sprite = g_pspFX[((pInf->DebrisMode2)&&(i&1)) ? pInf->DebrisMode2-1 : pInf->DebrisMode-1];
					SYS_ASSERT(p->Sprite);
					{
						V3XMESH *obj = OVI->mesh;
						int x = sysRand(obj->numVerts)-1;
						V3XVector_ApplyMatrixTrans(p->cent, obj->vertex[x], obj->matrix.Matrix);
					}
					p->angle.x = 0;
					p->angle.y = sysRand(4096);
					p->angle.z = sysRand(4096);
					transpa = 0;
					p->FadeStart = p->Sprite->maxItem/2;
                break;
                default:
                break;
			}

			if ((transpa)&&(g_SGSettings.VisualsFx>1)&&bAllowTrsp)
			{
				p->material.info.Transparency = (V3X.Client->Capabilities&GXSPEC_ALPHABLENDING_ADD)
					                     ? (transpa==2 ? V3XBLENDMODE_SUB: V3XBLENDMODE_ADD)
										 : V3XBLENDMODE_ALPHA;
				p->material.Render = V3XRCLASS_bitmap_transp;
				p->material.RenderID = V3XID_T_SPRITE+p->material.info.Transparency;
				p->material.render_near = p->material.render_far =
				p->material.render_clip  = V3XRENDER_SpriteAny;
			}
			else
			{
				p->material.info.Transparency = V3XBLENDMODE_NONE;
				p->material.Render = V3XRCLASS_bitmap;
				p->material.RenderID = V3XID_SPRITE;
				p->material.render_near = p->material.render_far =
				p->material.render_clip = V3XRENDER_SpriteAny;
            }

            if (GX.View.BytePerPixel>1)
			{
				SYS_ASSERT(p->Sprite);
			}
        }
    }
    return EJ;
}