@@ -335,6 +335,12 @@ bool C2D_SetTintMode(C2D_TintMode mode)
335335 case C2D_TintSub :
336336 new_mode = C2DiF_Mode_ImageSub ;
337337 break ;
338+ case C2D_TintOneMinusAdd :
339+ new_mode = C2DiF_Mode_ImageOMAdd ;
340+ break ;
341+ case C2D_TintOneMinusSub :
342+ new_mode = C2DiF_Mode_ImageOMSub ;
343+ break ;
338344 }
339345
340346 ctx -> flags = (ctx -> flags & ~ C2DiF_TintMode_Mask ) | (new_mode << (C2DiF_TintMode_Shift - C2DiF_Mode_Shift ));
@@ -721,21 +727,26 @@ void C2Di_Update(void)
721727 break ;
722728 }
723729 case C2DiF_Mode_ImageAdd :
730+ case C2DiF_Mode_ImageOMAdd :
724731 {
725732 // Use texenv to blend the color source with the addition-tinted version of it,
726733 // according to a parameter that is passed through with the help of proctex.
727734 proctex = C2DiF_ProcTex_Blend ;
728735
729736 // texenv0 = texclr + vtxcolor
737+ // texenv0 = (1-texclr) + vtxcolor
730738 env = C3D_GetTexEnv (0 );
731739 C3D_TexEnvInit (env );
732- C3D_TexEnvSrc (env , C3D_Both , GPU_TEXTURE0 , GPU_PRIMARY_COLOR , GPU_PRIMARY_COLOR );
740+ C3D_TexEnvSrc (env , C3D_RGB , GPU_TEXTURE0 , GPU_PRIMARY_COLOR , GPU_PRIMARY_COLOR );
741+ if (mode == C2DiF_Mode_ImageOMAdd ){ // if OM set to ONE MINUS
742+ C3D_TexEnvOpRgb (env , GPU_TEVOP_RGB_ONE_MINUS_SRC_COLOR , GPU_TEVOP_RGB_SRC_COLOR , GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA );
743+ }
733744 C3D_TexEnvFunc (env , C3D_RGB , GPU_ADD );
734745
735746 // texenv1.rgb = mix(texclr.rgb, texenv0.rgb, vtx.blend.y);
736747 env = C3D_GetTexEnv (1 );
737748 C3D_TexEnvInit (env );
738- C3D_TexEnvSrc (env , C3D_RGB , GPU_TEXTURE0 , GPU_PREVIOUS , GPU_TEXTURE3 );
749+ C3D_TexEnvSrc (env , C3D_Both , GPU_TEXTURE0 , GPU_PREVIOUS , GPU_TEXTURE3 );
739750 C3D_TexEnvOpRgb (env , GPU_TEVOP_RGB_SRC_COLOR , GPU_TEVOP_RGB_SRC_COLOR , GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA );
740751 C3D_TexEnvFunc (env , C3D_RGB , GPU_INTERPOLATE );
741752
@@ -745,21 +756,26 @@ void C2Di_Update(void)
745756 break ;
746757 }
747758 case C2DiF_Mode_ImageSub :
759+ case C2DiF_Mode_ImageOMSub :
748760 {
749761 // Use texenv to blend the color source with the subtraction-tinted version of it,
750762 // according to a parameter that is passed through with the help of proctex.
751763 proctex = C2DiF_ProcTex_Blend ;
752764
753765 // texenv0 = texclr - vtxcolor
766+ // texenv0 = (1-texclr) - vtxcolor
754767 env = C3D_GetTexEnv (0 );
755768 C3D_TexEnvInit (env );
756- C3D_TexEnvSrc (env , C3D_Both , GPU_TEXTURE0 , GPU_PRIMARY_COLOR , GPU_PRIMARY_COLOR );
769+ C3D_TexEnvSrc (env , C3D_RGB , GPU_TEXTURE0 , GPU_PRIMARY_COLOR , GPU_PRIMARY_COLOR );
770+ if (mode == C2DiF_Mode_ImageOMSub ){ // if OM set to ONE MINUS
771+ C3D_TexEnvOpRgb (env , GPU_TEVOP_RGB_ONE_MINUS_SRC_COLOR , GPU_TEVOP_RGB_SRC_COLOR , GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA );
772+ }
757773 C3D_TexEnvFunc (env , C3D_RGB , GPU_SUBTRACT );
758774
759775 // texenv1.rgb = mix(texclr.rgb, texenv0.rgb, vtx.blend.y);
760776 env = C3D_GetTexEnv (1 );
761777 C3D_TexEnvInit (env );
762- C3D_TexEnvSrc (env , C3D_RGB , GPU_TEXTURE0 , GPU_PREVIOUS , GPU_TEXTURE3 );
778+ C3D_TexEnvSrc (env , C3D_Both , GPU_TEXTURE0 , GPU_PREVIOUS , GPU_TEXTURE3 );
763779 C3D_TexEnvOpRgb (env , GPU_TEVOP_RGB_SRC_COLOR , GPU_TEVOP_RGB_SRC_COLOR , GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA );
764780 C3D_TexEnvFunc (env , C3D_RGB , GPU_INTERPOLATE );
765781
0 commit comments