Permalink
Browse files

Merge pull request #8 from GunioRobot/clean

Hi! I cleaned up your code for you!
  • Loading branch information...
2 parents 4a2e7db + 360136c commit f390b08f5966c97549df0ca4d4d9de7d2f06992f @Blaizer committed Oct 28, 2011
@@ -6,7 +6,7 @@ package Games::Neverhood::GG;
sub new {
my ($class) = @_;
my $self = bless {}, ref $class || $class;
-
+
# 2, 1, 4, 5, 3, 11, 8, 6, 7, 9, 10, 17, 16, 18, 19, 20, 15, 14, 13, 12
# $nursery_1_window_open -- until jump down in nursery_2
# $flytrap_place -- only while in mail room, also remember if it has grabbed ring
@@ -159,7 +159,7 @@ void NHC_IMG_mirror(SDL_Surface* surface) {
pixels[ypos + xpos] = pixels_copy[ypos + surface->w - xpos - 1];
}
}
-
+
free(pixels_copy);
}
@@ -85,7 +85,7 @@ package Games::Neverhood::Scene::Nursery::One::hammer_cover;
alpha => 0,
};
sub palette { $;->sprites->{background} }
-
+
package Games::Neverhood::Scene::Nursery::One::hammer;
use constant {
file => 89,
@@ -170,7 +170,7 @@ package Games::Neverhood::Scene::Nursery::One::window_cover;
$background->show_at([317, 338], [317, 338, 66, 2]);
$background->show_at([381, 211], [381, 211, 2, 127]);
}
-
+
package Games::Neverhood::Scene::Nursery::One::window;
use constant {
file => 261,
@@ -202,7 +202,7 @@ package Games::Neverhood::Scene::Nursery::One::lever_cover;
alpha => 0,
};
sub palette { $;->sprites->{background} }
-
+
package Games::Neverhood::Scene::Nursery::One::lever;
use constant {
file => 37,
@@ -211,7 +211,7 @@ sub this_surface {
if($mirror) {
Games::Neverhood::Image::mirror($surface);
}
-
+
if(defined $palette) {
my @colors;
if(eval { $palette->isa('Games::Neverhood::Sprite') }) {
@@ -11,22 +11,22 @@ use constant dont_store => [];
sub STORABLE_freeze {
my ($self, $cloning) = @_;
return if Storable::is_storing() or $cloning;
-
+
# remove the keys in dont_store from the object, keeping them safe in a separate hash
my %safe;
for(@{$self->dont_store}) {
$safe{$_} = delete $self->{$_} if exists $self->{$_};
}
-
+
# continue if we deleted anything
return unless %safe;
-
+
# perform freeze on the modified object
my $freeze = Storable::freeze($self);
-
+
# restore the object back to its original state
while(my ($k, $v) = each %safe) { $self->{$k} = $v }
-
+
return $freeze;
}
@@ -20,17 +20,17 @@ sub new {
$class = ref $class || $class;
my $hash = bless {@_}, $class;
my $self;
-
+
my ($dir, $file) = ($hash->dir, $hash->file);
-
+
defined $file or Carp::confess("Video '", $hash->name, "' must specify a file");
defined $dir or Carp::confess("Video '", $hash->name, "' must specify a dir");
-
+
my $filename = File::Spec->catfile($ShareDir, $dir, $file . '.0A');
-
+
$self = bless $class->xs_new($filename, {%$hash});
$self->xs_frame($self->start_frame) if $self->start_frame;
-
+
return $self;
}
@@ -292,7 +292,7 @@ NHC_VID* NHC_VID_new(const char* filename) {
printf("%d\n", vid->header->mclr_size);
printf("%d\n", vid->header->full_size);
printf("%d\n", vid->header->type_size);
-
+
// vid->mmap_tree = NHC_VID_Tree_New(vid->bs);
// vid->mclr_tree = NHC_VID_Tree_New(vid->bs);
// vid->full_tree = NHC_VID_Tree_New(vid->bs);
@@ -76,21 +76,21 @@ An anonymous hash is accepted, which will be turned into a sprite for you like t
=head2 set
$Nursery1->set
-
+
Sets the new current scene, calls C<load_sprites>, sets the new framerate.
Returns the scene.
=head2 load_sprites
$Nursery1->load_sprites
-
+
Loads all images for the sprites of the scene, if they haven't already been loaded.
Returns the scene.
=head2 unload_sprites
$Nursery1->unload_sprites
-
+
Forgets all the image data for the sprites of the scene, if they haven't already been unloaded.
Returns the scene.
View
12 typemap
@@ -17,7 +17,7 @@ Sint16 T_IV
Sint16 * T_PTR
Sint32 T_IV
Sint32 * T_PTR
-SDL_Event * O_OBJECT
+SDL_Event * O_OBJECT
SDL_ActiveEvent * O_OBJECT
SDL_KeyboardEvent * O_OBJECT
SDL_TextInputEvent * O_OBJECT
@@ -46,7 +46,7 @@ SDL_VideoInfo * O_OBJECT
SDL_version * O_OBJECT
const SDL_version * O_OBJECT
SDL_SysWMInfo * O_OBJECT
-SDL_Cursor * O_OBJECT
+SDL_Cursor * O_OBJECT
SDL_AudioSpec * O_OBJECT
SDL_AudioCVT * O_OBJECT
Mix_Fading T_UV
@@ -65,17 +65,17 @@ int ** T_PTR
void * T_PTR
SDL_TimerID T_PTR
SDL_NewTimerCallback T_PTR
-SDL_Joystick * O_OBJECT
+SDL_Joystick * O_OBJECT
FPSmanager * O_OBJECT
SDLNet_SocketSet T_PTR
TCPsocket T_PTR
UDPsocket T_PTR
UDPpacket * T_PTR
UDPpacket ** T_PTR
-IPaddress* O_OBJECT
+IPaddress* O_OBJECT
SDLNet_GenericSocket T_PTR
TTF_Font * O_OBJECT
-SDL_Overlay * O_OBJECT
+SDL_Overlay * O_OBJECT
SMPEG_Info * O_OBJECT
SMPEG * O_OBJECT
SMPEGstatus T_IV
@@ -118,7 +118,7 @@ O_OBJECT
Uint32 *threadid = (Uint32 *)safemalloc(sizeof(Uint32));
*threadid = SDL_ThreadID();
pointers[2] = (void*)threadid;
- sv_setref_pv( $arg, CLASS, (void*)pointers );
+ sv_setref_pv( $arg, CLASS, (void*)pointers );
} else {
XSRETURN_UNDEF;
}

0 comments on commit f390b08

Please sign in to comment.