diff options
| author | Eblo <7004497+Eblo@users.noreply.github.com> | 2025-09-19 23:23:08 -0400 |
|---|---|---|
| committer | Eblo <7004497+Eblo@users.noreply.github.com> | 2025-09-19 23:23:08 -0400 |
| commit | dc9587914d06cbe9140a4504ee0458744e80870b (patch) | |
| tree | fcca6b5e37e6ecf3da19c39bca42d5199b32db7a | |
| parent | 1de8a27a7d49c5a3a0862a5357b025b5e881f716 (diff) | |
Do not dereference rando actor script args
| -rw-r--r-- | mm/2s2h/Rando/ActorBehavior/EnAl.cpp | 2 | ||||
| -rw-r--r-- | mm/2s2h/Rando/ActorBehavior/EnAn.cpp | 2 | ||||
| -rw-r--r-- | mm/2s2h/Rando/ActorBehavior/EnGo.cpp | 6 | ||||
| -rw-r--r-- | mm/2s2h/Rando/ActorBehavior/EnPm.cpp | 2 | ||||
| -rw-r--r-- | mm/2s2h/Rando/ActorBehavior/EnShn.cpp | 3 |
5 files changed, 7 insertions, 8 deletions
diff --git a/mm/2s2h/Rando/ActorBehavior/EnAl.cpp b/mm/2s2h/Rando/ActorBehavior/EnAl.cpp index 74b9d675c..a528682fa 100644 --- a/mm/2s2h/Rando/ActorBehavior/EnAl.cpp +++ b/mm/2s2h/Rando/ActorBehavior/EnAl.cpp @@ -24,7 +24,7 @@ void Rando::ActorBehavior::InitEnAlBehavior() { if (cmdId == MSCRIPT_CMD_ID_OFFER_ITEM) { *should = false; - MsgScriptCmdOfferItem* cmd = (MsgScriptCmdOfferItem*)*va_arg(args, MsgScript*); + MsgScriptCmdOfferItem* cmd = va_arg(args, MsgScriptCmdOfferItem*); GetItemId getItemId = (GetItemId)SCRIPT_PACK_16(cmd->itemIdH, cmd->itemIdL); skipCmds.clear(); if (getItemId == GI_MASK_KAFEIS_MASK) { // Mayor's Residence diff --git a/mm/2s2h/Rando/ActorBehavior/EnAn.cpp b/mm/2s2h/Rando/ActorBehavior/EnAn.cpp index f0b835508..a64f5c2cf 100644 --- a/mm/2s2h/Rando/ActorBehavior/EnAn.cpp +++ b/mm/2s2h/Rando/ActorBehavior/EnAn.cpp @@ -26,7 +26,7 @@ void Rando::ActorBehavior::InitEnAnBehavior() { skipCmds.clear(); skipCmds.push_back(MSCRIPT_CMD_ID_AWAIT_TEXT); // Have to skip this to prevent a crash skipCmds.push_back(MSCRIPT_CMD_ID_AUTOTALK); // And have to skip this to prevent a softlock on repeats - MsgScriptCmdOfferItem* cmd = (MsgScriptCmdOfferItem*)*va_arg(args, MsgScript*); + MsgScriptCmdOfferItem* cmd = va_arg(args, MsgScriptCmdOfferItem*); GetItemId getItemId = (GetItemId)SCRIPT_PACK_16(cmd->itemIdH, cmd->itemIdL); /* * If the player has the Bombers' Notebook and this is the Letter to Kafei check, the game will crash diff --git a/mm/2s2h/Rando/ActorBehavior/EnGo.cpp b/mm/2s2h/Rando/ActorBehavior/EnGo.cpp index e8f2b900e..253eaba1f 100644 --- a/mm/2s2h/Rando/ActorBehavior/EnGo.cpp +++ b/mm/2s2h/Rando/ActorBehavior/EnGo.cpp @@ -38,7 +38,7 @@ void Rando::ActorBehavior::InitEnGoBehavior() { Player* player = GET_PLAYER(gPlayState); if (cmdId == MSCRIPT_CMD_ID_CHECK_ITEM) { - MsgScriptCmdCheckItem* cmd = (MsgScriptCmdCheckItem*)*script; + MsgScriptCmdCheckItem* cmd = (MsgScriptCmdCheckItem*)script; s16 skip = SCRIPT_PACK_16(cmd->offsetH, cmd->offsetL); s16 jumpTarget = 0x009A; @@ -57,7 +57,7 @@ void Rando::ActorBehavior::InitEnGoBehavior() { if (cmdId == MSCRIPT_CMD_ID_BEGIN_TEXT || cmdId == MSCRIPT_CMD_ID_CONTINUE_TEXT) { // Could also be MsgScriptCmdContinueText, but structs are essentially identical - MsgScriptCmdBeginText* cmd = (MsgScriptCmdBeginText*)*script; + MsgScriptCmdBeginText* cmd = (MsgScriptCmdBeginText*)script; u16 textId = SCRIPT_PACK_16(cmd->textIdH, cmd->textIdL); // Only override behavior if the player has yet to discover powder kegs @@ -76,7 +76,7 @@ void Rando::ActorBehavior::InitEnGoBehavior() { // Identify text choice branch at 0x004E by skip offset values if (cmdId == MSCRIPT_CMD_ID_CHECK_TEXT_CHOICE) { - MsgScriptCmdCheckTextChoice* cmd = (MsgScriptCmdCheckTextChoice*)*script; + MsgScriptCmdCheckTextChoice* cmd = (MsgScriptCmdCheckTextChoice*)script; s16 skipChoice1 = SCRIPT_PACK_16(cmd->offset0H, cmd->offset0L); s16 skipChoice2 = SCRIPT_PACK_16(cmd->offset1H, cmd->offset1L); s16 skipChoice3 = SCRIPT_PACK_16(cmd->offset2H, cmd->offset2L); diff --git a/mm/2s2h/Rando/ActorBehavior/EnPm.cpp b/mm/2s2h/Rando/ActorBehavior/EnPm.cpp index 57249f5db..62c9c8370 100644 --- a/mm/2s2h/Rando/ActorBehavior/EnPm.cpp +++ b/mm/2s2h/Rando/ActorBehavior/EnPm.cpp @@ -27,7 +27,7 @@ void Rando::ActorBehavior::InitEnPmBehavior() { * Express Mail, so we're just going to always act as if the player does not have the Postman's Hat. * This enables repeat rewards as well, which does slightly differ from vanilla. */ - MsgScriptCmdCheckItem* cmd = (MsgScriptCmdCheckItem*)*script; + MsgScriptCmdCheckItem* cmd = (MsgScriptCmdCheckItem*)script; ItemId itemId = (ItemId)SCRIPT_PACK_16(cmd->itemH, cmd->itemL); if (itemId == ITEM_MASK_POSTMAN) { *should = false; diff --git a/mm/2s2h/Rando/ActorBehavior/EnShn.cpp b/mm/2s2h/Rando/ActorBehavior/EnShn.cpp index 3807da132..b5478d72a 100644 --- a/mm/2s2h/Rando/ActorBehavior/EnShn.cpp +++ b/mm/2s2h/Rando/ActorBehavior/EnShn.cpp @@ -7,8 +7,7 @@ void Rando::ActorBehavior::InitEnShnBehavior() { Actor* actor = va_arg(args, Actor*); if (actor->id == ACTOR_EN_SHN && cmdId == MSCRIPT_CMD_ID_OFFER_ITEM) { // Swamp Tourist Center Guide - MsgScript* script = va_arg(args, MsgScript*); - MsgScriptCmdOfferItem* cmd = (MsgScriptCmdOfferItem*)*va_arg(args, MsgScript*); + MsgScriptCmdOfferItem* cmd = va_arg(args, MsgScriptCmdOfferItem*); GetItemId getItemId = (GetItemId)SCRIPT_PACK_16(cmd->itemIdH, cmd->itemIdL); if (getItemId == GI_HEART_PIECE) { // Showed picture of Tingle or the Deku King // Do not do any substituted behavior, just skip this single command |
