… | |
… | |
459 | char tmpbuf[20]; |
459 | char tmpbuf[20]; |
460 | int q = atoi (param); |
460 | int q = atoi (param); |
461 | |
461 | |
462 | if (is_valid_faceset (q)) |
462 | if (is_valid_faceset (q)) |
463 | ns->faceset = q; |
463 | ns->faceset = q; |
|
|
464 | |
464 | sprintf (tmpbuf, "%d", ns->faceset); |
465 | sprintf (tmpbuf, "%d", ns->faceset); |
465 | safe_strcat (cmdback, tmpbuf, &slen, HUGE_BUF); |
466 | safe_strcat (cmdback, tmpbuf, &slen, HUGE_BUF); |
466 | /* if the client is using faceset, it knows about image2 command */ |
467 | /* if the client is using faceset, it knows about image2 command */ |
467 | ns->image2 = 1; |
468 | ns->image2 = 1; |
468 | } |
469 | } |
… | |
… | |
561 | * This is what takes care of it. We tell the client how things worked out. |
562 | * This is what takes care of it. We tell the client how things worked out. |
562 | * I am not sure if this file is the best place for this function. however, |
563 | * I am not sure if this file is the best place for this function. however, |
563 | * it either has to be here or init_sockets needs to be exported. |
564 | * it either has to be here or init_sockets needs to be exported. |
564 | */ |
565 | */ |
565 | void |
566 | void |
566 | AddMeCmd (char *buf, int len, client * ns) |
567 | AddMeCmd (char *buf, int len, client *ns) |
567 | { |
568 | { |
|
|
569 | // face caching is mandatory |
|
|
570 | if (!ns->facecache) |
|
|
571 | { |
|
|
572 | ns->send_drawinfo ( |
|
|
573 | "\n" |
|
|
574 | "\n" |
|
|
575 | "***\n" |
|
|
576 | "*** WARNING:\n" |
|
|
577 | "*** Your client does not support face/image caching,\n" |
|
|
578 | "*** or it has been disabled. Face caching is mandatory\n" |
|
|
579 | "*** so please enable it or use a newer client.\n" |
|
|
580 | "***\n" |
|
|
581 | "*** I will proceed as if face caching were enabled.\n" |
|
|
582 | "\n" |
|
|
583 | "***\n", |
|
|
584 | NDI_RED |
|
|
585 | ); |
|
|
586 | //ns->facecache = true; |
|
|
587 | } |
|
|
588 | |
568 | INVOKE_CLIENT (ADDME, ns, ARG_DATA (buf, len)); |
589 | INVOKE_CLIENT (ADDME, ns, ARG_DATA (buf, len)); |
569 | } |
590 | } |
570 | |
591 | |
571 | /** Reply to ExtendedInfos command */ |
592 | /** Reply to ExtendedInfos command */ |
572 | void |
593 | void |
… | |
… | |
680 | snprintf (temp, sizeof (temp), "%d", i); |
701 | snprintf (temp, sizeof (temp), "%d", i); |
681 | strcat (cmdback, temp); |
702 | strcat (cmdback, temp); |
682 | } |
703 | } |
683 | |
704 | |
684 | ns->send_packet (cmdback); |
705 | ns->send_packet (cmdback); |
|
|
706 | } |
|
|
707 | |
|
|
708 | /** |
|
|
709 | * client requested an image. send it rate-limited |
|
|
710 | * before flushing. |
|
|
711 | */ |
|
|
712 | void |
|
|
713 | AskFaceCmd (char *buf, int len, client *ns) |
|
|
714 | { |
|
|
715 | ns->askface.push_back (atoi (buf)); |
685 | } |
716 | } |
686 | |
717 | |
687 | /** |
718 | /** |
688 | * Tells client the picture it has to use |
719 | * Tells client the picture it has to use |
689 | * to smooth a picture number given as argument. |
720 | * to smooth a picture number given as argument. |
… | |
… | |
1250 | << uint8 (extendedinfos) |
1281 | << uint8 (extendedinfos) |
1251 | << uint8 (eentrysize); |
1282 | << uint8 (eentrysize); |
1252 | |
1283 | |
1253 | estartlen = esl.length (); |
1284 | estartlen = esl.length (); |
1254 | } |
1285 | } |
1255 | else |
|
|
1256 | { |
|
|
1257 | /* suppress compiler warnings */ |
|
|
1258 | ewhatstart = 0; |
|
|
1259 | ewhatflag = 0; |
|
|
1260 | estartlen = 0; |
|
|
1261 | } |
|
|
1262 | |
1286 | |
1263 | /* x,y are the real map locations. ax, ay are viewport relative |
1287 | /* x,y are the real map locations. ax, ay are viewport relative |
1264 | * locations. |
1288 | * locations. |
1265 | */ |
1289 | */ |
1266 | ay = 0; |
1290 | ay = 0; |
… | |
… | |
1269 | * but that started to get a bit messy to look at. |
1293 | * but that started to get a bit messy to look at. |
1270 | */ |
1294 | */ |
1271 | max_x = pl->x + (socket.mapx + 1) / 2; |
1295 | max_x = pl->x + (socket.mapx + 1) / 2; |
1272 | max_y = pl->y + (socket.mapy + 1) / 2; |
1296 | max_y = pl->y + (socket.mapy + 1) / 2; |
1273 | |
1297 | |
|
|
1298 | maptile *plmap = pl->map; |
|
|
1299 | |
1274 | for (y = pl->y - socket.mapy / 2; y < max_y; y++, ay++) |
1300 | for (y = pl->y - socket.mapy / 2; y < max_y; y++, ay++) |
1275 | { |
1301 | { |
1276 | ax = 0; |
1302 | ax = 0; |
1277 | for (x = pl->x - socket.mapx / 2; x < max_x; x++, ax++) |
1303 | for (x = pl->x - socket.mapx / 2; x < max_x; x++, ax++) |
1278 | { |
1304 | { |
… | |
… | |
1284 | /* If the coordinates are not valid, or it is too dark to see, |
1310 | /* If the coordinates are not valid, or it is too dark to see, |
1285 | * we tell the client as such |
1311 | * we tell the client as such |
1286 | */ |
1312 | */ |
1287 | nx = x; |
1313 | nx = x; |
1288 | ny = y; |
1314 | ny = y; |
1289 | m = get_map_from_coord (pl->map, &nx, &ny); |
1315 | m = get_map_from_coord (plmap, &nx, &ny); |
1290 | |
1316 | |
1291 | if (!m) |
1317 | if (!m) |
1292 | { |
1318 | { |
1293 | /* space is out of map. Update space and clear values |
1319 | /* space is out of map. Update space and clear values |
1294 | * if this hasn't already been done. If the space is out |
1320 | * if this hasn't already been done. If the space is out |