diff options
author | Pokeglitch <pokeglitchx@gmail.com> | 2018-06-18 08:41:39 -0400 |
---|---|---|
committer | Pokeglitch <pokeglitchx@gmail.com> | 2018-06-18 08:41:39 -0400 |
commit | 12823eea3ea185d98e06320a0ee1a3baba1a0986 (patch) | |
tree | 1266f7289685c6d205f848a49afe938390a1ce2a | |
parent | a9ae89792cd54bf32e619eb00f38d16cbfaaf656 (diff) |
Added in macros for scripts, queue
-rw-r--r-- | constants/move_constants.asm | 2 | ||||
-rw-r--r-- | constants/pokemon_data_constants.asm | 2 | ||||
-rwxr-xr-x | constants/script_constants.asm | 2 | ||||
-rw-r--r-- | constants/wram_constants.asm | 2 | ||||
-rw-r--r-- | data/predef_pointers.inc | 6 | ||||
-rwxr-xr-x | engine/bcd.asm | 2 | ||||
-rwxr-xr-x | engine/events/field_moves.asm | 111 | ||||
-rwxr-xr-x | engine/items/item_effects.asm | 2 | ||||
-rwxr-xr-x | engine/overworld/spawn_points.asm | 1 | ||||
-rwxr-xr-x | engine/pokemon/health.asm | 1 | ||||
-rwxr-xr-x | home/music.asm | 4 | ||||
-rw-r--r-- | home/names.asm | 2 |
12 files changed, 70 insertions, 67 deletions
diff --git a/constants/move_constants.asm b/constants/move_constants.asm index dee94ff..4c26c04 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -296,4 +296,4 @@ NUM_ATTACKS EQU const_value + -1 const BATTLEANIM_HIT_CONFUSION -MOVE_DATA_SIZE EQU 7
\ No newline at end of file +MOVE_DATA_SIZE EQU 7 diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 9038685..e9ed0c1 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -134,4 +134,4 @@ PP_MASK EQU %00111111 ; HP ENEMY_HP_BAR EQU 0 BATTLE_HP_BAR EQU 1 -POKEMON_MENU_HP_BAR EQU 2
\ No newline at end of file +POKEMON_MENU_HP_BAR EQU 2 diff --git a/constants/script_constants.asm b/constants/script_constants.asm index 4a6390e..702e400 100755 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -19,4 +19,4 @@ SCRIPT_FAIL EQU 0 ; Some script don't combine the return value with the flag
; Instead, they load this into the wFieldMoveScriptID, and keep
; the return value in a
-SCRIPT_FINISHED EQU -1
\ No newline at end of file +SCRIPT_FINISHED EQU -1
diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 32a0379..c530a8b 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -20,4 +20,4 @@ PLAYER_NORMAL EQU 0 PLAYER_BIKE EQU 1 PLAYER_SKATE EQU 2 PLAYER_SURF EQU 4 -PLAYER_SURF_PIKA EQU 8
\ No newline at end of file +PLAYER_SURF_PIKA EQU 8 diff --git a/data/predef_pointers.inc b/data/predef_pointers.inc index 57a30e5..3ee6205 100644 --- a/data/predef_pointers.inc +++ b/data/predef_pointers.inc @@ -19,10 +19,10 @@ PredefPointers:: ; 1:62d3 add_predef GetItemAmount add_predef HealParty add_predef AddBCD - dbw BANK(AddBCD), AddBCD ; 8 - dbw BANK(AddBCD), AddBCD + dba AddBCD ; 8 + dba AddBCD add_predef SubBCD - dbw BANK(GetItemAmount), GetItemAmount + dba GetItemAmount add_predef SmallFarFlagAction GiveItemPredef:: dbw 3, GiveItem diff --git a/engine/bcd.asm b/engine/bcd.asm index 53f0b20..020dc64 100755 --- a/engine/bcd.asm +++ b/engine/bcd.asm @@ -52,4 +52,4 @@ SubBCD: ; 03:4df9 jr nz, .fill
scf
.done
- ret
\ No newline at end of file + ret
diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 7650715..15c2d27 100755 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -1,50 +1,58 @@ INCLUDE "constants.asm"
+jump_dest: MACRO
+\1JumpTable
+ dw \1
+ENDM
+
+next_jump: MACRO
+ ld a, (\1JumpTable - .JumpTable) / 2
+ ld [wFieldMoveScriptID], a
+ENDM
+
; TODO - need to constantize tile ids, movements
SECTION "Field Moves", ROMX[$4fab], BANK[$03]
CutFunction: ; 03:4fab
call .reset
-.loop
- call .next
- jr nc, .loop
+.next_script
+ call .run_script
+ jr nc, .next_script
ld [wFieldMoveSucceeded], a
ret
.reset
xor a
ld [wFieldMoveScriptID], a
ret
-.next
+.run_script
ld a, [wFieldMoveScriptID]
- ld hl, CutTable
+ ld hl, .JumpTable
jp CallJumptable
-CutTable
- dw TryCut
- dw CheckCuttableBlock
- dw CheckCuttableTile
- dw DoCut
- dw DoCut
- dw FailCut
-
-TryCut: ; 03:4fd1
+.JumpTable
+ jump_dest .TryCut
+ jump_dest .CheckCuttableBlock
+ jump_dest .CheckCuttableTile
+ jump_dest .DoCut
+ jump_dest .DoCut2
+ jump_dest .FailCut
+
+.TryCut ; 03:4fd1
call GetMapEnvironment
cp ROUTE
jr z, .success
cp TOWN
jr z, .success
- ld a, SCRIPT_ID_05
- ld [wFieldMoveScriptID], a
+ next_jump .FailCut
xor a
ret
.success
- ld a, SCRIPT_ID_01
- ld [wFieldMoveScriptID], a
+ next_jump .CheckCuttableBlock
xor a
ret
-CheckCuttableBlock: ; 03:4fea
+.CheckCuttableBlock ; 03:4fea
call GetFacingTileCoord
cp $80
jr nz, .fail
@@ -54,35 +62,33 @@ CheckCuttableBlock: ; 03:4fea ld a, h
ld [wMapBlocksAddress + 1], a
ld a, [hl]
- call GetCutReplacementBlock
+ call .GetCutReplacementBlock
jr nc, .fail
dec hl
ld a, [hl]
ld [wReplacementBlock], a
- ld a, SCRIPT_ID_04
- ld [wFieldMoveScriptID], a
+ next_jump .DoCut2
xor a
ret
.fail
- ld a, SCRIPT_ID_02
- ld [wFieldMoveScriptID], a
+ next_jump .CheckCuttableTile
xor a
ret
-GetCutReplacementBlock:
+.GetCutReplacementBlock ;TODO - address
ld c, a
- ld hl, CutReplacementBlocks
-.loop
+ ld hl, .CutReplacementBlocks
+.loop1
ld a, [hli]
cp -1
ret z
inc hl
cp c
- jr nz, .loop
+ jr nz, .loop1
scf
ret
-CutReplacementBlocks:
+.CutReplacementBlocks ; TODO - address
; replacement block, facing block
db $30, $25
db $31, $2A
@@ -90,69 +96,68 @@ CutReplacementBlocks: db $33, $35
db -1
-CheckCuttableTile: ; 03:502c
+.CheckCuttableTile ; 03:502c
call GetFacingTileCoord
- call IsCuttableTile
- jr nc, .fail
+ call .IsCuttableTile
+ jr nc, .fail2
call GetBlockLocation
ld a, [hl]
cp $3b
- jr nz, .fail
+ jr nz, .fail2
ld a, l
ld [wMapBlocksAddress], a
ld a, h
ld [wMapBlocksAddress + 1], a
ld a, $04
ld [wReplacementBlock], a
- ld a, SCRIPT_ID_03
- ld [wFieldMoveScriptID], a
+ next_jump .DoCut
xor a
ret
-.fail
- ld a, SCRIPT_ID_05
- ld [wFieldMoveScriptID], a
+.fail2
+ next_jump .FailCut
xor a
ret
-IsCuttableTile:
- ld hl, CuttableTiles
+.IsCuttableTile ; TODO - address
+ ld hl, .CuttableTiles
ld c, a
-.loop
+.loop2
ld a, [hli]
cp -1
ret z
cp c
- jr nz, .loop
+ jr nz, .loop2
scf
ret
-CuttableTiles:
+.CuttableTiles ; TODO - address
db $81
db $82
db $8A
db $8B
db -1
-FailCut: ; 03:5069
- ld hl, Text_CantUseCutHere
+.FailCut ; 03:5069
+ ld hl, .Text_CantUseCutHere
call MenuTextBoxBackup
scf
ld a, SCRIPT_FAIL
ret
-Text_CantUseCutHere: ; 03:5073
+.Text_CantUseCutHere ; 03:5073
text "ここでは つかえません"
prompt
-DoCut: ; 03:5080
- ld hl, CutScript
- ld a, BANK(CutScript)
+.DoCut ; 03:5080
+.DoCut2
+ ld hl, .CutScript
+ ld a, BANK(.CutScript)
call QueueScript
scf
ld a, SCRIPT_SUCCESS
ret
-CutScript: ; 03:508C
+.CutScript ; 03:508C
call RefreshScreen
ld hl, wPartyMonNicknames
ld a, BOXMON
@@ -160,7 +165,7 @@ CutScript: ; 03:508C ld a, [wWhichPokemon]
call GetNick
call CopyStringToStringBuffer2
- ld hl, Text_CutItDown
+ ld hl, .Text_CutItDown
call MenuTextBoxBackup
ld de, MUSIC_SURF
call PlaySFX
@@ -177,7 +182,7 @@ CutScript: ; 03:508C scf
ret
-Text_CutItDown: ; 03:50c4
+.Text_CutItDown ; 03:50c4
text_from_ram wStringBuffer2
text " は "
line "くさかりを つかった!"
@@ -561,4 +566,4 @@ TeleportScript: ; 03:5375 Text_ReturnToLastMonCenter: ; 03:5395
text "さいごに たちよった"
line "#センターにもどります"
- done
\ No newline at end of file + done
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 4ee9f42..d2e9545 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -76,4 +76,4 @@ ComputeMaxPP: ; 03:792B .no_pp_up
ld [hl], b
pop bc
- ret
\ No newline at end of file + ret
diff --git a/engine/overworld/spawn_points.asm b/engine/overworld/spawn_points.asm index ca654fd..c159a21 100755 --- a/engine/overworld/spawn_points.asm +++ b/engine/overworld/spawn_points.asm @@ -57,4 +57,3 @@ IsSpawnPoint: ; 03:47b6 .succeed
scf
ret
-
diff --git a/engine/pokemon/health.asm b/engine/pokemon/health.asm index 2810fd5..2d81b8d 100755 --- a/engine/pokemon/health.asm +++ b/engine/pokemon/health.asm @@ -356,4 +356,3 @@ UpdateHPBar_CalcOldNewHPBarPixels: ; 03:4F8B ld e, a
pop hl
ret
-
diff --git a/home/music.asm b/home/music.asm index 79bffea..8d908f0 100755 --- a/home/music.asm +++ b/home/music.asm @@ -10,7 +10,7 @@ PlayMapMusic: ; 00:3de1 cp e
jr z, .dont_play
push de
- ld de, $0000
+ ld de, 0
call PlayMusic
call DelayFrame
pop de
@@ -23,4 +23,4 @@ PlayMapMusic: ; 00:3de1 pop bc
pop de
pop hl
- ret
\ No newline at end of file + ret
diff --git a/home/names.asm b/home/names.asm index 162154d..aacd285 100644 --- a/home/names.asm +++ b/home/names.asm @@ -259,4 +259,4 @@ GetNick: ; 00:3a97 callab CorrectNickErrors pop bc pop hl - ret
\ No newline at end of file + ret |