Skip to content

Update EffectUtil.cpp and LightUtil.cpp‎ - #1968

Open
openconcerto wants to merge 3 commits into
SMGCommunity:masterfrom
openconcerto:utils
Open

Update EffectUtil.cpp and LightUtil.cpp‎#1968
openconcerto wants to merge 3 commits into
SMGCommunity:masterfrom
openconcerto:utils

Conversation

@openconcerto

Copy link
Copy Markdown

improved matching with original

@openconcerto openconcerto changed the title Update EffectUtil.cpp Update EffectUtil.cpp and LightUtil.cpp‎ Jul 23, 2026
// Instructionswap for some reason
void addEffectHitNormal(LiveActor* pActor, const char* pEffectName) {
addEffect(pActor, "HitMarkNormal");
char* effectName = "HitMarkNormal";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be typed to const char*.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

} else if (type == 0) {
MR::getSceneObj< LightDirector >(SceneObj_LightDirector)->loadLightPlayer();
} else {
AreaLightInfo* lightInfo = reinterpret_cast< AreaLightInfo* >(MR::getSceneObj< LightDirector >(SceneObj_LightDirector)->_18);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preferably edit the declaration of _18 to be typed properly than work around it with reinterpret_cast. It is assigned to in LightDirector::initData using the return value of LightDataHolder::findAreaLight, so you can use that as reference for what to type the member variable to.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, you can modify that

Comment on lines 258 to +263
pStrList = &pStrList[1];
ModelManager* pModelManager;
while (pStrList[0]) {
pModelManager = pActor->mModelManager;
Effect::addEffectSyncBck(::getEffectKeeper(pActor)->getEmitter(pEffectName), pModelManager, pStrList[0]);
pStrList = &pStrList[1];
while (*pStrList != nullptr) {
ModelManager* pModelManager = pActor->mModelManager;
MultiEmitter* pEmitter = ::getEffectKeeper(pActor)->getEmitter(pEffectName);
Effect::addEffectSyncBck(pEmitter, pModelManager, *pStrList);
pStrList++;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be converted to a for loop and still match?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took hours to find a 100% matching while loop...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but this kinda looks like a for loop. It happens :(

Comment on lines 248 to 254
const char* str;
while (str = tempStrList[0], tempStrList = &tempStrList[1], str) {
i++;
const char* const* current = pStrList;

int size = 0;
while (str = *current, current++, str) {
size++;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be converted to a for loop and still match without looking ugly?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, but failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants