Sync macros to have Give/Take Add/Remove unity

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