diff --git a/asm/macros/event.inc b/asm/macros/event.inc index bff600233..55c6469a8 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1547,13 +1547,13 @@ .byte \color .endm - @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened. - .macro loadhelp pointer:req + @ Displays the help menu with the given text. + .macro loadhelp msg:req .byte 0xc8 - .4byte \pointer + .4byte \msg .endm - @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened. + @ Erases the help menu .macro unloadhelp .byte 0xc9 .endm @@ -1568,10 +1568,11 @@ .byte 0xcb .endm - @ Compares the value of a hidden variable to a dword. - .macro comparehiddenvar a:req, value:req + @ Reads the value of the specified game stat and compares it to the specified value. + @ Sets the script comparisonResult to 0 if stat < value, 1 if stat == value, and 2 if stat > value. + .macro comparestat statId:req, value:req .byte 0xcc - .byte \a + .byte \statId .4byte \value .endm @@ -1616,9 +1617,10 @@ .byte \location .endm - .macro getbraillestringwidth pointer:req + @ Gets the width of the specified message in the Braille font and sets the result to VAR_0x8004. + .macro getbraillestringwidth msg:req .byte 0xd3 - .4byte \pointer + .4byte \msg .endm @ Writes the name of the specified item to the specified buffer. If 'item' is a Berry or ITEM_POKE_BALL @@ -1796,17 +1798,15 @@ callstd STD_FIND_ITEM .endm + @ Prints the message "{PLAYER} put the {ITEM} in the {POCKET}." The item name is pluralized, if applicable. .macro putitemaway item:req, amount=1 setorcopyvar VAR_0x8000, \item setorcopyvar VAR_0x8001, \amount callstd STD_PUT_ITEM_AWAY .endm - .macro giveitem_msg msg:req, item:req, amount=1, fanfare=MUS_LEVEL_UP - additem \item, \amount - msgreceiveditem \msg, \item, \amount, \fanfare - .endm - + @ Prints the provided message after playing the fanfare music (can only be MUS_LEVEL_UP or MUS_OBTAIN_KEY_ITEM). + @ It then prints the message shown by using putitemaway. .macro msgreceiveditem msg:req, item:req, amount=1, fanfare=MUS_LEVEL_UP loadword 0, \msg setorcopyvar VAR_0x8000, \item @@ -1815,12 +1815,20 @@ callstd STD_RECEIVED_ITEM .endm + @ Adds the specified item to the bag, then prints a message with fanfare. See description of msgreceiveditem. + .macro giveitem_msg msg:req, item:req, amount=1, fanfare=MUS_LEVEL_UP + additem \item, \amount + msgreceiveditem \msg, \item, \amount, \fanfare + .endm + + @ Depends on the provided function. With the default argument, unlocks the specified entry in the Fame Checker. .macro famechecker person:req, index:req, function=SetFlavorTextFlagFromSpecialVars setvar VAR_0x8004, \person setvar VAR_0x8005, \index special \function .endm + @ Sets the 'defeated' flag for all trainers in the specified gym. .macro set_gym_trainers gym:req setvar VAR_0x8008, \gym call EventScript_SetGymTrainers @@ -1833,6 +1841,7 @@ goto_if_eq \dest .endm + @ Prints a braille message, then waits for users input. .macro braillemessage_wait text:req setvar VAR_0x8006, 0 braillemessage \text diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index 0a9535ae9..c73c0bb87 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -205,7 +205,7 @@ gScriptCmdTable:: .4byte ScrCmd_unloadhelp @ 0xc9 .4byte ScrCmd_signmsg @ 0xca .4byte ScrCmd_normalmsg @ 0xcb - .4byte ScrCmd_comparestattoword @ 0xcc + .4byte ScrCmd_comparestat @ 0xcc .4byte ScrCmd_setmoneventlegal @ 0xcd .4byte ScrCmd_checkmoneventlegal @ 0xce .4byte ScrCmd_trywondercardscript @ 0xcf diff --git a/src/scrcmd.c b/src/scrcmd.c index 7bc654d13..37e7bfefb 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -578,7 +578,7 @@ bool8 ScrCmd_incrementgamestat(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_comparestattoword(struct ScriptContext * ctx) +bool8 ScrCmd_comparestat(struct ScriptContext * ctx) { u8 statIdx = ScriptReadByte(ctx); u32 value = ScriptReadWord(ctx); @@ -1556,23 +1556,23 @@ bool8 ScrCmd_showcontestpainting(struct ScriptContext * ctx) bool8 ScrCmd_braillemessage(struct ScriptContext * ctx) { - u8 *ptr = (u8 *)ScriptReadWord(ctx); - if (ptr == NULL) - ptr = (u8 *)ctx->data[0]; + u8 *msg = (u8 *)ScriptReadWord(ctx); + if (msg == NULL) + msg = (u8 *)ctx->data[0]; LoadStdWindowFrameGfx(); DrawDialogueFrame(0, 1); - AddTextPrinterParameterized(0, FONT_BRAILLE, ptr, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_BRAILLE, msg, 0, 1, 0, NULL); return FALSE; } bool8 ScrCmd_getbraillestringwidth(struct ScriptContext * ctx) { - u8 *ptr = (u8 *)ScriptReadWord(ctx); - if (ptr == NULL) - ptr = (u8 *)ctx->data[0]; + u8 *msg = (u8 *)ScriptReadWord(ctx); + if (msg == NULL) + msg = (u8 *)ctx->data[0]; - gSpecialVar_0x8004 = GetStringWidth(FONT_BRAILLE, ptr, -1); + gSpecialVar_0x8004 = GetStringWidth(FONT_BRAILLE, msg, -1); return FALSE; }