src/newgrf.cpp
changeset 5668 36b39f4a9032
parent 5617 07de31c05f46
child 5763 a6029daa547f
equal deleted inserted replaced
5667:47454cf088f9 5668:36b39f4a9032
   883 				for (t = 0; t < statspec->tiles; t++) {
   883 				for (t = 0; t < statspec->tiles; t++) {
   884 					DrawTileSprites *dts = &statspec->renderdata[t];
   884 					DrawTileSprites *dts = &statspec->renderdata[t];
   885 					uint seq_count = 0;
   885 					uint seq_count = 0;
   886 
   886 
   887 					dts->seq = NULL;
   887 					dts->seq = NULL;
   888 					dts->ground_sprite = grf_load_dword(&buf);
   888 					dts->ground_sprite = grf_load_word(&buf);
       
   889 					dts->ground_pal = grf_load_word(&buf);
   889 					if (dts->ground_sprite == 0) continue;
   890 					if (dts->ground_sprite == 0) continue;
       
   891 					if (HASBIT(dts->ground_pal, 15)) {
       
   892 						CLRBIT(dts->ground_pal, 15);
       
   893 						SETBIT(dts->ground_sprite, SPRITE_MODIFIER_USE_OFFSET);
       
   894 					}
   890 
   895 
   891 					while (buf < *bufp + len) {
   896 					while (buf < *bufp + len) {
   892 						DrawTileSeqStruct *dtss;
   897 						DrawTileSeqStruct *dtss;
   893 
   898 
   894 						// no relative bounding box support
   899 						// no relative bounding box support
   900 						dtss->delta_y = grf_load_byte(&buf);
   905 						dtss->delta_y = grf_load_byte(&buf);
   901 						dtss->delta_z = grf_load_byte(&buf);
   906 						dtss->delta_z = grf_load_byte(&buf);
   902 						dtss->size_x = grf_load_byte(&buf);
   907 						dtss->size_x = grf_load_byte(&buf);
   903 						dtss->size_y = grf_load_byte(&buf);
   908 						dtss->size_y = grf_load_byte(&buf);
   904 						dtss->size_z = grf_load_byte(&buf);
   909 						dtss->size_z = grf_load_byte(&buf);
   905 						dtss->image = grf_load_dword(&buf);
   910 						dtss->image = grf_load_word(&buf);
       
   911 						dtss->pal = grf_load_word(&buf);
   906 
   912 
   907 						/* Remap flags as ours collide */
   913 						/* Remap flags as ours collide */
   908 						if (HASBIT(dtss->image, 31)) {
   914 						if (HASBIT(dtss->pal, 15)) {
   909 							CLRBIT(dtss->image, 31);
   915 							CLRBIT(dtss->pal, 15);
   910 							SETBIT(dtss->image, 30);
   916 							SETBIT(dtss->image, SPRITE_MODIFIER_USE_OFFSET);
       
   917 						}
       
   918 
       
   919 						if (HASBIT(dtss->image, 15)) {
       
   920 							CLRBIT(dtss->image, 15);
       
   921 							SETBIT(dtss->image, PALETTE_MODIFIER_COLOR);
   911 						}
   922 						}
   912 						if (HASBIT(dtss->image, 14)) {
   923 						if (HASBIT(dtss->image, 14)) {
   913 							CLRBIT(dtss->image, 14);
   924 							CLRBIT(dtss->image, 14);
   914 							SETBIT(dtss->image, 31);
   925 							SETBIT(dtss->image, PALETTE_MODIFIER_TRANSPARENT);
   915 						}
   926 						}
   916 					}
   927 					}
   917 				}
   928 				}
   918 			}
   929 			}
   919 			break;
   930 			break;
  1090 
  1101 
  1091 					if (bridge->sprite_table[tableid] == NULL) {
  1102 					if (bridge->sprite_table[tableid] == NULL) {
  1092 						bridge->sprite_table[tableid] = MallocT<PalSpriteID>(32);
  1103 						bridge->sprite_table[tableid] = MallocT<PalSpriteID>(32);
  1093 					}
  1104 					}
  1094 
  1105 
  1095 					for (sprite = 0; sprite < 32; sprite++)
  1106 					for (sprite = 0; sprite < 32; sprite++) {
  1096 						bridge->sprite_table[tableid][sprite] = grf_load_dword(&buf);
  1107 						SpriteID image = grf_load_word(&buf);
       
  1108 						SpriteID pal   = grf_load_word(&buf);
       
  1109 
       
  1110 						if (HASBIT(pal, 15)) {
       
  1111 							SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
       
  1112 						}
       
  1113 
       
  1114 						/* Clear old color modifer bit */
       
  1115 						CLRBIT(image, 15);
       
  1116 
       
  1117 						bridge->sprite_table[tableid][sprite].sprite = image;
       
  1118 						bridge->sprite_table[tableid][sprite].pal    = pal;
       
  1119 					}
  1097 				}
  1120 				}
  1098 			}
  1121 			}
  1099 			break;
  1122 			break;
  1100 
  1123 
  1101 		case 0x0E: /* Flags; bit 0 - disable far pillars */
  1124 		case 0x0E: /* Flags; bit 0 - disable far pillars */
  3775 	CalculateRefitMasks();
  3798 	CalculateRefitMasks();
  3776 }
  3799 }
  3777 
  3800 
  3778 
  3801 
  3779 
  3802 
       
  3803