Tarferi icon

Shifting STR

Tarferi | PRO | 08/31/19 08:40:20 AM UTC | 0 ⭐ | 1433 👁️ | Never ⏰ | []
C++ |

1.64 KB

|

None

|

0 👍

/

0 👎

        unsigned int shiftOffset = STR->getOriginalSectionBeginOffset();
 
        Trigger* first = TRIG->triggers.get(0);
        TRIG->triggers.remove(0);
        for (unsigned int i = 0; i < 8; i++) {
 
            // Make a new trigger
            MALLOC_N(trigger, Trigger, 1, { free(first); return false; });
            if (!TRIG->triggers.insert(0, trigger)) { free(first); return false; }
 
            // Copy original values
            memcpy(trigger, first, sizeof(Trigger));
 
            // Set to one specific player only
            for (unsigned int o = 0; o < 28; o++) {
                trigger->players[o] = 0;
            }
            trigger->players[i] = 1;
 
            SET_ACT_COUNT_UP_ADDR(1, EUD_STR, shiftOffset); // Add offset to STR, void condition in all lists
 
            // Remove action from all triggers
            unsigned int nextActionIndex = 2;
            for (unsigned int o = 0; o < 8; o++) {
                ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), ADDRESS_TO_EPD(EUD_TRGLIST[o]), Modifiers::Add, 378, 0); // Set first pointer to 2nd action type
                nextActionIndex++;
 
                ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), ADDRESS_TO_EPD(EUD_CP), Modifiers::SetTo, ADDRESS_TO_EPD(EUD_TRGLIST[o]), 0); // Set CP to 2nd action type
                nextActionIndex++;
 
                ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), 13, Modifiers::SetTo, 0, 0); // Set action type to 0
                nextActionIndex++;
 
                ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), ADDRESS_TO_EPD(EUD_TRGLIST[o]), Modifiers::Subtract, 378, 0); // Set first pointer to original value
                nextActionIndex++;
            }
 
            ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), ADDRESS_TO_EPD(EUD_CP), Modifiers::SetTo, i, 0); // Restore current played ID
            nextActionIndex++;
        }
 
    }

Comments