Skip to content

Commit

Permalink
Document shard move tutors code
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudf committed Feb 9, 2025
1 parent f1ac42f commit e3075ee
Show file tree
Hide file tree
Showing 13 changed files with 702 additions and 715 deletions.
50 changes: 26 additions & 24 deletions asm/macros/scrcmd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
.short 48
.endm

// This also sets the player's direction appropriately when a pad
// This also sets the player's direction appropriately when a pad
// button is pressed, unlike the WaitABPadPress command.
.macro WaitABXPadPress
.short 49
Expand Down Expand Up @@ -671,7 +671,7 @@
.short \arg0
.endm

// If the player has no space left in the bag, resultVar will be set to FALSE
// If the player has no space left in the bag, resultVar will be set to FALSE
.macro AddItem item, count, resultVar
.short 123
.short \item
Expand Down Expand Up @@ -2195,7 +2195,7 @@
.short \destVarID
.endm

// Counts alive mons in the party and stores the result in the destVar,
// Counts alive mons in the party and stores the result in the destVar,
// but excludes the one at the party slot provided.
.macro CountAliveMonsExcept destVarID, partySlot
.short 411
Expand Down Expand Up @@ -4024,18 +4024,19 @@
.short \arg2
.endm

.macro ScrCmd_2E5 arg0, arg1, arg2
// resultVar will be set to TRUE if the pokemon has at least one move it can learn at the given location and doesn't know yet
.macro HasLearnableTutorMoves partySlot, location, resultVar
.short 741
.short \arg0
.short \arg1
.short \arg2
.short \partySlot
.short \location
.short \resultVar
.endm

.macro ScrCmd_2E6 arg0, arg1, arg2
.macro ShowMoveTutorMoveSelectionMenu partySlot, location, outSelectedOption
.short 742
.short \arg0
.short \arg1
.short \arg2
.short \partySlot
.short \location
.short \outSelectedOption
.endm

.macro ScrCmd_2E7 arg0, arg1
Expand All @@ -4049,33 +4050,34 @@
.short \arg0
.endm

.macro ScrCmd_2E9 arg0, arg1, arg2
.macro ResetMoveSlot partySlot, moveID, moveSlot
.short 745
.short \arg0
.short \arg1
.short \arg2
.short \partySlot
.short \moveID
.short \moveSlot
.endm

.macro ScrCmd_2EA arg0, arg1
// resultVar will be set to TRUE if the move is available at a shards move tutor and the player can afford it
.macro CanAffordMove moveID, resultVar
.short 746
.short \arg0
.short \arg1
.short \moveID
.short \resultVar
.endm

.macro ScrCmd_2EB arg0
.macro PayShardsCost moveID
.short 747
.short \arg0
.short \moveID
.endm

.macro ScrCmd_2EC arg0, arg1, arg2, arg3
.macro ShowShardsCost arg0, arg1, selectedMove, outSelectedOption
.short 748
.byte \arg0
.byte \arg1
.short \arg2
.short \arg3
.short \selectedMove
.short \outSelectedOption
.endm

.macro ScrCmd_2ED
.macro CloseShardsCostWindow
.short 749
.endm

Expand Down
15 changes: 15 additions & 0 deletions include/overlay005/move_tutor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef POKEPLATINUM_MOVE_TUTOR_H
#define POKEPLATINUM_MOVE_TUTOR_H

#include "field_script_context.h"

BOOL ScrCmd_HasSeenSpecies(ScriptContext *ctx);
BOOL ScrCmd_HasLearnableTutorMoves(ScriptContext *ctx);
BOOL ScrCmd_ResetMoveSlot(ScriptContext *ctx);
BOOL ScrCmd_CanAffordMove(ScriptContext *ctx);
BOOL ScrCmd_PayShardsCost(ScriptContext *ctx);
BOOL ScrCmd_ShowMoveTutorMoveSelectionMenu(ScriptContext *ctx);
BOOL ScrCmd_ShowShardsCost(ScriptContext *ctx);
BOOL ScrCmd_CloseShardCostWindow(ScriptContext *ctx);

#endif // POKEPLATINUM_MOVE_TUTOR_H
15 changes: 0 additions & 15 deletions include/overlay005/ov5_021F77A8.h

This file was deleted.

6 changes: 0 additions & 6 deletions include/overlay005/struct_ov5_021F7ED8_decl.h

This file was deleted.

2 changes: 1 addition & 1 deletion platinum.us/main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ Overlay overlay5
Object main.nef.p/src_overlay005_ov5_021F600C.c.o
Object main.nef.p/src_overlay005_ov5_021F61BC.c.o
Object main.nef.p/src_overlay005_ov5_021F6454.c.o
Object main.nef.p/src_overlay005_ov5_021F77A8.c.o
Object main.nef.p/src_overlay005_move_tutor.c.o
Object main.nef.p/src_overlay005_ov5_021F8370.c.o
Object main.nef.p/src_overlay005_ov5_021F8560.c.o
}
Expand Down
10 changes: 5 additions & 5 deletions res/field/scripts/scripts_route_212_house.s
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ _007E:
GoToIfEq 0x8000, 0xFF, _0264
ScrCmd_198 0x8000, 0x8001
GoToIfEq 0x8001, 0, _0259
ScrCmd_2E5 0x8000, 0, 0x800C
HasLearnableTutorMoves 0x8000, 0, 0x800C
GoToIfEq 0x800C, 0, _026F
BufferPartyMonNickname 0, 0x8000
Message 5
ScrCmd_2E6 0x8000, 0, 0x800C
ShowMoveTutorMoveSelectionMenu 0x8000, 0, 0x800C
SetVar 0x8003, 0x800C
GoToIfEq 0x8003, -2, _0264
ScrCmd_2EA 0x8003, 0x800C
CanAffordMove 0x8003, 0x800C
GoToIfEq 0x800C, 0, _027A
ScrCmd_1C8 0x800C, 0x8000
SetVar 0x8002, 0x800C
Expand Down Expand Up @@ -145,8 +145,8 @@ _0224:
End

_0245:
ScrCmd_2EB 0x8003
ScrCmd_2E9 0x8000, 0x8002, 0x8003
PayShardsCost 0x8003
ResetMoveSlot 0x8000, 0x8002, 0x8003
GoTo _0264
End

Expand Down
10 changes: 5 additions & 5 deletions res/field/scripts/scripts_snowpoint_city_east_house.s
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ _00B0:
GoToIfEq 0x8000, 0xFF, _0296
ScrCmd_198 0x8000, 0x8001
GoToIfEq 0x8001, 0, _028B
ScrCmd_2E5 0x8000, 2, 0x800C
HasLearnableTutorMoves 0x8000, 2, 0x800C
GoToIfEq 0x800C, 0, _02A1
BufferPartyMonNickname 0, 0x8000
Message 12
ScrCmd_2E6 0x8000, 2, 0x800C
ShowMoveTutorMoveSelectionMenu 0x8000, 2, 0x800C
SetVar 0x8003, 0x800C
GoToIfEq 0x8003, -2, _0296
ScrCmd_2EA 0x8003, 0x800C
CanAffordMove 0x8003, 0x800C
GoToIfEq 0x800C, 0, _02AC
ScrCmd_1C8 0x800C, 0x8000
SetVar 0x8002, 0x800C
Expand Down Expand Up @@ -149,8 +149,8 @@ _0256:
End

_0277:
ScrCmd_2EB 0x8003
ScrCmd_2E9 0x8000, 0x8002, 0x8003
PayShardsCost 0x8003
ResetMoveSlot 0x8000, 0x8002, 0x8003
GoTo _0296
End

Expand Down
10 changes: 5 additions & 5 deletions res/field/scripts/scripts_survival_area_north_house.s
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ _004C:
GoToIfEq 0x8000, 0xFF, _0232
ScrCmd_198 0x8000, 0x8001
GoToIfEq 0x8001, 0, _0227
ScrCmd_2E5 0x8000, 1, 0x800C
HasLearnableTutorMoves 0x8000, 1, 0x800C
GoToIfEq 0x800C, 0, _023D
BufferPartyMonNickname 0, 0x8000
Message 5
ScrCmd_2E6 0x8000, 1, 0x800C
ShowMoveTutorMoveSelectionMenu 0x8000, 1, 0x800C
SetVar 0x8003, 0x800C
GoToIfEq 0x8003, -2, _0232
ScrCmd_2EA 0x8003, 0x800C
CanAffordMove 0x8003, 0x800C
GoToIfEq 0x800C, 0, _0248
ScrCmd_1C8 0x800C, 0x8000
SetVar 0x8002, 0x800C
Expand Down Expand Up @@ -120,8 +120,8 @@ _01F2:
End

_0213:
ScrCmd_2EB 0x8003
ScrCmd_2E9 0x8000, 0x8002, 0x8003
PayShardsCost 0x8003
ResetMoveSlot 0x8000, 0x8002, 0x8003
GoTo _0232
End

Expand Down
6 changes: 3 additions & 3 deletions res/field/scripts/scripts_unk_0211.s
Original file line number Diff line number Diff line change
Expand Up @@ -1689,12 +1689,12 @@ _165E:

_1672:
Message 129
ScrCmd_2E6 0xFF, 0x8004, 0x800C
ShowMoveTutorMoveSelectionMenu 0xFF, 0x8004, 0x800C
SetVar 0x8003, 0x800C
GoToIfEq 0x8003, -2, _16A4
ScrCmd_2EC 21, 1, 0x8003, 0x800C
ShowShardsCost 21, 1, 0x8003, 0x800C
WaitABPress
ScrCmd_2ED
CloseShardsCostWindow
GoTo _16A4
End

Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ pokeplatinum_c = files(
'overlay005/ov5_021F600C.c',
'overlay005/ov5_021F61BC.c',
'overlay005/ov5_021F6454.c',
'overlay005/ov5_021F77A8.c',
'overlay005/move_tutor.c',
'overlay005/ov5_021F8370.c',
'overlay005/ov5_021F8560.c',
'overlay005/ov5_021FAF40.c',
Expand Down
Loading

0 comments on commit e3075ee

Please sign in to comment.