diff scn2k/scn2k_grp.cc @ 60:e16e13d8cd68

Replaced SATURATE -> ADD, implemented objComposite, corrected minor things
author Thibaut GIRKA <thib@sitedethib.com>
date Fri, 18 Dec 2009 20:41:38 +0100
parents c7bcc0ec2267
children 4416cfac86ae
line wrap: on
line diff
--- a/scn2k/scn2k_grp.cc
+++ b/scn2k/scn2k_grp.cc
@@ -168,7 +168,7 @@ void GrpObj::Update(void) {
 	}
 	if (picture == NULL) return;
 	if (attr & UPDATE_POS) {
-		if ( (attr & SATURATE) || zoom != -1) {
+		if (zoom != -1) {
 			int w=0, h=0;
 			GetSrcGeom(w,h);
 			picture->Move(_posx-w/2, _posy-h/2);
@@ -238,8 +238,8 @@ void GrpObj::UpdateSurface(void) {
 			picture->SetSurface(path.c_str(), 0, 0);
 			picture->SetSurfaceRect(Rect(0,0,width,height));
 		}
-		if (attr & SATURATE)
-			picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE);
+		if (attr & BLIT_ADD)
+			picture->SetSurfaceAttribute(PicBase::BLIT_ADD);
 	} else if (gtype == MOJI) { // テキスト描画
 		if (print_moji.length() == 0) return;
 		UpdateMoji();
@@ -396,8 +396,7 @@ void GrpObj::CreateGan(Event::Container&
 		return;
 	}
 
-	picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE);
-	attr = Attribute(attr | UPDATE_POS | SATURATE);
+	attr = Attribute(attr | UPDATE_POS);
 
 	const char* buf = data + 16;
 	buf += strlen(buf) + 1; // 画像ファイル名が入っている
@@ -631,7 +630,7 @@ Grp::Grp(Event::Container& _event, PicCo
 	RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &Grp::impl_grpCopy);
 	RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &Grp::impl_recFill);
 	RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &Grp::impl_recCopy);
-	RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //FIXME
+	RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //TODO: Same thing as recCopy, but using source's alpha
 	RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &Grp::impl_recAdd);
 	RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &Grp::impl_grpPan);
 
@@ -734,7 +733,7 @@ Grp::Grp(Event::Container& _event, PicCo
 	RegisterCommand(1, 82, 1019, "objBgColB", NULL);
 	RegisterCommand(1, 81, 1020, "objColLevel", NULL);
 	RegisterCommand(1, 82, 1020, "objBgColLevel", NULL);
-	RegisterCommand(1, 81, 1021, "objComposite", NULL);//(CmdImpl) &Grp::impl_objComposite); //FIXME: May be broken
+	RegisterCommand(1, 81, 1021, "objComposite", (CmdImpl) &Grp::impl_objComposite); //FIXME: May be broken
 	RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &Grp::impl_objComposite);
 	RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &Grp::impl_objSetText);
 	RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &Grp::impl_objSetText);
@@ -1553,22 +1552,17 @@ void Grp::Exec(Cmd& cmd) {
 	CommandHandler::Exec(cmd);
 
 	//TODO: ???
-	if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除?
+	if (cmd.cmd1 == 1 && cmd.cmd2 == 60 && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除?
 		DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
 		GrpObj& g = grpobj[cmd.args[0].value];
 		g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
 		cmd.clear();
 	}
 
-	//TODO: ???
-	if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && cmd.cmd2 == 0x51) {
-		/*GrpObj& g = grpobj[cmd.args[0].value];
-		int attr;
-		GrpObjMap::iterator it;
-		for (it = g.children_obj.begin(); it != g.children_obj.end(); it++)
-			attr |= it->second.attr;
-		if (attr & GrpObj::UPDATE_ALL)
-			SetObjChanged(cmd.args[0].value);*/
+	// Refresh changed objects...
+	//FIXME: should may be go away?
+	//Seems it'll work only for objects in the foreground
+	if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && cmd.cmd2 == 81) {
 		GrpObj* g;
 		if (cmd.cmd1 == 2)
 			g = GetGraphicObj(cmd.args[0].value, cmd.args[1].value);