diff --git a/star.c b/star.c index cb1d732..feebe18 100644 --- a/star.c +++ b/star.c @@ -2,40 +2,265 @@ #include #include +/* levels have fixed, hardcoded dimensions */ #define LEVEL_HEIGHT 9 #define LEVEL_WIDTH 16 -#define WALL 'W' -#define BALL 'B' -#define CUBE 'C' -#define VOID 'V' -#define GIFT 'G' +#define WALL '#' +#define BALL '@' +#define CUBE 'H' +#define VOID ' ' +#define GIFT '*' -char* levels[] = { "WWWWWWWWWWWWWWWWWBWWVVVVVVVVGWCWWVVVVVVVVVVGVWWWWVVVVVVVWWGVVVVWWVVVWWVGVVVVVVWWWWVGVVGVVVVVGVVWWVGVVVVVVGWWVGVWWVVVVVWWGVVVVVGWWWWWWWWWWWWWWWWW", - "VWVVWVWVWVVVWVWWWVVVGVVVVVVVVVBWVVVWGVVWGVVVGVVVWVWVGVVVVVGVVWVWVVVVVVWVVVGVVVWVWVVVVWCWVVGVVVVWVVVWVVWVWVVVWGGWWVVVVVVVVVVVVVWVVWVVWVVVVVVVVWVV", - "WWWWWWWWWWWWWWWWWVVVVVVVVVVVGWBWWVVVWWVVVVVVWWCWWVVVWGVVVVVGVVVWWVGVVVVVGWWVVVGWWVWGVVGVVGWVVGWWWVWWGVWGVVGVGWWWWGVVVVWWGVVVVVVWWWWWWWWWWWWWWWWW", - "WWWWWWWWWWWWWWWWWVVVVVVVVVVVVWCWWVVVVVWVVVVVVVVWWWGWGVGWGWGWGWGWWVWVWGVGWVWVWVWWWWGWGWGVGWGWGWGWWVVVVVWVVVVVVVVWWVVVWVVVVVVVWBVWWWWWWWWWWWWWWWWW", - "VWWWWWWWWWWWWWWVWBVVWVVVWVVWVVVWWVVWGVWVGVVGVWVWWWVVVVVVWVVWVVVWWGVWGWVVVVVVVVWWWWVVVVVWVGVWVVVWWGWVVWVWVWVVVWCWWVVVWVVVVGWVVWGWVWWWWWWWWWWWWWWV", - "VVVVWWWWWWWWWWWWVVVWVVVGVVVWGVGWVVWVVVVGVVVVWVWWVWVVVVVGVVVV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WVWVGVVVWVVWVWWVCVWVVWWVVWVBGWWVWVVWVVVGVWVWVWWWVVVGWWVWGVVGWWWVVVVVVVVGWGVVVWWWWWWWWWWWWWWWWW", - "WWWWWWWWWWWWWWWWWVWWWVVVVVGVVVWWWVVVWVVVVVVVWVWWWVVVWWGVVVVVVGVWWVVGVVVVGVVVGVWWWVVVVWVVVVWWWGVWWVVGVGVBVCVGVGGWWWWWWWWWWWWWWWWWVVVVVVVVVVVVVVVV", - "WWWWWWWWWWWWWWWWWGWVVWGWVWGVVWVWWVVVVWVVVVVVVVVWWGVVVWVVWGVVGVVWWWVWGVVVVVVGVWWWWVGVWVVVWWWGVVVWWVVVVVWBWCVVGVVWWWWWWWWWWWWWWWWWVVVVVVVVVVVVVVVV", - "VWWWWWWWWWWWWWWVWVWVVWGWVWGVVWVWWVVVVGVVWVVVVVVWWWVVVWVVVGVWGVVWWVVWGVVWVVGGVGVWWWGVWVVVWWVGVVVWWVVVVVWBWCVVGVVWVWWWWWWWWWWWWWWVVVVVVVVVVVVVVVVV", - "WWWWWWWWWWWWWWWWWVVVVVWVVVVVVVWWWVWWGVGVVVVWWGWWWVWGVVVVVGWVVWWWWVGGVVGWVWWVVVVWWVWGVGVWVVVVWWVWWVWWVVVBWCWWWGGWWWWWWWWWWWWWWWWWVVVVVVVVVVVVVVVV", - "WWWWWWWWWWWWWWWWWVVVVVVVVVVVVWVWWVGVWWGVVVGVVVVWWVVVWGVVGVVWWVVWWVGVVVVWWVVWGVVWWVWGVVVGWVVVVGVWWVWWGVWBVCVVVVVWWWWWWWWWWWWWWWWWVVVVVVVVVVVVVVVV" }; +char* levels[] = { "################" + "#@## *#H#" + "# * ###" + "# ##* #" + "# ## * ##" + "## * * * #" + "# * *## * #" + "# ##* *#" + "################", + + " # # # # # ##" + "# * @#" + " #* #* * " + "# # * * # #" + " # * # " + "# #H# * #" + " # # # #**#" + "# # " + " # # # ", + + "################" + "# *#@#" + "# ## ##H#" + "# #* * #" + "# * *## *#" + "# #* * *# *##" + "# ##* #* * *###" + "#* ##* #" + "################", + + "################" + "# #H#" + "# # #" + "##*#* *#*#*#*#*#" + "# # #* *# # # ##" + "##*#*#* *#*#*#*#" + "# # #" + "# # #@ #" + "################", + + " ############## " + "#@ # # # #" + "# #* # * * # #" + "## # # #" + "#* #*# ##" + "## # * # #" + "#*# # # # #H#" + "# # *# #*#" + " ############## ", + + " ############" + " # * #* *#" + " # * # ##" + " # * #" + "#@ * #" + "## * # ##" + "# * # #" + "#H # * ##* #" + "################", + + "################" + "# #" + " ## ### #* ##*#" + " #* #* # # # # " + " # # ### ## " + " ## # #*# #*# " + "# #" + "# @#* H #*#" + "################", + + "############### " + "# *## ##" + "# #* ## * #" + "# *## # #* #" + "## ## #*# #" + "## # *#* #" + "#*H*# * #@# #" + "## #" + " ###############", + + " # ########### " + " #*#* # @#" + "#* *# * # " + " # # *## *# #" + "# #* #*H* *#" + "# *## # " + "#*#* # " + "# # " + "############ ", + + " ########### " + "#### * #" + "# H ###* *# *#" + "# * #* #* # " + "# # * # *#" + "#*#* # *# #@# " + " #* ### ### " + "# # # # " + " ######### # #", + + "################" + "# # @#" + "# #** ** ##" + "## * ## *#" + "#* #*#** ###" + "## ## ## #" + "#* *# * H *#" + "##*### # ##" + " ## ########### ", + + "## ## #### " + "#@#####* ### *##" + "# ** * #" + "# ## ##* #*# #" + "# # * ###* ## #" + "# ## ## #H# #" + "# * #" + "# * #" + "################", + + " ############## " + "# @# * ##" + "# # #* *## #" + "# * # #" + "# * #*#" + "# # * #" + "## * * #*#" + "#H # * # # #" + " ############## ", + + "################" + "#*#* *#*#" + "# *#@ ## #" + "# H * #" + "# *# #" + "# * #" + "# *# # #" + "#*#* *#*#" + "################", + + " ###### ####### " + "# *# * #" + "# # * # # * #" + "# @# #** #* #" + " # # # * H# #" + "#* # #* #" + " # * # " + "#* *#" + " ############## ", + + "################" + "## H#* * *#" + "#* @*#* ##" + "## ### * ##" + "## *#*# #" + "#** *#* #" + "## * ####* #" + "##*# # #" + "################", + + "################" + "# *# #@ #" + "# # *#**#* # #" + "# #*##*# * #" + "# *# *# #" + "# *#* *# #" + "# # # ##*# # #" + "# * #* H #" + "################", + + "################" + "# * * H# #" + "# #*#* #* #" + "# #*# #* #" + "# * # *#* #" + "# #*# # *# #" + "# *#* # * # #" + "#*#@ # # #" + "################", + + "################" + "#* ## ##*#" + "# # # #* #" + "# *# *## * #" + "# # #* #" + "# # *# #" + "# ## *# ##* #H#" + "# *# #* ##@#" + "################", + + "################" + "# *#* #" + "##* *# ##* ##" + "# # # * # # #" + "# H # ## # @*#" + "# # # * # # #" + "## *## #* *##" + "# *#* #" + "################", + + "################" + "# ### * ##" + "# # # ##" + "# ##* * #" + "# * * * ##" + "# # ###* #" + "# * * @ H * **#" + "################" + " ", + + "################" + "#*# #*# #* # #" + "# # #" + "#* # #* * #" + "## #* * ###" + "# * # ###* #" + "# #@#H * #" + "################" + " ", + + " ############## " + "# # #*# #* # #" + "# * # #" + "## # * #* #" + "# #* # ** * #" + "##* # ## * #" + "# #@#H * #" + " ############## " + " ", + + "################" + "# # ##" + "# ##* * ##*##" + "# #* *# ###" + "# ** *# ## #" + "# #* * # ## #" + "# ## @#H###**#" + "################" + " ", + + "################" + "# # #" + "# * ##* * #" + "# #* * ## #" + "# * ## #* #" + "# #* *# * #" + "# ##* #@ H #" + "################" + " " }; struct state { char level[ LEVEL_HEIGHT * LEVEL_WIDTH ];