Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions lib/Games/PangZero.pm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ use vars qw (

use vars qw (
$DataDir $ScreenHeight $ScreenWidth $PhysicalScreenWidth $PhysicalScreenHeight $ScreenMargin
$SoundEnabled $MusicEnabled $FullScreen $ShowWebsite
$SoundEnabled $MusicEnabled $FullScreen
$DeathBallsEnabled $EarthquakeBallsEnabled $WaterBallsEnabled $SeekerBallsEnabled $Slippery
@DifficultyLevels $DifficultyLevelIndex $DifficultyLevel
@WeaponDurations $WeaponDuration $WeaponDurationIndex
Expand Down Expand Up @@ -165,7 +165,6 @@ sub Pause {

SDL::Video::blit_surface($pausedSurface, SDL::Rect->new(0, 0, $pausedSurface->w, $pausedSurface->h),
$App, SDL::Rect->new(($PhysicalScreenWidth - $pausedSurface->w) / 2, $PhysicalScreenHeight / 2 - 100, 0, 0));
$App->sync();
$Keys = ();
$Events = ();
while (1) { # Paused, wait for keypress
Expand Down Expand Up @@ -328,7 +327,7 @@ sub Initialize {
SDL::Video::wm_set_caption("Pang Zero $VERSION", "Pang Zero $VERSION");
SDL::Mouse::show_cursor(0);

$Background = SDL::Surface->new( Games::PangZero::Config::IsMicrosoftWindows() ? SDL_SWSURFACE() : SDL_HWSURFACE(), $App->w, $App->h, 16);
$Background = SDL::Surface->new( Games::PangZero::Config::IsMicrosoftWindows() ? SDL_SWSURFACE() : SDL_HWSURFACE(), $App->w, $App->h, 32);
$Background = SDL::Video::display_format($Background);
$ScoreFont = SDLx::SFont->new("$DataDir/brandybun3.png");
$MenuFont = SDLx::SFont->new("$DataDir/font2.png");
Expand Down Expand Up @@ -377,30 +376,4 @@ sub ShowErrorMessage {
print "Pang Zero $VERSION died:\n$message\n";
}

sub ShowWebPage {
my ($url) = @_;

return if $ENV{PANGZERO_TEST};

if (Games::PangZero::Config::IsMicrosoftWindows()) {
my $ws = "$DataDir/website.html";
$ws =~ s/\//\\\\/g;
exec 'cmd', '/c', $ws;
exit;
} elsif ($ENV{'DISPLAY'}) {
my @tryCommands = (
"which gnome-open > /dev/null 2>&1 && (gnome-open $url&)",
"which mozilla-firefox > /dev/null 2>&1 && (mozilla-firefox $url&)",
"which firefox > /dev/null 2>&1 && (firefox $url&)",
"which mozilla > /dev/null 2>&1 && (mozilla $url&)",
"which konqueror > /dev/null 2>&1 && (konqueror $url&)",
);
foreach (@tryCommands) {
return if system($_) == 0;
}
} else {
print "Visit $url for more info about Pang Zero $Games::PangZero::VERSION\n";
}
}

1;
7 changes: 2 additions & 5 deletions lib/Games/PangZero/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ sub GetConfigVars {
Games::PangZero::MusicEnabled
Games::PangZero::SoundEnabled
Games::PangZero::FullScreen
Games::PangZero::ShowWebsite
Games::PangZero::DeathBallsEnabled
Games::PangZero::EarthquakeBallsEnabled
Games::PangZero::WaterBallsEnabled
Expand Down Expand Up @@ -104,12 +103,10 @@ sub LoadConfig {
foreach $varname (GetConfigVars()) {
my $pattern = $varname;
$pattern =~ s/\[/\\[/g;
$pattern =~ s/\{/\\{/g;
if ($text =~ /$pattern = (.+?)$/m) {
$val = $1;
if ($varname eq Games::PangZero::ShowWebsite) {
eval( "\$$varname = '$val'" );
}
elsif($val =~ /^SDLK_\w+$/) {
if($val =~ /^SDLK_\w+$/) {
eval( "\$$varname = SDL::Events::$val()" );
}
elsif($val =~ /^[\d\.]+$/) {
Expand Down
1 change: 0 additions & 1 deletion lib/Games/PangZero/GameBase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ sub new {
}

sub Exit {
Games::PangZero::ShowWebPage("http://apocalypse.rulez.org/pangzero/Thanks_For_Playing_Pang_Zero_$Games::PangZero::VERSION" ) if $Games::PangZero::ShowWebsite ne $Games::PangZero::VERSION;
exit;
}

Expand Down
1 change: 0 additions & 1 deletion lib/Games/PangZero/Globals.pm
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,5 @@ $Games::PangZero::SeekerBallsEnabled = 1;
$Games::PangZero::FullScreen = 1;
$Games::PangZero::UnicodeMode = 0;
$Games::PangZero::Slippery = 0;
$Games::PangZero::ShowWebsite = 0;

1;
3 changes: 3 additions & 0 deletions lib/Games/PangZero/Graphics.pm
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ sub FindVideoMode {
return (800, 600);
}

# The below code does not work for some reason ($modes is empty), so just hardcode this
return (848, 480);

# Find a suitable widescreen mode
# One native resolution: 1680 x 1050 => 1.6 : 1
# Which could translate to: 840 x 525 => 1.6 : 1
Expand Down
4 changes: 0 additions & 4 deletions lib/Games/PangZero/Menu.pm
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ sub UpdateOptionsMenu {
$self->{menuItems}->[4]->SetParameter( $Games::PangZero::MusicEnabled ? 'on' : 'off');
$self->{menuItems}->[5]->SetText('< ' . ('Windowed', 'Fullscreen', 'Widescreen')[$Games::PangZero::FullScreen]
. ($self->{restart} ? ' (requires restart)' : '') . ' >');
$self->{menuItems}->[6]->SetParameter( $Games::PangZero::ShowWebsite eq $Games::PangZero::VERSION ? 'no' : 'yes' );
}

sub RunOptionsMenu {
Expand All @@ -409,7 +408,6 @@ sub RunOptionsMenu {
Games::PangZero::MenuItem->new( 100, $y += $yinc, "Sound: ", "Press Enter to turn sound effects on/off." ),
Games::PangZero::MenuItem->new( 100, $y += $yinc, "Music: ", "Press Enter to turn the background music on/off." ),
Games::PangZero::MenuItem->new( 68, $y += $yinc, "Fullscreen", "Press Left/Right to set the screen mode.", "If you have a wide screen (e.g. 16:9), use the Widescreen option.", "This doesn't take effect until you quit and restart the game." ),
Games::PangZero::MenuItem->new( 100, $y += $yinc, "Show website at exit: ", "Should Pang Zero take you to our web site at exit?", "True enlightenment awaits you online!" ),
);
$self->UpdateOptionsMenu();
push @Games::PangZero::GameObjects, (@{$self->{menuItems}});
Expand Down Expand Up @@ -438,8 +436,6 @@ sub RunOptionsMenu {
$Games::PangZero::SoundEnabled = 1 - $Games::PangZero::SoundEnabled; $self->UpdateOptionsMenu();
} elsif ($self->{currentItemIndex} == 4) {
Games::PangZero::Music::SetMusicEnabled(1 - $Games::PangZero::MusicEnabled); $self->UpdateOptionsMenu();
} elsif ($self->{currentItemIndex} == 6) {
$Games::PangZero::ShowWebsite = $Games::PangZero::ShowWebsite eq $Games::PangZero::VERSION ? 0 : $Games::PangZero::VERSION; $self->UpdateOptionsMenu();
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions pangzero.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Pang Zero
GenericName=Super Pang Clone
Comment=A clone and enhancement of Super Pang
Exec=pangzero
Icon=pangzero
Terminal=false
Type=Application
Categories=Game;ArcadeGame;