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

Method insertCommon

libs/JSystem/J2DGraph/J2DPictureEx.cpp:268–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268void J2DPictureEx::insertCommon(u8 index, f32 blendRatio)
269{
270 u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
271 mMaterial->getTevBlock()->getMaxStage();
272 u8 stageNum = mMaterial->getTevBlock()->getTevStageNum();
273
274 bool check;
275 if (texGenNum <= 1) {
276 check = stageNum != 1;
277 } else {
278 check = (stageNum != (texGenNum + 1));
279 }
280
281 shiftSetBlendRatio(index, blendRatio, true, true);
282 shiftSetBlendRatio(index, blendRatio, false, true);
283
284 texGenNum++;
285
286 mMaterial->getTexGenBlock()->setTexGenNum(texGenNum);
287
288 J2DTexCoordInfo coordInfo;
289 coordInfo.mTexGenType = 1;
290 coordInfo.mTexGenSrc = 4;
291
292 // some loop copy nonsense like this
293 for (int i = (texGenNum - 1); i >= index; i--) {
294 coordInfo.mTexGenMtx = (i * 3 + 30);
295 J2DTexCoord coord(coordInfo);
296 mMaterial->getTexGenBlock()->setTexCoord((u8)i, coord);
297 }
298
299 for (int i = texGenNum - 1; i > index; i--) {
300 mMaterial->getTexGenBlock()->setTexMtx((u8)i, mMaterial->getTexGenBlock()->getTexMtx((u8)(i - 1)));
301 }
302
303 J2DTexMtx texMtx;
304 mMaterial->getTexGenBlock()->setTexMtx(index, texMtx);
305
306 if (texGenNum == 1) {
307 stageNum = 1;
308 } else {
309 stageNum = texGenNum + (check ? 2 : 1);
310 }
311
312 mMaterial->getTevBlock()->setTevStageNum(stageNum);
313
314 setTevOrder(texGenNum, stageNum, check);
315 setTevStage(texGenNum, stageNum, check);
316 setTevKColor(texGenNum);
317 setTevKColorSel(texGenNum);
318 setTevKAlphaSel(texGenNum);
319}
320
321bool J2DPictureEx::isInsert(u8 p1) const
322{

Callers

nothing calls this directly

Calls 10

setTexGenNumMethod · 0.80
getTexGenNumMethod · 0.45
getTexGenBlockMethod · 0.45
getMaxStageMethod · 0.45
getTevBlockMethod · 0.45
getTevStageNumMethod · 0.45
setTexCoordMethod · 0.45
setTexMtxMethod · 0.45
getTexMtxMethod · 0.45
setTevStageNumMethod · 0.45

Tested by

no test coverage detected