Renaming Script Contexts

- Determined how the various script contexts were used and renamed accordingly.
- ScriptContext2_Enable/Disable => Lock/UnlockPlayerFieldControls - The sole purpose of the flag is to make sure the player can't move around in the overworld. It has nothing to do with script contexts.
- ScriptContext1 => ScriptContext - It is the global script context used to set up scripts which run over many frames.
- ScriptContext2_RunNewScript => RunScriptImmediately - ScriptContext2's sole purpose was to run scripts immediately and in a separate context, usually while the global context is waiting for things like map loads or screen changes.
This commit is contained in:
tustin2121
2022-08-15 15:18:12 -04:00
parent 3dc3dc847f
commit 1cb659df8c
65 changed files with 438 additions and 409 deletions
+5 -5
View File
@@ -277,7 +277,7 @@ static u8 CreateShopMenu(u8 martType)
{
int numMenuItems;
ScriptContext2_Enable();
LockPlayerFieldControls();
sMartInfo.martType = martType;
if (martType == MART_TYPE_NORMAL)
@@ -373,7 +373,7 @@ static void Task_HandleShopMenuQuit(u8 taskId)
ClearStdWindowAndFrameToTransparent(sMartInfo.windowId, 2); // Incorrect use, making it not copy it to vram.
RemoveWindow(sMartInfo.windowId);
TryPutSmartShopperOnAir();
ScriptContext2_Disable();
UnlockPlayerFieldControls();
DestroyTask(taskId);
if (sMartInfo.callback)
@@ -1210,19 +1210,19 @@ void CreatePokemartMenu(const u16 *itemsForSale)
CreateShopMenu(MART_TYPE_NORMAL);
SetShopItemsForSale(itemsForSale);
ClearItemPurchases();
SetShopMenuCallback(EnableBothScriptContexts);
SetShopMenuCallback(ScriptContext_Enable);
}
void CreateDecorationShop1Menu(const u16 *itemsForSale)
{
CreateShopMenu(MART_TYPE_DECOR);
SetShopItemsForSale(itemsForSale);
SetShopMenuCallback(EnableBothScriptContexts);
SetShopMenuCallback(ScriptContext_Enable);
}
void CreateDecorationShop2Menu(const u16 *itemsForSale)
{
CreateShopMenu(MART_TYPE_DECOR2);
SetShopItemsForSale(itemsForSale);
SetShopMenuCallback(EnableBothScriptContexts);
SetShopMenuCallback(ScriptContext_Enable);
}