Exemplo n.º 1
0
void SpriteDraw(Sprite *spr, sTexture *texture)
{
	if(!spr->disp) return;
	
	sGRPOBJ *grp = GRPOBJ_QUAD(spr->prio);
	GrpSetPos(grp, spr->pos.x, spr->pos.y);
	GrpSetRot(grp, spr->rot);
	GrpSetSize(grp, spr->size.x, spr->size.y);
	GrpSetUV(grp, spr->uv.x, spr->uv.y);
	GrpSetScale(grp, spr->scale.x, spr->scale.y);
	GrpSetCenter(grp, spr->center.x, spr->center.y);
	GrpSetRGBA(grp, spr->col.red, spr->col.green, spr->col.blue, spr->col.alpha);   
	GrpSetTexture(grp, texture);
	GrpSetBlendMode(grp, spr->blend);
	GrpSetFilter(grp, TRUE);
}
Exemplo n.º 2
0
static int objProc(sOBJ *obj, sParam *param, int msg, int lParam, int rParam)
{
	int res = 0;

	ObjVar *var = (ObjVar *)ObjGetVar(obj, sizeof(ObjVar));
	switch(msg)
	{
	case MSG_CREATE:
		{
			var->level = lParam;
			var->target_flag = (u_int)rParam;
			var->param = (sParam *)StkRefFrameP(0);
			var->pos = *(FVector2 *)StkRefFrameP(1);
			var->vct = *(FVector2 *)StkRefFrameP(2);
			var->dir = StkRefFrameF(3);
			float powofs = StkRefFrameF(4);

			var->radius = ParamGetReal(param, "radius");
			var->speed = ParamGetReal(param, "speed");
			var->power = PowerConvertInterValue(ParamGetReal(param, "power") * powofs);
			FVector4 *col;
			col = ParamGetFVec4(param, "col1");
			SetRGBA(&var->col1, col->x, col->y, col->z, col->w);
			col = ParamGetFVec4(param, "col2");
			SetRGBA(&var->col2, col->x, col->y, col->z, col->w);
			var->disp_size = ParamGetFVec2(param, "disp_size");
			

			FVector2 vct; 
			MathCalcVector(&vct, var->dir, var->speed);
			var->vct.x += vct.x;
			var->vct.y += vct.y;

			ObjSetPos(obj, var->pos.x, var->pos.y);
			ObjSetDir(obj, var->dir);
			ObjSetVct(obj, var->vct.x, var->vct.y);
		}
		break;

	case MSG_KILL:
		{
		}
		break;

	case MSG_STEP:
		{
#if 0
			GameFieldRange(&var->pos);
#endif

			var->pos.x += var->vct.x;
			var->pos.y += var->vct.y;
			
			ObjSetPos(obj, var->pos.x, var->pos.y);
			ObjSetDir(obj, var->dir);
			ObjSetVct(obj, var->vct.x, var->vct.y);

			res = FieldClip(&var->pos, 20.0f);
			if(res)
			{
				ObjKillReq(obj);
			}
			else
			{
				/* TODO:非常に重い処理なので解決策を考える */
				BOOL kill = sendDamage(obj, var->target_flag, &var->pos, &var->vct, var->radius, var->power);
				if(kill)
				{
					ObjKillReq(obj);
				}
			}
		}
		break;

	case MSG_DRAW:
		{
			sGRPOBJ *grp;
			grp = GRPOBJ_FILLCIRCLE(PRIO_SHOT);
			GrpSetPos(grp, var->disp_x, var->disp_y);
			GrpSetRot(grp, var->dir);
			GrpSetRGBA(grp, var->col1.red, var->col1.green, var->col1.blue, var->col1.alpha);
			GrpSetSize(grp, var->disp_size->x, var->disp_size->x);
			GrpSetLineNum(grp, 8);
			GrpSetSmooth(grp, TRUE);

			grp = GRPOBJ_FILLCIRCLE(PRIO_SHOT);
			GrpSetPos(grp, var->disp_x, var->disp_y);
			GrpSetRot(grp, var->dir);
			GrpSetRGBA(grp, var->col2.red, var->col2.green, var->col2.blue, var->col2.alpha);
			GrpSetSize(grp, var->disp_size->y, var->disp_size->y);
			GrpSetLineNum(grp, 6);
			GrpSetSmooth(grp, TRUE);
			
#ifdef DEBUG
			if(isDispDebugInfo())
			{
				sGRPOBJ *grp = GRPOBJ_CIRCLE(PRIO_DEBUG_PRINT);
				GrpSetPos(grp, var->disp_x, var->disp_y);
				GrpSetSize(grp, var->radius, var->radius);
				GrpSetLineNum(grp, 12);
				GrpSetRGBA(grp, 1.0f, 1.0f, 0.0f, 1.0f);
				GrpSetDrawSize(grp, 1.0f);
			}
#endif
		}
		break;

	case MSG_GAME_CAMERA:
		{
			FVector2 *pos = (FVector2 *)StkRefFrameP(0);
			var->disp_x = var->pos.x - pos->x;
			var->disp_y = var->pos.y - pos->y;
		}
		break;
	}

	return res;
}