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

Function tagCnv

src/Kameda/ReadPrintMessage.cpp:88–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86 }
87
88 void tagCnv(char *msg, void *bmcPtr, J2DTextBox::TFontSize fontSize, int n, char *txtBuf)
89 {
90 while (*msg && n--)
91 {
92 u8 tagData[32];
93 char buf[32];
94
95 if (*msg != 0x1a)
96 { // no escape sequence, normal formatting
97 *txtBuf++ = *msg++;
98 continue;
99 }
100 *msg++;
101
102 u8 tagSize = *msg++;
103 u8 tagGroup = *msg++;
104 u16 tagID = (*msg++ << 8);
105 tagID += *msg++;
106
107 for (u8 i = 0; i < tagSize - 5; i++)
108 tagData[i] = *msg++;
109
110 switch (tagGroup)
111 {
112 case 0:
113 {
114 switch (tagID)
115 {
116 case 0:
117 {
118 JUTColor color = getColor(bmcPtr, tagData[0]);
119 JUTColor gradient = getColor(bmcPtr, tagData[1]);
120 snprintf(buf, sizeof(buf), "\eCC[%02X%02X%02X%02X]\eGC[%02X%02X%02X%02X]",
121 color.r, color.g, color.b, color.a,
122 gradient.r, gradient.g, gradient.b, gradient.a);
123 break;
124 }
125 default:
126#line 193
127 JUT_ASSERT(0);
128 }
129 break;
130 }
131 case 1:
132 JUT_MINMAX_ASSERT(0, tagID, 10);
133 snprintf(buf, sizeof(buf), "%d", mNum[tagID]);
134 break;
135 case 2:
136 JUT_MINMAX_ASSERT(0, tagID, 10);
137 snprintf(buf, sizeof(buf), "%02d", mNum[tagID]);
138 break;
139 case 3:
140 JUT_MINMAX_ASSERT(0, tagID, 10);
141 snprintf(buf, sizeof(buf), "%03d", mNum[tagID]);
142 break;
143 case 4:
144 JUT_MINMAX_ASSERT(0, tagID, 5);
145 snprintf(buf, sizeof(buf), "%s", mStr[tagID]);

Callers 4

initMethod · 0.85
setCheckDataSubMethod · 0.85
setupMethod · 0.85
setMessageMethod · 0.85

Calls 2

getColorFunction · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected