comparison interface.pde @ 225:1c9deae71fb1

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 05 Sep 2018 20:28:23 +0300
parents 2e077cfc4f38
children 7401300452c2
comparison
equal deleted inserted replaced
224:33a5c7670e66 225:1c9deae71fb1
124 } 124 }
125 125
126 126
127 void fixed_raster_command(int par) 127 void fixed_raster_command(int par)
128 { 128 {
129 if (par == 'p') { 129 if (par == 'p')
130 {
130 g_raster_no--; 131 g_raster_no--;
131 if (g_raster_no < 0) 132 if (g_raster_no < 0)
132 g_raster_no = 9; 133 g_raster_no = 9;
133 set_fixed_raster(g_raster_no); 134 set_fixed_raster(g_raster_no);
134 g_data[int('r')] = 1; 135 g_data[int('r')] = 1;
135 } 136 }
136 else 137 else
137 if (par == 'n') { 138 if (par == 'n')
139 {
138 g_raster_no++; 140 g_raster_no++;
139 if (g_raster_no > 9) 141 if (g_raster_no > 9)
140 g_raster_no = 0; 142 g_raster_no = 0;
141 set_fixed_raster(g_raster_no); 143 set_fixed_raster(g_raster_no);
142 g_data[int('r')] = 1; 144 g_data[int('r')] = 1;
143 } 145 }
144 else 146 else
145 if (par == 'x') { 147 if (par == 'x')
148 {
146 g_raster_offset_x++; 149 g_raster_offset_x++;
147 if (g_raster_offset_x > 3) 150 if (g_raster_offset_x > 3)
148 g_raster_offset_x = 0; 151 g_raster_offset_x = 0;
149 } 152 }
150 else 153 else
151 if (par == 'y') { 154 if (par == 'y')
155 {
152 g_raster_offset_y++; 156 g_raster_offset_y++;
153 if (g_raster_offset_y > 3) 157 if (g_raster_offset_y > 3)
154 g_raster_offset_y = 0; 158 g_raster_offset_y = 0;
155 } 159 }
156 } 160 }
197 201
198 void makecolor(int c, int rr, int gg, int bb) 202 void makecolor(int c, int rr, int gg, int bb)
199 { 203 {
200 //0-255 go to g_map[] up until 1021-1023 204 //0-255 go to g_map[] up until 1021-1023
201 //the rest is not stored 205 //the rest is not stored
202 if (c < 256) { 206 if (c < 256)
207 {
203 g_map[256 + c * 3] = byte(rr); 208 g_map[256 + c * 3] = byte(rr);
204 g_map[256 + c * 3 + 1] = byte(gg); 209 g_map[256 + c * 3 + 1] = byte(gg);
205 g_map[256 + c * 3 + 2] = byte(bb); 210 g_map[256 + c * 3 + 2] = byte(bb);
206 } 211 }
207 g_r[c] = rr; 212 g_r[c] = rr;
214 219
215 int fylli() 220 int fylli()
216 { 221 {
217 //for the animated rubberband thingy 222 //for the animated rubberband thingy
218 g_rband++; 223 g_rband++;
219 if (g_rband > g_rbang) { 224 if (g_rband > g_rbang)
225 {
220 g_rband = 0; 226 g_rband = 0;
221 g_rbang++; 227 g_rbang++;
222 if (g_rbang > 12) g_rbang = 8; 228 if (g_rbang > 12) g_rbang = 8;
223 } 229 }
224 if (g_rband >= 3) return 0; 230 if (g_rband >= 3) return 0;
317 323
318 324
319 // parameter store/restore in case some functions need to bypass grid, attribute modes etc 325 // parameter store/restore in case some functions need to bypass grid, attribute modes etc
320 void storeparameters() 326 void storeparameters()
321 { 327 {
322 for (int i = 0; i <= 255; i++) { 328 for (int i = 0; i <= 255; i++)
329 {
323 g_data[767 + i] = g_data[i]; 330 g_data[767 + i] = g_data[i];
324 } 331 }
325 } 332 }
326 333
327 334
328 void restoreparameters() 335 void restoreparameters()
329 { 336 {
330 for (int i = 0; i <= 255; i++) { 337 for (int i = 0; i <= 255; i++)
338 {
331 g_data[i] = g_data[767 + i]; 339 g_data[i] = g_data[767 + i];
332 } 340 }
333 } 341 }
334 342
335 343
385 { 393 {
386 far = metal; 394 far = metal;
387 if (mm == 1) far = 0xffffff80; 395 if (mm == 1) far = 0xffffff80;
388 } 396 }
389 397
390 if (t == 66) { //raster icon 398 if (t == 66)
391 if (x >= 1 && y >= 2 && x <= 13 && y <= 12) { 399 { //raster icon
400 if (x >= 1 && y >= 2 && x <= 13 && y <= 12)
401 {
392 far = metal; 402 far = metal;
393 if (mm == 1) far = 0xffffff80; 403 if (mm == 1) far = 0xffffff80;
394 if (get_raster(x + 1, y) == 1) far = 0xff000000; 404 if (get_raster(x + 1, y) == 1) far = 0xff000000;
395 } 405 }
396 } 406 }
417 int ad = 1024 + xx * 8 + yy * 2048 + y * 256; 427 int ad = 1024 + xx * 8 + yy * 2048 + y * 256;
418 428
419 for (int x = 0; x < 8; x++) 429 for (int x = 0; x < 8; x++)
420 { 430 {
421 int far; 431 int far;
422 if (int(g_icons[ad + x]) != 0) { 432 if (int(g_icons[ad + x]) != 0)
433 {
423 far = 0xffb0b0b0; 434 far = 0xffb0b0b0;
424 if (g_bsize < 4) { 435 if (g_bsize < 4)
436 {
425 if (g_bsize + (g_btype * 4) + 96 == t) far = 0xffffff80; 437 if (g_bsize + (g_btype * 4) + 96 == t) far = 0xffffff80;
426 } 438 }
427 } else { 439 }
440 else
441 {
428 far = 0xff000000; 442 far = 0xff000000;
429 if (g_spare && t <= 95) far = 0xff008000; //different background color for spare mode 443 if (g_spare && t <= 95) far = 0xff008000; //different background color for spare mode
430 if (g_msgctr > 0 && t + 32 < 128) far = 0xff0000ff; //different background color 444 if (g_msgctr > 0 && t + 32 < 128) far = 0xff0000ff; //different background color
431 } 445 }
432 446
819 } 833 }
820 834
821 //tooltip 835 //tooltip
822 if (ad != ':' && ad != ';' && ad != '.') 836 if (ad != ':' && ad != ';' && ad != '.')
823 { 837 {
824 if (realdraw == 0) { 838 if (realdraw == 0)
839 {
825 if (moicon(xx + x, yy + y, 16 * g_uiscale, 16 * g_uiscale)) help(ad); 840 if (moicon(xx + x, yy + y, 16 * g_uiscale, 16 * g_uiscale)) help(ad);
826 } 841 }
827 if (doicon(xx + x, yy + y, 16 * g_uiscale, 16 * g_uiscale)) 842 if (doicon(xx + x, yy + y, 16 * g_uiscale, 16 * g_uiscale))
828 { 843 {
829 //println(g_realbutton); 844 //println(g_realbutton);
881 896
882 int nextluminance(int f, int d) 897 int nextluminance(int f, int d)
883 { 898 {
884 int res = f + d; 899 int res = f + d;
885 900
886 if (g_machine == PLUS4 || g_machine == PLUS4M) { 901 if (g_machine == PLUS4 || g_machine == PLUS4M)
902 {
887 if (f + d * 15 > 120) return f; 903 if (f + d * 15 > 120) return f;
888 if (f + d * 15 < 1) return f; 904 if (f + d * 15 < 1) return f;
889 if (d == 1) return f + 15; 905 if (d == 1) return f + 15;
890 if (d == -1) return f - 15; 906 if (d == -1) return f - 15;
891 return res; 907 return res;
892 } 908 }
893 909
894 if (g_map[13] == C64) { //here the "C64" is generic across C64,C64M and potential FLI modes 910 if (g_map[13] == C64)
911 { //here the "C64" is generic across C64,C64M and potential FLI modes
895 int out[] = { 912 int out[] = {
896 6, 1, 11, 15, 8, 10, 913 6, 1, 11, 15, 8, 10,
897 9, 13, 14, 2, 3, 4, 914 9, 13, 14, 2, 3, 4,
898 5, 1, 12, 7 915 5, 1, 12, 7
899 }; // from "Ptoing" 916 }; // from "Ptoing"
900 if (d == 1) res = out[f]; 917 if (d == 1) res = out[f];
901 if (d == -1) { 918 if (d == -1)
919 {
902 if (f == 0) return 0; 920 if (f == 0) return 0;
903 for (int i = 0; i < g_maxcolors; i++) { 921 for (int i = 0; i < g_maxcolors; i++)
922 {
904 if (out[i] == f) res = i; 923 if (out[i] == f) res = i;
905 } 924 }
906 } 925 }
907 } 926 }
908 927
909 if (g_map[13] == MSX) { 928 if (g_map[13] == MSX)
929 {
910 int out[] = { 930 int out[] = {
911 1, 4, 9, 10, 931 1, 4, 9, 10,
912 6, 12, 13, 14, 932 6, 12, 13, 14,
913 5, 3, 7, 15, 933 5, 3, 7, 15,
914 2, 8, 11, 15 934 2, 8, 11, 15
915 }; // calculated Y 935 }; // calculated Y
916 if (d == 1) res = out[f]; 936 if (d == 1) res = out[f];
917 if (d == -1) { 937 if (d == -1)
938 {
918 if (f == 0) return 0; 939 if (f == 0) return 0;
919 for (int i = 0; i < g_maxcolors - 1; i++) { 940 for (int i = 0; i < g_maxcolors - 1; i++)
941 {
920 if (out[i] == f) res = i; 942 if (out[i] == f) res = i;
921 } 943 }
922 } 944 }
923 } 945 }
924 946
940 962
941 963
942 void set_tool(int s) 964 void set_tool(int s)
943 { 965 {
944 //set current tool, for convenience 966 //set current tool, for convenience
945 for (int i = '0'; i <= '9'; i++) { 967 for (int i = '0'; i <= '9'; i++)
968 {
946 g_data[i] = 0; 969 g_data[i] = 0;
947 } 970 }
948 g_data[48 + s] = byte(1); 971 g_data[48 + s] = byte(1);
949 g_map[12] = byte(s); 972 g_map[12] = byte(s);
950 } 973 }
952 975
953 void selectcolor(int hand, int x) 976 void selectcolor(int hand, int x)
954 { 977 {
955 if (x >= g_maxcolors) x = x - g_maxcolors; 978 if (x >= g_maxcolors) x = x - g_maxcolors;
956 if (x < 0) x = x + g_maxcolors; 979 if (x < 0) x = x + g_maxcolors;
957 if (hand == 0) { 980 if (hand == 0)
981 {
958 g_farge = x; 982 g_farge = x;
959 g_ofarge = x; //kludgey, the colour and the "original colour" 983 g_ofarge = x; //kludgey, the colour and the "original colour"
960 if (g_btype == 9) g_data[int('p')] = 1; 984 if (g_btype == 9) g_data[int('p')] = 1;
961 g_realfront = byte(g_farge); 985 g_realfront = byte(g_farge);
962 g_realback = byte(g_backg); 986 g_realback = byte(g_backg);
963 } 987 }
964 if (hand == 1) { 988 if (hand == 1)
989 {
965 g_backg = x; 990 g_backg = x;
966 g_realback = byte(g_backg); 991 g_realback = byte(g_backg);
967 g_realfront = byte(g_farge); 992 g_realfront = byte(g_farge);
968 } 993 }
969 } 994 }
992 refresh(); 1017 refresh();
993 g_boxreconstruct = 2; 1018 g_boxreconstruct = 2;
994 } 1019 }
995 1020
996 1021
997 void palettebox(float x0, int y0, float x1) { 1022 void palettebox(float x0, int y0, float x1)
1023 {
998 if (g_palsteps == 0) return; 1024 if (g_palsteps == 0) return;
999 float expand = ((x1 - x0) / g_palsteps); 1025 float expand = ((x1 - x0) / g_palsteps);
1000 int divs = int(255 / (g_palsteps - 1)); 1026 int divs = int(255 / (g_palsteps - 1));
1001 for (int i = 0; i < g_palsteps; i++) { 1027 for (int i = 0; i < g_palsteps; i++)
1002 if (doicon_drag(int(x0 + expand * i), y0, int(expand), 7 * g_uiscale)) { 1028 {
1029 if (doicon_drag(int(x0 + expand * i), y0, int(expand), 7 * g_uiscale))
1030 {
1003 g_r[g_farge] = int(i * divs); 1031 g_r[g_farge] = int(i * divs);
1004 message("RED:" + i); 1032 message("RED:" + i);
1005 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]); 1033 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]);
1006 refresh(); 1034 refresh();
1007 g_boxreconstruct = 2; 1035 g_boxreconstruct = 2;
1008 } 1036 }
1009 if (doicon_drag(int(x0 + expand * i), y0 + 10 * g_uiscale, int(expand), 7 * g_uiscale)) { 1037 if (doicon_drag(int(x0 + expand * i), y0 + 10 * g_uiscale, int(expand), 7 * g_uiscale))
1038 {
1010 g_g[g_farge] = int(i * divs); 1039 g_g[g_farge] = int(i * divs);
1011 message("GREEN:" + i); 1040 message("GREEN:" + i);
1012 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]); 1041 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]);
1013 refresh(); 1042 refresh();
1014 g_boxreconstruct = 2; 1043 g_boxreconstruct = 2;
1015 } 1044 }
1016 if (doicon_drag(int(x0 + expand * i), y0 + 20 * g_uiscale, int(expand), 7 * g_uiscale)) { 1045 if (doicon_drag(int(x0 + expand * i), y0 + 20 * g_uiscale, int(expand), 7 * g_uiscale))
1046 {
1017 g_b[g_farge] = int(i * divs); 1047 g_b[g_farge] = int(i * divs);
1018 message("BLUE:" + i); 1048 message("BLUE:" + i);
1019 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]); 1049 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]);
1020 refresh(); 1050 refresh();
1021 g_boxreconstruct = 2; 1051 g_boxreconstruct = 2;
1024 1054
1025 for (int j = 0; j < 3; j++) 1055 for (int j = 0; j < 3; j++)
1026 { 1056 {
1027 e_rect(int(x0), y0 + j * 10 * g_uiscale, int(x1 - x0), 7 * g_uiscale, g_rgb[258]); 1057 e_rect(int(x0), y0 + j * 10 * g_uiscale, int(x1 - x0), 7 * g_uiscale, g_rgb[258]);
1028 1058
1029 for (int i = 1; i < g_palsteps; i++) { 1059 for (int i = 1; i < g_palsteps; i++)
1060 {
1030 e_rect(int(x0 + expand * i), y0 + j * 10 * g_uiscale, g_uiscale, 2 * g_uiscale, g_rgb[257]); 1061 e_rect(int(x0 + expand * i), y0 + j * 10 * g_uiscale, g_uiscale, 2 * g_uiscale, g_rgb[257]);
1031 } 1062 }
1032 } 1063 }
1033 1064
1034 e_rect(int(x0 + expand * g_r[g_farge] / divs), y0, int(expand), 7 * g_uiscale, g_rgb[260]); 1065 e_rect(int(x0 + expand * g_r[g_farge] / divs), y0, int(expand), 7 * g_uiscale, g_rgb[260]);
1048 yhei = 16 * g_uiscale; 1079 yhei = 16 * g_uiscale;
1049 expand = 1; 1080 expand = 1;
1050 yfat = 4 * g_uiscale; 1081 yfat = 4 * g_uiscale;
1051 bfat = 1 * g_uiscale; 1082 bfat = 1 * g_uiscale;
1052 1083
1053 if (g_maxcolors > 60) { 1084 if (g_maxcolors > 60)
1085 {
1054 yhei = 4 * g_uiscale; 1086 yhei = 4 * g_uiscale;
1055 yfat = 0; 1087 yfat = 0;
1056 bfat = 1; 1088 bfat = 1;
1057 } 1089 }
1058 1090
1062 far = 0xff000000; 1094 far = 0xff000000;
1063 1095
1064 maxp = g_maxcolors; 1096 maxp = g_maxcolors;
1065 xonko = int(int(512 / g_maxcolors) / 2) * g_uiscale; 1097 xonko = int(int(512 / g_maxcolors) / 2) * g_uiscale;
1066 1098
1067 if (g_maxcolors > 32) { 1099 if (g_maxcolors > 32)
1100 {
1068 maxp = int(g_maxcolors / 2); 1101 maxp = int(g_maxcolors / 2);
1069 xonko = int(1024 / g_maxcolors); 1102 xonko = int(1024 / g_maxcolors);
1070 } 1103 }
1071 1104
1072 if (g_machine == PLUS4 || g_machine == PLUS4M) 1105 if (g_machine == PLUS4 || g_machine == PLUS4M)
1078 yloc = yo + 8 * g_uiscale; 1111 yloc = yo + 8 * g_uiscale;
1079 if (g_maxcolors > 60) 1112 if (g_maxcolors > 60)
1080 { 1113 {
1081 yloc = yo + yhei * 7; 1114 yloc = yo + yhei * 7;
1082 1115
1083 if (x > 15 && x <= 30) { 1116 if (x > 15 && x <= 30)
1117 {
1084 xloc = xo + (x - 15) * xonko; 1118 xloc = xo + (x - 15) * xonko;
1085 yloc = yo + yhei * 6 + yfat * 2; 1119 yloc = yo + yhei * 6 + yfat * 2;
1086 } 1120 }
1087 if (x > 30 && x <= 45) { 1121 if (x > 30 && x <= 45)
1122 {
1088 xloc = xo + (x - 30) * xonko; 1123 xloc = xo + (x - 30) * xonko;
1089 yloc = yo + yhei * 5 + yfat * 4; 1124 yloc = yo + yhei * 5 + yfat * 4;
1090 } 1125 }
1091 if (x > 45 && x <= 60) { 1126 if (x > 45 && x <= 60)
1127 {
1092 xloc = xo + (x - 45) * xonko; 1128 xloc = xo + (x - 45) * xonko;
1093 yloc = yo + yhei * 4 + yfat * 6; 1129 yloc = yo + yhei * 4 + yfat * 6;
1094 } 1130 }
1095 if (x > 60 && x <= 75) { 1131 if (x > 60 && x <= 75)
1132 {
1096 xloc = xo + (x - 60) * xonko; 1133 xloc = xo + (x - 60) * xonko;
1097 yloc = yo + yhei * 3 + yfat * 8; 1134 yloc = yo + yhei * 3 + yfat * 8;
1098 } 1135 }
1099 if (x > 75 && x <= 90) { 1136 if (x > 75 && x <= 90)
1137 {
1100 xloc = xo + (x - 75) * xonko; 1138 xloc = xo + (x - 75) * xonko;
1101 yloc = yo + yhei * 2 + yfat * 10; 1139 yloc = yo + yhei * 2 + yfat * 10;
1102 } 1140 }
1103 if (x > 90 && x <= 105) { 1141 if (x > 90 && x <= 105)
1142 {
1104 xloc = xo + (x - 90) * xonko; 1143 xloc = xo + (x - 90) * xonko;
1105 yloc = yo + yhei * 1 + yfat * 12; 1144 yloc = yo + yhei * 1 + yfat * 12;
1106 } 1145 }
1107 if (x > 105 && x <= 120) { 1146 if (x > 105 && x <= 120)
1147 {
1108 xloc = xo + (x - 105) * xonko; 1148 xloc = xo + (x - 105) * xonko;
1109 yloc = yo + yhei * 0 + yfat * 14; 1149 yloc = yo + yhei * 0 + yfat * 14;
1110 } 1150 }
1111 1151
1112 yloc--; 1152 yloc--;
1116 { 1156 {
1117 if (mouseButton == LEFT || mouseButton == CENTER) 1157 if (mouseButton == LEFT || mouseButton == CENTER)
1118 { 1158 {
1119 selectcolor(0, x); 1159 selectcolor(0, x);
1120 } 1160 }
1121 if (mouseButton == RIGHT) { 1161 if (mouseButton == RIGHT)
1162 {
1122 selectcolor(1, x); 1163 selectcolor(1, x);
1123 g_button = LEFT; 1164 g_button = LEFT;
1124 } 1165 }
1125 } 1166 }
1126 1167
1137 far = 0xff000000; 1178 far = 0xff000000;
1138 if (g_backg == x && yfat > 0) far = 0xff808080; 1179 if (g_backg == x && yfat > 0) far = 0xff808080;
1139 1180
1140 e_rect(xloc, yloc + yhei, xonko, yfat, far); 1181 e_rect(xloc, yloc + yhei, xonko, yfat, far);
1141 if (doicon(xloc, yloc + yhei, xonko, yfat)) selectcolor(1, x); 1182 if (doicon(xloc, yloc + yhei, xonko, yfat)) selectcolor(1, x);
1142 if (yfat == 0) { 1183 if (yfat == 0)
1143 if (g_farge == x) { 1184 {
1185 if (g_farge == x)
1186 {
1144 e_rect(xloc, yloc, xonko / 4, yhei / 4, far); 1187 e_rect(xloc, yloc, xonko / 4, yhei / 4, far);
1145 e_rect(xloc, yloc + 1, xonko / 8, yhei / 4, far); 1188 e_rect(xloc, yloc + 1, xonko / 8, yhei / 4, far);
1146 } 1189 }
1147 if (g_backg == x) { 1190 if (g_backg == x)
1191 {
1148 e_rect(xloc + xonko - xonko / 4, yloc + yhei - 2, int(xonko / 4), int(yhei / 4), far); 1192 e_rect(xloc + xonko - xonko / 4, yloc + yhei - 2, int(xonko / 4), int(yhei / 4), far);
1149 e_rect(xloc + xonko - xonko / 8, yloc + yhei - 3, int(xonko / 8), int(yhei / 4), far); 1193 e_rect(xloc + xonko - xonko / 8, yloc + yhei - 3, int(xonko / 8), int(yhei / 4), far);
1150 } 1194 }
1151 } 1195 }
1152 if (int(g_map[0]) == x) { 1196 if (int(g_map[0]) == x)
1197 {
1153 far = 0xff000000; 1198 far = 0xff000000;
1154 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff; 1199 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff;
1155 e_rect(xloc, yloc, xonko, bfat, far); 1200 e_rect(xloc, yloc, xonko, bfat, far);
1156 e_rect(xloc, yloc + yhei - bfat, xonko, bfat, far); 1201 e_rect(xloc, yloc + yhei - bfat, xonko, bfat, far);
1157 e_rect(xloc, yloc, bfat, yhei, far); 1202 e_rect(xloc, yloc, bfat, yhei, far);
1158 e_rect(xloc + xonko - bfat, yloc, bfat, yhei, far); 1203 e_rect(xloc + xonko - bfat, yloc, bfat, yhei, far);
1159 } 1204 }
1160 if (int(g_map[1]) == x) { 1205 if (int(g_map[1]) == x)
1206 {
1161 far = 0xff000000; 1207 far = 0xff000000;
1162 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff; 1208 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff;
1163 e_rect(xloc + int(xonko / 4), yloc + int(yhei / 4), int(xonko / 4), int(yhei / 4), far); 1209 e_rect(xloc + int(xonko / 4), yloc + int(yhei / 4), int(xonko / 4), int(yhei / 4), far);
1164 } 1210 }
1165 if (g_machine == PLUS4 || g_machine == PLUS4M) { 1211 if (g_machine == PLUS4 || g_machine == PLUS4M)
1166 if (int(g_map[1]) != 255 && int(g_map[2]) == x) { 1212 {
1213 if (int(g_map[1]) != 255 && int(g_map[2]) == x)
1214 {
1167 far = 0xff000000; 1215 far = 0xff000000;
1168 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff; 1216 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff;
1169 e_rect(xloc + xonko - int(xonko / 4) * 2, yloc + yhei - int(yhei / 4) * 2, int(xonko / 4), int(yhei / 4), far); 1217 e_rect(xloc + xonko - int(xonko / 4) * 2, yloc + yhei - int(yhei / 4) * 2, int(xonko / 4), int(yhei / 4), far);
1170 } 1218 }
1171 } 1219 }
1197 int h = 0; 1245 int h = 0;
1198 if (g_button == RIGHT) h = 1; 1246 if (g_button == RIGHT) h = 1;
1199 e_rect(ox, oy, bs * 2, bs * 4, g_rgb[int(g_realback)]); 1247 e_rect(ox, oy, bs * 2, bs * 4, g_rgb[int(g_realback)]);
1200 e_rect(ox + bs / 2, oy + 4 * g_uiscale, 12 * g_uiscale, bs * 2, g_rgb[int(g_realfront)]); 1248 e_rect(ox + bs / 2, oy + 4 * g_uiscale, 12 * g_uiscale, bs * 2, g_rgb[int(g_realfront)]);
1201 if (doicon(ox, oy, bs * 2, bs * 3)) command(int('<')); 1249 if (doicon(ox, oy, bs * 2, bs * 3)) command(int('<'));
1202 if (g_machine == C64M || g_machine == MSX || g_machine == AMIGA) { 1250 if (g_machine == C64M || g_machine == MSX || g_machine == AMIGA)
1251 {
1203 e_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[int(g_map[1])]); 1252 e_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[int(g_map[1])]);
1204 d_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[257]); 1253 d_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[257]);
1205 if (doicon(ox, oy + bs * 3, bs * 2, bs)) { 1254 if (doicon(ox, oy + bs * 3, bs * 2, bs))
1255 {
1206 if (g_shift == false) selectcolor(h, int(g_map[1])); 1256 if (g_shift == false) selectcolor(h, int(g_map[1]));
1207 if (g_shift) command(int('C')); 1257 if (g_shift) command(int('C'));
1208 } 1258 }
1209 } 1259 }
1210 if (g_machine == PLUS4M) { 1260 if (g_machine == PLUS4M)
1261 {
1211 e_rect(ox, oy + bs * 3, bs, bs, g_rgb[int(g_map[1])]); 1262 e_rect(ox, oy + bs * 3, bs, bs, g_rgb[int(g_map[1])]);
1212 e_rect(ox + 8 * g_uiscale, oy + bs * 3, bs, bs, g_rgb[int(g_map[2])]); 1263 e_rect(ox + 8 * g_uiscale, oy + bs * 3, bs, bs, g_rgb[int(g_map[2])]);
1213 d_rect(ox, oy + bs * 3, bs, bs, g_rgb[257]); 1264 d_rect(ox, oy + bs * 3, bs, bs, g_rgb[257]);
1214 d_rect(ox + 8 * g_uiscale, oy + bs * 3, bs, bs, g_rgb[257]); 1265 d_rect(ox + 8 * g_uiscale, oy + bs * 3, bs, bs, g_rgb[257]);
1215 if (doicon(ox, oy + bs * 3, bs, bs)) { 1266 if (doicon(ox, oy + bs * 3, bs, bs))
1267 {
1216 if (g_shift == false) selectcolor(h, int(g_map[1])); 1268 if (g_shift == false) selectcolor(h, int(g_map[1]));
1217 if (g_shift) command(int('C')); 1269 if (g_shift) command(int('C'));
1218 } 1270 }
1219 if (doicon(ox + 8 * g_uiscale, oy + bs * 3, bs, bs)) { 1271 if (doicon(ox + 8 * g_uiscale, oy + bs * 3, bs, bs))
1272 {
1220 if (g_shift == false) selectcolor(h, int(g_map[2])); 1273 if (g_shift == false) selectcolor(h, int(g_map[2]));
1221 if (g_shift) command(int('V')); 1274 if (g_shift) command(int('V'));
1222 } 1275 }
1223 } 1276 }
1224 } 1277 }
1236 if (g_repanel > 0 && !forced) 1289 if (g_repanel > 0 && !forced)
1237 { 1290 {
1238 icontable(width - 32 * g_uiscale, 0, 0, 0); 1291 icontable(width - 32 * g_uiscale, 0, 0, 0);
1239 icontable(272 * g_uiscale, height - 32 * g_uiscale, 1, 0); 1292 icontable(272 * g_uiscale, height - 32 * g_uiscale, 1, 0);
1240 //icontable(0,0,3,0); 1293 //icontable(0,0,3,0);
1241 if (g_machine == PLUS4M || g_machine == PLUS4) { 1294 if (g_machine == PLUS4M || g_machine == PLUS4)
1295 {
1242 icontable(240 * g_uiscale, height - 32 * g_uiscale, 2, 0); 1296 icontable(240 * g_uiscale, height - 32 * g_uiscale, 2, 0);
1243 } 1297 }
1244 } 1298 }
1245 else 1299 else
1246 { 1300 {
1247 icontable(width - 32 * g_uiscale - 1, 0, 0, 1); 1301 icontable(width - 32 * g_uiscale - 1, 0, 0, 1);
1248 icontable(272 * g_uiscale, height - 32 * g_uiscale, 1, 1); 1302 icontable(272 * g_uiscale, height - 32 * g_uiscale, 1, 1);
1249 palettebox(g_uiscale * 324 + 4, height - 32 * g_uiscale, width - (96 * g_uiscale) - 4); 1303 palettebox(g_uiscale * 324 + 4, height - 32 * g_uiscale, width - (96 * g_uiscale) - 4);
1250 1304
1251 if (g_machine == PLUS4M || g_machine == PLUS4) { 1305 if (g_machine == PLUS4M || g_machine == PLUS4)
1306 {
1252 icontable(240 * g_uiscale, height - 32 * g_uiscale, 2, 1); 1307 icontable(240 * g_uiscale, height - 32 * g_uiscale, 2, 1);
1253 } 1308 }
1254 1309
1255 colorselector(0, height - 32 * g_uiscale); 1310 colorselector(0, height - 32 * g_uiscale);
1256 colorindicator(256 * g_uiscale, height - 32 * g_uiscale); 1311 colorindicator(256 * g_uiscale, height - 32 * g_uiscale);
1287 1342
1288 maxx = magx(); 1343 maxx = magx();
1289 mayy = magy(); 1344 mayy = magy();
1290 //borders & ultimate background 1345 //borders & ultimate background
1291 1346
1292 if (g_boxreconstruct == 1) { 1347 if (g_boxreconstruct == 1)
1348 {
1293 g_boxreconstruct = 0; 1349 g_boxreconstruct = 0;
1294 //between mag window and toolboxes 1350 //between mag window and toolboxes
1295 if (g_data['m'] == 1 || g_data['M'] == 1) 1351 if (g_data['m'] == 1 || g_data['M'] == 1)
1296 { 1352 {
1297 e_rect(0, (mayy * psizex) * 8, maxx * psizex * 8, height - ((g_vedge + g_uiscale * 2) + (mayy * psizex * 8)), g_rgb[263]); 1353 e_rect(0, (mayy * psizex) * 8, maxx * psizex * 8, height - ((g_vedge + g_uiscale * 2) + (mayy * psizex * 8)), g_rgb[263]);
1319 mayy--; 1375 mayy--;
1320 1376
1321 g_ofx = clampv(g_ofx, 0, MX - magx()); 1377 g_ofx = clampv(g_ofx, 0, MX - magx());
1322 g_ofy = clampv(g_ofy, 0, MY - magy()); 1378 g_ofy = clampv(g_ofy, 0, MY - magy());
1323 1379
1324 if (mmode == 10) { 1380 if (mmode == 10)
1381 {
1325 g_ofx = 0; 1382 g_ofx = 0;
1326 g_ofy = 0; 1383 g_ofy = 0;
1327 maxx = MX - 1; 1384 maxx = MX - 1;
1328 mayy = MY - 1; 1385 mayy = MY - 1;
1329 winsux = g_windowx; 1386 winsux = g_windowx;
1330 winsuy = g_windowy; 1387 winsuy = g_windowy;
1331 xcmag = 16; 1388 xcmag = 16;
1332 } //mini 1389 } //mini
1333 else 1390 else
1334 if (mmode == 0) { 1391 if (mmode == 0)
1392 {
1335 g_ofx = 0; 1393 g_ofx = 0;
1336 g_ofy = 0; 1394 g_ofy = 0;
1337 maxx = MX - 1; 1395 maxx = MX - 1;
1338 mayy = MY - 1; 1396 mayy = MY - 1;
1339 winsux = g_windowx; 1397 winsux = g_windowx;
1340 winsuy = g_windowy; 1398 winsuy = g_windowy;
1341 xcmag = 24; 1399 xcmag = 24;
1342 } //normal 1400 } //normal
1343 else 1401 else
1344 if (mmode == 20) { 1402 if (mmode == 20)
1403 {
1345 g_ofx = 0; 1404 g_ofx = 0;
1346 g_ofy = 0; 1405 g_ofy = 0;
1347 maxx = MX - 1; 1406 maxx = MX - 1;
1348 mayy = MY - 1; 1407 mayy = MY - 1;
1349 winsux = g_windowx; 1408 winsux = g_windowx;