Support for animated sayer sprites
This commit is contained in:
parent
7a31c1fc55
commit
61fb64c10a
|
|
@ -19,17 +19,19 @@ use vars qw/@ISA @EXPORT @EXPORT_OK %VisibleSprites/;
|
|||
# FIXME - This should be exported already?
|
||||
*GetOption = \&PerlRPG::Game::GetOption;
|
||||
|
||||
# FIXME - This should be a setable option
|
||||
my $speech_border = 5;
|
||||
|
||||
sub DrawSpeech {
|
||||
my($sayer, $text)=@_;
|
||||
my $app = GetOption('App');
|
||||
|
||||
my $sprite = GetAsset($sayer->{'Sprite'});
|
||||
my $sprite_x = $app->width() - $sprite->w();
|
||||
my $sprite_y = $app->height() - $sprite->h();
|
||||
my $sprite_h = $sprite->h();
|
||||
my $sprite_x = $app->width() - $sprite->clip()->w();
|
||||
my $sprite_y = $app->height() - $sprite->clip()->h();
|
||||
my $sprite_h = $sprite->clip()->h();
|
||||
$sprite = undef; # ShowSprite may unload this, we don't want to keep a handle to it
|
||||
ShowSprite('_SayerSprite', $sayer->{'Sprite'}, $sprite_x, $sprite_y, 254);
|
||||
ShowSprite('_SayerSprite', $sayer->{'Sprite'}, $sprite_x, $sprite_y, 254, @{ $sayer->{'SpriteOpts'} });
|
||||
|
||||
my $text_obj = SDLx::Text->new();
|
||||
$text_obj->color( $sayer->{'TextColor'} );
|
||||
|
|
|
|||
|
|
@ -170,16 +170,17 @@ sub RunScriptLine {
|
|||
}
|
||||
|
||||
sub AddSayer {
|
||||
my($name, $displayname, $sprite, @textcolor)=@_;
|
||||
if(@textcolor < 4) {
|
||||
$textcolor[3] = 255;
|
||||
}
|
||||
my($name, $displayname, $sprite, $r, $g, $b, $a, @opts)=@_;
|
||||
|
||||
my @textcolor=($r, $g, $b, $a);
|
||||
$textcolor[3] = 255 unless(defined $a);
|
||||
|
||||
$sayers{$name} = {
|
||||
'Name' => $name,
|
||||
'DisplayName' => StringSubst($displayname),
|
||||
'Sprite' => $sprite,
|
||||
'TextColor' => \@textcolor
|
||||
'TextColor' => \@textcolor,
|
||||
'SpriteOpts' => \@opts,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ __init__:
|
|||
Show aka2 spritesheet.png 100 0 2 Reverse
|
||||
Show aka3 spritesheet.png 200 0 3 max_loops=10
|
||||
|
||||
AddSayer h "Hermione" aka01.png 200 200 200 255
|
||||
AddSayer h "Hermione" aka01.png 200 200 200 255 flip
|
||||
AddSayer h2 "Topless\ Hermione" aka05.png 255 0 0 255
|
||||
AddSayer h3 "Stripping\ Hermione" spritesheet.png 255 0 0 255
|
||||
AddSayer h3 "Stripping\ Hermione" spritesheet.png 255 0 0 255 Reverse
|
||||
|
||||
Jump donothing
|
||||
|
||||
|
|
@ -22,5 +22,4 @@ donothing:
|
|||
h2 "TestVar [TestVar]"
|
||||
TestVar = uc("[TestVar]")
|
||||
h3 "TestVar2 [TestVar]"
|
||||
ExitGame
|
||||
Jump donothing
|
||||
|
|
|
|||
Loading…
Reference in New Issue