Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ gfx/battle/move_anim_1.2bpp: tools/gfx += --trim-whitespace

gfx/credits/the_end.2bpp: tools/gfx += --interleave --png=$<

gfx/diploma/diploma.2bpp: tools/gfx += --trim-whitespace

gfx/slots/slots_1.2bpp: tools/gfx += --trim-whitespace

gfx/tilesets/%.2bpp: tools/gfx += --trim-whitespace
Expand All @@ -149,7 +151,6 @@ gfx/trade/game_boy.2bpp: tools/gfx += --remove-duplicates
gfx/sgb/border.2bpp: tools/gfx += --trim-whitespace

gfx/surfing_pikachu/surfing_pikachu_1c.2bpp: tools/gfx += --trim-whitespace
gfx/surfing_pikachu/surfing_pikachu_3.2bpp: tools/gfx += --trim-whitespace


### Catch-all graphics rules
Expand Down
2 changes: 2 additions & 0 deletions constants/map_object_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ DEF SPRITESTATEDATA2_LENGTH EQU const_value

DEF NUM_SPRITESTATEDATA_STRUCTS EQU 16

DEF PIKACHU_SPRITE_INDEX EQU NUM_SPRITESTATEDATA_STRUCTS -1

const_def 6
const BIT_TRAINER ; 6
const BIT_ITEM ; 7
Expand Down
1 change: 1 addition & 0 deletions constants/text_constants.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DEF NAME_LENGTH EQU 11
DEF ITEM_NAME_LENGTH EQU 13
DEF NAME_BUFFER_LENGTH EQU 20
DEF NAME_LENGTH_JP EQU 6

; PrintNumber, PrintBCDNumber
const_def 5
Expand Down
26 changes: 13 additions & 13 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ RemoveFaintedPlayerMon:

ld a, [wPlayerMonNumber]
ld [wWhichPokemon], a
callfar IsThisPartymonStarterPikachu_Party
callfar IsThisPartyMonStarterPikachu
jr nc, .notPlayerPikachu
ldpikacry e, PikachuCry4
callfar PlayPikachuSoundClip
Expand All @@ -1076,10 +1076,10 @@ RemoveFaintedPlayerMon:
cp 30 ; is the enemy 30 levels greater than us?
jr nc, .carelessTrainer ; if so, punish the player for being careless, as they shouldn't be fighting a very high leveled trainer with such a level difference
.regularFaint
callabd_ModifyPikachuHappiness PIKAHAPPY_FAINTED
farcall_ModifyPikachuHappiness PIKAHAPPY_FAINTED
ret
.carelessTrainer
callabd_ModifyPikachuHappiness PIKAHAPPY_CARELESSTRAINER
farcall_ModifyPikachuHappiness PIKAHAPPY_CARELESSTRAINER
ret

PlayerMonFaintedText:
Expand Down Expand Up @@ -1794,7 +1794,7 @@ SendOutMon:
call RunPaletteCommand
ld hl, wEnemyBattleStatus1
res USING_TRAPPING_MOVE, [hl]
callfar IsThisPartymonStarterPikachu
callfar IsThisPartyMonStarterPikachu
jr c, .starterPikachu
ld a, $1
ldh [hWhoseTurn], a
Expand Down Expand Up @@ -1829,7 +1829,7 @@ AnimateRetreatingPlayerMon:
push af
ld a, [wPlayerMonNumber]
ld [wWhichPokemon], a
callfar IsThisPartymonStarterPikachu
callfar IsThisPartyMonStarterPikachu
pop bc
ld a, b
ld [wWhichPokemon], a
Expand Down Expand Up @@ -4331,7 +4331,7 @@ IgnoredOrdersText:
GetDamageVarsForPlayerAttack:
xor a
ld hl, wDamage ; damage to eventually inflict, initialise to zero
ldi [hl], a
ld [hli], a
ld [hl], a
ld hl, wPlayerMovePower
ld a, [hli]
Expand Down Expand Up @@ -4637,8 +4637,8 @@ CalculateDamage:

xor a
ld hl, hDividend
ldi [hl], a
ldi [hl], a
ld [hli], a
ld [hli], a
ld [hl], a

; Multiply level by 2
Expand All @@ -4651,11 +4651,11 @@ CalculateDamage:
pop af
.nc
inc hl
ldi [hl], a
ld [hli], a

; Divide by 5
ld a, 5
ldd [hl], a
ld [hld], a
push bc
ld b, 4
call Divide
Expand Down Expand Up @@ -4894,7 +4894,7 @@ HandleCounterMove:
; if it did damage, double it
ld a, [hl]
add a
ldd [hl], a
ld [hld], a
ld a, [hl]
adc a
ld [hl], a
Expand Down Expand Up @@ -5245,7 +5245,7 @@ HandleBuildingRage:
call StatModifierUpEffect ; stat modifier raising function
pop hl
xor a
ldd [hl], a ; null move effect
ld [hld], a ; null move effect
ld a, RAGE
ld [hl], a ; restore the target pokemon's move number to Rage
ldh a, [hWhoseTurn]
Expand Down Expand Up @@ -6561,7 +6561,7 @@ LoadPlayerBackPic:
jr nz, .loop
ld de, vBackPic
call InterlaceMergeSpriteBuffers
ld a, $0
ld a, BANK("Sprite Buffers")
call OpenSRAM
ld hl, vSprites
ld de, sSpriteBuffer1
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/experience.asm
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ GainExperience:
call CallBattleCore
call SaveScreenTilesToBuffer1
.printGrewLevelText
callabd_ModifyPikachuHappiness PIKAHAPPY_LEVELUP
farcall_ModifyPikachuHappiness PIKAHAPPY_LEVELUP
ld hl, GrewLevelText
call PrintText
xor a ; PLAYER_PARTY_DATA
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/init_battle.asm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ InitBattleCommon:
ld a, [wLoneAttackNo]
and a
jp z, _InitBattleCommon
callabd_ModifyPikachuHappiness PIKAHAPPY_GYMLEADER ; useless since already in bank3d
farcall_ModifyPikachuHappiness PIKAHAPPY_GYMLEADER ; useless since already in bank3d
jp _InitBattleCommon

InitWildBattle:
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/move_effects/substitute.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SubstituteEffect_:
jr c, .notEnoughHP ; underflow means user would be left with negative health
; bug: since it only branches on carry, it will possibly leave user with 0 HP
.userHasZeroOrMoreHP
ldi [hl], a ; save resulting HP after subtraction into current HP
ld [hli], a ; save resulting HP after subtraction into current HP
ld [hl], d
ld h, b
ld l, c
Expand Down
2 changes: 1 addition & 1 deletion engine/battle/scale_sprites.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; 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:
ld a, $0
ld a, BANK("Sprite Buffers")
call OpenSRAM
call .ScaleSpriteByTwo
call CloseSRAM
Expand Down
2 changes: 1 addition & 1 deletion engine/events/black_out.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ResetStatusAndHalveMoneyOnBlackout::
; Reset player status on blackout.
xor a
ld [wd434], a
ld [wPikachuCollisionCounter], a
xor a ; gamefreak copypasting functions (double xor a)
ld [wBattleResult], a
ld [wWalkBikeSurfState], a
Expand Down
2 changes: 1 addition & 1 deletion engine/events/diploma.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DisplayDiploma::
ld [wUpdateSpritesEnabled], a
ld hl, wStatusFlags5
set BIT_NO_TEXT_DELAY, [hl]
callfar _DisplayDiploma
callfar DisplayDiplomaTop
call WaitForTextScrollButtonPress
ld hl, wStatusFlags5
res BIT_NO_TEXT_DELAY, [hl]
Expand Down
110 changes: 44 additions & 66 deletions engine/events/diploma2.asm
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
DEF CIRCLE_TILE_ID EQU $10

_DisplayDiploma:
DisplayDiplomaTop:
call GBPalWhiteOutWithDelay3
call ClearScreen
ld de, SurfingPikachu3Graphics
ld de, DiplomaGraphics
ld hl, vChars2
lb bc, BANK(SurfingPikachu3Graphics), (SurfingPikachu3GraphicsEnd - SurfingPikachu3Graphics) / $10
lb bc, BANK(DiplomaGraphics), (DiplomaGraphicsEnd - DiplomaGraphics) / $10
call CopyVideoData

hlcoord 0, 0
call Func_e9bdf

call DiplomaDrawHorizontalBorder
hlcoord 0, 0
call Func_e9beb

call DiplomaDrawVerticalBorder
hlcoord 19, 0
call Func_e9beb

call DiplomaDrawVerticalBorder
ld a, $00
hlcoord 0, 0
ld [hl], a
Expand Down Expand Up @@ -67,105 +64,86 @@ DiplomaCongrats:
DiplomaGameFreak:
db "GAME FREAK@"

Func_e9ad3:
DisplayDiplomaBottom:
call ClearScreen
hlcoord 0, 17
call Func_e9bdf
call DiplomaDrawHorizontalBorder
hlcoord 0, 0
call Func_e9beb
call DiplomaDrawVerticalBorder
hlcoord 19, 0
call Func_e9beb
call DiplomaDrawVerticalBorder
ld a, $00
hlcoord 0, 17
ld [hl], a
hlcoord 19, 17
ld [hl], a
ld de, Tilemap_e9b3e

ld de, DiplomaPikachuTiles
hlcoord 6, 2
lb bc, 10, 12
call Diploma_Surfing_CopyBox
ld de, Tilemap_e9bb6

ld de, CongratulationsTiles
hlcoord 5, 13
lb bc, 1, 11
call Diploma_Surfing_CopyBox
ld de, String_e9bd5

ld de, DiplomaPlayTime
hlcoord 2, 15
call PlaceString
hlcoord 12, 15
ld de, wPlayTimeHours
lb bc, $40 | 1, 3
lb bc, LEFT_ALIGN | 1, 3
call PrintNumber
ld [hl], $16
ld [hl], $16 ; colon
inc hl
ld de, wPlayTimeMinutes
lb bc, $80 | 1, 2
lb bc, LEADING_ZEROES | 1, 2
call PrintNumber

ld a, [wNumSetBits]
cp 151
cp NUM_POKEMON
ret nz
ld de, TileMap_e9bc1
ld de, DiplomaMewTiles
hlcoord 2, 0
lb bc, 4, 5
call Diploma_Surfing_CopyBox
ret

Tilemap_e9b3e:
db $7f, $7f, $7f, $1a, $1b, $7f, $7f, $7f, $7f, $7f
db $7f, $7f, $7f, $7f, $7f, $1c, $1d, $1e, $1f, $20
db $7f, $21, $22, $23, $7f, $24, $25, $26, $27, $28
db $29, $2a, $2b, $2c, $2d, $2e, $2f, $30, $31, $32
db $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c
db $7f, $3d, $3e, $3f, $40, $41, $42, $43, $29, $44
db $45, $46, $47, $48, $49, $4a, $4b, $29, $29, $4c
db $4d, $4e, $4f, $50, $51, $52, $53, $54, $55, $56
db $57, $58, $59, $7f, $7f, $7f, $5a, $5b, $5c, $5d
db $5e, $5f, $60, $61, $62, $7f, $7f, $7f, $7f, $63
db $64, $65, $66, $67, $68, $7f, $7f, $7f, $7f, $7f
db $7f, $69, $6a, $6b, $6c, $6d, $6e, $7f, $7f, $7f

Tilemap_e9bb6:
db $05
db $06
db $07
db $08
db $09
db $0a
db $0b
db $0c
db $0d
db $0e
db $0f

TileMap_e9bc1:
db $70, $71, $7f, $72, $7f
db $73, $74, $75, $76, $77
db $7f, $78, $11, $12, $13
db $7f, $7f, $14, $15, $7f

String_e9bd5: db "PLAY TIME@"

Func_e9bdf:
ld c, 10
.asm_e9be1
DiplomaPikachuTiles:
INCBIN "gfx/diploma/diploma_pikachu.tilemap"

CongratulationsTiles:
db $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; CONGRATULATIONS!

DiplomaMewTiles:
INCBIN "gfx/diploma/diploma_mew.tilemap"

DiplomaPlayTime:
db "PLAY TIME@"

DiplomaDrawHorizontalBorder:
ld c, SCREEN_WIDTH / 2
.loop
ld [hl], $02
inc hl
ld [hl], $01
inc hl
dec c
jr nz, .asm_e9be1
jr nz, .loop
ret

Func_e9beb:
ld c, 9
DiplomaDrawVerticalBorder:
ld c, SCREEN_HEIGHT / 2
ld de, SCREEN_WIDTH
.asm_e9bed
.loop
ld [hl], $04
add hl, de
ld [hl], $03
add hl, de
dec c
jr nz, .asm_e9bed
jr nz, .loop
ret

SurfingPikachu3Graphics: INCBIN "gfx/surfing_pikachu/surfing_pikachu_3.2bpp"
SurfingPikachu3GraphicsEnd:
DiplomaGraphics: INCBIN "gfx/diploma/diploma.2bpp"
DiplomaGraphicsEnd:
12 changes: 4 additions & 8 deletions engine/events/hidden_objects/bench_guys.asm
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ PrintBenchGuyText:
ld a, [wSpritePlayerStateData1FacingDirection]
cp b

; bug: an 'inc hl' instruction is needed before looping back. When trying to
; talk to a bench guy from above, this Sprite Facing test will fail, and the
; next loop iteration will be misaligned within BenchGuyTextPointers table.
; As a result, the routine will miss the terminator byte, and continue to
; process data beyond the table boundary.
; It seems that it will only return after starting to read data from VRAM
; (According to Pan Docs, during PPU mode 3, reads return garbage value,
; usually $FF).
; bug: an 'inc hl' instruction is needed before looping back.
; Due to Yellow's new Pokecenter layout, it's now impossible to talk to a
; bench guy from above. The bug is still present but will not be triggered
; in a regular play.
jr nz, .loop ; player isn't facing the bench guy
ld a, [hl]
jp PrintPredefTextID
Expand Down
4 changes: 2 additions & 2 deletions engine/events/pikachu_happiness.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ModifyPikachuHappiness::
cp PIKAHAPPY_WALKING
jr z, .checkanywhereinparty
push de
callfar IsThisPartymonStarterPikachu_Party
callfar IsThisPartyMonStarterPikachu
pop de
ret nc
jr .proceed

.checkanywhereinparty
push de
callfar IsStarterPikachuInOurParty
callfar IsStarterPikachuAliveInOurParty
pop de
ret nc

Expand Down
Loading