… | |
… | |
522 | * commands. |
522 | * commands. |
523 | */ |
523 | */ |
524 | pl->count = 0; |
524 | pl->count = 0; |
525 | } |
525 | } |
526 | |
526 | |
527 | |
|
|
528 | /** |
527 | /** |
529 | * This handles the general commands from the client (ie, north, fire, cast, |
528 | * This handles the general commands from the client (ie, north, fire, cast, |
530 | * etc.). It is a lot like PlayerCmd above, but is called with the |
529 | * etc.). It is a lot like PlayerCmd above, but is called with the |
531 | * 'ncom' method which gives more information back to the client so it |
530 | * 'ncom' method which gives more information back to the client so it |
532 | * can throttle. |
531 | * can throttle. |
… | |
… | |
732 | static void |
731 | static void |
733 | rangetostring (player *pl, char *obuf) |
732 | rangetostring (player *pl, char *obuf) |
734 | { |
733 | { |
735 | dynbuf_text buf; |
734 | dynbuf_text buf; |
736 | |
735 | |
|
|
736 | if (pl->observe->contr) |
|
|
737 | pl = pl->observe->contr; |
|
|
738 | |
737 | if (pl->ranged_ob) |
739 | if (pl->ranged_ob) |
738 | buf << " Range" << (pl->ob->current_weapon == pl->ranged_ob ? "*" : "") << ": " << pl->ranged_ob->name; |
740 | buf << " Range" << (pl->ob->current_weapon == pl->ranged_ob ? "*" : "") << ": " << pl->ranged_ob->name; |
739 | |
741 | |
740 | if (pl->combat_ob) |
742 | if (pl->combat_ob) |
741 | buf << " Combat" << (pl->ob->current_weapon == pl->combat_ob ? "*" : "") << ": " << pl->combat_ob->name; |
743 | buf << " Combat" << (pl->ob->current_weapon == pl->combat_ob ? "*" : "") << ": " << pl->combat_ob->name; |
742 | |
744 | |
|
|
745 | #if 0 |
743 | //TODO: remove this when slot system is working, this is only for debugging |
746 | //TODO: remove this when slot system is working, this is only for debugging |
744 | if (pl->ob->chosen_skill) |
747 | if (pl->ob->chosen_skill) |
745 | buf << " Skill*: " << pl->ob->chosen_skill->name; |
748 | buf << " Skill*: " << pl->ob->chosen_skill->name; |
|
|
749 | #endif |
746 | |
750 | |
747 | //TODO: maybe golem should become the current_weapon, quite simply? |
751 | //TODO: maybe golem should become the current_weapon, quite simply? |
748 | if (pl->golem) |
752 | if (pl->golem) |
749 | buf << " Golem*: " << pl->golem->name; |
753 | buf << " Golem*: " << pl->golem->name; |
750 | |
754 | |
… | |
… | |
1038 | |
1042 | |
1039 | check_map_change (pl); |
1043 | check_map_change (pl); |
1040 | prefetch_surrounding_maps (pl->ob); |
1044 | prefetch_surrounding_maps (pl->ob); |
1041 | |
1045 | |
1042 | /* do LOS after calls to update_position */ |
1046 | /* do LOS after calls to update_position */ |
|
|
1047 | if (ob != pl->ob) |
|
|
1048 | clear_los (pl); |
1043 | if (pl->do_los) |
1049 | else if (pl->do_los) |
1044 | { |
1050 | { |
1045 | update_los (ob); |
1051 | update_los (ob); |
1046 | pl->do_los = 0; |
1052 | pl->do_los = 0; |
1047 | } |
1053 | } |
1048 | |
1054 | |
… | |
… | |
1138 | continue; |
1144 | continue; |
1139 | } |
1145 | } |
1140 | |
1146 | |
1141 | m->touch (); |
1147 | m->touch (); |
1142 | |
1148 | |
1143 | int d = ob->contr->blocked_los[ax][ay]; |
1149 | int d = pl->blocked_los[ax][ay]; |
1144 | |
1150 | |
1145 | if (d > 3) |
1151 | if (d > 3) |
1146 | { |
1152 | { |
1147 | |
1153 | |
1148 | int need_send = 0, count; |
1154 | int need_send = 0, count; |
… | |
… | |
1230 | || QUERY_FLAG (op, FLAG_MONSTER) || QUERY_FLAG (op, FLAG_ALIVE) || QUERY_FLAG (op, FLAG_GENERATOR)) |
1236 | || QUERY_FLAG (op, FLAG_MONSTER) || QUERY_FLAG (op, FLAG_ALIVE) || QUERY_FLAG (op, FLAG_GENERATOR)) |
1231 | { |
1237 | { |
1232 | if (op->stats.maxhp > 0 && (unsigned) op->stats.maxhp > (unsigned) op->stats.hp) |
1238 | if (op->stats.maxhp > 0 && (unsigned) op->stats.maxhp > (unsigned) op->stats.hp) |
1233 | { |
1239 | { |
1234 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1240 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1235 | stat_width = op->arch->tail_x; |
1241 | stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge |
1236 | } |
1242 | } |
1237 | } |
1243 | } |
1238 | |
1244 | |
1239 | if (op->msg && op->msg[0] == '@') |
1245 | if (op->msg && op->msg[0] == '@') |
1240 | flags |= 1; |
1246 | flags |= 1; |
… | |
… | |
1308 | } |
1314 | } |
1309 | } |
1315 | } |
1310 | /* Top face */ |
1316 | /* Top face */ |
1311 | else if (update_space (sl, socket, ms, lastcell, 0)) |
1317 | else if (update_space (sl, socket, ms, lastcell, 0)) |
1312 | mask |= 0x1; |
1318 | mask |= 0x1; |
1313 | |
|
|
1314 | |
1319 | |
1315 | /* Check to see if we are in fact sending anything for this |
1320 | /* Check to see if we are in fact sending anything for this |
1316 | * space by checking the mask. If so, update the mask. |
1321 | * space by checking the mask. If so, update the mask. |
1317 | * if not, reset the len to that from before adding the mask |
1322 | * if not, reset the len to that from before adding the mask |
1318 | * value, so we don't send those bits. |
1323 | * value, so we don't send those bits. |