summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2020-05-13 20:25:51 +0000
committerIan C <ianc@noddybox.co.uk>2020-05-13 20:25:51 +0000
commit58b60d1455a6670cbfb1572257460065fe7e6207 (patch)
tree2a5278c4534a16bcf08dad5433b6f8fb60368ede
parent983bba81d89ba877e8870251d92f64e16cf901c0 (diff)
Builds (just) and runs.
-rw-r--r--CLEVELS/-116
-rw-r--r--CLEVELS/-216
-rw-r--r--CLEVELS/115
-rw-r--r--CLEVELS/1046
-rw-r--r--CLEVELS/1180
-rw-r--r--CLEVELS/1236
-rw-r--r--CLEVELS/230
-rw-r--r--CLEVELS/336
-rw-r--r--CLEVELS/438
-rw-r--r--CLEVELS/527
-rw-r--r--CLEVELS/618
-rw-r--r--CLEVELS/724
-rw-r--r--CLEVELS/825
-rw-r--r--CLEVELS/961
-rw-r--r--CLEVELS/NO1
-rw-r--r--CLEVELS/README50
-rw-r--r--CLEVELS/TEST33
-rw-r--r--CLEVELS/template20
-rw-r--r--GFX16/amoeba6
-rw-r--r--GFX16/butterfly6
-rw-r--r--GFX16/butterflygen6
-rw-r--r--GFX16/chaser6
-rw-r--r--GFX16/chasergen6
-rw-r--r--GFX16/diamond6
-rw-r--r--GFX16/earth6
-rw-r--r--GFX16/exit6
-rw-r--r--GFX16/filter6
-rw-r--r--GFX16/miner6
-rw-r--r--GFX16/oneup6
-rw-r--r--GFX16/rock6
-rw-r--r--GFX16/rockgen6
-rw-r--r--GFX16/rockswitch6
-rw-r--r--GFX16/space6
-rw-r--r--GFX16/tuffwall6
-rw-r--r--GFX16/wall6
-rw-r--r--GFX16COL/amoebabin0 -> 271 bytes
-rw-r--r--GFX16COL/butterflybin0 -> 271 bytes
-rw-r--r--GFX16COL/butterflygenbin0 -> 271 bytes
-rw-r--r--GFX16COL/chaserbin0 -> 271 bytes
-rw-r--r--GFX16COL/chasergenbin0 -> 271 bytes
-rw-r--r--GFX16COL/colormapbin0 -> 1536 bytes
-rw-r--r--GFX16COL/diamondbin0 -> 271 bytes
-rw-r--r--GFX16COL/earthbin0 -> 271 bytes
-rw-r--r--GFX16COL/exitbin0 -> 271 bytes
-rw-r--r--GFX16COL/filterbin0 -> 271 bytes
-rw-r--r--GFX16COL/minerbin0 -> 271 bytes
-rw-r--r--GFX16COL/oneupbin0 -> 271 bytes
-rw-r--r--GFX16COL/rockbin0 -> 271 bytes
-rw-r--r--GFX16COL/rockgenbin0 -> 271 bytes
-rw-r--r--GFX16COL/rockswitchbin0 -> 271 bytes
-rw-r--r--GFX16COL/spacebin0 -> 271 bytes
-rw-r--r--GFX16COL/tuffwallbin0 -> 271 bytes
-rw-r--r--GFX16COL/wallbin0 -> 271 bytes
-rw-r--r--GFX8/amoeba4
-rw-r--r--GFX8/butterfly4
-rw-r--r--GFX8/butterflygen4
-rw-r--r--GFX8/chaser4
-rw-r--r--GFX8/chasergen4
-rw-r--r--GFX8/diamond4
-rw-r--r--GFX8/earth4
-rw-r--r--GFX8/exit4
-rw-r--r--GFX8/filter4
-rw-r--r--GFX8/miner4
-rw-r--r--GFX8/oneup4
-rw-r--r--GFX8/rock4
-rw-r--r--GFX8/rockgen4
-rw-r--r--GFX8/rockswitch4
-rw-r--r--GFX8/space4
-rw-r--r--GFX8/tuffwall4
-rw-r--r--GFX8/wall4
-rw-r--r--GFX8COL/amoebabin0 -> 79 bytes
-rw-r--r--GFX8COL/butterflybin0 -> 79 bytes
-rw-r--r--GFX8COL/butterflygenbin0 -> 79 bytes
-rw-r--r--GFX8COL/chaserbin0 -> 79 bytes
-rw-r--r--GFX8COL/chasergenbin0 -> 79 bytes
-rw-r--r--GFX8COL/colormapbin0 -> 1536 bytes
-rw-r--r--GFX8COL/diamondbin0 -> 79 bytes
-rw-r--r--GFX8COL/earthbin0 -> 79 bytes
-rw-r--r--GFX8COL/exitbin0 -> 79 bytes
-rw-r--r--GFX8COL/filterbin0 -> 79 bytes
-rw-r--r--GFX8COL/minerbin0 -> 79 bytes
-rw-r--r--GFX8COL/oneupbin0 -> 79 bytes
-rw-r--r--GFX8COL/rockbin0 -> 79 bytes
-rw-r--r--GFX8COL/rockgenbin0 -> 79 bytes
-rw-r--r--GFX8COL/rockswitchbin0 -> 79 bytes
-rw-r--r--GFX8COL/spacebin0 -> 79 bytes
-rw-r--r--GFX8COL/tuffwallbin0 -> 79 bytes
-rw-r--r--GFX8COL/wallbin0 -> 79 bytes
-rw-r--r--Makefile41
-rw-r--r--README143
-rw-r--r--XLEVELS/-116
-rw-r--r--XLEVELS/-216
-rw-r--r--XLEVELS/115
-rw-r--r--XLEVELS/1046
-rw-r--r--XLEVELS/1180
-rw-r--r--XLEVELS/1236
-rw-r--r--XLEVELS/230
-rw-r--r--XLEVELS/336
-rw-r--r--XLEVELS/438
-rw-r--r--XLEVELS/527
-rw-r--r--XLEVELS/618
-rw-r--r--XLEVELS/724
-rw-r--r--XLEVELS/825
-rw-r--r--XLEVELS/961
-rw-r--r--XLEVELS/DEBUGLEV35
-rw-r--r--XLEVELS/NO1
-rw-r--r--XLEVELS/README50
-rw-r--r--XLEVELS/TEST33
-rw-r--r--XLEVELS/template20
-rw-r--r--Xbit.c1877
-rw-r--r--Xbit.h596
-rw-r--r--dash.c3400
-rw-r--r--fontset.h2020
-rw-r--r--icon.bmp27
-rw-r--r--spred.c1264
115 files changed, 10717 insertions, 0 deletions
diff --git a/CLEVELS/-1 b/CLEVELS/-1
new file mode 100644
index 0000000..c1a3988
--- /dev/null
+++ b/CLEVELS/-1
@@ -0,0 +1,16 @@
+Well Done
+0,0
+0
+9999
+60,10
+R##########################################################E
+#..........................................................#
+#......*...*...................****........................#
+#......*...*.****.*....*.......*...*..**..*..*.****........#
+#......*...*.*....*....*.......*...*.*..*.**.*.*...........#
+#......*.*.*.***..*....*.......*...*.*..*.*.**.***.........#
+#......*.*.*.*....*....*.......*...*.*..*.*..*.*...........#
+#.......*.*..****.****.****....****...**..*..*.****........#
+#..........................................................#
+############################################################
+<END>
diff --git a/CLEVELS/-2 b/CLEVELS/-2
new file mode 100644
index 0000000..87775c5
--- /dev/null
+++ b/CLEVELS/-2
@@ -0,0 +1,16 @@
+Try again
+0,0
+0
+9999
+60,10
+R##########################################################E
+#..........................................................#
+#......@@@@@...............@@@.............................#
+#........@...@@@..@...@...@...@..@@@...@@..@@@.@..@........#
+#........@...@..@..@.@....@...@.@.....@..@..@..@@.@........#
+#........@...@@@....@.....@@@@@.@.@@..@@@@..@..@.@@........#
+#........@...@..@...@.....@...@.@..@..@..@..@..@..@........#
+#........@...@..@...@.....@...@..@@@..@..@.@@@.@..@........#
+#..........................................................#
+############################################################
+<END>
diff --git a/CLEVELS/1 b/CLEVELS/1
new file mode 100644
index 0000000..587ea04
--- /dev/null
+++ b/CLEVELS/1
@@ -0,0 +1,15 @@
+Nice and easy
+0,0
+10
+50
+39,9
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%.*........*..........................%
+%. ......@....*......@................%
+%. ....*......*......*......@@@@@@@@@.%
+%. ........@........*................E%
+%. ....*...*........*.......@.........%
+%. ...................................%
+%R.......@............................%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/10 b/CLEVELS/10
new file mode 100644
index 0000000..47e81f2
--- /dev/null
+++ b/CLEVELS/10
@@ -0,0 +1,46 @@
+It's aMAZEing!!!!
+0,0
+1
+200
+10,10
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R...............%%......................%%.............%%.............%%...............%
+%%%%%%%%%%%%%%.%%%%%%%.%%%%%%%%%%%.%%%%%%%%%%%%%%%.%%%%%%%%%%%%%.%%%%%%%%%%%%%%.%%%%%%..%
+%............................................%...........%%.............%%..............%
+%%%%%.%%%%%.%%%%%%%%%%%%%%%%%.%%%%%%%%.%%%%%.%%%%.%%%%%%%%%%%%%%%%%.%%%%%%.%%%%%%%%%%%%%%
+%%..%.%...%.%............%...........%.%.....%..................%....%.%.%..%...........%
+%...........%.%%%%%%%%%%.%.%%%%%%%%%%%.%.%%%.%.%%%%%%%%%%%%%%%%%%.%%%%...%..%.%%%%%%%%%.%
+%.%%%%%%%%%%%.%..........%.............%.%.%.%......%....%...%..............%.%.......%.%
+%.............%.%.%%%.%%%%.%%%%.%%%%%%%%.%.%.%.%%%%%%..%...%...%...%..%%.%..%.%.%%%%%.%.%
+%%%%.%%%%%%%....%.....%....%.................%......%..%%%%%%%%%%.%%%%%..%..%.%.%.....%.%
+%..........%..%.%%%%%.%.%%%%.%%%%%%%%%%%%%%%%%.%%%%%%...........%..%....%%..%.%.%%%%%%%.%
+%.%%%%%%.%.%..%...............%.....................%..%%%%%%%%.%.....%%.%..%.%.........%
+%.%......%.%..%%%%%%%%%%%%%%%%%.%%%%%.%%%%%%%%%%%%.%%.........%.%%.%%%%..%..%.%.%%%%%%%%%
+%.%.%%%%%%.%..%...%...%...%...%.%.....%..........%....%%%.%%%.%..........%..%.%.%.%...%%%
+%...............%...%...%...%...%.%%.%%.%%%%%%%%.%.%%%%...%.%.%%%%.%%%%%%%..%.%.%.%.%...%
+%.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.%%....%...%....%.%....%%%.%...............%.%.%...%%%.%
+%.%...................%.%%%.....%.%%%%%%%.%.%.%%%%.%.%%%%...%%%%%%%%%%%%%%%%%.%.%.%%%...%
+%.%.%%%.%%%%%%%%.%.%%.%...%.%.%.%.........%.%...%.........%..............%..%.%.%.%.%.%%%
+%.%.%.%.%......%.%..%.%%%.%%%.%.%%%%%%.%%%%.%%%.%.%%%%.%%%%.%%%%.%%%%.%%%%%.%.%.%.%.%...%
+%.%.%.%.%.%%%%.%.%..%.........%.%.............%.%...........%......%........%.%.%.%.%%%.%
+%.%.%.%.%.%..%.%.%%%%.%%%%%%%.%%%.%%%%%%%%%%%%%%%.%%%%%%%%%%%%%%%%%%%%%%%%%.%.%.%.%.%...%
+%.%.%.%%%.%..%.%..%...%...%.....%.........................%...%...%...%...%.%.%.%.%.%.%%%
+%.%.%.....%..%.%%.%.%%%.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%..%...%...%...%...%.%.%...%
+%.%.%.%%%%%..%..%.%.%.%.%..............%...%...%...%...%.....%..%%%%%%%%%%%%%%..%.%.%%%.%
+%.%.%.%......%%%%.%.%.%.%.%%%%%%%%%%%%.%.%...%...%...%...%.%.%...........%.%.%%...%.%...%
+%.%.%.%.%%%%..%.%.%.%.%.%.%..........%.%.%%%%%%%%%%%%%%%%%%%.%%%..%%%%%.%%.%..%%..%.%.%%%
+%.%.%.%....%%...%.%.%.%.%.%.%%%%%%%%.%.%...................%.%%..%%...%....%%..%%...%...%
+%.%.%.%%%.%%%%%%%.%.%.%.%.%.%......%.%.%%%%%%%%%%%%%%%%%%%.%.%........%%%%..%%..%%..%%%.%
+%.%%%.............%.%.%.%.%.%.%%%%.%.%.%...................%.%..%%%%%%%..%..%%%..%%.%...%
+%.%...%%%.%%%%%%%%%.%...%.%.%.%..%.%.%.%.%%%%%%%%%%%%%%%%%%%.%..%...................%.%%%
+%.%.%...%%%.........%.%.%.%.%.%.%%.%.%.%...................%.%..%%%%%%%%%%%%%%.%%%%.%...%
+%.%.%.%.....%%%%%%..%.%.%.%.%.%....%.%.%%%%%%%%%%%%%%%%%%%.%.%......%...%%%..%....%%%%%.%
+%.%.%.%%%%%%%....%.%%%%.%.%.%.%%%%%%.%.%...................%.%.%%%..%...%....%%%..%.....%
+%.%.%..%......%%%%.%..%.%.%.%........%.%.%%%%%%%%%%%%%%%%%%%.%........%.%.%....%%%%.%%%.%
+%.%.%%%%%%%%..%....%....%.%.%%%%%%%%%%.%..................%..%...%%%%.%......%....%.%...%
+%.%.....%..%.%%.%%%%..%.%.%............%...%.....%.%.%%%%%%..%%%%%%%%%%%%%%%%%%%%.%.%.%.%
+%.%.%%.....%....%.....%.%.%%%%%%%%%%%%%%...%.....%.%......%%...%...%...%...%..%E%%%.%.%.%
+%.%.%..%%%%%..%.%%.%..%.%...%...%...%...%%%%.%%%%%.%.%%%%%%%.%.%.%.%.%.%.%.%..%*%%..%%%.%
+%...%......%..%....%..%...%...%...%...%......%.....%.........%...%...%...%....%.........%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/11 b/CLEVELS/11
new file mode 100644
index 0000000..ae4e79d
--- /dev/null
+++ b/CLEVELS/11
@@ -0,0 +1,80 @@
+Look Out.
+0,0
+150
+150
+1,1
+%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R % %##############################################################% %**************************************************************% % E%
+% % %##############################################################% %**************************************************************% % %
+% % %############################################################ % %**************************************************************% % %
+% % %##################################################### % %**************************************************************% % %
+% % %############################################## % % ################################################### % % %
+% % %################################### % % % % %
+% % %########################### % % % % %
+% % %################### % % % % %
+% % %########### % % % % %
+% % %######## % % % % %
+% % %#### % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % $ $ $ $ % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% %%%%%%%%%%%% %%%%%%%% %%%%%%%%%%%% %
+% ! A%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/12 b/CLEVELS/12
new file mode 100644
index 0000000..1c7c3e0
--- /dev/null
+++ b/CLEVELS/12
@@ -0,0 +1,36 @@
+A little bit of everything
+0,0
+81
+150
+10,10
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %@@@@@% %
+% .%@@@%. ######### %
+% ..%@%.. #*******# %
+% ..%@%.. B #*****# %
+% ...@%.. #***# %
+% ...@%.. #*# %
+% ..%%%.. #*# %
+% ........ ........#*# %
+%....@@@@@........ ........... %
+%@@@@@@@@@........ ......... %
+%@@@@@@@@@........ .. % %
+%@@@@@@@@@... .. % %
+%%%%%%%%%%... .. % %
+%*********%.. % %
+%**********%.. %%%%%%%% R %
+%***********%. %
+%*******%%%**%.% %
+%%%%%%%% ***%$%@ @ @ %
+%............%@%............................. %
+%............%.%............................. %
+% %%%%%% %
+% % E% %
+% % @ %
+% @@ %. %
+% ....%%%%%%@ %
+% .. %
+%C ............ %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/2 b/CLEVELS/2
new file mode 100644
index 0000000..e8512a7
--- /dev/null
+++ b/CLEVELS/2
@@ -0,0 +1,30 @@
+Chain Reactions
+0,0
+60
+300
+60,24
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R ############# %
+% ############# %
+% ! ############# %
+% ############# %
+% %
+% ################################ %
+% . . %
+% . B B B B B . %
+% . . %
+% . . %
+% . B B B B B . %
+% . . %
+% . . %
+% . . %
+% . B B B B B . %
+% . . %
+% . . %
+% . . %
+% . B B B B B . %
+% . . %
+% . . %
+% . . E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/3 b/CLEVELS/3
new file mode 100644
index 0000000..bfbb4d4
--- /dev/null
+++ b/CLEVELS/3
@@ -0,0 +1,36 @@
+Let's Rock
+0,0
+15
+200
+70,30
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%C R %
+%% %%
+%.................................***###.............................%
+%..............................***####...............................%
+%..............................#####.................................%
+%..............................@###..................................%
+%....................%%.......@@@.#..................................%
+%...................%%.......@*@.....................................%
+%...................%%......@@@......................................%
+%..................%%......@*@.......................................%
+%..................%%.....@@@........................................%
+%.................%%%%...@*@.........................................%
+%.................%%%%%%@@@..........................................%
+%................%%%%%%@@@...........................................%
+%...............%%%%%*%%@%....%......................................%
+%..............%%%%%%%*%%%%..%%......................................%
+%............%%%%%%*%%%*%%%%%%.......................................%
+%...........%%%%%%%%*%%%%%%%%........................................%
+%..........%%%%%%*%%%*%%%%%..........................................%
+%..........%%%%%%%*%%%%%%%...........................................%
+%...........%%%%%%%*%%%%%............................................%
+%...........%%%%%%%%%%%%.............................................%
+%............%%%%%%%%@%%.............................................%
+%.............%%%%%%%%%..............................................%
+%..............%%%%%@%%..............................................%
+%...............%%%%%%...............................................%
+%.................%%%..............@..........................%@@@@@@%
+% C* C*****E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/4 b/CLEVELS/4
new file mode 100644
index 0000000..caab3bd
--- /dev/null
+++ b/CLEVELS/4
@@ -0,0 +1,38 @@
+The Plug Hole...
+0,0
+0
+255
+70,32
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R @@@ #*********# #*******E%
+%########### #*******# #*******%
+%*********## #*****# #******%
+%********## #***# #*****%
+%*******## #*# #@@@@%
+%******## C #*# #@@@%
+%*****## #*# #@@%
+%****## #*# #.%
+%***## #*# # %
+%**## #*# # %
+%*## #*# # %
+%*# ... # %
+%*# ## # # %
+%*# # # # %
+%*# B # ## # %
+%*# # # # %
+%*# ## # # %
+%*# # # # %
+%*# # ## # %
+%*# # # # %
+%*# B C ## # # %
+%*# # # # %
+%*# #&## # %
+%*# # # # %
+%*# ##### ## # %
+%*# ##*****## # # %
+%*# #*******# # ## %
+%*# #**@@@**# # # %
+%*# #*******# ## # %
+%* .*******. ## %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/5 b/CLEVELS/5
new file mode 100644
index 0000000..832772a
--- /dev/null
+++ b/CLEVELS/5
@@ -0,0 +1,27 @@
+It's all in the timing...
+0,0
+30
+300
+200,94
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%E.....................................R%
+%.......................................%
+%.......................................%
+%.......................................%
+%.......................................%
+%.........********************..........%
+%.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.%
+%.......................................%
+% %
+% %
+% %
+% %
+% %
+% %
+% %
+% %
+% %
+% A %
+% AAA %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/6 b/CLEVELS/6
new file mode 100644
index 0000000..0917b84
--- /dev/null
+++ b/CLEVELS/6
@@ -0,0 +1,18 @@
+Run Like Hell!!!
+0,0
+1
+35
+0,0
+%%%%%%%%%%%%%%%%%%%%
+% % R % % % E%
+% % % % % % % % % @%
+% % % % % % % % %..%
+% % % % % % % % %% %
+% % % % % % % % %% %
+% % % % % % % % %% %
+% % % % % % % % %% %
+% % % % % % % % %% %
+% % % % % % % % %% %
+%B% % % % %
+%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/7 b/CLEVELS/7
new file mode 100644
index 0000000..3c0c5e8
--- /dev/null
+++ b/CLEVELS/7
@@ -0,0 +1,24 @@
+Safe Cracker
+0,0
+45
+150
+20,70
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R.........................................................%
+%..........................................................%
+%.......@..........@ ...................................% %
+%...##### ......%%%%% ...................................% %
+%...# @ # ......%***# ...........%%%%....%..%.%..%.......% %
+%...# # ......%***# ...........%@@%....%..%.%..%.......% %
+%...# # ......%***% ...........%@@%....%%%%.%..%.......% %
+%...# A # ....B.%***% ...........%..%....%..%.%..........% %
+%...# # .... .%***% ...........%..%....%..%.%..%.......% %
+%...# # .... .%***% ...........%..%....................% %
+%...# # .... .%***% ..............%....................% %
+%...##### .%%%%%B...........%$$%....................% %
+%.................... ...........%..%....................%C%
+%.................... ..............%....................% %
+%.................... ...........%%%%....................% %
+%.................... ...................................%E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/8 b/CLEVELS/8
new file mode 100644
index 0000000..a76225d
--- /dev/null
+++ b/CLEVELS/8
@@ -0,0 +1,25 @@
+Raindrops
+0,0
+100
+200
+0,0
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R %rrrrrrrrrrrrrrrrrr% rrrrr %
+% % % %
+% % % %
+% % b b b % %
+% % % %
+% % % %
+% % % % %
+% % % % % %
+% % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % %
+% % % % % % % % % % %
+% % % %
+% %
+% %
+% E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/9 b/CLEVELS/9
new file mode 100644
index 0000000..01a959e
--- /dev/null
+++ b/CLEVELS/9
@@ -0,0 +1,61 @@
+Around the bend..
+0,0
+125
+200
+10,10
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R %% %*******%........................................%*******%
+%%%%%%%%%%%%%%%%%%%%%%% %% %%%%%%%%%% %*******%........................................%*******%
+% % %% % %*******%........................................%*******%
+%%%%%%%%%%%%%%%%%%%%%%% %% % %%%%%%%%%%%%%%..%%........................................%%%%%..%%
+% %% % %*******....%C %..................................... ....%
+% %%%%%%%%%%%%%%%%%%%%%%%%% % %********...% ...................................... %
+% % %%%%%%%%%% %%%%%%..................................... %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
+%.................................................................................................%
+%.................................................................................................%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
+ % C %
+ % %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
+%@@@@@@@@............ ................. ...................... ...................%
+%@@@@@@@@............ ................. ...................... ...................%
+%@@@@@@@@............ ................. ...................... ...................%
+%.@@@@@@@............ ................. ...................... ...................%
+%..@@@@@.............C .................C ......................C ...........********%
+%...@@@..%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%........% %%%%%%%%%%%%%%%%%%
+% % %E...............%
+%@@@@@. % %%%%%%%%%%..%%%%%%
+%.@@@@. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%..%%%%%%%%%%%%
+%..@@@. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..........%
+%...@@. ..............................................................................%
+%....@. ......***.........***.............***.............***...........***...........%
+%...... ..............................................................................%
+% ..%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%% ..%
+ % ...... ..%
+ %******..... ..%
+ %%%%%%%%%%%%%%%....%
+ %....%
+ %....%
+%%%%%%%%%%%%%%%%%%%%%%%....%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%**********************....***************************%
+%***********************..****************************%
+%*****************************************************%
+%**..................................................*%
+%**. .*%
+%**. .*%
+%**. .*%
+%**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*%
+%**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*%
+%**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*%
+%**..................................................*%
+%**..................................................*%
+%**. .*%
+%**. .*%
+%**. .*%
+%**..................................................*%
+%&****************************************************%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/NO b/CLEVELS/NO
new file mode 100644
index 0000000..48082f7
--- /dev/null
+++ b/CLEVELS/NO
@@ -0,0 +1 @@
+12
diff --git a/CLEVELS/README b/CLEVELS/README
new file mode 100644
index 0000000..1e91140
--- /dev/null
+++ b/CLEVELS/README
@@ -0,0 +1,50 @@
+Files
+-----
+
+These files must exist here to allow dash to run:
+
+NO - The number of levels in the directory. Just an ASCII file with
+ the number in it.
+-1 - A special level used for successfully completing a level
+-2 - A special level used for failing to complete a level
+1,2,3.. - The level files themselves.
+
+
+Map Design
+----------
+
+ENSURE THERE IS UNBREAKABLE WALL ALL AROUND THE LEVEL!!!!!!
+
+Title
+Start screen position (x,y)
+No of diamonds (0 == All)
+Timer (1 tick == 10 game cylces)
+Max size of amoeba,Chance of amoeba move (as %) [must be present if no amoeba]
+<Map Data>
+<END>
+
+
+Map characters :-
+
+R - Miner
+E - Exit
+% - Unbreakable Wall
+# - Explodable Wall
+. - Earth
+@ - Rock
+* - Gem
+B - Butterfly
+C - Chaser
+! - Swapper (swaps rocks and breakable walls around)
+& - Extra life
+$ - Indestructible Filter (changes falling rocks to diamonds and
+ visa versa if there is a space on the other side).
+A - Ameoba (fills surrounding spaces and earth and changes to
+ rocks or diamonds depending on whether it runs out of room or
+ gets contained first. Note : Multiple glyphs are taken to be
+ part of the same amoeba - even if space seperates them)
+r - Indestructible Rock generator - drops rocks out of it
+b - Indestructible Butterfly generator - generates butterflys in
+ 4 compass directions if there is space
+c - Indestructible Butterfly generator - generates butterflys in
+ 4 compass directions if there is space
diff --git a/CLEVELS/TEST b/CLEVELS/TEST
new file mode 100644
index 0000000..33a72ce
--- /dev/null
+++ b/CLEVELS/TEST
@@ -0,0 +1,33 @@
+Test New Features
+0,0
+0
+-1
+500,0
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R...................................................................%
+%......@.............................................................%
+%....... ............................................................%
+%....... ............................................................%
+%....... ............................................................%
+%....... .@@@@@@@@...................................................%
+%....... ............................................................%
+%....... .*....@.....................................................%
+%......$$$$$$$$$$$$..................................................%
+%....... .. ...................................................%
+%....... .. ...................................................%
+%....................................................................%
+%......$$$$$$$$$$$$.....@@@@@@@@.....................................%
+%...... ....@... ....@....................................%
+%...... ...@..........@...................................%
+%......$$$$$$$$$$$$...@.. @ ...@...................................%
+%...... .. .. ...@...................................%
+%...... ...@.. AA ...@...................................%
+%......$$$$$$$$$$$$...@.. AA . .@...................................%
+%.....................@......*...@...................................%
+%......................@........@....................................%
+%.......................@@@@@@@@.....................................%
+%....................................................................%
+%....................................................................%
+%............................................*......................E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/CLEVELS/template b/CLEVELS/template
new file mode 100644
index 0000000..ae5654f
--- /dev/null
+++ b/CLEVELS/template
@@ -0,0 +1,20 @@
+title
+screen_x,screen_y
+diamonds
+timer
+max_ameoba_size,ameoba_move_chance
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R.........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%.........................................................E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/GFX16/amoeba b/GFX16/amoeba
new file mode 100644
index 0000000..e77303d
--- /dev/null
+++ b/GFX16/amoeba
@@ -0,0 +1,6 @@
+#define amoeba_width 16
+#define amoeba_height 16
+static char amoeba_bits[] = {
+ 0x73, 0xce, 0xad, 0xb1, 0xdd, 0xbf, 0xfd, 0xdd, 0xdd, 0xda, 0xad, 0xbd,
+ 0xdb, 0xbf, 0xfb, 0xbf, 0x7b, 0x77, 0xbb, 0x6a, 0x7b, 0x77, 0xf7, 0x7f,
+ 0xfb, 0x7f, 0x3d, 0xb9, 0xcd, 0xb6, 0xf3, 0xcf};
diff --git a/GFX16/butterfly b/GFX16/butterfly
new file mode 100644
index 0000000..a2876cf
--- /dev/null
+++ b/GFX16/butterfly
@@ -0,0 +1,6 @@
+#define butterfly_width 16
+#define butterfly_height 16
+static char butterfly_bits[] = {
+ 0xb3, 0xcd, 0xad, 0xb5, 0x5e, 0x7a, 0x56, 0x6a, 0x5a, 0x5a, 0x5a, 0x5a,
+ 0x6a, 0x56, 0x2a, 0x54, 0x2a, 0x54, 0x6a, 0x56, 0x5a, 0x5a, 0x5a, 0x5a,
+ 0x56, 0x6a, 0x5e, 0x7a, 0xed, 0xb7, 0xf3, 0xcf};
diff --git a/GFX16/butterflygen b/GFX16/butterflygen
new file mode 100644
index 0000000..eea2401
--- /dev/null
+++ b/GFX16/butterflygen
@@ -0,0 +1,6 @@
+#define butterflygen_width 16
+#define butterflygen_height 16
+static char butterflygen_bits[] = {
+ 0x00, 0x00, 0xfe, 0x7f, 0xba, 0x7f, 0x92, 0x7f, 0x92, 0x7f, 0xba, 0x7d,
+ 0xfe, 0x78, 0xfe, 0x7d, 0xbe, 0x6d, 0x1e, 0x40, 0xbe, 0x6d, 0xfe, 0x7d,
+ 0xfe, 0x78, 0xfe, 0x7d, 0xfe, 0x7f, 0x00, 0x00};
diff --git a/GFX16/chaser b/GFX16/chaser
new file mode 100644
index 0000000..230bdc5
--- /dev/null
+++ b/GFX16/chaser
@@ -0,0 +1,6 @@
+#define chaser_width 16
+#define chaser_height 16
+static char chaser_bits[] = {
+ 0x07, 0xe0, 0xfb, 0xdf, 0xfd, 0xbf, 0xc6, 0x63, 0x86, 0x61, 0xfe, 0x7f,
+ 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x6f, 0x0e, 0x70, 0xf6, 0x7f, 0xfe, 0x7f,
+ 0x3e, 0x7c, 0xdd, 0xbb, 0xed, 0xb7, 0xf3, 0xcf};
diff --git a/GFX16/chasergen b/GFX16/chasergen
new file mode 100644
index 0000000..1a14efa
--- /dev/null
+++ b/GFX16/chasergen
@@ -0,0 +1,6 @@
+#define chasergen_width 16
+#define chasergen_height 16
+static char chasergen_bits[] = {
+ 0x00, 0x00, 0xfe, 0x7f, 0xc6, 0x7f, 0xaa, 0x7f, 0x92, 0x7f, 0x82, 0x7d,
+ 0x92, 0x78, 0xfe, 0x7d, 0xbe, 0x6d, 0x1e, 0x40, 0xbe, 0x6d, 0xfe, 0x7d,
+ 0xfe, 0x78, 0xfe, 0x7d, 0xfe, 0x7f, 0x00, 0x00};
diff --git a/GFX16/diamond b/GFX16/diamond
new file mode 100644
index 0000000..997829c
--- /dev/null
+++ b/GFX16/diamond
@@ -0,0 +1,6 @@
+#define diamond_width 16
+#define diamond_height 16
+static char diamond_bits[] = {
+ 0xff, 0xff, 0x7f, 0xfe, 0x3f, 0xfd, 0x5f, 0xfb, 0x6f, 0xf7, 0xf7, 0xee,
+ 0xfb, 0xde, 0xfd, 0xbe, 0xe1, 0x86, 0x1b, 0xd8, 0xf7, 0xee, 0xef, 0xf6,
+ 0xdf, 0xfa, 0x3f, 0xfc, 0x7f, 0xfe, 0xff, 0xff};
diff --git a/GFX16/earth b/GFX16/earth
new file mode 100644
index 0000000..7f05a78
--- /dev/null
+++ b/GFX16/earth
@@ -0,0 +1,6 @@
+#define earth_width 16
+#define earth_height 16
+static char earth_bits[] = {
+ 0xdf, 0xf7, 0xc5, 0x92, 0x75, 0xf0, 0x9d, 0x27, 0x8a, 0xe1, 0x7f, 0x3f,
+ 0x8e, 0x5b, 0xde, 0xff, 0x43, 0x89, 0xe8, 0xcf, 0x89, 0xd2, 0xe5, 0x93,
+ 0x79, 0x9d, 0xf1, 0x7a, 0x99, 0x4d, 0xb5, 0xbb};
diff --git a/GFX16/exit b/GFX16/exit
new file mode 100644
index 0000000..8921c70
--- /dev/null
+++ b/GFX16/exit
@@ -0,0 +1,6 @@
+#define exit_width 16
+#define exit_height 16
+static char exit_bits[] = {
+ 0xff, 0xff, 0x01, 0x80, 0xfd, 0xbf, 0x7d, 0xbe, 0x3d, 0xbc, 0x1d, 0xb8,
+ 0x1d, 0xb8, 0x3d, 0xbc, 0x7d, 0xbe, 0x7d, 0xbe, 0x7d, 0xbe, 0x3d, 0xbc,
+ 0x1d, 0xb8, 0xfd, 0xbf, 0x01, 0x80, 0xff, 0xff};
diff --git a/GFX16/filter b/GFX16/filter
new file mode 100644
index 0000000..ad2db3a
--- /dev/null
+++ b/GFX16/filter
@@ -0,0 +1,6 @@
+#define filter_width 16
+#define filter_height 16
+static char filter_bits[] = {
+ 0x00, 0x00, 0xfe, 0x7f, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
+ 0x7e, 0x7e, 0x7e, 0x7e, 0x02, 0x40, 0x06, 0x60, 0x0e, 0x70, 0x1e, 0x78,
+ 0x3e, 0x7c, 0x7e, 0x7e, 0xfe, 0x7f, 0x00, 0x00};
diff --git a/GFX16/miner b/GFX16/miner
new file mode 100644
index 0000000..7b435fe
--- /dev/null
+++ b/GFX16/miner
@@ -0,0 +1,6 @@
+#define miner_width 16
+#define miner_height 16
+static char miner_bits[] = {
+ 0x3f, 0xfe, 0x3f, 0xfe, 0x7f, 0xff, 0x0f, 0xf8, 0x07, 0xf0, 0xf3, 0xe7,
+ 0x1b, 0xec, 0x1b, 0xec, 0x3b, 0xee, 0xff, 0xff, 0xdf, 0xfd, 0xff, 0xff,
+ 0xdf, 0xfd, 0xff, 0xff, 0xcf, 0xf9, 0xc3, 0xe1};
diff --git a/GFX16/oneup b/GFX16/oneup
new file mode 100644
index 0000000..fb72d0a
--- /dev/null
+++ b/GFX16/oneup
@@ -0,0 +1,6 @@
+#define oneup_width 16
+#define oneup_height 16
+static char oneup_bits[] = {
+ 0x00, 0x00, 0xfe, 0x7f, 0x7e, 0x7e, 0x3e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
+ 0x3e, 0x7c, 0xfe, 0x7f, 0x92, 0x61, 0x92, 0x49, 0x92, 0x49, 0x92, 0x61,
+ 0x92, 0x79, 0xc6, 0x79, 0xfe, 0x7f, 0x00, 0x00};
diff --git a/GFX16/rock b/GFX16/rock
new file mode 100644
index 0000000..4bb0a84
--- /dev/null
+++ b/GFX16/rock
@@ -0,0 +1,6 @@
+#define rock_width 16
+#define rock_height 16
+static char rock_bits[] = {
+ 0x0f, 0xf0, 0x03, 0xc0, 0x39, 0x80, 0x3c, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x1f, 0xf8};
diff --git a/GFX16/rockgen b/GFX16/rockgen
new file mode 100644
index 0000000..d2c2828
--- /dev/null
+++ b/GFX16/rockgen
@@ -0,0 +1,6 @@
+#define rockgen_width 16
+#define rockgen_height 16
+static char rockgen_bits[] = {
+ 0x00, 0x00, 0xfe, 0x7f, 0xc6, 0x7f, 0x92, 0x7f, 0x8a, 0x7f, 0x82, 0x7f,
+ 0xc6, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7d, 0xfe, 0x7d,
+ 0xfe, 0x78, 0xfe, 0x7d, 0xfe, 0x7f, 0x00, 0x00};
diff --git a/GFX16/rockswitch b/GFX16/rockswitch
new file mode 100644
index 0000000..bedf5db
--- /dev/null
+++ b/GFX16/rockswitch
@@ -0,0 +1,6 @@
+#define rockswitch_width 16
+#define rockswitch_height 16
+static char rockswitch_bits[] = {
+ 0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xee, 0x7e, 0xde, 0x7d,
+ 0xbe, 0x7b, 0x6e, 0x77, 0xde, 0x60, 0xbe, 0x6e, 0x7e, 0x6e, 0xfe, 0x60,
+ 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0x00, 0x00};
diff --git a/GFX16/space b/GFX16/space
new file mode 100644
index 0000000..7263dcb
--- /dev/null
+++ b/GFX16/space
@@ -0,0 +1,6 @@
+#define space_width 16
+#define space_height 16
+static char space_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/GFX16/tuffwall b/GFX16/tuffwall
new file mode 100644
index 0000000..71513e3
--- /dev/null
+++ b/GFX16/tuffwall
@@ -0,0 +1,6 @@
+#define tuffwall_width 16
+#define tuffwall_height 16
+static char tuffwall_bits[] = {
+ 0xff, 0xff, 0x83, 0xc0, 0x05, 0xa1, 0x89, 0x90, 0xf1, 0x8f, 0x31, 0x8c,
+ 0x51, 0x8a, 0x9b, 0xa9, 0x95, 0xd9, 0x51, 0x8a, 0x31, 0x8c, 0xf1, 0x8f,
+ 0x09, 0x91, 0x85, 0xa0, 0x03, 0xc1, 0xff, 0xff};
diff --git a/GFX16/wall b/GFX16/wall
new file mode 100644
index 0000000..b12172f
--- /dev/null
+++ b/GFX16/wall
@@ -0,0 +1,6 @@
+#define wall_width 16
+#define wall_height 16
+static char wall_bits[] = {
+ 0x00, 0x00, 0xfe, 0x7f, 0xea, 0x57, 0xfe, 0x7f, 0xea, 0x57, 0xfe, 0x7f,
+ 0x3e, 0x7d, 0xfe, 0x7d, 0xbe, 0x7f, 0xbe, 0x7c, 0xfe, 0x7f, 0xea, 0x57,
+ 0xfe, 0x7f, 0xea, 0x57, 0xfe, 0x7f, 0x00, 0x00};
diff --git a/GFX16COL/amoeba b/GFX16COL/amoeba
new file mode 100644
index 0000000..115f3c8
--- /dev/null
+++ b/GFX16COL/amoeba
Binary files differ
diff --git a/GFX16COL/butterfly b/GFX16COL/butterfly
new file mode 100644
index 0000000..597a73d
--- /dev/null
+++ b/GFX16COL/butterfly
Binary files differ
diff --git a/GFX16COL/butterflygen b/GFX16COL/butterflygen
new file mode 100644
index 0000000..139f06b
--- /dev/null
+++ b/GFX16COL/butterflygen
Binary files differ
diff --git a/GFX16COL/chaser b/GFX16COL/chaser
new file mode 100644
index 0000000..4663c75
--- /dev/null
+++ b/GFX16COL/chaser
Binary files differ
diff --git a/GFX16COL/chasergen b/GFX16COL/chasergen
new file mode 100644
index 0000000..90d37ba
--- /dev/null
+++ b/GFX16COL/chasergen
Binary files differ
diff --git a/GFX16COL/colormap b/GFX16COL/colormap
new file mode 100644
index 0000000..3121add
--- /dev/null
+++ b/GFX16COL/colormap
Binary files differ
diff --git a/GFX16COL/diamond b/GFX16COL/diamond
new file mode 100644
index 0000000..7a47d62
--- /dev/null
+++ b/GFX16COL/diamond
Binary files differ
diff --git a/GFX16COL/earth b/GFX16COL/earth
new file mode 100644
index 0000000..c20a1b3
--- /dev/null
+++ b/GFX16COL/earth
Binary files differ
diff --git a/GFX16COL/exit b/GFX16COL/exit
new file mode 100644
index 0000000..792e4a4
--- /dev/null
+++ b/GFX16COL/exit
Binary files differ
diff --git a/GFX16COL/filter b/GFX16COL/filter
new file mode 100644
index 0000000..ca823d2
--- /dev/null
+++ b/GFX16COL/filter
Binary files differ
diff --git a/GFX16COL/miner b/GFX16COL/miner
new file mode 100644
index 0000000..4da26e4
--- /dev/null
+++ b/GFX16COL/miner
Binary files differ
diff --git a/GFX16COL/oneup b/GFX16COL/oneup
new file mode 100644
index 0000000..8da9fd4
--- /dev/null
+++ b/GFX16COL/oneup
Binary files differ
diff --git a/GFX16COL/rock b/GFX16COL/rock
new file mode 100644
index 0000000..4b137a4
--- /dev/null
+++ b/GFX16COL/rock
Binary files differ
diff --git a/GFX16COL/rockgen b/GFX16COL/rockgen
new file mode 100644
index 0000000..fc61e20
--- /dev/null
+++ b/GFX16COL/rockgen
Binary files differ
diff --git a/GFX16COL/rockswitch b/GFX16COL/rockswitch
new file mode 100644
index 0000000..b036d5d
--- /dev/null
+++ b/GFX16COL/rockswitch
Binary files differ
diff --git a/GFX16COL/space b/GFX16COL/space
new file mode 100644
index 0000000..ec4cc40
--- /dev/null
+++ b/GFX16COL/space
Binary files differ
diff --git a/GFX16COL/tuffwall b/GFX16COL/tuffwall
new file mode 100644
index 0000000..39fa67a
--- /dev/null
+++ b/GFX16COL/tuffwall
Binary files differ
diff --git a/GFX16COL/wall b/GFX16COL/wall
new file mode 100644
index 0000000..1631378
--- /dev/null
+++ b/GFX16COL/wall
Binary files differ
diff --git a/GFX8/amoeba b/GFX8/amoeba
new file mode 100644
index 0000000..39b61c9
--- /dev/null
+++ b/GFX8/amoeba
@@ -0,0 +1,4 @@
+#define amoeba_width 8
+#define amoeba_height 8
+static char amoeba_bits[] = {
+ 0x9f, 0x69, 0xb5, 0xbe, 0xa6, 0xbd, 0xdb, 0xe7};
diff --git a/GFX8/butterfly b/GFX8/butterfly
new file mode 100644
index 0000000..ad1c363
--- /dev/null
+++ b/GFX8/butterfly
@@ -0,0 +1,4 @@
+#define butterfly_width 8
+#define butterfly_height 8
+static char butterfly_bits[] = {
+ 0x3c, 0x5a, 0x66, 0x7e, 0x7e, 0x66, 0x5a, 0x3c};
diff --git a/GFX8/butterflygen b/GFX8/butterflygen
new file mode 100644
index 0000000..b013f41
--- /dev/null
+++ b/GFX8/butterflygen
@@ -0,0 +1,4 @@
+#define butterflygen_width 8
+#define butterflygen_height 8
+static char butterflygen_bits[] = {
+ 0xff, 0x81, 0xa5, 0xbd, 0xbd, 0xa5, 0x81, 0xff};
diff --git a/GFX8/chaser b/GFX8/chaser
new file mode 100644
index 0000000..c701378
--- /dev/null
+++ b/GFX8/chaser
@@ -0,0 +1,4 @@
+#define chaser_width 8
+#define chaser_height 8
+static char chaser_bits[] = {
+ 0xc3, 0xbd, 0x5a, 0x7e, 0x42, 0x7e, 0x00, 0x99};
diff --git a/GFX8/chasergen b/GFX8/chasergen
new file mode 100644
index 0000000..6113cfb
--- /dev/null
+++ b/GFX8/chasergen
@@ -0,0 +1,4 @@
+#define chasergen_width 8
+#define chasergen_height 8
+static char chasergen_bits[] = {
+ 0xff, 0x81, 0x99, 0xa5, 0xbd, 0xbd, 0x81, 0xff};
diff --git a/GFX8/diamond b/GFX8/diamond
new file mode 100644
index 0000000..c4c3823
--- /dev/null
+++ b/GFX8/diamond
@@ -0,0 +1,4 @@
+#define diamond_width 8
+#define diamond_height 8
+static char diamond_bits[] = {
+ 0xe7, 0xdb, 0xb5, 0x62, 0x76, 0xbd, 0xdb, 0xe7};
diff --git a/GFX8/earth b/GFX8/earth
new file mode 100644
index 0000000..3be8848
--- /dev/null
+++ b/GFX8/earth
@@ -0,0 +1,4 @@
+#define earth_width 8
+#define earth_height 8
+static char earth_bits[] = {
+ 0x77, 0xdd, 0xff, 0x7f, 0xeb, 0xfe, 0xdf, 0xf5};
diff --git a/GFX8/exit b/GFX8/exit
new file mode 100644
index 0000000..8d8b4b8
--- /dev/null
+++ b/GFX8/exit
@@ -0,0 +1,4 @@
+#define exit_width 8
+#define exit_height 8
+static char exit_bits[] = {
+ 0xff, 0x81, 0x99, 0xbd, 0x99, 0x99, 0x81, 0xff};
diff --git a/GFX8/filter b/GFX8/filter
new file mode 100644
index 0000000..c5638e4
--- /dev/null
+++ b/GFX8/filter
@@ -0,0 +1,4 @@
+#define filter_width 8
+#define filter_height 8
+static char filter_bits[] = {
+ 0x00, 0x66, 0x66, 0x66, 0x00, 0x42, 0x66, 0x00};
diff --git a/GFX8/miner b/GFX8/miner
new file mode 100644
index 0000000..10b1a81
--- /dev/null
+++ b/GFX8/miner
@@ -0,0 +1,4 @@
+#define miner_width 8
+#define miner_height 8
+static char miner_bits[] = {
+ 0xe3, 0xe3, 0xf7, 0xc1, 0xf7, 0xeb, 0xeb, 0xc9};
diff --git a/GFX8/oneup b/GFX8/oneup
new file mode 100644
index 0000000..7257999
--- /dev/null
+++ b/GFX8/oneup
@@ -0,0 +1,4 @@
+#define oneup_width 8
+#define oneup_height 8
+static char oneup_bits[] = {
+ 0xc3, 0xbd, 0x6e, 0x66, 0x6e, 0x6e, 0xbd, 0xc3};
diff --git a/GFX8/rock b/GFX8/rock
new file mode 100644
index 0000000..a692cff
--- /dev/null
+++ b/GFX8/rock
@@ -0,0 +1,4 @@
+#define rock_width 8
+#define rock_height 8
+static char rock_bits[] = {
+ 0x81, 0x04, 0x20, 0x00, 0x42, 0x00, 0x08, 0x81};
diff --git a/GFX8/rockgen b/GFX8/rockgen
new file mode 100644
index 0000000..2dd0d41
--- /dev/null
+++ b/GFX8/rockgen
@@ -0,0 +1,4 @@
+#define rockgen_width 8
+#define rockgen_height 8
+static char rockgen_bits[] = {
+ 0xff, 0x81, 0x99, 0xb5, 0xbd, 0x99, 0x81, 0xff};
diff --git a/GFX8/rockswitch b/GFX8/rockswitch
new file mode 100644
index 0000000..cc04d49
--- /dev/null
+++ b/GFX8/rockswitch
@@ -0,0 +1,4 @@
+#define rockswitch_width 8
+#define rockswitch_height 8
+static char rockswitch_bits[] = {
+ 0x00, 0x7e, 0x7e, 0x6a, 0x56, 0x4e, 0x7e, 0x00};
diff --git a/GFX8/space b/GFX8/space
new file mode 100644
index 0000000..c2efb9d
--- /dev/null
+++ b/GFX8/space
@@ -0,0 +1,4 @@
+#define space_width 8
+#define space_height 8
+static char space_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/GFX8/tuffwall b/GFX8/tuffwall
new file mode 100644
index 0000000..0e2360a
--- /dev/null
+++ b/GFX8/tuffwall
@@ -0,0 +1,4 @@
+#define tuffwall_width 8
+#define tuffwall_height 8
+static char tuffwall_bits[] = {
+ 0x00, 0x3c, 0x5a, 0x66, 0x66, 0x5a, 0x3c, 0x00};
diff --git a/GFX8/wall b/GFX8/wall
new file mode 100644
index 0000000..54372ab
--- /dev/null
+++ b/GFX8/wall
@@ -0,0 +1,4 @@
+#define wall_width 8
+#define wall_height 8
+static char wall_bits[] = {
+ 0xff, 0x89, 0xff, 0xa5, 0xa5, 0xff, 0x91, 0xff};
diff --git a/GFX8COL/amoeba b/GFX8COL/amoeba
new file mode 100644
index 0000000..1910a5a
--- /dev/null
+++ b/GFX8COL/amoeba
Binary files differ
diff --git a/GFX8COL/butterfly b/GFX8COL/butterfly
new file mode 100644
index 0000000..2ea6282
--- /dev/null
+++ b/GFX8COL/butterfly
Binary files differ
diff --git a/GFX8COL/butterflygen b/GFX8COL/butterflygen
new file mode 100644
index 0000000..b67a064
--- /dev/null
+++ b/GFX8COL/butterflygen
Binary files differ
diff --git a/GFX8COL/chaser b/GFX8COL/chaser
new file mode 100644
index 0000000..5022161
--- /dev/null
+++ b/GFX8COL/chaser
Binary files differ
diff --git a/GFX8COL/chasergen b/GFX8COL/chasergen
new file mode 100644
index 0000000..48a405a
--- /dev/null
+++ b/GFX8COL/chasergen
Binary files differ
diff --git a/GFX8COL/colormap b/GFX8COL/colormap
new file mode 100644
index 0000000..3121add
--- /dev/null
+++ b/GFX8COL/colormap
Binary files differ
diff --git a/GFX8COL/diamond b/GFX8COL/diamond
new file mode 100644
index 0000000..7b32f46
--- /dev/null
+++ b/GFX8COL/diamond
Binary files differ
diff --git a/GFX8COL/earth b/GFX8COL/earth
new file mode 100644
index 0000000..7c71df8
--- /dev/null
+++ b/GFX8COL/earth
Binary files differ
diff --git a/GFX8COL/exit b/GFX8COL/exit
new file mode 100644
index 0000000..682ef18
--- /dev/null
+++ b/GFX8COL/exit
Binary files differ
diff --git a/GFX8COL/filter b/GFX8COL/filter
new file mode 100644
index 0000000..0be00a4
--- /dev/null
+++ b/GFX8COL/filter
Binary files differ
diff --git a/GFX8COL/miner b/GFX8COL/miner
new file mode 100644
index 0000000..6e3f935
--- /dev/null
+++ b/GFX8COL/miner
Binary files differ
diff --git a/GFX8COL/oneup b/GFX8COL/oneup
new file mode 100644
index 0000000..aa2844d
--- /dev/null
+++ b/GFX8COL/oneup
Binary files differ
diff --git a/GFX8COL/rock b/GFX8COL/rock
new file mode 100644
index 0000000..1412e74
--- /dev/null
+++ b/GFX8COL/rock
Binary files differ
diff --git a/GFX8COL/rockgen b/GFX8COL/rockgen
new file mode 100644
index 0000000..4ffe2ac
--- /dev/null
+++ b/GFX8COL/rockgen
Binary files differ
diff --git a/GFX8COL/rockswitch b/GFX8COL/rockswitch
new file mode 100644
index 0000000..0f3120a
--- /dev/null
+++ b/GFX8COL/rockswitch
Binary files differ
diff --git a/GFX8COL/space b/GFX8COL/space
new file mode 100644
index 0000000..1db6b03
--- /dev/null
+++ b/GFX8COL/space
Binary files differ
diff --git a/GFX8COL/tuffwall b/GFX8COL/tuffwall
new file mode 100644
index 0000000..4adf2ab
--- /dev/null
+++ b/GFX8COL/tuffwall
Binary files differ
diff --git a/GFX8COL/wall b/GFX8COL/wall
new file mode 100644
index 0000000..6f71a03
--- /dev/null
+++ b/GFX8COL/wall
Binary files differ
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8927c67
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+# Makfile
+#
+
+OPTIM=-g
+OBJ=dash
+CC=cc
+
+# Uncomment the following line if your system does not support usleep()
+#
+# USLEEP=-DNOUSLEEP
+
+# For Suns - edit if your system is awkward too
+#
+INCLUDE_PATH=-I/usr/openwin/include -I/usr/5include
+LIB_PATH=-L/usr/openwin/lib -L/usr/5lib
+
+# Shouldn't need to edit below here
+#
+OPTS=$(OPTIM) $(USLEEP)
+
+ALL=dash spred
+
+all: $(ALL)
+
+$(OBJ): Xbit.o $(OBJ).o
+ $(CC) $(OPTS) $(LIB_PATH) -o $(OBJ) $(OBJ).o Xbit.o -lXext -lX11 -lm -lcurses -ltermcap
+
+Xbit.o: Xbit.c Xbit.h
+ $(CC) $(OPTS) $(INCLUDE_PATH) -c Xbit.c
+
+$(OBJ).o: Xbit.h $(OBJ).c
+ $(CC) $(OPTS) $(INCLUDE_PATH) -c $(OBJ).c
+
+spred: Xbit.o spred.o
+ $(CC) $(OPTS) $(LIB_PATH) -o spred spred.o Xbit.o -lXext -lX11 -lm
+
+spred.o: Xbit.h spred.c
+ $(CC) $(OPTS) $(INCLUDE_PATH) -c spred.c
+
+clean:
+ rm -f $(ALL) *.o core
diff --git a/README b/README
new file mode 100644
index 0000000..6eed935
--- /dev/null
+++ b/README
@@ -0,0 +1,143 @@
+ DASH 1.2
+ Preseneted by Noddybox 97
+
+You should find in the archive :
+
+README This file
+Makefile Simple bog standard make file for dash and spred.
+dash.c Main code
+Xbit.[ch] Library routines for easy X11 Xlib access
+spred.c Simple sprite editor
+CLEVELS/* Curses Level files. See CLEVELS/README for info.
+XLEVELS/* X11 Level files. See XLEVELS/README for info.
+lib/* Library files. Used for hiscore table
+GFX8/* X11 Bitmap format files for use in 8x8 B&W version
+GFX16/* X11 Bitmap format files for use in 16x16 B&W version
+GFX8COL/* spred generated sprite files for use in 8x8 colour
+ version.
+GFX16COL/* spred generated sprite files for use in 16x16 colour
+ version.
+
+Note that the reason the level files have been split into 2 directories (even
+though currently in the distribution they have the same contents) is that the
+curses mode does not give the same degree of control as the X11 version, so in
+that mode certain levels could become very unplayable.
+
+
+BUILD INSTRUCTIONS
+------------------
+
+Though written primarily on SunOS, this should work on most flavours of unix.
+The only thing to look out for is to include the -DUSLEEP line in the makfile
+if your system does not support the call 'usleep(int usec)'. If your system
+doesn't support select() either, the implementation of LocalUsleep() using
+poll() is left as an exercise for the reader :-)
+
+Try and ignore any incompatible pointer warnings. Unless they make it not
+work... :-)
+
+
+USAGE
+-----
+
+dash [switches]
+-s Use small version
+-b Use black and white sprites
+-d delay usleep() by delay for fast servers (eg, 90000 on Sun4)
+-l lev start from level lev
+-c use curses on tty (not yet perfect)
+-h Dump hi-score table
+
+
+X11 KEYS
+--------
+
+Escape Quit (from title page)
+Cursor Keys Move
+SHIFT + Cursor Keys Dig/Pick up/Push in direction
+P Pause
+Space Un-pause
+Q Suicide (for if you get stuck in a rockfall!)
+
+
+CURSES KEYS
+-----------
+
+^C Quit (from title page)
+Cursor Keys Move
+A,D,W,X Dig/Pick up/Push in direction
+P Pause
+Space Un-pause
+Q Suicide (for if you get stuck in a rockfall!)
+
+
+INSTRUCTIONS
+------------
+
+The object of the game is to collect a certain number of gems (as indicated at
+the top of the screen) and once collected make your way to the exit before the
+time limit expires.
+
+As you dig around the level to collect gems, boulders will fall as you dig the
+ground out from under them. Letting a boulder or gem fall on your head will
+kill you.
+
+As well as these basic mechanics they are extra objects that are waiting to
+cause you trouble...
+
+Butterflys These move around empty spaces, and will explode into a number
+ of gems if a boulder or gem is dropped on top of them. Note
+ that if they hit a wall, they like to turn to the right if
+ at all possible... This _could_ be handy to remember.
+
+Chasers They move slowly, but always towards you. Getting touched by
+ one of these ghosts is fatal! They explode into a number of
+ boulders if a boulder or gem falls on top of them.
+
+Ameoba This green blob grows outwards into any available space. If
+ sealed in (so it can grow no more) it will die and leave behind
+ gems. If it is allowed to grow too large it will also die,
+ leaving behind boulders!
+
+Filter This swallows falling boulders and gems, and if there is space
+ on the other side spits out a gem for a boulder and visa versa.
+
+Rock switch This switch swaps all the breakable walls and boulders around
+ in the level.
+
+Generators There are 3 flavours of generators. Rock generators will drop
+ out a rock downwards if there is room, while butterfly and
+ chaser generators produce the appropriate monster in all 4
+ compass directions if there is room.
+
+Exit This is where you have to get too!!! Make sure you can still
+ get to it at the end of the level!
+
+
+The line at the top of the screen contains :
+
+SCORE NO OF GEMS TO COLLECT NO OF GEMS GOT LIVES TIME LEFT
+
+
+NOTES
+-----
+
+dash switches off auto repeat to enhance the keyboard reading when run in X11
+mode. Auto repeat is re-enabled while the game is paused and when you exit
+the game cleanly from the title page.
+
+If you kill it mid-game, auto repeat will still be off. It can be re-enabled
+from the shell with 'xset r on'.
+
+
+
+Have Fun.
+
+
+
+
+email ianc@noddybox.demon.co.uk
+URL http://www.noddybox.demon.co.uk
+
+
+Release 1.2 Wed Nov 12 11:21:21 GMT 1997
diff --git a/XLEVELS/-1 b/XLEVELS/-1
new file mode 100644
index 0000000..c1a3988
--- /dev/null
+++ b/XLEVELS/-1
@@ -0,0 +1,16 @@
+Well Done
+0,0
+0
+9999
+60,10
+R##########################################################E
+#..........................................................#
+#......*...*...................****........................#
+#......*...*.****.*....*.......*...*..**..*..*.****........#
+#......*...*.*....*....*.......*...*.*..*.**.*.*...........#
+#......*.*.*.***..*....*.......*...*.*..*.*.**.***.........#
+#......*.*.*.*....*....*.......*...*.*..*.*..*.*...........#
+#.......*.*..****.****.****....****...**..*..*.****........#
+#..........................................................#
+############################################################
+<END>
diff --git a/XLEVELS/-2 b/XLEVELS/-2
new file mode 100644
index 0000000..87775c5
--- /dev/null
+++ b/XLEVELS/-2
@@ -0,0 +1,16 @@
+Try again
+0,0
+0
+9999
+60,10
+R##########################################################E
+#..........................................................#
+#......@@@@@...............@@@.............................#
+#........@...@@@..@...@...@...@..@@@...@@..@@@.@..@........#
+#........@...@..@..@.@....@...@.@.....@..@..@..@@.@........#
+#........@...@@@....@.....@@@@@.@.@@..@@@@..@..@.@@........#
+#........@...@..@...@.....@...@.@..@..@..@..@..@..@........#
+#........@...@..@...@.....@...@..@@@..@..@.@@@.@..@........#
+#..........................................................#
+############################################################
+<END>
diff --git a/XLEVELS/1 b/XLEVELS/1
new file mode 100644
index 0000000..587ea04
--- /dev/null
+++ b/XLEVELS/1
@@ -0,0 +1,15 @@
+Nice and easy
+0,0
+10
+50
+39,9
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%.*........*..........................%
+%. ......@....*......@................%
+%. ....*......*......*......@@@@@@@@@.%
+%. ........@........*................E%
+%. ....*...*........*.......@.........%
+%. ...................................%
+%R.......@............................%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/10 b/XLEVELS/10
new file mode 100644
index 0000000..47e81f2
--- /dev/null
+++ b/XLEVELS/10
@@ -0,0 +1,46 @@
+It's aMAZEing!!!!
+0,0
+1
+200
+10,10
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R...............%%......................%%.............%%.............%%...............%
+%%%%%%%%%%%%%%.%%%%%%%.%%%%%%%%%%%.%%%%%%%%%%%%%%%.%%%%%%%%%%%%%.%%%%%%%%%%%%%%.%%%%%%..%
+%............................................%...........%%.............%%..............%
+%%%%%.%%%%%.%%%%%%%%%%%%%%%%%.%%%%%%%%.%%%%%.%%%%.%%%%%%%%%%%%%%%%%.%%%%%%.%%%%%%%%%%%%%%
+%%..%.%...%.%............%...........%.%.....%..................%....%.%.%..%...........%
+%...........%.%%%%%%%%%%.%.%%%%%%%%%%%.%.%%%.%.%%%%%%%%%%%%%%%%%%.%%%%...%..%.%%%%%%%%%.%
+%.%%%%%%%%%%%.%..........%.............%.%.%.%......%....%...%..............%.%.......%.%
+%.............%.%.%%%.%%%%.%%%%.%%%%%%%%.%.%.%.%%%%%%..%...%...%...%..%%.%..%.%.%%%%%.%.%
+%%%%.%%%%%%%....%.....%....%.................%......%..%%%%%%%%%%.%%%%%..%..%.%.%.....%.%
+%..........%..%.%%%%%.%.%%%%.%%%%%%%%%%%%%%%%%.%%%%%%...........%..%....%%..%.%.%%%%%%%.%
+%.%%%%%%.%.%..%...............%.....................%..%%%%%%%%.%.....%%.%..%.%.........%
+%.%......%.%..%%%%%%%%%%%%%%%%%.%%%%%.%%%%%%%%%%%%.%%.........%.%%.%%%%..%..%.%.%%%%%%%%%
+%.%.%%%%%%.%..%...%...%...%...%.%.....%..........%....%%%.%%%.%..........%..%.%.%.%...%%%
+%...............%...%...%...%...%.%%.%%.%%%%%%%%.%.%%%%...%.%.%%%%.%%%%%%%..%.%.%.%.%...%
+%.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.%%....%...%....%.%....%%%.%...............%.%.%...%%%.%
+%.%...................%.%%%.....%.%%%%%%%.%.%.%%%%.%.%%%%...%%%%%%%%%%%%%%%%%.%.%.%%%...%
+%.%.%%%.%%%%%%%%.%.%%.%...%.%.%.%.........%.%...%.........%..............%..%.%.%.%.%.%%%
+%.%.%.%.%......%.%..%.%%%.%%%.%.%%%%%%.%%%%.%%%.%.%%%%.%%%%.%%%%.%%%%.%%%%%.%.%.%.%.%...%
+%.%.%.%.%.%%%%.%.%..%.........%.%.............%.%...........%......%........%.%.%.%.%%%.%
+%.%.%.%.%.%..%.%.%%%%.%%%%%%%.%%%.%%%%%%%%%%%%%%%.%%%%%%%%%%%%%%%%%%%%%%%%%.%.%.%.%.%...%
+%.%.%.%%%.%..%.%..%...%...%.....%.........................%...%...%...%...%.%.%.%.%.%.%%%
+%.%.%.....%..%.%%.%.%%%.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%..%...%...%...%...%.%.%...%
+%.%.%.%%%%%..%..%.%.%.%.%..............%...%...%...%...%.....%..%%%%%%%%%%%%%%..%.%.%%%.%
+%.%.%.%......%%%%.%.%.%.%.%%%%%%%%%%%%.%.%...%...%...%...%.%.%...........%.%.%%...%.%...%
+%.%.%.%.%%%%..%.%.%.%.%.%.%..........%.%.%%%%%%%%%%%%%%%%%%%.%%%..%%%%%.%%.%..%%..%.%.%%%
+%.%.%.%....%%...%.%.%.%.%.%.%%%%%%%%.%.%...................%.%%..%%...%....%%..%%...%...%
+%.%.%.%%%.%%%%%%%.%.%.%.%.%.%......%.%.%%%%%%%%%%%%%%%%%%%.%.%........%%%%..%%..%%..%%%.%
+%.%%%.............%.%.%.%.%.%.%%%%.%.%.%...................%.%..%%%%%%%..%..%%%..%%.%...%
+%.%...%%%.%%%%%%%%%.%...%.%.%.%..%.%.%.%.%%%%%%%%%%%%%%%%%%%.%..%...................%.%%%
+%.%.%...%%%.........%.%.%.%.%.%.%%.%.%.%...................%.%..%%%%%%%%%%%%%%.%%%%.%...%
+%.%.%.%.....%%%%%%..%.%.%.%.%.%....%.%.%%%%%%%%%%%%%%%%%%%.%.%......%...%%%..%....%%%%%.%
+%.%.%.%%%%%%%....%.%%%%.%.%.%.%%%%%%.%.%...................%.%.%%%..%...%....%%%..%.....%
+%.%.%..%......%%%%.%..%.%.%.%........%.%.%%%%%%%%%%%%%%%%%%%.%........%.%.%....%%%%.%%%.%
+%.%.%%%%%%%%..%....%....%.%.%%%%%%%%%%.%..................%..%...%%%%.%......%....%.%...%
+%.%.....%..%.%%.%%%%..%.%.%............%...%.....%.%.%%%%%%..%%%%%%%%%%%%%%%%%%%%.%.%.%.%
+%.%.%%.....%....%.....%.%.%%%%%%%%%%%%%%...%.....%.%......%%...%...%...%...%..%E%%%.%.%.%
+%.%.%..%%%%%..%.%%.%..%.%...%...%...%...%%%%.%%%%%.%.%%%%%%%.%.%.%.%.%.%.%.%..%*%%..%%%.%
+%...%......%..%....%..%...%...%...%...%......%.....%.........%...%...%...%....%.........%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/11 b/XLEVELS/11
new file mode 100644
index 0000000..ae4e79d
--- /dev/null
+++ b/XLEVELS/11
@@ -0,0 +1,80 @@
+Look Out.
+0,0
+150
+150
+1,1
+%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R % %##############################################################% %**************************************************************% % E%
+% % %##############################################################% %**************************************************************% % %
+% % %############################################################ % %**************************************************************% % %
+% % %##################################################### % %**************************************************************% % %
+% % %############################################## % % ################################################### % % %
+% % %################################### % % % % %
+% % %########################### % % % % %
+% % %################### % % % % %
+% % %########### % % % % %
+% % %######## % % % % %
+% % %#### % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % $ $ $ $ % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % % % %
+% %%%%%%%%%%%% %%%%%%%% %%%%%%%%%%%% %
+% ! A%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/12 b/XLEVELS/12
new file mode 100644
index 0000000..1c7c3e0
--- /dev/null
+++ b/XLEVELS/12
@@ -0,0 +1,36 @@
+A little bit of everything
+0,0
+81
+150
+10,10
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %@@@@@% %
+% .%@@@%. ######### %
+% ..%@%.. #*******# %
+% ..%@%.. B #*****# %
+% ...@%.. #***# %
+% ...@%.. #*# %
+% ..%%%.. #*# %
+% ........ ........#*# %
+%....@@@@@........ ........... %
+%@@@@@@@@@........ ......... %
+%@@@@@@@@@........ .. % %
+%@@@@@@@@@... .. % %
+%%%%%%%%%%... .. % %
+%*********%.. % %
+%**********%.. %%%%%%%% R %
+%***********%. %
+%*******%%%**%.% %
+%%%%%%%% ***%$%@ @ @ %
+%............%@%............................. %
+%............%.%............................. %
+% %%%%%% %
+% % E% %
+% % @ %
+% @@ %. %
+% ....%%%%%%@ %
+% .. %
+%C ............ %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/2 b/XLEVELS/2
new file mode 100644
index 0000000..e8512a7
--- /dev/null
+++ b/XLEVELS/2
@@ -0,0 +1,30 @@
+Chain Reactions
+0,0
+60
+300
+60,24
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R ############# %
+% ############# %
+% ! ############# %
+% ############# %
+% %
+% ################################ %
+% . . %
+% . B B B B B . %
+% . . %
+% . . %
+% . B B B B B . %
+% . . %
+% . . %
+% . . %
+% . B B B B B . %
+% . . %
+% . . %
+% . . %
+% . B B B B B . %
+% . . %
+% . . %
+% . . E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/3 b/XLEVELS/3
new file mode 100644
index 0000000..bfbb4d4
--- /dev/null
+++ b/XLEVELS/3
@@ -0,0 +1,36 @@
+Let's Rock
+0,0
+15
+200
+70,30
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%C R %
+%% %%
+%.................................***###.............................%
+%..............................***####...............................%
+%..............................#####.................................%
+%..............................@###..................................%
+%....................%%.......@@@.#..................................%
+%...................%%.......@*@.....................................%
+%...................%%......@@@......................................%
+%..................%%......@*@.......................................%
+%..................%%.....@@@........................................%
+%.................%%%%...@*@.........................................%
+%.................%%%%%%@@@..........................................%
+%................%%%%%%@@@...........................................%
+%...............%%%%%*%%@%....%......................................%
+%..............%%%%%%%*%%%%..%%......................................%
+%............%%%%%%*%%%*%%%%%%.......................................%
+%...........%%%%%%%%*%%%%%%%%........................................%
+%..........%%%%%%*%%%*%%%%%..........................................%
+%..........%%%%%%%*%%%%%%%...........................................%
+%...........%%%%%%%*%%%%%............................................%
+%...........%%%%%%%%%%%%.............................................%
+%............%%%%%%%%@%%.............................................%
+%.............%%%%%%%%%..............................................%
+%..............%%%%%@%%..............................................%
+%...............%%%%%%...............................................%
+%.................%%%..............@..........................%@@@@@@%
+% C* C*****E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/4 b/XLEVELS/4
new file mode 100644
index 0000000..caab3bd
--- /dev/null
+++ b/XLEVELS/4
@@ -0,0 +1,38 @@
+The Plug Hole...
+0,0
+0
+255
+70,32
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R @@@ #*********# #*******E%
+%########### #*******# #*******%
+%*********## #*****# #******%
+%********## #***# #*****%
+%*******## #*# #@@@@%
+%******## C #*# #@@@%
+%*****## #*# #@@%
+%****## #*# #.%
+%***## #*# # %
+%**## #*# # %
+%*## #*# # %
+%*# ... # %
+%*# ## # # %
+%*# # # # %
+%*# B # ## # %
+%*# # # # %
+%*# ## # # %
+%*# # # # %
+%*# # ## # %
+%*# # # # %
+%*# B C ## # # %
+%*# # # # %
+%*# #&## # %
+%*# # # # %
+%*# ##### ## # %
+%*# ##*****## # # %
+%*# #*******# # ## %
+%*# #**@@@**# # # %
+%*# #*******# ## # %
+%* .*******. ## %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/5 b/XLEVELS/5
new file mode 100644
index 0000000..832772a
--- /dev/null
+++ b/XLEVELS/5
@@ -0,0 +1,27 @@
+It's all in the timing...
+0,0
+30
+300
+200,94
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%E.....................................R%
+%.......................................%
+%.......................................%
+%.......................................%
+%.......................................%
+%.........********************..........%
+%.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.%
+%.......................................%
+% %
+% %
+% %
+% %
+% %
+% %
+% %
+% %
+% %
+% A %
+% AAA %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/6 b/XLEVELS/6
new file mode 100644
index 0000000..0917b84
--- /dev/null
+++ b/XLEVELS/6
@@ -0,0 +1,18 @@
+Run Like Hell!!!
+0,0
+1
+35
+0,0
+%%%%%%%%%%%%%%%%%%%%
+% % R % % % E%
+% % % % % % % % % @%
+% % % % % % % % %..%
+% % % % % % % % %% %
+% % % % % % % % %% %
+% % % % % % % % %% %
+% % % % % % % % %% %
+% % % % % % % % %% %
+% % % % % % % % %% %
+%B% % % % %
+%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/7 b/XLEVELS/7
new file mode 100644
index 0000000..3c0c5e8
--- /dev/null
+++ b/XLEVELS/7
@@ -0,0 +1,24 @@
+Safe Cracker
+0,0
+45
+150
+20,70
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R.........................................................%
+%..........................................................%
+%.......@..........@ ...................................% %
+%...##### ......%%%%% ...................................% %
+%...# @ # ......%***# ...........%%%%....%..%.%..%.......% %
+%...# # ......%***# ...........%@@%....%..%.%..%.......% %
+%...# # ......%***% ...........%@@%....%%%%.%..%.......% %
+%...# A # ....B.%***% ...........%..%....%..%.%..........% %
+%...# # .... .%***% ...........%..%....%..%.%..%.......% %
+%...# # .... .%***% ...........%..%....................% %
+%...# # .... .%***% ..............%....................% %
+%...##### .%%%%%B...........%$$%....................% %
+%.................... ...........%..%....................%C%
+%.................... ..............%....................% %
+%.................... ...........%%%%....................% %
+%.................... ...................................%E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/8 b/XLEVELS/8
new file mode 100644
index 0000000..a76225d
--- /dev/null
+++ b/XLEVELS/8
@@ -0,0 +1,25 @@
+Raindrops
+0,0
+100
+200
+0,0
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R %rrrrrrrrrrrrrrrrrr% rrrrr %
+% % % %
+% % % %
+% % b b b % %
+% % % %
+% % % %
+% % % % %
+% % % % % %
+% % % % % %
+% % % % % % % %
+% % % % % % % %
+% % % % % %
+% % % % % % % % % % %
+% % % %
+% %
+% %
+% E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/9 b/XLEVELS/9
new file mode 100644
index 0000000..01a959e
--- /dev/null
+++ b/XLEVELS/9
@@ -0,0 +1,61 @@
+Around the bend..
+0,0
+125
+200
+10,10
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R %% %*******%........................................%*******%
+%%%%%%%%%%%%%%%%%%%%%%% %% %%%%%%%%%% %*******%........................................%*******%
+% % %% % %*******%........................................%*******%
+%%%%%%%%%%%%%%%%%%%%%%% %% % %%%%%%%%%%%%%%..%%........................................%%%%%..%%
+% %% % %*******....%C %..................................... ....%
+% %%%%%%%%%%%%%%%%%%%%%%%%% % %********...% ...................................... %
+% % %%%%%%%%%% %%%%%%..................................... %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
+%.................................................................................................%
+%.................................................................................................%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
+ % C %
+ % %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
+%@@@@@@@@............ ................. ...................... ...................%
+%@@@@@@@@............ ................. ...................... ...................%
+%@@@@@@@@............ ................. ...................... ...................%
+%.@@@@@@@............ ................. ...................... ...................%
+%..@@@@@.............C .................C ......................C ...........********%
+%...@@@..%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%........% %%%%%%%%%%%%%%%%%%
+% % %E...............%
+%@@@@@. % %%%%%%%%%%..%%%%%%
+%.@@@@. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%..%%%%%%%%%%%%
+%..@@@. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..........%
+%...@@. ..............................................................................%
+%....@. ......***.........***.............***.............***...........***...........%
+%...... ..............................................................................%
+% ..%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%% ..%
+ % ...... ..%
+ %******..... ..%
+ %%%%%%%%%%%%%%%....%
+ %....%
+ %....%
+%%%%%%%%%%%%%%%%%%%%%%%....%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%**********************....***************************%
+%***********************..****************************%
+%*****************************************************%
+%**..................................................*%
+%**. .*%
+%**. .*%
+%**. .*%
+%**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*%
+%**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*%
+%**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*%
+%**..................................................*%
+%**..................................................*%
+%**. .*%
+%**. .*%
+%**. .*%
+%**..................................................*%
+%&****************************************************%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/DEBUGLEV b/XLEVELS/DEBUGLEV
new file mode 100644
index 0000000..7112171
--- /dev/null
+++ b/XLEVELS/DEBUGLEV
@@ -0,0 +1,35 @@
+DEBUG LEVEL
+0,0
+10
+50
+39,29
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% r #rrrrrr#rrrrrr# E%
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% #$# # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% # # # %
+% #$#$# %
+%R ##### %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/NO b/XLEVELS/NO
new file mode 100644
index 0000000..48082f7
--- /dev/null
+++ b/XLEVELS/NO
@@ -0,0 +1 @@
+12
diff --git a/XLEVELS/README b/XLEVELS/README
new file mode 100644
index 0000000..1e91140
--- /dev/null
+++ b/XLEVELS/README
@@ -0,0 +1,50 @@
+Files
+-----
+
+These files must exist here to allow dash to run:
+
+NO - The number of levels in the directory. Just an ASCII file with
+ the number in it.
+-1 - A special level used for successfully completing a level
+-2 - A special level used for failing to complete a level
+1,2,3.. - The level files themselves.
+
+
+Map Design
+----------
+
+ENSURE THERE IS UNBREAKABLE WALL ALL AROUND THE LEVEL!!!!!!
+
+Title
+Start screen position (x,y)
+No of diamonds (0 == All)
+Timer (1 tick == 10 game cylces)
+Max size of amoeba,Chance of amoeba move (as %) [must be present if no amoeba]
+<Map Data>
+<END>
+
+
+Map characters :-
+
+R - Miner
+E - Exit
+% - Unbreakable Wall
+# - Explodable Wall
+. - Earth
+@ - Rock
+* - Gem
+B - Butterfly
+C - Chaser
+! - Swapper (swaps rocks and breakable walls around)
+& - Extra life
+$ - Indestructible Filter (changes falling rocks to diamonds and
+ visa versa if there is a space on the other side).
+A - Ameoba (fills surrounding spaces and earth and changes to
+ rocks or diamonds depending on whether it runs out of room or
+ gets contained first. Note : Multiple glyphs are taken to be
+ part of the same amoeba - even if space seperates them)
+r - Indestructible Rock generator - drops rocks out of it
+b - Indestructible Butterfly generator - generates butterflys in
+ 4 compass directions if there is space
+c - Indestructible Butterfly generator - generates butterflys in
+ 4 compass directions if there is space
diff --git a/XLEVELS/TEST b/XLEVELS/TEST
new file mode 100644
index 0000000..33a72ce
--- /dev/null
+++ b/XLEVELS/TEST
@@ -0,0 +1,33 @@
+Test New Features
+0,0
+0
+-1
+500,0
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R...................................................................%
+%......@.............................................................%
+%....... ............................................................%
+%....... ............................................................%
+%....... ............................................................%
+%....... .@@@@@@@@...................................................%
+%....... ............................................................%
+%....... .*....@.....................................................%
+%......$$$$$$$$$$$$..................................................%
+%....... .. ...................................................%
+%....... .. ...................................................%
+%....................................................................%
+%......$$$$$$$$$$$$.....@@@@@@@@.....................................%
+%...... ....@... ....@....................................%
+%...... ...@..........@...................................%
+%......$$$$$$$$$$$$...@.. @ ...@...................................%
+%...... .. .. ...@...................................%
+%...... ...@.. AA ...@...................................%
+%......$$$$$$$$$$$$...@.. AA . .@...................................%
+%.....................@......*...@...................................%
+%......................@........@....................................%
+%.......................@@@@@@@@.....................................%
+%....................................................................%
+%....................................................................%
+%............................................*......................E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/XLEVELS/template b/XLEVELS/template
new file mode 100644
index 0000000..ae5654f
--- /dev/null
+++ b/XLEVELS/template
@@ -0,0 +1,20 @@
+title
+screen_x,screen_y
+diamonds
+timer
+max_ameoba_size,ameoba_move_chance
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%R.........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%..........................................................%
+%.........................................................E%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+<END>
diff --git a/Xbit.c b/Xbit.c
new file mode 100644
index 0000000..83fdb3c
--- /dev/null
+++ b/Xbit.c
@@ -0,0 +1,1877 @@
+/*
+
+ Xbit - Simple xlib interface
+
+ Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ -------------------------------------------------------------------------
+
+ This is a bit messy as it based on very old K&R code.
+
+*/
+static char rcs_id[]="$Id: Xbit.c 11 2006-05-02 19:02:49Z ianc $";
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xos.h>
+#include <X11/Xatom.h>
+
+#include <X11/extensions/XShm.h>
+
+/* #include <machine/param.h> */
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include <netinet/in.h>
+
+#include "Xbit.h"
+
+#include "icon.bmp"
+
+#define WARN(x) fprintf(stderr,"%s(%d) : Warning:%s\n",__FILE__,__LINE__,x);
+#define WARN1(x,y) fprintf(stderr,"%s(%d) : Warning:%s %s\n",__FILE__,__LINE__,x,y);
+
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#define ABS(x) ((x) < 0 ? (-(x)) : (x))
+
+
+/* GLOBALS
+*/
+
+#define MAXPM 256
+
+typedef struct WEntry
+{
+ Window w;
+ Pixmap pm[MAXPM];
+ int used_MIT_SHM;
+ XShmSegmentInfo
+ shm_info;
+ int pmi;
+ int buffer;
+ int use_pm;
+ int multi;
+ int multino;
+ ulong multicls;
+ GC gc;
+ int ox;
+ int oy;
+ int ww;
+ int wh;
+ int pw;
+ int ph;
+ int func;
+ int lastuserfunc;
+ ulong lastfg;
+ int spline_thresh;
+ struct WEntry *next;
+} WEntry;
+
+
+static WEntry *whead=NULL;
+static WEntry *wtail=NULL;
+
+static WEntry *current=NULL;
+
+static WEntry *stack[128];
+static int sttop;
+
+static Display *display=NULL;
+static XVisualInfo vinfo;
+static int screen;
+
+static int use_shm=True;
+
+static ulong xb_black;
+static ulong xb_white;
+
+/* Buffer for Xprintf() and XIprintf()
+*/
+static char prbuf[1024];
+
+/* Definitions for XImage 8x8 charset
+*/
+#include "fontset.h"
+
+
+/* Put globals
+*/
+static int no_plots;
+static XPoint points[MAX_PUTPLOTS];
+
+
+/* Set write mode
+*/
+#define WM(c) do {if ((c)!=current->func) { \
+ XSetFunction(display,current->gc,c); \
+ current->func=c; } } while(0)
+
+
+/* Set foreground funcrion
+*/
+#define FG(c) do {if ((c)!=current->lastfg) { \
+ XSetForeground(display,current->gc,c); \
+ current->lastfg=c; } } while(0)
+
+
+/* Stack current windows
+*/
+#define PUSHW do {stack[sttop++]=current;} while(0)
+#define POPW do {current=stack[--sttop];} while(0)
+
+
+/* ------------- FUNCTIONS ------------- */
+
+static void CreateWEntry(Window w, GC g, int ww, int wh)
+{
+ WEntry *new;
+
+ if (!(new=malloc(sizeof(WEntry))))
+ {
+ fprintf(stderr,"%s(%d) : FATAL:%s\n",__FILE__,__LINE__,
+ "Couldn't malloc() WEntry");
+ exit(1);
+ }
+
+ if (!whead)
+ {
+ whead=new;
+ wtail=new;
+ }
+ else
+ {
+ wtail->next=new;
+ wtail=new;
+ }
+
+ new->next=NULL;
+
+ new->w=w;
+ new->gc=g;
+
+ new->pm[0]=0;
+ new->pm[1]=0;
+ new->pmi=0;
+ new->buffer=True;
+ new->use_pm=True;
+ new->multi=False;
+ new->ox=0;
+ new->oy=0;
+ new->ww=ww;
+ new->wh=wh;
+ new->pw=0;
+ new->ph=0;
+ new->func=GXcopy;
+ new->lastuserfunc=GXcopy;
+ new->lastfg=-1;
+ new->spline_thresh=1;
+ new->used_MIT_SHM=False;
+}
+
+
+XImage *CreateXImage(void)
+{
+ XImage *img;
+ char *p;
+
+ if (!use_shm)
+ {
+ switch(vinfo.depth)
+ {
+ case 8:
+ p=malloc(current->pw*current->ph*1);
+ break;
+ case 16:
+ p=malloc(current->pw*current->ph*2);
+ break;
+ default:
+ p=malloc(current->pw*current->ph*4);
+ break;
+ }
+
+ if (!p)
+ {
+ fprintf(stderr,"%s(%d) : FATAL:%s\n",__FILE__,__LINE__,
+ "Couldn't malloc() XImage data");
+ exit(1);
+ }
+
+ img=XCreateImage
+ (display,
+ vinfo.visual,
+ vinfo.depth, /* Image depth */
+ ZPixmap, /* Image format */
+ 0, /* Offset */
+ p, /* Data */
+ current->pw, /* Width */
+ current->ph, /* Height */
+ 8, /* Bitmap pad */
+ 0);
+ }
+ else
+ {
+ img=XShmCreateImage(display,
+ vinfo.visual,
+ vinfo.depth,
+ ZPixmap,
+ NULL,
+ &(current->shm_info),
+ current->pw,
+ current->ph);
+
+ if (!img)
+ return(NULL);
+
+ current->used_MIT_SHM=True;
+
+ /* Get shared memory for image
+ */
+ current->shm_info.shmid=shmget(IPC_PRIVATE,
+ img->bytes_per_line*img->height,
+ IPC_CREAT|0777);
+
+ if (current->shm_info.shmid<0)
+ {
+ WARN("Couldn't get MITSHM mem");
+ exit(1);
+ }
+
+ current->shm_info.shmaddr=shmat(current->shm_info.shmid,0,0);
+ img->data=current->shm_info.shmaddr;
+
+ current->shm_info.readOnly=False;
+
+ /* Try and attached shared memory
+ */
+ if (!XShmAttach(display,&(current->shm_info)))
+ {
+ WARN("Failed to attach MITSHM block");
+ exit(1);
+ }
+
+ XSync(display,False);
+ }
+
+ ClsXImage(img);
+ return img;
+}
+
+
+void ClsXImage(XImage *img)
+{
+ memset(img->data,0,img->bytes_per_line*img->height);
+}
+
+
+void DestroyXImage(XImage *img)
+{
+ if (current->used_MIT_SHM)
+ {
+ XShmDetach(display,&(current->shm_info));
+
+ if (current->shm_info.shmaddr)
+ shmdt(current->shm_info.shmaddr);
+
+ if (current->shm_info.shmid>=0)
+ shmctl(current->shm_info.shmid,IPC_RMID,0);
+
+ current->used_MIT_SHM=False;
+ }
+
+ XDestroyImage(img);
+ XSync(display,False);
+}
+
+
+void SetCurrentWin(Window w)
+{
+ WEntry *l;
+
+ l=whead;
+
+ while(l)
+ {
+ if (l->w==w)
+ {
+ current=l;
+ return;
+ }
+
+ l=l->next;
+ }
+
+ WARN("Asked for non-existant window");
+}
+
+
+int GetVisualDepth(void)
+{
+ return vinfo.depth;
+}
+
+
+Window OpenWin (int argc,
+ char **argv,
+ char *title,
+ int wx, int wy, int ww, int wh,
+ int pw, int ph,
+ unsigned long ev,
+ XSizeHints *hints,
+ ulong *black, ulong *white)
+{
+ Window window;
+ GC gc;
+ char *display_name=NULL;
+ Pixmap icon_pixmap;
+ int i,j,k;
+
+ if (!display)
+ {
+ if ((display=XOpenDisplay(display_name))==NULL)
+ {
+ fprintf(stderr,"%s: can't connect to %s\n",
+ argv[0], XDisplayName(display_name));
+ exit(-1);
+ }
+
+ /* Try and find shared memory extension
+ */
+ use_shm=XQueryExtension(display,"MIT-SHM",&i,&j,&k);
+
+ /* Find a nice 8-bit visual for us to use...
+ */
+ if (!XMatchVisualInfo(display,DefaultScreen(display),8,
+ PseudoColor,&vinfo))
+ if (!XMatchVisualInfo(display,DefaultScreen(display),16,
+ TrueColor,&vinfo))
+ if (!XMatchVisualInfo(display,DefaultScreen(display),24,
+ TrueColor,&vinfo))
+ if (!XMatchVisualInfo(display,DefaultScreen(display),32,
+ TrueColor,&vinfo))
+ {
+ WARN("no visual found!\n");
+ exit(1);
+ }
+ }
+
+ screen=DefaultScreen(display);
+
+ xb_black=BlackPixel(display,screen);
+ xb_white=WhitePixel(display,screen);
+ *black=xb_black;
+ *white=xb_white;
+
+ window=XCreateWindow(display,
+ RootWindow(display,screen),
+ wx,wy,ww,wh,1,
+ vinfo.depth,
+ InputOutput,
+ vinfo.visual,
+ 0,NULL);
+
+ icon_pixmap=XCreateBitmapFromData(
+ display,
+ window,
+ icon_bits,
+ icon_width,icon_height);
+
+ XSetStandardProperties(
+ display,
+ window,
+ title,
+ title,
+ icon_pixmap,
+ argv,argc,
+ hints);
+
+ XSelectInput (display,window,ev);
+
+ gc=XCreateGC(display,window,0,NULL);
+
+ XSetForeground(display,gc,*black);
+ XSetBackground(display,gc,*white);
+ XSetPlaneMask(display,gc,AllPlanes);
+ XSetGraphicsExposures(display,gc,False);
+
+ XMapWindow (display,window);
+
+ CreateWEntry(window,gc,ww,wh);
+ SetCurrentWin(window);
+
+ Resize(pw,ph);
+
+ return window;
+}
+
+
+Window OpenRootWin (ulong *black,ulong *white,int *w,int *h,int pw,int ph)
+{
+ Window window;
+ GC gc;
+ char *display_name=NULL;
+ int i,j,k;
+
+ if (!display)
+ {
+ int depth;
+
+ if ((display=XOpenDisplay(display_name))==NULL)
+ {
+ fprintf(stderr,"can't connect to %s\n",XDisplayName(display_name));
+ exit(-1);
+ }
+
+ screen=DefaultScreen(display);
+
+ depth=DefaultDepth(display,screen);
+
+ /* Try and find shared memory extension
+ */
+ use_shm=XQueryExtension(display,"MIT-SHM",&i,&j,&k);
+
+ /* Find a visual for us to use...
+ */
+ if (!XMatchVisualInfo(display,DefaultScreen(display),depth,
+ depth==8 ? PseudoColor:TrueColor,&vinfo))
+ {
+ WARN("no visual to match the root window!");
+ exit(1);
+ }
+ }
+
+ xb_black=BlackPixel(display,screen);
+ xb_white=WhitePixel(display,screen);
+ *black=xb_black;
+ *white=xb_white;
+
+ window=RootWindow(display,screen);
+
+ gc=XCreateGC(display,window,0,NULL);
+
+ XSetForeground(display,gc,*black);
+ XSetBackground(display,gc,*white);
+ XSetPlaneMask(display,gc,AllPlanes);
+
+ XMapWindow (display,window);
+
+ *w=DisplayWidth(display,screen);
+ *h=DisplayHeight(display,screen);
+
+ CreateWEntry(window,gc,*w,*h);
+ SetCurrentWin(window);
+
+ Resize(pw,ph);
+
+ return window;
+}
+
+
+XFontStruct *XUseFont(const char *n)
+{
+ XFontStruct *ft;
+
+ if (ft=XLoadQueryFont(display,n))
+ XSetFont(display,current->gc,ft->fid);
+ else
+ WARN1("couldn't load font:",n);
+
+ return ft;
+}
+
+
+void XUseCursor(const char *bm, const char *mask, XColor fg, XColor bg)
+{
+ Pixmap b,m;
+ Cursor curs;
+ int bmw,bmh,bmx,bmy;
+ int maskw,maskh,maskx,masky;
+
+ if (XReadBitmapFile(display,current->w,bm,&bmw,&bmh,&b,&bmx,&bmy)
+ ==BitmapOpenFailed)
+ {
+ WARN1("Couldn't read in cursor file:",bm);
+ return;
+ }
+
+ if (XReadBitmapFile(display,current->w,mask,&maskw,&maskh,&m,&maskx,&masky)
+ ==BitmapOpenFailed)
+ {
+ WARN1("Couldn't read in mask file:",bm);
+ return;
+ }
+
+ curs=XCreatePixmapCursor(display,b,m,&fg,&bg,bmx,bmy);
+
+ XDefineCursor(display,current->w,curs);
+
+ XFreePixmap(display,b);
+ XFreePixmap(display,m);
+}
+
+
+void LoadBitmap(const char *fn,int x,int y, int resize)
+{
+ Pixmap bm;
+ int w,h,hx,hy;
+ int cw,ch;
+
+ if (!current->use_pm)
+ {
+ WARN("Need pixmaps to load in bitmap");
+ }
+
+ if (XReadBitmapFile(display,current->w,fn,&w,&h,&bm,&hx,&hy)
+ ==BitmapOpenFailed)
+ {
+ WARN1("Couldn't read in bitmap file:",fn);
+ return;
+ }
+
+ if ((w!=current->pw)||(h!=current->ph))
+ {
+ if (resize)
+ {
+ Resize(w+x,h+y);
+ cw=w;
+ ch=h;
+ }
+ else
+ {
+ cw=current->pw-x;
+ ch=current->ph-y;
+ }
+ }
+
+ XCopyPlane(display,bm,current->pm[current->pmi],
+ current->gc,0,0,cw,ch,x,y,1L);
+
+ XFreePixmap(display,bm);
+}
+
+
+Pixmap GetBitmap(const char *fn, int *w, int *h, int *hx, int *hy)
+{
+ Pixmap bm,ret;
+
+ if (XReadBitmapFile(display,current->w,fn,w,h,&bm,hx,hy)
+ ==BitmapOpenFailed)
+ {
+ WARN1("Couldn't read in bitmap file:",fn);
+ return(0);
+ }
+
+ ret=XCreatePixmap(display,current->w,*w,*h,vinfo.depth);
+
+ XCopyPlane(display,bm,ret,current->gc,0,0,*w,*h,0,0,1L);
+
+ XFreePixmap(display,bm);
+
+ return ret;
+}
+
+
+void DrawXImage(XImage *img)
+{
+ if (use_shm)
+ XShmPutImage (display,
+ current->pm[0],
+ current->gc,
+ img,
+ 0,0,
+ 0,0,
+ current->pw,current->ph,
+ False);
+ else
+ XPutImage (display,
+ current->pm[0],
+ current->gc,
+ img,
+ 0,0,
+ 0,0,
+ current->pw,current->ph);
+}
+
+
+void Resize(int w,int h)
+{
+ int f;
+
+ if (w<current->ww)
+ w=current->ww;
+
+ if (h<current->wh)
+ h=current->wh;
+
+ current->pw=w;
+ current->ph=h;
+
+ if (!current->use_pm)
+ return;
+
+ if (current->multi)
+ {
+ WM(GXcopy);
+ FG(current->multicls);
+ for(f=0;f<current->multino;f++)
+ {
+ XFreePixmap(display,current->pm[f]);
+ current->pm[f]=XCreatePixmap(display,current->w,w,h,vinfo.depth);
+ XFillRectangle(display,current->pm[f],
+ current->gc,0,0,current->pw,current->ph);
+ }
+ WM(current->lastuserfunc);
+ return;
+ }
+
+ if (current->pm[0])
+ {
+ XFreePixmap(display,current->pm[0]);
+
+ if (current->buffer)
+ XFreePixmap(display,current->pm[1]);
+ }
+
+ current->pmi=0;
+
+ current->pm[0]=XCreatePixmap(display,current->w,w,h,vinfo.depth);
+
+ if (current->buffer)
+ current->pm[1]=XCreatePixmap(display,current->w,w,h,vinfo.depth);
+}
+
+
+void Redraw(int x,int y)
+{
+ if ((x+current->ww)>current->pw)
+ x=current->pw-current->ww;
+
+ if ((y+current->wh)>current->ph)
+ y=current->ph-current->wh;
+
+ current->ox=x;
+ current->oy=y;
+
+ if (!current->use_pm)
+ {
+ XSync(display,False);
+ return;
+ }
+
+ WM(GXcopy);
+
+ if (current->buffer)
+ {
+ XCopyArea(display,current->pm[current->pmi^1],current->w,
+ current->gc,x,y,current->ww,current->wh,0,0);
+ XSync(display,False);
+ }
+ else
+ {
+ XCopyArea(display,current->pm[current->pmi],current->w,
+ current->gc,x,y,current->ww,current->wh,0,0);
+ XSync(display,False);
+ }
+
+ WM(current->lastuserfunc);
+}
+
+
+Pixmap GetCurrentPixmap(void)
+
+{
+ if (!current->use_pm)
+ return(0);
+
+ return current->pm[current->pmi];
+}
+
+GC GetCurrentGC(void)
+
+{
+ return current->gc;
+}
+
+
+void DisableDoubleBuffer(void)
+
+{
+ current->pmi=0;
+ XFreePixmap(display,current->pm[1]);
+ current->buffer=False;
+}
+
+
+void DisablePixmap(void)
+
+{
+ current->pmi=0;
+
+ if (current->use_pm)
+ XFreePixmap(display,current->pm[0]);
+
+ if (current->buffer)
+ XFreePixmap(display,current->pm[1]);
+
+ current->buffer=False;
+ current->use_pm=False;
+ current->pm[0]=current->w;
+}
+
+
+void DisableShm(void)
+{
+ use_shm=False;
+}
+
+
+void EnableBuffers(int no, ulong clscol)
+{
+ int f;
+
+ current->pmi=0;
+
+ if (current->use_pm)
+ XFreePixmap(display,current->pm[0]);
+
+ if (current->buffer)
+ XFreePixmap(display,current->pm[1]);
+
+ current->buffer=False;
+ current->use_pm=True;
+ current->multi=True;
+
+ if (no>MAXPM)
+ current->multino=MAXPM;
+ else
+ current->multino=no;
+
+ current->multicls=clscol;
+
+ WM(GXcopy);
+ FG(current->multicls);
+ for(f=0;f<current->multino;f++)
+ {
+ current->pm[f]=XCreatePixmap(display,current->w,current->ww,current->wh,
+ vinfo.depth);
+ XFillRectangle(display,current->pm[f],
+ current->gc,0,0,current->pw,current->ph);
+ }
+
+ WM(current->lastuserfunc);
+}
+
+
+void Pageflip(void)
+{
+ if (current->buffer)
+ current->pmi=current->pmi^1;
+
+ if (current->multi)
+ if ((++current->pmi)>=current->multino)
+ current->pmi=0;
+}
+
+
+void SetAsBackdrop(void)
+{
+ XSetWindowBackgroundPixmap (display, current->w, current->pm[current->pmi]);
+ XSync(display,False);
+}
+
+
+void XUseFunction(int f)
+{
+ WM(f);
+ current->lastuserfunc=f;
+}
+
+
+void XSetLineStyle(unsigned int w, int ls, int cs, int js)
+{
+ XSetLineAttributes(display,current->gc,w,ls,cs,js);
+}
+
+
+void XCls(ulong c)
+{
+ if (current->use_pm)
+ {
+ WM(GXcopy);
+ FG(c);
+ XFillRectangle(display,current->pm[current->pmi],
+ current->gc,0,0,current->pw,current->ph);
+ WM(current->lastuserfunc);
+ }
+ else
+ {
+ /*
+ XSetBackground(display,current->gc,c);
+ XClearWindow(display,current->pm[0]);
+ */
+ WM(GXcopy);
+ FG(c);
+ XFillRectangle(display,current->pm[current->pmi],
+ current->gc,0,0,current->pw,current->ph);
+ WM(current->lastuserfunc);
+ }
+}
+
+
+void XPlot(int x,int y, ulong c)
+{
+ FG(c);
+ XDrawPoint(display,current->pm[current->pmi],current->gc,x,y);
+}
+
+
+void XLine(int x1,int y1,int x2,int y2, ulong c)
+{
+ FG(c);
+ XDrawLine(display,current->pm[current->pmi],current->gc,x1,y1,x2,y2);
+}
+
+
+void SetSplineThresh(int t)
+{
+ current->spline_thresh=t;
+}
+
+
+static void XDoSpline(int x0,int y0,int x1,int y1,int x2,int y2,ulong c)
+{
+ int xa, ya, xb, yb, xc, yc, xp, yp;
+
+ if ((x0==x1==x2)&&(y0==y1==y2))
+ {
+ XPlot(x0,y0,c);
+ return;
+ }
+
+ if ((x0==x1)&&(y0==y1))
+ {
+ XLine(x1,y1,x2,y2,c);
+ return;
+ }
+
+ if ((x0==x2)&&(y0==y2))
+ {
+ XLine(x0,y0,x1,y1,c);
+ return;
+ }
+
+ if ((x1==x2)&&(y1==y2))
+ {
+ XLine(x0,y0,x2,y2,c);
+ return;
+ }
+
+ xa = ( x0 + x1 ) / 2;
+ ya = ( y0 + y1 ) / 2;
+ xc = ( x1 + x2 ) / 2;
+ yc = ( y1 + y2 ) / 2;
+ xb = ( xa + xc ) / 2;
+ yb = ( ya + yc ) / 2;
+
+ xp = ( x0 + xb ) / 2;
+ yp = ( y0 + yb ) / 2;
+
+ if ( ABS( xa - xp ) + ABS( ya - yp ) > current->spline_thresh )
+ XDoSpline(x0,y0,xa,ya,xb,yb,c);
+ else
+ XDrawLine(display,current->pm[current->pmi],current->gc,x0,y0,xb,yb);
+
+ xp = ( x2 + xb ) / 2;
+ yp = ( y2 + yb ) / 2;
+ if ( ABS( xc - xp ) + ABS( yc - yp ) > current->spline_thresh )
+ XDoSpline(xb,yb,xc,yc,x2,y2,c);
+ else
+ XDrawLine(display,current->pm[current->pmi],current->gc,xb,yb,x2,y2);
+}
+
+
+void XSpline(int x1,int y1,int x2,int y2,int x3,int y3,ulong c)
+{
+ FG(c);
+
+ if ((x1==x2==x3)&&(y1==y2==y3))
+ {
+ XPlot(x1,y1,c);
+ return;
+ }
+
+ if ((x1==x2)&&(y1==y2))
+ {
+ XLine(x2,y2,x3,y3,c);
+ return;
+ }
+
+ if ((x1==x3)&&(y1==y3))
+ {
+ XLine(x1,y1,x2,y2,c);
+ return;
+ }
+
+ if ((x2==x3)&&(y2==y3))
+ {
+ XLine(x1,y1,x3,y3,c);
+ return;
+ }
+
+ XDoSpline(x1,y1,x2,y2,x3,y3,c);
+}
+
+
+void XPrint(int x,int y, const char *s, ulong c)
+
+{
+ FG(c);
+ XDrawString(display,current->pm[current->pmi],current->gc,x,y,s,strlen(s));
+}
+
+
+void Xprintf(int x, int y, ulong colour, const char *fmt, ...)
+{
+ va_list va;
+
+ va_start(va,fmt);
+ vsprintf(prbuf,fmt,va);
+ va_end(va);
+
+ FG(colour);
+ XDrawString(display,current->pm[current->pmi],current->gc,
+ x,y,prbuf,strlen(prbuf));
+}
+
+
+void XISetFont(XImageFont n)
+{
+ switch(n)
+ {
+ case XI_FONT1:
+ xifont=xifont1;
+ break;
+ case XI_FONT2:
+ xifont=xifont2;
+ break;
+ }
+}
+
+
+static void XIPlot(XImage *img,int x,int y, ulong c)
+{
+ if ((y<0)||(y>=img->height)||(x<0)||(x>=img->width))
+ return;
+
+ XPutPixel(img,x,y,c);
+}
+
+
+void XIprintf(XImage *img, int x, int y, int sx, int sy, ulong col,
+ const char *fmt, ...)
+{
+ int f,px,py,psx,psy,ch;
+ char *data;
+ va_list arg;
+
+ va_start(arg,fmt);
+ vsprintf(prbuf,fmt,arg);
+ va_end(arg);
+
+ if ((sx==1)&&(sy==1))
+ {
+ for(f=0;f<strlen(prbuf);f++)
+ {
+ ch=prbuf[f];
+
+ for(py=0;py<XIFONTH;py++)
+ if ((y+py>=0)&&(y+py<img->height))
+ for(px=0;px<XIFONTW;px++)
+ if ((x+px>=0)&&(x+px<img->width))
+ if (xifont[ch].data[py][px])
+ XPutPixel(img,x+px,y+py,col);
+
+ x+=XIFONTW;
+ }
+ }
+ else
+ {
+ for(f=0;f<strlen(prbuf);f++)
+ {
+ ch=prbuf[f];
+
+ for(py=0;py<XIFONTH;py++)
+ for(px=0;px<XIFONTW;px++)
+ if (xifont[ch].data[py][px])
+ for(psx=0;psx<sx;psx++)
+ for(psy=0;psy<sy;psy++)
+ XPutPixel(img,x+px*sx+psx,y+py*sy+psy,col);
+
+ x+=XIFONTW*sx;
+ }
+ }
+}
+
+
+void XBox(int x,int y,int w,int h,ulong c)
+{
+ FG(c);
+ XDrawRectangle(display,current->pm[current->pmi],current->gc,x,y,w,h);
+}
+
+
+void XFillBox(int x,int y,int w,int h,ulong c)
+{
+ FG(c);
+ XFillRectangle(display,current->pm[current->pmi],current->gc,x,y,w,h);
+}
+
+
+void XCircle(int x,int y,int rx,int ry,int a1,int a2,ulong c)
+{
+ FG(c);
+ XDrawArc(display,current->pm[current->pmi],current->gc,x,y,rx,ry,a1,a2);
+}
+
+
+void XFillCircle(int x,int y,int rx,int ry,int a1,int a2,ulong c)
+{
+ FG(c);
+ XFillArc(display,current->pm[current->pmi],current->gc,x,y,rx,ry,a1,a2);
+}
+
+
+void XStartPlots(void)
+{
+ no_plots=0;
+}
+
+
+void XAddPlot(int x,int y)
+{
+ points[no_plots].x=x;
+ points[no_plots].y=y;
+
+ no_plots++;
+}
+
+
+void XPutPlots(ulong c)
+{
+ FG(c);
+ XDrawPoints(display,current->pm[current->pmi],current->gc,
+ points,no_plots,CoordModeOrigin);
+}
+
+
+void XPutPlotsAsLines(ulong c)
+{
+ FG(c);
+ XDrawLines(display,current->pm[current->pmi],current->gc,
+ points,no_plots,CoordModeOrigin);
+}
+
+
+void XFillPoly(XPoint *xp,int n,int shape,ulong c)
+{
+ FG(c);
+ XFillPolygon(display,current->pm[current->pmi],current->gc,xp,n,
+ shape,CoordModeOrigin);
+}
+
+
+void XScroll(int dx,int dy)
+{
+ int destx,desty,srcx,srcy;
+ int w,h;
+
+ if (dx>=0)
+ {
+ destx=0;
+ srcx=dx;
+ w=current->pw-dx;
+ }
+
+ if (dx<0)
+ {
+ destx=-(dx);
+ srcx=0;
+ w=current->pw+dx;
+ }
+
+ if (dy>=0)
+ {
+ desty=0;
+ srcy=dy;
+ h=current->ph-dy;
+ }
+
+ if (dy<0)
+ {
+ desty=-(dy);
+ srcy=0;
+ h=current->ph+dy;
+ }
+
+ WM(GXcopy);
+ XCopyArea(display,current->pm[current->pmi],current->pm[current->pmi],
+ current->gc,srcx,srcy,current->pw-dx,current->ph,destx,desty);
+ WM(current->lastuserfunc);
+}
+
+
+void XCopy(int sx,int sy,int w,int h,int dx,int dy)
+{
+ WM(GXcopy);
+ XCopyArea(display,current->pm[current->pmi],current->pm[current->pmi],
+ current->gc,sx,sy,current->pw,current->ph,dx,dy);
+ WM(current->lastuserfunc);
+}
+
+
+void XPut(Pixmap spm,int sx,int sy,int w,int h,int dx,int dy)
+{
+ WM(GXcopy);
+ XCopyArea(display,spm,current->pm[current->pmi],
+ current->gc,sx,sy,w,h,dx,dy);
+ WM(current->lastuserfunc);
+}
+
+
+void XGet(Pixmap dpm,int sx,int sy,int w,int h,int dx,int dy)
+{
+ WM(GXcopy);
+ XCopyArea(display,dpm,current->pm[current->pmi],
+ current->gc,sx,sy,w,h,dx,dy);
+ WM(current->lastuserfunc);
+}
+
+
+void ScreenCopy(void)
+{
+ if (current->buffer)
+ {
+ WM(GXcopy);
+ XCopyArea(display,current->pm[current->pmi^1],
+ current->pm[current->pmi],current->gc,0,0,
+ current->pw,current->ph,0,0);
+ WM(current->lastuserfunc);
+ }
+}
+
+
+Display *GetDisplay(void)
+{
+ return display;
+}
+
+
+
+void XFinished(void)
+{
+ XCloseDisplay(display);
+}
+
+
+void XDoTillButtonPress(XVoidCallback func)
+{
+ XEvent event;
+ int ignore=True;
+
+ while (True)
+ if (XPending(display))
+ {
+ XNextEvent(display,&event);
+
+ switch (event.type)
+ {
+ case Expose:
+ if (event.xexpose.count)
+ break;
+ Redraw(current->ox,current->oy);
+ break;
+
+ case ButtonPress:
+ if (event.xbutton.button)
+ if (!ignore)
+ return;
+ break;
+ }
+ }
+ else
+ if (func)
+ switch (func())
+ {
+ case XFUNCCONT:
+ ignore=False;
+ break;
+
+ case XFUNCIGNORE:
+ ignore=True;
+ break;
+
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+
+}
+
+
+void XDoMouse(XButtonCallback button, XMoveCallBack move, XVoidCallback process)
+{
+ XEvent event;
+
+ while (True)
+ if ((XPending(display))||(!process))
+ {
+ XNextEvent(display,&event);
+
+ switch (event.type)
+ {
+ case Expose:
+ if (event.xexpose.count)
+ break;
+ Redraw(current->ox,current->oy);
+ break;
+
+ case MotionNotify:
+ if (move)
+ switch(move(event.xmotion.window,
+ event.xmotion.x,event.xmotion.y))
+ {
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+ break;
+
+ case ButtonPress:
+ if (button)
+ switch(button(event.xbutton.window,XPRESS,
+ event.xbutton.button,
+ event.xbutton.x,event.xbutton.y))
+ {
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+ break;
+ }
+ }
+ else
+ if (process)
+ switch (process())
+ {
+ case XFUNCCONT:
+ case XFUNCIGNORE:
+ break;
+
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+
+}
+
+
+static int IsMoveWin(Window w, XWindowMoveCallBack call[] ,int *i)
+{
+ int f;
+
+ if (!call)
+ {
+ return(False);
+ }
+
+ f=0;
+
+ while(call[f].w)
+ {
+ if (call[f].w==w)
+ {
+ *i=f;
+ return call[f].func ? True:False;
+ }
+ else
+ {
+ f++;
+ }
+ }
+
+ return False;
+}
+
+
+static int IsButtonWin(Window w, XWindowButtonCallback call[] ,int *i)
+{
+ int f;
+
+ if (!call)
+ {
+ return(False);
+ }
+
+ f=0;
+
+ while(call[f].w)
+ {
+ if (call[f].w==w)
+ {
+ *i=f;
+ return call[f].func ? True:False;
+ }
+ else
+ {
+ f++;
+ }
+ }
+
+ return False;
+}
+
+
+static int IsKeyWin(Window w, XWindowKeyCallback call[] ,int *i)
+{
+ int f;
+
+ if (!call)
+ {
+ return(False);
+ }
+
+ f=0;
+
+ while(call[f].w)
+ {
+ if (call[f].w==w)
+ {
+ *i=f;
+ return call[f].func ? True:False;
+ }
+ else
+ {
+ f++;
+ }
+ }
+
+ return False;
+}
+
+
+void XDoWindows(XWindowButtonCallback button[],
+ XWindowMoveCallBack move[],
+ XWindowKeyCallback key[],
+ XVoidCallback process)
+{
+ int i;
+ XEvent event;
+
+ while (True)
+ if ((XPending(display))||(!process))
+ {
+ XNextEvent(display,&event);
+
+ switch (event.type)
+ {
+ case Expose:
+ if (event.xexpose.count)
+ break;
+
+ PUSHW;
+ SetCurrentWin(event.xexpose.window);
+ Redraw(current->ox,current->oy);
+ POPW;
+
+ break;
+
+ case MotionNotify:
+ if (IsMoveWin(event.xmotion.window,move,&i))
+ {
+ switch(move[i].func(event.xmotion.window,
+ event.xmotion.x,
+ event.xmotion.y))
+ {
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+ }
+ break;
+
+ case ButtonPress:
+ if (IsButtonWin(event.xbutton.window,button,&i))
+ {
+ switch(button[i].func
+ (event.xbutton.window,
+ XPRESS,
+ event.xbutton.button,
+ event.xbutton.x,event.xbutton.y))
+ {
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+ }
+ break;
+
+ case ButtonRelease:
+ if (IsButtonWin(event.xbutton.window,button,&i))
+ {
+ switch(button[i].func
+ (event.xbutton.window,
+ XRELEASE,
+ event.xbutton.button,
+ event.xbutton.x,event.xbutton.y))
+ {
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+ }
+ break;
+
+ case KeyPress:
+ if (IsKeyWin(event.xkey.window,key,&i))
+ {
+ switch(key[i].func(event.xkey.window,
+ XPRESS,
+ &event))
+ {
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+ }
+ break;
+
+ case KeyRelease:
+ if (IsKeyWin(event.xkey.window,key,&i))
+ {
+ switch(key[i].func(event.xkey.window,
+ XRELEASE,
+ &event))
+ {
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ if (process)
+ {
+ switch (process())
+ {
+ case XFUNCCONT:
+ case XFUNCIGNORE:
+ break;
+
+ case XFUNCSTOP:
+ return;
+ break;
+ }
+ }
+}
+
+
+/* Sprite routines */
+void LoadSprite(const char *fn, XSprite *spr, const XColor xc[256])
+{
+ Pixmap piximg,pixmask,pixsave;
+ int fd,x,y;
+ char magic[11];
+ unsigned char *data,*p;
+ unsigned short us;
+ GC gc;
+
+ if ((fd=open(fn,O_RDONLY))==-1)
+ {
+ WARN1("Couldn't open sprite file",fn);
+ return;
+ }
+
+ read(fd,magic,11);
+
+ if (strncmp(magic,"XbitSprite",10))
+ {
+ WARN1(fn,"is not a sprite file!");
+ close(fd);
+ return;
+ }
+
+ spr->x=spr->y=0;
+
+ read(fd,&us,sizeof(unsigned short));
+ spr->w=ntohs(us);
+ read(fd,&us,sizeof(unsigned short));
+ spr->h=ntohs(us);
+
+ if (!(data=malloc(spr->w*spr->h)))
+ {
+ WARN("Couldn't grab memory for sprite image");
+ close(fd);
+ return;
+ }
+
+ if (read(fd,data,spr->w*spr->h)!=spr->w*spr->h)
+ {
+ WARN("Couldn't load sprite image");
+ close(fd);
+ free(data);
+ return;
+ }
+
+ close(fd);
+
+ gc=XCreateGC(display,current->w,0,NULL);
+
+ XSetPlaneMask(display,gc,AllPlanes);
+ XSetGraphicsExposures(display,gc,False);
+
+ piximg=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth);
+ pixmask=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth);
+ pixsave=XCreatePixmap(display,current->w,spr->w,spr->h,vinfo.depth);
+
+ p=data;
+
+ for(y=0;y<spr->h;y++)
+ {
+ for(x=0;x<spr->w;x++)
+ {
+ XSetForeground(display,gc,xc[*p].pixel);
+ XDrawPoint(display,piximg,gc,x,y);
+
+ if (*p)
+ XSetForeground(display,gc,xb_white);
+ else
+ XSetForeground(display,gc,xb_black);
+
+ XDrawPoint(display,pixmask,gc,x,y);
+
+ p++;
+ }
+ }
+
+ spr->data=piximg;
+ spr->mask=pixmask;
+ spr->save=pixsave;
+
+ free(data);
+}
+
+
+void XDrawSprites(XSprite *spr[],int no, XSpriteControl ctl)
+{
+ int f;
+
+ WM(GXcopy);
+
+ if (!(ctl&XSPRNOSAVE))
+ for(f=0;f<no;f++)
+ if (current->buffer)
+ {
+ spr[f]->lx=spr[f]->x;
+ spr[f]->ly=spr[f]->y;
+ XCopyArea(display,current->pm[current->pmi^1],
+ spr[f]->save,current->gc,spr[f]->x,spr[f]->y,
+ spr[f]->w,spr[f]->h,0,0);
+ }
+ else
+ {
+ spr[f]->lx=spr[f]->x;
+ spr[f]->ly=spr[f]->y;
+ XCopyArea(display,current->pm[current->pmi],
+ spr[f]->save,current->gc,spr[f]->x,spr[f]->y,
+ spr[f]->w,spr[f]->h,0,0);
+ }
+
+ WM(GXand);
+ for(f=0;f<no;f++)
+ if (current->buffer)
+ XCopyArea(display,spr[f]->mask,current->pm[current->pmi^1],
+ current->gc,0,0,
+ spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y);
+ else
+ XCopyArea(display,spr[f]->mask,current->pm[current->pmi],
+ current->gc,0,0,
+ spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y);
+
+ WM(GXor);
+ for(f=0;f<no;f++)
+ if (current->buffer)
+ XCopyArea(display,spr[f]->data,current->pm[current->pmi^1],
+ current->gc,0,0,
+ spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y);
+ else
+ XCopyArea(display,spr[f]->data,current->pm[current->pmi],
+ current->gc,0,0,
+ spr[f]->w,spr[f]->h,spr[f]->x,spr[f]->y);
+
+ WM(current->lastuserfunc);
+}
+
+
+void XEraseSprites(XSprite *spr[],int no)
+{
+ int f;
+
+ WM(GXcopy);
+
+ for(f=0;f<no;f++)
+ if (current->buffer)
+ XCopyArea(display,spr[f]->save,current->pm[current->pmi^1],
+ current->gc,0,0,
+ spr[f]->w,spr[f]->h,spr[f]->lx,spr[f]->ly);
+ else
+ XCopyArea(display,spr[f]->save,current->pm[current->pmi],
+ current->gc,0,0,
+ spr[f]->w,spr[f]->h,spr[f]->lx,spr[f]->ly);
+
+ WM(current->lastuserfunc);
+}
+
+
+void LoadColormap(const char *fn, XColor xc[256])
+{
+ int fd,f;
+ unsigned short us;
+
+ if ((fd=open(fn,O_RDONLY))==-1)
+ {
+ WARN1("Couldn't open cmap",fn);
+ return;
+ }
+
+ for(f=0;f<256;f++)
+ {
+ xc[f].flags=DoRed|DoGreen|DoBlue;
+ read(fd,&us,sizeof(unsigned short));
+ xc[f].red=ntohs(us);
+ read(fd,&us,sizeof(unsigned short));
+ xc[f].green=ntohs(us);
+ read(fd,&us,sizeof(unsigned short));
+ xc[f].blue=ntohs(us);
+
+ XAllocColor(display,DefaultColormap(display,screen),xc + f);
+ }
+}
+
+
+void AllocColors(int no,ulong pix[],const char *name[])
+{
+ int f,col;
+ XColor xc;
+
+ for(f=0;f<no;f++)
+ {
+ if (XParseColor(display,DefaultColormap(display,screen),name[f],&xc))
+ {
+ if (XAllocColor(display,DefaultColormap(display,screen),&xc))
+ pix[f]=xc.pixel;
+ else
+ {
+ WARN1("couldn't allocate",name[f]);
+
+ col=0;
+
+ if (xc.flags&DoRed)
+ col+=xc.red;
+
+ if (xc.flags&DoBlue)
+ col+=xc.blue;
+
+ if (xc.flags&DoGreen)
+ col+=xc.green;
+
+ if (col>(0x8000*3))
+ {
+ WARN("defaulting to white");
+ pix[f]=WhitePixel(display,screen);
+ }
+ else
+ {
+ WARN("defaulting to black");
+ pix[f]=BlackPixel(display,screen);
+ }
+ }
+ }
+ else
+ {
+ WARN1("not a color ",name[f]);
+ pix[f]=WhitePixel(display,screen);
+ }
+ }
+}
+
+
+void AllocColorsRGB(int no, ulong pix[], const Colour col[])
+{
+ int f;
+ XColor xc;
+
+ for(f=0;f<no;f++)
+ {
+ xc.red=col[f].r;
+ xc.green=col[f].g;
+ xc.blue=col[f].b;
+ xc.flags=DoRed|DoBlue|DoGreen;
+
+ if (XAllocColor(display,DefaultColormap(display,screen),&xc))
+ pix[f]=xc.pixel;
+ else
+ {
+ WARN("couldn't allocate RGB color");
+
+ if ((col[f].r+col[f].g+col[f].b)>(0x8000*3))
+ {
+ WARN("defaulting to white");
+ pix[f]=WhitePixel(display,screen);
+ }
+ else
+ {
+ WARN("defaulting to black");
+ pix[f]=BlackPixel(display,screen);
+ }
+ }
+ }
+}
+
+
+void LoadSpriteDataSet (const char *cmapfn,
+ const char *sprfn[],
+ SpriteDataSet *set)
+{
+ int f,r,fd;
+ char magic[11];
+ XColor xcol[256];
+ Colour col[256];
+ SpriteData *spr;
+ int no;
+ int used[256];
+ unsigned short us;
+ unsigned char byte;
+
+
+ /* Allocate referenced table
+ */
+ for(f=0;f<256;f++)
+ used[f]=-1;
+
+ /* Count and allocate referenced sprites
+ */
+ no=0;
+ while(sprfn[no])
+ no++;
+
+ /* Load in colourmap
+ */
+ LoadColormap(cmapfn,xcol);
+
+ set->no_col=0;
+ set->no_spr=no;
+
+ /* Load in sprites and sort out colour usage
+ */
+ spr=malloc(sizeof(SpriteData)*no);
+
+ for(f=0;f<no;f++)
+ {
+ if ((fd=open(sprfn[f],O_RDONLY))==-1)
+ {
+ WARN1("Couldn't open sprite file",sprfn[f]);
+ exit(1);
+ return;
+ }
+
+ read(fd,magic,11);
+
+ if (strncmp(magic,"XbitSprite",10))
+ {
+ WARN1(sprfn[f],"is not a sprite file!");
+ exit(1);
+ return;
+ }
+
+ read(fd,&us,sizeof(unsigned short));
+ spr[f].w=ntohs(us);
+ read(fd,&us,sizeof(unsigned short));
+ spr[f].h=ntohs(us);
+
+ if (!(spr[f].data=malloc(spr[f].w*spr[f].h)))
+ {
+ WARN("Couldn't grab memory for sprite image");
+ exit(1);
+ }
+
+ /* Read through pixel values, stacking up colour definitions as neeed
+ */
+ for(r=0;r<(spr[f].w*spr[f].h);r++)
+ {
+ read(fd,&byte,1);
+
+ if (used[byte]==-1)
+ {
+ col[set->no_col].r=xcol[byte].red;
+ col[set->no_col].g=xcol[byte].green;
+ col[set->no_col].b=xcol[byte].blue;
+
+ used[byte]=set->no_col++;
+ }
+
+ spr[f].data[r]=used[byte];
+ }
+
+ close(fd);
+ }
+
+ /* Got all sprites - allocate and remap colours
+ */
+ AllocColoursRGB(set->no_col,set->pix,col);
+
+ /* Remap sprites
+ */
+ for(f=0;f<no;f++)
+ for(r=0;r<(spr[f].w*spr[f].h);r++)
+ spr[f].data[r]=set->pix[spr[f].data[r]];
+
+ /* Set up return, all done
+ */
+ set->spr=spr;
+}
+
+
+/* END OF FILE */
diff --git a/Xbit.h b/Xbit.h
new file mode 100644
index 0000000..bfb1ab9
--- /dev/null
+++ b/Xbit.h
@@ -0,0 +1,596 @@
+/*
+
+ lunar - Simple X11 Lunar Lander
+
+ Copyright (C) 2005 Ian Cowburn (ianc@noddybox.demon.co.uk)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ -------------------------------------------------------------------------
+
+*/
+
+#ifndef XBIT_H
+#define XBIT_H "$Id: Xbit.h 7 2005-05-13 01:01:08Z ianc $"
+
+
+/*
+ Version 2 of the Bitmap manipulation library for X
+
+ Now supports :
+
+ Multiple windows
+ Pixmaps bigger than the window
+ Mutiple pixmap buffers (upto a maxim of 256 per window)
+ XImage print routines
+ Better XImage support, defaulting to shared memory usage.
+
+ IMPORTANT NOTES ON MIT-SHM SUPPORT :
+
+ 1. Only call CreateXImage() ONCE per window.
+
+ 2. If you wish resources to be freed properly on completion, it
+ is important that DestroyXImage() is called before exiting
+ with the window the XImage was created in relation to set
+ as the current window.
+
+ 3. Allow the user to toggle MIT-SHM from a switch, as if the
+ server supports it, but using it is failing for some other
+ reason, then your program will be unable to run.
+
+*/
+#include <X11/X.h>
+#include <X11/Xlib.h>
+
+
+/* Just as I'm a lazy typer
+*/
+typedef unsigned char uchar;
+typedef unsigned long ulong;
+
+
+/* Maximums for PutPlots()
+*/
+#define MAX_PUTPLOTS 4096
+
+
+/* Types and constants
+*/
+#define MIN_ANG 0
+#define MAX_ANG 23040
+
+typedef enum
+{
+ XFUNCCONT,
+ XFUNCIGNORE,
+ XFUNCSTOP
+} XFuncControl;
+
+typedef struct
+{
+ int x,y;
+ unsigned short w,h;
+ int lx,ly; /* This field is 'private' */
+ Pixmap data; /* This field is 'private' */
+ Pixmap mask; /* This field is 'private' */
+ Pixmap save; /* This field is 'private' */
+} XSprite;
+
+typedef enum
+{
+ XSPRSAVE,
+ XSPRNOSAVE
+} XSpriteControl;
+
+
+typedef struct
+{
+ int r,g,b;
+} Colour;
+
+typedef Colour Color;
+
+
+typedef enum
+{
+ XPRESS,
+ XRELEASE
+} XPressRelease;
+
+
+typedef XFuncControl (*XVoidCallback)(void);
+typedef XFuncControl (*XMoveCallBack)(Window w, int x, int y);
+typedef XFuncControl (*XButtonCallback)(Window w, XPressRelease mode,
+ int button, int x, int y);
+typedef XFuncControl (*XKeyCallback)(Window w, XPressRelease mode,
+ XEvent *event);
+
+typedef struct
+{
+ Window w;
+ XMoveCallBack func;
+} XWindowMoveCallBack;
+
+typedef struct
+{
+ Window w;
+ XButtonCallback func;
+} XWindowButtonCallback;
+
+typedef struct
+{
+ Window w;
+ XKeyCallback func;
+} XWindowKeyCallback;
+
+
+/* XImage font defs
+*/
+typedef enum
+{
+ XI_FONT1,
+ XI_FONT2
+} XImageFont;
+
+
+/* Portable sprite data definitions - allows sprite data and colormap data to
+ be read from a list of files, returning
+ an array of RGB triplets defining the
+ colormap, and array of pixels
+ corresponding to those colours and a
+ series of sprite images with converted
+ pixel values. This means you can use
+ data normally read in just for the
+ XSprite routines on any format of display
+ mechanism.
+*/
+#define SPRD_AT(spr,x,y) (*(spr.data+(x)+((y)*(spr.w))))
+
+typedef struct
+{
+ int w,h; /* Width, height */
+ ulong *data; /* Data */
+} SpriteData;
+
+typedef struct
+{
+ int no_col; /* No of colours used by sprites */
+ ulong pix[256]; /* Array of pixel values */
+ int no_spr;
+ SpriteData *spr; /* Array of sprite data */
+} SpriteDataSet;
+
+
+/* Function Prototypes
+*/
+
+Window OpenWin
+ (
+ int argc,
+ char *argv[],
+ char *title,
+ int Win_X,
+ int Win_Y,
+ int Win_Width,
+ int Win_Height,
+ int Pix_Width,
+ int Pix_Height,
+ unsigned long event_mask,
+ XSizeHints *hints,
+ ulong *black,
+ ulong *white
+ );
+
+Window OpenRootWin
+ (
+ ulong *black, ulong *white,
+ int *w, int *h, int Pix_Width, int Pix_Height
+ );
+
+void SetCurrentWin
+ (
+ Window w
+ );
+
+int GetVisualDepth(void);
+
+XImage *CreateXImage(void);
+
+void ClsXImage
+ (
+ XImage *img
+ );
+
+void DestroyXImage
+ (
+ XImage *img
+ );
+
+XFontStruct
+ *XUseFont
+ (
+ const char *font_name
+ );
+
+void XUseCursor
+ (
+ const char *bitmap_filename,
+ const char *mask_filename,
+ XColor fg,
+ XColor bg
+ );
+
+void SetAsBackdrop(void);
+
+void DisableDoubleBuffer(void);
+
+void DisablePixmap(void);
+
+void DisableShm(void);
+
+void EnableBuffers
+ (
+ int no,
+ ulong clscol
+ );
+
+void LoadBitmap
+ (
+ const char *fn,
+ int x,
+ int y,
+ int resize
+ );
+
+Pixmap GetBitmap
+ (
+ const char *fn,
+ int *width,
+ int *height,
+ int *hot_x,
+ int *hot_y
+ );
+
+/* These 2 are for manipulating your own XImage structures
+*/
+Pixmap GetCurrentPixmap(void);
+GC GetCurrentGC(void);
+
+void Redraw
+ (
+ int off_x,
+ int off_y
+ );
+
+void DrawXImage
+ (
+ XImage *img
+ );
+
+/* Note that if this used with EnableBuffers() on, this will move to the next
+ buffer
+*/
+void Pageflip(void);
+
+void Resize
+ (
+ int pix_w,
+ int pix_h
+ );
+
+void XSetLineStyle
+ (
+ unsigned int line_width,
+ int line_style,
+ int cap_style,
+ int join_style
+ );
+
+void XUseFunction
+ (
+ int GC_function
+ );
+
+void XCls
+ (
+ ulong colour
+ );
+
+void XPlot
+ (
+ int x,
+ int y,
+ ulong colour
+ );
+
+void XLine
+ (
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ ulong colour
+ );
+
+void SetSplineThresh
+ (
+ int thresh
+ );
+
+void XSpline
+ (
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ int x3,
+ int y3,
+ ulong colour
+ );
+
+void XPrint
+ (
+ int x,
+ int y,
+ const char *string,
+ ulong colour
+ );
+
+void Xprintf
+ (
+ int x,
+ int y,
+ ulong colour,
+ const char *fmt,
+ ...
+ );
+
+void XISetFont
+ (
+ XImageFont font_no
+ );
+
+void XIprintf
+ (
+ XImage *img,
+ int x,
+ int y,
+ int scale_x,
+ int scale_y,
+ ulong colour,
+ const char *fmt,
+ ...
+ );
+
+void XBox
+ (
+ int x,
+ int y,
+ int w,
+ int h,
+ ulong colour
+ );
+
+void XFillBox
+ (
+ int x,
+ int y,
+ int w,
+ int h,
+ ulong colour
+ );
+
+void XCircle
+ (
+ int x,
+ int y,
+ int rx,
+ int ry,
+ int ang1,
+ int ang2,
+ ulong colour
+ );
+
+void XFillCircle
+ (
+ int x,
+ int y,
+ int rx,
+ int ry,
+ int ang1,
+ int ang2,
+ ulong colour
+ );
+
+void XStartPlots(void);
+
+void XAddPlot
+ (
+ int x,
+ int y
+ );
+
+void XPutPlots
+ (
+ ulong col
+ );
+
+void XPutPlotsAsLines
+ (
+ ulong col
+ );
+
+void XFillPoly
+ (
+ XPoint xp[],
+ int no_points,
+ int shape,
+ ulong col
+ );
+
+void XScroll
+ (
+ int dx,
+ int dy
+ );
+
+void XCopy
+ (
+ int srcx,
+ int srcy,
+ int w,
+ int h,
+ int destx,
+ int desty
+ );
+
+void XPut
+ (
+ Pixmap src,
+ int srcx,
+ int srcy,
+ int w,
+ int h,
+ int destx,
+ int desty
+ );
+
+void XGet
+ (
+ Pixmap dest,
+ int srcx,
+ int srcy,
+ int w,
+ int h,
+ int destx,
+ int desty
+ );
+
+void ScreenCopy(void);
+
+Display *GetDisplay(void);
+
+void XFinished(void);
+
+/* The following event routines expect mouse events to be set in the
+ event mask */
+
+void XDoTillButtonPress
+ (
+ XVoidCallback func
+ );
+
+void XDoMouse
+ (
+ XButtonCallback mouse_button,
+ XMoveCallBack mouse_movement,
+ XVoidCallback process
+ );
+
+void XDoWindows
+ (
+ XWindowButtonCallback mouse_button[],
+ XWindowMoveCallBack mouse_movement[],
+ XWindowKeyCallback key_press[],
+ XFuncControl (*process) ()
+ );
+
+
+/* Sprite routines */
+void LoadSprite
+ (
+ const char *filename,
+ XSprite *sprite,
+ const XColor xc[256]
+ );
+
+
+void XDrawSprites
+ (
+ XSprite *sprites[],
+ int no,
+ XSpriteControl control
+ );
+
+void XEraseSprites
+ (
+ XSprite *sprites[],
+ int no
+ );
+
+void LoadColormap
+ (
+ const char *filename,
+ XColor xc[256]
+ );
+
+#define AllocColors AllocColours
+void AllocColours
+ (
+ int no,
+ ulong pixels[],
+ const char *colname[]
+ );
+
+#define AllocColorsRGB AllocColoursRGB
+void AllocColoursRGB
+ (
+ int no,
+ ulong pixels[],
+ const Colour cols[]
+ );
+
+void LoadSpriteDataSet
+ (
+ const char *cmap_filename,
+ const char *sprite_filenames[],
+ SpriteDataSet *set
+ );
+
+
+/*
+
+ File Formats:
+
+ NB: all ushorts are stored in network format. See ntohs(3).
+
+ Colormap:
+
+ red.ushort - Red component color 0
+ green.ushort - Red component color 0
+ blue.ushort - Red component color 0
+ ...
+ ...
+ red.ushort - Red component color 255
+ green.ushort - Red component color 255
+ blue.ushort - Red component color 255
+
+
+ Sprite:
+
+ "XbitSprite" - Magic string (NULL terminated)
+ width.ushort - width of sprite
+ height.ushort - height of sprite
+ byte.uchar - Pixel value for (0,0)
+ byte.uchar - Pixel value for (1,0)
+ ...
+ ...
+ byte.uchar - Pixel value for (width-1,height-1)
+
+*/
+
+#endif
+
+/* END OF FILE */
diff --git a/dash.c b/dash.c
new file mode 100644
index 0000000..0c124ce
--- /dev/null
+++ b/dash.c
@@ -0,0 +1,3400 @@
+/*
+
+ Simple boulder dash clone for X11/xlib/curses
+
+ Needs a fast-ish machine - uses quite a few raster scans of the level
+ on each game cycle.
+
+ ...And the curses/X pointer code could be neater and better thought out...
+
+ ... It is only a hack though :-) ...
+
+*/
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xos.h>
+#include <X11/Xatom.h>
+#include <X11/keysym.h>
+
+#include <curses.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <memory.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <math.h>
+#include <signal.h>
+
+#include <stdarg.h>
+
+#include "Xbit.h"
+
+#define WINX 100
+#define WINY 100
+#define WINW 640
+#define WINH 400
+
+#define RND(x) ((rand())%(x))
+
+/* Slightly roundabout, but allows us to test the op
+*/
+#ifdef NOUSLEEP
+# define USLEEP(x) LocalUsleep(x)
+#else
+# define USLEEP(x) usleep(x)
+#endif
+
+XSizeHints size_hints;
+ulong black,white;
+Display *disp;
+Window window;
+Colormap cm;
+XFontStruct *font;
+
+char *GetPath(),
+ *GetFXPath(),
+ *GetLevelPath(),
+ *GetLibPath();
+
+#define SPACESPRNAME "space"
+#define EARTHSPRNAME "earth"
+#define ROCKSPRNAME "rock"
+#define ROCKFALLSPRNAME ROCKSPRNAME
+#define TUFFWALLSPRNAME "tuffwall"
+#define WALLSPRNAME "wall"
+#define GEMSPRNAME "diamond"
+#define GEMFALLSPRNAME GEMSPRNAME
+#define HEROSPRNAME "miner"
+#define EXITSPRNAME "exit"
+#define BUTTSPRNAME "butterfly"
+#define CHSRSPRNAME "chaser"
+#define ROCKSWSPRNAME "rockswitch"
+#define ONEUPSPRNAME "oneup"
+#define FILTERSPRNAME "filter"
+#define AMOEBASPRNAME "amoeba"
+#define ROCKGENSPRNAME "rockgen"
+#define BUTTGENSPRNAME "butterflygen"
+#define CHSRGENSPRNAME "chasergen"
+
+#define SPACEGLY ' '
+#define EARTHGLY '.'
+#define ROCKGLY '@'
+#define TUFFWALLGLY '%'
+#define WALLGLY '#'
+#define GEMGLY '*'
+#define HEROGLY 'R'
+#define EXITGLY 'E'
+#define BUTTGLY 'B'
+#define CHSRGLY 'C'
+#define ROCKSWGLY '!'
+#define ONEUPGLY '&'
+#define FILTERGLY '$'
+#define AMOEBAGLY 'A'
+#define ROCKGENGLY 'r'
+#define BUTTGENGLY 'b'
+#define CHSRGENGLY 'c'
+
+#define SPACESPR 0
+#define EARTHSPR 1
+#define ROCKSPR 2
+#define TUFFWALLSPR 3
+#define WALLSPR 4
+#define GEMSPR 5
+#define HEROSPR 6
+#define EXITSPR 7
+#define ROCKFALLSPR 8
+#define GEMFALLSPR 9
+#define BUTTSPR 10
+#define CHSRSPR 11
+#define ROCKSWSPR 12
+#define ONEUPSPR 13
+#define FILTERSPR 14
+#define AMOEBASPR 15
+#define ROCKGENSPR 16
+#define BUTTGENSPR 17
+#define CHSRGENSPR 18
+#define NOSPR 19
+
+#define VOIDSPR -1
+
+#define X(x) ((x)*chsz)
+#define Y(y) ((y)*chsz)
+
+#define SCRX 40
+#define SCRY 24
+
+typedef struct
+ {
+ char *name;
+ Pixmap p;
+ } sprite;
+
+sprite spr[NOSPR]=
+ {
+ {SPACESPRNAME,0},
+ {EARTHSPRNAME,0},
+ {ROCKSPRNAME,0},
+ {TUFFWALLSPRNAME,0},
+ {WALLSPRNAME,0},
+ {GEMSPRNAME,0},
+ {HEROSPRNAME,0},
+ {EXITSPRNAME,0},
+ {ROCKFALLSPRNAME,0},
+ {GEMFALLSPRNAME,0},
+ {BUTTSPRNAME,0},
+ {CHSRSPRNAME,0},
+ {ROCKSWSPRNAME,0},
+ {ONEUPSPRNAME,0},
+ {FILTERSPRNAME,0},
+ {AMOEBASPRNAME,0},
+ {ROCKGENSPRNAME,0},
+ {BUTTGENSPRNAME,0},
+ {CHSRGENSPRNAME,0}
+ };
+
+char glyph_map[NOSPR]=
+ {
+ /* SPACESPR */ ' ',
+ /* EARTHSPR */ '.',
+ /* ROCKSPR */ '@',
+ /* TUFFWALLSPR */ '#',
+ /* WALLSPR */ '+',
+ /* GEMSPR */ '*',
+ /* HEROSPR */ '&',
+ /* EXITSPR */ 'E',
+ /* ROCKFALLSPR */ '@',
+ /* GEMFALLSPR */ '*',
+ /* BUTTSPR */ '%',
+ /* CHSRSPR */ '"',
+ /* ROCKSWSPR */ '^',
+ /* ONEUPSPR */ '$',
+ /* FILTERSPR */ '=',
+ /* AMOEBASPR */ '~',
+ /* ROCKGENSPR */ '+',
+ /* BUTTGENSPR */ '+',
+ /* CHSRGENSPR */ '+'
+ };
+
+#define MAX_ENEMY 2000
+#define MAX_GENERATOR 100
+
+typedef struct
+ {
+ int alive;
+ int type;
+ int x,y;
+ int dir;
+ int moved;
+ } Enemy;
+
+typedef struct
+ {
+ int cycle;
+ int type;
+ int x,y;
+ } Generator;
+
+Enemy enemy[MAX_ENEMY];
+Generator generator[MAX_GENERATOR];
+int no_enemy;
+int no_generator;
+
+
+#define AMOEBA_COUNT 5
+
+typedef struct
+ {
+ int alive;
+ int count;
+ int size;
+ int could_move;
+ } Amoeba;
+
+Amoeba amoeba;
+int max_amoeba_size;
+int amoeba_move_chance;
+
+
+#define WELLDONELEV -1
+#define TRYAGAINLEV -2
+
+typedef struct
+ {
+ int sx,sy;
+ int ex,ey;
+ int x,y;
+ int time;
+ int no;
+ int toget;
+ int w,h;
+ char *name;
+ char *data;
+ } Level;
+
+
+#define NONE -1
+#define UP 0
+#define RIGHT 1
+#define DOWN 2
+#define LEFT 3
+
+#define ROT_RIGHT(d) ((((d)+1)>LEFT) ? (UP) : ((d)+1))
+#define ROT_LEFT(d) ((((d)-1)<UP) ? (LEFT) : ((d)-1))
+#define ROT_FLIP(d) (((d)+2)%4)
+
+struct
+ {
+ int x,y;
+ } move_tbl[4]=
+ {
+ {0,-1},
+ {1,0},
+ {0,1},
+ {-1,0}
+ };
+
+#define MAX_HISCORE 10
+#define HINAMELEN 32
+
+typedef struct
+ {
+ int score;
+ char name[HINAMELEN+1];
+ int level;
+ } hiscore;
+
+hiscore hisc[MAX_HISCORE]=
+ {
+ {10000,"Score 1",1},
+ {9000,"Score 2",2},
+ {8000,"Score 3",3},
+ {7000,"Score 4",4},
+ {6000,"Score 5",5},
+ {5000,"Score 6",6},
+ {4000,"Score 7",7},
+ {3000,"Score 8",8},
+ {2000,"Score 9",9},
+ {1000,"Score 10",10}
+ };
+
+int chsz=16;
+int slp=-1;
+int bw=False;
+int startlev=1;
+int cursesmode=False;
+
+double si[360];
+double co[360];
+
+int level=1;
+int score=0;
+int no_levels=0;
+int lives=3;
+int quit=False;
+int dead=False;
+Level lev;
+int fr_flag;
+int title_fr;
+#define AT(a,b) *((lev.data)+(a)+((lev.w)*(b)))
+
+
+/* Curses/X mode function calls */
+int (*TitlePage)()=NULL;
+int (*Cls)()=NULL; /* Cls(int colour) */
+int (*Put)()=NULL; /* Put(int x,y,SprNum) */
+int (*Centre)()=NULL; /* Centre(char *str;int y,col) */
+int (*Update)()=NULL;
+int (*Repaint)()=NULL; /* Repaint (int full_flag) */
+int (*Printf)()=NULL; /* Printf(x,y,col,fmt,....) */
+int (*IntroLevel)()=NULL;
+int (*PlayLevel)()=NULL;
+int (*LevelWon)()=NULL;
+int (*LevelLost)()=NULL;
+int (*GameWon)()=NULL;
+int (*GameLost)()=NULL;
+int (*Show)()=NULL; /* Show(int (*func)(),sleep_fl,quit_fl) */
+int (*EndWindowing)()=NULL;
+
+/* X Versions */
+int XTitle();
+/* int XCls(); */
+int PutX();
+int XCentre();
+int XUpdate();
+int XRepaint();
+/* int Xprintf(); */
+int XIntroLevel();
+int XPlayLevel();
+int LevelOk();
+int LevelNotOk();
+int XGameOverWon();
+int XGameOverLost();
+int DoTillPress();
+int XEndWindowing();
+
+/* Curses Versions */
+int CursesTitle();
+int CursesCls();
+int CursesPut();
+int CursesCentre();
+int CursesRedraw();
+int CursesRepaint();
+int CursesPrintf(int x, int y, int c, const char *fmt, ...);
+int CursesIntroLevel();
+int CursesPlayLevel();
+/* int LevelOk(); */
+/* int LevelNotOk(); */
+int CursesGameOverWon();
+int CursesGameOverLost();
+int CursesDoTillPress();
+int CursesEndWindowing();
+
+
+int main(argc,argv)
+int argc;
+char *argv[];
+
+{
+ int f;
+ XEvent event;
+ unsigned long evmask;
+ void IntrHandler();
+
+ umask(000);
+ signal(SIGINT,IntrHandler);
+
+ for(f=0;f<360;f++)
+ {
+ co[f]=cos((M_PI/180.0)*f);
+ si[f]=sin((M_PI/180.0)*f);
+ }
+
+ f=1;
+ while(f<argc)
+ {
+ if(!strcmp(argv[f],"-s"))
+ {
+ chsz=8;
+ f++;
+ }
+ else if (!strcmp(argv[f],"-d"))
+ {
+ slp=atoi(argv[f+1]);
+ f+=2;
+ }
+ else if (!strcmp(argv[f],"-l"))
+ {
+ startlev=atoi(argv[f+1]);
+ f+=2;
+ }
+ else if (!strcmp(argv[f],"-b"))
+ {
+ bw=True;
+ f++;
+ }
+ else if (!strcmp(argv[f],"-c"))
+ {
+ cursesmode=True;
+ f++;
+ }
+ else if (!strcmp(argv[f],"-h"))
+ {
+ LoadScores();
+ printf("%3s %7s %-*s %3s\n",
+ "Pos","Score",HINAMELEN,"Name","Level");
+
+ for(f=0;f<MAX_HISCORE;f++)
+ printf("%3d %7d %-*s %3d\n",
+ f+1,hisc[f].score,HINAMELEN,hisc[f].name,hisc[f].level);
+ Exit(0);
+ }
+ else
+ {
+ fprintf(stderr,"%s: usage %s [switches]\n",argv[0],argv[0]);
+ fprintf(stderr,"-s Use small version\n");
+ fprintf(stderr,"-b Use black and white sprites\n");
+ fprintf(stderr,"-d delay usleep() by delay for fast servers\n");
+ fprintf(stderr,"-l lev start from level lev\n");
+ fprintf(stderr,"-c use curses on tty (not yet perfect)\n");
+ fprintf(stderr,"-h Dump hi-score table\n");
+ Exit(1);
+ }
+ }
+
+ srand(getpid());
+
+ if (!cursesmode)
+ {
+ TitlePage=XTitle;
+ Cls=XCls;
+ Put=PutX;
+ Centre=XCentre;
+ Update=XUpdate;
+ Repaint=XRepaint;
+ Printf=Xprintf;
+ IntroLevel=XIntroLevel;
+ PlayLevel=XPlayLevel;
+ LevelWon=LevelOk;
+ LevelLost=LevelNotOk;
+ GameWon=XGameOverWon;
+ GameLost=XGameOverLost;
+ Show=DoTillPress;
+ EndWindowing=XEndWindowing;
+
+ size_hints.flags=PPosition|PSize|PMinSize|PMaxSize;
+ size_hints.x=WINX;
+ size_hints.y=WINY;
+ size_hints.width=size_hints.min_width=X(SCRX);
+ size_hints.height=size_hints.min_height=Y(SCRY);
+ size_hints.max_width=X(SCRX);
+ size_hints.max_height=Y(SCRY);
+
+ evmask=ButtonPressMask|KeyPressMask|KeyReleaseMask;
+
+ window=OpenWin(argc,argv,argv[0],
+ WINX,WINY,X(SCRX),Y(SCRY),
+ 0,0,
+ evmask,
+ &size_hints,&black,&white);
+
+ DisableDoubleBuffer();
+
+ disp=GetDisplay();
+
+ if (chsz==16)
+ font=XUseFont("8x13bold" /*"fixed-screen-b-14"*/);
+ else
+ font=XUseFont("5x8");
+
+ if (bw)
+ LoadSpritesBW();
+ else
+ LoadSprites();
+ }
+ else
+ {
+ chsz=1;
+ initscr();
+
+ if ((LINES<SCRY)||(COLS<SCRX))
+ {
+ endwin();
+ fprintf(stderr,"%s: expect at least a %dx%d terminal...\n",
+ argv[0],SCRX,SCRY);
+ Exit(1);
+ }
+
+ cbreak();
+ noecho();
+ nonl();
+ nodelay(stdscr,TRUE);
+ intrflush(stdscr, FALSE);
+ keypad(stdscr, TRUE);
+ clear();
+
+ TitlePage=XTitle;
+ Cls=CursesCls;
+ Put=CursesPut;
+ Centre=CursesCentre;
+ Update=CursesRedraw;
+ Repaint=CursesRepaint;
+ Printf=CursesPrintf;
+ IntroLevel=CursesIntroLevel;
+ PlayLevel=CursesPlayLevel;
+ LevelWon=LevelOk;
+ LevelLost=LevelNotOk;
+ GameWon=CursesGameOverWon;
+ GameLost=CursesGameOverLost;
+ Show=CursesDoTillPress;
+ EndWindowing=CursesEndWindowing;
+ }
+
+ LoadLevelNo();
+
+ lev.name=lev.data=NULL;
+
+ AutoOff();
+
+ (*Cls)(black);
+ title_fr=True;
+ (*Show)(TitlePage,False,True);
+
+ while(!quit)
+ {
+ level=startlev;
+ lives=3;
+ score=0;
+ dead=False;
+
+ do
+ {
+ LoadLevel(level);
+ (*Show)(IntroLevel,False,False);
+
+ fr_flag=True; /* Wish I had client data in my XFunc stuff... */
+
+ if ((*PlayLevel)())
+ {
+ if (lev.time>0)
+ while(lev.time)
+ {
+ lev.time--;
+ score+=5;
+ DrawScore();
+ (*Update)();
+ }
+
+ for(f=0;f<level*1000;f+=100)
+ {
+ score+=100;
+ DrawScore();
+ (*Update)();
+ }
+
+ level++;
+ (*Show)(LevelOk,True,False);
+ }
+ else
+ {
+ lives--;
+ if (lives>-1)
+ (*Show)(LevelNotOk,True,False);
+ }
+ } while ((lives>-1)&&(level<=no_levels));
+
+ (*Cls)(black);
+
+ if (lives==-1)
+ (*GameLost)();
+ else
+ (*GameWon)();
+
+ if(score>hisc[MAX_HISCORE-1].score)
+ EnterHiscore();
+
+ (*Cls)(black);
+ title_fr=True;
+ (*Show)(TitlePage,False,True);
+ }
+
+ AutoOn();
+
+ (*EndWindowing)();
+}
+
+
+void IntrHandler()
+{
+ if (EndWindowing)
+ (*EndWindowing)();
+
+ AutoOn();
+
+ exit(0);
+}
+
+/* --------------------------------------------------------------------- */
+
+
+AutoOff()
+
+{
+ if (!cursesmode)
+ {
+ XAutoRepeatOff(disp);
+ (*Update)();
+ }
+}
+
+
+AutoOn()
+
+{
+ if (!cursesmode)
+ {
+ XAutoRepeatOn(disp);
+ (*Update)();
+ }
+}
+
+
+/* --------------------------------------------------------------------- */
+
+char *GetPath()
+{
+ static char *env=NULL;
+ char *p;
+
+ if (!env)
+ {
+ if (p=getenv("DASHPATH"))
+ {
+ env=malloc(strlen(p)+5);
+
+ strcpy(env,p);
+
+ if (env[strlen(env)-1]!='/')
+ strcat(env,"/");
+ }
+ else
+ env=strdup("./");
+ }
+
+ return(env);
+}
+
+
+char *GetFXPath(s)
+char *s;
+
+{
+ static char r[256];
+ char *p;
+
+ strcpy(r,GetPath());
+
+ if (bw)
+ {
+ if (chsz==16)
+ strcat(r,"GFX16/");
+ else
+ strcat(r,"GFX8/");
+ }
+ else
+ {
+ if (chsz==16)
+ strcat(r,"GFX16COL/");
+ else
+ strcat(r,"GFX8COL/");
+ }
+
+ strcat(r,s);
+
+ return(r);
+}
+
+
+char *GetLevelPath(s)
+char *s;
+
+{
+ static char r[256];
+ char *p;
+
+ strcpy(r,GetPath());
+
+ if (cursesmode)
+ strcat(r,"CLEVELS/");
+ else
+ strcat(r,"XLEVELS/");
+
+ strcat(r,s);
+
+ return(r);
+}
+
+
+char *GetLibPath(s)
+char *s;
+
+{
+ static char r[256];
+ char *p;
+
+ strcpy(r,GetPath());
+
+ strcat(r,"lib/");
+
+ strcat(r,s);
+
+ return(r);
+}
+
+
+LoadScores()
+
+{
+ int fd,f;
+
+ if ((fd=open(GetLibPath("score"),O_RDONLY))==-1)
+ return;
+
+ for(f=0;f<MAX_HISCORE;f++)
+ read(fd,&hisc[f],sizeof(hiscore));
+
+ close(fd);
+}
+
+
+SaveScores()
+
+{
+ int fd,f;
+
+ if ((fd=open(GetLibPath("score"),O_CREAT|O_WRONLY|O_TRUNC,0666))==-1)
+ return;
+
+ for(f=0;f<MAX_HISCORE;f++)
+ write(fd,&hisc[f],sizeof(hiscore));
+
+ close(fd);
+}
+
+
+LoadSpritesBW()
+
+{
+ int f,w,h,x,y;
+
+ for(f=0;f<NOSPR;f++)
+ spr[f].p=GetBitmap(GetFXPath(spr[f].name),&w,&h,&x,&y);
+}
+
+
+LoadSprites()
+
+{
+ XColor xc[256];
+ XSprite s;
+ int f,w,h,x,y;
+
+ LoadColormap(GetFXPath("colormap"),xc);
+
+ /*
+ cm=XCreateColormap(disp,window,DefaultVisual(disp,0),AllocAll);
+ XSetWindowColormap(disp,window,cm);
+ XStoreColors(disp,cm,xc,256);
+ */
+
+ for(f=0;f<NOSPR;f++)
+ {
+ LoadSprite(GetFXPath(spr[f].name),&s,xc);
+ spr[f].p=s.data;
+ }
+}
+
+
+LoadLevelNo()
+
+{
+ FILE *fp;
+
+ if (!(fp=fopen(GetLevelPath("NO"),"r")))
+ {
+ fprintf(stderr,"Couldn't read %s\n",GetLevelPath("NO"));
+ Exit(1);
+ }
+
+ fscanf(fp,"%d",&no_levels);
+
+ fclose(fp);
+}
+
+
+LoadLevel(l)
+int l;
+
+{
+ char s[256];
+ FILE *fp;
+ int x,y,f,tg;
+ long oldpos;
+
+ sprintf(s,"%d",l);
+
+ if (!(fp=fopen(GetLevelPath(s),"r")))
+ {
+ fprintf(stderr,"Couldn't read LEVELS/%d\n",l);
+ AutoOn();
+ Exit(1);
+ }
+
+ if (lev.name)
+ {
+ free(lev.name);
+ free(lev.data);
+ }
+
+ no_enemy=0;
+ for(f=0;f<MAX_ENEMY;f++)
+ enemy[f].alive=False;
+
+ no_generator=0;
+
+ amoeba.alive=False;
+
+ fgets(s,256,fp);
+
+ s[strlen(s)-1]=NULL;
+ lev.name=strdup(s);
+
+ fgets(s,256,fp);
+ sscanf(s,"%d,%d",&lev.x,&lev.y);
+
+ fgets(s,256,fp);
+ sscanf(s,"%d",&lev.toget);
+ lev.no=0;
+
+ if (!lev.toget)
+ tg=True;
+ else
+ tg=False;
+
+ fgets(s,256,fp);
+ sscanf(s,"%d",&lev.time);
+
+ fgets(s,256,fp);
+ sscanf(s,"%d,%d",&max_amoeba_size,&amoeba_move_chance);
+
+ x=y=0;
+ lev.sx=lev.sy=-1;
+ lev.ex=lev.ey=-1;
+
+ oldpos=ftell(fp);
+
+ fgets(s,256,fp);
+ lev.w=strlen(s)-1;
+
+ lev.h=0;
+ fgets(s,256,fp);
+ while(!feof(fp))
+ {
+ lev.h++;
+ fgets(s,256,fp);
+ }
+
+ clearerr(fp);
+ fseek(fp,oldpos,0);
+
+ lev.data=(char *)malloc(lev.w*lev.h);
+
+ fgets(s,256,fp);
+
+ for(y=0;y<lev.h;y++)
+ {
+ s[strlen(s)-1]=NULL;
+ if (strlen(s)!=lev.w)
+ {
+ fprintf(stderr,"Corrupt level file!\n");
+ AutoOn();
+ Exit(1);
+ }
+
+ if (feof(fp))
+ {
+ fprintf(stderr,"Corrupt level file!\n");
+ AutoOn();
+ Exit(1);
+ }
+
+ x=0;
+ for(f=0;f<strlen(s);f++,x++)
+ switch (s[f])
+ {
+ case SPACEGLY:
+ AT(x,y)=SPACESPR;
+ break;
+ case EARTHGLY:
+ AT(x,y)=EARTHSPR;
+ break;
+ case ROCKGLY:
+ AT(x,y)=ROCKSPR;
+ break;
+ case TUFFWALLGLY:
+ AT(x,y)=TUFFWALLSPR;
+ break;
+ case WALLGLY:
+ AT(x,y)=WALLSPR;
+ break;
+ case GEMGLY:
+ AT(x,y)=GEMSPR;
+ if (tg)
+ lev.toget++;
+ break;
+ case HEROGLY:
+ AT(x,y)=EARTHSPR;
+ lev.sx=x;
+ lev.sy=y;
+ break;
+ case EXITGLY:
+ AT(x,y)=EXITSPR;
+ lev.ex=x;
+ lev.ey=y;
+ break;
+ case BUTTGLY:
+ AT(x,y)=BUTTSPR;
+ enemy[no_enemy].alive=True;
+ enemy[no_enemy].type=BUTTSPR;
+ enemy[no_enemy].x=x;
+ enemy[no_enemy].y=y;
+ enemy[no_enemy].dir=UP;
+ enemy[no_enemy].moved=False;
+ if ((++no_enemy)>MAX_ENEMY)
+ {
+ fprintf(stderr,"Error! To many enemies level file!\n");
+ AutoOn();
+ Exit(1);
+ }
+ break;
+ case CHSRGLY:
+ AT(x,y)=CHSRSPR;
+ enemy[no_enemy].alive=True;
+ enemy[no_enemy].type=CHSRSPR;
+ enemy[no_enemy].x=x;
+ enemy[no_enemy].y=y;
+ enemy[no_enemy].dir=UP;
+ enemy[no_enemy].moved=False;
+ if ((++no_enemy)>MAX_ENEMY)
+ {
+ fprintf(stderr,"Error! To many enemies level file!\n");
+ AutoOn();
+ Exit(1);
+ }
+ break;
+ case ROCKSWGLY:
+ AT(x,y)=ROCKSWSPR;
+ break;
+ case ONEUPGLY:
+ AT(x,y)=ONEUPSPR;
+ break;
+ case FILTERGLY:
+ AT(x,y)=FILTERSPR;
+ break;
+ case AMOEBAGLY:
+ AT(x,y)=AMOEBASPR;
+ if (amoeba.alive)
+ {
+ amoeba.size++;
+ }
+ else
+ {
+ amoeba.alive=True;
+ amoeba.size=1;
+ amoeba.count=AMOEBA_COUNT;
+ amoeba.could_move=False;
+ }
+ break;
+ case ROCKGENGLY:
+ AT(x,y)=ROCKGENSPR;
+ generator[no_generator].cycle=0;
+ generator[no_generator].type=ROCKGENSPR;
+ generator[no_generator].x=x;
+ generator[no_generator].y=y;
+ if ((++no_generator)>MAX_GENERATOR)
+ {
+ fprintf(stderr,"Error! To many generators!\n");
+ AutoOn();
+ Exit(1);
+ }
+ break;
+ case BUTTGENGLY:
+ AT(x,y)=BUTTGENSPR;
+ generator[no_generator].cycle=0;
+ generator[no_generator].type=BUTTGENSPR;
+ generator[no_generator].x=x;
+ generator[no_generator].y=y;
+ if ((++no_generator)>MAX_GENERATOR)
+ {
+ fprintf(stderr,"Error! To many generators!\n");
+ AutoOn();
+ Exit(1);
+ }
+ break;
+ case CHSRGENGLY:
+ AT(x,y)=CHSRGENSPR;
+ generator[no_generator].cycle=0;
+ generator[no_generator].type=CHSRGENSPR;
+ generator[no_generator].x=x;
+ generator[no_generator].y=y;
+ if ((++no_generator)>MAX_GENERATOR)
+ {
+ fprintf(stderr,"Error! To many generators!\n");
+ AutoOn();
+ Exit(1);
+ }
+ break;
+ default:
+ break;
+ }
+
+ fgets(s,256,fp);
+ }
+
+ if ((lev.sx==-1))
+ {
+ fprintf(stderr,"Error! No miner in level file!\n");
+ AutoOn();
+ Exit(1);
+ }
+
+ if ((lev.ex==-1))
+ {
+ fprintf(stderr,"Error! No exit in level file!\n");
+ AutoOn();
+ Exit(1);
+ }
+}
+
+PutX(x,y,n)
+
+{
+ XPut(spr[n].p,0,0,chsz,chsz,X(x),Y(y));
+}
+
+XCentre(s,y,c)
+char *s;
+int y,c;
+
+{
+ XPrint(X(SCRX)/2-strlen(s)*((font->max_bounds.width)>>1),y,s,c);
+}
+
+
+CursesCentre(s,y,c)
+char *s;
+int y,c;
+
+{
+ /* mvaddstr(y,SCRX/2-strlen(s)/2,s); */
+ mvaddstr(y,COLS/2-strlen(s)/2,s);
+}
+
+
+DoTillPress(f,s,qf)
+int (*f)();
+int s,qf;
+
+{
+ XEvent e;
+
+ if(XPending(disp))
+ XNextEvent(disp,&e);
+
+ while(1)
+ {
+ if ((slp>-1)&&(s))
+ USLEEP(slp);
+
+ if(XPending(disp))
+ {
+ XNextEvent(disp,&e);
+
+ switch(e.type)
+ {
+ case KeyPress:
+ switch(XLookupKeysym((XKeyEvent *)&e,ShiftMapIndex))
+ {
+ case XK_space:
+ return;
+ break;
+
+ case XK_Escape:
+ if (qf)
+ {
+ quit=True;
+ return;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case ButtonPress:
+ return;
+ break;
+ default:
+ break;
+ }
+ }
+
+ (*f)();
+ }
+}
+
+/* --------------------------------------------------------------------- */
+
+#define TITLEBLKS 44
+#define TBX(x1,x2) (14+(x1*4)+x2)
+#define TBY(y) (5+(y))
+
+static struct
+ {
+ int x,y;
+ } title_bl[TITLEBLKS]=
+ {
+ {TBX(0,0), TBY(4)}, /* D */
+ {TBX(0,1), TBY(4)}, /* D */
+ {TBX(0,0), TBY(3)}, /* D */
+ {TBX(0,2), TBY(3)}, /* D */
+ {TBX(0,0), TBY(2)}, /* D */
+ {TBX(0,2), TBY(2)}, /* D */
+ {TBX(0,0), TBY(1)}, /* D */
+ {TBX(0,2), TBY(1)}, /* D */
+ {TBX(0,0), TBY(0)}, /* D */
+ {TBX(0,1), TBY(0)}, /* D */
+
+ {TBX(1,0), TBY(4)}, /* A */
+ {TBX(1,2), TBY(4)}, /* A */
+ {TBX(1,0), TBY(3)}, /* A */
+ {TBX(1,2), TBY(3)}, /* A */
+ {TBX(1,0), TBY(2)}, /* A */
+ {TBX(1,1), TBY(2)}, /* A */
+ {TBX(1,2), TBY(2)}, /* A */
+ {TBX(1,0), TBY(1)}, /* A */
+ {TBX(1,2), TBY(1)}, /* A */
+ {TBX(1,0), TBY(0)}, /* A */
+ {TBX(1,1), TBY(0)}, /* A */
+ {TBX(1,2), TBY(0)}, /* A */
+
+ {TBX(2,0), TBY(4)}, /* S */
+ {TBX(2,1), TBY(4)}, /* S */
+ {TBX(2,2), TBY(4)}, /* S */
+ {TBX(2,2), TBY(3)}, /* S */
+ {TBX(2,2), TBY(2)}, /* S */
+ {TBX(2,1), TBY(2)}, /* S */
+ {TBX(2,0), TBY(2)}, /* S */
+ {TBX(2,0), TBY(1)}, /* S */
+ {TBX(2,0), TBY(0)}, /* S */
+ {TBX(2,1), TBY(0)}, /* S */
+ {TBX(2,2), TBY(0)}, /* S */
+
+ {TBX(3,0), TBY(4)}, /* H */
+ {TBX(3,2), TBY(4)}, /* H */
+ {TBX(3,0), TBY(3)}, /* H */
+ {TBX(3,2), TBY(3)}, /* H */
+ {TBX(3,0), TBY(2)}, /* H */
+ {TBX(3,1), TBY(2)}, /* H */
+ {TBX(3,2), TBY(2)}, /* H */
+ {TBX(3,0), TBY(1)}, /* H */
+ {TBX(3,2), TBY(1)}, /* H */
+ {TBX(3,0), TBY(0)}, /* H */
+ {TBX(3,2), TBY(0)} /* H */
+ };
+
+
+int XTitle()
+
+{
+ static int fr=True;
+ static int bln=0;
+ static int x=0;
+ static int y=0;
+ static int sc=0;
+ static int sct=0;
+ char s[128];
+ int f;
+
+ if (title_fr)
+ {
+ x=title_bl[0].x;
+ y=0;
+ title_fr=False;
+ LoadScores();
+
+ sc=0;
+ bln=0;
+ sct=0;
+
+ (*Centre)("ALL TIME DASHERS",Y(12),white);
+
+ if (!cursesmode)
+ {
+ (*Printf)(0,Y(13),white,"%3s %7s %-*s %3s",
+ "Pos","Score",HINAMELEN,"Name","Level");
+
+ (*Centre)("Press Escape to quit",Y(SCRY-4),white);
+ }
+ else
+ (*Centre)("^C to quit",Y(SCRY-4),white);
+
+ (*Centre)("Press Space to continue",Y(SCRY-2),white);
+ }
+
+ if (!cursesmode)
+ {
+ XFillBox(0,Y(14),X(SCRX),Y(3),black);
+
+ (*Printf)(0,Y(15),white,"%3d %7d %-*s %3d",
+ sc+1,hisc[sc].score,HINAMELEN,hisc[sc].name,hisc[sc].level);
+ }
+ else
+ {
+ (*Printf)(0,Y(15),white,"Pos : %-2d",sc+1);
+ (*Printf)(0,Y(16),white,"Name : %-*s",HINAMELEN,hisc[sc].name);
+ (*Printf)(0,Y(17),white,"Score : %-7d",hisc[sc].score);
+ (*Printf)(0,Y(18),white,"Level : %-3d",hisc[sc].level);
+ }
+
+ if (sct++==100)
+ {
+ sct=0;
+ if (++sc==MAX_HISCORE)
+ sc=0;
+ }
+
+ if (y>=title_bl[bln].y)
+ if (++bln<TITLEBLKS)
+ {
+ x=title_bl[bln].x;
+ y=0;
+ }
+
+ if (bln<TITLEBLKS)
+ {
+ if (y)
+ (*Put)(x,y-1,SPACESPR);
+
+ (*Put)(x,y++,GEMSPR);
+ }
+
+ (*Update)();
+
+ return(XFUNCCONT);
+}
+
+/* --------------------------------------------------------------------- */
+
+#define INTROSPR 30
+
+struct
+ {
+ int x,y;
+ } ispr[INTROSPR];
+
+XIntroLevel()
+
+{
+ static int fr=True;
+ char s[100];
+ int f;
+
+ if (fr)
+ {
+ for(f=0;f<INTROSPR;f++)
+ {
+ ispr[f].x=X(RND(SCRX));
+ ispr[f].y=Y(RND(SCRY));
+ }
+
+ fr=False;
+ }
+
+ (*Cls)(black);
+
+ for(f=0;f<INTROSPR;f++)
+ {
+ XPut(spr[GEMSPR].p,0,0,chsz,chsz,ispr[f].x,ispr[f].y);
+
+ if ((ispr[f].y+=2)>Y(SCRY))
+ {
+ ispr[f].x=X(RND(SCRX));
+ ispr[f].y=-chsz;
+ }
+ }
+
+ sprintf(s,"Level %d",level);
+ (*Centre)(s,Y(3),white);
+
+ sprintf(s,"'%s'",lev.name);
+ (*Centre)(s,Y(5),white);
+
+ (*Centre)("Press Space to continue",Y(SCRY-2),white);
+
+ (*Update)();
+
+ return(XFUNCCONT);
+}
+
+/* --------------------------------------------------------------------- */
+
+int LevelOk()
+
+{
+ static int ix=1;
+ int x,y;
+
+ if (fr_flag)
+ {
+ fr_flag=False;
+
+ LoadLevel(WELLDONELEV);
+
+ ix=1;
+
+ (*Cls)(black);
+ (*Repaint)(True);
+ }
+ else
+ (*Repaint)(False);
+
+ lev.x+=ix;
+
+ if ((lev.x==0)||(lev.x==lev.w-SCRX))
+ {
+ ix=-ix;
+
+ for(x=0;x<lev.w;x++)
+ for(y=0;y<lev.h;y++)
+ if (AT(x,y)==EARTHSPR)
+ AT(x,y)=SPACESPR;
+ }
+
+ DrawMess("Press Space");
+
+ (*Update)();
+
+ Gravity();
+}
+
+
+int LevelNotOk()
+
+{
+ static int ix=1;
+ int x,y;
+
+ if (fr_flag)
+ {
+ fr_flag=False;
+
+ ix=1;
+
+ LoadLevel(TRYAGAINLEV);
+
+ (*Repaint)(True);
+ }
+ else
+ (*Repaint)(False);
+
+ lev.x+=ix;
+
+ if ((lev.x==0)||(lev.x==lev.w-SCRX))
+ {
+ ix=-ix;
+
+ for(x=0;x<lev.w;x++)
+ for(y=0;y<lev.h;y++)
+ if (AT(x,y)==EARTHSPR)
+ AT(x,y)=SPACESPR;
+ }
+
+ DrawMess("Press Space");
+
+ (*Update)();
+
+ Gravity();
+}
+
+/* --------------------------------------------------------------------- */
+
+DrawMess(s)
+char *s;
+
+{
+ if (!cursesmode)
+ XFillBox(0,0,X(SCRX),Y(1)-1,black);
+
+ (*Centre)(s,((cursesmode) ? (0) : (Y(1)-2)),white);
+}
+
+
+DrawScore()
+
+{
+ if (!cursesmode)
+ {
+ XFillBox(0,0,X(SCRX),Y(1)-1,black);
+
+ (*Printf)(0,(Y(1)-2),white,
+ "Score %7d Collect %3d Got %3d Lives %2d Time %4d",
+ score,lev.toget,lev.no,lives,lev.time);
+ }
+ else
+ if (COLS>=80)
+ (*Printf)(0,0,white,
+ "Score %7d Collect %3d Got %3d Lives %2d Time %4d",
+ score,lev.toget,lev.no,lives,lev.time);
+ else
+ (*Printf)(0,0,white,"S:%-7d C:%-3d G:%-3d L:%-2d T:%-4d",
+ score,lev.toget,lev.no,lives,lev.time);
+}
+
+
+XUpdate()
+
+{
+ Redraw(0,0);
+}
+
+
+XRepaint(full)
+
+{
+ static char scr[SCRX][SCRY];
+ static int lx,ly;
+ int x,y,px,py;
+
+ if (full)
+ {
+ lx=lev.x;
+ ly=lev.y;
+
+ for(y=0;y<SCRY;y++)
+ for(x=0;x<SCRX;x++)
+ scr[x][y]=VOIDSPR;
+ }
+ else
+ {
+ px=lx-lev.x;
+ py=ly-lev.y;
+
+ if (px==-1)
+ {
+ XCopy(X(1),Y(1),X(SCRX-1),Y(SCRY-1),X(0),Y(1));
+ for (x=1;x<SCRX;x++)
+ for(y=0;y<SCRY;y++)
+ scr[x-1][y]=scr[x][y];
+
+ for(y=0;y<SCRY;y++)
+ scr[SCRX-1][y]=VOIDSPR;
+ }
+
+ if (px==1)
+ {
+ XCopy(X(0),Y(1),X(SCRX-1),Y(SCRY-1),X(1),Y(1));
+ for (x=SCRX-1;x>0;x--)
+ for(y=0;y<SCRY;y++)
+ scr[x][y]=scr[x-1][y];
+
+ for(y=0;y<SCRY;y++)
+ scr[0][y]=VOIDSPR;
+ }
+
+ if (py==-1)
+ {
+ XCopy(X(0),Y(2),X(SCRX),Y(SCRY-2),X(0),Y(1));
+ for (x=0;x<SCRX;x++)
+ for(y=1;y<SCRY;y++)
+ scr[x][y-1]=scr[x][y];
+
+ for(x=0;x<SCRX;x++)
+ scr[x][SCRY-1]=VOIDSPR;
+ }
+
+ if (py==1)
+ {
+ XCopy(X(0),Y(1),X(SCRX),Y(SCRY-2),X(0),Y(2));
+ for (x=0;x<SCRX;x++)
+ for(y=SCRY-1;y>0;y--)
+ scr[x][y]=scr[x][y-1];
+
+ for(x=0;x<SCRX;x++)
+ scr[x][1]=VOIDSPR;
+ }
+ }
+
+ for(y=1;y<SCRY;y++)
+ for(x=0;x<SCRX;x++)
+ {
+ px=lev.x+x;
+ py=lev.y+y-1;
+
+ if ((px<lev.w)&&(py<lev.h)&&(px>-1)&&(py>-1))
+ {
+ if (scr[x][y]!=AT(px,py))
+ {
+ (*Put)(x,y,AT(px,py));
+ scr[x][y]=AT(px,py);
+ }
+ }
+ else
+ if (scr[x][y]!=SPACESPR)
+ {
+ (*Put)(x,y,SPACESPR);
+ scr[x][y]=SPACESPR;
+ }
+ }
+
+ lx=lev.x;
+ ly=lev.y;
+}
+
+/* --------------------------------------------------------------------- */
+#define MOVE_AMOEBA(x,y) ((AT(x,y)==SPACESPR)||(AT(x,y)==EARTHSPR))
+
+CheckAmoebaMove(x,y)
+
+{
+ int r=False;
+
+ if (MOVE_AMOEBA(x-1,y))
+ {
+ r=True;
+ if (RND(100)>amoeba_move_chance)
+ {
+ AT(x-1,y)=AMOEBASPR;
+ amoeba.size++;
+ }
+ }
+
+ if (MOVE_AMOEBA(x+1,y))
+ {
+ r=True;
+ if (RND(100)>amoeba_move_chance)
+ {
+ AT(x+1,y)=AMOEBASPR;
+ amoeba.size++;
+ }
+ }
+
+ if (MOVE_AMOEBA(x,y-1))
+ {
+ r=True;
+ if (RND(100)>amoeba_move_chance)
+ {
+ AT(x,y-1)=AMOEBASPR;
+ amoeba.size++;
+ }
+ }
+
+ if (MOVE_AMOEBA(x,y+1))
+ {
+ r=True;
+ if (RND(100)>amoeba_move_chance)
+ {
+ AT(x,y+1)=AMOEBASPR;
+ amoeba.size++;
+ }
+ }
+
+ return(r);
+}
+
+HandleAmoeba()
+
+{
+ int f,x,y,d;
+
+ if (amoeba.alive)
+ if (!(--amoeba.count))
+ {
+ amoeba.count=AMOEBA_COUNT;
+ amoeba.could_move=False;
+
+ for(y=0;y<lev.h;y++)
+ for(x=0;x<lev.w;x++)
+ if (AT(x,y)==AMOEBASPR)
+ if (CheckAmoebaMove(x,y))
+ amoeba.could_move=True;
+
+ if (amoeba.size>max_amoeba_size)
+ {
+ for(y=0;y<lev.h;y++)
+ for(x=0;x<lev.w;x++)
+ if (AT(x,y)==AMOEBASPR)
+ AT(x,y)=ROCKSPR;
+ }
+ else
+ if (!amoeba.could_move)
+ {
+ for(y=0;y<lev.h;y++)
+ for(x=0;x<lev.w;x++)
+ if (AT(x,y)==AMOEBASPR)
+ AT(x,y)=GEMSPR;
+ }
+ }
+}
+
+
+/* --------------------------------------------------------------------- */
+
+GenerateMonsters(x,y,t)
+int x,y,t;
+
+{
+ if ((AT(x-1,y)==SPACESPR)&&(no_enemy<MAX_ENEMY))
+ {
+ AT(x-1,y)=t;
+ enemy[no_enemy].alive=True;
+ enemy[no_enemy].type=t;
+ enemy[no_enemy].x=x-1;
+ enemy[no_enemy].y=y;
+ enemy[no_enemy].dir=LEFT;
+ enemy[no_enemy].moved=False;
+ no_enemy++;
+ }
+
+ if ((AT(x+1,y)==SPACESPR)&&(no_enemy<MAX_ENEMY))
+ {
+ AT(x+1,y)=t;
+ enemy[no_enemy].alive=True;
+ enemy[no_enemy].type=t;
+ enemy[no_enemy].x=x+1;
+ enemy[no_enemy].y=y;
+ enemy[no_enemy].dir=RIGHT;
+ enemy[no_enemy].moved=False;
+ no_enemy++;
+ }
+
+ if ((AT(x,y+1)==SPACESPR)&&(no_enemy<MAX_ENEMY))
+ {
+ AT(x,y+1)=t;
+ enemy[no_enemy].alive=True;
+ enemy[no_enemy].type=t;
+ enemy[no_enemy].x=x;
+ enemy[no_enemy].y=y+1;
+ enemy[no_enemy].dir=DOWN;
+ enemy[no_enemy].moved=False;
+ no_enemy++;
+ }
+
+ if ((AT(x,y-1)==SPACESPR)&&(no_enemy<MAX_ENEMY))
+ {
+ AT(x,y-1)=t;
+ enemy[no_enemy].alive=True;
+ enemy[no_enemy].type=t;
+ enemy[no_enemy].x=x;
+ enemy[no_enemy].y=y-1;
+ enemy[no_enemy].dir=UP;
+ enemy[no_enemy].moved=False;
+ no_enemy++;
+ }
+}
+
+
+HandleGenerators()
+
+{
+ Generator *g;
+ int f;
+
+ for(f=0;f<no_generator;f++)
+ {
+ g=&generator[f];
+
+ AT(g->x,g->y)=g->type; /* Make generators 'indestructible' */
+
+ if (!((g->cycle++)%20))
+ switch(g->type)
+ {
+ case ROCKGENSPR:
+ if (AT(g->x,g->y+1)==SPACESPR)
+ AT(g->x,g->y+1)=ROCKFALLSPR;
+ break;
+
+ case BUTTGENSPR:
+ GenerateMonsters(g->x,g->y,BUTTSPR);
+ break;
+
+ case CHSRGENSPR:
+ GenerateMonsters(g->x,g->y,CHSRSPR);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+/* --------------------------------------------------------------------- */
+
+CheckEnemyMove(e,d)
+Enemy *e;
+int d;
+
+{
+ switch(AT((e)->x+move_tbl[(d)].x,(e)->y+move_tbl[(d)].y))
+ {
+ case SPACESPR:
+ case HEROSPR:
+ return(True);
+ break;
+ default:
+ return(False);
+ break;
+ }
+}
+
+#define ISDESTRUCT(c) \
+ ((c==SPACESPR)|| \
+ (c==EARTHSPR)|| \
+ (c==ROCKSPR)|| \
+ (c==WALLSPR)|| \
+ (c==GEMSPR)|| \
+ (c==HEROSPR)|| \
+ (c==ROCKFALLSPR)|| \
+ (c==GEMFALLSPR)|| \
+ (c==BUTTSPR)|| \
+ (c==CHSRSPR))
+
+HandleEnemies()
+
+{
+ int f;
+
+ for(f=0;f<no_enemy;f++)
+ if (enemy[f].alive)
+ switch(enemy[f].type)
+ {
+ case BUTTSPR:
+ HandleButt(&enemy[f]);
+ break;
+
+ case CHSRSPR:
+ HandleChsr_V2(&enemy[f]);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+HandleButt(e)
+Enemy *e;
+
+{
+ int x,y,b;
+
+ switch (AT(e->x,e->y))
+ {
+ case ROCKFALLSPR:
+ case GEMFALLSPR:
+ e->alive=False;
+ score+=20;
+ for(x=-1;x<2;x++)
+ for(y=-1;y<2;y++)
+ if (ISDESTRUCT(AT(e->x+x,e->y+y)))
+ AT(e->x+x,e->y+y)=GEMFALLSPR;
+ return;
+ break;
+
+ default:
+ AT(e->x,e->y)=SPACESPR;
+
+ if (CheckEnemyMove(e,e->dir))
+ {
+ e->x+=move_tbl[e->dir].x;
+ e->y+=move_tbl[e->dir].y;
+ }
+ else
+ {
+ if (CheckEnemyMove(e,ROT_RIGHT(e->dir)))
+ e->dir=ROT_RIGHT(e->dir);
+ else
+ e->dir=ROT_LEFT(e->dir);
+ }
+ AT(e->x,e->y)=BUTTSPR;
+ }
+}
+
+
+HandleChsr(e)
+Enemy *e;
+
+{
+ int x,y,f,od,md;
+
+ switch (AT(e->x,e->y))
+ {
+ case ROCKFALLSPR:
+ case GEMFALLSPR:
+ e->alive=False;
+ score+=20;
+ for(x=-1;x<2;x++)
+ for(y=-1;y<2;y++)
+ if (ISDESTRUCT(AT(e->x+x,e->y+y)))
+ AT(e->x+x,e->y+y)=ROCKFALLSPR;
+ return;
+ break;
+
+ default:
+ AT(e->x,e->y)=SPACESPR;
+
+ if ((od=e->dir)==NONE)
+ {
+ od=UP;
+ e->moved=False;
+ }
+
+ if (e->dir!=NONE)
+ if(!CheckEnemyMove(e,e->dir))
+ {
+ e->dir=NONE;
+ e->moved=False;
+ }
+
+ if(e->moved)
+ {
+ md=e->dir;
+ e->dir=NONE;
+ }
+ else
+ md=NONE;
+
+ /* Try moving in the X plane towards the sprite */
+ if (e->dir==NONE)
+ {
+ x=lev.sx-e->x;
+
+ if (x<0)
+ e->dir=LEFT;
+ else
+ e->dir=RIGHT;
+
+ if (e->dir!=NONE)
+ if(!CheckEnemyMove(e,e->dir))
+ e->dir=NONE;
+ }
+
+ if (md!=NONE)
+ if (md==ROT_FLIP(e->dir))
+ e->dir=NONE;
+
+ /* Try moving in the Y plane towards the sprite */
+ if (e->dir==NONE)
+ {
+ y=lev.sy-e->y;
+
+ if (y<0)
+ e->dir=UP;
+ else
+ e->dir=LEFT;
+
+ if (e->dir!=NONE)
+ if(!CheckEnemyMove(e,e->dir))
+ e->dir=NONE;
+ }
+
+ if (md!=NONE)
+ if (md==ROT_FLIP(e->dir))
+ {
+ e->dir=md;
+ e->moved=True;
+ }
+
+ /* Try any other direction */
+ if (e->dir==NONE)
+ {
+ if (CheckEnemyMove(e,ROT_RIGHT(od)))
+ {
+ e->dir=ROT_RIGHT(od);
+ e->moved=True;
+ }
+
+ if (e->dir==NONE)
+ if (CheckEnemyMove(e,ROT_LEFT(od)))
+ {
+ e->dir=ROT_LEFT(od);
+ e->moved=True;
+ }
+
+ if (e->dir==NONE)
+ if (CheckEnemyMove(e,ROT_FLIP(od)))
+ {
+ e->dir=ROT_LEFT(od);
+ e->moved=True;
+ }
+ }
+
+ if (e->dir!=NONE)
+ {
+ e->x+=move_tbl[e->dir].x;
+ e->y+=move_tbl[e->dir].y;
+ }
+
+ AT(e->x,e->y)=CHSRSPR;
+ break;
+ }
+}
+
+
+HandleChsr_V2(e)
+Enemy *e;
+
+{
+ int x,y,b;
+
+ switch (AT(e->x,e->y))
+ {
+ case ROCKFALLSPR:
+ case GEMFALLSPR:
+ e->alive=False;
+ score+=20;
+ for(x=-1;x<2;x++)
+ for(y=-1;y<2;y++)
+ if (AT(e->x+x,e->y+y)!=TUFFWALLSPR)
+ AT(e->x+x,e->y+y)=ROCKFALLSPR;
+ return;
+ break;
+
+ default:
+
+ if (e->moved)
+ {
+ e->moved--;
+ return;
+ }
+
+ e->moved=3;
+
+ AT(e->x,e->y)=SPACESPR;
+
+ e->dir=NONE;
+
+ if (lev.sy<e->y)
+ e->dir=UP;
+ else
+ if (lev.sy>e->y)
+ e->dir=DOWN;
+
+ if (e->dir!=NONE)
+ {
+ b=AT(e->x+move_tbl[e->dir].x,e->y+move_tbl[e->dir].y);
+
+ if ((b!=SPACESPR)&&(b!=HEROSPR))
+ e->dir=NONE;
+ }
+
+ if (e->dir==NONE)
+ {
+ if (lev.sx<e->x)
+ e->dir=LEFT;
+ else
+ if (lev.sx>e->x)
+ e->dir=RIGHT;
+
+ if (e->dir!=NONE)
+ {
+ b=AT(e->x+move_tbl[e->dir].x,e->y+move_tbl[e->dir].y);
+
+ if ((b!=SPACESPR)&&(b!=HEROSPR))
+ e->dir=NONE;
+ }
+ }
+
+ if (e->dir!=NONE)
+ {
+ e->x+=move_tbl[e->dir].x;
+ e->y+=move_tbl[e->dir].y;
+ }
+
+ AT(e->x,e->y)=CHSRSPR;
+ }
+}
+
+
+HandleChsr_V1(e)
+Enemy *e;
+
+{
+ switch (AT(e->x,e->y))
+ {
+ case ROCKFALLSPR:
+ case GEMFALLSPR:
+ e->alive=False;
+ score+=20;
+ return;
+ break;
+
+ default:
+ AT(e->x,e->y)=SPACESPR;
+
+ e->x+=move_tbl[e->dir].x;
+ e->y+=move_tbl[e->dir].y;
+
+ if ((AT(e->x,e->y)!=SPACESPR)&&(AT(e->x,e->y)!=HEROSPR))
+ {
+ e->x-=move_tbl[e->dir].x;
+ e->y-=move_tbl[e->dir].y;
+
+ if ((++e->dir)>LEFT)
+ e->dir=UP;
+ }
+ AT(e->x,e->y)=CHSRSPR;
+ }
+}
+
+
+/* --------------------------------------------------------------------- */
+
+CanMove(d)
+
+{
+ if (d==NONE)
+ return(False);
+
+ switch(AT(lev.sx+move_tbl[d].x,lev.sy+move_tbl[d].y))
+ {
+ case ROCKSPR:
+ if ((d==LEFT)||(d==RIGHT))
+ {
+ if (AT(lev.sx+move_tbl[d].x*2,lev.sy+move_tbl[d].y*2)==SPACESPR)
+ {
+ AT(lev.sx+move_tbl[d].x*2,lev.sy+move_tbl[d].y*2)=ROCKSPR;
+ AT(lev.sx+move_tbl[d].x,lev.sy+move_tbl[d].y)=SPACESPR;
+ }
+ else
+ return(False);
+ }
+ else
+ return(False);
+ break;
+
+ case TUFFWALLSPR:
+ case WALLSPR:
+ case ROCKFALLSPR:
+ case GEMFALLSPR:
+ case AMOEBASPR:
+ case FILTERSPR:
+ case ROCKGENSPR:
+ case BUTTGENSPR:
+ case CHSRGENSPR:
+ return(False);
+ break;
+
+ case EXITSPR:
+ if (lev.no>=lev.toget)
+ return(True);
+ else
+ return(False);
+
+
+ default:
+ return(True);
+ break;
+ }
+}
+
+
+CheckEnemies()
+
+{
+ int f,x,y;
+
+ for(f=0;f<no_enemy;f++)
+ if (enemy[f].alive)
+ if ((enemy[f].x==lev.sx)&&(enemy[f].y==lev.sy))
+ switch(enemy[f].type)
+ {
+ case BUTTSPR:
+ for(x=-1;x<2;x++)
+ for(y=-1;y<2;y++)
+ if (AT(lev.sx+x,lev.sy+y)!=TUFFWALLSPR)
+ AT(lev.sx+x,lev.sy+y)=GEMFALLSPR;
+ return(False);
+ break;
+
+ case CHSRSPR:
+ for(x=-1;x<2;x++)
+ for(y=-1;y<2;y++)
+ if (AT(lev.sx+x,lev.sy+y)!=TUFFWALLSPR)
+ AT(lev.sx+x,lev.sy+y)=ROCKFALLSPR;
+ return(False);
+ break;
+
+ default:
+ break;
+ }
+
+ return(True);
+}
+
+
+Handle(c)
+int c;
+
+{
+ int x,y;
+
+ switch(c)
+ {
+ case SPACESPR:
+ break;
+
+ case EARTHSPR:
+ /* score+=10; */
+ break;
+
+ case ROCKSPR:
+ case ROCKFALLSPR:
+ case GEMFALLSPR:
+ for(x=-1;x<2;x++)
+ for(y=-1;y<2;y++)
+ if (AT(lev.sx+x,lev.sy+y)!=TUFFWALLSPR)
+ AT(lev.sx+x,lev.sy+y)=ROCKFALLSPR;
+ return(False);
+ break;
+
+ case WALLSPR:
+ break;
+
+ case GEMSPR:
+ score+=10;
+ lev.no++;
+ break;
+
+ case ROCKSWSPR:
+ for(x=0;x<lev.w;x++)
+ for(y=0;y<lev.h;y++)
+ switch (AT(x,y))
+ {
+ case ROCKSPR:
+ case ROCKFALLSPR:
+ AT(x,y)=WALLSPR;
+ break;
+ case WALLSPR:
+ AT(x,y)=ROCKSPR;
+ default:
+ break;
+ }
+ return(True);
+ break;
+
+ case ONEUPSPR:
+ lives++;
+ break;
+
+ case EXITSPR:
+ return(False);
+ break;
+
+ default:
+ break;
+
+ }
+
+ return(True);
+}
+
+
+HandlePush(d,x,y)
+int d,x,y;
+
+{
+ int c;
+ int lx,ly;
+
+ switch(c=AT(x,y))
+ {
+ case SPACESPR:
+ break;
+
+ case EARTHSPR:
+ AT(x,y)=SPACESPR;
+ break;
+
+ case ROCKSPR:
+ if ((d==LEFT)||(d==RIGHT))
+ if (AT(x+move_tbl[d].x,y+move_tbl[d].y)==SPACESPR)
+ {
+ AT(x+move_tbl[d].x,y+move_tbl[d].y)=ROCKSPR;
+ AT(x,y)=SPACESPR;
+ }
+ break;
+
+ case ROCKFALLSPR:
+ case GEMFALLSPR:
+ break;
+
+ case WALLSPR:
+ break;
+
+ case GEMSPR:
+ score+=10;
+ lev.no++;
+ AT(x,y)=SPACESPR;
+ break;
+
+ case ROCKSWSPR:
+ for(lx=0;lx<lev.w;lx++)
+ for(ly=0;ly<lev.h;ly++)
+ switch (AT(lx,ly))
+ {
+ case ROCKSPR:
+ case ROCKFALLSPR:
+ AT(lx,ly)=WALLSPR;
+ break;
+ case WALLSPR:
+ AT(lx,ly)=ROCKSPR;
+ default:
+ break;
+ }
+ AT(x,y)=SPACESPR;
+ break;
+
+ case ONEUPSPR:
+ lives++;
+ AT(x,y)=SPACESPR;
+ break;
+
+ case EXITSPR:
+ lev.sx=lev.ex;
+ lev.sy=lev.ey;
+ return(False);
+ break;
+
+ default:
+ break;
+
+ }
+
+ return(True);
+}
+
+
+#define ISSTOP(b) ((b==ROCKSPR)||(b==ROCKFALLSPR)|| \
+ (b==WALLSPR)||(b==TUFFWALLSPR)||(b==EARTHSPR)|| \
+ (b==GEMSPR)||(b==GEMFALLSPR)||(b==EXITSPR)||\
+ (b==AMOEBASPR)||(b==ROCKGENSPR)||(b==BUTTGENSPR)||\
+ (b==CHSRGENSPR))
+
+Gravity()
+
+{
+ int x,y,b,l,r,l2,r2;
+
+ for(y=lev.h-1;y>-1;y--)
+ for(x=0;x<lev.w;x++)
+ switch(AT(x,y))
+ {
+ case ROCKFALLSPR:
+ l=AT(x-1,y+1);
+ l2=AT(x-1,y);
+ r=AT(x+1,y+1);
+ r2=AT(x+1,y);
+ b=AT(x,y+1);
+
+ if (ISSTOP(b))
+ {
+ if (ISSTOP(r)&&(!ISSTOP(l))&&(l2==SPACESPR))
+ {
+ AT(x,y)=SPACESPR;
+ AT(x-1,y+1)=ROCKFALLSPR;
+ }
+ else if (ISSTOP(l)&&(!ISSTOP(r))&&(r2==SPACESPR))
+ {
+ AT(x,y)=SPACESPR;
+ AT(x+1,y+1)=ROCKFALLSPR;
+ }
+ else
+ AT(x,y)=ROCKSPR;
+ }
+ else
+ {
+ if (b!=FILTERSPR)
+ {
+ AT(x,y)=SPACESPR;
+ AT(x,y+1)=ROCKFALLSPR;
+ }
+ else
+ {
+ AT(x,y)=SPACESPR;
+ if (AT(x,y+2)==SPACESPR)
+ AT(x,y+2)=GEMFALLSPR;
+ }
+ }
+
+ break;
+
+ case GEMFALLSPR:
+ l=AT(x-1,y+1);
+ l2=AT(x-1,y);
+ r=AT(x+1,y+1);
+ r2=AT(x+1,y);
+ b=AT(x,y+1);
+
+ if (ISSTOP(b))
+ {
+ if (ISSTOP(r)&&(!ISSTOP(l))&&(l2==SPACESPR))
+ {
+ AT(x,y)=SPACESPR;
+ AT(x-1,y+1)=GEMFALLSPR;
+ }
+ else if (ISSTOP(l)&&(!ISSTOP(r))&&(r2==SPACESPR))
+ {
+ AT(x,y)=SPACESPR;
+ AT(x+1,y+1)=GEMFALLSPR;
+ }
+ else
+ AT(x,y)=GEMSPR;
+ }
+ else
+ {
+ if (b!=FILTERSPR)
+ {
+ AT(x,y)=SPACESPR;
+ AT(x,y+1)=GEMFALLSPR;
+ }
+ else
+ {
+ AT(x,y)=SPACESPR;
+ if (AT(x,y+2)==SPACESPR)
+ AT(x,y+2)=ROCKFALLSPR;
+ }
+ }
+
+ break;
+
+ case ROCKSPR:
+ l=AT(x-1,y+1);
+ l2=AT(x-1,y);
+ r=AT(x+1,y+1);
+ r2=AT(x+1,y);
+ b=AT(x,y+1);
+
+ if (b==SPACESPR)
+ {
+ AT(x,y)=SPACESPR;
+ AT(x,y+1)=ROCKFALLSPR;
+ }
+ else if ((r==SPACESPR)&&(r2==SPACESPR)&&
+ ((b==GEMSPR)||(b==ROCKSPR)||(b==WALLSPR)||
+ (b==TUFFWALLSPR)))
+ {
+ AT(x,y)=SPACESPR;
+ AT(x+1,y+1)=ROCKFALLSPR;
+ }
+ else if ((l==SPACESPR)&&(l2==SPACESPR)&&
+ ((b==GEMSPR)||(b==ROCKSPR)||(b==WALLSPR)||
+ (b==TUFFWALLSPR)))
+ {
+ AT(x,y)=SPACESPR;
+ AT(x-1,y+1)=ROCKFALLSPR;
+ }
+ break;
+
+ case GEMSPR:
+ l=AT(x-1,y+1);
+ l2=AT(x-1,y);
+ r=AT(x+1,y+1);
+ r2=AT(x+1,y);
+ b=AT(x,y+1);
+
+ if (b==SPACESPR)
+ {
+ AT(x,y)=SPACESPR;
+ AT(x,y+1)=GEMFALLSPR;
+ }
+ else if ((r==SPACESPR)&&(r2==SPACESPR)&
+ ((b==GEMSPR)||(b==ROCKSPR)||(b==WALLSPR)||
+ (b==TUFFWALLSPR)))
+ {
+ AT(x,y)=SPACESPR;
+ AT(x+1,y+1)=GEMFALLSPR;
+ }
+ else if ((l==SPACESPR)&&(l2==SPACESPR)&
+ ((b==GEMSPR)||(b==ROCKSPR)||(b==WALLSPR)||
+ (b==TUFFWALLSPR)))
+ {
+ AT(x,y)=SPACESPR;
+ AT(x-1,y+1)=GEMFALLSPR;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+XPlayLevel()
+
+{
+ XEvent e;
+ int dir=NONE;
+ int x,y,ok,ls,kp,kpm,dt,ti;
+ int f,r;
+ int shiftmode,shiftrelease;
+ int pressed[4],released[4];
+
+ AT(lev.sx,lev.sy)=HEROSPR;
+ (*Cls)(black);
+ (*Repaint)(True);
+ DrawScore();
+ (*Update)();
+
+ ok=True;
+ dt=20;
+ ti=0;
+
+ for(f=0;f<4;f++)
+ {
+ pressed[f]=0;
+ released[f]=False;
+ }
+
+ shiftmode=False;
+ shiftrelease=False;
+
+ while(dt)
+ {
+ if (slp>-1)
+ USLEEP(slp);
+
+ for(f=0;f<4;f++)
+ if (released[f])
+ {
+ pressed[f]=0;
+ released[f]=False;
+
+ if (f==dir)
+ dir=NONE;
+ }
+
+ if (dir==NONE)
+ {
+ kp=-1;
+ kpm=0;
+
+ for(f=0;f<4;f++)
+ if (pressed[f]>kpm)
+ {
+ kpm=pressed[f];
+ kp=f;
+ }
+
+ if (kp!=-1)
+ dir=kp;
+ }
+
+ if (shiftrelease)
+ {
+ shiftmode=False;
+ shiftrelease=False;
+ }
+
+ while(XPending(disp))
+ {
+ XNextEvent(disp,&e);
+
+ switch(e.type)
+ {
+ case KeyPress:
+ switch(XLookupKeysym((XKeyEvent *)&e,ShiftMapIndex))
+ {
+ case XK_Shift_L:
+ case XK_Shift_R:
+ shiftmode=True;
+ break;
+
+ case XK_Up:
+ for(f=0;f<4;f++)
+ if (pressed[f]>0)
+ pressed[f]++;
+
+ pressed[UP]=1;
+ dir=UP;
+ break;
+
+ case XK_Left:
+ for(f=0;f<4;f++)
+ if (pressed[f]>0)
+ pressed[f]++;
+
+ pressed[LEFT]=1;
+ dir=LEFT;
+ break;
+
+ case XK_Down:
+ for(f=0;f<4;f++)
+ if (pressed[f]>0)
+ pressed[f]++;
+
+ pressed[DOWN]=1;
+ dir=DOWN;
+ break;
+
+ case XK_Right:
+ for(f=0;f<4;f++)
+ if (pressed[f]>0)
+ pressed[f]++;
+
+ pressed[RIGHT]=1;
+ dir=RIGHT;
+ break;
+
+ case XK_Q:
+ case XK_q:
+ dir=NONE;
+ return(False);
+ break;
+
+ case XK_P:
+ case XK_p:
+ DoPause();
+ (*Repaint)(True);
+ break;
+
+ default:
+ dir=NONE;
+ }
+ break;
+
+ case KeyRelease:
+ switch(XLookupKeysym((XKeyEvent *)&e,ShiftMapIndex))
+ {
+ case XK_Shift_L:
+ case XK_Shift_R:
+ shiftrelease=True;
+ break;
+
+ case XK_Up:
+ released[UP]=True;
+ break;
+
+ case XK_Left:
+ released[LEFT]=True;
+ break;
+
+ case XK_Down:
+ released[DOWN]=True;
+ break;
+
+ case XK_Right:
+ released[RIGHT]=True;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (ok)
+ {
+ ok=CheckEnemies();
+
+ if ((shiftmode)&&(dir!=NONE))
+ {
+ ok=HandlePush(dir,lev.sx+move_tbl[dir].x,
+ lev.sy+move_tbl[dir].y);
+ if (ok)
+ ok=Handle(AT(lev.sx,lev.sy));
+ }
+ else
+ {
+ if(CanMove(dir))
+ {
+ if (AT(lev.sx,lev.sy)==HEROSPR)
+ AT(lev.sx,lev.sy)=SPACESPR;
+
+ lev.sx+=move_tbl[dir].x;
+ lev.sy+=move_tbl[dir].y;
+ ok=Handle(AT(lev.sx,lev.sy));
+ AT(lev.sx,lev.sy)=HEROSPR;
+ }
+ else
+ ok=Handle(AT(lev.sx,lev.sy));
+ }
+ }
+
+ x=lev.sx-lev.x;
+ y=lev.sy-lev.y;
+
+ if (x<10)
+ if (lev.x)
+ lev.x--;
+
+ if (x>SCRX-10)
+ if (lev.x<lev.w-SCRX)
+ lev.x++;
+
+ if (y<10)
+ if (lev.y)
+ lev.y--;
+
+ if (y>(SCRY-10))
+ if (lev.y<(lev.h-SCRY+1))
+ lev.y++;
+
+ HandleGenerators();
+ HandleEnemies();
+ HandleAmoeba();
+
+ Gravity();
+
+ if (ok)
+ ok=Handle(AT(lev.sx,lev.sy));
+
+ (*Repaint)(False);
+ DrawScore();
+ (*Update)();
+
+ if (!ok)
+ {
+ if ((lev.sx==lev.ex)&&(lev.sy==lev.ey))
+ dt=0;
+ else
+ dt--;
+ }
+ else
+ {
+ if (++ti==10)
+ {
+ ti=0;
+ if (!(--lev.time))
+ {
+ ok=False;
+ dt=40;
+
+ for(x=0;x<lev.w;x++)
+ for(y=0;y<lev.h;y++)
+ if ((AT(x,y)!=SPACESPR)&&(AT(x,y)!=TUFFWALLSPR))
+ AT(x,y)=ROCKFALLSPR;
+ }
+ }
+ }
+ }
+
+ return((lev.sx==lev.ex)&&(lev.sy==lev.ey));
+}
+
+
+/* --------------------------------------------------------------------- */
+
+
+#define PAUSE_SX 30
+#define PAUSE_SY 5
+#define PAUSE_X 8
+#define PAUSE_Y 8
+
+char *start_pause_map[PAUSE_SY]=
+ {
+ /* 123456789012345678901234567890 */
+ " ## # # # ## ### ## ",
+ " # # # # # # # # # # ",
+ " ## ### # # # ## # # ",
+ " # # # # # # # # # ",
+ " # # # # ## ### ## "
+ };
+
+int pause_map[PAUSE_SX][PAUSE_SY];
+
+PauseFunc()
+
+{
+ int x,y;
+
+ (*Cls)(black);
+
+ for(x=0;x<PAUSE_SX;x++)
+ for(y=0;y<PAUSE_SY;y++)
+ if (pause_map[x][y])
+ {
+ (*Put)(PAUSE_X+x,PAUSE_Y+y,pause_map[x][y]++);
+
+ if (pause_map[x][y]==NOSPR)
+ pause_map[x][y]=1;
+ }
+
+ (*Update)();
+
+ return(XFUNCCONT);
+}
+
+
+DoPause()
+
+{
+ int x,y;
+
+ AutoOn();
+
+ for(x=0;x<PAUSE_SX;x++)
+ for(y=0;y<PAUSE_SY;y++)
+ if (*(start_pause_map[y]+x)=='#')
+ pause_map[x][y]=RND(NOSPR-1)+1;
+ else
+ pause_map[x][y]=0;
+
+ (*Show)(PauseFunc,True,False);
+
+ AutoOff();
+}
+
+
+/* --------------------------------------------------------------------- */
+
+
+DoXGameOverLost()
+
+{
+ (*Printf)(RND(X(SCRX)),RND(Y(SCRY)),white,"YOU'VE LOST!!!!!");
+
+ (*Update)();
+
+ return(XFUNCCONT);
+}
+
+
+XGameOverLost()
+
+{
+ (*Show)(DoXGameOverLost,False);
+}
+
+/* --------------------------------------------------------------------- */
+
+#define NO_GW_CAST 14
+#define NO_GW_INTRO 6
+#define NO_GW_LINES 12
+#define GW_SPR_RAD 5
+
+struct
+ {
+ int spr;
+ char *name;
+ } gw_cast[NO_GW_CAST]=
+ {
+ /* {SPACESPR,"The Empty Bits(?!?)"}, */
+ {EARTHSPR,"The Ground"},
+ {ROCKSPR,"Rock"},
+ {GEMSPR,"Diamond"},
+ {EXITSPR,"The Exit"},
+ {BUTTSPR,"Butterfly"},
+ {CHSRSPR,"Chaser"},
+ {AMOEBASPR,"The Amoeba"},
+ {ROCKSWSPR,"The Rock Switch"},
+ {ONEUPSPR,"The 1 UP!!!"},
+ {FILTERSPR,"The Filter"},
+ {ROCKGENSPR,"The Rock Generator"},
+ {BUTTGENSPR,"The Butterfly Generator"},
+ {CHSRGENSPR,"The Chaser Generator"},
+ {HEROSPR,"You!"}
+ };
+
+char *gw_intro[NO_GW_INTRO]=
+ {
+ "Starring",
+ "Starring",
+ "Special appearance by",
+ "Introducing",
+ "Guest appearance by",
+ "Special guest star"
+ };
+
+char *gw_text[NO_GW_LINES]=
+ {
+ "Congratulations!",
+ "You have completed",
+ "all the levels!!!",
+ " ",
+ "Thanks for playing!",
+ " ",
+ "DASH!",
+ "Written by",
+ "Noddybox",
+ " ",
+ "Visit me at",
+ "www.noddybox.demon.co.uk",
+ };
+
+int gw_cast_no;
+int gw_intro_no;
+int gw_cast_x;
+int gw_ang;
+int NO_GW_SPR;
+int gw_cast_inc;
+int gw_text_no;
+int gw_text_ti;
+
+DoXGameOverWonSmallScale()
+
+{
+ static int la=0;
+ static int lx=0;
+ int a;
+ double dy;
+ int f;
+
+ (*Cls)(black);
+
+ (*Centre)(gw_text[gw_text_no],Y(3),white);
+
+ if (++gw_text_ti==300)
+ {
+ gw_text_ti=0;
+ if (++gw_text_no==NO_GW_LINES)
+ gw_text_no=0;
+ }
+
+ (*Printf)(X(SCRX)-gw_cast_x,Y(SCRY-1),white,"%s %s",
+ gw_intro[gw_intro_no],gw_cast[gw_cast_no].name);
+
+ la=a=gw_ang;
+ lx=gw_cast_x;
+ for(f=0;f<NO_GW_SPR;f++)
+ {
+ dy=(double)(Y(15))-(double)(Y(GW_SPR_RAD))*si[a];
+
+ XPut( spr[gw_cast[gw_cast_no].spr].p,
+ 0,0,chsz,chsz,
+ gw_cast_x-X(f*2),
+ (int)dy);
+
+ if ((a+=20)>359)
+ a-=360;
+ }
+
+ if ((gw_ang+=1)>359)
+ gw_ang-=360;
+
+ if ((gw_cast_x+=gw_cast_inc) > X(SCRX)+X(NO_GW_SPR*2))
+ {
+ gw_cast_x=0;
+ gw_intro_no=RND(NO_GW_INTRO);
+ if (++gw_cast_no==NO_GW_CAST)
+ gw_cast_no=0;
+ }
+
+ (*Update)();
+
+ return(XFUNCCONT);
+}
+
+
+DoXGameOverWonLargeScale()
+
+{
+ static int la=0;
+ static char s[100];
+ int a;
+ double dx,dy;
+ int f;
+
+ XFillBox(0,Y(2),X(SCRX),Y(2),black);
+ XFillBox(0,Y(SCRY-2),X(SCRX),Y(2),black);
+
+ a=la;
+ for(f=0;f<NO_GW_SPR;f++)
+ {
+ dx=(double)(X(SCRX/2))-(double)(X(GW_SPR_RAD))*si[a];
+ dy=(double)(Y(SCRY/2))-(double)(Y(GW_SPR_RAD))*co[a];
+
+ XFillBox((int)dx,(int)dy,chsz,chsz,black);
+
+ if ((a+=(360/NO_GW_SPR))>359)
+ a-=360;
+ }
+
+ (*Centre)(gw_text[gw_text_no],Y(3),white);
+
+ if (++gw_text_ti==100)
+ {
+ gw_text_ti=0;
+ if (++gw_text_no==NO_GW_LINES)
+ gw_text_no=0;
+ }
+
+ sprintf(s,"%s %s",gw_intro[gw_intro_no],gw_cast[gw_cast_no].name);
+ (*Centre)(s,Y(SCRY-1),white);
+
+ la=a=gw_ang;
+ for(f=0;f<NO_GW_SPR;f++)
+ {
+ dx=(double)(X(SCRX/2))-(double)(X(GW_SPR_RAD))*si[a];
+ dy=(double)(Y(SCRY/2))-(double)(Y(GW_SPR_RAD))*co[a];
+
+ XPut( spr[gw_cast[gw_cast_no].spr].p,
+ 0,0,chsz,chsz,
+ (int)dx,
+ (int)dy);
+
+ if ((a+=(360/NO_GW_SPR))>359)
+ a-=360;
+ }
+
+ if ((gw_ang+=1)>359)
+ gw_ang-=360;
+
+ if (++gw_cast_x==100)
+ {
+ gw_cast_x=0;
+ gw_intro_no=RND(NO_GW_INTRO);
+ if (++gw_cast_no==NO_GW_CAST)
+ gw_cast_no=0;
+ }
+
+ (*Update)();
+
+ return(XFUNCCONT);
+}
+
+
+XGameOverWon()
+
+{
+ score+=lives*2000;
+
+ gw_cast_no=0;
+ gw_cast_x=0;
+ gw_intro_no=RND(NO_GW_INTRO);
+ gw_ang=0;
+
+ gw_text_no=0;
+ gw_text_ti=0;
+
+ if (chsz==8)
+ {
+ NO_GW_SPR=20;
+ gw_cast_inc=1;
+ (*Show)(DoXGameOverWonSmallScale,False);
+ }
+ else
+ {
+ NO_GW_SPR=5;
+ gw_cast_inc=3;
+ (*Show)(DoXGameOverWonLargeScale,False);
+ }
+}
+
+XEndWindowing()
+{
+ /* X11 cleans up on exit anyway... */
+}
+
+/* --------------------------------------------------------------------- */
+
+int CmpHi(a,b)
+hiscore *a,*b;
+
+{
+ int f;
+
+ (*Cls)(black);
+
+ (*Centre)("YOU GOT A HISCORE!!!!!!",Y(1),white);
+
+ (*Printf)(0,Y(3),white,"%3s %7s %-*s %3s",
+ "Pos","Score",HINAMELEN,"Name","Level");
+
+ for(f=0;f<MAX_HISCORE;f++)
+ (*Printf)(0,Y(5+f),white,"%3d %7d %-*s %3d",
+ f+1,hisc[f].score,HINAMELEN,hisc[f].name,hisc[f].level);
+
+ (*Update)();
+
+ return(b->score-a->score);
+}
+
+
+int ShowTable()
+
+{
+ int f;
+
+ (*Cls)(black);
+
+ (*Centre)("YOU GOT A HISCORE!!!!!!",Y(1),white);
+
+ (*Printf)(0,Y(3),white,"%3s %7s %-*s %3s",
+ "Pos","Score",HINAMELEN,"Name","Level");
+
+ for(f=0;f<MAX_HISCORE;f++)
+ (*Printf)(0,Y(5+f),white,"%3d %7d %-*s %3d",
+ f+1,hisc[f].score,HINAMELEN,hisc[f].name,hisc[f].level);
+
+ (*Centre)("Press Space to continue",Y(SCRY-2),white);
+
+ (*Update)();
+}
+
+
+EnterHiscore()
+
+{
+ LoadScores();
+
+ strncpy(hisc[MAX_HISCORE-1].name,getpwuid(getuid())->pw_name,HINAMELEN);
+ hisc[MAX_HISCORE-1].score=score;
+ hisc[MAX_HISCORE-1].level=level;
+
+ qsort(hisc,MAX_HISCORE,sizeof(hiscore),CmpHi);
+
+ SaveScores();
+
+ (*Show)(ShowTable,False);
+}
+
+/* --------------------------------------------------------------------- */
+
+int CursesCls(c)
+int c;
+{
+ erase();
+}
+
+
+int CursesPut(x,y,c)
+int x,y,c;
+{
+ mvaddch(y,x,glyph_map[c]);
+}
+
+
+int CursesRedraw()
+{
+ move(LINES-1,COLS-1);
+ refresh();
+}
+
+
+int CursesRepaint(full)
+int full;
+
+{
+ int x,y,px,py;
+
+ if (full)
+ for(x=0;x<SCRX;x++)
+ for(y=1;y<SCRY;y++)
+ mvaddch(y,x,' ');
+
+ for(y=1;y<SCRY;y++)
+ for(x=0;x<SCRX;x++)
+ {
+ px=lev.x+x;
+ py=lev.y+y-1;
+
+ if ((px<lev.w)&&(py<lev.h)&&(px>-1)&&(py>-1))
+ mvaddch(y,x,glyph_map[AT(px,py)]);
+ else
+ mvaddch(y,x,glyph_map[SPACESPR]);
+ }
+}
+
+
+int CursesPrintf(int x, int y, int c, const char *fmt, ...)
+{
+ char s[128];
+ va_list l;
+
+ va_start(l, fmt);
+
+ vsprintf(s,fmt,l);
+
+ mvaddstr(y,x,s);
+
+ va_end(l);
+}
+
+
+int CursesIntroLevel()
+{
+ char s[128];
+
+ (*Cls)(black);
+
+ sprintf(s,"Level %d",level);
+ (*Centre)(s,Y(3),white);
+
+ sprintf(s,"'%s'",lev.name);
+ (*Centre)(s,Y(5),white);
+
+ (*Centre)("Press Space to continue",Y(SCRY-2),white);
+
+ (*Update)();
+
+ return(XFUNCCONT);
+}
+
+
+int CursesPlayLevel()
+{
+ int dir=NONE;
+ int x,y,ok,ls,kp,kpm,dt,ti;
+ int f,r;
+ int shiftmode;
+
+ AT(lev.sx,lev.sy)=HEROSPR;
+ (*Cls)(black);
+ (*Repaint)(True);
+ DrawScore();
+ (*Update)();
+
+ ok=True;
+ dt=20;
+ ti=0;
+
+ while(dt)
+ {
+ if (slp>-1)
+ USLEEP(slp);
+
+ shiftmode=False;
+
+ switch(getch())
+ {
+ case KEY_DOWN:
+ dir=DOWN;
+ shiftmode=False;
+ break;
+ case KEY_UP:
+ dir=UP;
+ shiftmode=False;
+ break;
+ case KEY_LEFT:
+ dir=LEFT;
+ shiftmode=False;
+ break;
+ case KEY_RIGHT:
+ dir=RIGHT;
+ shiftmode=False;
+ break;
+
+ case 'X':
+ case 'x':
+ dir=DOWN;
+ shiftmode=True;
+ break;
+ case 'W':
+ case 'w':
+ dir=UP;
+ shiftmode=True;
+ break;
+ case 'A':
+ case 'a':
+ dir=LEFT;
+ shiftmode=True;
+ break;
+ case 'D':
+ case 'd':
+ dir=RIGHT;
+ shiftmode=True;
+ break;
+
+ case 'p':
+ case 'P':
+ DoPause();
+ break;
+ case 'q':
+ case 'Q':
+ return(False);
+ break;
+ default:
+ dir=NONE;
+ }
+ flushinp();
+
+ if (ok)
+ {
+ ok=CheckEnemies();
+
+ if (shiftmode)
+ {
+ if (dir!=NONE)
+ {
+ ok=HandlePush(dir,lev.sx+move_tbl[dir].x,
+ lev.sy+move_tbl[dir].y);
+ if (ok)
+ ok=Handle(AT(lev.sx,lev.sy));
+ }
+ }
+ else
+ {
+ if(CanMove(dir))
+ {
+ if (AT(lev.sx,lev.sy)==HEROSPR)
+ AT(lev.sx,lev.sy)=SPACESPR;
+
+ lev.sx+=move_tbl[dir].x;
+ lev.sy+=move_tbl[dir].y;
+ ok=Handle(AT(lev.sx,lev.sy));
+ AT(lev.sx,lev.sy)=HEROSPR;
+ }
+ else
+ ok=Handle(AT(lev.sx,lev.sy));
+ }
+ }
+
+ x=lev.sx-lev.x;
+ y=lev.sy-lev.y;
+
+ if (x<10)
+ if (lev.x)
+ lev.x--;
+
+ if (x>SCRX-10)
+ if (lev.x<lev.w-SCRX)
+ lev.x++;
+
+ if (y<10)
+ if (lev.y)
+ lev.y--;
+
+ if (y>(SCRY-10))
+ if (lev.y<(lev.h-SCRY+1))
+ lev.y++;
+
+ HandleGenerators();
+ HandleEnemies();
+ HandleAmoeba();
+
+ Gravity();
+
+ if (ok)
+ ok=Handle(AT(lev.sx,lev.sy));
+
+ (*Repaint)(False);
+ DrawScore();
+ (*Update)();
+
+ if (!ok)
+ {
+ if ((lev.sx==lev.ex)&&(lev.sy==lev.ey))
+ dt=0;
+ else
+ dt--;
+ }
+ else
+ {
+ if (++ti==10)
+ {
+ ti=0;
+ if (!(--lev.time))
+ {
+ ok=False;
+ dt=40;
+
+ for(x=0;x<lev.w;x++)
+ for(y=0;y<lev.h;y++)
+ if ((AT(x,y)!=SPACESPR)&&(AT(x,y)!=TUFFWALLSPR))
+ AT(x,y)=ROCKFALLSPR;
+ }
+ }
+ }
+ }
+
+ return((lev.sx==lev.ex)&&(lev.sy==lev.ey));
+}
+
+
+int _CursesGameOverWon()
+{
+ static unsigned int c;
+
+ (*Cls)(black);
+
+ c++;
+
+ (*Centre)("Congratulations!!!",Y(2),white);
+ (*Centre)("You have completed",Y(3),white);
+ (*Centre)("dash in curses mode!!!",Y(4),white);
+
+ (*Centre)("A feat I never thought possible...",Y(12),white);
+ (*Centre)("Noddybox salutes you!",Y(13),white);
+ (*Centre)("www.noddybox.demon.co.uk",Y(15),white);
+
+ if ((c/10)%2)
+ (*Centre)("Press Space to continue",Y(SCRY-2),white);
+
+ (*Update)();
+}
+
+
+int CursesGameOverWon()
+{
+ (*Show)(_CursesGameOverWon,False,False);
+}
+
+
+int _CursesGameOverLost()
+{
+ static unsigned int c;
+
+ (*Cls)(black);
+
+ c++;
+
+ (*Centre)("Game Over",Y(6),white);
+
+ if ((c/10)%2)
+ (*Centre)("Press Space to continue",Y(SCRY-2),white);
+
+ (*Update)();
+}
+
+
+int CursesGameOverLost()
+{
+ (*Show)(_CursesGameOverLost,False,False);
+}
+
+
+int CursesDoTillPress(f,s,q)
+int (*f)();
+int s,q;
+
+{
+ chtype ch;
+
+ while(1)
+ {
+ switch(getch())
+ {
+ case ' ':
+ return;
+ break;
+ case 27:
+ if (q)
+ quit=True;
+ break;
+ default:
+ break;
+ }
+
+ (*f)();
+
+ if /* (s) */ (True)
+ USLEEP(slp);
+ }
+}
+
+
+CursesEndWindowing()
+{
+ (*Cls)(black);
+ (*Update)();
+ endwin();
+}
+
+
+/* --------------------------------------------------------------------- */
+
+int Exit(n)
+int n;
+
+{
+ if (EndWindowing)
+ (*EndWindowing)();
+ exit(n);
+}
+
+/* --------------------------------------------------------------------- */
+
+#ifdef NOUSLEEP
+
+LocalUsleep(u)
+int u;
+
+{
+ struct timeval tv;
+
+ tv.tv_sec=0;
+ tv.tv_usec=u;
+
+ (void)select(0,NULL,NULL,NULL,&tv);
+}
+
+#endif /* NOUSLEEP */
diff --git a/fontset.h b/fontset.h
new file mode 100644
index 0000000..d7eb76f
--- /dev/null
+++ b/fontset.h
@@ -0,0 +1,2020 @@
+#ifndef XIFONTW
+
+#define XIFONTW 8
+#define XIFONTH 8
+
+#define NULLCHARDEF {{ \
+ {1,1,1,1,1,1,1,0,}, \
+ {1,0,0,0,0,0,1,0,}, \
+ {1,0,1,1,1,0,1,0,}, \
+ {1,0,1,0,1,0,1,0,}, \
+ {1,0,1,1,1,0,1,0,}, \
+ {1,0,0,0,0,0,1,0,}, \
+ {1,1,1,1,1,1,1,0,}, \
+ {0,0,0,0,0,0,0,0,}, \
+ }}
+
+typedef struct
+ {
+ char data[XIFONTH][XIFONTW];
+ } FontChar;
+
+FontChar xifont1[128] =
+ {
+ NULLCHARDEF, /* 00 */
+ NULLCHARDEF, /* 01 */
+ NULLCHARDEF, /* 02 */
+ NULLCHARDEF, /* 03 */
+ NULLCHARDEF, /* 04 */
+ NULLCHARDEF, /* 05 */
+ NULLCHARDEF, /* 06 */
+ NULLCHARDEF, /* 07 */
+ NULLCHARDEF, /* 08 */
+ NULLCHARDEF, /* 09 */
+ NULLCHARDEF, /* 0a */
+ NULLCHARDEF, /* 0b */
+ NULLCHARDEF, /* 0c */
+ NULLCHARDEF, /* 0d */
+ NULLCHARDEF, /* 0e */
+ NULLCHARDEF, /* 0f */
+ NULLCHARDEF, /* 10 */
+ NULLCHARDEF, /* 11 */
+ NULLCHARDEF, /* 12 */
+ NULLCHARDEF, /* 13 */
+ NULLCHARDEF, /* 14 */
+ NULLCHARDEF, /* 15 */
+ NULLCHARDEF, /* 16 */
+ NULLCHARDEF, /* 17 */
+ NULLCHARDEF, /* 18 */
+ NULLCHARDEF, /* 19 */
+ NULLCHARDEF, /* 1a */
+ NULLCHARDEF, /* 1b */
+ NULLCHARDEF, /* 1c */
+ NULLCHARDEF, /* 1d */
+ NULLCHARDEF, /* 1e */
+ NULLCHARDEF, /* 1f */
+
+ {{ /* 20 ' ' */
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0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0,1,1,0,},
+ {0,0,0,0,1,1,0,0,},
+ {0,0,0,0,1,1,0,0,},
+ {0,0,0,1,1,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ }},
+ {{ /* 7e '~' */
+ {0,0,1,1,0,0,1,1,},
+ {0,1,1,1,1,1,1,0,},
+ {1,1,0,0,1,1,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ }},
+ {{ /* 7f DEL */
+ {0,1,1,0,1,1,0,0,},
+ {1,1,1,1,1,1,1,0,},
+ {1,1,1,1,1,1,1,0,},
+ {1,1,1,1,1,1,1,0,},
+ {0,1,1,1,1,1,0,0,},
+ {0,0,1,1,1,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ }},
+ };
+
+
+
+FontChar xifont2[128] =
+ {
+ NULLCHARDEF, /* 00 */
+ NULLCHARDEF, /* 01 */
+ NULLCHARDEF, /* 02 */
+ NULLCHARDEF, /* 03 */
+ NULLCHARDEF, /* 04 */
+ NULLCHARDEF, /* 05 */
+ NULLCHARDEF, /* 06 */
+ NULLCHARDEF, /* 07 */
+ NULLCHARDEF, /* 08 */
+ NULLCHARDEF, /* 09 */
+ NULLCHARDEF, /* 0a */
+ NULLCHARDEF, /* 0b */
+ NULLCHARDEF, /* 0c */
+ NULLCHARDEF, /* 0d */
+ NULLCHARDEF, /* 0e */
+ NULLCHARDEF, /* 0f */
+ NULLCHARDEF, /* 10 */
+ NULLCHARDEF, /* 11 */
+ NULLCHARDEF, /* 12 */
+ NULLCHARDEF, /* 13 */
+ NULLCHARDEF, /* 14 */
+ NULLCHARDEF, /* 15 */
+ NULLCHARDEF, /* 16 */
+ NULLCHARDEF, /* 17 */
+ NULLCHARDEF, /* 18 */
+ NULLCHARDEF, /* 19 */
+ NULLCHARDEF, /* 1a */
+ NULLCHAR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 7c '|' */
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ }},
+ {{ /* 7d '}' */
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,0,1,0,0,0,},
+ {0,0,0,0,1,0,0,0,},
+ {0,0,0,0,0,1,0,0,},
+ {0,0,0,0,1,0,0,0,},
+ {0,0,0,0,1,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ }},
+ {{ /* 7e '~' */
+ {0,0,1,0,0,0,0,0,},
+ {0,1,0,1,0,1,0,0,},
+ {0,0,0,0,1,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ }},
+ {{ /* 7f DEL */
+ {0,1,1,0,1,1,0,0,},
+ {1,1,1,1,1,1,1,0,},
+ {1,1,1,1,1,1,1,0,},
+ {1,1,1,1,1,1,1,0,},
+ {0,1,1,1,1,1,0,0,},
+ {0,0,1,1,1,0,0,0,},
+ {0,0,0,1,0,0,0,0,},
+ {0,0,0,0,0,0,0,0,},
+ }},
+ };
+
+FontChar *xifont=xifont1;
+
+#endif
diff --git a/icon.bmp b/icon.bmp
new file mode 100644
index 0000000..6ef7ee1
--- /dev/null
+++ b/icon.bmp
@@ -0,0 +1,27 @@
+#define icon_width 48
+#define icon_height 48
+static char icon_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xf8,
+ 0x13, 0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ff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xe3, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xfb,
+ 0xfb, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/spred.c b/spred.c
new file mode 100644
index 0000000..b1f36c8
--- /dev/null
+++ b/spred.c
@@ -0,0 +1,1264 @@
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xos.h>
+#include <X11/Xatom.h>
+#include <X11/keysym.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <math.h>
+
+#include "Xbit.h"
+
+#define WINX 270
+#define WINY 25
+#define WINW 700
+#define WINH 800
+
+#define RND(x) (rand()%(x))
+
+#define RAD(x) (M_PI/180.0*(double)(x))
+
+#define ABS(x) ((x)<0 ? (-(x)) : (x))
+#define SGN(x) ((x) ? ((x)/ABS(x)) : (0))
+
+XSizeHints size_hints;
+int black,white;
+Display *disp;
+Window window;
+Colormap cm;
+XFontStruct *font;
+
+
+#define CMAP_R 4
+#define CMAP_N (256/CMAP_R)
+#define CMAP_X 0
+#define CMAP_Y 760
+#define CMAP_W (640/CMAP_N)
+#define CMAP_H 10
+
+#define MAX_SPR_W 48
+#define MAX_SPR_H 48
+
+#define GRID_X 0
+#define GRID_Y 100
+#define SETGW(w,h) (12+((w-h)/3))
+
+#define SPR_X 640
+#define SPR_Y 100
+
+#define STR_Y 80
+
+#define PLOT 0
+#define FILL 1
+#define LINE 2
+#define RECT 3
+#define BOX 4
+#define CIRCLE 5
+#define OVAL 6
+#define ENDMODE 7
+
+#define PLOT_TXT "Plot"
+#define FILL_TXT "Fill"
+#define LINE_TXT "Line"
+#define RECT_TXT "Rect"
+#define BOX_TXT "Box"
+#define CIRCLE_TXT "Circle"
+#define OVAL_TXT "Oval"
+#define ENDMODE_TXT "Bug?"
+
+#define W_MAX 1
+#define W_MIN 40
+#define R_MAX 41
+#define R_MIN 80
+#define B_MAX 81
+#define B_MIN 120
+#define G_MAX 121
+#define G_MIN 160
+#define RG_MAX 161
+#define RG_MIN 180
+#define RB_MAX 181
+#define RB_MIN 200
+#define BG_MAX 201
+#define BG_MIN 220
+#define RND_MAX 221
+#define RND_MIN 255
+
+
+typedef struct
+ {
+ int x,y,w,h;
+ char *text;
+ int (*redraw)();
+ int (*callback)();
+ } Button;
+
+int RdCmapBut(),CmapBut();
+int RdSprSaveBut(),SprSaveBut();
+int RdSprLoadBut(),SprLoadBut();
+int RdSetCol(),SetCol();
+int RdSpreadBut(),SpreadBut();
+int RdLoadCmapBut(),LoadCmapBut();
+int RdDrawMode(),DrawMode();
+int RdClearToBut(),ClearToBut();
+int RdClearBut(),ClearBut();
+int RdSetSprBut(),SetSprBut();
+int RdQuitBut(),QuitBut();
+
+#define NO_BUT 11
+Button butlist[NO_BUT]=
+ {
+ {1,10,90,20,
+ "Save Cmap",
+ RdCmapBut,
+ CmapBut},
+ {101,10,90,20,
+ "Save Sprite",
+ RdSprSaveBut,
+ SprSaveBut},
+ {201,10,90,20,
+ "Load Sprite",
+ RdSprLoadBut,
+ SprLoadBut},
+ {301,10,90,20,
+ "Set Color",
+ RdSetCol,
+ SetCol},
+ {401,10,90,20,
+ "Spread",
+ RdSpreadBut,
+ SpreadBut},
+ {1,35,90,20,
+ "Load Cmap",
+ RdLoadCmapBut,
+ LoadCmapBut},
+ {101,35,90,20,
+ "DrawMode",
+ RdDrawMode,
+ DrawMode},
+ {201,35,90,20,
+ "Clear To",
+ RdClearToBut,
+ ClearToBut},
+ {301,35,90,20,
+ "Clear",
+ RdClearBut,
+ ClearBut},
+ {401,35,90,20,
+ "Set Size",
+ RdSetSprBut,
+ SetSprBut},
+ {501,10,90,20,
+ "Quit",
+ RdQuitBut,
+ QuitBut}
+ };
+
+#define MAXSTRLEN 64
+
+int quit=False;
+int selcol;
+int range=False;
+int width=1;
+int drawmode=PLOT;
+int last_x=-1,last_y=-1;
+XColor xc[256];
+int namelen=0;
+char name[MAXSTRLEN];
+int SPR_W=MAX_SPR_W;
+int SPR_H=MAX_SPR_H;
+int GRID_W=SETGW(MAX_SPR_W,MAX_SPR_H);
+unsigned char sprite[MAX_SPR_W][MAX_SPR_H];
+
+
+int main(argc,argv)
+int argc;
+char *argv[];
+
+{
+ XEvent event;
+ unsigned long evmask;
+ XFuncControl Process();
+ int f;
+
+ size_hints.flags=PPosition|PSize|PMinSize|PMaxSize;
+ size_hints.x=WINX;
+ size_hints.y=WINY;
+ size_hints.width=size_hints.min_width=WINW;
+ size_hints.height=size_hints.min_height=WINH;
+ size_hints.max_width=WINW;
+ size_hints.max_height=WINH;
+
+ evmask=ExposureMask|ButtonPressMask|StructureNotifyMask|KeyPressMask;
+
+ window=OpenWin(argc,argv,argv[0],
+ WINX,WINY,WINW,WINH,0,0,
+ evmask,
+ &size_hints,&black,&white);
+
+ DisableDoubleBuffer();
+
+ disp=GetDisplay();
+
+ cm=XCreateColormap(disp,window,DefaultVisual(disp,0),AllocAll);
+ XSetWindowColormap(disp,window,cm);
+
+ font=XUseFont("fixed");
+
+ SetCmFade(W_MAX,W_MIN,xc,DoRed|DoBlue|DoGreen);
+ SetCmFade(R_MAX,R_MIN,xc,DoRed);
+ SetCmFade(B_MAX,B_MIN,xc,DoBlue);
+ SetCmFade(G_MAX,G_MIN,xc,DoGreen);
+ SetCmFade(RG_MAX,RG_MIN,xc,DoRed|DoGreen);
+ SetCmFade(RB_MAX,RB_MIN,xc,DoRed|DoBlue);
+ SetCmFade(BG_MAX,BG_MIN,xc,DoBlue|DoGreen);
+
+ for(f=RND_MAX;f<=RND_MIN;f++)
+ {
+ xc[f].pixel=f;
+ xc[f].flags=DoRed|DoBlue|DoGreen;
+ xc[f].red=RND(0xff)*0xff;
+ xc[f].green=RND(0xff)*0xff;
+ xc[f].blue=RND(0xff)*0xff;
+ }
+
+ black=1;
+ white=0;
+ selcol=white;
+
+ xc[black].pixel=black;
+ xc[black].flags=DoRed|DoBlue|DoGreen;
+ xc[black].red=xc[black].blue=xc[black].green=0;
+
+ xc[white].pixel=white;
+ xc[white].flags=DoRed|DoBlue|DoGreen;
+ xc[white].red=xc[white].blue=xc[white].green=0xffff;
+
+ XStoreColors(disp,cm,xc,256);
+
+ MainLoop(argc,argv);
+}
+
+
+SetCmFade(c1,c2,xc,fl)
+int c1,c2;
+XColor xc[];
+int fl;
+
+{
+ int f,n,r;
+
+ n=(c2-c1)+1;
+ n=0xff/n;
+
+ for(f=c1,r=0xff;f<=c2;f++,r-=n)
+ {
+ xc[f].pixel=f;
+ xc[f].flags=DoRed|DoBlue|DoGreen;
+
+ if (fl&DoRed)
+ xc[f].red=r*0xff;
+ else
+ xc[f].red=0;
+
+ if (fl&DoGreen)
+ xc[f].green=r*0xff;
+ else
+ xc[f].green=0;
+
+ if (fl&DoBlue)
+ xc[f].blue=r*0xff;
+ else
+ xc[f].blue=0;
+
+ }
+}
+
+/* Main Loop */
+
+MainLoop(argc,argv)
+int argc;
+char *argv[];
+
+{
+ XEvent e;
+ KeySym ks;
+ char keybuf[10];
+ int f,x,y;
+
+ name[0]=NULL;
+
+ for(x=0;x<SPR_W;x++)
+ for(y=0;y<SPR_H;y++)
+ sprite[x][y]=(x*y)%256;
+
+ if (argc>1)
+ {
+ strcpy(name,argv[1]);
+ namelen=strlen(name);
+ }
+
+ RedrawButs();
+ RedrawCmap();
+ RedrawSel();
+ RedrawStr();
+ RedrawSpr();
+ Redraw(0,0);
+
+ while(!quit)
+ {
+ if(XPending(disp))
+ {
+ XNextEvent(disp,&e);
+
+ switch(e.type)
+ {
+ case KeyPress:
+ XLookupString(&e,keybuf,10,&ks,NULL);
+
+ switch(ks)
+ {
+ case XK_Delete:
+ case XK_BackSpace:
+ if (namelen)
+ {
+ name[--namelen]=NULL;
+ RedrawStr();
+ Redraw(0,0);
+ }
+ break;
+
+ default:
+ switch(keybuf[0])
+ {
+ case '':
+ name[namelen=0]=NULL;
+ RedrawStr();
+ Redraw(0,0);
+ break;
+
+ case '\n':
+ case '\r':
+ case '\t':
+ break;
+
+ default:
+ if (namelen<MAXSTRLEN-1)
+ {
+ name[namelen++]=keybuf[0];
+ name[namelen]=NULL;
+ RedrawStr();
+ Redraw(0,0);
+ }
+ break;
+ }
+ break;
+ }
+ break;
+
+ case ButtonPress:
+ if (!range)
+ ButtonPoll(butlist,NO_BUT,e.xbutton.x,e.xbutton.y);
+
+ if (!range)
+ SpritePress(e.xbutton.x,e.xbutton.y,e.xbutton.button);
+
+ if (range)
+ {
+ if (ColPress(e.xbutton.x,e.xbutton.y,&f))
+ {
+ RangeCols(selcol,f);
+ range=False;
+ RedrawCmap();
+ RedrawSel();
+ Redraw(0,0);
+ }
+ }
+ else
+ if(ColPress(e.xbutton.x,e.xbutton.y,&selcol))
+ {
+ RedrawCmap();
+ RedrawSel();
+ Redraw(0,0);
+ }
+
+ break;
+
+ case Expose:
+ if (e.xexpose.count)
+ break;
+ Redraw(0,0);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+}
+
+
+/* Main Loop routines */
+
+NullStr()
+
+{
+ strcpy(name,"");
+ namelen=0;
+ RedrawStr();
+}
+
+
+RedrawAll()
+
+{
+ XCls(black);
+ RedrawButs();
+ RedrawCmap();
+ RedrawSel();
+ RedrawStr();
+ RedrawSpr();
+ Redraw(0,0);
+}
+
+RedrawButs()
+
+{
+ int f;
+
+ XCls(black);
+
+ for(f=0;f<NO_BUT;f++)
+ ButtonRedraw(&butlist[f]);
+}
+
+
+RedrawCmap()
+
+{
+ int x,y,f;
+
+ x=CMAP_X;
+ y=CMAP_Y;
+
+ for(f=0;f<256;f++,x+=CMAP_W)
+ {
+ if ((f)&&(!(f%CMAP_N)))
+ {
+ y+=CMAP_H;
+ x=CMAP_X;
+ }
+ XFillBox(x,y,CMAP_W,CMAP_H,f);
+ }
+}
+
+
+RedrawSel()
+
+{
+ XFillBox
+ (0,CMAP_Y-5-font->max_bounds.ascent,WINW,font->max_bounds.ascent+2,black);
+
+ Xprintf(0,CMAP_Y-5,white,"Colour selected : %4d",selcol);
+
+ XBox(CMAP_X+(selcol%CMAP_N)*CMAP_W,CMAP_Y+(selcol/CMAP_N)*CMAP_H,
+ CMAP_W,CMAP_H,white);
+}
+
+
+RedrawStr()
+
+{
+ char s[MAXSTRLEN+1];
+ int f;
+
+ for(f=0;f<MAXSTRLEN;f++)
+ if (f<namelen)
+ s[f]=name[f];
+ else
+ s[f]='_';
+
+ s[MAXSTRLEN]=0;
+
+ XFillBox
+ (0,STR_Y-font->max_bounds.ascent,WINW,font->max_bounds.ascent+2,black);
+ Xprintf(0,STR_Y,white,"Name : %s",s);
+}
+
+
+RedrawSpr()
+
+{
+ int x,y,f,r;
+
+ for(f=0,x=GRID_X;f<=SPR_W;f++,x+=GRID_W)
+ XLine(x,GRID_Y,x,GRID_Y+GRID_W*SPR_H,white);
+
+ for(r=0,y=GRID_Y;r<=SPR_H;r++,y+=GRID_W)
+ XLine(GRID_X,y,GRID_X+GRID_W*SPR_W,y,white);
+
+ for(x=0;x<SPR_W;x++)
+ for(y=0;y<SPR_H;y++)
+ SprPlot(x,y,sprite[x][y]);
+}
+
+
+SpritePress(x,y,b)
+int x,y,b;
+
+{
+ int dx,dy;
+ int c;
+
+ x-=GRID_X;
+ y-=GRID_Y;
+ x/=GRID_W;
+ y/=GRID_W;
+
+ if (b==3)
+ c=black;
+ else
+ c=selcol;
+
+ if ((x<0)||(x>=SPR_W)||(y<0)||(y>=SPR_H))
+ return;
+
+ if(b==2)
+ {
+ selcol=sprite[x][y];
+ RedrawCmap();
+ RedrawSel();
+ }
+ else
+ switch(drawmode)
+ {
+ case PLOT:
+ SprSet(x,y,c);
+ break;
+
+ case FILL:
+ if (sprite[x][y]!=c)
+ SprFill(x,y,c,sprite[x][y]);
+ break;
+
+ case LINE:
+ if (last_x==-1)
+ {
+ last_x=x;
+ last_y=y;
+ SprPlot(x,y,sprite[x][y]^255);
+ }
+ else
+ {
+ SprLine(x,y,last_x,last_y,selcol);
+
+ last_x=-1;
+ last_y=-1;
+ }
+ break;
+
+ case RECT:
+ if (last_x==-1)
+ {
+ last_x=x;
+ last_y=y;
+ SprPlot(x,y,sprite[x][y]^255);
+ }
+ else
+ {
+ if (x>last_x)
+ {
+ dx=last_x;
+ last_x=x;
+ x=dx;
+ }
+
+ if (y>last_y)
+ {
+ dy=last_y;
+ last_y=y;
+ y=dy;
+ }
+
+ for(dx=x;dx<=last_x;dx++)
+ {
+ SprSet(dx,y,selcol);
+ SprSet(dx,last_y,selcol);
+ }
+
+ for(dy=y;dy<=last_y;dy++)
+ {
+ SprSet(x,dy,selcol);
+ SprSet(last_x,dy,selcol);
+ }
+
+ last_x=-1;
+ last_y=-1;
+ }
+ break;
+
+ case BOX:
+ if (last_x==-1)
+ {
+ last_x=x;
+ last_y=y;
+ SprPlot(x,y,sprite[x][y]^255);
+ }
+ else
+ {
+ if (x>last_x)
+ {
+ dx=last_x;
+ last_x=x;
+ x=dx;
+ }
+
+ if (y>last_y)
+ {
+ dy=last_y;
+ last_y=y;
+ y=dy;
+ }
+
+ for(dx=x;dx<=last_x;dx++)
+ for(dy=y;dy<=last_y;dy++)
+ SprSet(dx,dy,selcol);
+
+ last_x=-1;
+ last_y=-1;
+ }
+ break;
+
+ case CIRCLE:
+ if (last_x==-1)
+ {
+ last_x=x;
+ last_y=y;
+ SprPlot(x,y,sprite[x][y]^255);
+ }
+ else
+ {
+ if (ABS(last_x-x)<ABS(last_y-y))
+ SprCircle(last_x,last_y,
+ ABS(last_y-y),ABS(last_y-y),selcol);
+ else
+ SprCircle(last_x,last_y,
+ ABS(last_x-x),ABS(last_x-x),selcol);
+
+ last_x=-1;
+ last_y=-1;
+ }
+ break;
+
+ case OVAL:
+ if (last_x==-1)
+ {
+ last_x=x;
+ last_y=y;
+ SprPlot(x,y,sprite[x][y]^255);
+ }
+ else
+ {
+ SprCircle(last_x,last_y,ABS(last_x-x),ABS(last_y-y),selcol);
+
+ last_x=-1;
+ last_y=-1;
+ }
+ break;
+
+ }
+
+ Redraw(0,0);
+}
+
+
+SprCircle(x,y,rx,ry,c)
+int x,y,rx,ry,c;
+
+{
+ int odx,ody,dy,dx,a;
+
+ SprPlot(x,y,sprite[x][y]);
+
+ odx=x+(int)(sin(RAD(a))*rx);
+ ody=y+(int)(cos(RAD(a))*ry);
+
+ for(a=0;a<360;a+=5)
+ {
+ dx=x+(int)(sin(RAD(a))*rx);
+ dy=y+(int)(cos(RAD(a))*ry);
+
+ SprLine(dx,dy,odx,ody,c);
+
+ odx=dx;
+ ody=dy;
+ }
+}
+
+
+SprLine(p1x,p1y,p2x,p2y,c)
+int p1x,p1y,p2x,p2y,c;
+
+{
+ int f;
+ int dx,dy,ix,iy,incrE,incrNE,d,x,y,ymode;
+
+ dx=p2x-p1x;
+ dy=p2y-p1y;
+
+ ix=SGN(dx);
+ iy=SGN(dy);
+
+ dx=ABS(dx);
+ dy=ABS(dy);
+
+ if (dy>dx)
+ {
+ ymode=True;
+ d=dx*2-dy;
+ incrE=dx*2;
+ incrNE=(dx-dy)*2;
+ }
+ else
+ {
+ ymode=False;
+ d=dy*2-dx;
+ incrE=dy*2;
+ incrNE=(dy-dx)*2;
+ }
+
+ x=p1x;
+ y=p1y;
+
+ SprSet(x,y,c);
+
+ if (ymode)
+ while(y!=p2y)
+ {
+ if (d<=0)
+ {
+ d+=incrE;
+ y+=iy;
+ }
+ else
+ {
+ d+=incrNE;
+ y+=iy;
+ x+=ix;
+ }
+
+ SprSet(x,y,c);
+ }
+ else
+ while(x!=p2x)
+ {
+ if (d<=0)
+ {
+ d+=incrE;
+ x+=ix;
+ }
+ else
+ {
+ d+=incrNE;
+ y+=iy;
+ x+=ix;
+ }
+
+ SprSet(x,y,c);
+ }
+}
+
+
+SprSet(x,y,c)
+int x,y,c;
+
+{
+ if ((x<0)||(x>=SPR_W)||(y<0)||(y>=SPR_H))
+ return;
+
+ sprite[x][y]=c;
+ SprPlot(x,y,c);
+}
+
+
+SprPlot(x,y,c)
+int x,y,c;
+
+{
+ XPlot(SPR_X+x,SPR_Y+y,c);
+
+ x=GRID_X+(x*GRID_W)+1;
+ y=GRID_Y+(y*GRID_W)+1;
+
+ XFillBox(x,y,GRID_W-1,GRID_W-1,c);
+}
+
+
+SprFill(x,y,c,bc)
+int x,y,c,bc;
+
+{
+ if ((x<0)||(x>=SPR_W)||(y<0)||(y>=SPR_H)||(sprite[x][y]==c)||
+ (sprite[x][y]!=bc))
+ return;
+
+ SprSet(x,y,c);
+
+ SprFill(x-1,y,c,bc);
+ SprFill(x+1,y,c,bc);
+ SprFill(x,y-1,c,bc);
+ SprFill(x,y+1,c,bc);
+}
+
+
+ColPress(x,y,c)
+int x,y,*c;
+
+{
+ int lc;
+
+ x-=CMAP_X;
+ x/=CMAP_W;
+ y-=CMAP_Y;
+ y/=CMAP_H;
+
+ lc=y*CMAP_N+x;
+
+ if ((lc<0)||(lc>255))
+ return(False);
+ else
+ {
+ *c=lc;
+ return(True);
+ }
+}
+
+
+RangeCols(a,b)
+int a,b;
+
+{
+ int f,n,rc,gc,bc;
+
+ if (a>b)
+ {
+ f=a;
+ a=b;
+ b=f;
+ }
+
+ n=(b-a);
+
+ rc=((int)xc[b].red-(int)xc[a].red)/n;
+ gc=((int)xc[b].green-(int)xc[a].green)/n;
+ bc=((int)xc[b].blue-(int)xc[a].blue)/n;
+
+ for(f=1;f<n;f++)
+ {
+ xc[a+f].red=xc[a].red+(f*rc);
+ xc[a+f].green=xc[a].green+(f*gc);
+ xc[a+f].blue=xc[a].blue+(f*bc);
+ }
+ XStoreColors(disp,cm,xc,256);
+}
+
+
+/* Button Routines */
+
+isin(x,y,bx,by,bw,bh)
+int x,y,bx,by,bw,bh;
+
+{
+ if ((x>=bx)&&(x<=bx+bw)&&(y>=by)&&(y<=by+bh))
+ return(True);
+ else
+ return(False);
+}
+
+ButtonPoll(b,n,x,y)
+Button b[];
+int n;
+int x,y;
+
+{
+ int f;
+
+ for(f=0;f<n;f++)
+ if (isin(x,y,b[f].x,b[f].y,b[f].w,b[f].h))
+ {
+ (*b[f].callback)();
+ (*b[f].redraw)(&b[f]);
+ Redraw(0,0);
+ }
+}
+
+ButtonText(b)
+Button *b;
+
+{
+ XFillBox(b->x,b->y,b->w,b->h,black);
+ XBox(b->x,b->y,b->w,b->h,white);
+ Xprintf(
+ (b->x)+(b->w/2)-(strlen(b->text))*(font->max_bounds.width/2),
+ (b->y)+(b->h/2)+(font->max_bounds.descent/2),
+ white,"%s",b->text);
+}
+
+
+ButtonRedraw(b)
+Button *b;
+
+{
+ XBox(b->x,b->y,b->w,b->h,white);
+
+ if (b->redraw)
+ (*b->redraw)(b);
+}
+
+/* Button Callbacks and redraws */
+
+int RdCmapBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int CmapBut()
+
+{
+ unsigned short us;
+ int fd,f;
+
+ if ((fd=open(name,O_WRONLY|O_CREAT|O_TRUNC,0666))==-1)
+ {
+ fprintf(stderr,"Couldn't save colormap to %s!\n",name);
+ return;
+ }
+
+ for(f=0;f<256;f++)
+ {
+ us=htons(xc[f].red);
+ write(fd,&us,sizeof(unsigned short));
+ us=htons(xc[f].green);
+ write(fd,&us,sizeof(unsigned short));
+ us=htons(xc[f].blue);
+ write(fd,&us,sizeof(unsigned short));
+ }
+
+ close(fd);
+}
+
+
+int RdLoadCmapBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int LoadCmapBut()
+
+{
+ unsigned short us;
+ int fd,f;
+
+ if ((fd=open(name,O_RDONLY))==-1)
+ {
+ fprintf(stderr,"Couldn't read colormap from %s!\n",name);
+ return;
+ }
+
+ for(f=0;f<256;f++)
+ {
+ read(fd,&us,sizeof(unsigned short));
+ xc[f].red=ntohs(us);
+ read(fd,&us,sizeof(unsigned short));
+ xc[f].green=ntohs(us);
+ read(fd,&us,sizeof(unsigned short));
+ xc[f].blue=ntohs(us);
+ }
+
+ close(fd);
+
+ XStoreColors(disp,cm,xc,256);
+}
+
+
+int RdSprSaveBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int SprSaveBut()
+
+{
+ int fd,x,y;
+ unsigned short s;
+
+ if ((fd=open(name,O_WRONLY|O_CREAT,0666))==-1)
+ {
+ fprintf(stderr,"Couldn't save sprite to %s!\n",name);
+ return;
+ }
+
+ write(fd,"XbitSprite",11);
+
+ s=htons(SPR_W);
+ write(fd,&s,sizeof(unsigned short));
+
+ s=htons(SPR_H);
+ write(fd,&s,sizeof(unsigned short));
+
+ for(y=0;y<SPR_H;y++)
+ for(x=0;x<SPR_W;x++)
+ write(fd,&sprite[x][y],sizeof(unsigned char));
+
+ close(fd);
+}
+
+
+int RdSprLoadBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int SprLoadBut()
+
+{
+ int fd,x,y;
+ unsigned short s;
+ char m[11];
+
+ if ((fd=open(name,O_RDONLY))==-1)
+ {
+ fprintf(stderr,"Couldn't read sprite from %s!\n",name);
+ return;
+ }
+
+ read(fd,m,11);
+
+ if (strncmp("XbitSprite",m,10))
+ {
+ fprintf(stderr,"%s not a sprite!\n",name);
+ return;
+ }
+
+ read(fd,&s,sizeof(unsigned short));
+ SPR_W=ntohs(s);
+ read(fd,&s,sizeof(unsigned short));
+ SPR_H=ntohs(s);
+
+ GRID_W=SETGW(MAX_SPR_W,SPR_H);
+
+ for(y=0;y<SPR_H;y++)
+ for(x=0;x<SPR_W;x++)
+ read(fd,&sprite[x][y],sizeof(unsigned char));
+
+ close(fd);
+
+ RedrawAll();
+}
+
+
+int RdSetCol(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int SetCol()
+
+{
+ static char *dum="0";
+ char *r,*g,*b,s[MAXSTRLEN];
+ int rc,gc,bc;
+
+ strcpy(s,name);
+
+ r=strtok(s," ");
+ g=strtok(NULL," ");
+ b=strtok(NULL," ");
+
+ if (!r)
+ r=dum;
+ if (!b)
+ b=dum;
+ if (!g)
+ g=dum;
+
+ xc[selcol].red=(int)strtol(r,NULL,0)*0xff;
+ xc[selcol].green=(int)strtol(g,NULL,0)*0xff;
+ xc[selcol].blue=(int)strtol(b,NULL,0)*0xff;
+
+ NullStr();
+
+ XStoreColors(disp,cm,xc,256);
+}
+
+
+int RdDrawMode(b)
+Button *b;
+
+{
+ switch(drawmode)
+ {
+ case PLOT:
+ b->text=PLOT_TXT;
+ break;
+
+ case FILL:
+ b->text=FILL_TXT;
+ break;
+
+ case LINE:
+ b->text=LINE_TXT;
+ break;
+
+ case RECT:
+ b->text=RECT_TXT;
+ break;
+
+ case BOX:
+ b->text=BOX_TXT;
+ break;
+
+ case CIRCLE:
+ b->text=CIRCLE_TXT;
+ break;
+
+ case OVAL:
+ b->text=OVAL_TXT;
+ break;
+
+ default:
+ b->text=ENDMODE_TXT;
+ break;
+ }
+ ButtonText(b);
+}
+
+
+int DrawMode()
+
+{
+ if(++drawmode==ENDMODE)
+ drawmode=PLOT;
+
+ if (last_x!=-1)
+ RedrawSpr();
+
+ last_x=last_y=-1;
+}
+
+
+int RdSpreadBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int SpreadBut()
+
+{
+ range=True;
+}
+
+
+int RdClearToBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int ClearToBut()
+
+{
+ int x,y;
+
+ for(x=0;x<SPR_W;x++)
+ for(y=0;y<SPR_H;y++)
+ SprSet(x,y,selcol);
+}
+
+
+int RdClearBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int ClearBut()
+
+{
+ int x,y;
+
+ for(x=0;x<SPR_W;x++)
+ for(y=0;y<SPR_H;y++)
+ SprSet(x,y,black);
+}
+
+
+int RdSetSprBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int SetSprBut()
+
+{
+ int n;
+
+ n=(int)strtol(name,NULL,0);
+
+ if (n<1)
+ n=2;
+
+ if (n>MAX_SPR_W)
+ n=MAX_SPR_W;
+
+ SPR_W=n;
+ SPR_H=n;
+
+ GRID_W=SETGW(MAX_SPR_W,n);
+
+ NullStr();
+
+ RedrawAll();
+}
+
+
+int RdQuitBut(b)
+Button *b;
+
+{
+ ButtonText(b);
+}
+
+
+int QuitBut()
+
+{
+ quit=True;
+}