summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--colors.txt6
-rw-r--r--game.adb50
-rw-r--r--map.txt2
3 files changed, 17 insertions, 41 deletions
diff --git a/colors.txt b/colors.txt
index 647ec0d..50e06ca 100644
--- a/colors.txt
+++ b/colors.txt
@@ -1,10 +1,10 @@
Background 174 122 29
Floor 0 0 44
Wall 0 0 0
-Barricade 0 255 255
+Barricade 0 178 255
Player 232 193 255
-DoorKey 25 254 228
-Bomb 0 255 255
+DoorKey 128 182 228
+Bomb 0 186 255
Label 0 0 255
Shrek 60 255 255
Urmom 242 196 212
diff --git a/game.adb b/game.adb
index bf2df4e..9af766c 100644
--- a/game.adb
+++ b/game.adb
@@ -304,26 +304,6 @@ procedure Game is
Up => (X => 0, Y => -1),
Down => (X => 0, Y => 1)];
- procedure Step(D: in Direction; Position: in out IVector2) is
- begin
- case D is
- when Left => Position.X := Position.X - 1;
- when Right => Position.X := Position.X + 1;
- when Up => Position.Y := Position.Y - 1;
- when Down => Position.Y := Position.Y + 1;
- end case;
- end;
-
- function Opposite(D: Direction) return Direction is
- begin
- case D is
- when Left => return Right;
- when Right => return Left;
- when Up => return Down;
- when Down => return Up;
- end case;
- end;
-
function Inside_Of_Rect(Start, Size, Point: in IVector2) return Boolean is
begin
return Start <= Point and then Point < Start + Size;
@@ -402,9 +382,8 @@ procedure Game is
for Dir in Direction loop
declare
- New_Position: IVector2 := Position;
+ New_Position: IVector2 := Position + Direction_Vector(Dir);
begin
- Step(Dir, New_Position);
for Limit in 1..Step_Length_Limit loop
if not Boss_Can_Stand_Here(Game, New_Position, Me) then
exit;
@@ -414,7 +393,7 @@ procedure Game is
end if;
Game.Bosses(Me).Path(New_Position.Y, New_Position.X) := Game.Bosses(Me).Path(Position.Y, Position.X) + 1;
Q.Append(New_Position);
- Step(Dir, New_Position);
+ New_Position := New_Position + Direction_Vector(Dir);
end loop;
end;
end loop;
@@ -658,21 +637,20 @@ procedure Game is
end;
procedure Player_Step(Game: in out Game_State; Dir: Direction) is
+ New_Position: constant IVector2 := Game.Player.Position + Direction_Vector(Dir);
begin
Game.Player.Prev_Position := Game.Player.Position;
Game.Turn_Animation := 1.0;
- Step(Dir, Game.Player.Position);
- if not Within_Map(Game, Game.Player.Position) then
- Step(Opposite(Dir), Game.Player.Position);
+ if not Within_Map(Game, New_Position) then
return;
end if;
- case Game.Map(Game.Player.Position.Y, Game.Player.Position.X) is
+ case Game.Map(New_Position.Y, New_Position.X) is
when Floor =>
declare
use Hashed_Map_Items;
- C: Cursor := Game.Items.Find(Game.Player.Position);
+ C: Cursor := Game.Items.Find(New_Position);
begin
if Has_Element(C) then
case Element(C).Kind is
@@ -689,15 +667,14 @@ procedure Game is
end case;
end if;
end;
+ Game.Player.Position := New_Position;
when Door =>
if Game.Player.Keys > 0 then
Game.Player.Keys := Game.Player.Keys - 1;
- Open_Adjacent_Doors(Game, Game.Player.Position);
- else
- Step(Opposite(Dir), Game.Player.Position);
+ Open_Adjacent_Doors(Game, New_Position);
+ Game.Player.Position := New_Position;
end if;
- when others =>
- Step(Opposite(Dir), Game.Player.Position);
+ when others => null;
end case;
end;
@@ -742,7 +719,7 @@ procedure Game is
end if;
end loop;
- Step(Dir, New_Position);
+ New_Position := New_Position + Direction_Vector(Dir);
when Barricade =>
Game.Map(New_Position.Y, New_Position.X) := Explosion;
return;
@@ -825,9 +802,8 @@ procedure Game is
if Space_Down and then Game.Player.Bombs > 0 then
for Dir in Direction loop
declare
- Position: IVector2 := Game.Player.Position;
+ Position: constant IVector2 := Game.Player.Position + Direction_Vector(Dir);
begin
- Step(Dir, Position);
if Within_Map(Game, Position) and then Game.Map(Position.Y, Position.X) = Floor then
Draw_Bomb(Position, Palette_RGB(COLOR_BOMB));
if Dir_Pressed(Dir) then
@@ -898,7 +874,7 @@ procedure Game is
Position: IVector2 := Game.Bosses(Me).Position;
begin
while Boss_Can_Stand_Here(Game, Position, Me) loop
- Step(Dir, Position);
+ Position := Position + Direction_Vector(Dir);
if Within_Map(Game, Position) and then Game.Bosses(Me).Path(Position.Y, Position.X) = Current - 1 then
Game.Bosses(Me).Position := Position;
exit Search;
diff --git a/map.txt b/map.txt
index 595c9e3..1cb95fd 100644
--- a/map.txt
+++ b/map.txt
@@ -12,7 +12,7 @@
#######.........# #...................#########
#.....#.........# #...................#.......#
#.....#.........#############################........B..........#.......#
- #..*..=.........&......!................@.......................&...%...#
+ #..*..=....@....&......!........................................&...%...#
#.....#.........#############################...................#.......#
#.....#.........# #...................#.......#
#######.........# #...................#########