@@ -455,18 +455,24 @@ void GetVisSetAtPosition(VECTOR *pos, char *tgt, int *ccx, int *ccz)
455455{
456456 int cx , cz ;
457457 int rx , rz ;
458+ int barrel_region_x , barrel_region_z ;
458459
459460 cx = (pos -> vx + units_across_halved ) / MAP_CELL_SIZE ;
460461 cz = (pos -> vz + units_down_halved ) / MAP_CELL_SIZE ;
461462
463+ if (* ccx == cx && * ccz == cz )
464+ {
465+ return ;
466+ }
467+
462468 * ccx = cx ;
463469 * ccz = cz ;
464470
465471 rx = cx / MAP_REGION_SIZE ;
466472 rz = cz / MAP_REGION_SIZE ;
467473
468- int barrel_region_x = (rx & 1 );
469- int barrel_region_z = (rz & 1 );
474+ barrel_region_x = (rx & 1 );
475+ barrel_region_z = (rz & 1 );
470476
471477 GetPVSRegionCell2 (
472478 barrel_region_x + barrel_region_z * 2 ,
@@ -509,9 +515,7 @@ void PVSDecode(char *output, char *celldata, ushort sz, int havanaCorruptCellBod
509515 int ni ;
510516 int sym ;
511517
512- ni = nybblearray [i ];
513- i ++ ;
514-
518+ ni = nybblearray [i ++ ];
515519 if (ni < 12 )
516520 {
517521 symIndex = ni * 2 ;
@@ -520,67 +524,48 @@ void PVSDecode(char *output, char *celldata, ushort sz, int havanaCorruptCellBod
520524 }
521525 else
522526 {
523- if (i == sz * 2 )
527+ if (i == sz * 2 )
524528 break ;
525529
526- sym = (ni & 3 ) * 16 + nybblearray [i ];
527- i ++ ;
528-
530+ sym = (ni & 3 ) * 16 + nybblearray [i ++ ];
529531 if (sym < 60 )
530532 {
531533 symIndex = sym * 2 + 24 ;
532534 goto spod ;
533535 }
534536
535- sym = ((sym & 3 ) * 16 + nybblearray [i ]) * 16 + nybblearray [i + 1 ];
536- i += 2 ;
537+ sym = ((sym & 3 ) * 16 + nybblearray [i ++ ]) * 16 + nybblearray [i ++ + 1 ];
537538 }
538539
539540 pixelIndex += (sym >> 1 );
540- decodebuf [pixelIndex ] = 1 ;
541- pixelIndex ++ ;
542-
541+ decodebuf [pixelIndex ++ ] = 1 ;
543542 if ((sym & 1 ) != 0 )
544543 {
545- decodebuf [pixelIndex ] = 1 ;
546- pixelIndex ++ ;
544+ decodebuf [pixelIndex ++ ] = 1 ;
547545 }
548546 }
549547
550548 if (havanaCorruptCellBodge == 0 )
551549 decodebuf [pvs_square_sq - 1 ] ^= 1 ;
552550
553551 size = pvs_square - 2 ;
554-
555552 op = (decodebuf - 1 ) + (size * pvs_square + pvs_square );
556- i = size ;
557- while (i >= 0 )
553+ for (i = size ; i >= 0 ; -- i )
558554 {
559- i -- ;
560- j = pvs_square ;
561- while (j > 0 )
555+ for (j = pvs_square ; j > 0 ; -- j , -- op )
562556 {
563557 * op = * op ^ op [pvs_square ];
564- j -- ;
565- op -- ;
566558 }
567559 }
568560
569561 size = pvs_square - 1 ;
570562 op = (decodebuf - 2 ) + (size * pvs_square + pvs_square );
571-
572- i = size ;
573- while (i >= 0 )
563+ for (i = size ; i >= 0 ; -- i , -- op )
574564 {
575- j = pvs_square - 2 ;
576- while (j >= 0 )
565+ for (j = pvs_square - 2 ; j >= 0 ; -- j , -- op )
577566 {
578567 * op = * op ^ op [1 ];
579- j -- ;
580- op -- ;
581568 }
582- i -- ;
583- op -- ;
584569 }
585570
586571#if 0
0 commit comments