summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2015-11-29 15:09:32 -0500
committerluckytyphlosion <alan.rj.huang@gmail.com>2015-11-29 15:09:32 -0500
commit6dc1f939e1e97563928c22950d8fa618d892c32d (patch)
tree9f9f19eac7a40d9d66fb259da8b1e377826360be
parent2e3b58e6207997315cd69bf50968494b3b2b982b (diff)
bankB misc functions
ScaleSpriteByTwo, DisplayEffectiveness and CheckIfMoveIsKnown
-rw-r--r--constants/predef_constants.asm2
-rw-r--r--engine/battle/display_effectiveness.asm6
-rw-r--r--engine/battle/scale_sprites.asm17
-rwxr-xr-xengine/game_corner_slots2.asm10
-rwxr-xr-xengine/items/tmhm.asm4
-rwxr-xr-xengine/predefs.asm2
-rw-r--r--engine/predefsA.asm2
-rwxr-xr-xmain.asm2
-rwxr-xr-xyellow/main.asm17
9 files changed, 37 insertions, 25 deletions
diff --git a/constants/predef_constants.asm b/constants/predef_constants.asm
index c8b4a9cd..34b751e4 100644
--- a/constants/predef_constants.asm
+++ b/constants/predef_constants.asm
@@ -31,7 +31,7 @@ const_value = 0
predef_const GetQuantityOfItemInBag
predef_const CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0
predef_const GiveItem
- predef_const InvertBGPalColor0_4Frames
+ predef_const InvertBGPal_4Frames
predef_const FindPathToPlayer
predef_const Func_480ff
predef_const CalcPositionOfPlayerRelativeToNPC
diff --git a/engine/battle/display_effectiveness.asm b/engine/battle/display_effectiveness.asm
index 17f0bd5b..1ef9873c 100644
--- a/engine/battle/display_effectiveness.asm
+++ b/engine/battle/display_effectiveness.asm
@@ -1,4 +1,4 @@
-DisplayEffectiveness: ; 2fb7b (b:7b7b)
+DisplayEffectiveness: ; 2fd25 (b:7d25)
ld a, [wDamageMultipliers]
and a, $7F
cp a, $0A
@@ -9,10 +9,10 @@ DisplayEffectiveness: ; 2fb7b (b:7b7b)
.done
jp PrintText
-SuperEffectiveText: ; 2fb8e (b:7b8e)
+SuperEffectiveText: ; 2fd38 (b:7d38)
TX_FAR _SuperEffectiveText
db "@"
-NotVeryEffectiveText: ; 2fb93 (b:7b93)
+NotVeryEffectiveText: ; 2fd3d (b:7d3d)
TX_FAR _NotVeryEffectiveText
db "@"
diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm
index ed227984..3d4c0e0b 100644
--- a/engine/battle/scale_sprites.asm
+++ b/engine/battle/scale_sprites.asm
@@ -1,7 +1,14 @@
; scales both uncompressed sprite chunks by two in every dimension (creating 2x2 output pixels per input pixel)
; assumes that input sprite chunks are 4x4 tiles, and the rightmost and bottommost 4 pixels will be ignored
; resulting in a 7*7 tile output sprite chunk
-ScaleSpriteByTwo: ; 2fe40 (b:7e40)
+ScaleSpriteByTwo: ; 2fd79 (b:7d79)
+ ld a, $0
+ call SwitchSRAMBankAndLatchClockData
+ call ScaleSpriteByTwo_
+ call PrepareRTCDataAndDisableSRAM
+ ret
+
+ScaleSpriteByTwo_: ; 2fd85 (b:7d85)
ld de, S_SPRITEBUFFER1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
ld hl, S_SPRITEBUFFER0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
call ScaleLastSpriteColumnByTwo ; last tile column is special case
@@ -10,7 +17,7 @@ ScaleSpriteByTwo: ; 2fe40 (b:7e40)
ld hl, S_SPRITEBUFFER1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
call ScaleLastSpriteColumnByTwo ; last tile column is special case
-ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55)
+ScaleFirstThreeSpriteColumnsByTwo: ; 2fd9a (b:7d9a)
ld b, $3 ; 3 tile columns
.columnLoop
ld c, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
@@ -39,7 +46,7 @@ ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55)
jr nz, .columnLoop
ret
-ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d)
+ScaleLastSpriteColumnByTwo: ; 2fdc2 (b:7dc2)
ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
ld [H_SPRITEINTERLACECOUNTER], a
ld bc, -1
@@ -61,7 +68,7 @@ ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d)
; scales the given 4 bits in a (4x1 pixels) to 2 output bytes (8x2 pixels)
; hl: destination pointer
; bc: destination pointer offset (added after the two bytes have been written)
-ScalePixelsByTwo: ; 2fe97 (b:7e97)
+ScalePixelsByTwo: ; 2fddc (b:7ddc)
push hl
and $f
ld hl, DuplicateBitsTable
@@ -78,7 +85,7 @@ ScalePixelsByTwo: ; 2fe97 (b:7e97)
ret
; repeats each input bit twice
-DuplicateBitsTable: ; 2fea8 (b:7ea8)
+DuplicateBitsTable: ; 2fded (b:7ded)
db $00, $03, $0c, $0f
db $30, $33, $3c, $3f
db $c0, $c3, $cc, $cf
diff --git a/engine/game_corner_slots2.asm b/engine/game_corner_slots2.asm
index 58386ba1..1bcbefb1 100755
--- a/engine/game_corner_slots2.asm
+++ b/engine/game_corner_slots2.asm
@@ -1,4 +1,4 @@
-AbleToPlaySlotsCheck: ; 2ff09 (b:7f09)
+AbleToPlaySlotsCheck: ; 2fdfd (b:7dfd)
ld a, [wSpriteStateData1 + 2]
and $8
jr z, .done ; not able
@@ -6,13 +6,13 @@ AbleToPlaySlotsCheck: ; 2ff09 (b:7f09)
predef GetQuantityOfItemInBag
ld a, b
and a
- ld b, (GameCornerCoinCaseText_id - TextPredefs) / 2 + 1
+ ld b, GameCornerCoinCaseText_id ; - TextPredefs) / 2 + 1
jr z, .printCoinCaseRequired
ld hl, wPlayerCoins
ld a, [hli]
or [hl]
jr nz, .done ; able to play
- ld b, (GameCornerNoCoinsText_id - TextPredefs) / 2 + 1
+ ld b, GameCornerNoCoinsText_id ; - TextPredefs) / 2 + 1
.printCoinCaseRequired
call EnableAutoTextBoxDrawing
ld a, b
@@ -22,10 +22,10 @@ AbleToPlaySlotsCheck: ; 2ff09 (b:7f09)
ld [wCanPlaySlots], a
ret
-GameCornerCoinCaseText: ; 2ff32 (b:7f32)
+GameCornerCoinCaseText: ; 2fe26 (b:7e26)
TX_FAR _GameCornerCoinCaseText
db "@"
-GameCornerNoCoinsText: ; 2ff37 (b:7f37)
+GameCornerNoCoinsText: ; 2fe2b (b:7e2b)
TX_FAR _GameCornerNoCoinsText
db "@"
diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm
index 0fcc5710..be93fc0e 100755
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -1,5 +1,5 @@
; checks if the mon in [wWhichPokemon] already knows the move in [wMoveNum]
-CheckIfMoveIsKnown: ; 2fe18 (b:7e18)
+CheckIfMoveIsKnown: ; 2fd42 (b:7d42)
ld a, [wWhichPokemon]
ld hl, wPartyMon1Moves
ld bc, wPartyMon2 - wPartyMon1
@@ -21,6 +21,6 @@ CheckIfMoveIsKnown: ; 2fe18 (b:7e18)
scf
ret
-AlreadyKnowsText: ; 2fe3b (b:7e3b)
+AlreadyKnowsText: ; 2fd65 (b:7d65)
TX_FAR _AlreadyKnowsText
db "@"
diff --git a/engine/predefs.asm b/engine/predefs.asm
index 02c696d6..d4e3511c 100755
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -84,7 +84,7 @@ PredefPointers:: ; f681d (3d:681d)
;add_predef IsItemInBag_
;dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0
;dbw $03,GiveItem
- ;add_predef InvertBGPalColor0_4Frames
+ ;add_predef InvertBGPal_4Frames
;add_predef FindPathToPlayer
;add_predef Func_480ff
;add_predef CalcPositionOfPlayerRelativeToNPC
diff --git a/engine/predefsA.asm b/engine/predefsA.asm
index 5761fdb4..1cfb60f6 100644
--- a/engine/predefsA.asm
+++ b/engine/predefsA.asm
@@ -1,5 +1,5 @@
; inverts the BGP for 4 (6 on CGB due to lag) frames
-InvertBGPalColor0_4Frames: ; 2bd4c (a:7d4c)
+InvertBGPal_4Frames: ; 2bd4c (a:7d4c)
call GetPredefRegisters ; leftover of red/blue, has no use here
ld a, [rBGP]
xor $ff
diff --git a/main.asm b/main.asm
index 741e9857..e36f755f 100755
--- a/main.asm
+++ b/main.asm
@@ -2575,7 +2575,7 @@ ApplyOutOfBattlePoisonDamage: ; c3de (3:43de)
and a ; are any party members poisoned?
jr z, .skipPoisonEffectAndSound
ld b, $2
- predef InvertBGPalColor0_4Frames ; change BG white to dark grey for 4 frames
+ predef InvertBGPal_4Frames ; change BG white to dark grey for 4 frames
ld a, SFX_POISONED
call PlaySound
.skipPoisonEffectAndSound
diff --git a/yellow/main.asm b/yellow/main.asm
index b7a9cfba..24b6250f 100755
--- a/yellow/main.asm
+++ b/yellow/main.asm
@@ -1796,7 +1796,7 @@ ApplyOutOfBattlePoisonDamage: ; c3de (3:43de)
and a ; are any party members poisoned?
jr z, .skipPoisonEffectAndSound
ld b, $2
- predef InvertBGPalColor0_4Frames ; change BG white to dark grey for 4 frames
+ predef InvertBGPal_4Frames ; change BG white to dark grey for 4 frames
ld a, SFX_POISONED
call PlaySound
.skipPoisonEffectAndSound
@@ -3866,12 +3866,17 @@ BeedrillPicBack: INCBIN "pic/monback/beedrillb.pic"
FossilKabutopsPic: INCBIN "pic/ymon/fossilkabutops.pic"
- dr $2fd25,$2fd42
-CheckIfMoveIsKnown: ; 2fd42 (b:7d42)
- dr $2fd42,$2fd6a
+INCLUDE "engine/battle/display_effectiveness.asm"
+INCLUDE "engine/items/tmhm.asm"
Func_2fd6a: ; 2fd6a (b:7d6a)
- dr $2fd6a,$30000
-
+ callab IsThisPartymonOurPikachu
+ ret nc
+ ld a, $3
+ ld [wd431], a
+ ret
+
+INCLUDE "engine/battle/scale_sprites.asm"
+INCLUDE "engine/game_corner_slots2.asm"
SECTION "Pics 4", ROMX, BANK[PICS_4]