… | |
… | |
886 | |
886 | |
887 | /** |
887 | /** |
888 | * Tells the client that here is a player it should start using. |
888 | * Tells the client that here is a player it should start using. |
889 | */ |
889 | */ |
890 | void |
890 | void |
891 | esrv_new_player (player *pl, uint32 weight) |
891 | esrv_new_player (player *pl) |
892 | { |
892 | { |
|
|
893 | sint32 weight = pl->ob->client_weight (); |
|
|
894 | |
893 | packet sl ("player"); |
895 | packet sl ("player"); |
894 | |
896 | |
895 | sl << uint32 (pl->ob->count) |
897 | sl << uint32 (pl->ob->count) |
896 | << uint32 (weight) |
898 | << uint32 (weight) |
897 | << uint32 (pl->ob->face) |
899 | << uint32 (pl->ob->face) |
… | |
… | |
1242 | uint8 flags = 0; |
1244 | uint8 flags = 0; |
1243 | tag_t player = 0; |
1245 | tag_t player = 0; |
1244 | |
1246 | |
1245 | // send hp information, if applicable |
1247 | // send hp information, if applicable |
1246 | if (object *op = ms.faces_obj [0]) |
1248 | if (object *op = ms.faces_obj [0]) |
|
|
1249 | if (op->is_head () && !op->invisible) |
1247 | { |
1250 | { |
1248 | if (op->head || op->invisible) |
1251 | if (op->stats.maxhp > op->stats.hp |
1249 | ; // do not show |
1252 | && op->stats.maxhp > 0 |
1250 | else if (op->type == PLAYER |
1253 | && (op->type == PLAYER |
|
|
1254 | || op->type == DOOR // does not work, have maxhp 0 |
1251 | || QUERY_FLAG (op, FLAG_MONSTER) || QUERY_FLAG (op, FLAG_ALIVE) || QUERY_FLAG (op, FLAG_GENERATOR)) |
1255 | || QUERY_FLAG (op, FLAG_MONSTER) || QUERY_FLAG (op, FLAG_ALIVE) || QUERY_FLAG (op, FLAG_GENERATOR))) |
1252 | { |
|
|
1253 | if (op->stats.maxhp > 0 && (unsigned) op->stats.maxhp > (unsigned) op->stats.hp) |
|
|
1254 | { |
1256 | { |
1255 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1257 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
1256 | stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge |
1258 | stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge |
1257 | } |
1259 | } |
1258 | } |
|
|
1259 | |
1260 | |
1260 | if (op->msg && op->msg[0] == '@') |
1261 | if (op->msg && op->msg[0] == '@') |
1261 | flags |= 1; |
1262 | flags |= 1; |
1262 | |
1263 | |
1263 | if (op->type == PLAYER && op != ob) |
1264 | if (op->type == PLAYER && op != ob) |
1264 | player = op->count; |
1265 | player = op->count; |
1265 | } |
1266 | } |
1266 | |
1267 | |
1267 | if (lastcell.stat_hp != stat_hp) |
1268 | if (lastcell.stat_hp != stat_hp) |
1268 | { |
1269 | { |
1269 | lastcell.stat_hp = stat_hp; |
1270 | lastcell.stat_hp = stat_hp; |
1270 | |
1271 | |