comparison scn2k/scn2k_grp.cc @ 18:4d7486cb20a9

Sync with upstream
author thib
date Tue, 16 Sep 2008 15:30:03 +0000
parents 8da1d92ac8f8
children 824b89018ea8
comparison
equal deleted inserted replaced
17:a95c130b567b 18:4d7486cb20a9
76 int rotate; // 0-360度 76 int rotate; // 0-360度
77 77
78 vector<Rect> src_pos; 78 vector<Rect> src_pos;
79 enum GrpType { FILLRECT = 1, FILE = 2, GAN = 3, MOJI = 4, DIGIT = 5} gtype; 79 enum GrpType { FILLRECT = 1, FILE = 2, GAN = 3, MOJI = 4, DIGIT = 5} gtype;
80 enum Attribute { NONE=0, WIPEON=1, SATURATE=2, HIDDEN=4, HIDDEN_GROUP=8, 80 enum Attribute { NONE=0, WIPEON=1, SATURATE=2, HIDDEN=4, HIDDEN_GROUP=8,
81 UPDATE_PICTURE = 8, UPDATE_POS = 16, UPDATE_ALPHA = 32, UPDATE_SNUM = 64, UPDATE_CLIP = 128, UPDATE_VISIBLE = 256, 81 UPDATE_PICTURE = 16, UPDATE_POS = 32, UPDATE_ALPHA = 64, UPDATE_SNUM = 128, UPDATE_CLIP = 256, UPDATE_VISIBLE = 512,
82 UPDATE_ALL = (8|16|32|64|128|256), 82 UPDATE_ALL = (16|32|64|128|256|512),
83 ANM_PLAYSTART = 0x8000, ANM_PLAYING = 0x10000, 83 ANM_PLAYSTART = 0x8000, ANM_PLAYING = 0x10000,
84 DIG_ZERO = 0x10000*2, DIG_SIGN = 0x10000*4, DIG_PACK=0x10000*8,DIG_SPACE=0x10000*16 84 DIG_ZERO = 0x10000*2, DIG_SIGN = 0x10000*4, DIG_PACK=0x10000*8,DIG_SPACE=0x10000*16
85 }; 85 };
86 Attribute attr; 86 Attribute attr;
87 87
233 int GrpObj::PosY() { 233 int GrpObj::PosY() {
234 return _posy; 234 return _posy;
235 } 235 }
236 void GrpObj::SetUpdate(void) { 236 void GrpObj::SetUpdate(void) {
237 attr = Attribute (attr | UPDATE_PICTURE); 237 attr = Attribute (attr | UPDATE_PICTURE);
238 Update(); //FIXME 238 //Update(); //FIXME
239 } 239 }
240 void GrpObj::SetPos(int index, int x,int y) { 240 void GrpObj::SetPos(int index, int x,int y) {
241 if (index < 0 || index > 8) { 241 if (index < 0 || index > 8) {
242 fprintf(stderr,"GrpObj::SetPos: Invalid index %d <- %d,%d\n",index,x,y); 242 fprintf(stderr,"GrpObj::SetPos: Invalid index %d <- %d,%d\n",index,x,y);
243 return; 243 return;
336 UpdateSurface(); 336 UpdateSurface();
337 attr = Attribute( (attr | UPDATE_ALL) & (~UPDATE_PICTURE)); 337 attr = Attribute( (attr | UPDATE_ALL) & (~UPDATE_PICTURE));
338 } 338 }
339 if (picture == 0) return; 339 if (picture == 0) return;
340 if (attr & UPDATE_POS) { 340 if (attr & UPDATE_POS) {
341 if (attr & SATURATE) { 341 if ( (attr & SATURATE) || zoom != -1) {
342 int w=0, h=0; 342 int w=0, h=0;
343 GetSrcGeom(w,h); 343 GetSrcGeom(w,h);
344 picture->Move(_posx-w/2, _posy-h/2); 344 picture->Move(_posx-w/2, _posy-h/2);
345 } else { 345 } else {
346 picture->Move(_posx, _posy); 346 picture->Move(_posx, _posy);
707 return; 707 return;
708 }; 708 };
709 709
710 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) { 710 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) {
711 if (zoom == new_zoom && rotate == new_rotate) return; 711 if (zoom == new_zoom && rotate == new_rotate) return;
712 if (new_zoom != -1) zoom = new_zoom; 712 if ( zoom == -1 || new_zoom == -1) {
713 attr = Attribute(attr | UPDATE_POS); // centering する
714 }
715 zoom = new_zoom;
713 if (new_rotate != -1) rotate = new_rotate; 716 if (new_rotate != -1) rotate = new_rotate;
714 if (zoom < 0) zoom = 256; 717 if (zoom < 0) zoom = 256;
715 if (rotate < 0) rotate = 0; 718 if (rotate < 0) rotate = 0;
716 else if (rotate > 360) rotate %= 360; 719 else if (rotate > 360) rotate %= 360;
717 720
1215 if (g->status == WAIT_MOVIE) 1218 if (g->status == WAIT_MOVIE)
1216 g->music.StopMovie(); 1219 g->music.StopMovie();
1217 if (g->status == WAIT_ANM) 1220 if (g->status == WAIT_ANM)
1218 g->AbortAnm(); 1221 g->AbortAnm();
1219 if (g->status == WAIT_SHAKE && g->anm2 != 0) { 1222 if (g->status == WAIT_SHAKE && g->anm2 != 0) {
1223 g->anm2->Abort();
1220 delete g->anm2; 1224 delete g->anm2;
1221 g->anm2 = 0; 1225 g->anm2 = 0;
1222 } 1226 }
1223 return false; // event deleted 1227 return false; // event deleted
1224 } 1228 }
1845 g.name = cmd.Str(cmd.args[1]); 1849 g.name = cmd.Str(cmd.args[1]);
1846 } 1850 }
1847 CreateObj(cmd.args[0].value); 1851 CreateObj(cmd.args[0].value);
1848 if (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb || cmd.cmd3 == 0x4b0 || cmd.cmd3 == 0x578) { 1852 if (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb || cmd.cmd3 == 0x4b0 || cmd.cmd3 == 0x578) {
1849 // FILE, GAN, MOJI, DIGIT ならば座標等の設定を行う 1853 // FILE, GAN, MOJI, DIGIT ならば座標等の設定を行う
1850 if (cmd.cmd4 >= 1+base_argc) { 1854 if (cmd.cmd4 >= 1) {
1851 if (cmd.args[2+base_argc].value == 0) { 1855 if (cmd.args[2+base_argc].value == 0) {
1852 if (cmd.cmd1 == 1) 1856 if (cmd.cmd1 == 1)
1853 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP); 1857 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP);
1854 else 1858 else
1855 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); 1859 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1860 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); 1864 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
1861 } 1865 }
1862 if (cmd.cmd1 == 1) 1866 if (cmd.cmd1 == 1)
1863 SetObjChangedGroup(cmd.args[0].value); 1867 SetObjChangedGroup(cmd.args[0].value);
1864 } 1868 }
1865 if (cmd.cmd4 >= 2+base_argc) { // 座標等も設定 1869 if (cmd.cmd4 >= 2) { // 座標等も設定
1866 g.SetPos(0,cmd.args[3+base_argc].value, cmd.args[4+base_argc].value); 1870 g.SetPos(0,cmd.args[3+base_argc].value, cmd.args[4+base_argc].value);
1867 } 1871 }
1868 if ( (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb) && cmd.cmd4 >= 4+base_argc) { // pattern 番号も設定 1872 if ( (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb) && cmd.cmd4 >= 3) { // pattern 番号も設定
1869 g.SetSurfaceNum(cmd.args[5+base_argc].value); 1873 g.SetSurfaceNum(cmd.args[5+base_argc].value);
1870 base_argc++; // 0x3e8 (FILE) / 0x3eb (GAN) の場合のみこのオプションは存在する 1874 base_argc++; // 0x3e8 (FILE) / 0x3eb (GAN) の場合のみこのオプションは存在する
1871 } 1875 }
1872 cmd.clear(); 1876 cmd.clear();
1873 } else { 1877 } else {