diff options
author | Rangi42 <remy.oukaour+rangi42@gmail.com> | 2018-02-26 11:28:46 -0500 |
---|---|---|
committer | Rangi42 <remy.oukaour+rangi42@gmail.com> | 2018-02-26 11:28:46 -0500 |
commit | 83af28e32f2bfcde9210c06bc5eb6466f92e4aa2 (patch) | |
tree | 7f5a34575b27d4d8f871a373ac1b4978f8657497 /Automatically-reuse-Repel.md | |
parent | aaedef5dd3edff15a809b4c3e0f9c4e6eaa310c5 (diff) |
Add more tables of contents, and commit the script used
Diffstat (limited to 'Automatically-reuse-Repel.md')
-rw-r--r-- | Automatically-reuse-Repel.md | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Automatically-reuse-Repel.md b/Automatically-reuse-Repel.md index 8c1db9a..aba0ce8 100644 --- a/Automatically-reuse-Repel.md +++ b/Automatically-reuse-Repel.md @@ -2,13 +2,16 @@ Starting in B2/W2, when a Repel, Super Repel, or Max Repel expires and you have Implementing this feature in Gen 2 is relatively simple, but does involve a number of different areas: -- WRAM and SRAM need space to save the type of Repel -- The Repel item effect needs to save its type -- The script that notifies when a Repel wears off needs to check if you have another one and let you choose to reuse it -- There needs to be an alternative notification message including the "Use another?" question text +## Contents +1. [Add space in WRAM and SRAM for the type of Repel used](#1-add-space-in-wram-and-sram-for-the-type-of-repel-used) +2. [Store the type when a Repel is used](#2-store-the-type-when-a-repel-is-used) +3. [Check if you have more of the last-used type when one wears off](#3-check-if-you-have-more-of-the-last-used-type-when-one-wears-off) +4. [Ask whether to use another Repel, and do so, if applicable](#4-ask-whether-to-use-another-repel-and-do-so-if-applicable) +5. [Define the "Use another?" message](#5-define-the-use-another-message) -## 1. Add space in RAM for `wRepelType` + +## 1. Add space in WRAM and SRAM for the type of Repel used There's already this line in [wram.asm](../blob/master/wram.asm): @@ -32,22 +35,22 @@ wKurtApricornQuantity:: db ``` -## 2. Store `wRepelType` when a Repel is used +## 2. Store the type when a Repel is used The file that defines item effects is, predictably, [engine/item_effects.asm](../blob/master/engine/item_effects.asm). It turns out that Repel, Super Repel, and Max Repel all use the same code, so we don't have to write anything three times. ```diff -SuperRepel: ; f462 +SuperRepelEffect: ; f462 ld b, 200 jr UseRepel ; f466 -MaxRepel: ; f466 +MaxRepelEffect: ; f466 ld b, 250 jr UseRepel ; f466 -Repel: ; f46a +RepelEffect: ; f46a ld b, 100 ; f46c @@ -72,7 +75,7 @@ TextJump_RepelUsedEarlierIsStillInEffect: ; 0xf47d ``` -## 3. Ask whether to reuse Repel +## 3. Check if you have more of the last-used type when one wears off Edit [engine/events.asm](../blob/master/engine/events.asm): @@ -105,7 +108,7 @@ DoRepelStep: ; 96bd7 Note that `UseAnotherRepelScript` hasn't been defined yet, so we'll do that next. -## 4. Define `UseAnotherRepelScript` +## 4. Ask whether to use another Repel, and do so, if applicable Edit [engine/events/misc_scripts_2.asm](../blob/master/engine/events/misc_scripts_2.asm): @@ -140,7 +143,7 @@ RepelWoreOffScript:: ; 0x13619 Again, we have not yet defined `UseAnotherRepelText`, so let's finish up with that. -## 5. Define `UseAnotherRepelText` +## 5. Define the "Use another?" message Edit [data/text/common_1.asm](../blob/master/data/text/common_1.asm): |