comparison 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
comparison
equal deleted inserted replaced
59:36d92d21300f 60:e16e13d8cd68
166 UpdateSurface(); 166 UpdateSurface();
167 attr = Attribute( (attr | UPDATE_ALL) & (~UPDATE_PICTURE)); 167 attr = Attribute( (attr | UPDATE_ALL) & (~UPDATE_PICTURE));
168 } 168 }
169 if (picture == NULL) return; 169 if (picture == NULL) return;
170 if (attr & UPDATE_POS) { 170 if (attr & UPDATE_POS) {
171 if ( (attr & SATURATE) || zoom != -1) { 171 if (zoom != -1) {
172 int w=0, h=0; 172 int w=0, h=0;
173 GetSrcGeom(w,h); 173 GetSrcGeom(w,h);
174 picture->Move(_posx-w/2, _posy-h/2); 174 picture->Move(_posx-w/2, _posy-h/2);
175 } else { 175 } else {
176 picture->Move(_posx, _posy); 176 picture->Move(_posx, _posy);
236 string path(name); 236 string path(name);
237 path += ".g00"; 237 path += ".g00";
238 picture->SetSurface(path.c_str(), 0, 0); 238 picture->SetSurface(path.c_str(), 0, 0);
239 picture->SetSurfaceRect(Rect(0,0,width,height)); 239 picture->SetSurfaceRect(Rect(0,0,width,height));
240 } 240 }
241 if (attr & SATURATE) 241 if (attr & BLIT_ADD)
242 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE); 242 picture->SetSurfaceAttribute(PicBase::BLIT_ADD);
243 } else if (gtype == MOJI) { // テキスト描画 243 } else if (gtype == MOJI) { // テキスト描画
244 if (print_moji.length() == 0) return; 244 if (print_moji.length() == 0) return;
245 UpdateMoji(); 245 UpdateMoji();
246 } else if (gtype == DIGIT) { // 数値を画像表示 246 } else if (gtype == DIGIT) { // 数値を画像表示
247 UpdateDigit(); 247 UpdateDigit();
394 fprintf(stderr,"GrpObj::CreateGan: Invalid'GAN' file %s\n", path.c_str()); 394 fprintf(stderr,"GrpObj::CreateGan: Invalid'GAN' file %s\n", path.c_str());
395 delete info; 395 delete info;
396 return; 396 return;
397 } 397 }
398 398
399 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE); 399 attr = Attribute(attr | UPDATE_POS);
400 attr = Attribute(attr | UPDATE_POS | SATURATE);
401 400
402 const char* buf = data + 16; 401 const char* buf = data + 16;
403 buf += strlen(buf) + 1; // 画像ファイル名が入っている 402 buf += strlen(buf) + 1; // 画像ファイル名が入っている
404 buf += 4; // 定数 20000 403 buf += 4; // 定数 20000
405 int pics = read_little_endian_int(buf); buf += 4; // 複数のアニメーション情報が入っている場合、情報数 404 int pics = read_little_endian_int(buf); buf += 4; // 複数のアニメーション情報が入っている場合、情報数
629 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &Grp::impl_grpOpen); 628 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &Grp::impl_grpOpen);
630 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &Grp::impl_shake); 629 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &Grp::impl_shake);
631 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &Grp::impl_grpCopy); 630 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &Grp::impl_grpCopy);
632 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &Grp::impl_recFill); 631 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &Grp::impl_recFill);
633 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &Grp::impl_recCopy); 632 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &Grp::impl_recCopy);
634 RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //FIXME 633 RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //TODO: Same thing as recCopy, but using source's alpha
635 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &Grp::impl_recAdd); 634 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &Grp::impl_recAdd);
636 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &Grp::impl_grpPan); 635 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &Grp::impl_grpPan);
637 636
638 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &Grp::impl_snmBgScroll); 637 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &Grp::impl_snmBgScroll);
639 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &Grp::impl_snmPlay); 638 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &Grp::impl_snmPlay);
732 RegisterCommand(1, 82, 1018, "objBgColG", NULL); 731 RegisterCommand(1, 82, 1018, "objBgColG", NULL);
733 RegisterCommand(1, 81, 1019, "objColB", NULL); 732 RegisterCommand(1, 81, 1019, "objColB", NULL);
734 RegisterCommand(1, 82, 1019, "objBgColB", NULL); 733 RegisterCommand(1, 82, 1019, "objBgColB", NULL);
735 RegisterCommand(1, 81, 1020, "objColLevel", NULL); 734 RegisterCommand(1, 81, 1020, "objColLevel", NULL);
736 RegisterCommand(1, 82, 1020, "objBgColLevel", NULL); 735 RegisterCommand(1, 82, 1020, "objBgColLevel", NULL);
737 RegisterCommand(1, 81, 1021, "objComposite", NULL);//(CmdImpl) &Grp::impl_objComposite); //FIXME: May be broken 736 RegisterCommand(1, 81, 1021, "objComposite", (CmdImpl) &Grp::impl_objComposite); //FIXME: May be broken
738 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &Grp::impl_objComposite); 737 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &Grp::impl_objComposite);
739 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &Grp::impl_objSetText); 738 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &Grp::impl_objSetText);
740 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &Grp::impl_objSetText); 739 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &Grp::impl_objSetText);
741 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &Grp::impl_objTextOpts); //FIXME: Incomplete 740 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &Grp::impl_objTextOpts); //FIXME: Incomplete
742 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &Grp::impl_objTextOpts); 741 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &Grp::impl_objTextOpts);
1551 if (cmd.cmd_type != CMD_OTHER) return; 1550 if (cmd.cmd_type != CMD_OTHER) return;
1552 1551
1553 CommandHandler::Exec(cmd); 1552 CommandHandler::Exec(cmd);
1554 1553
1555 //TODO: ??? 1554 //TODO: ???
1556 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除? 1555 if (cmd.cmd1 == 1 && cmd.cmd2 == 60 && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除?
1557 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除 1556 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
1558 GrpObj& g = grpobj[cmd.args[0].value]; 1557 GrpObj& g = grpobj[cmd.args[0].value];
1559 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); 1558 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1560 cmd.clear(); 1559 cmd.clear();
1561 } 1560 }
1562 1561
1563 //TODO: ??? 1562 // Refresh changed objects...
1564 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && cmd.cmd2 == 0x51) { 1563 //FIXME: should may be go away?
1565 /*GrpObj& g = grpobj[cmd.args[0].value]; 1564 //Seems it'll work only for objects in the foreground
1566 int attr; 1565 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && cmd.cmd2 == 81) {
1567 GrpObjMap::iterator it;
1568 for (it = g.children_obj.begin(); it != g.children_obj.end(); it++)
1569 attr |= it->second.attr;
1570 if (attr & GrpObj::UPDATE_ALL)
1571 SetObjChanged(cmd.args[0].value);*/
1572 GrpObj* g; 1566 GrpObj* g;
1573 if (cmd.cmd1 == 2) 1567 if (cmd.cmd1 == 2)
1574 g = GetGraphicObj(cmd.args[0].value, cmd.args[1].value); 1568 g = GetGraphicObj(cmd.args[0].value, cmd.args[1].value);
1575 else 1569 else
1576 g = GetGraphicObj(cmd.args[0].value); 1570 g = GetGraphicObj(cmd.args[0].value);