diff scn2k/scn2k_grp.cc @ 18:4d7486cb20a9

Sync with upstream
author thib
date Tue, 16 Sep 2008 15:30:03 +0000
parents 8da1d92ac8f8
children 824b89018ea8
line wrap: on
line diff
--- a/scn2k/scn2k_grp.cc
+++ b/scn2k/scn2k_grp.cc
@@ -78,8 +78,8 @@ struct GrpObj {
 	vector<Rect> src_pos;
 	enum GrpType { FILLRECT = 1, FILE = 2, GAN = 3, MOJI = 4, DIGIT = 5} gtype;
 	enum Attribute { NONE=0, WIPEON=1, SATURATE=2, HIDDEN=4, HIDDEN_GROUP=8,
-		UPDATE_PICTURE = 8, UPDATE_POS = 16, UPDATE_ALPHA = 32, UPDATE_SNUM = 64, UPDATE_CLIP = 128, UPDATE_VISIBLE = 256,
-		UPDATE_ALL = (8|16|32|64|128|256),
+		UPDATE_PICTURE = 16, UPDATE_POS = 32, UPDATE_ALPHA = 64, UPDATE_SNUM = 128, UPDATE_CLIP = 256, UPDATE_VISIBLE = 512,
+		UPDATE_ALL = (16|32|64|128|256|512),
 		ANM_PLAYSTART = 0x8000, ANM_PLAYING = 0x10000,
 		DIG_ZERO = 0x10000*2, DIG_SIGN = 0x10000*4, DIG_PACK=0x10000*8,DIG_SPACE=0x10000*16
 		};
@@ -235,7 +235,7 @@ int GrpObj::PosY() {
 }
 void GrpObj::SetUpdate(void) {
 	attr = Attribute (attr | UPDATE_PICTURE);
-	Update(); //FIXME
+	//Update(); //FIXME
 }
 void GrpObj::SetPos(int index, int x,int y) {
 	if (index < 0 || index > 8) {
@@ -338,7 +338,7 @@ void GrpObj::Update(void) {
 	}
 	if (picture == 0) return;
 	if (attr & UPDATE_POS) {
-		if (attr & SATURATE) {
+		if ( (attr & SATURATE) || zoom != -1) {
 			int w=0, h=0;
 			GetSrcGeom(w,h);
 			picture->Move(_posx-w/2, _posy-h/2);
@@ -709,7 +709,10 @@ void GrpObj::CreateGanSpecial(Event::Con
 
 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) {
 	if (zoom == new_zoom && rotate == new_rotate) return;
-	if (new_zoom != -1) zoom = new_zoom;
+	if ( zoom == -1 || new_zoom == -1) {
+		attr = Attribute(attr | UPDATE_POS); // centering する
+	}
+	zoom = new_zoom;
 	if (new_rotate != -1) rotate = new_rotate;
 	if (zoom < 0) zoom = 256;
 	if (rotate < 0) rotate = 0;
@@ -1217,6 +1220,7 @@ bool GrpImpl::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル
 	if (g->status == WAIT_ANM)
 		g->AbortAnm();
 	if (g->status == WAIT_SHAKE && g->anm2 != 0) {
+		g->anm2->Abort();
 		delete g->anm2;
 		g->anm2 = 0;
 	}
@@ -1847,7 +1851,7 @@ void GrpImpl::Exec(Cmd& cmd) {
 			CreateObj(cmd.args[0].value);
 			if (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb || cmd.cmd3 == 0x4b0 || cmd.cmd3 == 0x578) {
 				// FILE, GAN, MOJI, DIGIT ならば座標等の設定を行う
-				if (cmd.cmd4 >= 1+base_argc) {
+				if (cmd.cmd4 >= 1) {
 					if (cmd.args[2+base_argc].value == 0) {
 						if (cmd.cmd1 == 1)
 							g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP);
@@ -1862,10 +1866,10 @@ void GrpImpl::Exec(Cmd& cmd) {
 					if (cmd.cmd1 == 1)
 						SetObjChangedGroup(cmd.args[0].value);
 				}
-				if (cmd.cmd4 >= 2+base_argc) { // 座標等も設定
+				if (cmd.cmd4 >= 2) { // 座標等も設定
 					g.SetPos(0,cmd.args[3+base_argc].value, cmd.args[4+base_argc].value);
 				}
-				if ( (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb) && cmd.cmd4 >= 4+base_argc) { // pattern 番号も設定
+				if ( (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb) && cmd.cmd4 >= 3) { // pattern 番号も設定
 					g.SetSurfaceNum(cmd.args[5+base_argc].value);
 					base_argc++; // 0x3e8 (FILE) / 0x3eb (GAN) の場合のみこのオプションは存在する
 				}