Advertisement
Tarferi

Shifting STR

Aug 31st, 2019
722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1.         unsigned int shiftOffset = STR->getOriginalSectionBeginOffset();
  2.  
  3.         Trigger* first = TRIG->triggers.get(0);
  4.         TRIG->triggers.remove(0);
  5.         for (unsigned int i = 0; i < 8; i++) {
  6.  
  7.             // Make a new trigger
  8.             MALLOC_N(trigger, Trigger, 1, { free(first); return false; });
  9.             if (!TRIG->triggers.insert(0, trigger)) { free(first); return false; }
  10.  
  11.             // Copy original values
  12.             memcpy(trigger, first, sizeof(Trigger));
  13.  
  14.             // Set to one specific player only
  15.             for (unsigned int o = 0; o < 28; o++) {
  16.                 trigger->players[o] = 0;
  17.             }
  18.             trigger->players[i] = 1;
  19.  
  20.             SET_ACT_COUNT_UP_ADDR(1, EUD_STR, shiftOffset); // Add offset to STR, void condition in all lists
  21.  
  22.             // Remove action from all triggers
  23.             unsigned int nextActionIndex = 2;
  24.             for (unsigned int o = 0; o < 8; o++) {
  25.                 ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), ADDRESS_TO_EPD(EUD_TRGLIST[o]), Modifiers::Add, 378, 0); // Set first pointer to 2nd action type
  26.                 nextActionIndex++;
  27.  
  28.                 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
  29.                 nextActionIndex++;
  30.  
  31.                 ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), 13, Modifiers::SetTo, 0, 0); // Set action type to 0
  32.                 nextActionIndex++;
  33.  
  34.                 ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), ADDRESS_TO_EPD(EUD_TRGLIST[o]), Modifiers::Subtract, 378, 0); // Set first pointer to original value
  35.                 nextActionIndex++;
  36.             }
  37.  
  38.             ACT_SET_DEATHS((&(trigger->actions[nextActionIndex])), ADDRESS_TO_EPD(EUD_CP), Modifiers::SetTo, i, 0); // Restore current played ID
  39.             nextActionIndex++;
  40.         }
  41.  
  42.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement