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

Method getTevKonstReg

libs/JSystem/J2DGraph/J2DAnimation.cpp:892–988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

890}
891
892void J2DAnmTevRegKey::getTevKonstReg(u16 idx, GXColor *color) const
893{
894 J3DAnmKRegKeyTable *info = &mKRegKeyTable[idx];
895 f32 val;
896 switch (info->mTables[0].mMaxFrame)
897 {
898 case 0:
899 color->r = 0;
900 break;
901 case 1:
902 color->r = mKRedVals[info->mTables[0].mOffset];
903 break;
904 default:
905 val = J2DGetKeyFrameInterpolation<s16>(getFrame(), &info->mTables[0], &mKRedVals[info->mTables[0].mOffset]);
906 if (val < 0)
907 {
908 color->r = 0;
909 }
910 else if (val > 255)
911 {
912 color->r = 255;
913 }
914 else
915 {
916 OSf32tou8(&val, &color->r);
917 }
918 }
919 switch (info->mTables[1].mMaxFrame)
920 {
921 case 0:
922 color->g = 0;
923 break;
924 case 1:
925 color->g = mKGreenVals[info->mTables[1].mOffset];
926 break;
927 default:
928 val = J2DGetKeyFrameInterpolation<s16>(getFrame(), &info->mTables[1], &mKGreenVals[info->mTables[1].mOffset]);
929 if (val < 0)
930 {
931 color->g = 0;
932 }
933 else if (val > 255)
934 {
935 color->g = 255;
936 }
937 else
938 {
939 OSf32tou8(&val, &color->g);
940 }
941 }
942 switch (info->mTables[2].mMaxFrame)
943 {
944 case 0:
945 color->b = 0;
946 break;
947 case 1:
948 color->b = mKBlueVals[info->mTables[2].mOffset];
949 break;

Callers 2

animationMethod · 0.80
calcMethod · 0.80

Calls 1

OSf32tou8Function · 0.85

Tested by

no test coverage detected