MCPcopy Create free account
hub / github.com/doldecomp/mkdd / getTevColorReg

Method getTevColorReg

libs/JSystem/J2DGraph/J2DAnimation.cpp:794–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792}
793
794void J2DAnmTevRegKey::getTevColorReg(u16 idx, GXColorS10 *color) const
795{
796 J3DAnmCRegKeyTable *info = &mCRegKeyTable[idx];
797 f32 val;
798 switch (info->mTables[0].mMaxFrame)
799 {
800 case 0:
801 color->r = 0;
802 break;
803 case 1:
804 color->r = mCRedVals[info->mTables[0].mOffset];
805 break;
806 default:
807 val = J2DGetKeyFrameInterpolation<s16>(getFrame(), &info->mTables[0], &mCRedVals[info->mTables[0].mOffset]);
808 if (val < -1024)
809 {
810 color->r = -1024;
811 }
812 else if (val > 1023)
813 {
814 color->r = 1023;
815 }
816 else
817 {
818 OSf32tos16(&val, &color->r);
819 }
820 }
821 switch (info->mTables[1].mMaxFrame)
822 {
823 case 0:
824 color->g = 0;
825 break;
826 case 1:
827 color->g = mCGreenVals[info->mTables[1].mOffset];
828 break;
829 default:
830 val = J2DGetKeyFrameInterpolation<s16>(getFrame(), &info->mTables[1], &mCGreenVals[info->mTables[1].mOffset]);
831 if (val < -1024)
832 {
833 color->g = -1024;
834 }
835 else if (val > 1023)
836 {
837 color->g = 1023;
838 }
839 else
840 {
841 OSf32tos16(&val, &color->g);
842 }
843 }
844 switch (info->mTables[2].mMaxFrame)
845 {
846 case 0:
847 color->b = 0;
848 break;
849 case 1:
850 color->b = mCBlueVals[info->mTables[2].mOffset];
851 break;

Callers 2

animationMethod · 0.80
calcMethod · 0.80

Calls 1

OSf32tos16Function · 0.85

Tested by

no test coverage detected