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

Method calcIsHitItem

src/Sato/ItemObjMgr.cpp:1059–1079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1057}
1058
1059void ItemObjMgr::calcIsHitItem(JSUListIterator<ItemObj> &list1, JSUListIterator<ItemObj> &list2) {
1060 // I hope you got fired for writing this function
1061 if ((list2->_12c & 1) == 0)
1062 return;
1063
1064 const JGeometry::TVec3f colPos = list2->mColPos; // should've used a reference
1065 if (list1->IsHitObject(list1->mBounds, colPos, list2->mBounds)) {
1066 ItemObj *item1 = list1.getObject(); // pls use this for the actualy function calls as well, it's the exact same as operator->
1067 ItemObj *item2 = list2.getObject();
1068 ItemObj::ItemColFlag flag1 = list1->calcColReaction(item2);
1069 ItemObj::ItemColFlag flag2 = list2->calcColReaction(item1);
1070
1071 if (flag1 != 6 && flag2 != 6) {
1072 list1->callHitItemSound(item2);
1073 list2->callHitItemSound(item1);
1074 list1->setTransfer1();
1075 list2->setTransfer1();
1076 ItemObj::colItemReflect(item1, item2, flag1, flag2);
1077 }
1078 }
1079}
1080
1081void ItemObjMgr::setKartHittingList(JSUListIterator<ItemObj> &list, int kart_index)
1082{

Callers

nothing calls this directly

Calls 5

IsHitObjectMethod · 0.80
callHitItemSoundMethod · 0.80
setTransfer1Method · 0.80
getObjectMethod · 0.45
calcColReactionMethod · 0.45

Tested by

no test coverage detected