@@ -603,14 +603,14 @@ TextureClass *Load_Texture(ChunkLoadClass &cload)
603603
604604 while (cload.Open_Chunk ()) {
605605 int id = cload.Cur_Chunk_ID ();
606- if (id == W3D_CHUNK_TEXTURE_NAME ) {
607- cload. Read (name, cload. Cur_Chunk_Length ());
608- } else if (id == W3D_CHUNK_TEXTURE_INFO) {
609- if (id == 1 ) {
610- cload. Read (&info, 12 );
611- }
612-
613- texinfo = true ;
606+ switch (id) {
607+ case W3D_CHUNK_TEXTURE_NAME:
608+ cload. Read (name, cload. Cur_Chunk_Length ());
609+ break ;
610+ case W3D_CHUNK_TEXTURE_INFO:
611+ cload. Read (&info, sizeof (info));
612+ texinfo = true ;
613+ break ;
614614 }
615615
616616 cload.Close_Chunk ();
@@ -638,6 +638,7 @@ TextureClass *Load_Texture(ChunkLoadClass &cload)
638638 case W3DTEXTURE_MIP_LEVELS_4:
639639 mips = MipCountType::MIP_LEVELS_4;
640640 break ;
641+ case W3DTEXTURE_MIP_LEVELS_ALL:
641642 default :
642643 mips = MipCountType::MIP_LEVELS_ALL;
643644 break ;
@@ -646,20 +647,27 @@ TextureClass *Load_Texture(ChunkLoadClass &cload)
646647
647648 WW3DFormat format = WW3D_FORMAT_UNKNOWN;
648649
649- if ((info.Attributes & W3DTEXTURE_TYPE_MASK) == W3DTEXTURE_TYPE_BUMPMAP) {
650- if (DX8Wrapper::Is_Initted ()) {
651- if (DX8Wrapper::Get_Current_Caps ()->Support_Bump_Envmap ()) {
652- mips = MipCountType::MIP_LEVELS_1;
653-
654- if (DX8Wrapper::Get_Current_Caps ()->Supports_Texture_Format (WW3D_FORMAT_U8V8)) {
655- format = WW3D_FORMAT_U8V8;
656- } else if (DX8Wrapper::Get_Current_Caps ()->Supports_Texture_Format (WW3D_FORMAT_X8L8V8U8)) {
657- format = WW3D_FORMAT_X8L8V8U8;
658- } else if (DX8Wrapper::Get_Current_Caps ()->Supports_Texture_Format (WW3D_FORMAT_L6V5U5)) {
659- format = WW3D_FORMAT_L6V5U5;
650+ switch (info.Attributes & W3DTEXTURE_TYPE_MASK) {
651+ case W3DTEXTURE_TYPE_COLORMAP:
652+ break ;
653+ case W3DTEXTURE_TYPE_BUMPMAP:
654+ if (DX8Wrapper::Is_Initted ()) {
655+ if (DX8Wrapper::Get_Current_Caps ()->Support_Bump_Envmap ()) {
656+ mips = MipCountType::MIP_LEVELS_1;
657+
658+ if (DX8Wrapper::Get_Current_Caps ()->Supports_Texture_Format (WW3D_FORMAT_U8V8)) {
659+ format = WW3D_FORMAT_U8V8;
660+ } else if (DX8Wrapper::Get_Current_Caps ()->Supports_Texture_Format (WW3D_FORMAT_X8L8V8U8)) {
661+ format = WW3D_FORMAT_X8L8V8U8;
662+ } else if (DX8Wrapper::Get_Current_Caps ()->Supports_Texture_Format (WW3D_FORMAT_L6V5U5)) {
663+ format = WW3D_FORMAT_L6V5U5;
664+ }
660665 }
661666 }
662- }
667+ break ;
668+ default :
669+ captainslog_assert (false );
670+ break ;
663671 }
664672
665673 TextureClass *tex = W3DAssetManager::Get_Instance ()->Get_Texture (name, mips, format);
0 commit comments