Changeset 523
- Timestamp:
- 08/14/07 12:02:48 (1 year ago)
- Files:
-
- trunk/src/cave.c (modified) (9 diffs)
- trunk/src/defines.h (modified) (1 diff)
- trunk/src/monster2.c (modified) (2 diffs)
- trunk/src/object2.c (modified) (2 diffs)
- trunk/src/spells2.c (modified) (5 diffs)
- trunk/src/ui-event.h (modified) (1 diff)
- trunk/src/xtra1.c (modified) (2 diffs)
- trunk/src/xtra3.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/cave.c
r522 r523 17 17 */ 18 18 #include "angband.h" 19 #include "ui-event.h" 19 20 20 21 /* … … 1109 1110 Term_queue_char(t, kx+1, ky, TERM_WHITE, ' ', 0, 0); 1110 1111 } 1111 1112 /* Redraw map */1113 p_ptr->redraw |= (PR_MAP);1114 1112 } 1115 1113 } … … 1245 1243 1246 1244 1247 static void lite_spot_map(int y, int x)1248 {1249 grid_data g;1250 byte a, ta;1251 char c, tc;1252 1253 int ky, kx;1254 1255 int j;1256 1257 /* Scan windows */1258 for (j = 0; j < ANGBAND_TERM_MAX; j++)1259 {1260 term *t = angband_term[j];1261 1262 /* No window */1263 if (!t) continue;1264 1265 /* No relevant flags */1266 if (!(op_ptr->window_flag[j] & (PW_MAP))) continue;1267 1268 /* Location relative to panel */1269 ky = y - t->offset_y;1270 kx = x - t->offset_x;1271 1272 if (use_bigtile)1273 {1274 kx += kx;1275 if (kx + 1 >= t->wid) continue;1276 }1277 1278 /* Verify location */1279 if ((ky < 0) || (ky >= t->hgt)) continue;1280 if ((kx < 0) || (kx >= t->wid)) continue;1281 1282 /* Hack -- redraw the grid spot */1283 map_info(y, x, &g);1284 grid_data_as_text(&g, &a, &c, &ta, &tc);1285 Term_queue_char(t, kx, ky, a, c, ta, tc);1286 1287 if (use_bigtile)1288 {1289 kx++;1290 1291 /* Mega-Hack : Queue dummy char */1292 if (a & 0x80)1293 Term_queue_char(t, kx, ky, 255, -1, 0, 0);1294 else1295 Term_queue_char(t, kx, ky, TERM_WHITE, ' ', TERM_WHITE, ' ');1296 }1297 1298 /* Redraw map */1299 p_ptr->redraw |= (PR_MAP);1300 }1301 }1302 1303 1304 1245 1305 1246 /* … … 1307 1248 * 1308 1249 * This function should only be called on "legal" grids. 1309 *1310 * Note the inline use of "print_rel()" for efficiency.1311 *1312 * The main screen will always be at least 24x80 in size.1313 1250 */ 1314 1251 void lite_spot(int y, int x) 1315 1252 { 1316 byte a; 1317 char c; 1318 byte ta; 1319 char tc; 1320 grid_data g; 1321 1322 int ky, kx; 1323 int vy, vx; 1324 1325 /* Update map sub-windows */ 1326 lite_spot_map(y, x); 1327 1328 /* Location relative to panel */ 1329 ky = y - Term->offset_y; 1330 1331 /* Verify location */ 1332 if ((ky < 0) || (ky >= SCREEN_HGT)) return; 1333 1334 /* Location relative to panel */ 1335 kx = x - Term->offset_x; 1336 1337 /* Verify location */ 1338 if ((kx < 0) || (kx >= SCREEN_WID)) return; 1339 1340 /* Location in window */ 1341 vy = ky + ROW_MAP; 1342 1343 /* Location in window */ 1344 vx = kx + COL_MAP; 1345 1346 if (use_bigtile) vx += kx; 1347 1348 /* Hack -- redraw the grid */ 1349 map_info(y, x, &g); 1350 grid_data_as_text(&g, &a, &c, &ta, &tc); 1351 Term_queue_char(Term, vx, vy, a, c, ta, tc); 1352 1353 if (use_bigtile) 1354 { 1355 vx++; 1356 1357 /* Mega-Hack : Queue dummy char */ 1358 if (a & 0x80) 1359 Term_queue_char(Term, vx, vy, 255, -1, 0, 0); 1360 else 1361 Term_queue_char(Term, vx, vy, TERM_WHITE, ' ', TERM_WHITE, ' '); 1362 } 1253 ui_event_signal_point(ui_MAP_CHANGED, x, y); 1363 1254 } 1364 1255 … … 1422 1313 } 1423 1314 } 1424 1425 /* Redraw map */1426 p_ptr->redraw |= (PR_MAP);1427 1315 } 1428 1316 } … … 3293 3181 /* Memorize the object */ 3294 3182 cave_info[y][x] |= (CAVE_MARK); 3183 lite_spot(y, x); 3295 3184 } 3296 3185 … … 3306 3195 /* Memorize the walls */ 3307 3196 cave_info[yy][xx] |= (CAVE_MARK); 3197 lite_spot(yy, xx); 3308 3198 } 3309 3199 } … … 3311 3201 } 3312 3202 } 3313 3314 /* Redraw map */3315 p_ptr->redraw |= (PR_MAP);3316 3203 } 3317 3204 … … 3393 3280 p_ptr->update |= (PU_FORGET_VIEW | PU_UPDATE_VIEW | PU_MONSTERS); 3394 3281 3395 /* Redraw map, monster list */3282 /* Redraw whole map, monster list */ 3396 3283 p_ptr->redraw |= (PR_MAP | PR_MONLIST); 3397 3284 } trunk/src/defines.h
r522 r523 1609 1609 #define PR_DTRAP 0x00010000L /* Trap detection indicator */ 1610 1610 #define PR_STATE 0x00020000L /* Display Extra (State) */ 1611 #define PR_MAP 0x00040000L /* Display Map */1611 #define PR_MAP 0x00040000L /* Redraw whole map */ 1612 1612 1613 1613 #define PR_INVEN 0x00080000L /* Display inven/equip */ trunk/src/monster2.c
r522 r523 1366 1366 /* Update the flow */ 1367 1367 p_ptr->update |= (PU_UPDATE_FLOW); 1368 1369 /* Window stuff */1370 p_ptr->redraw |= (PR_MAP);1371 1368 } 1372 1369 … … 1402 1399 /* Update the flow */ 1403 1400 p_ptr->update |= (PU_UPDATE_FLOW); 1404 1405 /* Window stuff */1406 p_ptr->redraw |= (PR_MAP);1407 1401 } 1408 1402 trunk/src/object2.c
r522 r523 336 336 msg_print("Compacting objects..."); 337 337 338 /* Redraw map */339 p_ptr->redraw |= (PR_MAP);340 341 342 343 344 338 /*** Try destroying objects ***/ 345 339 … … 732 726 void object_aware(object_type *o_ptr) 733 727 { 728 int i; 729 734 730 /* Fully aware of the effects */ 735 731 k_info[o_ptr->k_idx].aware = TRUE; 736 732 737 /* Scrolls can change the graphics when becoming aware */ 738 if (o_ptr->tval == TV_SCROLL) 739 { 740 /* Redraw map */ 741 p_ptr->redraw |= (PR_MAP); 733 /* Some objects can change their "tile" when becoming aware */ 734 for (i = 1; i < o_max; i++) 735 { 736 object_type *floor_o_ptr = &o_list[i]; 737 738 /* If it's on the floor and of the right "kind" */ 739 if (!(floor_o_ptr->held_m_idx) && floor_o_ptr->k_idx == o_ptr->k_idx) 740 { 741 /* Redraw that location */ 742 lite_spot(floor_o_ptr->iy, floor_o_ptr->ix); 743 } 742 744 } 743 745 } trunk/src/spells2.c
r522 r523 2473 2473 /* Lose light and knowledge */ 2474 2474 cave_info[y][x] &= ~(CAVE_GLOW | CAVE_MARK); 2475 2476 lite_spot(y, x); 2475 2477 2476 2478 /* Hack -- Notice player affect */ … … 2550 2552 p_ptr->update |= (PU_FORGET_FLOW | PU_UPDATE_FLOW); 2551 2553 2552 /* Redraw m ap, monster list */2553 p_ptr->redraw |= (PR_M AP | PR_MONLIST);2554 /* Redraw monster list */ 2555 p_ptr->redraw |= (PR_MONLIST); 2554 2556 } 2555 2557 … … 2624 2626 /* Lose light and knowledge */ 2625 2627 cave_info[yy][xx] &= ~(CAVE_GLOW | CAVE_MARK); 2626 2628 2627 2629 /* Skip the epicenter */ 2628 2630 if (!dx && !dy) continue; … … 2842 2844 xx = cx + dx; 2843 2845 2844 /* Skip unaffected grids*/2845 if (!map[16+yy-cy][16+xx-cx]) continue;2846 2847 /* Paranoia -- never affect player */2848 if ((yy == py) && (xx == px)) continue;2846 /* Note unaffected grids for light changes, etc. */ 2847 if (!map[16+yy-cy][16+xx-cx]) 2848 { 2849 lite_spot(yy, xx); 2850 } 2849 2851 2850 2852 /* Destroy location (if valid) */ 2851 if (cave_valid_bold(yy, xx))2853 else if (cave_valid_bold(yy, xx)) 2852 2854 { 2853 2855 int feat = FEAT_FLOOR; … … 2894 2896 /* Fully update the flow */ 2895 2897 p_ptr->update |= (PU_FORGET_FLOW | PU_UPDATE_FLOW); 2896 2897 /* Redraw map */2898 p_ptr->redraw |= (PR_MAP);2899 2898 2900 2899 /* Update the health bar */ trunk/src/ui-event.h
r522 r523 34 34 ui_MESSAGES_CHANGED, 35 35 36 ui_event_REDRAW /* A 'set' of events has finished*/36 ui_event_REDRAW /* It's the end of a "set" of events, so safe to update */ 37 37 } ui_event_type; 38 38 trunk/src/xtra1.c
r522 r523 1610 1610 if (character_icky) return; 1611 1611 1612 /* Deal with the basic signals*/1612 /* For each listed flag, send the appropriate signal to the UI */ 1613 1613 for (i = 0; i < N_ELEMENTS(redraw_events); i++) 1614 1614 { 1615 1615 const struct flag_event_trigger *hnd = &redraw_events[i]; 1616 1616 1617 if (p_ptr->redraw & hnd->flag) 1617 1618 ui_event_signal(hnd->event); … … 1621 1622 if (p_ptr->redraw & PR_MAP) 1622 1623 { 1623 /* We probably really want map changes to be incremental*/1624 /* Mark the whole map to be redrawn */ 1624 1625 ui_event_signal_point(ui_MAP_CHANGED, -1, -1); 1625 1626 } 1626 1627 1627 1628 p_ptr->redraw = 0; 1629 1630 /* 1631 * Do any plotting, etc. delayed from earlier - this set of updates 1632 * is over. 1633 */ 1634 ui_event_signal(ui_event_REDRAW); 1628 1635 } 1629 1636 trunk/src/xtra3.c
r522 r523 904 904 905 905 906 /* ------------------------------------------------------------------------ 907 * Map redraw. 908 * ------------------------------------------------------------------------ */ 909 static void trace_map_updates(ui_event_type type, ui_event_data *data, void *user) 910 { 911 if (data->point.x == -1 && data->point.y == -1) 912 { 913 printf("Redraw whole map\n"); 914 } 915 else 916 { 917 printf("Redraw (%i, %i)\n", data->point.x, data->point.y); 918 } 919 } 920 921 static void update_maps(ui_event_type type, ui_event_data *data, void *user) 922 { 923 term *t = user; 924 925 /* This signals a whole-map redraw. */ 926 if (data->point.x == -1 && data->point.y == -1) 927 { 928 prt_map(); 929 } 930 /* Single point to be redrawn */ 931 else 932 { 933 grid_data g; 934 byte a, ta; 935 char c, tc; 936 937 int ky, kx; 938 int vy, vx; 939 940 /* Location relative to panel */ 941 ky = data->point.y - t->offset_y; 942 kx = data->point.x - t->offset_x; 943 944 if (t == angband_term[0]) 945 { 946 /* Verify location */ 947 if ((ky < 0) || (ky >= SCREEN_HGT)) return; 948 949 /* Verify location */ 950 if ((kx < 0) || (kx >= SCREEN_WID)) return; 951 952 /* Location in window */ 953 vy = ky + ROW_MAP; 954 vx = kx + COL_MAP; 955 956 if (use_bigtile) vx += kx; 957 } 958 else 959 { 960 if (use_bigtile) 961 { 962 kx += kx; 963 if (kx + 1 >= t->wid) return; 964 } 965 966 /* Verify location */ 967 if ((ky < 0) || (ky >= t->hgt)) return; 968 if ((kx < 0) || (kx >= t->wid)) return; 969 970 /* Location in window */ 971 vy = ky; 972 vx = kx; 973 } 974 975 976 /* Redraw the grid spot */ 977 map_info(data->point.y, data->point.x, &g); 978 grid_data_as_text(&g, &a, &c, &ta, &tc); 979 Term_queue_char(t, vx, vy, TERM_L_GREEN, c, ta, tc); 980 /* Term_queue_char(t, vx, vy, a, c, ta, tc);*/ 981 982 if (use_bigtile) 983 { 984 vx++; 985 986 /* Mega-Hack : Queue dummy char */ 987 if (a & 0x80) 988 Term_queue_char(t, vx, vy, 255, -1, 0, 0); 989 else 990 Term_queue_char(t, vx, vy, TERM_WHITE, ' ', TERM_WHITE, ' '); 991 } 992 } 993 } 906 994 907 995 /* ------------------------------------------------------------------------ … … 1044 1132 } 1045 1133 1046 1047 /* 1048 * The "display_map()" function handles NULL arguments in a special manner. 1049 */ 1134 static struct minimap_flags 1135 { 1136 int win_idx; 1137 bool needs_redraw; 1138 } minimap_data[ANGBAND_TERM_MAX]; 1139 1050 1140 static void update_minimap_subwindow(ui_event_type type, ui_event_data *data, void *user) 1141 { 1142 struct minimap_flags *flags = user; 1143 1144 if (type == ui_MAP_CHANGED) 1145 { 1146 flags->needs_redraw = TRUE; 1147 } 1148 else if (type == ui_event_REDRAW) 1149 { 1150 term *old = Term; 1151 term *t = angband_term[flags->win_idx]; 1152 1153 /* Activate */ 1154 Term_activate(t); 1155 1156 /* Redraw map */ 1157 display_map(NULL, NULL); 1158 Term_fresh(); 1159 1160 /* Restore */ 1161 Term_activate(old); 1162 1163 flags->needs_redraw = FALSE; 1164 } 1165 } 1166 1167 1168 /* 1169 * Hack -- display player in sub-windows (mode 0) 1170 */ 1171 static void update_player0_subwindow(ui_event_type type, ui_event_data *data, void *user) 1051 1172 { 1052 1173 term *old = Term; … … 1056 1177 Term_activate(inv_term); 1057 1178 1058 /* Redraw map */ 1059 display_map(NULL, NULL); 1179 /* Display flags */ 1180 display_player(0); 1181 1060 1182 Term_fresh(); 1061 1183 … … 1064 1186 } 1065 1187 1066 1067 /* 1068 * Hack -- display player in sub-windows (mode 0) 1069 */ 1070 static void update_player0_subwindow(ui_event_type type, ui_event_data *data, void *user) 1188 /* 1189 * Hack -- display player in sub-windows (mode 1) 1190 */ 1191 static void update_player1_subwindow(ui_event_type type, ui_event_data *data, void *user) 1071 1192 { 1072 1193 term *old = Term; … … 1077 1198 1078 1199 /* Display flags */ 1079 display_player( 0);1200 display_player(1); 1080 1201 1081 1202 Term_fresh(); … … 1085 1206 } 1086 1207 1087 /* 1088 * Hack -- display player in sub-windows (mode 1) 1089 */ 1090 static void update_player1_subwindow(ui_event_type type, ui_event_data *data, void *user) 1091 { 1208 1209 /* 1210 /* 1211 * Display the left-hand-side of the main term, in more compact fashion. 1212 */ 1213 static void update_player_compact_subwindow(ui_event_type type, ui_event_data *data, void *user) 1214 { 1215 int row = 0; 1216 int col = 0; 1217 int i; 1218 1092 1219 term *old = Term; 1093 1220 term *inv_term = user; … … 1096 1223 Term_activate(inv_term); 1097 1224 1098 /* Display flags */ 1099 display_player(1); 1225 /* Race and Class */ 1226 prt_field(p_name + rp_ptr->name, row++, col); 1227 prt_field(c_name + cp_ptr->name, row++, col); 1228 1229 /* Title */ 1230 prt_title(row++, col); 1231 1232 /* Level/Experience */ 1233 prt_level(row++, col); 1234 prt_exp(row++, col); 1235 1236 /* Gold */ 1237 prt_gold(row++, col); 1238 1239 /* Equippy chars */ 1240 prt_equippy(row++, col); 1241 1242 /* All Stats */ 1243 for (i = 0; i < A_MAX; i++) prt_stat(i, row++, col); 1244 1245 /* Empty row */ 1246 row++; 1247 1248 /* Armor */ 1249 prt_ac(row++, col); 1250 1251 /* Hitpoints */ 1252 prt_hp(row++, col); 1253 1254 /* Spellpoints */ 1255 prt_sp(row++, col); 1256 1257 /* Monster health */ 1258 prt_health(row++, col); 1100 1259 1101 1260 Term_fresh(); … … 1106 1265 1107 1266 1108 /* 1109 /* 1110 * Display the left-hand-side of the main term, in more compact fashion. 1111 */ 1112 static void update_player_compact_subwindow(ui_event_type type, ui_event_data *data, void *user) 1113 { 1114 int row = 0; 1115 int col = 0; 1116 int i; 1117 1267 static void flush_subwindow(ui_event_type type, ui_event_data *data, void *user) 1268 { 1118 1269 term *old = Term; 1119 term * inv_term= user;1270 term *t = user; 1120 1271 1121 1272 /* Activate */ 1122 Term_activate(inv_term); 1123 1124 /* Race and Class */ 1125 prt_field(p_name + rp_ptr->name, row++, col); 1126 prt_field(c_name + cp_ptr->name, row++, col); 1127 1128 /* Title */ 1129 prt_title(row++, col); 1130 1131 /* Level/Experience */ 1132 prt_level(row++, col); 1133 prt_exp(row++, col); 1134 1135 /* Gold */ 1136 prt_gold(row++, col); 1137 1138 /* Equippy chars */ 1139 prt_equippy(row++, col); 1140 1141 /* All Stats */ 1142 for (i = 0; i < A_MAX; i++) prt_stat(i, row++, col); 1143 1144 /* Empty row */ 1145 row++; 1146 1147 /* Armor */ 1148 prt_ac(row++, col); 1149 1150 /* Hitpoints */ 1151 prt_hp(row++, col); 1152 1153 /* Spellpoints */ 1154 prt_sp(row++, col); 1155 1156 /* Monster health */ 1157 prt_health(row++, col); 1273 Term_activate(t); 1158 1274 1159 1275 Term_fresh(); … … 1162 1278 Term_activate(old); 1163 1279 } 1164 1165 1280 1166 1281 … … 1228 1343 1229 1344 case PW_MAP: 1230 /* Doesn't need to do anything atm. */ 1345 { 1346 register_or_deregister(ui_MAP_CHANGED, 1347 update_maps, 1348 angband_term[win_idx]); 1349 1350 register_or_deregister(ui_event_REDRAW, 1351 flush_subwindow, 1352 angband_term[win_idx]); 1231 1353 break; 1354 } 1232 1355 1233 1356 … … 1242 1365 case PW_OVERHEAD: 1243 1366 { 1367 minimap_data[win_idx].win_idx = win_idx; 1368 1244 1369 register_or_deregister(ui_MAP_CHANGED, 1245 1370 update_minimap_subwindow, 1246 angband_term[win_idx]); 1371 &minimap_data[win_idx]); 1372 1373 register_or_deregister(ui_event_REDRAW, 1374 update_minimap_subwindow, 1375 &minimap_data[win_idx]); 1247 1376 break; 1248 1377 } … … 1331 1460 * Temporary (hopefully) hackish solutions. 1332 1461 * ------------------------------------------------------------------------ */ 1333 static void update_maps(ui_event_type type, ui_event_data *data, void *user)1334 {1335 prt_map();1336 }1337 1338 1462 static void check_panel(ui_event_type type, ui_event_data *data, void *user) 1339 1463 { … … 1360 1484 1361 1485 /* Simplest way to keep the map up to date - will do for now */ 1362 ui_event_register(ui_MAP_CHANGED, update_maps, NULL); 1363 1486 ui_event_register(ui_MAP_CHANGED, update_maps, angband_term[0]); 1487 #if 0 1488 ui_event_register(ui_MAP_CHANGED, trace_map_updates, angband_term[0]); 1489 #endif 1364 1490 /* Check if the panel should shift when the player's moved */ 1365 1491 ui_event_register(ui_PLAYER_MOVED, check_panel, NULL);
