Skip to content

Commit

Permalink
fix: dissociate btiles from btile positioning in map screens by addin…
Browse files Browse the repository at this point in the history
…g btile attribute to OBSTACLEs, DECORATIONs and ITEMs.
  • Loading branch information
jorgegv committed Feb 6, 2021
1 parent 56f69c4 commit b517536
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
26 changes: 13 additions & 13 deletions game_data/map/Screen01.gdata
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
BEGIN_SCREEN
NAME Screen01

OBSTACLE NAME=Tree01 ROW=8 COL=4
OBSTACLE NAME=Tree01 ROW=10 COL=6
OBSTACLE NAME=Rock01 ROW=10 COL=12
OBSTACLE NAME=Rock01 ROW=10 COL=14
OBSTACLE NAME=Ice01 ROW=9 COL=20
OBSTACLE NAME=Ice01 ROW=8 COL=22
OBSTACLE NAME=Tree1 BTILE=Tree01 ROW=8 COL=4
OBSTACLE NAME=Tree2 BTILE=Tree01 ROW=10 COL=6
OBSTACLE NAME=Rock1 BTILE=Rock01 ROW=10 COL=12
OBSTACLE NAME=Rock2 BTILE=Rock01 ROW=10 COL=14
OBSTACLE NAME=Ice1 BTILE=Ice01 ROW=9 COL=20
OBSTACLE NAME=Ice2 BTILE=Ice01 ROW=8 COL=22

// Decoration for a hotzone must defined separately
DECORATION NAME=Stairs ROW=16 COL=10
DECORATION NAME=Stairs BTILE=Stairs ROW=16 COL=10
HOTZONE NAME=Stairs ROW=17 COL=11 WIDTH=1 HEIGHT=2 TYPE=WARP DEST_SCREEN=Screen02 DEST_HERO_X=100 DEST_HERO_Y=136 ACTIVE=1

// Decoration for a hotzone must defined separately
DECORATION NAME=ExitGame ROW=1 COL=29
DECORATION NAME=ExitGame BTILE=ExitGame ROW=1 COL=29
HOTZONE NAME=ExitGame ROW=1 COL=29 WIDTH=2 HEIGHT=2 TYPE=END_OF_GAME ACTIVE=0

DECORATION NAME=QuePereza ROW=4 COL=14
OBSTACLE NAME=TomaEmail ROW=14 COL=22
OBSTACLE NAME=PNGTest ROW=17 COL=18
DECORATION NAME=QuePereza BTILE=QuePereza ROW=4 COL=14
OBSTACLE NAME=TomaEmail1 BTILE=TomaEmail ROW=14 COL=22
OBSTACLE NAME=PNGTest1 BTILE=PNGTest ROW=17 COL=18

SPRITE NAME=Ghost01 MOVEMENT=LINEAR XMIN=8 YMIN=8 XMAX=233 YMAX=8 INITX=70 INITY=8 DX=2 DY=0 SPEED_DELAY=1 ANIMATION_DELAY=25 BOUNCE=1
SPRITE NAME=GhostPNG MOVEMENT=LINEAR XMIN=40 YMIN=8 XMAX=233 YMAX=159 INITX=50 INITY=8 DX=1 DY=2 SPEED_DELAY=1 ANIMATION_DELAY=25 BOUNCE=1
SPRITE NAME=GhostPNG MOVEMENT=LINEAR XMIN=8 YMIN=8 XMAX=233 YMAX=159 INITX=50 INITY=108 DX=1 DY=2 SPEED_DELAY=1 ANIMATION_DELAY=25 BOUNCE=1

HERO STARTUP_XPOS=20 STARTUP_YPOS=20

ITEM NAME=Heart ROW=3 COL=6 ITEM_INDEX=0
ITEM NAME=MagicKey ROW=3 COL=16 ITEM_INDEX=1
ITEM NAME=Heart BTILE=Heart ROW=3 COL=6 ITEM_INDEX=0
ITEM NAME=MagicKey BTILE=MagicKey ROW=3 COL=16 ITEM_INDEX=1

END_SCREEN
6 changes: 3 additions & 3 deletions game_data/map/Screen02.gdata
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
BEGIN_SCREEN
NAME Screen02

OBSTACLE NAME=Tree01 ROW=8 COL=4
OBSTACLE NAME=Tree01 ROW=10 COL=6
OBSTACLE NAME=Tree1 BTILE=Tree01 ROW=8 COL=4
OBSTACLE NAME=Tree2 BTILE=Tree01 ROW=10 COL=6

// Decoration for a hotzone must defined separately
DECORATION NAME=Stairs ROW=16 COL=10
DECORATION NAME=Stairs BTILE=Stairs ROW=16 COL=10
HOTZONE NAME=Stairs ROW=17 COL=11 WIDTH=1 HEIGHT=2 TYPE=WARP DEST_SCREEN=Screen01 DEST_HERO_X=100 DEST_HERO_Y=136 ACTIVE=1

SPRITE NAME=GhostPNG MOVEMENT=LINEAR XMIN=8 YMIN=8 XMAX=233 YMAX=159 INITX=50 INITY=108 DX=1 DY=2 SPEED_DELAY=1 ANIMATION_DELAY=25 BOUNCE=1
Expand Down
11 changes: 8 additions & 3 deletions tools/datagen.pl
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ sub output_screen {
$screen->{'name'},
scalar( @{$screen->{'btiles'}});
print $output_fh join( ",\n", map {
sprintf("\t{ TT_%s, %d, %d, &btile_%s, %s }", uc($_->{'type'}), $_->{'row'}, $_->{'col'}, $_->{'name'}, 'F_BTILE_ACTIVE' )
sprintf("\t{ TT_%s, %d, %d, &btile_%s, %s }", uc($_->{'type'}), $_->{'row'}, $_->{'col'}, $_->{'btile'}, 'F_BTILE_ACTIVE' )
} @{$screen->{'btiles'}} );
print $output_fh "\n};\n\n";
}
Expand Down Expand Up @@ -966,8 +966,13 @@ sub check_screen_btiles_are_valid {
my %is_valid_btile = map { $_->{'name'}, 1 } @btiles;
foreach my $screen ( @screens ) {
foreach my $btile ( @{ $screen->{'btiles'} } ) {
if ( not $is_valid_btile{ $btile->{'name'} } ) {
warn sprintf "Screen '%s': undefined btile '%s'\n", $screen->{'name'}, $btile->{'name'};
if ( not defined( $btile->{'btile'} ) ) {
warn sprintf "Screen '%s': %s has no associated btile attribute\n", $screen->{'name'}, $btile->{'type'};
$errors++;
next;
}
if ( not $is_valid_btile{ $btile->{'btile'} } ) {
warn sprintf "Screen '%s': undefined btile '%s'\n", $screen->{'name'}, $btile->{'btile'};
$errors++;
}
}
Expand Down

0 comments on commit b517536

Please sign in to comment.