/**********************************************************************

	Title :                 Procs
	Filename :              procs.c
	Author :                Thomas Szirtes
	Revision :              1.0

	Notes :                 Procedures for task-management. 
							Application	Specific.
							
	Copyright :             (C) SEGA Europe 1998

  **********************************************************************/

#include	"ftypes.h"
#include	"task.h"
#include	"procs.h"

#ifdef USING_SET4
 #include	 "shinobi.h"
#else
 #include	 "ninja.h"
#endif


/*----------- APPLICATION SPECIFIC -------------*/
extern  NJS_OBJECT object_ex_sphere_sphere[];
extern  NJS_TEXLIST     misc_texlist;
extern  NJS_MATERIAL matlist_ex_sphere_sphere[];


void ProcExplode(TASK *t)
{
	EXPLODE_TASK_DATA		*etd = (EXPLODE_TASK_DATA *)t->data;

	matlist_ex_sphere_sphere[0].diffuse.argb.a      =       255-(unsigned char)(etd->size*25.f);
	njSetTexture(&misc_texlist);
	njPushMatrix(NULL);
		njTranslateV(NULL,&etd->centre);        
		njScale(NULL,etd->size,etd->size,etd->size);
		njDrawObject(object_ex_sphere_sphere);
	njPopMatrix(1);
	etd->size+=0.5f;
}

void ProcTransport(TASK *t)
{
	TRANSPORT_TASK_DATA *etd = (TRANSPORT_TASK_DATA *)t->data;

	/* abort */
	
	matlist_ex_sphere_sphere[0].diffuse.argb.a      =       (unsigned char)((etd->cursize/etd->size)*255.f);
	njSetTexture(&misc_texlist);
	njPushMatrix(NULL);
		njTranslateV(NULL,&etd->centre);        
		njScale(NULL,etd->cursize,etd->cursize,etd->cursize);
		njDrawObject(object_ex_sphere_sphere);
	njPopMatrix(1);

	etd->cursize-=0.2f;


	if (etd->cursize<=1.f)  t->life=0; 

}