/* COLONY - A Colony on a new and hostile planet (C) Copyright 1995, Peter Harrison (C) Copyright 1995, Ashley Noble (Graphics Libary) */ #include #include #include #include "c:\tc\vga_13\vga13.h" #include "colony.h" /* OBJECTS */ unsigned char greble1[] = { 42, 6, 0, 0, 0, 0, 6, 42, 42, 0, 0, 14, 14, 0, 0, 42, 0, 42, 0, 39, 39, 0, 42, 0, 0, 0, 42, 39, 39, 42, 0, 0, 42, 42, 42, 39, 39, 42, 42, 42, 0, 0, 42, 39, 39, 42, 0, 0, 0, 42, 0, 39, 39, 0, 42, 0, 42, 0, 0, 0, 0, 0, 0, 42, }; unsigned char greble2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 0, 0, 0, 0, 44, 44, 44, 44, 43, 0, 43, 44, 44, 19, 44, 44, 44, 43, 43, 44, 44, 44, 44, 44, 44, 43, 43, 0, 44, 44, 44, 44, 44, 0, 43, 0, 0, 44, 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; unsigned char greble3[] = { 0, 0, 0, 14, 14, 0, 0, 0, 0, 0, 14, 23, 23, 14, 0, 0, 0, 72, 72, 14, 14, 72, 72, 0, 72, 0, 14, 14, 14, 14, 0, 72, 0, 0, 14, 14, 14, 14, 0, 0, 0, 72, 72, 14, 14, 72, 72, 0, 72, 0, 0, 14, 14, 0, 0, 72, 0, 0, 14, 14, 14, 14, 0, 0, }; unsigned char greble4[] = { 0, 0, 0, 0, 0, 40, 40, 0, 0, 0, 47, 47, 0, 40, 0, 40, 0, 0, 0, 47, 57, 57, 40, 40, 47, 49, 0, 45, 57, 57, 0, 0, 0, 0, 45, 45, 45, 47, 47, 0, 49, 45, 45, 45, 0, 0, 47, 0, 0, 45, 45, 0, 49, 0, 0, 0, 0, 0, 49, 0, 49, 0, 0, 0, }; unsigned char greble5[] = { 0, 0, 0, 0, 68, 68, 68, 0, 0, 0, 0, 68, 68, 40, 68, 68, 0, 0, 39, 43, 68, 68, 23, 23, 0, 0, 40, 43, 43, 0, 68, 68, 0, 40, 43, 43, 43, 0, 0, 0, 0, 39, 43, 43, 0, 43, 43, 0, 0, 0, 43, 43, 0, 0, 0, 0, 43, 43, 0, 43, 43, 43, 0, 0, }; /* */ #define B 0 #define FG 0xFF #if 0 unsigned char greble7[] = { B, B, B, B, B, B, B, B, B, B, B, FG, FG, B, B, B, B, FG, FG, FG, FG, FG, B, B, B, B, B, B, FG, FG, FG, B, B, B, B, FG, B, B, FG, FG, B, B, FG, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_sea[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, FG, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_net[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_land[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, FG, B, B }; unsigned char o_fence[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_seaside[] = { B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_destroy[] = { B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_carnivore[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_unused[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; #else unsigned char greble7[] = { B, B, B, B, B, B, B, B, B, B, B, FG, FG, B, B, B, B, FG, FG, FG, FG, FG, B, B, B, B, B, B, FG, FG, FG, B, B, B, B, FG, B, B, FG, FG, B, B, FG, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_sea[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, FG, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_net[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_land[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, FG, B, B }; unsigned char o_fence[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_seaside[] = { B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_destroy[] = { B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_carnivore[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; unsigned char o_comestible[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, FG, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B }; unsigned char o_unused[] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, FG, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B }; #endif unsigned char *organe[] = { o_sea, o_net, o_land, o_fence, o_seaside, o_destroy, o_carnivore, o_comestible, o_unused }; unsigned char *greble[] = { "", greble1, greble2, greble3, greble4, greble5 }; unsigned char tree[] = { 0, 0, 0, 49, 49, 0, 0, 0, 0, 0, 49, 49, 49, 49, 0, 0, 0, 0, 49, 49, 49, 49, 0, 0, 0, 49, 49, 49, 49, 49, 49, 0, 0, 49, 49, 49, 49, 49, 49, 0, 0, 0, 0,114,114, 0, 0, 0, 0, 0, 0,114,114, 0, 0, 0, 0, 0, 0,114,114, 0, 0, 0, }; unsigned char home[] = { 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 0, 41, 41, 0, 0, 0, 0, 0, 41, 41, 41, 41, 0, 0, 0, 41, 0, 41, 41, 0, 41, 0, 0, 0, 0, 43, 43, 0, 0, 0, 0, 0, 43, 0, 0, 43, 0, 0, 0, 0, 43, 0, 0, 43, 0, 0, }; unsigned char unit[] = { 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 65, 20, 20, 65, 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 65, 0, 0, 56, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 0, 0, 56, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 56, 56, 56, 56, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 56, 56, 7, 56, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 56, 56, 56, 56, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 56, 0, 56, 56, 7, 56, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 67, 67, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0,110,110,110,110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,110,110,110,110,110,110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,110,110, 0, 0,110,110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,110,110, 0, 0,110,110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, 0, 0, 0, 42, 42, 42, 0, 0, 42, 42, 42, 0, 0, 0, 0, 0, }; unsigned char boat[] = { 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, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 65,113, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 65, 65,113, 0, 0, 0, 0, 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 57, 0,113, 0, 0, 0, 0, 0, 0, 65, 65, 58, 58, 58, 57, 57, 57, 57, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 57, 57, 57, 57, 57, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 57, 57, 0, 57, 57, 57, 0, 0, 114,114,114,114,114,114, 65, 65, 57,114,114,114,114,114,114,114, 0,114,114,114,114,114, 65, 65,114,114,114,114,114,114,114,114, 0, 0,114,114, 33, 33, 33, 45, 33, 33,114,114,114,114,114, 0, 0, 0, 33, 33, 33, 0, 0, 45, 9, 33, 33, 33, 33, 33,114, 0, 0, 0, 0, 0, 33, 0, 0, 9, 9, 0, 0, 0, 0, 33, 33, 0, 0, 0, 0, 0, 33, 33, 0, 0, 0, 9, 9, 0, 0, 0, 33, 33, 0, 0, 0, 0, 0, 33, 33, 0, 0, 0, 9, 0, 0, 0, 0, 0, }; unsigned char fight[] = { 0, 0, 0, 22, 22, 40, 40, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 22, 40, 22, 40, 40, 22, 0, 0, 0, 0, 0, 0, 0, 0, 22, 22, 40, 22, 22, 22, 40, 22, 22, 0, 0, 0, 0, 0, 0, 22, 22, 40, 40, 22, 22, 40, 22, 22, 40, 22, 0, 0, 0, 0, 0, 22, 40, 40, 22, 40, 40, 40, 22, 40, 40, 40, 22, 0, 0, 0, 0, 40, 40, 22, 22, 22, 22, 22, 40, 22, 22, 22, 40, 22, 0, 0, 0, 22, 22, 22, 22, 22, 22, 40, 22, 22, 22, 40, 22, 40, 22, 0, 0, 0, 22, 22, 22, 22, 40, 22, 22, 22, 40, 22, 40, 22, 22, 22, 0, 0, 0, 22, 22, 40, 22, 22, 22, 40, 22, 40, 22, 22, 22, 22, 22, 0, 0, 0, 22, 22, 40, 40, 40, 22, 40, 22, 22, 22, 22, 22, 22, 0, 0, 0, 0, 22, 22, 40, 22, 22, 40, 22, 22, 22, 22, 22, 22, 0, 0, 0, 0, 0, 22, 22, 22, 40, 40, 22, 40, 22, 22, 22, 40, 0, 0, 0, 0, 0, 0, 22, 22, 40, 40, 40, 40, 22, 22, 40, 22, 0, 0, 0, 0, 0, 0, 0, 22, 22, 22, 40, 40, 22, 40, 22, 22, 0, 0, 0, 0, 0, 0, 0, 0, 22, 22, 40, 40, 40, 22, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 22, 22, 22, 22, 0, 0, }; unsigned char tera0[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 33, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, }; unsigned char tera1[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1,119, 1, 1, 33, 33, 33, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1,119, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,119,119,119, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,119,121,119,119,119, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1,119,121,119,119,119, 1, 1, 1, 1, 1, 1, 33, 1, 1,121,121,119,121,119,119,119, 1, 1, 1, 1, 1, 1, 1, 1,121,121,119,121,121,119,119,119, 1, 1, 33, 33, 33, 1, 1, 1,121,121,121,121,121,119,119,119, 1, 33, 1, 1, 1, 1, 1,121,121,121,121,121,119,119,119,119, 1, 1, 1, 1, 1, 1,121,121,121,121,121,120,119,119,119,119, 1, 1, 1, 1, 1, 1,121,121,121,121,119,119,119,119,119,119, 1, 1, 1, 1, 1,119,119,121,119,119,119,119,119,119,119,119, 1, 1, 1, 1,119,119,119,119,119,119,119,119,119,119,119,119, 1, 1,119,119,119,119,119,119,119,119,119,119,119,119,119,119, 1,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, 1,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, }; unsigned char tera2[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, }; unsigned char tera3[] = { 120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 120,120, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 33, 33, 1, 1, 120,120,120,120,120,120,120,120, 1, 1, 1, 33, 1, 1, 1, 1, 120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, }; unsigned char tera4[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120, 1, 1, 1, 33, 33, 33, 1, 1, 1, 33, 33, 1, 1, 1,120,120, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120, 1, 1, 1, 1, 1, 1, 1, 33, 33, 1, 1, 1, 1,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1,120,120, 1, 1, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1,120,120,120, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120, 1, 1, 33, 33, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1,120,120, 1, 33, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120, }; unsigned char tera5[] = { 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,121,121,120,120,120,120,120,120,120,120,120,120,120, 121,121,121,121,121,121,121,121,120,120,120,119,119,120,120,120, 121,120,120,120,121,121,121,121,121,120,120,121,121,120,120,120, 120,120,120,120,121,121,121,121,121,120,120,119,121,121,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,121, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,121,120,120,120,120,121,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,117,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,117,117,120,120,120,120, 120,120,120,120,120,120,120,120,117,117,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, }; unsigned char tera6[] = { 120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 120,120,120,120, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 120,120,120, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 120,120,120, 1, 1, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 120,120, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; unsigned char tera7[] = { 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 33, 33, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120,120, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1,120,120,120,120, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120,120, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120, }; unsigned char tera8[] = { 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1,120,120,120,120, 1, 1,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 33, 33, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; unsigned char tera9[] = { 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 120,120,120,120,120,120,120,120,120,120,120,120, 43, 43, 1, 1, 120,120,120,120,120,120,120,120,120, 43, 43, 43, 43, 1, 1, 1, 120,120,120,120,120,120,120,120, 43, 43, 1, 1, 1, 1, 1, 1, 120,120,120,120,120,120, 43, 43, 43, 1, 1, 1, 1, 1, 1, 1, 120,120,120,120, 43, 43, 43, 43, 43, 1, 1, 1, 32, 32, 1, 1, 120,120,120, 43, 43, 43, 43, 43, 1, 1, 1, 32, 1, 1, 1, 1, 120,120,120, 43, 43, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120,120, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120, 43, 43, 1, 1, 1, 1, 32, 32, 32, 1, 1, 1, 1, 1, 120,120, 43, 1, 1, 1, 1, 1, 1, 1, 1, 32, 1, 1, 1, 1, 120,120, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120, 1, 1, 1, 32, 32, 32, 1, 1, 1, 32, 32, 32, 1, 1, 120,120, 1, 1, 32, 1, 1, 1, 1, 1, 32, 1, 1, 1, 1, 1, 120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; unsigned char tera10[] = { 1,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, }; unsigned char tera11[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120, 120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120,120, 120,120,120,120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120, 120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; unsigned char tera12[] = { 120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120, 120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120, 120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120,120, 120,120,120,120, 1, 1, 1, 1, 1, 1, 1,120,120,120,120,120, 120,120,120,120,120, 1, 1, 1,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, }; unsigned char tera13[] = { 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120, 1, 1,120,120,120,120,120,120,120,120,120,120, 120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120, 120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120, 120,120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120,120,120, 120, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,120, }; unsigned char tera14[] = { 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1,120,120,120,120,120,120,120,120,120,120,120,120,120, 1,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, }; unsigned char tera15[] = { 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120, 1, 1, 120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, }; unsigned char tera16[] = { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,120,120, 6, 6,120,120,120, 6,120,120, 6,120,120, 6,120, 6, 6,120, 6,120, 6,120,120,120, 6,120,120, 6,120,120, 6, 6,120, 6, 6,120,120,120,120,120,120,120,120,120,120,120,120, 6,120,120, 6, 6,120,120,120,120,120,120,120,120,120,120,120, 6,120,120, 6,120, 6,120,120,120,120,120,120,120,120,120,120, 6, 6,120, 6,120,120,120,120,120,120,120,120,120,120,120,120, 6,120, 6, 6, 6,120,120,120,120,120,120,120,120,120,120,120, 6,120,120, 6,120, 6,120,120,120,120,120,120,120,120,120,120, 6, 6,120, 6,120,120,120,120,120,120,120,120,120,120,120,120, 6,120, 6, 6, 6,120,120,120,120,120,120,120,120,120,120,120, 6,120,120, 6,120, 6,120,120,120,120,120,120,120,120,120,120, 6, 6,120, 6,120,120,120,120,120,120,120,120,120,120,120,120, 6,120, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,120,120, 120, 6,120,120, 6,120,120, 6,120,120, 6,120,120,120, 6,120, 120,120, 6,120,120, 6,120,120, 6,120,120, 6,120,120,120, 6, }; unsigned char tera17[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 1, 1, 1, 21, 21, 21, 1, 1, 1, 21, 21, 21, 1, 1, 1, 1, 21, 21, 43, 1, 1, 1, 43, 21, 43, 1, 1, 1, 21, 1, 1, 1, 1, 1, 21, 1, 1, 1, 21, 1, 1, 21, 1, 1, 1, 1, 1, 1, 1, 21, 1, 1, 1, 1, 21, 1, 1, 1, 21, 1, 1, 1, 1, 21, 1, 1, 43, 21, 21, 43, 1, 1, 1, 21, 43, 21, 1, 1, 1, 1, 21, 21, 21, 1, 1, 1, 21, 21, 21, 1, 1, 1, 21, 1, 1, 1, 1, 1, 21, 1, 1, 21, 1, 1, 1, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 43, 1, 1, 21, 1, 1, 1, 21, 1, 1, 1, 1, 1, 21, 21, 21, 1, 1, 1, 21, 43, 21, 1, 1, 43, 21, 1, 1, 1, 1, 1, 1, 21, 21, 21, 1, 1, 1, 21, 21, 21, 1, 1, 1, 1, 1, 1, 21, 1, 1, 1, 21, 1, 1, 21, 1, 1, 1, 1, 1, 1, 1, 1, 21, 1, 1, 1, 21, 1, 1, 21, 1, 1, 1, 1, 1, 21, 1, 1, 1, 43, 21, 43, 1, 1, 1, 43, 21, 21, 1, 1, 1, 1, 21, 21, 21, 1, 1, 1, 21, 21, 21, 1, 1, 1, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; unsigned char *tera[] = { tera0, tera1, tera2, tera3, tera4, tera5, tera6, tera7, tera8, tera9, tera10, tera11, tera12, tera13, tera14, tera15, tera16, tera17 }; #define MAXFOOD 50 #define PROBA_SEA 55 #define SEA 0 #define LAND 5 #define FENCE 16 #define NET 17 #define TREE 40 #define DIM_X 60 #define DIM_Y 30 #define DIM (DIM_X * DIM_Y + 1) #define N_GREBLES_INIT 100 #define WIN_X 21 #define WIN_Y 11 #define LEN1 16 /* length unit */ #define WOOD_FENCE 2 #define WOOD_HOME 5 #define WOOD_BOAT 5 #define COLONIST 6 #define PXL_X 320 #define PXL_Y 170 #define MAX_WOOD 10 #define RATION 3 #define FIGHT_DELAY 1000 /* GLOBALS */ struct MAP map[1801]; struct MEN men; uchar man = 1; double mutant = 0; double level = 50000; #define GAMEFILE "colony.dat" #define ACCESS(x) (*af) (&x, sizeof(x), 1, fd); access_game (char *filename, char *mode, size_t (*af) ()) { FILE *fd; fd = fopen (filename, mode); if (fd != NULL) { ACCESS (map) ACCESS (men) ACCESS (man) ACCESS (mutant) ACCESS (level) fclose (fd); } } load_game (char *filename) { access_game (filename, "rb", fread); } save_game (char *filename) { access_game (filename, "wb", fwrite); } int main(int argc, char *argv[]) { initial(); if (!strcmp (argv[1], "-r")) load_game (argv[2]); gameloop(); v_reset_mode(); m_hide(); m_close(); save_game (GAMEFILE); } int initial(void) { uint count, land, rounds, x, y, opt; v_setmode13(); m_init(); /* INTRODUCTION */ v_cprintf(45,0,0,0,1,0,"Colony on Greblis (Version 1.2)"); v_cprintf(45,0,0,10,1,0,"(C) Copyright 1995 Peter Harrison"); v_cprintf(54,0,0,30,1,0,"To Start, Type Level Number :"); v_cprintf(54,0,0,40,1,0,"1 - Easy, 2 - Medium, 3 - Hard"); v_cprintf(54,0,0,70,0,0,"ARROW KEYS to Move"); v_cprintf(54,0,0,80,0,0,"INSERT to Fence or Net"); v_cprintf(54,0,0,90,0,0,"HOME to Build Colony"); v_cprintf(54,0,0,100,0,0,"PAGE-UP to View Situation"); v_cprintf(54,0,0,110,0,0,"ESC to Exit"); v_cprintf(54,0,0,130,0,0,"View COLONY.TXT for Help"); v_cprintf(54,0,0,140,0,0,"Internet : info@harrison.co.nz"); v_putimage(tera16,220,75, 16,16); v_putimage(unit, 240, 85, 16, 16); v_putimage(tera5, 220,95, 16, 16); v_putsprite(tree, 220, 100, 8, 8, 0); v_putsprite(greble1, 228, 95, 8, 8, 0); v_putimage(fight, 240, 105, 16, 16); opt = bioskey(0); switch(opt) { case 561: level = 500000; v_cprintf(45,0,0,181,1,0,"Level Easy :"); break; case 818: level = 200000; v_cprintf(45,0,0,181,1,0,"Level Medium :"); break; case 1075: v_cprintf(45,0,0,181,1,0,"Level Hard :"); level = 50000; break; default : v_cprintf(45,0,0,181,1,0,"Level Novice :"); level = 1000000; break; }; v_cprintf(45,0,0,190,1,0,"Wood"); v_putimage(tera16,220,180, 16,16); v_putimage(unit, 240, 180, 16, 16); v_putimage(tera5, 260,180, 16, 16); v_putsprite(tree, 260, 185, 8, 8, 0); v_putsprite(greble1, 268, 180, 8, 8, 0); v_putimage(fight, 280, 180, 16, 16); display_wood(); m_show(); /* CREATE LAND */ randomize(); for(count=0; count < 1801 ; count++) { map[count].greble = 0; map[count].food = random(MAXFOOD /*50*/); if( random(100) > PROBA_SEA /*55*/) { map[count].tera = LAND /*5*/; } else { map[count].tera = SEA /*0*/; } } /* CLEAN SEA AND LAND */ for(rounds=0; rounds < 1; rounds++ ) { for(count=0; count < DIM /*1801*/; count++) { if( seearound( count, SEA /*0*/ ) < 3 ) map[count].tera = LAND /*5*/; } for(count=0; count < DIM /*1801*/; count++) { if( seearound( count, LAND /*5*/ ) < 3 ) map[count].tera = SEA /*0*/; } } /* PUT EDGE TERRAIN ON MAP */ for(count=0; count 0) { if( map[count-1].tera == LAND /*5*/ ) land = land + 2; } if( (count+DIM_Y/*30*/) < DIM /*1801*/) { if( map[count+DIM_Y/*30*/].tera == LAND/*5*/ ) land = land + 4; } if( (count-DIM_Y /*30*/) > 0) { if( map[count-DIM_Y/*30*/].tera == LAND/*5*/ ) land = land + 8; } } switch(land) { case 1: map[count].tera = 2; break; case 2: map[count].tera = 8; break; case 3: map[count].tera = 10; break; case 4: map[count].tera = 4; break; case 5: map[count].tera = 1; break; case 6: map[count].tera = 7; break; case 7: map[count].tera = 14; break; case 8: map[count].tera = 6; break; case 9: map[count].tera = 3; break; case 10: map[count].tera = 9; break; case 11: map[count].tera = 15; break; case 12: map[count].tera = 11; break; case 13: map[count].tera = 12; break; case 14: map[count].tera = 13; break; case 15: map[count].tera = 5; break; } } /* SET UP MEN / UNITS */ #ifdef OLD men.x = random(60); men.y = random(30); men.wood = 0; land = ( men.x * 30 ) + men.y; while( map[land].tera != 5 ) { men.x = random(60); men.y = random(30); land = ( men.x * 30 ) + men.y; } #else do { men.x = random(DIM_X); men.y = random(DIM_Y); land = ( men.x * DIM_Y ) + men.y; } while( map[land].tera != LAND ); #endif /* SET UP GREBLES */ for( count=0; count<45/*N_GREBLES_INIT*//*100*/; count++) { x = random(DIM_X/*60*/); y = random(DIM_Y/*30*/); land = ( x * DIM_Y/*30*/ ) + y; if( map[land].tera == SEA/*0*/ ) { map[land].greble = 2; } if( map[land].tera == LAND/*5*/ ) { map[land].greble = 1; } } for (count=0; count < 40; count++) { x = random(DIM_X/*60*/); y = random(DIM_Y/*30*/); land = ( x * DIM_Y/*30*/ ) + y; map[land].greble = 7; if (count < 10) map[land].genome = random (1 << GENOME_SIZE); else if (random(2)) map[land].genome = G_LAND | G_COMESTIBLE; else map[land].genome = G_SEA | G_COMESTIBLE; } } int gameloop(void) { int viewx, viewy, ex = 0, option, redraw = 1, nx, ny, mb; viewx = men.x - (WIN_X-1)/2 /*10*/; if( viewx < 0 ) viewx = 0; if( viewx > DIM_X-WIN_X+1/*40*/ ) viewx = DIM_X-WIN_X+1/*40*/; viewy = men.y - (WIN_Y-1)/2 /*5*/; if( viewy < 0 ) viewy = 0; if( viewy > DIM_Y-WIN_Y+1/*20*/ ) viewy = DIM_Y-WIN_Y+1/*20*/; while(ex==0) { if(redraw > 0) { display_map( viewx, viewy ); redraw = 0; } displaymen( viewx, viewy ); processing( viewx, viewy ); clearmen( viewx, viewy); mb = m_button(); if(mb==1) { if(m_ypos() < 180) { nx = ((men.x - viewx)*16) - m_xpos(); ny = ((men.y - viewy)*16) - m_ypos(); if( (nx > 0) & (checkmap( men.x-1, men.y ) > 0) ) men.x--; if( (nx < -16) & (checkmap( men.x+1, men.y ) > 0) ) men.x++; if( (ny > 0) & (checkmap( men.x, men.y-1 ) > 0) ) men.y--; if( (ny < -16) & (checkmap( men.x, men.y+1 ) > 0) ) men.y++; redraw=1; } else { nx = m_xpos(); if( nx > 220 & nx < 240 ) fenceit( viewx, viewy ); if( nx > 240 & nx < 260 ) homeit(viewx, viewy ); if( nx > 260 & nx < 280 ) { displayall(); redraw = 2; } if( nx > 280 & nx < 300 ) ex=1; } delay(250); } if(bioskey(1)!=0) { option = bioskey(0); } else { option = 0; } switch(option) { case 283: ex = 1; break; case 19712: if( (men.x < DIM_X-1/*59*/) & (checkmap( men.x + 1 , men.y ) > 0) ) men.x++; redraw = 1; break; case 19200: if( (men.x > 0) & (checkmap( men.x - 1 , men.y ) > 0) ) men.x--; redraw = 1; break; case 20480: if( (men.y < DIM_Y/*30*/) & (checkmap( men.x , men.y + 1 ) > 0) ) men.y++; redraw = 1; break; case 18432: if( (men.y > 0) & (checkmap( men.x , men.y - 1 ) > 0) ) men.y--; redraw = 1; break; case 18688: displayall(); redraw = 2; break; case 20992: fenceit( viewx, viewy ); break; case 18176: homeit( viewx, viewy ); break; default: break; } check_greble( viewx, viewy ); if( redraw == 1 ) { int viewx1, viewy1; redraw = 0; viewx1 = viewx; viewy1 = viewy; if( ( men.x - 2 ) < viewx ) { viewx = men.x - (WIN_X-1)/2 /*10*/; if( viewx < 0 ) viewx = 0; redraw = 1; } if( ( men.x + 2 ) > ( viewx + WIN_X-1/*20*/ ) ) { viewx = men.x - (WIN_X-1)/2 /*10*/; if( viewx > DIM_X-WIN_X+1/*40*/ ) viewx = DIM_X-WIN_X+1/*40*/; redraw = 1; } if( ( men.y - 2 ) < viewy ) { viewy = men.y - (WIN_Y-1)/2 /*5*/; if( viewy < 0 ) viewy = 0; redraw = 1; } if( ( men.y + 2 ) > ( viewy + WIN_Y-1/*10*/ ) ) { viewy = men.y - (WIN_Y-1)/2 /*5*/; if( viewy > DIM_Y-WIN_Y+1 /*20*/ ) viewy = DIM_Y-WIN_Y+1 /*20*/; redraw = 1; } if (viewx == viewx1 && viewy == viewy1) redraw = 0; } } } int check_greble( int viewx, int viewy ) { int m; m = ( men.x * DIM_Y/*30*/ ) + men.y; if( map[m].greble > 0 ) { kill_greble( men.x, men.y, m, viewx, viewy ); } if( map[m].food == TREE/*40*/ & ( map[m].tera == LAND/*5*/ | map[m].tera == FENCE/*16*/ ) ) { eattree( men.x, men.y, m, viewx, viewy ); } } int fenceit( int viewx, int viewy ) { int m, x, y; m = (men.x * DIM_Y/*30*/) + men.y; if(men.wood>WOOD_FENCE-1/*1*/ & ( map[m].tera==LAND/*5*/ | map[m].tera==FENCE/*16*/ ) ) { map[m].tera = FENCE/*16*/; x = (men.x - viewx) * LEN1 /*16*/; y = (men.y - viewy) * LEN1 /*16*/; men.wood=men.wood-WOOD_FENCE/*2*/; display_tera( x, y, map[m].tera ); display_greble( x, y, m ); display_wood(); } if(men.wood>WOOD_FENCE-1/*1*/ & map[m].tera==SEA/*0*/ ) { map[m].tera = NET /*17*/; x = (men.x - viewx) * LEN1/*16*/; y = (men.y - viewy) * LEN1/*16*/; men.wood=men.wood-WOOD_FENCE/*2*/; display_tera( x, y, map[m].tera ); display_greble( x, y, m ); display_wood(); } } int homeit( int viewx, int viewy ) { int m, x, y; m = (men.x * DIM_Y/*30*/) + men.y; if( men.wood > WOOD_HOME/*5*/ & map[m].tera==LAND/*5*/ & map[m].greble==0 ) { map[m].greble = COLONIST/*6*/; x = (men.x - viewx) * LEN1 /*16*/; y = (men.y - viewy) * LEN1 /*16*/; men.wood = men.wood - WOOD_HOME/*5*/; display_tera( x, y, map[m].tera ); display_greble( x, y, m ); display_wood(); } } int checkmap( int x, int y ) { int m, t; m = ( x * DIM_Y/*30*/ ) + y; t = map[m].tera; if(men.boat==1) { if( t==SEA/*0*/ | t==NET/*17*/ ) { t=1; } else { men.boat=0; } } if( t==0 & men.wood > WOOD_BOAT/*5*/ ) { men.wood = men.wood - WOOD_BOAT/*5*/; men.boat = 1; display_wood(); } return( t ); } int displayall(void) { int x ,y ,m, grebles=0, home=0; m_hide(); v_box( 15, 0, 49, 49, 150, 170 ); for(x=0; x 0) { v_box( 1, 0, 50+y*2, 50+x*2, 51+y*2, 51+x*2 ); } if(map[m].greble > 0 & map[m].greble!=COLONIST/*6*/) { v_box( 2, 0, 50+y*2, 50+x*2, 51+y*2, 51+x*2 ); grebles++; } if(map[m].greble==COLONIST/*6*/) { v_box( 3, 0, 50+y*2, 50+x*2, 51+y*2, 51+x*2 ); home++; } } } v_box( 4, 0, 50+men.y*2, 50+men.x*2, 51+men.y*2, 51+men.x*2 ); v_cprintf( 36, 0, 60, 115, 1, 0, "%i Grebles", grebles ); v_cprintf( 36, 0, 60, 135, 1, 0, "%i Homes", home ); bioskey(0); m_show(); if(grebles==0) { return(1); } else { return(0); } } int displaymen( int viewx, int viewy ) { int x, y, m; x = ( men.x - viewx ) * LEN1 /*16*/; y = ( men.y - viewy ) * LEN1 /*16*/; cond_hide( x, y ); if(men.boat == 0) { v_putsprite( unit, x, y, LEN1, LEN1 /*16, 16*/, 0); } else { v_putsprite( boat, x, y, LEN1, LEN1 /*16, 16*/, 0); } m_show(); } int clearmen( int viewx, int viewy ) { int m, x, y; m = ( men.x * DIM_Y/*30*/ ) + men.y; x = ( men.x - viewx ) * LEN1 /*16*/; y = ( men.y - viewy ) * LEN1 /*16*/; display_tera( x, y, map[m].tera); display_greble( x, y, m); } int seearound( int grid, int check ) { int count=0; if( (grid-1) >-1 ) { if( map[grid-1].tera == check ) count++; } if( (grid-DIM_X+1/*59*/) >-1 ) { if( map[grid-DIM_Y+1/*29*/].tera == check ) count++; } if( (grid-DIM_X/*60*/) >-1 ) { if( map[grid-DIM_Y/*30*/].tera == check ) count++; } if( (grid-DIM_X-1/*61*/) >-1 ) { if( map[grid-DIM_Y-1/*31*/].tera == check ) count++; } if( (grid+1) 0 ) { map[m].greble = 0; display_process( x, y, m, viewx, viewy ); } if(map[m].food < TREE/*40*/) { map[m].food++; } else { display_process( x, y, m, viewx, viewy ); } if( map[m].greble > 0 ) { map[m].food = map[m].food - 3; option = random(4); switch(option) { case 0: dx = x+1; dy = y; break; case 1: dx = x-1; dy = y; break; case 2: dx = x; dy = y+1; break; case 3: dx = x; dy = y-1; break; } dm = ( dx * DIM_Y/*30*/ ) + dy; greb = map[dm].greble; if( dx > 0 & dx < DIM_X/*60*/ & dy > 0 & dy < DIM_Y/*30*/ ) { switch(map[m].greble) { case 1: if(map[dm].tera==LAND/*5*/ & greb==0 & map[dm].food>RATION/*3*/ ) { map[dm].greble = 1; } break; case 2: if( mutant > level + random(1000) ) { if( greb==0 & map[dm].food>RATION/*3*/ & map[dm].tera!=SEA/*0*/ & map[dm].tera!=FENCE/*16*/ ) { map[dm].greble = 3; mutant = 0; } } else { if( map[dm].tera==SEA/*0*/ & greb==0 & map[dm].food>RATION/*3*/ ) { map[dm].greble = 2; } } break; case 3: if( mutant > ( level + random(1000) ) ) { if( greb==0 & map[dm].food>RATION/*3*/ & map[dm].tera==LAND/*5*/ ) { map[dm].greble = 4; mutant = 0; } } else { if( greb==0 & map[dm].food>RATION/*3*/ & map[dm].tera!=FENCE/*16*/ & map[dm].tera!=SEA/*0*/ ) { map[dm].greble = 3; } } break; case 4: if( mutant > ( level + random(1000) ) ) { if( map[dm].food > RATION/*3*/ & map[dm].tera != SEA/*0*/ ) { map[dm].greble = 5; if( map[dm].tera==FENCE/*16*/ ) map[dm].tera = LAND/*5*/; mutant = 0; } } else { if( map[dm].tera!=SEA/*0*/ & greb==0 & map[dm].food>RATION/*3*/ ) { map[dm].greble = 4; if( map[dm].tera==FENCE/*16*/ ) map[dm].tera = LAND/*5*/; } } break; case 5: if( ( map[dm].food > RATION/*3*/ | (greb != 0 & greb != 5) ) & map[dm].tera == LAND/*5*/ ) { if( greb != 0 & greb != 5) { map[m].food = 30; map[dm].food = 30; } map[dm].greble = 5; if( map[dm].tera==FENCE/*16*/ ) map[dm].tera = LAND/*5*/; } break; case 6: if( ( map[dm].tera == LAND/*5*/ | map[dm].tera == FENCE/*16*/ ) & ( greb == 1 | greb == 3 | (greb == 7 && (map[dm].genome & G_COMESTIBLE)) | map[dm].food > RATION/*3*/ ) & greb != 5 ) { if( greb == 1 | greb == 3 ) { map[m].food = 30; map[dm].food = 30; if (map[dm].tera==LAND/*5*/) map[dm].tera = FENCE/*16*/; map[dm].greble = 6; } if( greb==0 ) map[dm].greble = 6; } break; case 7: #if 0 if( mutant > ( level + random(1000) ) ) { if( ((map[dm].food > RATION/*3*/) || ((map[m].genome & G_CARNIVORE) && (greb != 0) && ((greb != 7) || (map[dm].genome != map[m].genome)) )) && /*map[dm].tera != SEA*//*0*/ can_cross (map[m].genome, map[dm].tera) ) { map[dm].greble = 5; if( map[dm].tera==FENCE/*16*/ ) map[dm].tera = LAND/*5*/; mutant = 0; } } else #endif { #if 0 if( can_cross (map[m].genome, map[dm].tera /*map[dm].tera!=SEA*//*0*/ & greb==0 & map[dm].food>RATION/*3*/ ) #endif if( (( (greb==0) && (map[dm].food > RATION/*3*/) ) || ((map[m].genome & G_CARNIVORE) && (greb != 0) && ((greb != 7) || (map[dm].genome != map[m].genome)) )) && /*map[dm].tera != SEA*//*0*/ can_cross (map[m].genome, map[dm].tera) ) { /* if (greb != 0) { map[m].food = 30; map[dm].food = 30; } */ map[dm].greble = 7; map[dm].genome = map[m].genome; if (map[dm].tera==NET && (map[m].genome & G_DESTROY)) map[dm].tera = SEA; if( map[dm].tera==FENCE/*16*/ && (map[m].genome & G_DESTROY)) map[dm].tera = LAND/*5*/; if (mutant > (level + random(1000))) { mutant = 0; map[dm].genome ^= 1 << random ( GENOME_SIZE ); } } } break; }; display_process( dx, dy, dm, viewx, viewy ); } } } } int display_process( int x, int y, int m, int viewx, int viewy ) { int xpos = ( x - viewx ) * LEN1/*16*/; int ypos = ( y - viewy ) * LEN1/*16*/; if( xpos > -1 & xpos < PXL_X/*320*/ & ypos > -1 & ypos < PXL_Y/*170*/ ) { display_tera( xpos, ypos, map[m].tera ); display_greble( xpos, ypos, m ); displaymen( viewx, viewy ); } } int kill_greble( int x, int y, int m, int viewx, int viewy ) { if( men.wood > 0 & map[m].greble!=COLONIST/*6*/ ) { int xpos = ( x - viewx ) * LEN1/*16*/; int ypos = ( y - viewy ) * LEN1/*16*/; map[m].greble = 0; men.wood--; cond_hide( xpos, ypos); v_putsprite( fight, xpos, ypos, LEN1, LEN1 /*16, 16*/, 0 ); m_show(); delay(FIGHT_DELAY/*1000*/); display_tera( xpos, ypos, map[m].tera ); displaymen( viewx, viewy ); display_wood(); } if( map[m].greble==COLONIST/*6*/ & map[m].food > 6 & men.wood < MAX_WOOD /*10*/ ) { men.wood = men.wood + 1; map[m].food = map[m].food - 3; display_wood(); } } int eattree( int x, int y, int m, int viewx, int viewy ) { int xpos = ( x - viewx ) * LEN1/*16*/; int ypos = ( y - viewy ) * LEN1/*16*/; if( men.wood < MAX_WOOD/*10*/ & ( map[m].tera == LAND/*5*/ | map[m].tera == FENCE/*16*/ ) ) { men.wood++; map[m].food = map[m].food - TREE/*40*/; cond_hide(xpos, ypos); v_putsprite( fight, xpos, ypos, LEN1, LEN1 /*16, 16*/ , 0 ); m_show(); delay(FIGHT_DELAY/*1000*/); display_tera( xpos, ypos, map[m].tera ); displaymen( viewx, viewy ); display_wood(); } } int display_wood(void) { m_hide(); v_box(3,0,190,40,198,140); v_box(3,2,190,40,198,40+men.wood*10); m_show(); } int cond_hide( int x, int y ) { int mx = m_xpos(); int my = m_ypos(); if( (abs(x-mx) + abs(y-my)) < 30 ) { m_hide(); } }