rw-parser-ng 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,6 +71,7 @@ var TxdParser = /** @class */ (function (_super) {
71
71
  var compressed = (compressionFlags & (1 << 3)) !== 0;
72
72
  var paletteType = (rasterFormat >> 13) & 3;
73
73
  var mipWidth = width;
74
+ var pixelFormat = rasterFormat & 0x0F00;
74
75
  var mipHeight = height;
75
76
  var mipmaps = [];
76
77
  var palette = (paletteType !== ImageFormatEnums_1.PaletteType.PALETTE_NONE ? this.readPalette(paletteType, depth) : new Uint8Array(0));
@@ -87,7 +88,7 @@ var TxdParser = /** @class */ (function (_super) {
87
88
  ImageFormatEnums_1.RasterFormat.RASTER_888,
88
89
  ImageFormatEnums_1.RasterFormat.RASTER_555
89
90
  ];
90
- var hasAlpha = ((platformId === ImageFormatEnums_1.PlatformType.D3D9 && alpha) || (platformId == ImageFormatEnums_1.PlatformType.D3D8 && !rasterFormatsWithoutAlpha.includes(rasterFormat)));
91
+ var hasAlpha = ((platformId === ImageFormatEnums_1.PlatformType.D3D9 && alpha) || (platformId == ImageFormatEnums_1.PlatformType.D3D8 && !rasterFormatsWithoutAlpha.includes(pixelFormat)));
91
92
  bitmap = Array.from(this.getBitmapWithPalette(paletteType, depth, hasAlpha, raster, palette, width, height));
92
93
  }
93
94
  else if (platformId === ImageFormatEnums_1.PlatformType.D3D8 && compressionFlags !== 0) {
@@ -97,7 +98,7 @@ var TxdParser = /** @class */ (function (_super) {
97
98
  bitmap = Array.from(this.getBitmapWithDXT(d3dFormat, raster, width, height));
98
99
  }
99
100
  else {
100
- bitmap = Array.from(this.getBitmapWithRasterFormat(rasterFormat, raster, width, height));
101
+ bitmap = Array.from(this.getBitmapWithRasterFormat(pixelFormat, raster, width, height));
101
102
  }
102
103
  mipmaps.push(bitmap);
103
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rw-parser-ng",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Parses RenderWare DFF, TXD and IFP files into usable format!",
5
5
  "author": {
6
6
  "name": "DepsCian",
@@ -106,6 +106,7 @@ export class TxdParser extends RwFile {
106
106
  const paletteType = (rasterFormat >> 13) & 0b11;
107
107
 
108
108
  let mipWidth = width;
109
+ const pixelFormat = rasterFormat & 0x0F00;
109
110
  let mipHeight = height;
110
111
 
111
112
  let mipmaps: number[][] = [];
@@ -129,7 +130,7 @@ export class TxdParser extends RwFile {
129
130
  RasterFormat.RASTER_555
130
131
  ];
131
132
 
132
- const hasAlpha = ((platformId === PlatformType.D3D9 && alpha) || (platformId == PlatformType.D3D8 && !rasterFormatsWithoutAlpha.includes(rasterFormat)));
133
+ const hasAlpha = ((platformId === PlatformType.D3D9 && alpha) || (platformId == PlatformType.D3D8 && !rasterFormatsWithoutAlpha.includes(pixelFormat)));
133
134
 
134
135
  bitmap = Array.from(this.getBitmapWithPalette(paletteType, depth, hasAlpha, raster, palette, width, height));
135
136
  }
@@ -140,7 +141,7 @@ export class TxdParser extends RwFile {
140
141
  bitmap = Array.from(this.getBitmapWithDXT(d3dFormat, raster, width, height));
141
142
  }
142
143
  else {
143
- bitmap = Array.from(this.getBitmapWithRasterFormat(rasterFormat, raster, width, height))
144
+ bitmap = Array.from(this.getBitmapWithRasterFormat(pixelFormat, raster, width, height))
144
145
  }
145
146
 
146
147
  mipmaps.push(bitmap);