48 static const n_byte icns[896] =
51 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
52 0x00, 0x02, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x00, 0x01, 0x0A, 0x84, 0x00, 0x04, 0x8A, 0x89, 0x00,
53 0x02, 0x4A, 0x92, 0x00, 0x09, 0x2A, 0xA4, 0x80, 0x04, 0x9F, 0xC9, 0x00, 0x02, 0x70, 0x72, 0x00,
54 0x01, 0x60, 0x34, 0x00, 0x00, 0xC0, 0x18, 0x00, 0x1F, 0x80, 0x0F, 0xC0, 0x00, 0x80, 0x08, 0x00,
55 0x3F, 0x80, 0x0F, 0xE0, 0x00, 0x80, 0x08, 0x00, 0x1F, 0x80, 0x0F, 0xC0, 0x00, 0xC0, 0x18, 0x00,
56 0x01, 0x60, 0x34, 0x00, 0x02, 0x70, 0x72, 0x00, 0x04, 0x9F, 0xC9, 0x00, 0x09, 0x2A, 0xA4, 0x80,
57 0x02, 0x4A, 0x92, 0x00, 0x04, 0x8A, 0x89, 0x00, 0x01, 0x0A, 0x84, 0x00, 0x00, 0x0A, 0x80, 0x00,
58 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x02, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x00, 0x01, 0x0A, 0x84, 0x00, 0x04, 0x8A, 0x89, 0x00,
62 0x02, 0x4A, 0x92, 0x00, 0x09, 0x2A, 0xA4, 0x80, 0x04, 0x9F, 0xC9, 0x00, 0x02, 0x70, 0x72, 0x00,
63 0x01, 0x60, 0x34, 0x00, 0x00, 0xC0, 0x18, 0x00, 0x1F, 0x80, 0x0F, 0xC0, 0x00, 0xB8, 0x08, 0x00,
64 0x01, 0xC7, 0x1C, 0x00, 0x0E, 0x00, 0xE3, 0x00, 0x10, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00, 0x40,
65 0x20, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x80,
66 0x10, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x40, 0x08, 0x01, 0xC0, 0x40,
67 0x07, 0x8E, 0x38, 0x80, 0x00, 0x70, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
71 0x00, 0x38, 0xE3, 0x80, 0x01, 0xC0, 0x1C, 0x60, 0x02, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x08,
72 0x04, 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10,
73 0x02, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x08, 0x01, 0x00, 0x38, 0x08,
74 0x00, 0xF1, 0xD7, 0x10, 0x00, 0xAE, 0xAA, 0xE0, 0x01, 0x55, 0x55, 0x40, 0x02, 0xAA, 0xAA, 0x80,
75 0x05, 0x55, 0x55, 0x00, 0x0A, 0xAA, 0xAA, 0x00, 0x05, 0x55, 0x54, 0x00, 0x0A, 0xAA, 0xA8, 0x00,
76 0x05, 0x55, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78 0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 0xAA, 0xFF, 0xFF, 0x55, 0x55, 0x7F, 0xFE, 0xAA, 0xAA, 0xFF,
102 0xFD, 0x55, 0x55, 0xFF, 0xFA, 0xAA, 0xAB, 0xFF, 0xFD, 0x55, 0x57, 0xFF, 0xFA, 0xAA, 0xBF, 0xFF,
103 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
105 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
106 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
107 0xFF, 0xD5, 0xFB, 0xFF, 0xFF, 0xAA, 0xBF, 0xFF, 0x77, 0x55, 0x55, 0xF5, 0xAB, 0xA0, 0xAA, 0xAA,
108 0x55, 0x40, 0x01, 0x55, 0xAA, 0x80, 0x00, 0x2A, 0x54, 0x00, 0x00, 0x55, 0xA0, 0x00, 0x00, 0x2A,
109 0x40, 0x00, 0x00, 0x55, 0xA0, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, 0x0A,
110 0x00, 0x0A, 0x80, 0x05, 0x01, 0x0A, 0x84, 0x02, 0x04, 0x8A, 0x89, 0x05, 0x02, 0x4A, 0x92, 0x02,
111 0x09, 0x2A, 0xA4, 0x80, 0x04, 0x9F, 0xC9, 0x00, 0x02, 0x70, 0x72, 0x00, 0x01, 0x60, 0x34, 0x00,
112 0x00, 0xC0, 0x18, 0x00, 0x1F, 0x80, 0x0F, 0xC0, 0x00, 0x80, 0x08, 0x00, 0xFF, 0xFF, 0xFF, 0xFF
118 static const n_byte conv[ 96 ] =
120 0, 40, 41, 0, 0, 0, 0, 42, 43, 44, 38, 39, 45, 11, 46, 47, 1, 2, 3, 4, 5, 6, 7,
121 8, 9, 10, 48, 49, 0, 50, 0, 51, 0, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
122 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 52, 53, 54, 0, 55, 56,
123 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
124 32, 33, 34, 35, 36, 37, 57, 58, 59, 0, 0
128 static const n_byte2 seg14[ 60 ] =
130 0x0000, 0x3F00, 0x1800, 0x36C0, 0x3CC0, 0x19C0, 0x2DC0, 0x2FC0, 0x3800, 0x3FC0,
131 0x3DC0, 0x00C0, 0x3BC0, 0x3CA1, 0x2700, 0x3C21, 0x27C0, 0x23C0, 0x2F80, 0x1BC0,
132 0x2421, 0x1E00, 0x0354, 0x0700, 0x1B06, 0x1B12, 0x3F00, 0x33C0, 0x3F10, 0x33D0,
133 0x2DC0, 0x2021, 0x1F00, 0x030C, 0x1B18, 0x001E, 0x11E0, 0x240C, 0x00FF, 0x00E1,
135 0x8001, 0x0101, 0x0001, 0x0014, 0x000A, 0x0008, 0x8000, 0x000C, 0xC000, 0x4008,
136 0x04C0, 0xA004, 0x2700, 0x0012, 0x3402, 0x0400, 0x0002, 0x244A, 0x0021, 0x2494
140 #define MAX_NUMBER_ERRORS 35
142 static n_byte number_errors;
153 static n_int toggle_weather = 1;
154 static n_int toggle_brain = 1;
155 static n_int toggle_braincode = 0;
156 static n_int toggle_territory = 0;
157 static n_int toggle_tidedaylight = 0;
162 return toggle_weather;
173 toggle_braincode ^= 1;
174 return toggle_braincode;
179 toggle_territory ^= 1;
180 return toggle_territory;
185 toggle_tidedaylight ^= 1;
186 return toggle_tidedaylight;
191 #define UNDRAW_MAX 100000
195 static n_int undraw_count = 0;
202 static void draw_undraw()
204 if (undraw_count == 0)
return;
208 *undraw_location[undraw_count] = undraw_color[undraw_count];
211 while(undraw_count > -1);
215 static n_byte * local_offscreen = 0L;
219 local_offscreen = value;
220 return local_offscreen;
227 undraw_location[undraw_count] = location;
228 undraw_color[undraw_count] = location[0];
233 (void)
SHOW_ERROR(
"Erase count outside limit");
235 location[0] = local_col->
color;
246 static n_int terrain_dim_x = 512;
247 static n_int terrain_dim_y = 511;
251 n_byte *byte_info = information;
260 return pixel_map(px, py, dx, dy, information);
267 n_byte *byte_info = information;
274 n_byte *byte_info = information;
275 byte_info[ px + (py * terrain_dim_x) ] = 0;
282 n_byte *byte_info = information;
283 byte_info[ px + (py * terrain_dim_x) ] =
COLOUR_GREY;
289 n_byte *local_buffer = local_offscreen;
291 if (local_buffer == 0L)
304 #ifndef GRAPHLESS_GUI
313 #ifdef MULTITOUCH_CONTROLS
315 extern touch_control_state tc_state;
317 void draw_tc_controls(
n_join * local_mono)
319 const n_int half_y = terrain_dim_y / 2;
320 n_vect2 point1, point2, point3;
322 if (tc_state == TCS_SHOW_CONTROLS)
334 vect2_populate(&point3, terrain_dim_x - TC_FRACTION_X + 5, half_y);
341 if (tc_state == TCS_LEFT_STATE_CONTROLS)
352 if (tc_state == TCS_RIGHT_STATE_CONTROLS)
354 vect2_populate(&point1, terrain_dim_x - TC_FRACTION_X + 5, half_y + TC_OFFSET_Y);
355 vect2_populate(&point2, terrain_dim_x - TC_FRACTION_X + 5, half_y - TC_OFFSET_Y);
372 n_int line_y_offset = 128 + 24;
373 n_int linx_x_offset = 84;
374 n_int tab_offset = 36;
376 n_int line_y_offset = 12;
377 n_int linx_x_offset = 12;
378 n_int tab_offset = 0;
423 draw_string(platform, linx_x_offset + tab_offset, line_y_offset, &local_draw);
428 draw_string(
"This software and Noble Ape are a continuing ", linx_x_offset, line_y_offset, &local_draw);
431 draw_string(
"work of Tom Barbalet begun on 13 June 1996.", linx_x_offset, line_y_offset, &local_draw);
435 draw_string(
"No apes or cats were harmed in the writing ", linx_x_offset, line_y_offset, &local_draw);
438 draw_string(
"of this software.", linx_x_offset, line_y_offset, &local_draw);
445 #define ledfir(x, y, dx, dy, c) if(((val >> c)&1)) (*local_draw)((x + off_x + offset),((y + off_y)), dx, dy, local_info)
462 while (str[char_loop] > 31)
464 n_int val = seg14[conv[str[char_loop] - 32]];
465 n_int offset = char_loop << 3;
512 local_pixel.
pixel_draw = &draw_character_line;
520 #define POS_HIRES(num) ((num+(HI_RES_MAP_DIMENSION*2))&(HI_RES_MAP_DIMENSION-1))
522 #define CONVERT_X(x, cx) (n_uint)((POS_HIRES((x)+cx)) )
523 #define CONVERT_Y(y, cy) (n_uint)((POS_HIRES((y)+cy)) << HI_RES_MAP_BITS)
525 #define CONVERT_XY(x,y) (CONVERT_X(x) | CONVERT_Y(y))
527 #define SUBSTA(c) ((c<<8)|c)
529 static n_byte2 color_group[256*3];
546 n_int lp = 0, lp2 = 0;
547 n_int dr = 0, dg = 0, db = 0;
548 n_int ar = 0, ag = 0, ab = 0, cntr = 0;
549 n_int fp = 0, fl = 0, del_c = 0;
552 if (lp == points[cntr])
554 ar =
SUBSTA(points[(cntr) | 1]);
555 ag =
SUBSTA(points[(cntr) | 2]);
556 ab =
SUBSTA(points[(cntr) | 3]);
564 dr =
SUBSTA(points[(cntr) | 1]);
565 dg =
SUBSTA(points[(cntr) | 2]);
566 db =
SUBSTA(points[(cntr) | 3]);
577 n_int del_a = (fl - lp), del_b = (lp - fp);
579 color_fit[lp2++] = (
n_byte2)(((ar * del_a) + (dr * del_b)) / del_c);
580 color_fit[lp2++] = (
n_byte2)(((ag * del_a) + (dg * del_b)) / del_c);
581 color_fit[lp2++] = (
n_byte2)(((ab * del_a) + (db * del_b)) / del_c);
585 color_fit[lp2++] = (
n_byte2)(ar);
586 color_fit[lp2++] = (
n_byte2)(ag);
587 color_fit[lp2++] = (
n_byte2)(ab);
591 if (points == land_points)
620 if (!toggle_tidedaylight)
625 darken = (darken * darken) / 402;
626 darken = (sign * darken) + 624;
630 n_int cg_val = color_group[loop];
631 n_int response = (cg_val * darken) >> 10;
633 color_fit[loop] = (
n_byte2)response;
638 while(loop < (256 * 3))
640 color_fit[loop] = color_group[loop];
659 static void draw_terrain_scan(
void * void_dtss,
void * xlocation,
void * unused)
667 n_int pixy = (scrx + (dim_x >> 1)) + (dim_y1 * dim_x );
668 n_int actual = dim_y1;
683 const n_byte2 value = combined[check_change];
684 const n_int z00 = value & 255;
685 const n_byte col00 = value >> 8;
687 n_int aval = (scry - z00);
688 if (aval < -1) aval = -1;
694 while (actual > aval)
696 buf_offscr[pixy] = col00;
709 if (buf_offscr == 0L)
714 if (local_sim->
select == 0L)
716 io_erase(buf_offscr, dimensions->
x * dimensions->
y);
720 const n_int lowest_y = ((dimensions->
y + 256) * dimensions->
y)/256;
725 n_int scrx = (0 - (dimensions->
x >> 1));
734 dtss.
lowest_s = ((value_vector.
x * (((lowest_y)) - dimensions->
y)));
735 dtss.
lowest_c = ((value_vector.
y * (((lowest_y)) - dimensions->
y)));
756 while (scrx < (dimensions->
x - (dimensions->
x >> 1)))
764 screen_x_location[0] = scrx;
772 draw_terrain_scan(local_dtss, screen_x_location, 0L);
798 n_pixel * local_draw = &pixel_overlay;
799 n_pixel * local_draw_black = &pixel_black;
801 const n_byte * local_icon;
809 if (local_info == 0L)
816 local_kind_black.
pixel_draw = local_draw_black;
821 if ((hr != 40) && (hr != 0))
823 math_join(6, 5+hr, 38, 0, &local_kind_black);
828 (*local_draw)(5 , 5 + hr, 0, 0, local_info);
829 (*local_draw)(45, 5 + hr, 0, 0, local_info);
830 (*local_draw)(5 + hr, 45, 0, 0, local_info);
831 (*local_draw)(5 + hr, 5, 0, 0, local_info);
844 (void)
math_join((25 + (hour_clock.
x / 5)), (25 + (hour_clock.
y / 5)), (hour_clock.
x / 17), (hour_clock.
y / 17), &local_kind);
848 #define FACING_OFFSIDE ((terrain_dim_x-(512-411)))
849 #define SP_EN_OFFSIDE ((terrain_dim_x-(512-325)))
851 #define GENETICS_X (terrain_dim_x-69)
852 #define GENETICS_Y (55)
854 #define GENDER_X (terrain_dim_x-110)
855 #define GENDER_Y (10)
863 if ((hr != 40) && (hr != 0))
873 (*local_draw)(50 + 45+ FACING_OFFSIDE, 5 + hr, 0, 0, local_info);
874 (*local_draw)(50 + 5 + hr+ FACING_OFFSIDE, 45, 0, 0, local_info);
875 (*local_draw)(50 + 5 + hr+ FACING_OFFSIDE, 5, 0, 0, local_info);
877 (*local_draw)(58 + 55 +
SP_EN_OFFSIDE, 5 + hr, 0, 0, local_info);
878 (*local_draw)(50 + 55 + SP_EN_OFFSIDE, 5 + hr, 0, 0, local_info);
880 (*local_draw)(58 + 55 + 18 + SP_EN_OFFSIDE, 5 + hr, 0, 0, local_info);
881 (*local_draw)(50 + 55 + 18 + SP_EN_OFFSIDE, 5 + hr, 0, 0, local_info);
888 (*local_draw)(50 + 55 + hr +
SP_EN_OFFSIDE, 5, 0, 0, local_info);
889 (*local_draw)(50 + 55 + hr + SP_EN_OFFSIDE, 45, 0, 0, local_info);
890 (*local_draw)(50 + 55 + 18 + hr + SP_EN_OFFSIDE, 5, 0, 0, local_info);
891 (*local_draw)(50 + 55 + 18 + hr + SP_EN_OFFSIDE, 45, 0, 0, local_info);
902 (facing_clock.
x / 17), (facing_clock.
y / 17), &local_kind);
921 n_int four = ( genetic_block >> (ha3 * 2) ) & 3 ;
964 if (local_speed != 0)
968 if (local_energy > 127)
1008 n_uint icon_stripe = (local_icon[(ha1<<2)|3] << 0) | (local_icon[(ha1<<2)|2] << 8)
1009 | (local_icon[(ha1<<2)|1] << 16) | (local_icon[(ha1<<2)|0] << 24);
1013 if ((icon_stripe >> (31-ha2)) & 1)
1015 (*local_draw)(5 + ha2, 55 + ha1, 0, 0, local_info);
1024 #define ACTIVE_PIXEL(px,py) sketch_psetc(POSITIVE_LAND_COORD(px),POSITIVE_LAND_COORD(py),COLOUR_RED)
1025 #define ERASER_PIXEL(px,py) sketch_psetc(POSITIVE_LAND_COORD(px),POSITIVE_LAND_COORD(py), \
1041 n_int start = -1, stop = 2;
1043 n_int start_point = ((time_coef &3 )) + 3;
1050 n_int scrx = (magx + tx);
1051 n_int scry = (magy + ty);
1080 if(local_facing == 0 || local_facing == 7)
1083 if(local_facing == 1 || local_facing == 0)
1086 if(local_facing == 2 || local_facing == 1)
1089 if(local_facing == 3 || local_facing == 2)
1092 if(local_facing == 4 || local_facing == 3)
1095 if(local_facing == 5 || local_facing == 4)
1098 if(local_facing == 6 || local_facing == 5)
1101 if(local_facing == 7 || local_facing == 6)
1121 n_int start = -1, stop = 2;
1123 n_int start_point = ((time_coef &3 )) + 3;
1131 n_int scrx = (magx + tx);
1132 n_int scry = (magy + ty);
1161 if(local_facing == 0 || local_facing == 7)
1164 if(local_facing == 1 || local_facing == 0)
1167 if(local_facing == 2 || local_facing == 1)
1170 if(local_facing == 3 || local_facing == 2)
1173 if(local_facing == 4 || local_facing == 3)
1176 if(local_facing == 5 || local_facing == 4)
1179 if(local_facing == 6 || local_facing == 5)
1182 if(local_facing == 7 || local_facing == 6)
1194 if (draw == 0L)
return;
1220 sprintf(string_draw,
"%ld",value);
1221 draw_string(string_draw, (lx*64)+2 , (ly*64)+5, &local_draw);
1230 static void draw_weather(
n_land * local_land)
1234 n_pixel * local_draw = &pixel_color8;
1235 void * local_info = &local_col;
1239 if (local_col.
screen == 0L)
1243 while(py < (map_dimensions2))
1246 n_int scr_y = py << 1;
1247 while(px < (map_dimensions2))
1249 n_int scr_x = px << 1;
1253 (*local_draw)(scr_x+1, scr_y+1, 0, 0, local_info);
1257 (*local_draw)(scr_x, scr_y , 0, 0, local_info);
1267 n_uint lp = 0, division = 1000000;
1270 if ((count + 1) > division)
1274 value[lp] = (
n_byte)(
'0' + ((count / division) % 10));
1278 value[lp] = (
n_byte)(
'0');
1284 value[6] = (
'0' + ((count / 1) % 10));
1289 n_int offset_y = 100;
1291 n_string_block bcps_string = {
' ',
' ',
' ',
' ',
' ',
' ',
'X',
' ',
1292 'B',
'P',
'S',
' ',
' ',
' ',
' ',
' ',
' ', 0
1294 n_string_block fps_string = {
' ',
' ',
' ',
' ',
' ',
' ',
'X',
' ',
1295 'F',
'P',
'S',
' ',
' ',
' ',
' ',
' ',
' ',
' ', 0
1300 draw_count_number(bcps, bcps_string);
1301 draw_string(bcps_string, terrain_dim_x - 98, offset_y, local_mono);
1306 draw_count_number(fps, fps_string);
1307 draw_string(fps_string, terrain_dim_x - 98, offset_y, local_mono);
1318 if ((local_sim->
select == 0L) || (number_errors != 0))
1328 n_pixel * local_draw_brain = &pixel_overlay;
1332 n_int center_x = dimensions->
x >> 1;
1333 n_int center_y = dimensions->
y >> 1;
1334 n_int act_x2a, term_1a, term_2a;
1336 n_byte * brainptr = local;
1337 n_byte * obrainptr = &local[ 32 * 32 * 32 ];
1338 n_int a11, a12, a13, a21, a23, a31, a32, a33;
1351 a11 = -((a32 * a23) >> 8);
1352 a13 = ((a32 * a21) >> 8);
1353 a31 = ((a12 * a23) >> 8);
1354 a33 = -((a12 * a21) >> 8);
1366 a12 = (a12 * 1152) >> 8;
1367 a32 = (a32 * 1152) >> 8;
1368 act_x2a = -((a21 + a23) << 4);
1369 term_1a = -((a11 + a12 + a13) << 4);
1370 term_2a = -((a31 + a32 + a33) << 4);
1374 n_int term_1 = term_1a;
1375 n_int term_2 = term_2a;
1378 n_int act_x1 = term_1 ;
1379 n_int act_x2 = act_x2a;
1380 n_int act_y1 = term_2 ;
1384 if ((brainptr[loop] ^ obrainptr[loop]) >> 5)
1386 n_int scr_z = 256 + (act_x1 >> 11);
1387 n_int s_x = ((act_x2 * scr_z) >> 16) + center_x;
1388 n_int s_y = ((act_y1 * scr_z) >> 16) + center_y - 120;
1389 (*local_draw_brain)(s_x, s_y, 0, 0, local_info_brain);
1390 if ((act_x1 > 0) && draw_big)
1392 (*local_draw_brain)(s_x - 1, s_y, 0, 0, local_info_brain);
1393 (*local_draw_brain)(s_x + 1, s_y, 0, 0, local_info_brain);
1394 (*local_draw_brain)(s_x, s_y - 1, 0, 0, local_info_brain);
1395 (*local_draw_brain)(s_x, s_y + 1, 0, 0, local_info_brain);
1413 tilt_y = ( tilt_y + 2 ) & 255;
1430 #ifdef NOBLE_APE_ASSERT
1431 printf(
"ERROR: %s\n", error_text);
1437 io_string_write(simulation_date_time_error, simulation_date_time, &position);
1443 io_string_write(simulation_date_time_error,
" ** Maximum errors reached **" , &position);
1463 error_char_copy = error_array[number_errors][loop] = simulation_date_time_error[loop];
1468 error_array[number_errors][loop] = 0;
1481 while(loop < remains->count)
1503 n_byte tide_compress[45];
1505 n_byte tide_point = tide - 106;
1508 n_int fl = tide_point;
1511 if (toggle_tidedaylight)
1518 tide_compress[lp] = (
n_byte)(((ar * (fl - lp)) + (dr * (lp - fp))) / (fl-fp));
1519 if (lp == tide_point)
1533 if ((val > 105) && (val < 151))
1535 screen[lp] = tide_compress[val - 106];
1543 n_byte tide_compress[45];
1545 n_byte tide_point = tide - 106;
1548 n_int fl = tide_point;
1551 if (toggle_tidedaylight)
1558 tide_compress[lp] = (
n_byte)(((ar * (fl - lp)) + (dr * (lp - fp))) / (fl-fp));
1559 if (lp == tide_point)
1571 n_byte4 block_group = block[lp >> 5];
1573 if (block_group != 0)
1575 n_int local_loop = lp<<1;
1576 n_int local_loop_end = local_loop+64;
1578 while (local_loop < local_loop_end)
1580 if ((block_group >> lp) & 1)
1582 data[local_loop|1] = tide_compress[data[local_loop] - 106];
1623 draw_apeloc_hires(local_sim, bei, &local_8bit);
1627 draw_apeloc(local_sim, bei, &local_8bit);
1649 static n_byte local_tide;
1659 if (toggle_territory)
1661 draw_region(local_sim->
select);
1663 draw_remains(local_sim, local_col.
screen);
1678 if(number_errors != 0)
1681 while(loop< (number_errors+1))
1683 draw_string(error_array[loop], 40, (loop*12) + 62, &local_mono);
1689 static void draw_line_braincode(
n_string pointer,
n_int line)
1694 draw_string(pointer, 4 + (terrain_dim_x/2) - 256, (line*12) + 246 + (terrain_dim_y/2) - 256, &local_mono);
1699 *co_x = terrain_dim_x;
1700 *co_y = terrain_dim_y;
1706 terrain_dim_x = dim_x;
1707 terrain_dim_y = dim_y;
1722 local_vect.
x = terrain_dim_x;
1723 local_vect.
y = terrain_dim_y;
1725 draw_apes(local_sim, 0);
1726 draw_apes(local_sim, 1);
1728 #ifdef EXECUTE_THREADED
1732 draw_terrain(local_sim, &local_vect, 0);
1736 draw_terrain(local_sim, &local_vect, 1);
1739 draw_terrain(local_sim, &local_vect, 0);
1741 draw_meters(local_sim);
1742 draw_errors(local_sim);
1747 draw_brain(local_sim, &local_vect);
1756 if (toggle_braincode)
1766 draw_weather(local_sim->
land);
1770 #ifdef MULTITOUCH_CONTROLS
1771 draw_tc_controls(&local_mono);