shithub: pokecrystal

Download patch

ref: e706b878d9f78466e6cc9eda184e14a798cc4a0d
parent: ab0f9c287a45d1986985545d7ec6a2cd862e26fc
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Tue Nov 23 15:37:18 EST 2021

Use ~X instead of $ff ^ X

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -533,7 +533,7 @@
 	ret z
 
 	; Don't do anything if SFX is being played
-	and $ff ^ (1 << DANGER_ON_F)
+	and ~(1 << DANGER_ON_F)
 	ld d, a
 	call _CheckSFX
 	jr c, .increment
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -340,7 +340,7 @@
 	ld a, BATTLE_VARS_SUBSTATUS3
 	call GetBattleVarAddr
 	ld a, [hl]
-	and $ff ^ (1 << SUBSTATUS_BIDE | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_CHARGED)
+	and ~(1 << SUBSTATUS_BIDE | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_CHARGED)
 	ld [hl], a
 
 	call ResetFuryCutterCount
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -245,7 +245,7 @@
 	ld c, NUM_SPRITE_OAM_STRUCTS
 .loop
 	ld a, [hl]
-	and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; zeros out the palette bits
+	and ~(PALETTE_MASK | VRAM_BANK_1) ; zeros out the palette bits
 	assert PAL_BATTLE_OB_ENEMY == 0
 	ld [hli], a
 rept SPRITEOAMSTRUCT_LENGTH - 1
--- a/engine/battle_anims/helpers.asm
+++ b/engine/battle_anims/helpers.asm
@@ -37,7 +37,7 @@
 	push af
 	ld a, [hl]
 	push hl
-	and $ff ^ (Y_FLIP << 1 | X_FLIP << 1)
+	and ~(Y_FLIP << 1 | X_FLIP << 1)
 	ld hl, BATTLEANIMSTRUCT_DURATION
 	add hl, bc
 	ld [hl], a
--- a/engine/events/catch_tutorial.asm
+++ b/engine/events/catch_tutorial.asm
@@ -35,7 +35,7 @@
 	ldh [hJoyPressed], a
 	ld a, [wOptions]
 	push af
-	and $ff ^ TEXT_DELAY_MASK
+	and ~TEXT_DELAY_MASK
 	add TEXT_DELAY_MED
 	ld [wOptions], a
 	ld hl, .AutoInput
--- a/engine/gfx/sprites.asm
+++ b/engine/gfx/sprites.asm
@@ -351,7 +351,7 @@
 	and PRIORITY | Y_FLIP | X_FLIP
 	ld b, a
 	ld a, [hl]
-	and $ff ^ (PRIORITY | Y_FLIP | X_FLIP)
+	and ~(PRIORITY | Y_FLIP | X_FLIP)
 	or b
 	ret
 
@@ -436,7 +436,7 @@
 	push af
 	ld a, [hl]
 	push hl
-	and $ff ^ (Y_FLIP << 1 | X_FLIP << 1)
+	and ~(Y_FLIP << 1 | X_FLIP << 1)
 	ld hl, SPRITEANIMSTRUCT_DURATIONOFFSET
 	add hl, bc
 	add [hl]
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -2189,7 +2189,7 @@
 	xor a
 	ld [wPokeFluteCuredSleep], a
 
-	ld b, $ff ^ SLP
+	ld b, ~SLP
 
 	ld hl, wPartyMon1Status
 	call .CureSleep
--- a/engine/link/mystery_gift.asm
+++ b/engine/link/mystery_gift.asm
@@ -14,7 +14,7 @@
 MG_CANCELED       EQU 1 << MG_CANCELED_F
 MG_WRONG_PREFIX   EQU 1 << MG_WRONG_PREFIX_F
 MG_NOT_OKAY       EQU MG_WRONG_CHECKSUM | MG_TIMED_OUT | MG_CANCELED | MG_WRONG_PREFIX
-MG_OKAY           EQU $ff ^ MG_NOT_OKAY
+MG_OKAY           EQU ~MG_NOT_OKAY
 MG_START_END      EQU %11111111
 
 REGION_PREFIX EQU $96
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -472,7 +472,7 @@
 	ld bc, wOptionsEnd - wOptions
 	call CopyBytes
 	ld a, [wOptions]
-	and $ff ^ (1 << NO_TEXT_SCROLL)
+	and ~(1 << NO_TEXT_SCROLL)
 	ld [sOptions], a
 	jp CloseSRAM
 
--- a/engine/menus/trainer_card.asm
+++ b/engine/menus/trainer_card.asm
@@ -532,7 +532,7 @@
 	inc de
 
 	ld a, [wTrainerCardBadgeTileID]
-	and $ff ^ (1 << 7)
+	and ~(1 << 7)
 	add [hl]
 	ld [de], a ; tile id
 	inc hl
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -2530,7 +2530,7 @@
 	ld hl, OBJECT_PALETTE
 	add hl, bc
 	ld a, [hl]
-	and $ff ^ PALETTE_MASK
+	and ~PALETTE_MASK
 	or d
 	ld [hl], a
 	ret
@@ -2895,7 +2895,7 @@
 	ld hl, OBJECT_SPRITE_TILE
 	add hl, bc
 	ld a, [hl]
-	and $ff ^ (1 << 7)
+	and ~(1 << 7)
 	ldh [hCurSpriteTile], a
 	xor a
 	bit 7, [hl]
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -759,7 +759,7 @@
 	call GetScriptByte
 	ld [wMusicFadeID + 1], a
 	call GetScriptByte
-	and $ff ^ (1 << MUSIC_FADE_IN_F)
+	and ~(1 << MUSIC_FADE_IN_F)
 	ld [wMusicFade], a
 	ret
 
@@ -1159,7 +1159,7 @@
 	call BufferScreen
 	predef StartBattle
 	ld a, [wBattleResult]
-	and $ff ^ BATTLERESULT_BITMASK
+	and ~BATTLERESULT_BITMASK
 	ld [wScriptVar], a
 	ret
 
@@ -1175,7 +1175,7 @@
 	ld d, [hl]
 	ld [hl], 0
 	ld a, [wBattleResult]
-	and $ff ^ BATTLERESULT_BITMASK
+	and ~BATTLERESULT_BITMASK
 	cp LOSE
 	jr nz, .notblackedout
 	ld b, BANK(Script_BattleWhiteout)
--- a/engine/overworld/variables.asm
+++ b/engine/overworld/variables.asm
@@ -137,5 +137,5 @@
 
 .BattleResult:
 	ld a, [wBattleResult]
-	and $ff ^ BATTLERESULT_BITMASK
+	and ~BATTLERESULT_BITMASK
 	jp .loadstringbuffer2
--- a/engine/pokemon/stats_screen.asm
+++ b/engine/pokemon/stats_screen.asm
@@ -65,12 +65,12 @@
 ; ???
 	ld [wStatsScreenFlags], a
 	ld a, [wStatsScreenFlags]
-	and $ff ^ STAT_PAGE_MASK
+	and ~STAT_PAGE_MASK
 	or PINK_PAGE ; first_page
 	ld [wStatsScreenFlags], a
 .loop
 	ld a, [wJumptableIndex]
-	and $ff ^ (1 << 7)
+	and ~(1 << 7)
 	ld hl, StatsScreenPointerTable
 	rst JumpTable
 	call StatsScreen_WaitAnim
@@ -85,7 +85,7 @@
 ; ???
 	ld [wStatsScreenFlags], a
 	ld a, [wStatsScreenFlags]
-	and $ff ^ STAT_PAGE_MASK
+	and ~STAT_PAGE_MASK
 	or PINK_PAGE ; first_page
 	ld [wStatsScreenFlags], a
 .loop
@@ -394,7 +394,7 @@
 
 .set_page
 	ld a, [wStatsScreenFlags]
-	and $ff ^ STAT_PAGE_MASK
+	and ~STAT_PAGE_MASK
 	or c
 	ld [wStatsScreenFlags], a
 	ld h, 4
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -56,7 +56,7 @@
 	jr nz, .wait
 
 	ldh a, [rLCDC]
-	and $ff ^ (1 << rLCDC_ENABLE)
+	and ~(1 << rLCDC_ENABLE)
 	ldh [rLCDC], a
 
 	xor a
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -1607,7 +1607,7 @@
 
 Unknown_17da94:
 for x, 8
-	db $ff ^ (1 << x)
+	db ~(1 << x)
 endr
 
 Function17da9c: