@@ -535,7 +535,7 @@ void func_80041C24(s_LmHeader* lmHeader, s32 arg1, s32 arg2) // 0x80041C24
535535 D_800C1020 .field_150 = arg1 ;
536536 D_800C1020 .field_154 = arg2 ;
537537 D_800C1020 .ipdTableSize_158 = 0 ;
538- D_800C1020 .field_588 = 1 ;
538+ D_800C1020 .hasGlobalPlm = 1 ;
539539
540540 func_80041D10 (D_800C1020 .ipdTable_15C , 4 );
541541 func_80041D48 ();
@@ -585,15 +585,15 @@ void func_80041D48() // 0x80041D48
585585 y = 21 ;
586586 }
587587
588- func_8005B1A0 (& D_800C1020 .field_430 .field_58 [i ], 0 , 0 , y , 0 , 0 , x , j );
588+ Tex_Init1 (& D_800C1020 .field_430 .field_58 [i ], 0 , 0 , y , 0 , 0 , x , j );
589589 }
590590
591591 func_8005B46C (& D_800C1020 .field_430 .field_0 );
592592 func_8005B474 (& D_800C1020 .field_430 .field_0 , D_800C1020 .field_430 .field_58 , 8 );
593593
594594 for (i = 0 , y = 26 , j = 0 ; i < 2 ; i ++ , x += 16 )
595595 {
596- func_8005B1A0 (& D_800C1020 .field_430 .field_118 [i ], 0 , 0 , y , (i & 0x1 ) * 32 , 0 , x , j );
596+ Tex_Init1 (& D_800C1020 .field_430 .field_118 [i ], 0 , 0 , y , (i & 0x1 ) * 32 , 0 , x , j );
597597 if (i & 0x1 )
598598 {
599599 y ++ ;
@@ -629,7 +629,7 @@ void Map_PlaceIpdAtGridPos(s16 ipdFileIdx, s32 x, s32 z) // 0x80041ED0
629629 ipd = ptr -> ipdHeader_0 ;
630630 if (ipd -> isLoaded_1 )
631631 {
632- func_80056BF8 (ipd -> lmHeader_4 );
632+ Lm_MaterialRefCountDec (ipd -> lmHeader_4 );
633633 }
634634 }
635635
@@ -644,28 +644,28 @@ void func_80041FF0() // 0x80041FF0
644644
645645void func_8004201C () // 0x8004201C
646646{
647- s_Material_8 * material_8 ;
647+ s_Texture * tex_8 ;
648648
649- material_8 = & D_800C1020 .field_430 .field_58 [0 ];
650- while (material_8 < (& D_800C1020 .field_430 .field_58 [8 ]))
649+ tex_8 = & D_800C1020 .field_430 .field_58 [0 ];
650+ while (tex_8 < (& D_800C1020 .field_430 .field_58 [8 ]))
651651 {
652- if (material_8 -> field_14 == 0 )
652+ if (tex_8 -> refCount_14 == 0 )
653653 {
654- func_8005B3A4 ( material_8 );
654+ Tex_Init0 ( tex_8 );
655655 }
656656
657- material_8 ++ ;
657+ tex_8 ++ ;
658658 }
659659
660- material_8 = & D_800C1020 .field_430 .field_118 [0 ];
661- while (material_8 < (& D_800C1020 .field_430 .field_118 [2 ]))
660+ tex_8 = & D_800C1020 .field_430 .field_118 [0 ];
661+ while (tex_8 < (& D_800C1020 .field_430 .field_118 [2 ]))
662662 {
663- if (material_8 -> field_14 == 0 )
663+ if (tex_8 -> refCount_14 == 0 )
664664 {
665- func_8005B3A4 ( material_8 );
665+ Tex_Init0 ( tex_8 );
666666 }
667667
668- material_8 ++ ;
668+ tex_8 ++ ;
669669 }
670670}
671671
@@ -685,34 +685,34 @@ void func_800420FC() // 0x800420FC
685685 if (Fs_QueueEntryLoadStatusGet (ptr -> queueIdx_8 ) >= FsQueueEntryLoadStatus_Loaded &&
686686 ptr -> lmHeader_0 -> isLoaded_2 )
687687 {
688- func_80056BF8 (D_800C1020 .field_138 .lmHeader_0 );
688+ Lm_MaterialRefCountDec (D_800C1020 .field_138 .lmHeader_0 );
689689 }
690690
691691 func_80041CB4 (& D_800C1020 .field_138 , D_800C1020 .field_138 .lmHeader_0 );
692692}
693693
694- s_Material_8 * func_80042178 (char * arg0 ) // 0x80042178
694+ s_Texture * func_80042178 (char * arg0 ) // 0x80042178
695695{
696- s_Material_8 * material_8 ;
696+ s_Texture * tex_8 ;
697697
698- material_8 = func_8005B4BC (arg0 , & D_800C1020 .field_430 .field_0 );
699- if (material_8 != NULL )
698+ tex_8 = func_8005B4BC (arg0 , & D_800C1020 .field_430 .field_0 );
699+ if (tex_8 != NULL )
700700 {
701- return material_8 ;
701+ return tex_8 ;
702702 }
703703
704- material_8 = func_8005B4BC (arg0 , & D_800C1020 .field_430 .field_2C );
705- if (material_8 != NULL )
704+ tex_8 = func_8005B4BC (arg0 , & D_800C1020 .field_430 .field_2C );
705+ if (tex_8 != NULL )
706706 {
707- return material_8 ;
707+ return tex_8 ;
708708 }
709709
710710 return NULL ;
711711}
712712
713713void func_800421D8 (char * mapTag , s32 plmIdx , s32 arg2 , s32 arg3 , s32 arg4 , s32 arg5 ) // 0x800421D8
714714{
715- D_800C1020 .field_588 = arg3 ;
715+ D_800C1020 .hasGlobalPlm = arg3 ;
716716 D_800C1020 .field_134 = arg5 ;
717717
718718 if (plmIdx != NO_VALUE )
@@ -722,7 +722,7 @@ void func_800421D8(char* mapTag, s32 plmIdx, s32 arg2, s32 arg3, s32 arg4, s32 a
722722 if (Fs_QueueEntryLoadStatusGet (D_800C1020 .field_138 .queueIdx_8 ) >= FsQueueEntryLoadStatus_Loaded &&
723723 D_800C1020 .field_138 .lmHeader_0 -> isLoaded_2 )
724724 {
725- func_80056BF8 (D_800C1020 .field_138 .lmHeader_0 );
725+ Lm_MaterialRefCountDec (D_800C1020 .field_138 .lmHeader_0 );
726726 }
727727
728728 D_800C1020 .field_138 .fileIdx_4 = plmIdx ;
@@ -763,7 +763,7 @@ void func_80042300(s_800C1020* arg0, s32 arg1) // 0x80042300
763763 ipd1 = temp_s0 -> ipdHeader_0 ;
764764 if (ipd1 -> isLoaded_1 )
765765 {
766- func_80056BF8 (ipd1 -> lmHeader_4 );
766+ Lm_MaterialRefCountDec (ipd1 -> lmHeader_4 );
767767 }
768768 }
769769
@@ -983,7 +983,7 @@ s32 func_8004287C(s_800BCE18_2BEC_0* arg0, s_800BCE18_2BEC_0_10* arg1, s32 posX,
983983 continue ;
984984 }
985985
986- if (D_800C1020 .field_588 == 0 )
986+ if (D_800C1020 .hasGlobalPlm == 0 )
987987 {
988988 if (ptr1 -> field_8 == xIdx && ptr1 -> field_A == zIdx )
989989 {
@@ -1138,35 +1138,35 @@ s32 func_80042EBC(s_800C1020* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) // 0
11381138 arg0 -> field_580 = temp_v0 ;
11391139 arg0 -> field_584 = var_v1 ;
11401140
1141- func_800431E4 (arg0 , arg1 , arg2 , arg3 , arg4 , arg0 -> field_588 );
1141+ func_800431E4 (arg0 , arg1 , arg2 , arg3 , arg4 , arg0 -> hasGlobalPlm );
11421142 func_800433B8 (arg0 );
11431143
11441144 for (i = NO_VALUE ; i < 2 ; i ++ )
11451145 {
11461146 for (j = NO_VALUE ; j < 2 ; j ++ )
11471147 {
1148- if (arg0 -> field_588 != 0 || (j == 0 && i == 0 ))
1148+ if (arg0 -> hasGlobalPlm != 0 || (j == 0 && i == 0 ))
11491149 {
11501150 temp_s3 = sp2C + i ;
11511151 temp_s1 = sp28 + j ;
11521152
11531153 temp_v0_2 = func_80043554 (temp_s1 , temp_s3 );
11541154 if (temp_v0_2 != NO_VALUE &&
1155- func_80042DE8 (arg1 , arg2 , temp_s1 , temp_s3 , arg0 -> field_588 ) <= 0 &&
1155+ func_80042DE8 (arg1 , arg2 , temp_s1 , temp_s3 , arg0 -> hasGlobalPlm ) <= 0 &&
11561156 !func_80043578 (& arg0 -> ipdTable_15C [0 ], temp_s1 , temp_s3 ))
11571157 {
1158- temp_v0_3 = func_800435E4 (& arg0 -> ipdTable_15C [0 ], arg0 -> field_588 );
1158+ temp_v0_3 = func_800435E4 (& arg0 -> ipdTable_15C [0 ], arg0 -> hasGlobalPlm );
11591159
11601160 if (Fs_QueueEntryLoadStatusGet (temp_v0_3 -> queueEntryIdx_4 ) >= 2 )
11611161 {
11621162 temp_v1 = temp_v0_3 -> destBuffer_0 ;
11631163 if (temp_v1 -> field_1 != 0 )
11641164 {
1165- func_80056BF8 (temp_v1 -> field_4 );
1165+ Lm_MaterialRefCountDec (temp_v1 -> field_4 );
11661166 }
11671167 }
11681168
1169- temp_v0_4 = func_800436D8 (temp_v0_3 , temp_v0_2 , temp_s1 , temp_s3 , arg1 , arg2 , arg3 , arg4 , arg0 -> field_588 );
1169+ temp_v0_4 = func_800436D8 (temp_v0_3 , temp_v0_2 , temp_s1 , temp_s3 , arg1 , arg2 , arg3 , arg4 , arg0 -> hasGlobalPlm );
11701170 if (temp_v0_4 != NO_VALUE )
11711171 {
11721172 sp30 = temp_v0_4 ;
@@ -1231,7 +1231,7 @@ void func_800433B8(s_800C1020* arg0) // 0x800433B8
12311231 {
12321232 if (ptr -> ipdHeader_0 -> isLoaded_1 && ptr -> field_C > 0 && ptr -> field_10 > 0 )
12331233 {
1234- func_80056BF8 (ptr -> ipdHeader_0 -> lmHeader_4 );
1234+ Lm_MaterialRefCountDec (ptr -> ipdHeader_0 -> lmHeader_4 );
12351235 }
12361236 }
12371237 }
@@ -1442,7 +1442,7 @@ bool func_8004393C(s32 posX, s32 posZ) // 0x8004393C
14421442 fileChunkCoordX = FLOOR_TO_STEP (FP_METER_TO_GEO (posX ), FP_METER_GEO (40.0f ));
14431443 fileChunkCoordZ = FLOOR_TO_STEP (FP_METER_TO_GEO (posZ ), FP_METER_GEO (40.0f ));
14441444
1445- if (D_800C1020 .field_588 != 0 )
1445+ if (D_800C1020 .hasGlobalPlm != 0 )
14461446 {
14471447 return func_80042E2C (FP_METER_TO_GEO (D_800C1020 .field_578 ), FP_METER_TO_GEO (D_800C1020 .field_57C ), fileChunkCoordX , fileChunkCoordZ ) <= FP_METER_GEO (4.5f );
14481448 }
@@ -1491,7 +1491,7 @@ bool func_80043B34(s_800C117C* arg0, s_800C1020* arg1)
14911491 return true;
14921492 }
14931493
1494- return arg1 -> field_588 != 0 ;
1494+ return arg1 -> hasGlobalPlm != 0 ;
14951495}
14961496
14971497bool IpdHeader_IsTextureLoaded (s_IpdHeader * ipdHeader ) // 0x80043B70
@@ -1572,7 +1572,7 @@ bool LmFilter_NameEndsWithH(s_Material* mat) // 0x80043D64
15721572{
15731573 char * charCode ;
15741574
1575- for (charCode = & mat -> materialName_0 .str [7 ]; charCode >= & mat -> materialName_0 .str [0 ]; charCode -- )
1575+ for (charCode = & mat -> name_0 .str [7 ]; charCode >= & mat -> name_0 .str [0 ]; charCode -- )
15761576 {
15771577 if (* charCode == '\0' )
15781578 {
0 commit comments