-rw-r--r-- | noncore/games/kpacman/referee.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/noncore/games/kpacman/referee.cpp b/noncore/games/kpacman/referee.cpp index 81f331b..6d8f3fb 100644 --- a/noncore/games/kpacman/referee.cpp +++ b/noncore/games/kpacman/referee.cpp | |||
@@ -473,529 +473,515 @@ void Referee::fillStrList(QStrList &list, QString values, int max) | |||
473 | 473 | ||
474 | for (uint i = 0; i < (uint) max; i++) { | 474 | for (uint i = 0; i < (uint) max; i++) { |
475 | if (values.find(',') < 0 && values.length() > 0) { | 475 | if (values.find(',') < 0 && values.length() > 0) { |
476 | value = values; | 476 | value = values; |
477 | values = ""; | 477 | values = ""; |
478 | } | 478 | } |
479 | if (values.find(',') >= 0) { | 479 | if (values.find(',') >= 0) { |
480 | value = values.left(values.find(',')); | 480 | value = values.left(values.find(',')); |
481 | values.remove(0,values.find(',')+1); | 481 | values.remove(0,values.find(',')+1); |
482 | } | 482 | } |
483 | if (!value.isEmpty()) | 483 | if (!value.isEmpty()) |
484 | last = value; | 484 | last = value; |
485 | 485 | ||
486 | list.append(last); | 486 | list.append(last); |
487 | } | 487 | } |
488 | } | 488 | } |
489 | 489 | ||
490 | void Referee::fillMapName() | 490 | void Referee::fillMapName() |
491 | { | 491 | { |
492 | QStrList list = mapName; | 492 | QStrList list = mapName; |
493 | 493 | ||
494 | if (!mapName.isEmpty()) | 494 | if (!mapName.isEmpty()) |
495 | mapName.clear(); | 495 | mapName.clear(); |
496 | 496 | ||
497 | QString map; | 497 | QString map; |
498 | 498 | ||
499 | QFileInfo fileInfo; | 499 | QFileInfo fileInfo; |
500 | 500 | ||
501 | for (uint i = 0; i < list.count(); i++) { | 501 | for (uint i = 0; i < list.count(); i++) { |
502 | map = list.at(i); | 502 | map = list.at(i); |
503 | 503 | ||
504 | if (map.left(1) != "/" && map.left(1) != "~") | 504 | if (map.left(1) != "/" && map.left(1) != "~") |
505 | map = FIND_APP_DATA( mapDirectory+map ); | 505 | map = FIND_APP_DATA( mapDirectory+map ); |
506 | 506 | ||
507 | fileInfo.setFile(map); | 507 | fileInfo.setFile(map); |
508 | if (!fileInfo.isReadable()) | 508 | if (!fileInfo.isReadable()) |
509 | map = ""; | 509 | map = ""; |
510 | 510 | ||
511 | mapName.append(map); | 511 | mapName.append(map); |
512 | } | 512 | } |
513 | } | 513 | } |
514 | 514 | ||
515 | void Referee::confLevels(bool defGroup) | 515 | void Referee::confLevels(bool defGroup) |
516 | { | 516 | { |
517 | APP_CONFIG_BEGIN( cfg ); | 517 | APP_CONFIG_BEGIN( cfg ); |
518 | if (defGroup || cfg->hasKey("Levels")) | 518 | if (defGroup || cfg->hasKey("Levels")) |
519 | maxLevel = cfg->readNumEntry("Levels", 13); | 519 | maxLevel = cfg->readNumEntry("Levels", 13); |
520 | APP_CONFIG_END( cfg ); | 520 | APP_CONFIG_END( cfg ); |
521 | } | 521 | } |
522 | 522 | ||
523 | void Referee::confMisc(bool defGroup) | 523 | void Referee::confMisc(bool defGroup) |
524 | { | 524 | { |
525 | APP_CONFIG_BEGIN( cfg ); | 525 | APP_CONFIG_BEGIN( cfg ); |
526 | if (defGroup || cfg->hasKey("PixmapDirectory")) { | 526 | if (defGroup || cfg->hasKey("PixmapDirectory")) { |
527 | pixmapDirectory = cfg->readEntry("PixmapDirectory"); | 527 | pixmapDirectory = cfg->readEntry("PixmapDirectory"); |
528 | 528 | ||
529 | if (pixmapDirectory.left(1) != "/" && pixmapDirectory.left(1) != "~") | 529 | if (pixmapDirectory.left(1) != "/" && pixmapDirectory.left(1) != "~") |
530 | pixmapDirectory.insert(0, "pics/"); | 530 | pixmapDirectory.insert(0, "pics/"); |
531 | if (pixmapDirectory.right(1) != "/") | 531 | if (pixmapDirectory.right(1) != "/") |
532 | pixmapDirectory.append("/"); | 532 | pixmapDirectory.append("/"); |
533 | } | 533 | } |
534 | 534 | ||
535 | if (defGroup || cfg->hasKey("MapDirectory")) { | 535 | if (defGroup || cfg->hasKey("MapDirectory")) { |
536 | mapDirectory = cfg->readEntry("MapDirectory"); | 536 | mapDirectory = cfg->readEntry("MapDirectory"); |
537 | 537 | ||
538 | if (mapDirectory.left(1) != "/" && mapDirectory.left(1) != "~") | 538 | if (mapDirectory.left(1) != "/" && mapDirectory.left(1) != "~") |
539 | mapDirectory.insert(0, "maps/"); | 539 | mapDirectory.insert(0, "maps/"); |
540 | if (mapDirectory.right(1) != "/") | 540 | if (mapDirectory.right(1) != "/") |
541 | mapDirectory.append("/"); | 541 | mapDirectory.append("/"); |
542 | } | 542 | } |
543 | 543 | ||
544 | if (defGroup || cfg->hasKey("MapName")) | 544 | if (defGroup || cfg->hasKey("MapName")) |
545 | fillStrList(mapName, cfg->readEntry("MapName", "map"), maxLevel+1); | 545 | fillStrList(mapName, cfg->readEntry("MapName", "map"), maxLevel+1); |
546 | 546 | ||
547 | if (defGroup || cfg->hasKey("MonsterIQ")) | 547 | if (defGroup || cfg->hasKey("MonsterIQ")) |
548 | fillArray(monsterIQ, cfg->readEntry("MonsterIQ", "0,170,180,170,180,170,180"), maxLevel+1); | 548 | fillArray(monsterIQ, cfg->readEntry("MonsterIQ", "0,170,180,170,180,170,180"), maxLevel+1); |
549 | if (defGroup || cfg->hasKey("FruitIQ")) | 549 | if (defGroup || cfg->hasKey("FruitIQ")) |
550 | fillArray(fruitIQ, cfg->readEntry("FruitIQ", "0,170,180,170,180,170,180"), maxLevel+1); | 550 | fillArray(fruitIQ, cfg->readEntry("FruitIQ", "0,170,180,170,180,170,180"), maxLevel+1); |
551 | if (defGroup || cfg->hasKey("FruitIndex")) | 551 | if (defGroup || cfg->hasKey("FruitIndex")) |
552 | fillArray(fruitIndex, cfg->readEntry("FruitIndex", "0"), maxLevel+1); | 552 | fillArray(fruitIndex, cfg->readEntry("FruitIndex", "0"), maxLevel+1); |
553 | APP_CONFIG_END( cfg ); | 553 | APP_CONFIG_END( cfg ); |
554 | } | 554 | } |
555 | 555 | ||
556 | void Referee::confTiming(bool defGroup) | 556 | void Referee::confTiming(bool defGroup) |
557 | { | 557 | { |
558 | APP_CONFIG_BEGIN( cfg ); | 558 | APP_CONFIG_BEGIN( cfg ); |
559 | if (defGroup || cfg->hasKey("SpeedMS")) | 559 | if (defGroup || cfg->hasKey("SpeedMS")) |
560 | fillArray(speed, cfg->readEntry("SpeedMS", "20"), maxLevel+1); | 560 | fillArray(speed, cfg->readEntry("SpeedMS", "20"), maxLevel+1); |
561 | if (defGroup || cfg->hasKey("PacmanTicks")) | 561 | if (defGroup || cfg->hasKey("PacmanTicks")) |
562 | fillArray(pacmanTicks,cfg->readEntry("PacmanTicks", "3"), maxLevel+1); | 562 | fillArray(pacmanTicks,cfg->readEntry("PacmanTicks", "3"), maxLevel+1); |
563 | if (defGroup || cfg->hasKey("RemTicks")) | 563 | if (defGroup || cfg->hasKey("RemTicks")) |
564 | fillArray(remTicks, cfg->readEntry("RemTicks", "1"), maxLevel+1); | 564 | fillArray(remTicks, cfg->readEntry("RemTicks", "1"), maxLevel+1); |
565 | if (defGroup || cfg->hasKey("DangerousTicks")) | 565 | if (defGroup || cfg->hasKey("DangerousTicks")) |
566 | fillArray(dangerousTicks, cfg->readEntry("DangerousTicks", "3"), maxLevel+1); | 566 | fillArray(dangerousTicks, cfg->readEntry("DangerousTicks", "3"), maxLevel+1); |
567 | if (defGroup || cfg->hasKey("HarmlessTicks")) | 567 | if (defGroup || cfg->hasKey("HarmlessTicks")) |
568 | fillArray(harmlessTicks, cfg->readEntry("HarmlessTicks", "7,6,,5,,4"), maxLevel+1); | 568 | fillArray(harmlessTicks, cfg->readEntry("HarmlessTicks", "7,6,,5,,4"), maxLevel+1); |
569 | if (defGroup || cfg->hasKey("HarmlessDurationTicks")) | 569 | if (defGroup || cfg->hasKey("HarmlessDurationTicks")) |
570 | fillArray(harmlessDurTicks, cfg->readEntry("HarmlessDurationTicks", "375,,,300,,250,200,150"), maxLevel+1); | 570 | fillArray(harmlessDurTicks, cfg->readEntry("HarmlessDurationTicks", "375,,,300,,250,200,150"), maxLevel+1); |
571 | if (defGroup || cfg->hasKey("HarmlessWarningTicks")) | 571 | if (defGroup || cfg->hasKey("HarmlessWarningTicks")) |
572 | fillArray(harmlessWarnTicks, cfg->readEntry("HarmlessWarningTicks", "135"), maxLevel+1); | 572 | fillArray(harmlessWarnTicks, cfg->readEntry("HarmlessWarningTicks", "135"), maxLevel+1); |
573 | if (defGroup || cfg->hasKey("ArrestTicks")) | 573 | if (defGroup || cfg->hasKey("ArrestTicks")) |
574 | fillArray(arrestTicks, cfg->readEntry("ArrestTicks", "6"), maxLevel+1); | 574 | fillArray(arrestTicks, cfg->readEntry("ArrestTicks", "6"), maxLevel+1); |
575 | if (defGroup || cfg->hasKey("ArrestDurationTicks")) | 575 | if (defGroup || cfg->hasKey("ArrestDurationTicks")) |
576 | fillArray(arrestDurTicks, cfg->readEntry("ArrestDurationTicks", "200,,,150"), maxLevel+1); | 576 | fillArray(arrestDurTicks, cfg->readEntry("ArrestDurationTicks", "200,,,150"), maxLevel+1); |
577 | if (defGroup || cfg->hasKey("FruitTicks")) | 577 | if (defGroup || cfg->hasKey("FruitTicks")) |
578 | fillArray(fruitTicks, cfg->readEntry("FruitTicks", "7,6,,5,,4"), maxLevel+1); | 578 | fillArray(fruitTicks, cfg->readEntry("FruitTicks", "7,6,,5,,4"), maxLevel+1); |
579 | if (defGroup || cfg->hasKey("FruitAppearsTicks")) | 579 | if (defGroup || cfg->hasKey("FruitAppearsTicks")) |
580 | fillArray(fruitAppearsTicks, cfg->readEntry("FruitAppearsTicks", "1000,,1500,2000,2500,3000,3500,4000"), maxLevel+1); | 580 | fillArray(fruitAppearsTicks, cfg->readEntry("FruitAppearsTicks", "1000,,1500,2000,2500,3000,3500,4000"), maxLevel+1); |
581 | if (defGroup || cfg->hasKey("FruitDurationTicks")) | 581 | if (defGroup || cfg->hasKey("FruitDurationTicks")) |
582 | fillArray(fruitDurTicks, cfg->readEntry("FruitDurationTicks", "500,,,400,350,300,,250,200,150"), maxLevel+1); | 582 | fillArray(fruitDurTicks, cfg->readEntry("FruitDurationTicks", "500,,,400,350,300,,250,200,150"), maxLevel+1); |
583 | if (defGroup || cfg->hasKey("FruitScoreDurationTicks")) | 583 | if (defGroup || cfg->hasKey("FruitScoreDurationTicks")) |
584 | fillArray(fruitScoreDurTicks, cfg->readEntry("FruitScoreDurationTicks", "150"), maxLevel+1); | 584 | fillArray(fruitScoreDurTicks, cfg->readEntry("FruitScoreDurationTicks", "150"), maxLevel+1); |
585 | 585 | ||
586 | if (defGroup || cfg->hasKey("MonsterScoreDurationMS")) | 586 | if (defGroup || cfg->hasKey("MonsterScoreDurationMS")) |
587 | monsterScoreDurMS = cfg->readNumEntry("MonsterScoreDurationMS", 1000); | 587 | monsterScoreDurMS = cfg->readNumEntry("MonsterScoreDurationMS", 1000); |
588 | if (defGroup || cfg->hasKey("PlayerDurationMS")) | 588 | if (defGroup || cfg->hasKey("PlayerDurationMS")) |
589 | playerDurMS = cfg->readNumEntry("PlayerDurationMS", 3000); | 589 | playerDurMS = cfg->readNumEntry("PlayerDurationMS", 3000); |
590 | if (defGroup || cfg->hasKey("ReadyDurationMS")) | 590 | if (defGroup || cfg->hasKey("ReadyDurationMS")) |
591 | readyDurMS = cfg->readNumEntry("ReadyDurationMS", 2000); | 591 | readyDurMS = cfg->readNumEntry("ReadyDurationMS", 2000); |
592 | if (defGroup || cfg->hasKey("GameOverDurationMS")) | 592 | if (defGroup || cfg->hasKey("GameOverDurationMS")) |
593 | gameOverDurMS = cfg->readNumEntry("GameOverDurationMS", 3000); | 593 | gameOverDurMS = cfg->readNumEntry("GameOverDurationMS", 3000); |
594 | if (defGroup || cfg->hasKey("AfterPauseMS")) | 594 | if (defGroup || cfg->hasKey("AfterPauseMS")) |
595 | afterPauseMS = cfg->readNumEntry("AfterPauseMS", 1000); | 595 | afterPauseMS = cfg->readNumEntry("AfterPauseMS", 1000); |
596 | if (defGroup || cfg->hasKey("DyingPreAnimationMS")) | 596 | if (defGroup || cfg->hasKey("DyingPreAnimationMS")) |
597 | dyingPreAnimationMS = cfg->readNumEntry("DyingPreAnimationMS", 1000); | 597 | dyingPreAnimationMS = cfg->readNumEntry("DyingPreAnimationMS", 1000); |
598 | if (defGroup || cfg->hasKey("DyingAnimationMS")) | 598 | if (defGroup || cfg->hasKey("DyingAnimationMS")) |
599 | dyingAnimationMS = cfg->readNumEntry("DyingAnimationMS", 100); | 599 | dyingAnimationMS = cfg->readNumEntry("DyingAnimationMS", 100); |
600 | if (defGroup || cfg->hasKey("DyingPostAnimationMS")) | 600 | if (defGroup || cfg->hasKey("DyingPostAnimationMS")) |
601 | dyingPostAnimationMS = cfg->readNumEntry("DyingPostAnimationMS", 500); | 601 | dyingPostAnimationMS = cfg->readNumEntry("DyingPostAnimationMS", 500); |
602 | if (defGroup || cfg->hasKey("IntroAnimationMS")) | 602 | if (defGroup || cfg->hasKey("IntroAnimationMS")) |
603 | introAnimationMS = cfg->readNumEntry("IntroAnimationMS", 800); | 603 | introAnimationMS = cfg->readNumEntry("IntroAnimationMS", 800); |
604 | if (defGroup || cfg->hasKey("IntroPostAnimationMS")) | 604 | if (defGroup || cfg->hasKey("IntroPostAnimationMS")) |
605 | introPostAnimationMS = cfg->readNumEntry("IntroPostAnimationMS", 1000); | 605 | introPostAnimationMS = cfg->readNumEntry("IntroPostAnimationMS", 1000); |
606 | if (defGroup || cfg->hasKey("LevelUpPreAnimationMS")) | 606 | if (defGroup || cfg->hasKey("LevelUpPreAnimationMS")) |
607 | levelUpPreAnimationMS = cfg->readNumEntry("LevelUpPreAnimationMS", 2000); | 607 | levelUpPreAnimationMS = cfg->readNumEntry("LevelUpPreAnimationMS", 2000); |
608 | if (defGroup || cfg->hasKey("LevelUpAnimationMS")) | 608 | if (defGroup || cfg->hasKey("LevelUpAnimationMS")) |
609 | levelUpAnimationMS = cfg->readNumEntry("LevelUpAnimationMS", 2000); | 609 | levelUpAnimationMS = cfg->readNumEntry("LevelUpAnimationMS", 2000); |
610 | if (defGroup || cfg->hasKey("EnergizerAnimationMS")) | 610 | if (defGroup || cfg->hasKey("EnergizerAnimationMS")) |
611 | energizerAnimationMS = cfg->readNumEntry("EnergizerAnimationMS", 200); | 611 | energizerAnimationMS = cfg->readNumEntry("EnergizerAnimationMS", 200); |
612 | APP_CONFIG_END( cfg ); | 612 | APP_CONFIG_END( cfg ); |
613 | } | 613 | } |
614 | 614 | ||
615 | void Referee::confScoring(bool defGroup) | 615 | void Referee::confScoring(bool defGroup) |
616 | { | 616 | { |
617 | APP_CONFIG_BEGIN( cfg ); | 617 | APP_CONFIG_BEGIN( cfg ); |
618 | if (defGroup || cfg->hasKey("PointScore")) | 618 | if (defGroup || cfg->hasKey("PointScore")) |
619 | pointScore = cfg->readNumEntry("PointScore", 10); | 619 | pointScore = cfg->readNumEntry("PointScore", 10); |
620 | if (defGroup || cfg->hasKey("EnergizerScore")) | 620 | if (defGroup || cfg->hasKey("EnergizerScore")) |
621 | energizerScore = cfg->readNumEntry("EnergizerScore", 50); | 621 | energizerScore = cfg->readNumEntry("EnergizerScore", 50); |
622 | if (defGroup || cfg->hasKey("FruitScore")) | 622 | if (defGroup || cfg->hasKey("FruitScore")) |
623 | fillArray(fruitScore, cfg->readEntry("FruitScore", "100,300,500,,700,,1000,,2000,,3000,,5000"), maxLevel+1); | 623 | fillArray(fruitScore, cfg->readEntry("FruitScore", "100,300,500,,700,,1000,,2000,,3000,,5000"), maxLevel+1); |
624 | if (defGroup || cfg->hasKey("MonsterScore")) | 624 | if (defGroup || cfg->hasKey("MonsterScore")) |
625 | fillArray(monsterScore, cfg->readEntry("MonsterScore", "200,400,800,1600"), 4); | 625 | fillArray(monsterScore, cfg->readEntry("MonsterScore", "200,400,800,1600"), 4); |
626 | if (defGroup || cfg->hasKey("ExtraLifeScore")) | 626 | if (defGroup || cfg->hasKey("ExtraLifeScore")) |
627 | fillArray(extraLifeScore, cfg->readEntry("ExtraLifeScore", "10000"), -1); | 627 | fillArray(extraLifeScore, cfg->readEntry("ExtraLifeScore", "10000"), -1); |
628 | APP_CONFIG_END( cfg ); | 628 | APP_CONFIG_END( cfg ); |
629 | } | 629 | } |
630 | 630 | ||
631 | void Referee::confScheme() | 631 | void Referee::confScheme() |
632 | { | 632 | { |
633 | APP_CONFIG_BEGIN( cfg ); | 633 | APP_CONFIG_BEGIN( cfg ); |
634 | SAVE_CONFIG_GROUP( cfg, oldgroup ); | 634 | SAVE_CONFIG_GROUP( cfg, oldgroup ); |
635 | QString newgroup; | 635 | QString newgroup; |
636 | 636 | ||
637 | // if not set, read mode and scheme from the configfile | 637 | // if not set, read mode and scheme from the configfile |
638 | if (mode == -1 && scheme == -1) { | 638 | if (mode == -1 && scheme == -1) { |
639 | scheme = cfg->readNumEntry("Scheme", -1); | 639 | scheme = cfg->readNumEntry("Scheme", -1); |
640 | mode = cfg->readNumEntry("Mode", -1); | 640 | mode = cfg->readNumEntry("Mode", -1); |
641 | 641 | ||
642 | // if mode is not set in the defGroup-group, lookup the scheme group | 642 | // if mode is not set in the defGroup-group, lookup the scheme group |
643 | if (scheme != -1 || mode == -1) { | 643 | if (scheme != -1 || mode == -1) { |
644 | newgroup.sprintf("Scheme %d", scheme); | 644 | newgroup.sprintf("Scheme %d", scheme); |
645 | cfg->setGroup(newgroup); | 645 | cfg->setGroup(newgroup); |
646 | 646 | ||
647 | mode = cfg->readNumEntry("Mode", -1); | 647 | mode = cfg->readNumEntry("Mode", -1); |
648 | RESTORE_CONFIG_GROUP( cfg, oldgroup ); | 648 | RESTORE_CONFIG_GROUP( cfg, oldgroup ); |
649 | } | 649 | } |
650 | } | 650 | } |
651 | 651 | ||
652 | confLevels(); | 652 | confLevels(); |
653 | 653 | ||
654 | if (mode != -1) { | 654 | if (mode != -1) { |
655 | newgroup.sprintf("Mode %d", mode); | 655 | newgroup.sprintf("Mode %d", mode); |
656 | cfg->setGroup(newgroup); | 656 | cfg->setGroup(newgroup); |
657 | 657 | ||
658 | confLevels(FALSE); | 658 | confLevels(FALSE); |
659 | } | 659 | } |
660 | 660 | ||
661 | if (scheme != -1) { | 661 | if (scheme != -1) { |
662 | newgroup.sprintf("Scheme %d", scheme); | 662 | newgroup.sprintf("Scheme %d", scheme); |
663 | cfg->setGroup(newgroup); | 663 | cfg->setGroup(newgroup); |
664 | 664 | ||
665 | confLevels(FALSE); | 665 | confLevels(FALSE); |
666 | } | 666 | } |
667 | 667 | ||
668 | RESTORE_CONFIG_GROUP( cfg, oldgroup ); | 668 | RESTORE_CONFIG_GROUP( cfg, oldgroup ); |
669 | 669 | ||
670 | confMisc(); | 670 | confMisc(); |
671 | confTiming(); | 671 | confTiming(); |
672 | confScoring(); | 672 | confScoring(); |
673 | 673 | ||
674 | if (mode != -1) { | 674 | if (mode != -1) { |
675 | newgroup.sprintf("Mode %d", mode); | 675 | newgroup.sprintf("Mode %d", mode); |
676 | cfg->setGroup(newgroup); | 676 | cfg->setGroup(newgroup); |
677 | 677 | ||
678 | confMisc(FALSE); | 678 | confMisc(FALSE); |
679 | confTiming(FALSE); | 679 | confTiming(FALSE); |
680 | confScoring(FALSE); | 680 | confScoring(FALSE); |
681 | } | 681 | } |
682 | 682 | ||
683 | if (scheme != -1) { | 683 | if (scheme != -1) { |
684 | newgroup.sprintf("Scheme %d", scheme); | 684 | newgroup.sprintf("Scheme %d", scheme); |
685 | cfg->setGroup(newgroup); | 685 | cfg->setGroup(newgroup); |
686 | 686 | ||
687 | confMisc(FALSE); | 687 | confMisc(FALSE); |
688 | confTiming(FALSE); | 688 | confTiming(FALSE); |
689 | confScoring(FALSE); | 689 | confScoring(FALSE); |
690 | } | 690 | } |
691 | 691 | ||
692 | fillMapName(); | 692 | fillMapName(); |
693 | 693 | ||
694 | RESTORE_CONFIG_GROUP( cfg, oldgroup ); | 694 | RESTORE_CONFIG_GROUP( cfg, oldgroup ); |
695 | APP_CONFIG_END( cfg ); | 695 | APP_CONFIG_END( cfg ); |
696 | } | 696 | } |
697 | 697 | ||
698 | void Referee::setScheme(int Scheme, int Mode, Bitfont *font) | 698 | void Referee::setScheme(int Scheme, int Mode, Bitfont *font) |
699 | { | 699 | { |
700 | mode = Mode; | 700 | mode = Mode; |
701 | scheme = Scheme; | 701 | scheme = Scheme; |
702 | 702 | ||
703 | confScheme(); | 703 | confScheme(); |
704 | 704 | ||
705 | pix->setScheme(scheme, mode, font); | 705 | pix->setScheme(scheme, mode, font); |
706 | 706 | ||
707 | pacman->setMaxPixmaps(pix->maxPixmaps(PacmanPix)); | 707 | pacman->setMaxPixmaps(pix->maxPixmaps(PacmanPix)); |
708 | fruit->setMaxPixmaps(pix->maxPixmaps(FruitPix)); | 708 | fruit->setMaxPixmaps(pix->maxPixmaps(FruitPix)); |
709 | 709 | ||
710 | for (Monster *m = monsters->first(); m != 0; m = monsters->next()) | 710 | for (Monster *m = monsters->first(); m != 0; m = monsters->next()) |
711 | if (m) | 711 | if (m) |
712 | m->setMaxPixmaps(pix->maxPixmaps(MonsterPix), pix->maxPixmaps(EyesPix)); | 712 | m->setMaxPixmaps(pix->maxPixmaps(MonsterPix), pix->maxPixmaps(EyesPix)); |
713 | 713 | ||
714 | for (Energizer *e = energizers->first(); e != 0; e = energizers->next()) | 714 | for (Energizer *e = energizers->first(); e != 0; e = energizers->next()) |
715 | if (e) | 715 | if (e) |
716 | e->setMaxPixmaps(pix->maxPixmaps(EnergizerPix)); | 716 | e->setMaxPixmaps(pix->maxPixmaps(EnergizerPix)); |
717 | 717 | ||
718 | if (gameState.testBit(Introducing)) | 718 | if (gameState.testBit(Introducing)) |
719 | for (int i = 0; i < (gameState.testBit(Init) ? timerCount : 15); i++) | 719 | for (int i = 0; i < (gameState.testBit(Init) ? timerCount : 15); i++) |
720 | introPaint(i); | 720 | introPaint(i); |
721 | 721 | ||
722 | setFixedSize(pix->levelPix().size()); | 722 | setFixedSize(pix->levelPix().size()); |
723 | repaint(); | 723 | repaint(); |
724 | } | 724 | } |
725 | 725 | ||
726 | void Referee::keyPressEvent( QKeyEvent *k ) | 726 | void Referee::keyPressEvent( QKeyEvent *k ) |
727 | { | 727 | { |
728 | uint key = k->key(); | 728 | uint key = k->key(); |
729 | #ifdef QWS | 729 | |
730 | // "OK" => new game | 730 | if ( !gameState.testBit(Playing) && ( key == Key_Up || key == Key_Down || key == Key_Left || key == Key_Right ) ) |
731 | if ( key == Key_F33 || key == Key_F2 || key == Key_Enter ) | ||
732 | play(); | ||
733 | else if ( !gameState.testBit(Playing) && | ||
734 | ( key == Key_Up || | ||
735 | key == Key_Down || | ||
736 | key == Key_Right || | ||
737 | key == Key_Left )) | ||
738 | play(); | 731 | play(); |
739 | // "Space" => pause | ||
740 | //else if ( key == Key_Space || key == Key_F3 ) | ||
741 | // pause(); | ||
742 | // "Menu" => hall of fame | ||
743 | //else if ( key == Key_F11 || key == Key_F4 ) | ||
744 | // toggleHallOfFame(); | ||
745 | #endif | ||
746 | 732 | ||
747 | if (gameState.testBit(Paused) || gameState.testBit(HallOfFame) || | 733 | if (gameState.testBit(Paused) || gameState.testBit(HallOfFame) || |
748 | gameState.testBit(Demonstration) || gameState.testBit(Dying) || | 734 | gameState.testBit(Demonstration) || gameState.testBit(Dying) || |
749 | gameState.testBit(Ready) || gameState.testBit(LevelDone) || | 735 | gameState.testBit(Ready) || gameState.testBit(LevelDone) || |
750 | !gameState.testBit(Playing)) | 736 | !gameState.testBit(Playing)) |
751 | return; | 737 | return; |
752 | 738 | ||
753 | if (key == UpKey) | 739 | if (key == UpKey) |
754 | pacman->setDirection(N); | 740 | pacman->setDirection(N); |
755 | else if (key == DownKey) | 741 | else if (key == DownKey) |
756 | pacman->setDirection(S); | 742 | pacman->setDirection(S); |
757 | else if (key == RightKey) | 743 | else if (key == RightKey) |
758 | pacman->setDirection(E); | 744 | pacman->setDirection(E); |
759 | else if (key == LeftKey) | 745 | else if (key == LeftKey) |
760 | pacman->setDirection(W); | 746 | pacman->setDirection(W); |
761 | 747 | ||
762 | #ifdef CHEATS | 748 | #ifdef CHEATS |
763 | else if (key == Key_L) { printf("levelUp()\n"); levelUp(); } | 749 | else if (key == Key_L) { printf("levelUp()\n"); levelUp(); } |
764 | else if (key == Key_F) { printf("fruit->move(TRUE)\n"); fruit->move(TRUE); repaint(FALSE); } | 750 | else if (key == Key_F) { printf("fruit->move(TRUE)\n"); fruit->move(TRUE); repaint(FALSE); } |
765 | else if (key == Key_E) { printf("setLifes(++lifes)\n"); emit setLifes(++lifes); } | 751 | else if (key == Key_E) { printf("setLifes(++lifes)\n"); emit setLifes(++lifes); } |
766 | #endif | 752 | #endif |
767 | 753 | ||
768 | else { | 754 | else { |
769 | k->ignore(); | 755 | k->ignore(); |
770 | return; | 756 | return; |
771 | } | 757 | } |
772 | k->accept(); | 758 | k->accept(); |
773 | } | 759 | } |
774 | 760 | ||
775 | void Referee::score(int p) | 761 | void Referee::score(int p) |
776 | { | 762 | { |
777 | if (!gameState.testBit(Playing)) | 763 | if (!gameState.testBit(Playing)) |
778 | return; | 764 | return; |
779 | 765 | ||
780 | if ((points += p) < 0) | 766 | if ((points += p) < 0) |
781 | points = 0; | 767 | points = 0; |
782 | 768 | ||
783 | emit setPoints(points); | 769 | emit setPoints(points); |
784 | 770 | ||
785 | if (points >= nextExtraLifeScore) { | 771 | if (points >= nextExtraLifeScore) { |
786 | emit setLifes(++lifes); | 772 | emit setLifes(++lifes); |
787 | if (extraLifeScoreIndex < (int) extraLifeScore.size()-1) | 773 | if (extraLifeScoreIndex < (int) extraLifeScore.size()-1) |
788 | extraLifeScoreIndex++; | 774 | extraLifeScoreIndex++; |
789 | if (extraLifeScore[extraLifeScoreIndex] < 0) | 775 | if (extraLifeScore[extraLifeScoreIndex] < 0) |
790 | nextExtraLifeScore = extraLifeScore[extraLifeScoreIndex] * -1; | 776 | nextExtraLifeScore = extraLifeScore[extraLifeScoreIndex] * -1; |
791 | else | 777 | else |
792 | nextExtraLifeScore += extraLifeScore[extraLifeScoreIndex]; | 778 | nextExtraLifeScore += extraLifeScore[extraLifeScoreIndex]; |
793 | } | 779 | } |
794 | } | 780 | } |
795 | 781 | ||
796 | void Referee::eaten() | 782 | void Referee::eaten() |
797 | { | 783 | { |
798 | if (gameState.testBit(Ready)) | 784 | if (gameState.testBit(Ready)) |
799 | return; | 785 | return; |
800 | 786 | ||
801 | stop(); | 787 | stop(); |
802 | 788 | ||
803 | if (monstersEaten < 4) | 789 | if (monstersEaten < 4) |
804 | monstersEaten++; | 790 | monstersEaten++; |
805 | 791 | ||
806 | gameState.setBit(Scoring); | 792 | gameState.setBit(Scoring); |
807 | score(monsterScore[monstersEaten-1]); | 793 | score(monsterScore[monstersEaten-1]); |
808 | 794 | ||
809 | repaint(pix->rect(pix->rect(pacman->position(), MonsterPix), | 795 | repaint(pix->rect(pix->rect(pacman->position(), MonsterPix), |
810 | pix->rect(pacman->position(), MonsterScorePix, monstersEaten-1))); | 796 | pix->rect(pacman->position(), MonsterScorePix, monstersEaten-1))); |
811 | 797 | ||
812 | if (--timerCount > 0) | 798 | if (--timerCount > 0) |
813 | QTimer::singleShot( monsterScoreDurMS, this, SLOT(eaten())); | 799 | QTimer::singleShot( monsterScoreDurMS, this, SLOT(eaten())); |
814 | else { | 800 | else { |
815 | for (Monster *m = monsters->first(); m != 0; m = monsters->next()) | 801 | for (Monster *m = monsters->first(); m != 0; m = monsters->next()) |
816 | if (m && m->direction() == X && !gameState.testBit(Introducing)) | 802 | if (m && m->direction() == X && !gameState.testBit(Introducing)) |
817 | m->setDirection(N); | 803 | m->setDirection(N); |
818 | if (monstersEaten != 4 || !gameState.testBit(Introducing)) | 804 | if (monstersEaten != 4 || !gameState.testBit(Introducing)) |
819 | QTimer::singleShot( monsterScoreDurMS, this, SLOT(start())); | 805 | QTimer::singleShot( monsterScoreDurMS, this, SLOT(start())); |
820 | } | 806 | } |
821 | } | 807 | } |
822 | 808 | ||
823 | void Referee::toggleHallOfFame() | 809 | void Referee::toggleHallOfFame() |
824 | { | 810 | { |
825 | gameState.toggleBit(HallOfFame); | 811 | gameState.toggleBit(HallOfFame); |
826 | } | 812 | } |
827 | 813 | ||
828 | void Referee::hallOfFame() | 814 | void Referee::hallOfFame() |
829 | { | 815 | { |
830 | if (gameState.testBit(HallOfFame)) // If the HallOfFame is switched on manually, toggle the | 816 | if (gameState.testBit(HallOfFame)) // If the HallOfFame is switched on manually, toggle the |
831 | toggleHallOfFame(); // bit twice. | 817 | toggleHallOfFame(); // bit twice. |
832 | 818 | ||
833 | emit setLevel(0); // Clear status display for hall of fame | 819 | emit setLevel(0); // Clear status display for hall of fame |
834 | emit setScore(level, 0); | 820 | emit setScore(level, 0); |
835 | emit forcedHallOfFame(TRUE); | 821 | emit forcedHallOfFame(TRUE); |
836 | } | 822 | } |
837 | 823 | ||
838 | void Referee::pause() | 824 | void Referee::pause() |
839 | { | 825 | { |
840 | static int pausedTimer = 0; | 826 | static int pausedTimer = 0; |
841 | 827 | ||
842 | if (!gameState.testBit(Paused)) { | 828 | if (!gameState.testBit(Paused)) { |
843 | pausedTimer = gameTimer; | 829 | pausedTimer = gameTimer; |
844 | stop(); | 830 | stop(); |
845 | stopEnergizer(); | 831 | stopEnergizer(); |
846 | gameState.setBit(Paused); | 832 | gameState.setBit(Paused); |
847 | repaint(pix->rect((BoardWidth*BoardHeight)/2-BoardWidth, tr("PAUSED")), FALSE); | 833 | repaint(pix->rect((BoardWidth*BoardHeight)/2-BoardWidth, tr("PAUSED")), FALSE); |
848 | } else { | 834 | } else { |
849 | gameState.clearBit(Paused); | 835 | gameState.clearBit(Paused); |
850 | repaint(pix->rect((BoardWidth*BoardHeight)/2-BoardWidth, tr("PAUSED")), FALSE); | 836 | repaint(pix->rect((BoardWidth*BoardHeight)/2-BoardWidth, tr("PAUSED")), FALSE); |
851 | if (pausedTimer) { | 837 | if (pausedTimer) { |
852 | pausedTimer = 0; | 838 | pausedTimer = 0; |
853 | start(); | 839 | start(); |
854 | } | 840 | } |
855 | } | 841 | } |
856 | emit togglePaused(); | 842 | emit togglePaused(); |
857 | } | 843 | } |
858 | 844 | ||
859 | void Referee::intro() | 845 | void Referee::intro() |
860 | { | 846 | { |
861 | stop(); | 847 | stop(); |
862 | stopEnergizer(); | 848 | stopEnergizer(); |
863 | bool paused = gameState.testBit(Paused); | 849 | bool paused = gameState.testBit(Paused); |
864 | 850 | ||
865 | gameState.fill(FALSE); | 851 | gameState.fill(FALSE); |
866 | gameState.setBit(Introducing); | 852 | gameState.setBit(Introducing); |
867 | gameState.setBit(Init); | 853 | gameState.setBit(Init); |
868 | 854 | ||
869 | if (paused) | 855 | if (paused) |
870 | gameState.setBit(Paused); | 856 | gameState.setBit(Paused); |
871 | 857 | ||
872 | level = 0; | 858 | level = 0; |
873 | emit setLevel(level); | 859 | emit setLevel(level); |
874 | 860 | ||
875 | board->init(Intro); | 861 | board->init(Intro); |
876 | pix->setLevel(level); | 862 | pix->setLevel(level); |
877 | 863 | ||
878 | initPacman(); | 864 | initPacman(); |
879 | initFruit(); | 865 | initFruit(); |
880 | initMonsters(); | 866 | initMonsters(); |
881 | initEnergizers(); | 867 | initEnergizers(); |
882 | 868 | ||
883 | repaint(); | 869 | repaint(); |
884 | 870 | ||
885 | monstersEaten = 0; | 871 | monstersEaten = 0; |
886 | timerCount = 0; | 872 | timerCount = 0; |
887 | introPlay(); | 873 | introPlay(); |
888 | } | 874 | } |
889 | 875 | ||
890 | void Referee::introMonster(int id) | 876 | void Referee::introMonster(int id) |
891 | { | 877 | { |
892 | Monster *m = new Monster(board, id); | 878 | Monster *m = new Monster(board, id); |
893 | 879 | ||
894 | m->setPosition((10+id*6)*BoardWidth+10); | 880 | m->setPosition((10+id*6)*BoardWidth+10); |
895 | m->setDirection(E); | 881 | m->setDirection(E); |
896 | m->setDangerous(dangerousTicks[level], monsterIQ[level]); | 882 | m->setDangerous(dangerousTicks[level], monsterIQ[level]); |
897 | m->setMaxPixmaps(pix->maxPixmaps(MonsterPix), pix->maxPixmaps(EyesPix)); | 883 | m->setMaxPixmaps(pix->maxPixmaps(MonsterPix), pix->maxPixmaps(EyesPix)); |
898 | 884 | ||
899 | if (m->body() != -1) | 885 | if (m->body() != -1) |
900 | pix->draw(m->position(), RoomPix, MonsterPix, m->body()); | 886 | pix->draw(m->position(), RoomPix, MonsterPix, m->body()); |
901 | if (m->eyes() != -1) | 887 | if (m->eyes() != -1) |
902 | pix->draw(m->position(), RoomPix, EyesPix, m->eyes()); | 888 | pix->draw(m->position(), RoomPix, EyesPix, m->eyes()); |
903 | 889 | ||
904 | repaint(pix->rect(m->position(), MonsterPix), FALSE); | 890 | repaint(pix->rect(m->position(), MonsterPix), FALSE); |
905 | m->setPosition(OUT); | 891 | m->setPosition(OUT); |
906 | } | 892 | } |
907 | 893 | ||
908 | void Referee::introPaint(int t) | 894 | void Referee::introPaint(int t) |
909 | { | 895 | { |
910 | QString pts; | 896 | QString pts; |
911 | 897 | ||
912 | switch (t) { | 898 | switch (t) { |
913 | case 0 : repaint(pix->draw(16, 6, RoomPix, tr("CHARACTER"), WHITE, QColor(), AlignLeft), FALSE); | 899 | case 0 : repaint(pix->draw(16, 6, RoomPix, tr("CHARACTER"), WHITE, QColor(), AlignLeft), FALSE); |
914 | repaint(pix->draw(36, 6, RoomPix, tr("/"), WHITE, QColor(), AlignLeft), FALSE); | 900 | repaint(pix->draw(36, 6, RoomPix, tr("/"), WHITE, QColor(), AlignLeft), FALSE); |
915 | repaint(pix->draw(40, 6, RoomPix, tr("NICKNAME"), WHITE, QColor(), AlignLeft), FALSE); | 901 | repaint(pix->draw(40, 6, RoomPix, tr("NICKNAME"), WHITE, QColor(), AlignLeft), FALSE); |
916 | break; | 902 | break; |
917 | case 1 : introMonster(0); | 903 | case 1 : introMonster(0); |
918 | break; | 904 | break; |
919 | case 2 : repaint(pix->draw(16, 10, RoomPix, tr("-SHADOW"), RED, QColor(), AlignLeft), FALSE); | 905 | case 2 : repaint(pix->draw(16, 10, RoomPix, tr("-SHADOW"), RED, QColor(), AlignLeft), FALSE); |
920 | break; | 906 | break; |
921 | case 3 : repaint(pix->draw(38, 10, RoomPix, tr("\"BLINKY\""), RED, QColor(), AlignLeft), FALSE); | 907 | case 3 : repaint(pix->draw(38, 10, RoomPix, tr("\"BLINKY\""), RED, QColor(), AlignLeft), FALSE); |
922 | break; | 908 | break; |
923 | case 4 : introMonster(1); | 909 | case 4 : introMonster(1); |
924 | break; | 910 | break; |
925 | case 5 : repaint(pix->draw(16, 16, RoomPix, tr("-SPEEDY"), PINK, QColor(), AlignLeft), FALSE); | 911 | case 5 : repaint(pix->draw(16, 16, RoomPix, tr("-SPEEDY"), PINK, QColor(), AlignLeft), FALSE); |
926 | break; | 912 | break; |
927 | case 6 : repaint(pix->draw(38, 16, RoomPix, tr("\"PINKY\""), PINK, QColor(), AlignLeft), FALSE); | 913 | case 6 : repaint(pix->draw(38, 16, RoomPix, tr("\"PINKY\""), PINK, QColor(), AlignLeft), FALSE); |
928 | break; | 914 | break; |
929 | case 7 : introMonster(2); | 915 | case 7 : introMonster(2); |
930 | break; | 916 | break; |
931 | case 8 : repaint(pix->draw(16, 22, RoomPix, tr("-BASHFUL"), CYAN, QColor(), AlignLeft), FALSE); | 917 | case 8 : repaint(pix->draw(16, 22, RoomPix, tr("-BASHFUL"), CYAN, QColor(), AlignLeft), FALSE); |
932 | break; | 918 | break; |
933 | case 9 : repaint(pix->draw(38, 22, RoomPix, tr("\"INKY\""), CYAN, QColor(), AlignLeft), FALSE); | 919 | case 9 : repaint(pix->draw(38, 22, RoomPix, tr("\"INKY\""), CYAN, QColor(), AlignLeft), FALSE); |
934 | break; | 920 | break; |
935 | case 10 : introMonster(3); | 921 | case 10 : introMonster(3); |
936 | break; | 922 | break; |
937 | case 11 : repaint(pix->draw(16, 28, RoomPix, tr("-POKEY"), ORANGE, QColor(), AlignLeft), FALSE); | 923 | case 11 : repaint(pix->draw(16, 28, RoomPix, tr("-POKEY"), ORANGE, QColor(), AlignLeft), FALSE); |
938 | break; | 924 | break; |
939 | case 12 : repaint(pix->draw(38, 28, RoomPix, tr("\"CLYDE\""), ORANGE, QColor(), AlignLeft), FALSE); | 925 | case 12 : repaint(pix->draw(38, 28, RoomPix, tr("\"CLYDE\""), ORANGE, QColor(), AlignLeft), FALSE); |
940 | break; | 926 | break; |
941 | case 13 : pts.sprintf("%d", pointScore); | 927 | case 13 : pts.sprintf("%d", pointScore); |
942 | repaint(pix->draw(28, 44, RoomPix, pts.data(), WHITE, QColor(), AlignRight), FALSE); | 928 | repaint(pix->draw(28, 44, RoomPix, pts.data(), WHITE, QColor(), AlignRight), FALSE); |
943 | repaint(pix->draw(31, 44, RoomPix, "\x1C\x1D\x1E", WHITE, QColor(), AlignLeft), FALSE); | 929 | repaint(pix->draw(31, 44, RoomPix, "\x1C\x1D\x1E", WHITE, QColor(), AlignLeft), FALSE); |
944 | pts.sprintf("%d", energizerScore); | 930 | pts.sprintf("%d", energizerScore); |
945 | repaint(pix->draw(28, 48, RoomPix, pts.data(), WHITE, QColor(), AlignRight), FALSE); | 931 | repaint(pix->draw(28, 48, RoomPix, pts.data(), WHITE, QColor(), AlignRight), FALSE); |
946 | repaint(pix->draw(31, 48, RoomPix, "\x1C\x1D\x1E", WHITE, QColor(), AlignLeft), FALSE); | 932 | repaint(pix->draw(31, 48, RoomPix, "\x1C\x1D\x1E", WHITE, QColor(), AlignLeft), FALSE); |
947 | break; | 933 | break; |
948 | case 14 : // "@ 1980 MIDWAY MFG.CO." | 934 | case 14 : // "@ 1980 MIDWAY MFG.CO." |
949 | #if defined( KDE2_PORT ) | 935 | #if defined( KDE2_PORT ) |
950 | repaint(pix->draw(30, 58, RoomPix, "© 1998-2002 J.THÖNNISSEN", PINK), FALSE); | 936 | repaint(pix->draw(30, 58, RoomPix, "© 1998-2002 J.THÖNNISSEN", PINK), FALSE); |
951 | #elif defined( QPE_PORT ) | 937 | #elif defined( QPE_PORT ) |
952 | repaint(pix->draw(30, 55, RoomPix, "© 1998-2002 J.THÖNNISSEN", PINK), FALSE); | 938 | repaint(pix->draw(30, 55, RoomPix, "© 1998-2002 J.THÖNNISSEN", PINK), FALSE); |
953 | repaint(pix->draw(29, 58, RoomPix, tr("QTOPIA PORT: CATALIN CLIMOV"), GREEN), FALSE); | 939 | repaint(pix->draw(29, 58, RoomPix, tr("QTOPIA PORT: CATALIN CLIMOV"), GREEN), FALSE); |
954 | repaint(pix->draw(29, 61, RoomPix, tr("PRESS CURSOR TO START"), GREEN), FALSE); | 940 | repaint(pix->draw(29, 61, RoomPix, tr("PRESS CURSOR TO START"), GREEN), FALSE); |
955 | #endif | 941 | #endif |
956 | break; | 942 | break; |
957 | } | 943 | } |
958 | } | 944 | } |
959 | 945 | ||
960 | void Referee::introPlay() | 946 | void Referee::introPlay() |
961 | { | 947 | { |
962 | if (!gameState.testBit(Introducing) || gameState.testBit(Ready)) | 948 | if (!gameState.testBit(Introducing) || gameState.testBit(Ready)) |
963 | return; | 949 | return; |
964 | if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) { | 950 | if (gameState.testBit(Paused) || gameState.testBit(HallOfFame)) { |
965 | QTimer::singleShot(afterPauseMS, this, SLOT(introPlay())); | 951 | QTimer::singleShot(afterPauseMS, this, SLOT(introPlay())); |
966 | return; | 952 | return; |
967 | } | 953 | } |
968 | 954 | ||
969 | if (!gameState.testBit(Init)) { | 955 | if (!gameState.testBit(Init)) { |
970 | if (monstersEaten == 4) { | 956 | if (monstersEaten == 4) { |
971 | stop(); | 957 | stop(); |
972 | QTimer::singleShot(introPostAnimationMS, this, SLOT(demo())); | 958 | QTimer::singleShot(introPostAnimationMS, this, SLOT(demo())); |
973 | } | 959 | } |
974 | if (pacman->direction() == W) { | 960 | if (pacman->direction() == W) { |
975 | int id = -1; | 961 | int id = -1; |
976 | if (pacman->position() == 37*BoardWidth-6) | 962 | if (pacman->position() == 37*BoardWidth-6) |
977 | id = 0; | 963 | id = 0; |
978 | else | 964 | else |
979 | if (board->isMonster(37*BoardWidth-6)) | 965 | if (board->isMonster(37*BoardWidth-6)) |
980 | for (Monster *m = monsters->first(); m != 0; m = monsters->next()) | 966 | for (Monster *m = monsters->first(); m != 0; m = monsters->next()) |
981 | if (m && m->position() == 37*BoardWidth-6) { | 967 | if (m && m->position() == 37*BoardWidth-6) { |
982 | id = m->id(); | 968 | id = m->id(); |
983 | id++; | 969 | id++; |
984 | break; | 970 | break; |
985 | } | 971 | } |
986 | 972 | ||
987 | if (id >= 0 && id <= 4) | 973 | if (id >= 0 && id <= 4) |
988 | for (Monster *m = monsters->first(); m != 0; m = monsters->next()) | 974 | for (Monster *m = monsters->first(); m != 0; m = monsters->next()) |
989 | if (m && m->id() == id && m->position() == OUT) { | 975 | if (m && m->id() == id && m->position() == OUT) { |
990 | m->setPosition(37*BoardWidth-1); | 976 | m->setPosition(37*BoardWidth-1); |
991 | m->setDirection(W); | 977 | m->setDirection(W); |
992 | m->setDangerous(dangerousTicks[level], monsterIQ[level]); | 978 | m->setDangerous(dangerousTicks[level], monsterIQ[level]); |
993 | board->set(37*BoardWidth-1, monsterhome, id); | 979 | board->set(37*BoardWidth-1, monsterhome, id); |
994 | repaint(pix->rect(m->position(), MonsterPix)); | 980 | repaint(pix->rect(m->position(), MonsterPix)); |
995 | break; | 981 | break; |
996 | } | 982 | } |
997 | } | 983 | } |
998 | return; | 984 | return; |
999 | } | 985 | } |
1000 | 986 | ||
1001 | if (timerCount < 15) | 987 | if (timerCount < 15) |