Skip to content

Commit

Permalink
Merge pull request #301 from Rangi42/master
Browse files Browse the repository at this point in the history
Sync home and macro code with pokeyellow
  • Loading branch information
Rangi42 committed Nov 6, 2020
2 parents abaf9fe + e16dec8 commit d3f1352
Show file tree
Hide file tree
Showing 43 changed files with 177 additions and 227 deletions.
10 changes: 0 additions & 10 deletions constants/gfx_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ TILE_WIDTH EQU 8 ; pixels
LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes
LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes

const_def
const SHADE_WHITE ; %00
const SHADE_LIGHT ; %01
const SHADE_DARK ; %10
const SHADE_BLACK ; %11
NUM_PAL_COLORS EQU const_value

PAL_COLOR_SIZE EQU 2
PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE

SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels
Expand Down
12 changes: 8 additions & 4 deletions constants/palette_constants.asm
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
; monochrome palette color ids
const_def
const WHITE
const LIGHT_GRAY
const DARK_GRAY
const BLACK
const SHADE_WHITE ; %00
const SHADE_LIGHT ; %01
const SHADE_DARK ; %10
const SHADE_BLACK ; %11
NUM_PAL_COLORS EQU const_value

PAL_COLOR_SIZE EQU 2
PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE

; pal/blk packets
; SetPalFunctions indexes (see engine/gfx/palettes.asm)
Expand Down
6 changes: 3 additions & 3 deletions data/maps/special_warps.asm
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ FirstMapSpec:
special_warp_spec REDS_HOUSE_2F, 3, 6, REDS_HOUSE_2
TradeCenterSpec1:
special_warp_spec TRADE_CENTER, 3, 4, CLUB
TradeCenterSpec2:
TradeCenterSpec2:
special_warp_spec TRADE_CENTER, 6, 4, CLUB
ColosseumSpec1:
ColosseumSpec1:
special_warp_spec COLOSSEUM, 3, 4, CLUB
ColosseumSpec2:
ColosseumSpec2:
special_warp_spec COLOSSEUM, 6, 4, CLUB


Expand Down
2 changes: 1 addition & 1 deletion data/trainers/special_moves.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; unique moves for gym leaders
; this is not automatic! you have to write the index you want to [wLoneAttackNo]
; first. e.g., erika's script writes 4 to [wLoneAttackNo] to get mega drain,
; first. e.g., erika's script writes 4 to [wLoneAttackNo] to get mega drain,
; the fourth entry in the list.
LoneMoves:
; pokemon index, move to give nth pokemon
Expand Down
8 changes: 4 additions & 4 deletions engine/battle/animations.asm
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ DrawFrameBlock:
.afterDrawingTiles
ld a, [wFBMode]
cp FRAMEBLOCKMODE_02
jr z, .advanceFrameBlockDestAddr; skip delay and don't clean OAM buffer
jr z, .advanceFrameBlockDestAddr ; skip delay and don't clean OAM buffer
ld a, [wSubAnimFrameDelay]
ld c, a
call DelayFrames
Expand Down Expand Up @@ -2410,7 +2410,7 @@ FallingObjects_InitXCoords:
ret

FallingObjects_InitialXCoords:
db $38,$40,$50,$60,$70,$88,$90,$56,$67,$4A,$77,$84,$98,$32,$22,$5C,$6C,$7D,$8E,$99
db $38, $40, $50, $60, $70, $88, $90, $56, $67, $4A, $77, $84, $98, $32, $22, $5C, $6C, $7D, $8E, $99

FallingObjects_InitMovementData:
ld hl, wFallingObjectsMovementData
Expand All @@ -2426,7 +2426,7 @@ FallingObjects_InitMovementData:
ret

FallingObjects_InitialMovementData:
db $00,$84,$06,$81,$02,$88,$01,$83,$05,$89,$09,$80,$07,$87,$03,$82,$04,$85,$08,$86
db $00, $84, $06, $81, $02, $88, $01, $83, $05, $89, $09, $80, $07, $87, $03, $82, $04, $85, $08, $86

AnimationShakeEnemyHUD:
; Shakes the enemy HUD.
Expand Down Expand Up @@ -2583,7 +2583,7 @@ TossBallAnimation:

.PokeBallAnimations:
; sequence of animations that make up the Poké Ball toss
db POOF_ANIM,HIDEPIC_ANIM,SHAKE_ANIM,POOF_ANIM,SHOWPIC_ANIM
db POOF_ANIM, HIDEPIC_ANIM, SHAKE_ANIM, POOF_ANIM, SHOWPIC_ANIM

.BlockBall
ld a, TOSS_ANIM
Expand Down
26 changes: 14 additions & 12 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ ChooseNextMon:
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .notLinkBattle
inc a
inc a ; 1
ld [wActionResultOrTookBattleTurn], a
call LinkBattleExchangeData
.notLinkBattle
Expand Down Expand Up @@ -1724,7 +1724,7 @@ SendOutMon:
ld hl, wEnemyMonHP
ld a, [hli]
or [hl] ; is enemy mon HP zero?
jp z, .skipDrawingEnemyHUDAndHPBar; if HP is zero, skip drawing the HUD and HP bar
jp z, .skipDrawingEnemyHUDAndHPBar ; if HP is zero, skip drawing the HUD and HP bar
call DrawEnemyHUDAndHPBar
.skipDrawingEnemyHUDAndHPBar
call DrawPlayerHUDAndHPBar
Expand Down Expand Up @@ -2017,14 +2017,16 @@ DisplayBattleMenu::
dec a
jp nz, .handleBattleMenuInput ; handle menu input if it's not the old man tutorial
; the following happens for the old man tutorial
; Temporarily save the player name in wGrassRate,
; which is supposed to get overwritten when entering a
; map with wild Pokémon.
; Due to an oversight, the data may not get
; overwritten (on Cinnabar and Route 21) and the infamous
; Missingno. glitch can show up.
ld hl, wPlayerName
ld de, wGrassRate
ld bc, NAME_LENGTH
call CopyData ; temporarily save the player name in unused space,
; which is supposed to get overwritten when entering a
; map with wild Pokémon. Due to an oversight, the data
; may not get overwritten (cinnabar) and the infamous
; Missingno. glitch can show up.
call CopyData
ld hl, .oldManName
ld de, wPlayerName
ld bc, NAME_LENGTH
Expand Down Expand Up @@ -2206,7 +2208,7 @@ BagWasSelected:
OldManItemList:
db 1 ; # items
db POKE_BALL, 50
db -1
db -1 ; end

DisplayPlayerBag:
; get the pointer to player's bag when in a normal battle
Expand Down Expand Up @@ -4101,7 +4103,7 @@ CheckForDisobedience:
call GetCurrentMove
.canUseMove
ld a, $1
and a; clear Z flag
and a ; clear Z flag
ret
.cannotUseMove
xor a ; set Z flag
Expand Down Expand Up @@ -4485,7 +4487,7 @@ CalculateDamage:
ld b, 4
call Divide

; Update wCurDamage.
; Update wCurDamage.
; Capped at MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE: 999 - 2 = 997.
ld hl, wDamage
ld b, [hl]
Expand Down Expand Up @@ -4574,7 +4576,7 @@ JumpToOHKOMoveEffect:
INCLUDE "data/battle/unused_critical_hit_moves.asm"

; determines if attack is a critical hit
; azure heights claims "the fastest pokémon (who are,not coincidentally,
; Azure Heights claims "the fastest pokémon (who are, not coincidentally,
; among the most popular) tend to CH about 20 to 25% of the time."
CriticalHitTest:
xor a
Expand Down Expand Up @@ -6302,7 +6304,7 @@ LoadPlayerBackPic:
dec a ; is it the old man tutorial?
ld de, RedPicBack
jr nz, .next
ld de, OldManPic
ld de, OldManPicBack
.next
ld a, BANK(RedPicBack)
call UncompressSpriteFromDE
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/decrement_pp.asm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DecrementPP:
ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use?
ld c, a
ld b, 0
add hl ,bc ; calculate the address in memory of the PP we need to decrement
add hl, bc ; calculate the address in memory of the PP we need to decrement
; based on the move chosen.
dec [hl] ; Decrement PP
ret
35 changes: 18 additions & 17 deletions engine/battle/effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ FreezeBurnParalyzeEffect:
ret nz ; return if they have a substitute, can't effect them
ldh a, [hWhoseTurn]
and a
jp nz, opponentAttacker
jp nz, .opponentAttacker
ld a, [wEnemyMonStatus]
and a
jp nz, CheckDefrost ; can't inflict status if opponent is already statused
Expand All @@ -224,33 +224,33 @@ FreezeBurnParalyzeEffect:
ret nc ; do nothing if random value is >= 1A or 4D [no status applied]
ld a, b ; what type of effect is this?
cp BURN_SIDE_EFFECT1
jr z, .burn
jr z, .burn1
cp FREEZE_SIDE_EFFECT
jr z, .freeze
; .paralyze
jr z, .freeze1
; .paralyze1
ld a, 1 << PAR
ld [wEnemyMonStatus], a
call QuarterSpeedDueToParalysis ; quarter speed of affected mon
ld a, ANIM_A9
call PlayBattleAnimation
jp PrintMayNotAttackText ; print paralysis text
.burn
.burn1
ld a, 1 << BRN
ld [wEnemyMonStatus], a
call HalveAttackDueToBurn ; halve attack of affected mon
ld a, ANIM_A9
call PlayBattleAnimation
ld hl, BurnedText
jp PrintText
.freeze
.freeze1
call ClearHyperBeam ; resets hyper beam (recharge) condition from target
ld a, 1 << FRZ
ld [wEnemyMonStatus], a
ld a, ANIM_A9
call PlayBattleAnimation
ld hl, FrozenText
jp PrintText
opponentAttacker:
.opponentAttacker
ld a, [wBattleMonStatus] ; mostly same as above with addresses swapped for opponent
and a
jp nz, CheckDefrost
Expand All @@ -265,31 +265,32 @@ opponentAttacker:
ld a, [wEnemyMoveEffect]
cp PARALYZE_SIDE_EFFECT1 + 1
ld b, $1a
jr c, .next1
jr c, .next2
ld b, $4d
sub $1e
.next1
.next2
push af
call BattleRandom
cp b
pop bc
ret nc
ld a, b
cp BURN_SIDE_EFFECT1
jr z, .burn
jr z, .burn2
cp FREEZE_SIDE_EFFECT
jr z, .freeze
jr z, .freeze2
; .paralyze2
ld a, 1 << PAR
ld [wBattleMonStatus], a
call QuarterSpeedDueToParalysis
jp PrintMayNotAttackText
.burn
.burn2
ld a, 1 << BRN
ld [wBattleMonStatus], a
call HalveAttackDueToBurn
ld hl, BurnedText
jp PrintText
.freeze
.freeze2
; hyper beam bits aren't reseted for opponent's side
ld a, 1 << FRZ
ld [wBattleMonStatus], a
Expand Down Expand Up @@ -458,14 +459,14 @@ UpdateStatDone:
ld bc, wPlayerMonMinimized
ldh a, [hWhoseTurn]
and a
jr z, .asm_3f4e6
jr z, .playerTurn
ld hl, wEnemyBattleStatus2
ld de, wEnemyMoveNum
ld bc, wEnemyMonMinimized
.asm_3f4e6
.playerTurn
ld a, [de]
cp MINIMIZE
jr nz, .asm_3f4f9
jr nz, .notMinimize
; if a substitute is up, slide off the substitute and show the mon pic before
; playing the minimize animation
bit HAS_SUBSTITUTE_UP, [hl]
Expand All @@ -476,7 +477,7 @@ UpdateStatDone:
push de
call nz, Bankswitch
pop de
.asm_3f4f9
.notMinimize
call PlayCurrentMoveAnimation
ld a, [de]
cp MINIMIZE
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/ghost_marowak_anim.asm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CopyMonPicFromBGToSpriteVRAM:
ld [hli], a
ld a, d
ld [hli], a
ld a, $10 ; use OBP1
ld a, OAM_OBP1
ld [hli], a
inc d
dec c
Expand Down
6 changes: 3 additions & 3 deletions engine/battle/move_effects/heal.asm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ HealEffect_:
ld [wHPBarNewHP], a
.playAnim
ld hl, PlayCurrentMoveAnimation
call BankswitchEtoF
call EffectCallBattleCore
ldh a, [hWhoseTurn]
and a
hlcoord 10, 9
Expand All @@ -98,14 +98,14 @@ HealEffect_:
ld [wHPBarType], a
predef UpdateHPBar2
ld hl, DrawHUDsAndHPBars
call BankswitchEtoF
call EffectCallBattleCore
ld hl, RegainedHealthText
jp PrintText
.failed
ld c, 50
call DelayFrames
ld hl, PrintButItFailedText_
jp BankswitchEtoF
jp EffectCallBattleCore

StartedSleepingEffect:
text_far _StartedSleepingEffect
Expand Down
6 changes: 3 additions & 3 deletions engine/battle/move_effects/reflect_light_screen.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ ReflectLightScreenEffect_:
.playAnim
push hl
ld hl, PlayCurrentMoveAnimation
call BankswitchEtoF
call EffectCallBattleCore
pop hl
jp PrintText
.moveFailed
ld c, 50
call DelayFrames
ld hl, PrintButItFailedText_
jp BankswitchEtoF
jp EffectCallBattleCore

LightScreenProtectedText:
text_far _LightScreenProtectedText
Expand All @@ -40,6 +40,6 @@ ReflectGainedArmorText:
text_far _ReflectGainedArmorText
text_end

BankswitchEtoF:
EffectCallBattleCore:
ld b, BANK(BattleCore)
jp Bankswitch
2 changes: 1 addition & 1 deletion engine/battle/move_effects/transform.asm
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ TransformEffect_:

.failed
ld hl, PrintButItFailedText_
jp BankswitchEtoF
jp EffectCallBattleCore

TransformedText:
text_far _TransformedText
Expand Down
4 changes: 2 additions & 2 deletions engine/battle/read_trainer_party.asm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ReadTrainer:

; get the pointer to trainer data for this class
ld a, [wCurOpponent]
sub $C9 ; convert value from pokemon to trainer
sub OPP_ID_OFFSET + 1 ; convert value from pokemon to trainer
add a
ld hl, TrainerDataPointers
ld c, a
Expand Down Expand Up @@ -79,7 +79,7 @@ ReadTrainer:
pop hl
jr .SpecialTrainer
.AddLoneMove
; does the trainer have a single monster with a different move
; does the trainer have a single monster with a different move?
ld a, [wLoneAttackNo] ; Brock is 01, Misty is 02, Erika is 04, etc
and a
jr z, .AddTeamMove
Expand Down
Loading

0 comments on commit d3f1352

Please sign in to comment.