From cd649184f556db777d592671a7274bfa4a8423d7 Mon Sep 17 00:00:00 2001 From: "U-Daniel-PC\\Daniel" Date: Fri, 3 Jul 2015 14:37:53 -0500 Subject: Rename/organize part 1 of 4 rename functions, clean up address/wram comments, other misc only broken up so that all changes are viewable on github --- engine/overworld/cut.asm | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'engine/overworld/cut.asm') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 7b92bca3..215bf103 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -1,7 +1,7 @@ UsedCut: ; ef54 (3:6f54) xor a ld [wcd6a], a - ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET + ld a, [W_CURMAPTILESET] and a ; OVERWORLD jr z, .asm_ef6b cp GYM @@ -9,28 +9,28 @@ UsedCut: ; ef54 (3:6f54) ld a, [wTileInFrontOfPlayer] cp $50 ; gym cut tree jr nz, .asm_ef77 - jr asm_ef82 + jr .asm_ef82 .asm_ef6b dec a ld a, [wTileInFrontOfPlayer] cp $3d ; cut tree - jr z, asm_ef82 + jr z, .asm_ef82 cp $52 ; grass - jr z, asm_ef82 + jr z, .asm_ef82 .asm_ef77 - ld hl, NothingToCutText + ld hl, .NothingToCutText jp PrintText -NothingToCutText: ; ef7d (3:6f7d) +.NothingToCutText TX_FAR _NothingToCutText db "@" -asm_ef82: ; ef82 (3:6f82) +.asm_ef82 ld [wcd4d], a ld a, $1 ld [wcd6a], a - ld a, [wWhichPokemon] ; wWhichPokemon - ld hl, wPartyMonNicks ; wPartyMonNicks + ld a, [wWhichPokemon] + ld hl, wPartyMonNicks call GetPartyMonName ld hl, wd730 set 6, [hl] @@ -54,7 +54,7 @@ asm_ef82: ; ef82 (3:6f82) ld a, $ff ld [wUpdateSpritesEnabled], a call AnimateCutTree - ld de, CutTreeBlockSwaps ; $7100 + ld de, CutTreeBlockSwaps call Func_f09f call RedrawMapView callba Func_79e96 @@ -75,15 +75,15 @@ AnimateCutTree: ; eff7 (3:6ff7) xor a ld [wcd50], a ld a, $e4 - ld [rOBP1], a ; $ff49 + ld [rOBP1], a ld a, [wcd4d] cp $52 jr z, .asm_f020 - ld de, Overworld_GFX + $2d0 ; $42d0 ; cuttable tree sprite top row + ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row ld hl, vChars1 + $7c0 ld bc, (BANK(Overworld_GFX) << 8) + $02 call CopyVideoData - ld de, Overworld_GFX + $3d0 ; $43d0 ; cuttable tree sprite bottom row + ld de, Overworld_GFX + $3d0 ; cuttable tree sprite bottom row ld hl, vChars1 + $7e0 ld bc, (BANK(Overworld_GFX) << 8) + $02 call CopyVideoData @@ -111,7 +111,7 @@ AnimateCutTree: ; eff7 (3:6ff7) ret LoadCutTreeAnimationTilePattern: ; f04c (3:704c) - ld de, AnimationTileset2 + $60 ; $474e ; tile depicting a leaf + ld de, AnimationTileset2 + $60 ; tile depicting a leaf ld bc, (BANK(AnimationTileset2) << 8) + $01 jp CopyVideoData @@ -173,7 +173,7 @@ BoulderDustAnimationOffsets: ; f097 (3:7097) Func_f09f: ; f09f (3:709f) push de - ld a, [W_CURMAPWIDTH] ; wd369 + ld a, [W_CURMAPWIDTH] add $6 ld c, a ld b, $0 @@ -190,22 +190,22 @@ Func_f09f: ; f09f (3:709f) jr z, .asm_f0cf cp $8 jr z, .asm_f0d7 - ld a, [W_XBLOCKCOORD] ; wd364 + ld a, [W_XBLOCKCOORD] and a jr z, .asm_f0e0 jr .asm_f0ec .asm_f0c7 - ld a, [W_YBLOCKCOORD] ; wd363 + ld a, [W_YBLOCKCOORD] and a jr z, .asm_f0e0 jr .asm_f0df .asm_f0cf - ld a, [W_YBLOCKCOORD] ; wd363 + ld a, [W_YBLOCKCOORD] and a jr z, .asm_f0e1 jr .asm_f0e0 .asm_f0d7 - ld a, [W_XBLOCKCOORD] ; wd364 + ld a, [W_XBLOCKCOORD] and a jr z, .asm_f0e6 jr .asm_f0e0 -- cgit v1.2.3 From f702fc7840e30f00c840ce619a1ea15d763438de Mon Sep 17 00:00:00 2001 From: dannye Date: Sat, 4 Jul 2015 00:44:12 -0500 Subject: Start using text predef macros also sprite direction constants --- engine/overworld/cut.asm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engine/overworld/cut.asm') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 215bf103..26a65b5b 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -185,26 +185,26 @@ Func_f09f: ; f09f (3:709f) add hl, bc ld a, [wSpriteStateData1 + 9] and a - jr z, .asm_f0c7 - cp $4 - jr z, .asm_f0cf - cp $8 - jr z, .asm_f0d7 + jr z, .down + cp SPRITE_FACING_UP + jr z, .up + cp SPRITE_FACING_LEFT + jr z, .left ld a, [W_XBLOCKCOORD] and a jr z, .asm_f0e0 jr .asm_f0ec -.asm_f0c7 +.down ld a, [W_YBLOCKCOORD] and a jr z, .asm_f0e0 jr .asm_f0df -.asm_f0cf +.up ld a, [W_YBLOCKCOORD] and a jr z, .asm_f0e1 jr .asm_f0e0 -.asm_f0d7 +.left ld a, [W_XBLOCKCOORD] and a jr z, .asm_f0e6 -- cgit v1.2.3 From 01631a2e5910b5334ba0f7cc534bc5d7e5b60ccc Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Tue, 14 Jul 2015 14:32:49 -0700 Subject: player animations, emotion bubbles, etc. --- engine/overworld/cut.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/overworld/cut.asm') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 26a65b5b..163b32e7 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -73,7 +73,7 @@ UsedCutText: ; eff2 (3:6ff2) AnimateCutTree: ; eff7 (3:6ff7) xor a - ld [wcd50], a + ld [wWhichAnimationOffsets], a ld a, $e4 ld [rOBP1], a ld a, [wcd4d] @@ -138,7 +138,7 @@ GetCutTreeBoulderDustAnimationOffsets: ; f068 (3:7068) srl a ld e, a ld d, $0 ; de holds direction (00: down, 02: up, 04: left, 06: right) - ld a, [wcd50] + ld a, [wWhichAnimationOffsets] and a ld hl, CutTreeAnimationOffsets jr z, .asm_f084 -- cgit v1.2.3 From 07dd7056372288de7bb5b64f9416d741adb3b499 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Tue, 14 Jul 2015 19:46:52 -0700 Subject: hall of fame / credits --- engine/overworld/cut.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/overworld/cut.asm') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 163b32e7..8f171545 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -26,7 +26,7 @@ UsedCut: ; ef54 (3:6f54) db "@" .asm_ef82 - ld [wcd4d], a + ld [wCutTile], a ld a, $1 ld [wcd6a], a ld a, [wWhichPokemon] @@ -76,7 +76,7 @@ AnimateCutTree: ; eff7 (3:6ff7) ld [wWhichAnimationOffsets], a ld a, $e4 ld [rOBP1], a - ld a, [wcd4d] + ld a, [wCutTile] cp $52 jr z, .asm_f020 ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row -- cgit v1.2.3 From 994c2cbf289efa2e23eabf1af96ba62e4f066005 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Tue, 14 Jul 2015 23:16:06 -0700 Subject: named wram variables --- engine/overworld/cut.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/overworld/cut.asm') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 8f171545..f7be269c 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -1,6 +1,6 @@ UsedCut: ; ef54 (3:6f54) xor a - ld [wcd6a], a + ld [wActionResultOrTookBattleTurn], a ; initialise to failure value ld a, [W_CURMAPTILESET] and a ; OVERWORLD jr z, .asm_ef6b @@ -28,7 +28,7 @@ UsedCut: ; ef54 (3:6f54) .asm_ef82 ld [wCutTile], a ld a, $1 - ld [wcd6a], a + ld [wActionResultOrTookBattleTurn], a ; used cut ld a, [wWhichPokemon] ld hl, wPartyMonNicks call GetPartyMonName -- cgit v1.2.3 From ea9cc86949cecc3508aeac06b807372b6b0134d8 Mon Sep 17 00:00:00 2001 From: dannye Date: Sun, 19 Jul 2015 03:46:12 -0500 Subject: Name sound effects --- engine/overworld/cut.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/overworld/cut.asm') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index f7be269c..293daee7 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -60,7 +60,7 @@ UsedCut: ; ef54 (3:6f54) callba Func_79e96 ld a, $1 ld [wUpdateSpritesEnabled], a - ld a, (SFX_02_56 - SFX_Headers_02) / 3 + ld a, SFX_CUT call PlaySound ld a, $90 ld [hWY], a -- cgit v1.2.3 From 82512e449115aa9d004e24a3d1526dd32570c56d Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Fri, 24 Jul 2015 14:39:45 -0700 Subject: named animation functions/variables --- engine/overworld/cut.asm | 125 ++++++++++++++++++++++++----------------------- 1 file changed, 65 insertions(+), 60 deletions(-) (limited to 'engine/overworld/cut.asm') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 293daee7..2056bbb0 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -3,21 +3,21 @@ UsedCut: ; ef54 (3:6f54) ld [wActionResultOrTookBattleTurn], a ; initialise to failure value ld a, [W_CURMAPTILESET] and a ; OVERWORLD - jr z, .asm_ef6b + jr z, .overworld cp GYM - jr nz, .asm_ef77 + jr nz, .nothingToCut ld a, [wTileInFrontOfPlayer] cp $50 ; gym cut tree - jr nz, .asm_ef77 - jr .asm_ef82 -.asm_ef6b + jr nz, .nothingToCut + jr .canCut +.overworld dec a ld a, [wTileInFrontOfPlayer] cp $3d ; cut tree - jr z, .asm_ef82 + jr z, .canCut cp $52 ; grass - jr z, .asm_ef82 -.asm_ef77 + jr z, .canCut +.nothingToCut ld hl, .NothingToCutText jp PrintText @@ -25,9 +25,9 @@ UsedCut: ; ef54 (3:6f54) TX_FAR _NothingToCutText db "@" -.asm_ef82 +.canCut ld [wCutTile], a - ld a, $1 + ld a, 1 ld [wActionResultOrTookBattleTurn], a ; used cut ld a, [wWhichPokemon] ld hl, wPartyMonNicks @@ -37,7 +37,7 @@ UsedCut: ; ef54 (3:6f54) call GBPalWhiteOutWithDelay3 call ClearSprites call RestoreScreenTilesAndReloadTilePatterns - ld a, $90 + ld a, SCREEN_HEIGHT_PIXELS ld [hWY], a call Delay3 call LoadGBPal @@ -53,11 +53,11 @@ UsedCut: ; ef54 (3:6f54) res 6, [hl] ld a, $ff ld [wUpdateSpritesEnabled], a - call AnimateCutTree + call InitCutAnimOAM ld de, CutTreeBlockSwaps - call Func_f09f + call ReplaceTreeTileBlock call RedrawMapView - callba Func_79e96 + callba AnimCut ld a, $1 ld [wUpdateSpritesEnabled], a ld a, SFX_CUT @@ -71,14 +71,15 @@ UsedCutText: ; eff2 (3:6ff2) TX_FAR _UsedCutText db "@" -AnimateCutTree: ; eff7 (3:6ff7) +InitCutAnimOAM: ; eff7 (3:6ff7) xor a ld [wWhichAnimationOffsets], a ld a, $e4 ld [rOBP1], a ld a, [wCutTile] cp $52 - jr z, .asm_f020 + jr z, .grass +; tree ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row ld hl, vChars1 + $7c0 ld bc, (BANK(Overworld_GFX) << 8) + $02 @@ -87,45 +88,45 @@ AnimateCutTree: ; eff7 (3:6ff7) ld hl, vChars1 + $7e0 ld bc, (BANK(Overworld_GFX) << 8) + $02 call CopyVideoData - jr WriteCutTreeBoulderDustAnimationOAMBlock -.asm_f020 + jr WriteCutOrBoulderDustAnimationOAMBlock +.grass ld hl, vChars1 + $7c0 - call LoadCutTreeAnimationTilePattern + call LoadCutGrassAnimationTilePattern ld hl, vChars1 + $7d0 - call LoadCutTreeAnimationTilePattern + call LoadCutGrassAnimationTilePattern ld hl, vChars1 + $7e0 - call LoadCutTreeAnimationTilePattern + call LoadCutGrassAnimationTilePattern ld hl, vChars1 + $7f0 - call LoadCutTreeAnimationTilePattern - call WriteCutTreeBoulderDustAnimationOAMBlock + call LoadCutGrassAnimationTilePattern + call WriteCutOrBoulderDustAnimationOAMBlock ld hl, wOAMBuffer + $93 - ld de, $4 + ld de, 4 ld a, $30 ld c, e -.asm_f044 +.loop ld [hl], a add hl, de xor $60 dec c - jr nz, .asm_f044 + jr nz, .loop ret -LoadCutTreeAnimationTilePattern: ; f04c (3:704c) +LoadCutGrassAnimationTilePattern: ; f04c (3:704c) ld de, AnimationTileset2 + $60 ; tile depicting a leaf ld bc, (BANK(AnimationTileset2) << 8) + $01 jp CopyVideoData -WriteCutTreeBoulderDustAnimationOAMBlock: ; f055 (3:7055) - call GetCutTreeBoulderDustAnimationOffsets +WriteCutOrBoulderDustAnimationOAMBlock: ; f055 (3:7055) + call GetCutOrBoulderDustAnimationOffsets ld a, $9 - ld de, CutTreeBoulderDustAnimationTilesAndAttributes + ld de, CutOrBoulderDustAnimationTilesAndAttributes jp WriteOAMBlock -CutTreeBoulderDustAnimationTilesAndAttributes: ; f060 (3:7060) +CutOrBoulderDustAnimationTilesAndAttributes: ; f060 (3:7060) db $FC,$10,$FD,$10 db $FE,$10,$FF,$10 -GetCutTreeBoulderDustAnimationOffsets: ; f068 (3:7068) +GetCutOrBoulderDustAnimationOffsets: ; f068 (3:7068) ld hl, wSpriteStateData1 + 4 ld a, [hli] ; player's sprite screen Y position ld b, a @@ -140,10 +141,10 @@ GetCutTreeBoulderDustAnimationOffsets: ; f068 (3:7068) ld d, $0 ; de holds direction (00: down, 02: up, 04: left, 06: right) ld a, [wWhichAnimationOffsets] and a - ld hl, CutTreeAnimationOffsets - jr z, .asm_f084 + ld hl, CutAnimationOffsets + jr z, .next ld hl, BoulderDustAnimationOffsets -.asm_f084 +.next add hl, de ld e, [hl] inc hl @@ -156,7 +157,7 @@ GetCutTreeBoulderDustAnimationOffsets: ; f068 (3:7068) ld c, a ret -CutTreeAnimationOffsets: ; f08f (3:708f) +CutAnimationOffsets: ; f08f (3:708f) ; Each pair represents the x and y pixels offsets from the player of where the cut tree animation should be drawn db 8, 36 ; player is facing down db 8, 4 ; player is facing up @@ -171,75 +172,79 @@ BoulderDustAnimationOffsets: ; f097 (3:7097) db -24, 20 ; player is facing left db 40, 20 ; player is facing right -Func_f09f: ; f09f (3:709f) +ReplaceTreeTileBlock: ; f09f (3:709f) +; Determine the address of the tile block that contains the tile in front of the +; player (i.e. where the tree is) and replace it with the corresponding tile +; block that doesn't have the tree. push de ld a, [W_CURMAPWIDTH] - add $6 + add 6 ld c, a - ld b, $0 - ld d, $0 + ld b, 0 + ld d, 0 ld hl, wCurrentTileBlockMapViewPointer ld a, [hli] ld h, [hl] ld l, a add hl, bc - ld a, [wSpriteStateData1 + 9] + ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction and a jr z, .down cp SPRITE_FACING_UP jr z, .up cp SPRITE_FACING_LEFT jr z, .left +; right ld a, [W_XBLOCKCOORD] and a - jr z, .asm_f0e0 - jr .asm_f0ec + jr z, .centerTileBlock + jr .rightOfCenter .down ld a, [W_YBLOCKCOORD] and a - jr z, .asm_f0e0 - jr .asm_f0df + jr z, .centerTileBlock + jr .belowCenter .up ld a, [W_YBLOCKCOORD] and a - jr z, .asm_f0e1 - jr .asm_f0e0 + jr z, .aboveCenter + jr .centerTileBlock .left ld a, [W_XBLOCKCOORD] and a - jr z, .asm_f0e6 - jr .asm_f0e0 -.asm_f0df + jr z, .leftOfCenter + jr .centerTileBlock +.belowCenter add hl, bc -.asm_f0e0 +.centerTileBlock add hl, bc -.asm_f0e1 +.aboveCenter ld e, $2 add hl, de - jr .asm_f0f0 -.asm_f0e6 + jr .next +.leftOfCenter ld e, $1 add hl, bc add hl, de - jr .asm_f0f0 -.asm_f0ec + jr .next +.rightOfCenter ld e, $3 add hl, bc add hl, de -.asm_f0f0 +.next pop de ld a, [hl] ld c, a -.asm_f0f3 +.loop ; find the matching tile block in the array ld a, [de] inc de inc de cp $ff ret z cp c - jr nz, .asm_f0f3 + jr nz, .loop dec de - ld a, [de] + ld a, [de] ; replacement tile block from matching array entry ld [hl], a ret -- cgit v1.2.3 From f8a9c37a0019eb085c22c6e3ae53b16ff0cd4f6a Mon Sep 17 00:00:00 2001 From: dannye Date: Wed, 5 Aug 2015 16:20:29 -0500 Subject: Use more lb and other clean up --- engine/overworld/cut.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engine/overworld/cut.asm') diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 2056bbb0..30aedbc1 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -82,11 +82,11 @@ InitCutAnimOAM: ; eff7 (3:6ff7) ; tree ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row ld hl, vChars1 + $7c0 - ld bc, (BANK(Overworld_GFX) << 8) + $02 + lb bc, BANK(Overworld_GFX), $02 call CopyVideoData ld de, Overworld_GFX + $3d0 ; cuttable tree sprite bottom row ld hl, vChars1 + $7e0 - ld bc, (BANK(Overworld_GFX) << 8) + $02 + lb bc, BANK(Overworld_GFX), $02 call CopyVideoData jr WriteCutOrBoulderDustAnimationOAMBlock .grass @@ -113,7 +113,7 @@ InitCutAnimOAM: ; eff7 (3:6ff7) LoadCutGrassAnimationTilePattern: ; f04c (3:704c) ld de, AnimationTileset2 + $60 ; tile depicting a leaf - ld bc, (BANK(AnimationTileset2) << 8) + $01 + lb bc, BANK(AnimationTileset2), $01 jp CopyVideoData WriteCutOrBoulderDustAnimationOAMBlock: ; f055 (3:7055) -- cgit v1.2.3