Mercurial > otakunoraifu
comparison scn2k/scn2k_grp.cc @ 53:ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
* ParseMoji moved to TextStream
* Some cleaning (0 -> NULL when needed, removal of useless returns, ...)
author | thib |
---|---|
date | Sun, 19 Apr 2009 11:44:05 +0000 |
parents | 15a18fbe6f21 |
children | d7cde171a1de |
comparison
equal
deleted
inserted
replaced
52:15a18fbe6f21 | 53:ddbcbd000206 |
---|---|
99 void SetSurfaceNum(int num = -1); | 99 void SetSurfaceNum(int num = -1); |
100 void SetZoomRotate(int zoom=-1, int rotate=-1); | 100 void SetZoomRotate(int zoom=-1, int rotate=-1); |
101 void SetClipArea(int x, int y, int width, int height); | 101 void SetClipArea(int x, int y, int width, int height); |
102 void GetSrcGeom(int& width, int& height); | 102 void GetSrcGeom(int& width, int& height); |
103 void SetUpdate(void); | 103 void SetUpdate(void); |
104 TextStream ParseMoji(const char* str, int def_r ,int def_g, int def_b, int def_size); | |
105 void UpdateMoji(void); | 104 void UpdateMoji(void); |
106 void UpdateDigit(void); | 105 void UpdateDigit(void); |
107 void UpdateSurface(void); | 106 void UpdateSurface(void); |
108 void ZoomRotate(void); | 107 void ZoomRotate(void); |
109 void Update(void); | 108 void Update(void); |
175 | 174 |
176 Surface* Dsurface(int pdt); | 175 Surface* Dsurface(int pdt); |
177 Surface* Ssurface(int pdt); | 176 Surface* Ssurface(int pdt); |
178 | 177 |
179 // cgmode 用画像処理関連 | 178 // cgmode 用画像処理関連 |
180 void LoadCgm(AyuSysConfig& config); | 179 void LoadCgm(void); |
181 std::map<std::string, int> cgm_info; | 180 std::map<std::string, int> cgm_info; |
182 set<int>& cgm_data; | 181 set<int>& cgm_data; |
183 int cgm_size; | 182 int cgm_size; |
184 | 183 |
185 class MuSys& music; | 184 class MuSys *music; |
186 | 185 |
187 public: | 186 public: |
188 AyuSysConfig& config; | 187 AyuSysConfig *config; |
189 void LoadSurface(const char* str, int pdt); | 188 void LoadSurface(const char* str, int pdt); |
190 | 189 |
191 private: | 190 private: |
192 void LoadSurface(const char* str); | 191 void LoadSurface(const char* str); |
193 void LoadSurface(void); | 192 void LoadSurface(void); |
197 void StartShake(int total, const int* pattern); | 196 void StartShake(int total, const int* pattern); |
198 void AbortAnm(void); | 197 void AbortAnm(void); |
199 static bool Pressed(int x, int y, void* pointer); | 198 static bool Pressed(int x, int y, void* pointer); |
200 | 199 |
201 public: | 200 public: |
202 GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& _flag, set<int>& _cgm_data, class MuSys& mu, AyuSysConfig& config); | 201 GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& _flag, set<int>& _cgm_data); |
203 ~GrpImpl(); | 202 ~GrpImpl(); |
204 bool Wait(unsigned int current_time, Cmd& cmd); | 203 bool Wait(unsigned int current_time, Cmd& cmd); |
205 void Exec(Cmd& cmd); | 204 void Exec(Cmd& cmd); |
206 void InitSel(AyuSysConfig& config); | 205 void InitSel(void); |
207 void Save(std::string& str); | 206 void Save(std::string& str); |
208 void Load(const char* str); | 207 void Load(const char* str); |
209 void SaveSys(std::string& str); | 208 void SaveSys(std::string& str); |
210 void LoadSys(const char* str); | 209 void LoadSys(const char* str); |
211 void SetSkipMode(SkipMode _mode); | 210 void SetSkipMode(SkipMode _mode); |
311 } | 310 } |
312 /* ボタンの位置情報を求める */ | 311 /* ボタンの位置情報を求める */ |
313 /* g00 ファイルのヘッダ部分に位置情報は入っている */ | 312 /* g00 ファイルのヘッダ部分に位置情報は入っている */ |
314 string path(name); | 313 string path(name); |
315 path += ".g00"; | 314 path += ".g00"; |
316 ARCINFO* info = file_searcher.Find(FILESEARCH::PDT, path.c_str(), "g00"); | 315 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::PDT, path.c_str(), "g00"); |
317 if (info == NULL) { // ファイルが見つからない | 316 if (info == NULL) { // ファイルが見つからない |
318 fprintf(stderr, "GrpObj::GetSrcGeom : Cannot find file %s\n", path.c_str()); | 317 fprintf(stderr, "GrpObj::GetSrcGeom : Cannot find file %s\n", path.c_str()); |
319 return; | 318 return; |
320 } | 319 } |
321 const char* data = info->Read(); | 320 const char* data = info->Read(); |
451 picture->SetSurfaceRect(Rect(0, 0, zoom_r.width(), zoom_r.height())); | 450 picture->SetSurfaceRect(Rect(0, 0, zoom_r.width(), zoom_r.height())); |
452 | 451 |
453 pic_parent->Root().DeleteSurface(surface_orig); | 452 pic_parent->Root().DeleteSurface(surface_orig); |
454 } | 453 } |
455 | 454 |
456 static char* wstrchr(const char* s, unsigned int chr) { | |
457 int ws, wc; | |
458 while(*s != 0) { | |
459 if (*s < 0 && s[1] != 0) { | |
460 wc = int((unsigned char)(s[0]))*0x100 + int((unsigned char)(s[1])); | |
461 ws = 2; | |
462 } else { | |
463 wc = (unsigned char)(s[0]); | |
464 ws = 1; | |
465 } | |
466 if (wc == chr) return (char*)s; | |
467 s += ws; | |
468 } | |
469 return NULL; | |
470 } | |
471 | |
472 //TODO: See why it does nothing with font/text_stream.cc:98 | |
473 TextStream GrpObj::ParseMoji(const char* str, int def_r ,int def_g, int def_b, int def_size) { // 制御シーケンス付き文字列をparse | |
474 TextStream ts; | |
475 ts.kanji_type = TextStream::sjis; | |
476 ts.SetColor(def_r, def_g, def_b); | |
477 char* copy_str = new char[strlen(str)+1]; | |
478 char* next_str; | |
479 char* retptr; | |
480 int var; | |
481 | |
482 while( (next_str = wstrchr(str, '#')) != NULL) { | |
483 int len = next_str - str; | |
484 strncpy(copy_str, str, len); | |
485 copy_str[len] = 0; | |
486 ts.Add(copy_str); | |
487 str = next_str + 1; | |
488 | |
489 switch(str[0]) { | |
490 case '#': // separator | |
491 str += 1; | |
492 break; | |
493 case 'D': case 'd': // return | |
494 ts.AddReturn(); | |
495 str += 1; | |
496 break; | |
497 case 'C': case 'c': // color | |
498 str += 1; | |
499 var = strtol(str, &next_str,10); | |
500 if (var == 0 && str == next_str) { // no parameter | |
501 ts.SetColor(def_r, def_g, def_b); | |
502 } else { | |
503 int r,g,b; char key[1024]; | |
504 sprintf(key, "#COLOR_TABLE.%03d", var); | |
505 if (parent_pimpl->config.GetParam(key, 3, &r, &g, &b)) { // color not found | |
506 r = g = b = 0; | |
507 } | |
508 ts.SetColor(r, g, b); | |
509 str = next_str; | |
510 } | |
511 break; | |
512 case 'S': case 's': // size | |
513 str += 1; | |
514 var = strtol(str, &next_str, 10); | |
515 if (var == 0 && str == next_str) { // no parameter | |
516 ts.SetSize(1); | |
517 } else { | |
518 if (def_size == 0) def_size = 20; | |
519 if (var <= 0) var = 1; | |
520 ts.SetSize(double(var)/def_size); | |
521 } | |
522 break; | |
523 case 'X': case 'x': // xpos : not supported | |
524 case 'Y': case 'y': // ypos : not supported | |
525 default: | |
526 ts.Add("#"); | |
527 break; | |
528 } | |
529 } | |
530 ts.Add(str); | |
531 delete[] copy_str; | |
532 return ts; | |
533 } | |
534 | |
535 void GrpObj::UpdateMoji(void) { // 文字の大きさ、色などを変更 | 455 void GrpObj::UpdateMoji(void) { // 文字の大きさ、色などを変更 |
536 if (print_moji.length() == 0 || print_size <= 2) return; | 456 if (print_moji.length() == 0 || print_size <= 2) return; |
537 if (pic_parent == 0) return; | 457 if (pic_parent == 0) return; |
538 /* テキストの大きさを得る */ | 458 /* テキストの大きさを得る */ |
539 int r, g, b; | 459 int r, g, b; |
542 } else { | 462 } else { |
543 r = print_r; | 463 r = print_r; |
544 g = print_g; | 464 g = print_g; |
545 b = print_b; | 465 b = print_b; |
546 } | 466 } |
547 TextStream ts = ParseMoji(print_moji.c_str(), r, g, b, print_size); | 467 TextStream ts = TextStream::ParseMoji(print_moji.c_str(), r, g, b, print_size); |
548 TextGlyphStream gs; | 468 TextGlyphStream gs; |
549 vector<int> lh; | 469 vector<int> lh; |
550 // とりあえず drawable width は充分に大きく(2048)取る | 470 // とりあえず drawable width は充分に大きく(2048)取る |
551 DefaultLayout(print_size-2)->Layout(ts, gs, lh, 2048); // print_size そのままだと弱干大きすぎるので -2 | 471 DefaultLayout(print_size-2)->Layout(ts, gs, lh, 2048); // print_size そのままだと弱干大きすぎるので -2 |
552 int width = gs.width(); | 472 int width = gs.width(); |
644 } | 564 } |
645 if (gan_name.empty()) return; | 565 if (gan_name.empty()) return; |
646 /* アニーメション情報 (.GAN ファイル)を求める */ | 566 /* アニーメション情報 (.GAN ファイル)を求める */ |
647 string path(gan_name); | 567 string path(gan_name); |
648 path += ".gan"; | 568 path += ".gan"; |
649 ARCINFO* info = file_searcher.Find(FILESEARCH::GAN, path.c_str(), "gan"); | 569 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::GAN, path.c_str(), "gan"); |
650 if (info == NULL) { | 570 if (info == NULL) { |
651 fprintf(stderr,"GrpObj::CreateGan: Cannot Find 'GAN' file %s\n", path.c_str()); | 571 fprintf(stderr,"GrpObj::CreateGan: Cannot Find 'GAN' file %s\n", path.c_str()); |
652 return; | 572 return; |
653 } | 573 } |
654 const char* data = info->Read(); | 574 const char* data = info->Read(); |
824 * | 744 * |
825 */ | 745 */ |
826 | 746 |
827 #include "music2/music.h" | 747 #include "music2/music.h" |
828 | 748 |
829 GrpImpl::GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm_data, class MuSys& _mu, AyuSysConfig& _config) : | 749 GrpImpl::GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm_data): |
830 event(_event), | 750 event(_event), |
831 flags(f), | 751 flags(f), |
832 parent(_parent), | 752 parent(_parent), |
833 status(NORMAL), | 753 status(NORMAL), |
834 skip_mode(SKIP_NO), | 754 skip_mode(SKIP_NO), |
835 music(_mu), | |
836 cgm_data(_cgm_data), | 755 cgm_data(_cgm_data), |
837 grpobj(this), | 756 grpobj(this), |
838 bs_obj(this), | 757 bs_obj(this) |
839 config(_config) | |
840 { | 758 { |
841 int i; | 759 int i; |
842 for (i=0; i<MAXPDT; i++) { | 760 for (i=0; i<MAXPDT; i++) { |
843 ssurface[i] = 0; | 761 ssurface[i] = 0; |
844 dsurface[i] = 0; | 762 dsurface[i] = 0; |
845 } | 763 } |
764 | |
765 music = MuSys::GetInstance(); | |
766 config = AyuSysConfig::GetInstance(); | |
767 | |
846 screen = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | 768 screen = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); |
847 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | 769 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); |
848 surface = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | 770 surface = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); |
849 surface_update = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | 771 surface_update = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); |
850 DSurfaceFill(surface, Rect(*surface), 0, 0, 0); | 772 DSurfaceFill(surface, Rect(*surface), 0, 0, 0); |
852 screen->SetSurface(surface, 0, 0); | 774 screen->SetSurface(surface, 0, 0); |
853 screen->show(); | 775 screen->show(); |
854 screen_front->hide(); | 776 screen_front->hide(); |
855 screen_front->ZMove(screen); | 777 screen_front->ZMove(screen); |
856 | 778 |
857 LoadCgm(config); | 779 LoadCgm(); |
858 | 780 |
859 anm1 = 0; anm2 = 0; | 781 anm1 = NULL; |
782 anm2 = NULL; | |
860 } | 783 } |
861 | 784 |
862 GrpImpl::~GrpImpl() { | 785 GrpImpl::~GrpImpl() { |
863 | 786 |
864 map<int,GrpObj>::iterator it; | 787 map<int,GrpObj>::iterator it; |
929 } | 852 } |
930 } else { | 853 } else { |
931 if (str[0] != 0) | 854 if (str[0] != 0) |
932 fprintf(stderr,"Cannot find surface %d <- '%s'\n",pdt,str); | 855 fprintf(stderr,"Cannot find surface %d <- '%s'\n",pdt,str); |
933 } | 856 } |
934 return; | 857 } |
935 } | 858 |
936 | 859 void GrpImpl::InitSel(void) { |
937 void GrpImpl::InitSel(AyuSysConfig& config) { | |
938 int i; | 860 int i; |
939 int args[16]; | 861 int args[16]; |
940 char key[1024]; | 862 char key[1024]; |
941 for (i=0; i<999; i++) { | 863 for (i=0; i<999; i++) { |
942 sprintf(key, "#SEL.%03d",i); | 864 sprintf(key, "#SEL.%03d",i); |
943 if (config.GetParam(key, 15, &args[0], &args[1], | 865 if (config->GetParam(key, 15, &args[0], &args[1], |
944 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], | 866 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], |
945 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], | 867 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], |
946 &args[14])) { | 868 &args[14])) { |
947 | 869 |
948 sprintf(key, "#SELR.%03d", i); | 870 sprintf(key, "#SELR.%03d", i); |
949 if (config.GetParam(key, 16, &args[0], &args[1], | 871 if (config->GetParam(key, 16, &args[0], &args[1], |
950 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], | 872 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], |
951 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], | 873 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], |
952 &args[14], &args[15])) continue; | 874 &args[14], &args[15])) continue; |
953 } | 875 } |
954 SEL& s = anmtype[i]; | 876 SEL& s = anmtype[i]; |
1253 } | 1175 } |
1254 | 1176 |
1255 bool GrpImpl::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル | 1177 bool GrpImpl::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル |
1256 GrpImpl* g = (GrpImpl*)pointer; | 1178 GrpImpl* g = (GrpImpl*)pointer; |
1257 if (g->status == WAIT_MOVIE) | 1179 if (g->status == WAIT_MOVIE) |
1258 g->music.StopMovie(); | 1180 g->music->StopMovie(); |
1259 if (g->status == WAIT_ANM) | 1181 if (g->status == WAIT_ANM) |
1260 g->AbortAnm(); | 1182 g->AbortAnm(); |
1261 if (g->status == WAIT_SHAKE && g->anm2 != NULL) { | 1183 if (g->status == WAIT_SHAKE && g->anm2 != NULL) { |
1262 g->anm2->Abort(); | 1184 g->anm2->Abort(); |
1263 delete g->anm2; | 1185 delete g->anm2; |
1300 0x08, 0x85, 0xc0, 0x75, 0x56, 0x8b, 0x1d, 0xd0, | 1222 0x08, 0x85, 0xc0, 0x75, 0x56, 0x8b, 0x1d, 0xd0, |
1301 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81, | 1223 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81, |
1302 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76 | 1224 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76 |
1303 }; | 1225 }; |
1304 | 1226 |
1305 void GrpImpl::LoadCgm(AyuSysConfig& config) { | 1227 void GrpImpl::LoadCgm() { |
1306 /* cgm ファイル読み込み */ | 1228 /* cgm ファイル読み込み */ |
1307 const char* fname = config.GetParaStr("#CGTABLE_FILE"); | 1229 const char* fname = config->GetParaStr("#CGTABLE_FILE"); |
1308 if (fname == NULL) return; | 1230 if (fname == NULL) return; |
1309 ARCINFO* info = file_searcher.Find(FILESEARCH::ALL, fname, ""); | 1231 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::ALL, fname, ""); |
1310 if (info == NULL) return; | 1232 if (info == NULL) return; |
1311 char* data = info->CopyRead(); | 1233 char* data = info->CopyRead(); |
1312 int sz = info->Size(); | 1234 int sz = info->Size(); |
1313 delete info; | 1235 delete info; |
1314 | 1236 |
1364 delete p; | 1286 delete p; |
1365 } | 1287 } |
1366 grpobj.clear(); | 1288 grpobj.clear(); |
1367 | 1289 |
1368 bg_name = ""; | 1290 bg_name = ""; |
1369 music.StopCDROM(100); | 1291 music->StopCDROM(100); |
1370 } | 1292 } |
1371 | 1293 |
1372 void GrpImpl::SaveSys(string& save) { | 1294 void GrpImpl::SaveSys(string& save) { |
1373 char buf[1024]; | 1295 char buf[1024]; |
1374 save = "\n[Graphics]\n"; | 1296 save = "\n[Graphics]\n"; |
1485 delete anm2; | 1407 delete anm2; |
1486 anm2 = NULL; | 1408 anm2 = NULL; |
1487 } | 1409 } |
1488 status = NORMAL; | 1410 status = NORMAL; |
1489 } else if (status == WAIT_SE) { | 1411 } else if (status == WAIT_SE) { |
1490 if (music.IsStopSE()) status = NORMAL; | 1412 if (music->IsStopSE()) status = NORMAL; |
1491 return true; | 1413 return true; |
1492 } else if (status == WAIT_MOVIE) { | 1414 } else if (status == WAIT_MOVIE) { |
1493 if (music.IsStopMovie()) { | 1415 if (music->IsStopMovie()) { |
1494 music.StopMovie(); | 1416 music->StopMovie(); |
1495 status = NORMAL; | 1417 status = NORMAL; |
1496 screen->ReBlit(); | 1418 screen->ReBlit(); |
1497 } | 1419 } |
1498 return true; | 1420 return true; |
1499 } | 1421 } |
1527 grpobj.erase(begin, end); | 1449 grpobj.erase(begin, end); |
1528 } | 1450 } |
1529 | 1451 |
1530 void GrpImpl::Exec(Cmd& cmd) { | 1452 void GrpImpl::Exec(Cmd& cmd) { |
1531 if (cmd.cmd_type == CMD_TEXTEND) { | 1453 if (cmd.cmd_type == CMD_TEXTEND) { |
1532 music.StopKoe(500); // テキスト終了で声を止める | 1454 music->StopKoe(500); // テキスト終了で声を止める |
1533 cmd.clear(); | 1455 cmd.clear(); |
1534 return; | 1456 return; |
1535 } | 1457 } |
1536 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) { | 1458 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) { |
1537 // wait する場合は RefreshObj() しておく | 1459 // wait する場合は RefreshObj() しておく |
1602 cmd.cmd_type = CMD_SAVECMDGRP_START; | 1524 cmd.cmd_type = CMD_SAVECMDGRP_START; |
1603 } else if (cmd.cmd3 == 0x20) { | 1525 } else if (cmd.cmd3 == 0x20) { |
1604 // shake screen | 1526 // shake screen |
1605 char key[1024]; | 1527 char key[1024]; |
1606 sprintf(key, "#SHAKE.%03d", cmd.args[0].value); | 1528 sprintf(key, "#SHAKE.%03d", cmd.args[0].value); |
1607 if (config.SearchParam(key) != 2) { | 1529 if (config->SearchParam(key) != 2) { |
1608 fprintf(stderr,"Cannot find shake pattern %d; use default pattern\n",cmd.args[0].value); | 1530 fprintf(stderr,"Cannot find shake pattern %d; use default pattern\n",cmd.args[0].value); |
1609 strcpy(key, "#SHAKE.000"); // default key | 1531 strcpy(key, "#SHAKE.000"); // default key |
1610 } | 1532 } |
1611 int num; const int* pattern; | 1533 int num; const int* pattern; |
1612 pattern = config.GetParamArray(key, num); | 1534 pattern = config->GetParamArray(key, num); |
1613 if (pattern) { | 1535 if (pattern) { |
1614 StartShake(num, pattern); | 1536 StartShake(num, pattern); |
1615 status = WAIT_SHAKE; | 1537 status = WAIT_SHAKE; |
1616 } | 1538 } |
1617 cmd.clear(); | 1539 cmd.clear(); |
2090 */ | 2012 */ |
2091 g.print_size = cmd.args[1].value; | 2013 g.print_size = cmd.args[1].value; |
2092 /* 前景色を得る */ | 2014 /* 前景色を得る */ |
2093 int cr,cg,cb; char key[1024]; | 2015 int cr,cg,cb; char key[1024]; |
2094 sprintf(key, "#COLOR_TABLE.%03d", cmd.args[5].value); | 2016 sprintf(key, "#COLOR_TABLE.%03d", cmd.args[5].value); |
2095 if (config.GetParam(key, 3, &cr, &cg, &cb)) { // color not found | 2017 if (config->GetParam(key, 3, &cr, &cg, &cb)) { // color not found |
2096 cr = cg = cb = 0; | 2018 cr = cg = cb = 0; |
2097 } | 2019 } |
2098 g.print_r = cr; | 2020 g.print_r = cr; |
2099 g.print_g = cg; | 2021 g.print_g = cg; |
2100 g.print_b = cb; | 2022 g.print_b = cb; |
2211 */ | 2133 */ |
2212 // 本来は音楽関連のコマンド | 2134 // 本来は音楽関連のコマンド |
2213 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x14) { | 2135 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x14) { |
2214 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { | 2136 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { |
2215 eprintf("play bgm %s\n",cmd.Str(cmd.args[0])); | 2137 eprintf("play bgm %s\n",cmd.Str(cmd.args[0])); |
2216 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000); | 2138 music->PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000); |
2217 cmd.cmd_type = CMD_SAVECMD_ONCE; | 2139 cmd.cmd_type = CMD_SAVECMD_ONCE; |
2218 } | 2140 } |
2219 if (cmd.cmd3 == 2 && (cmd.cmd4 == 2 || cmd.cmd4 == 0) ) { /* ??? : ことみシナリオラストの音楽再生 */ | 2141 if (cmd.cmd3 == 2 && (cmd.cmd4 == 2 || cmd.cmd4 == 0) ) { /* ??? : ことみシナリオラストの音楽再生 */ |
2220 eprintf("play bgm %s\n",cmd.Str(cmd.args[0])); | 2142 eprintf("play bgm %s\n",cmd.Str(cmd.args[0])); |
2221 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 1); | 2143 music->PlayCDROM( (char*)cmd.Str(cmd.args[0]), 1); |
2222 cmd.cmd_type = CMD_SAVECMD_ONCE; | 2144 cmd.cmd_type = CMD_SAVECMD_ONCE; |
2223 } | 2145 } |
2224 if (cmd.cmd3 == 0 && cmd.cmd4 == 2) { | 2146 if (cmd.cmd3 == 0 && cmd.cmd4 == 2) { |
2225 eprintf("fade bgm %d? and play bgm %s; %d\n",cmd.args[1].value, cmd.Str(cmd.args[0]), cmd.args[2].value); | 2147 eprintf("fade bgm %d? and play bgm %s; %d\n",cmd.args[1].value, cmd.Str(cmd.args[0]), cmd.args[2].value); |
2226 // music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000, cmd.args[2].value); | 2148 // music->PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000, cmd.args[2].value); |
2227 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000); | 2149 music->PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000); |
2228 cmd.cmd_type = CMD_SAVECMD_ONCE; | 2150 cmd.cmd_type = CMD_SAVECMD_ONCE; |
2229 } | 2151 } |
2230 if ( (cmd.cmd3 == 5 || cmd.cmd3 == 0x69) && cmd.cmd4 == 0) { | 2152 if ( (cmd.cmd3 == 5 || cmd.cmd3 == 0x69) && cmd.cmd4 == 0) { |
2231 if (cmd.cmd3 == 5) { | 2153 if (cmd.cmd3 == 5) { |
2232 music.StopCDROM(0); | 2154 music->StopCDROM(0); |
2233 eprintf("stop bgm\n"); | 2155 eprintf("stop bgm\n"); |
2234 } else { | 2156 } else { |
2235 music.StopCDROM(cmd.args[0].value); | 2157 music->StopCDROM(cmd.args[0].value); |
2236 eprintf("fade bgm %d\n",cmd.args[0].value); | 2158 eprintf("fade bgm %d\n",cmd.args[0].value); |
2237 } | 2159 } |
2238 cmd.cmd_type = CMD_SAVECMD_ONCE; | 2160 cmd.cmd_type = CMD_SAVECMD_ONCE; |
2239 } | 2161 } |
2240 } | 2162 } |
2241 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x15) { | 2163 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x15) { |
2242 if ((cmd.cmd3 == 2) || (cmd.cmd3 == 0 && (cmd.cmd4 == 1 || cmd.cmd4 == 2)) || (cmd.cmd3 == 0 && cmd.cmd4 == 0)) { | 2164 if ((cmd.cmd3 == 2) || (cmd.cmd3 == 0 && (cmd.cmd4 == 1 || cmd.cmd4 == 2)) || (cmd.cmd3 == 0 && cmd.cmd4 == 0)) { |
2243 eprintf("play SE %s\n",cmd.Str(cmd.args[0])); | 2165 eprintf("play SE %s\n",cmd.Str(cmd.args[0])); |
2244 if (cmd.cmd3 == 2) { | 2166 if (cmd.cmd3 == 2) { |
2245 music.PlaySE(cmd.Str(cmd.args[0]),1); | 2167 music->PlaySE(cmd.Str(cmd.args[0]),1); |
2246 cmd.cmd_type = CMD_SAVECMD_ONCE; | 2168 cmd.cmd_type = CMD_SAVECMD_ONCE; |
2247 } else { | 2169 } else { |
2248 music.PlaySE(cmd.Str(cmd.args[0])); | 2170 music->PlaySE(cmd.Str(cmd.args[0])); |
2249 cmd.clear(); | 2171 cmd.clear(); |
2250 } | 2172 } |
2251 } else if (cmd.cmd3 == 5) { | 2173 } else if (cmd.cmd3 == 5) { |
2252 eprintf("Stop SE\n"); | 2174 eprintf("Stop SE\n"); |
2253 music.StopSE(); | 2175 music->StopSE(); |
2254 cmd.cmd_type = CMD_SAVECMD_ONCE; | 2176 cmd.cmd_type = CMD_SAVECMD_ONCE; |
2255 } else if (cmd.cmd3 == 0x69) { | 2177 } else if (cmd.cmd3 == 0x69) { |
2256 eprintf("Stop SE with fade %d\n",cmd.args[0].value); | 2178 eprintf("Stop SE with fade %d\n",cmd.args[0].value); |
2257 music.StopSE(cmd.args[0].value); | 2179 music->StopSE(cmd.args[0].value); |
2258 cmd.cmd_type = CMD_SAVECMD_ONCE; | 2180 cmd.cmd_type = CMD_SAVECMD_ONCE; |
2259 } | 2181 } |
2260 } | 2182 } |
2261 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && (cmd.cmd3 == 0x4bb || cmd.cmd3 == 0x4bc) ) { | 2183 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && (cmd.cmd3 == 0x4bb || cmd.cmd3 == 0x4bc) ) { |
2262 // 音楽を待ってみる(絶対に違うが)。本来、04-803 に対応してなにかの終わりをwaitするっぽい(風子/智代Ed付近) | 2184 // 音楽を待ってみる(絶対に違うが)。本来、04-803 に対応してなにかの終わりをwaitするっぽい(風子/智代Ed付近) |
2263 // EnableSyscom らしいが、よくわからない (rldev) | 2185 // EnableSyscom らしいが、よくわからない (rldev) |
2264 // if (!music.IsStopSE()) status = WAIT_SE; | 2186 // if (!music->IsStopSE()) status = WAIT_SE; |
2265 cmd.clear(); | 2187 cmd.clear(); |
2266 } | 2188 } |
2267 | 2189 |
2268 // 音楽モードで音量を上げるためのコマンド (SetBgmVolume) | 2190 // 音楽モードで音量を上げるためのコマンド (SetBgmVolume) |
2269 // とりあえず未実装 | 2191 // とりあえず未実装 |
2270 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x8b6 && cmd.cmd3 <= 0x8b9) { // Set{Bgm,Koe,PCM,Se}VolMod | 2192 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x8b6 && cmd.cmd3 <= 0x8b9) { // Set{Bgm,Koe,PCM,Se}VolMod |
2271 music.volmod[cmd.cmd3-0x8b6] = cmd.args[0].value; | 2193 music->volmod[cmd.cmd3-0x8b6] = cmd.args[0].value; |
2272 config.SetParam("#VOLMOD", 4, music.volmod[0], music.volmod[1], music.volmod[2], music.volmod[3]); | 2194 config->SetParam("#VOLMOD", 4, music->volmod[0], music->volmod[1], music->volmod[2], music->volmod[3]); |
2273 cmd.clear(); | 2195 cmd.clear(); |
2274 } | 2196 } |
2275 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x91a && cmd.cmd3 <= 0x91d) { // Get{Bgm,Koe,PCM,Se}VolMod | 2197 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x91a && cmd.cmd3 <= 0x91d) { // Get{Bgm,Koe,PCM,Se}VolMod |
2276 cmd.SetSysvar(music.volmod[cmd.cmd3-0x91a]); | 2198 cmd.SetSysvar(music->volmod[cmd.cmd3-0x91a]); |
2277 } | 2199 } |
2278 | 2200 |
2279 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x16) { | 2201 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x16) { |
2280 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { | 2202 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { |
2281 eprintf("play SE %d\n",cmd.args[0].value); | 2203 eprintf("play SE %d\n",cmd.args[0].value); |
2282 music.PlaySE(cmd.args[0].value); | 2204 music->PlaySE(cmd.args[0].value); |
2283 cmd.clear(); | 2205 cmd.clear(); |
2284 } | 2206 } |
2285 } | 2207 } |
2286 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x17) { | 2208 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x17) { |
2287 if (cmd.cmd3 == 0) { | 2209 if (cmd.cmd3 == 0) { |
2289 if (cmd.cmd4 == 1) { | 2211 if (cmd.cmd4 == 1) { |
2290 eprintf(", para? %d",cmd.args[1].value); | 2212 eprintf(", para? %d",cmd.args[1].value); |
2291 } | 2213 } |
2292 eprintf("\n"); | 2214 eprintf("\n"); |
2293 char buf[1024]; sprintf(buf, "%d",cmd.args[0].value); | 2215 char buf[1024]; sprintf(buf, "%d",cmd.args[0].value); |
2294 if ( !(skip_mode & SKIP_TEXT)) music.PlayKoe(buf); | 2216 if ( !(skip_mode & SKIP_TEXT)) music->PlayKoe(buf); |
2295 cmd.clear(); | 2217 cmd.clear(); |
2296 } | 2218 } |
2297 } | 2219 } |
2298 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1a) { | 2220 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1a) { |
2299 if ( (cmd.cmd3 == 0x14 || cmd.cmd3 == 1) && cmd.cmd4 == 0) { | 2221 if ( (cmd.cmd3 == 0x14 || cmd.cmd3 == 1) && cmd.cmd4 == 0) { |
2301 int x = cmd.args[1].value; | 2223 int x = cmd.args[1].value; |
2302 int y = cmd.args[2].value; | 2224 int y = cmd.args[2].value; |
2303 int x2 = cmd.args[3].value; | 2225 int x2 = cmd.args[3].value; |
2304 int y2 = cmd.args[4].value; | 2226 int y2 = cmd.args[4].value; |
2305 eprintf("play movie ; name %s pos %d,%d - %d,%d\n",str,x,y,x2,y2); | 2227 eprintf("play movie ; name %s pos %d,%d - %d,%d\n",str,x,y,x2,y2); |
2306 music.PlayMovie(str, x, y, x2, y2,1); | 2228 music->PlayMovie(str, x, y, x2, y2,1); |
2307 status = WAIT_MOVIE; | 2229 status = WAIT_MOVIE; |
2308 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | 2230 event.RegisterGlobalPressFunc(&Pressed, (void*)this); |
2309 cmd.clear(); | 2231 cmd.clear(); |
2310 } | 2232 } |
2311 } | 2233 } |
2316 /******************************************************** | 2238 /******************************************************** |
2317 ** | 2239 ** |
2318 ** class Grp | 2240 ** class Grp |
2319 */ | 2241 */ |
2320 | 2242 |
2321 Grp::Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm,class MuSys& mu, AyuSysConfig& config) { | 2243 Grp::Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm) { |
2322 pimpl = new GrpImpl(_event, _parent, f, _cgm, mu, config); | 2244 pimpl = new GrpImpl(_event, _parent, f, _cgm); |
2323 } | 2245 } |
2324 | 2246 |
2325 Grp::~Grp() { | 2247 Grp::~Grp() { |
2326 delete pimpl; | 2248 delete pimpl; |
2327 } | 2249 } |
2336 | 2258 |
2337 void Grp::SetSkipMode(SkipMode mode) { | 2259 void Grp::SetSkipMode(SkipMode mode) { |
2338 pimpl->SetSkipMode(mode); | 2260 pimpl->SetSkipMode(mode); |
2339 } | 2261 } |
2340 | 2262 |
2341 void Grp::InitSel(AyuSysConfig& config) { | 2263 void Grp::InitSel(void) { |
2342 pimpl->InitSel(config); | 2264 pimpl->InitSel(); |
2343 } | 2265 } |
2344 | 2266 |
2345 void Grp::Save(std::string& str) { | 2267 void Grp::Save(std::string& str) { |
2346 pimpl->Save(str); | 2268 pimpl->Save(str); |
2347 } | 2269 } |