summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-05-28 17:43:51 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-05-28 17:43:51 -0400
commitc93574436f30106fd2211abea452fe3a96948211 (patch)
tree3147c82a48ccd933576cdc485e54d7e13677df85
parent40fce3a7d2959eaa2eaf38b3b9ff2bfc583c6e8d (diff)
Viridian Mart
-rw-r--r--constants/event_macros.asm21
-rwxr-xr-xconstants/hide_show_constants.asm2
-rw-r--r--data/map_header_banks.asm2
-rw-r--r--data/map_header_pointers.asm2
-rwxr-xr-xmain.asm15
-rw-r--r--maps/ceruleanmart.blk2
-rw-r--r--maps/cinnabarmart.blk2
-rw-r--r--maps/fuchsiamart.blk2
-rw-r--r--maps/lavendermart.blk2
-rw-r--r--maps/pewtermart.blk2
-rw-r--r--maps/saffronmart.blk2
-rw-r--r--maps/vermilionmart.blk2
-rw-r--r--maps/viridianmart.blk2
-rwxr-xr-xscripts/viridianmart.asm16
14 files changed, 60 insertions, 14 deletions
diff --git a/constants/event_macros.asm b/constants/event_macros.asm
index 9f24ace7..5eb73147 100644
--- a/constants/event_macros.asm
+++ b/constants/event_macros.asm
@@ -125,6 +125,27 @@ CheckAndResetEventA: MACRO
ld [wEventFlags + ((\1) / 8)], a
ENDM
+CheckAndSetEventReuseHL: MACRO
+ IF event_byte != ((\1) / 8)
+event_byte = ((\1) / 8)
+ ld hl, wEventFlags + event_byte
+ ENDC
+
+ bit (\1) % 8, [hl]
+ set (\1) % 8, [hl]
+ ENDM
+
+CheckAndResetEventReuseHL: MACRO
+ IF event_byte != ((\1) / 8)
+event_byte = ((\1) / 8)
+ ld hl, wEventFlags + event_byte
+ ENDC
+
+ bit (\1) % 8, [hl]
+ res (\1) % 8, [hl]
+ ENDM
+
+
;\1 = event index
SetEvent: MACRO
event_byte = ((\1) / 8)
diff --git a/constants/hide_show_constants.asm b/constants/hide_show_constants.asm
index 5a6347d5..9481466e 100755
--- a/constants/hide_show_constants.asm
+++ b/constants/hide_show_constants.asm
@@ -8,7 +8,7 @@ const_value = 0
const HS_PALLET_TOWN_OAK ; 00
const HS_LYING_OLD_MAN ; 01
- const HS_PERSON_02 ; 02
+ const HS_OLD_MAN_1 ; 02
const HS_OLD_MAN ; 03
const HS_MUSEUM_GUY ; 04
const HS_GYM_GUY ; 05
diff --git a/data/map_header_banks.asm b/data/map_header_banks.asm
index 2b901ed5..dbe4d15f 100644
--- a/data/map_header_banks.asm
+++ b/data/map_header_banks.asm
@@ -42,7 +42,7 @@ MapHeaderBanks:: ; fc3e4 (3f:43e4)
db BANK(BluesHouse_h)
db BANK(OaksLab_h)
db BANK(ViridianPokecenter_h)
- db $07 ; db BANK(ViridianMart_h)
+ db BANK(ViridianMart_h)
db $07 ; db BANK(School_h)
db $07 ; db BANK(ViridianHouse_h)
db $1d ; db BANK(ViridianGym_h)
diff --git a/data/map_header_pointers.asm b/data/map_header_pointers.asm
index 9d358b2d..e3edc139 100644
--- a/data/map_header_pointers.asm
+++ b/data/map_header_pointers.asm
@@ -42,7 +42,7 @@ MapHeaderPointers:: ; fc1f2 (3f:41f2)
dw BluesHouse_h
dw OaksLab_h ;id=40
dw ViridianPokecenter_h
- dw $4c6e ; dw ViridianMart_h
+ dw ViridianMart_h
dw $4d6d ; dw School_h
dw $4dc6 ; dw ViridianHouse_h
dw $40d4 ; dw ViridianGym_h
diff --git a/main.asm b/main.asm
index 926e8984..325bcdbe 100755
--- a/main.asm
+++ b/main.asm
@@ -304,7 +304,20 @@ INCLUDE "data/mapHeaders/oakslab.asm"
INCLUDE "scripts/oakslab.asm"
INCLUDE "data/mapObjects/oakslab.asm"
- dr $1cc6e,$1e2ae ; map scripts
+INCLUDE "data/mapHeaders/viridianmart.asm"
+INCLUDE "scripts/viridianmart.asm"
+INCLUDE "data/mapObjects/viridianmart.asm"
+ViridianMartBlocks:
+PewterMartBlocks:
+CeruleanMartBlocks:
+VermilionMartBlocks:
+LavenderMartBlocks:
+CeladonMartBlocks:
+SaffronMartBlocks:
+FuchsiaMartBlocks:
+CinnabarMartBlocks:
+INCBIN "maps/viridianmart.blk"
+ dr $1cd6d,$1e2ae ; map scripts
INCLUDE "engine/menu/oaks_pc.asm"
diff --git a/maps/ceruleanmart.blk b/maps/ceruleanmart.blk
index 1da8fffc..62385406 100644
--- a/maps/ceruleanmart.blk
+++ b/maps/ceruleanmart.blk
@@ -1 +1 @@
-   \ No newline at end of file
+ %  \ No newline at end of file
diff --git a/maps/cinnabarmart.blk b/maps/cinnabarmart.blk
index 1da8fffc..62385406 100644
--- a/maps/cinnabarmart.blk
+++ b/maps/cinnabarmart.blk
@@ -1 +1 @@
-   \ No newline at end of file
+ %  \ No newline at end of file
diff --git a/maps/fuchsiamart.blk b/maps/fuchsiamart.blk
index 1da8fffc..62385406 100644
--- a/maps/fuchsiamart.blk
+++ b/maps/fuchsiamart.blk
@@ -1 +1 @@
-   \ No newline at end of file
+ %  \ No newline at end of file
diff --git a/maps/lavendermart.blk b/maps/lavendermart.blk
index 1da8fffc..62385406 100644
--- a/maps/lavendermart.blk
+++ b/maps/lavendermart.blk
@@ -1 +1 @@
-   \ No newline at end of file
+ %  \ No newline at end of file
diff --git a/maps/pewtermart.blk b/maps/pewtermart.blk
index 1da8fffc..62385406 100644
--- a/maps/pewtermart.blk
+++ b/maps/pewtermart.blk
@@ -1 +1 @@
-   \ No newline at end of file
+ %  \ No newline at end of file
diff --git a/maps/saffronmart.blk b/maps/saffronmart.blk
index 1da8fffc..62385406 100644
--- a/maps/saffronmart.blk
+++ b/maps/saffronmart.blk
@@ -1 +1 @@
-   \ No newline at end of file
+ %  \ No newline at end of file
diff --git a/maps/vermilionmart.blk b/maps/vermilionmart.blk
index 1da8fffc..62385406 100644
--- a/maps/vermilionmart.blk
+++ b/maps/vermilionmart.blk
@@ -1 +1 @@
-   \ No newline at end of file
+ %  \ No newline at end of file
diff --git a/maps/viridianmart.blk b/maps/viridianmart.blk
index 1da8fffc..62385406 100644
--- a/maps/viridianmart.blk
+++ b/maps/viridianmart.blk
@@ -1 +1 @@
-   \ No newline at end of file
+ %  \ No newline at end of file
diff --git a/scripts/viridianmart.asm b/scripts/viridianmart.asm
index 8d974abc..05e566fb 100755
--- a/scripts/viridianmart.asm
+++ b/scripts/viridianmart.asm
@@ -3,7 +3,8 @@ ViridianMartScript: ; 1d46e (7:546e)
call EnableAutoTextBoxDrawing
ld hl, ViridianMartScriptPointers
ld a, [W_VIRIDIANMARKETCURSCRIPT]
- jp JumpTable
+ call JumpTable
+ ret
ViridianMartScript_1d47d: ; 1d47d (7:547d)
CheckEvent EVENT_OAK_GOT_PARCEL
@@ -57,8 +58,19 @@ ViridianMartScript1: ; 1d4c0 (7:54c0)
SetEvent EVENT_GOT_OAKS_PARCEL
ld a, $2
ld [W_VIRIDIANMARKETCURSCRIPT], a
- ; fallthrough
+ ret
+
ViridianMartScript2: ; 1d4df (7:54df)
+ CheckEventHL EVENT_02D
+ ret z
+ CheckAndSetEventReuseHL EVENT_02C
+ ret nz
+ ld a, HS_OLD_MAN
+ ld [wMissableObjectIndex], a
+ predef HideObject
+ ld a, HS_OLD_MAN_1
+ ld [wMissableObjectIndex], a
+ predef ShowObject
ret
ViridianMartTextPointers: ; 1d4e0 (7:54e0)