… | |
… | |
500 | my $bgmusic;#TODO#hack#d# |
500 | my $bgmusic;#TODO#hack#d# |
501 | |
501 | |
502 | sub audio_init { |
502 | sub audio_init { |
503 | if ($CFG->{audio_enable}) { |
503 | if ($CFG->{audio_enable}) { |
504 | if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { |
504 | if (open my $fh, "<:utf8", CFClient::find_rcfile "sounds/config") { |
|
|
505 | |
505 | $SDL_MIXER = new SDL::Mixer; |
506 | $SDL_MIXER = new SDL::Mixer |
|
|
507 | -rate => 22050, |
|
|
508 | -channels => 1, # mono |
|
|
509 | -size => 512; |
|
|
510 | |
506 | $SDL_MIXER->allocate_channels (8); |
511 | $SDL_MIXER->allocate_channels (8); |
507 | |
512 | |
508 | # TODO: hack, do play loop and mood music |
513 | # TODO: hack, do play loop and mood music |
509 | if ($CFG->{bgm_enable}) { |
514 | if ($CFG->{bgm_enable}) { |
510 | $bgmusic = new SDL::Music CFClient::find_rcfile "music/game3.ogg"; |
515 | $bgmusic = new SDL::Music CFClient::find_rcfile "music/game3.ogg"; |
… | |
… | |
796 | |
801 | |
797 | my $chunk = $AUDIO_CHUNKS{$SOUNDS[$soundnum]} |
802 | my $chunk = $AUDIO_CHUNKS{$SOUNDS[$soundnum]} |
798 | or return; |
803 | or return; |
799 | |
804 | |
800 | $SDL_MIXER->play_channel (-1, $chunk); |
805 | $SDL_MIXER->play_channel (-1, $chunk); |
801 | warn "sound $x,$y,$soundnum,$type\n";#d# |
806 | # warn "sound $x,$y,$soundnum,$type\n";#d# |
802 | } |
807 | } |
803 | |
808 | |
804 | sub conn::query { |
809 | sub conn::query { |
805 | my ($self, $flags, $prompt) = @_; |
810 | my ($self, $flags, $prompt) = @_; |
806 | |
811 | |
807 | #TODO |
812 | #TODO, display dialog with relevant information |
808 | warn "<<<<QUERY:$flags:$prompt>>>\n";#d# |
813 | warn "<<<<QUERY:$flags:$prompt>>>\n";#d# |
809 | } |
814 | } |
810 | |
815 | |
811 | sub conn::drawinfo { |
816 | sub conn::drawinfo { |
812 | my ($self, $color, $text) = @_; |
817 | my ($self, $color, $text) = @_; |
… | |
… | |
826 | [0.99, 0.77, 0.26], |
831 | [0.99, 0.77, 0.26], |
827 | [0.74, 0.65, 0.41], |
832 | [0.74, 0.65, 0.41], |
828 | ); |
833 | ); |
829 | |
834 | |
830 | $LOGVIEW->add_paragraph ($color[$color], $text); |
835 | $LOGVIEW->add_paragraph ($color[$color], $text); |
|
|
836 | } |
|
|
837 | |
|
|
838 | sub conn::spell_add { |
|
|
839 | my ($self, $spell) = @_; |
|
|
840 | |
|
|
841 | $MAPWIDGET->add_command ("invoke $spell->{name}", $spell->{message}, sub { |
|
|
842 | }); |
|
|
843 | $MAPWIDGET->add_command ("cast $spell->{name}", $spell->{message}, sub { |
|
|
844 | }); |
|
|
845 | } |
|
|
846 | |
|
|
847 | sub conn::spell_delete { |
|
|
848 | my ($self, $spell) = @_; |
|
|
849 | } |
|
|
850 | |
|
|
851 | sub conn::addme_success { |
|
|
852 | my ($self) = @_; |
|
|
853 | |
|
|
854 | for my $skill (values %{$self->{skill_info}}) { |
|
|
855 | $MAPWIDGET->add_command ("ready_skill $skill", "", sub { |
|
|
856 | }); |
|
|
857 | $MAPWIDGET->add_command ("use_skill $skill", "", sub { |
|
|
858 | }); |
|
|
859 | } |
831 | } |
860 | } |
832 | |
861 | |
833 | %SDL_CB = ( |
862 | %SDL_CB = ( |
834 | SDL_QUIT() => sub { |
863 | SDL_QUIT() => sub { |
835 | Event::unloop -1; |
864 | Event::unloop -1; |