… | |
… | |
471 | |
471 | |
472 | ns->send_packet (cmdback); |
472 | ns->send_packet (cmdback); |
473 | } |
473 | } |
474 | |
474 | |
475 | /** |
475 | /** |
476 | * client requested an image. send it rate-limited |
|
|
477 | * before flushing. |
|
|
478 | */ |
|
|
479 | void |
|
|
480 | AskFaceCmd (char *buf, int len, client *ns) |
|
|
481 | { |
|
|
482 | ns->askface.push_back (atoi (buf)); |
|
|
483 | } |
|
|
484 | |
|
|
485 | /** |
|
|
486 | * Tells client the picture it has to use |
|
|
487 | * to smooth a picture number given as argument. |
|
|
488 | */ |
|
|
489 | void |
|
|
490 | AskSmooth (char *buf, int len, client *ns) |
|
|
491 | { |
|
|
492 | ns->send_face (atoi (buf)); |
|
|
493 | ns->flush_fx (); |
|
|
494 | } |
|
|
495 | |
|
|
496 | /** |
|
|
497 | * This handles the general commands from the client (ie, north, fire, cast, |
476 | * This handles the general commands from the client (ie, north, fire, cast, |
498 | * etc.) |
477 | * etc.) |
499 | */ |
478 | */ |
500 | void |
479 | void |
501 | PlayerCmd (char *buf, int len, player *pl) |
480 | PlayerCmd (char *buf, int len, player *pl) |
… | |
… | |
747 | |
726 | |
748 | //TODO: maybe golem should become the current_weapon, quite simply? |
727 | //TODO: maybe golem should become the current_weapon, quite simply? |
749 | if (pl->golem) |
728 | if (pl->golem) |
750 | buf << " Golem*: " << pl->golem->name; |
729 | buf << " Golem*: " << pl->golem->name; |
751 | |
730 | |
|
|
731 | buf << '\0'; |
752 | buf.linearise (obuf); |
732 | buf.linearise (obuf); |
753 | obuf [buf.size ()] = 0; |
|
|
754 | } |
733 | } |
755 | |
734 | |
756 | #define AddIfInt64(Old,New,Type) if (Old != New) {\ |
735 | #define AddIfInt64(Old,New,Type) if (Old != New) {\ |
757 | Old = New; \ |
736 | Old = New; \ |
758 | sl << uint8 (Type) << uint64 (New); \ |
737 | sl << uint8 (Type) << uint64 (New); \ |
… | |
… | |
1030 | */ |
1009 | */ |
1031 | if (!plmap || plmap->in_memory != MAP_IN_MEMORY) |
1010 | if (!plmap || plmap->in_memory != MAP_IN_MEMORY) |
1032 | return; |
1011 | return; |
1033 | |
1012 | |
1034 | int x, y, ax, ay, startlen, max_x, max_y, oldlen; |
1013 | int x, y, ax, ay, startlen, max_x, max_y, oldlen; |
1035 | sint16 nx, ny; |
|
|
1036 | int estartlen, eoldlen; |
1014 | int estartlen, eoldlen; |
1037 | uint8 eentrysize; |
1015 | uint8 eentrysize; |
1038 | uint16 ewhatstart, ewhatflag; |
1016 | uint16 ewhatstart, ewhatflag; |
1039 | uint8 extendedinfos; |
1017 | uint8 extendedinfos; |
1040 | maptile *m; |
|
|
1041 | |
1018 | |
1042 | check_map_change (pl); |
1019 | check_map_change (pl); |
1043 | prefetch_surrounding_maps (pl->ob); |
1020 | prefetch_surrounding_maps (pl->ob); |
1044 | |
1021 | |
1045 | /* do LOS after calls to update_position */ |
1022 | /* do LOS after calls to update_position */ |
… | |
… | |
1111 | max_x = ob->x + (socket.mapx + 1) / 2; |
1088 | max_x = ob->x + (socket.mapx + 1) / 2; |
1112 | max_y = ob->y + (socket.mapy + 1) / 2; |
1089 | max_y = ob->y + (socket.mapy + 1) / 2; |
1113 | |
1090 | |
1114 | for (y = ob->y - socket.mapy / 2; y < max_y; y++, ay++) |
1091 | for (y = ob->y - socket.mapy / 2; y < max_y; y++, ay++) |
1115 | { |
1092 | { |
|
|
1093 | sint16 nx, ny; |
|
|
1094 | maptile *m = 0; |
|
|
1095 | |
1116 | ax = 0; |
1096 | ax = 0; |
1117 | for (x = ob->x - socket.mapx / 2; x < max_x; x++, ax++) |
1097 | for (x = ob->x - socket.mapx / 2; x < max_x; x++, ax++) |
1118 | { |
1098 | { |
|
|
1099 | // check to see if we can simply go one right quickly |
|
|
1100 | ++nx; |
|
|
1101 | if (m && nx >= m->width) |
|
|
1102 | m = 0; |
|
|
1103 | |
|
|
1104 | if (!m) |
|
|
1105 | { |
|
|
1106 | nx = x; ny = y; m = plmap; |
|
|
1107 | |
|
|
1108 | if (!xy_normalise (m, nx, ny)) |
|
|
1109 | m = 0; |
|
|
1110 | } |
|
|
1111 | |
1119 | int emask, mask; |
1112 | int emask, mask; |
1120 | emask = mask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; |
1113 | emask = mask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; |
1121 | |
1114 | |
1122 | MapCell &lastcell = socket.lastmap.cells[ax][ay]; |
1115 | MapCell &lastcell = socket.lastmap.cells[ax][ay]; |
1123 | |
1116 | |
1124 | /* If the coordinates are not valid, or it is too dark to see, |
1117 | /* If the coordinates are not valid, or it is too dark to see, |
1125 | * we tell the client as such |
1118 | * we tell the client as such |
1126 | */ |
1119 | */ |
1127 | nx = x; |
|
|
1128 | ny = y; |
|
|
1129 | m = get_map_from_coord (plmap, &nx, &ny); |
|
|
1130 | |
|
|
1131 | if (!m) |
1120 | if (!m) |
1132 | { |
1121 | { |
1133 | /* space is out of map. Update space and clear values |
1122 | /* space is out of map. Update space and clear values |
1134 | * if this hasn't already been done. If the space is out |
1123 | * if this hasn't already been done. If the space is out |
1135 | * of the map, it shouldn't have a head |
1124 | * of the map, it shouldn't have a head |
… | |
… | |
1216 | } |
1205 | } |
1217 | |
1206 | |
1218 | lastcell.count = d; |
1207 | lastcell.count = d; |
1219 | |
1208 | |
1220 | mapspace &ms = m->at (nx, ny); |
1209 | mapspace &ms = m->at (nx, ny); |
|
|
1210 | ms.update (); |
1221 | |
1211 | |
1222 | if (socket.extmap) |
1212 | if (socket.extmap) |
1223 | { |
1213 | { |
1224 | uint8 stat_hp = 0; |
1214 | uint8 stat_hp = 0; |
1225 | uint8 stat_width = 0; |
1215 | uint8 stat_width = 0; |