mirror of
https://github.com/pret/pokefirered.git
synced 2025-03-01 10:25:37 +00:00
Sync macros to have Give/Take Add/Remove unity
This commit is contained in:
parent
8c560386ed
commit
a5d8b98fde
@ -488,7 +488,7 @@
|
||||
.endm
|
||||
|
||||
@ Adds a quantity amount of item index to the player's PC. Both arguments can be variables.
|
||||
.macro givepcitem index:req, quantity:req
|
||||
.macro addpcitem index:req, quantity:req
|
||||
.byte 0x49
|
||||
.2byte \index
|
||||
.2byte \quantity
|
||||
@ -1018,14 +1018,14 @@
|
||||
.endm
|
||||
|
||||
@ If check is 0x00, this command adds value to the player's money.
|
||||
.macro givemoney value:req, check:req
|
||||
.macro addmoney value:req, check:req
|
||||
.byte 0x90
|
||||
.4byte \value
|
||||
.byte \check
|
||||
.endm
|
||||
|
||||
@ If check is 0x00, this command subtracts value from the player's money.
|
||||
.macro takemoney value:req, check:req
|
||||
.macro removemoney value:req, check:req
|
||||
.byte 0x91
|
||||
.4byte \value
|
||||
.byte \check
|
||||
@ -1246,12 +1246,12 @@
|
||||
.2byte \out
|
||||
.endm
|
||||
|
||||
.macro givecoins count:req
|
||||
.macro addcoins count:req
|
||||
.byte 0xb4
|
||||
.2byte \count
|
||||
.endm
|
||||
|
||||
.macro takecoins word:req
|
||||
.macro removecoins word:req
|
||||
.byte 0xb5
|
||||
.2byte \word
|
||||
.endm
|
||||
@ -1539,7 +1539,7 @@
|
||||
goto_if TRUE, \dest
|
||||
.endm
|
||||
|
||||
.macro goto_if_undefeated trainer:req, dest:req
|
||||
.macro goto_if_not_defeated trainer:req, dest:req
|
||||
checktrainerflag \trainer
|
||||
goto_if FALSE, \dest
|
||||
.endm
|
||||
@ -1549,7 +1549,7 @@
|
||||
call_if TRUE, \dest
|
||||
.endm
|
||||
|
||||
.macro call_if_undefeated trainer:req, dest:req
|
||||
.macro call_if_not_defeated trainer:req, dest:req
|
||||
checktrainerflag \trainer
|
||||
call_if FALSE, \dest
|
||||
.endm
|
||||
|
@ -1910,7 +1910,7 @@ CeladonCity_GameCorner_EventScript_1B2867:: @ 81B2867
|
||||
compare VAR_RESULT, FALSE
|
||||
goto_if_eq EventScript_1B292B
|
||||
playse SE_SHOP
|
||||
takemoney 50, 0
|
||||
removemoney 50, 0
|
||||
updatemoneybox 0, 0, 0
|
||||
waitse
|
||||
message gUnknown_81B1E24
|
||||
|
@ -246,15 +246,15 @@ EventScript_16C0A5:: @ 816C0A5
|
||||
end
|
||||
|
||||
EventScript_16C0B6:: @ 816C0B6
|
||||
takemoney 200, 0
|
||||
removemoney 200, 0
|
||||
return
|
||||
|
||||
EventScript_16C0BD:: @ 816C0BD
|
||||
takemoney 300, 0
|
||||
removemoney 300, 0
|
||||
return
|
||||
|
||||
EventScript_16C0C4:: @ 816C0C4
|
||||
takemoney 350, 0
|
||||
removemoney 350, 0
|
||||
return
|
||||
|
||||
EventScript_16C0CB:: @ 816C0CB
|
||||
|
@ -52,8 +52,8 @@ EventScript_16C706:: @ 816C706
|
||||
checkmoney 10000, 0
|
||||
compare VAR_RESULT, FALSE
|
||||
goto_if_eq EventScript_16C7AC
|
||||
givecoins 500
|
||||
takemoney 10000, 0
|
||||
addcoins 500
|
||||
removemoney 10000, 0
|
||||
goto EventScript_16C762
|
||||
end
|
||||
|
||||
@ -64,8 +64,8 @@ EventScript_16C734:: @ 816C734
|
||||
checkmoney 1000, 0
|
||||
compare VAR_RESULT, FALSE
|
||||
goto_if_eq EventScript_16C7AC
|
||||
givecoins 50
|
||||
takemoney 1000, 0
|
||||
addcoins 50
|
||||
removemoney 1000, 0
|
||||
goto EventScript_16C762
|
||||
end
|
||||
|
||||
@ -133,7 +133,7 @@ CeladonCity_GameCorner_EventScript_16C7E7:: @ 816C7E7
|
||||
checkcoins VAR_TEMP_1
|
||||
compare VAR_TEMP_1, 9990
|
||||
goto_if_ge EventScript_16C82B
|
||||
givecoins 10
|
||||
addcoins 10
|
||||
textcolor 3
|
||||
msgbox gUnknown_8196B0D
|
||||
playse SE_SHOP
|
||||
@ -194,7 +194,7 @@ CeladonCity_GameCorner_EventScript_16C89E:: @ 816C89E
|
||||
checkcoins VAR_TEMP_1
|
||||
compare VAR_TEMP_1, 9980
|
||||
goto_if_ge EventScript_16C8E2
|
||||
givecoins 20
|
||||
addcoins 20
|
||||
textcolor 3
|
||||
msgbox gUnknown_8196D47
|
||||
playse SE_SHOP
|
||||
@ -222,7 +222,7 @@ CeladonCity_GameCorner_EventScript_16C8FE:: @ 816C8FE
|
||||
checkcoins VAR_TEMP_1
|
||||
compare VAR_TEMP_1, 9980
|
||||
goto_if_ge EventScript_16C942
|
||||
givecoins 20
|
||||
addcoins 20
|
||||
textcolor 3
|
||||
msgbox gUnknown_8196DF8
|
||||
playse SE_SHOP
|
||||
|
@ -213,7 +213,7 @@ EventScript_16CDA5:: @ 816CDA5
|
||||
end
|
||||
|
||||
EventScript_16CDB3:: @ 816CDB3
|
||||
takecoins VAR_TEMP_2
|
||||
removecoins VAR_TEMP_2
|
||||
updatecoinsbox 0, 5
|
||||
getspeciesname 0, VAR_TEMP_1
|
||||
playfanfare MUS_FANFA1
|
||||
@ -227,7 +227,7 @@ EventScript_16CDB3:: @ 816CDB3
|
||||
end
|
||||
|
||||
EventScript_16CDE0:: @ 816CDE0
|
||||
takecoins VAR_TEMP_2
|
||||
removecoins VAR_TEMP_2
|
||||
updatecoinsbox 0, 5
|
||||
getspeciesname 0, VAR_TEMP_1
|
||||
playfanfare MUS_FANFA1
|
||||
@ -330,7 +330,7 @@ EventScript_16CF3F:: @ 816CF3F
|
||||
checkitemspace VAR_TEMP_1, 1
|
||||
compare VAR_RESULT, FALSE
|
||||
goto_if_eq EventScript_16CF79
|
||||
takecoins VAR_TEMP_2
|
||||
removecoins VAR_TEMP_2
|
||||
updatecoinsbox 0, 5
|
||||
giveitem VAR_TEMP_1
|
||||
goto EventScript_16CC10
|
||||
|
@ -251,7 +251,7 @@ EventScript_16DC68:: @ 816DC68
|
||||
|
||||
EventScript_16DC6A:: @ 816DC6A
|
||||
call EventScript_16DC34
|
||||
goto_if_undefeated TRAINER_BURGLAR_QUINN, EventScript_16DC7A
|
||||
goto_if_not_defeated TRAINER_BURGLAR_QUINN, EventScript_16DC7A
|
||||
releaseall
|
||||
end
|
||||
|
||||
@ -327,7 +327,7 @@ EventScript_16DD31:: @ 816DD31
|
||||
|
||||
EventScript_16DD41:: @ 816DD41
|
||||
call EventScript_16DC34
|
||||
goto_if_undefeated TRAINER_SUPER_NERD_AVERY, EventScript_16DD51
|
||||
goto_if_not_defeated TRAINER_SUPER_NERD_AVERY, EventScript_16DD51
|
||||
releaseall
|
||||
end
|
||||
|
||||
@ -412,7 +412,7 @@ EventScript_16DE0F:: @ 816DE0F
|
||||
|
||||
EventScript_16DE1F:: @ 816DE1F
|
||||
call EventScript_16DC34
|
||||
goto_if_undefeated TRAINER_BURGLAR_RAMON, EventScript_16DE2F
|
||||
goto_if_not_defeated TRAINER_BURGLAR_RAMON, EventScript_16DE2F
|
||||
releaseall
|
||||
end
|
||||
|
||||
@ -488,7 +488,7 @@ EventScript_16DEE6:: @ 816DEE6
|
||||
|
||||
EventScript_16DEF6:: @ 816DEF6
|
||||
call EventScript_16DC34
|
||||
goto_if_undefeated TRAINER_SUPER_NERD_DEREK, EventScript_16DF06
|
||||
goto_if_not_defeated TRAINER_SUPER_NERD_DEREK, EventScript_16DF06
|
||||
releaseall
|
||||
end
|
||||
|
||||
@ -564,7 +564,7 @@ EventScript_16DFBD:: @ 816DFBD
|
||||
|
||||
EventScript_16DFCD:: @ 816DFCD
|
||||
call EventScript_16DC34
|
||||
goto_if_undefeated TRAINER_BURGLAR_DUSTY, EventScript_16DFDD
|
||||
goto_if_not_defeated TRAINER_BURGLAR_DUSTY, EventScript_16DFDD
|
||||
releaseall
|
||||
end
|
||||
|
||||
@ -640,7 +640,7 @@ EventScript_16E094:: @ 816E094
|
||||
|
||||
EventScript_16E0A4:: @ 816E0A4
|
||||
call EventScript_16DC34
|
||||
goto_if_undefeated TRAINER_SUPER_NERD_ZAC, EventScript_16E0B4
|
||||
goto_if_not_defeated TRAINER_SUPER_NERD_ZAC, EventScript_16E0B4
|
||||
releaseall
|
||||
end
|
||||
|
||||
|
@ -113,7 +113,7 @@ EventScript_16D3CA:: @ 816D3CA
|
||||
checkmoney 500, 0
|
||||
compare VAR_RESULT, FALSE
|
||||
goto_if_eq EventScript_16D48C
|
||||
takemoney 500, 0
|
||||
removemoney 500, 0
|
||||
updatemoneybox 0, 0, 0
|
||||
msgbox gUnknown_8197D07
|
||||
textcolor 3
|
||||
|
@ -86,7 +86,7 @@ EventScript_16A402:: @ 816A402
|
||||
compare VAR_TEMP_1, 2
|
||||
call_if_eq EventScript_16A46B
|
||||
playse SE_SHOP
|
||||
takemoney 50, 0
|
||||
removemoney 50, 0
|
||||
updatemoneybox 0, 0, 0
|
||||
waitse
|
||||
msgbox gUnknown_8190505
|
||||
|
@ -4,7 +4,7 @@ RocketHideout_B1F_MapScripts:: @ 8161195
|
||||
.byte 0
|
||||
|
||||
RocketHideout_B1F_OnLoad:: @ 81611A0
|
||||
call_if_undefeated TRAINER_TEAM_ROCKET_GRUNT_12 EventScript_161233
|
||||
call_if_not_defeated TRAINER_TEAM_ROCKET_GRUNT_12 EventScript_161233
|
||||
end
|
||||
|
||||
RocketHideout_B1F_OnTransition:: @ 81611AA
|
||||
|
@ -105,7 +105,7 @@ EventScript_16F86A:: @ 816F86A
|
||||
end
|
||||
|
||||
EventScript_16F86F:: @ 816F86F
|
||||
takemoney 500, 0
|
||||
removemoney 500, 0
|
||||
updatemoneybox 0, 0, 0
|
||||
playfanfare MUS_FANFA1
|
||||
message Text_19DBD3
|
||||
|
@ -69,12 +69,12 @@ gScriptCmdTable:: @ 815F9B4
|
||||
.4byte ScrCmd_setholewarp
|
||||
.4byte ScrCmd_getplayerxy
|
||||
.4byte ScrCmd_getpartysize
|
||||
.4byte ScrCmd_giveitem
|
||||
.4byte ScrCmd_takeitem
|
||||
.4byte ScrCmd_additem
|
||||
.4byte ScrCmd_removeitem
|
||||
.4byte ScrCmd_checkitemspace
|
||||
.4byte ScrCmd_checkitem
|
||||
.4byte ScrCmd_checkitemtype
|
||||
.4byte ScrCmd_givepcitem
|
||||
.4byte ScrCmd_addpcitem
|
||||
.4byte ScrCmd_checkpcitem
|
||||
.4byte ScrCmd_givedecoration
|
||||
.4byte ScrCmd_takedecoration
|
||||
@ -145,8 +145,8 @@ gScriptCmdTable:: @ 815F9B4
|
||||
.4byte ScrCmd_showcontestresults
|
||||
.4byte ScrCmd_contestlinktransfer
|
||||
.4byte ScrCmd_random
|
||||
.4byte ScrCmd_givemoney
|
||||
.4byte ScrCmd_takemoney
|
||||
.4byte ScrCmd_addmoney
|
||||
.4byte ScrCmd_removemoney
|
||||
.4byte ScrCmd_checkmoney
|
||||
.4byte ScrCmd_showmoneybox
|
||||
.4byte ScrCmd_hidemoneybox
|
||||
@ -181,8 +181,8 @@ gScriptCmdTable:: @ 815F9B4
|
||||
.4byte ScrCmd_addelevmenuitem
|
||||
.4byte ScrCmd_showelevmenu
|
||||
.4byte ScrCmd_checkcoins
|
||||
.4byte ScrCmd_givecoins
|
||||
.4byte ScrCmd_takecoins
|
||||
.4byte ScrCmd_addcoins
|
||||
.4byte ScrCmd_removecoins
|
||||
.4byte ScrCmd_setwildbattle
|
||||
.4byte ScrCmd_dowildbattle
|
||||
.4byte ScrCmd_setvaddress
|
||||
|
@ -217,7 +217,7 @@ EventScript_TryPickUpHiddenCoins::
|
||||
specialvar VAR_RESULT, Special_CheckAddCoins
|
||||
compare VAR_RESULT, FALSE
|
||||
goto_if_eq EventScript_HiddenCoinsButCaseIsFull
|
||||
givecoins VAR_0x8006
|
||||
addcoins VAR_0x8006
|
||||
getstdstring 1, 0x17
|
||||
call EventScript_PlayFanfareObtainedItem
|
||||
call EventScript_FoundCoins
|
||||
|
@ -8,7 +8,7 @@ void ShowCoinsWindow(u32 coinAmount, u8 x, u8 y);
|
||||
void HideCoinsWindow(void);
|
||||
u16 GetCoins(void);
|
||||
void SetCoins(u16 coinAmount);
|
||||
bool8 GiveCoins(u16 toAdd);
|
||||
bool8 TakeCoins(u16 toSub);
|
||||
bool8 AddCoins(u16 toAdd);
|
||||
bool8 RemoveCoins(u16 toSub);
|
||||
|
||||
#endif // GUARD_COINS_H
|
||||
|
@ -19,7 +19,7 @@ void SetCoins(u16 coinAmount)
|
||||
gSaveBlock1Ptr->coins = coinAmount ^ gSaveBlock2Ptr->encryptionKey;
|
||||
}
|
||||
|
||||
bool8 GiveCoins(u16 toAdd)
|
||||
bool8 AddCoins(u16 toAdd)
|
||||
{
|
||||
u16 coins = GetCoins();
|
||||
if (coins >= MAX_COINS)
|
||||
@ -39,7 +39,7 @@ bool8 GiveCoins(u16 toAdd)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 TakeCoins(u16 toSub)
|
||||
bool8 RemoveCoins(u16 toSub)
|
||||
{
|
||||
u16 coins = GetCoins();
|
||||
if (coins >= toSub)
|
||||
|
18
src/scrcmd.c
18
src/scrcmd.c
@ -463,7 +463,7 @@ bool8 ScrCmd_random(struct ScriptContext *ctx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_giveitem(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_additem(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
||||
u32 quantity = VarGet(ScriptReadHalfword(ctx));
|
||||
@ -473,7 +473,7 @@ bool8 ScrCmd_giveitem(struct ScriptContext *ctx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_takeitem(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_removeitem(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
||||
u32 quantity = VarGet(ScriptReadHalfword(ctx));
|
||||
@ -508,7 +508,7 @@ bool8 ScrCmd_checkitemtype(struct ScriptContext *ctx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_givepcitem(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_addpcitem(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 quantity = VarGet(ScriptReadHalfword(ctx));
|
||||
@ -1797,7 +1797,7 @@ bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_givemoney(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_addmoney(struct ScriptContext *ctx)
|
||||
{
|
||||
u32 amount = ScriptReadWord(ctx);
|
||||
u8 ignore = ScriptReadByte(ctx);
|
||||
@ -1807,7 +1807,7 @@ bool8 ScrCmd_givemoney(struct ScriptContext *ctx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_takemoney(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_removemoney(struct ScriptContext *ctx)
|
||||
{
|
||||
u32 amount = ScriptReadWord(ctx);
|
||||
u8 ignore = ScriptReadByte(ctx);
|
||||
@ -2202,22 +2202,22 @@ bool8 ScrCmd_checkcoins(struct ScriptContext *ctx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_givecoins(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_addcoins(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 coins = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
if (GiveCoins(coins) == TRUE)
|
||||
if (AddCoins(coins) == TRUE)
|
||||
gSpecialVar_Result = 0;
|
||||
else
|
||||
gSpecialVar_Result = 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_takecoins(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_removecoins(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 coins = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
if (TakeCoins(coins) == TRUE)
|
||||
if (RemoveCoins(coins) == TRUE)
|
||||
gSpecialVar_Result = 0;
|
||||
else
|
||||
gSpecialVar_Result = 1;
|
||||
|
@ -768,7 +768,7 @@ static void MainTask_SlotsGameLoop(u8 taskId)
|
||||
else if (JOY_NEW(DPAD_DOWN))
|
||||
{
|
||||
sSlotMachineState->bet++;
|
||||
TakeCoins(1);
|
||||
RemoveCoins(1);
|
||||
PlaySE(SE_REGI);
|
||||
sub_8141148(8, 0);
|
||||
sub_8141148(2, 1);
|
||||
@ -780,7 +780,7 @@ static void MainTask_SlotsGameLoop(u8 taskId)
|
||||
if (GetCoins() >= toAdd)
|
||||
{
|
||||
sSlotMachineState->bet = 3;
|
||||
TakeCoins(toAdd);
|
||||
RemoveCoins(toAdd);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -927,7 +927,7 @@ static void MainTask_ConfirmExitGame(u8 taskId)
|
||||
switch (Menu_ProcessInputNoWrapClearOnChoose())
|
||||
{
|
||||
case 0:
|
||||
GiveCoins(sSlotMachineState->bet);
|
||||
AddCoins(sSlotMachineState->bet);
|
||||
sub_8141148(8, 0);
|
||||
data[0] = 3;
|
||||
break;
|
||||
@ -1008,7 +1008,7 @@ static void MainTask_WinHandlePayout(u8 taskId)
|
||||
{
|
||||
if (IsFanfareTaskInactive() && JOY_NEW(START_BUTTON))
|
||||
{
|
||||
GiveCoins(sSlotMachineState->payout);
|
||||
AddCoins(sSlotMachineState->payout);
|
||||
sSlotMachineState->payout = 0;
|
||||
}
|
||||
else
|
||||
@ -1020,7 +1020,7 @@ static void MainTask_WinHandlePayout(u8 taskId)
|
||||
PlaySE(SE_PIN);
|
||||
if (sSlotMachineState->payout != 0)
|
||||
{
|
||||
GiveCoins(1);
|
||||
AddCoins(1);
|
||||
sSlotMachineState->payout--;
|
||||
}
|
||||
data[1] = 8;
|
||||
|
Loading…
x
Reference in New Issue
Block a user