diff --git a/Makefile b/Makefile index 8d4aa7900..63d1177e8 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,6 @@ engine/credits.o \ data/pokemon/egg_moves.o \ data/pokemon/evos_attacks.o \ data/pokemon/dex_entries.o \ -misc/crystal_misc.o \ text/common_text.o \ gfx/pics.o @@ -202,8 +201,8 @@ gfx/pokegear/pokegear_sprites.2bpp: tools/gfx += --trim-whitespace gfx/unknown/ascii_font.2bpp: tools/gfx += --trim-whitespace gfx/unknown/bold_font.1bpp: tools/gfx += --trim-whitespace -gfx/unknown/egg_animated.2bpp: tools/gfx += --trim-whitespace -gfx/unknown/egg_animated_nonmatching.2bpp: tools/gfx += --remove-duplicates --remove-xflip +gfx/unknown/electro_ball.2bpp: tools/gfx += --trim-whitespace +gfx/unknown/electro_ball_nonmatching.2bpp: tools/gfx += --remove-duplicates --remove-xflip gfx/unknown/mobile_splash.2bpp: tools/gfx += --remove-duplicates --remove-xflip gfx/unknown/pichu_animated.2bpp: tools/gfx += --trim-whitespace gfx/unknown/unknown_egg.2bpp: rgbgfx += -h diff --git a/constants/battle_tower_constants.asm b/constants/battle_tower_constants.asm index 5ab69d752..0436e4e22 100755 --- a/constants/battle_tower_constants.asm +++ b/constants/battle_tower_constants.asm @@ -1,4 +1,4 @@ -; BattleTowerAction arguments (see misc/battle_tower_5c.asm) +; BattleTowerAction arguments (see mobile/battle_tower_5c.asm) const_def const BATTLETOWERACTION_CHECK_EXPLANATION_READ const BATTLETOWERACTION_SET_EXPLANATION_READ diff --git a/data/battle_tower.asm b/data/battle_tower.asm index 2c78ffb82..d2e07fac3 100644 --- a/data/battle_tower.asm +++ b/data/battle_tower.asm @@ -1,7 +1,7 @@ BattleTowerTrainers: ; 1f814e ; The trainer class is not used in Crystal 1.0 due to a bug. ; Instead, the sixth character in the trainer's name is used. -; See misc/battle_tower_47.asm +; See mobile/battle_tower_47.asm db "HANSON@@@@", FISHER db "SAWYER@@@@", POKEMANIAC db "MASUDA@@@@", GUITARIST diff --git a/gfx/font.asm b/gfx/font.asm index f2efefd37..8d17722f4 100755 --- a/gfx/font.asm +++ b/gfx/font.asm @@ -55,7 +55,7 @@ INCBIN "gfx/font/weekday_kanji.2bpp" ; f8f24 OverworldPhoneIconGFX: ; f8f24 -INCBIN "gfx/mobile/overworld_phone_icon.2bpp" +INCBIN "gfx/font/overworld_phone_icon.2bpp" ; f8f34 GFX_f8f34: ; unused bold letters + unown chars diff --git a/gfx/mobile/overworld_phone_icon.png b/gfx/font/overworld_phone_icon.png similarity index 100% rename from gfx/mobile/overworld_phone_icon.png rename to gfx/font/overworld_phone_icon.png diff --git a/gfx/unknown/egg_animated.2bpp.lz.3eaf004f b/gfx/unknown/electro_ball.2bpp.lz.3eaf004f similarity index 100% rename from gfx/unknown/egg_animated.2bpp.lz.3eaf004f rename to gfx/unknown/electro_ball.2bpp.lz.3eaf004f diff --git a/gfx/unknown/egg_animated.png b/gfx/unknown/electro_ball.png similarity index 100% rename from gfx/unknown/egg_animated.png rename to gfx/unknown/electro_ball.png diff --git a/gfx/unknown/egg_animated_nonmatching.png b/gfx/unknown/electro_ball_nonmatching.png similarity index 100% rename from gfx/unknown/egg_animated_nonmatching.png rename to gfx/unknown/electro_ball_nonmatching.png diff --git a/macros/charmap.asm b/macros/charmap.asm index deb0aa2c0..fd2d371fd 100644 --- a/macros/charmap.asm +++ b/macros/charmap.asm @@ -32,7 +32,7 @@ charmap "", $5e ; "ROCKET" charmap "", $5f -; Actual characters (from gfx/misc/font_extra.png) +; Actual characters (from gfx/font/font_extra.png) charmap "", $60 ; unused charmap "", $61 ; unused @@ -68,7 +68,7 @@ charmap "┘", $7e charmap " ", $7f -; Actual characters (from gfx/misc/font_battle_extra.png) +; Actual characters (from gfx/font/font_battle_extra.png) charmap "", $6e @@ -86,13 +86,13 @@ charmap "", $60 ; from gfx/mobile/phone_tiles.2bpp charmap "▲", $61 ; gfx/font/up_arrow.png - charmap "", $62 ; gfx/mobile/overworld_phone_icon.2bpp + charmap "", $62 ; gfx/font/overworld_phone_icon.2bpp charmap "_", $62 ; from gfx/battle/hp_exp_bar_border.1bpp charmap "′", $6e ; gfx/font/feet_inches.png charmap "″", $6f ; gfx/font/feet_inches.png -; Actual characters (from gfx/misc/font.png) +; Actual characters (from gfx/font/font.png) charmap "A", $80 charmap "B", $81 diff --git a/main.asm b/main.asm index 629e34968..aecfde835 100644 --- a/main.asm +++ b/main.asm @@ -563,7 +563,235 @@ ApplyPokerusTick: ; 13988 INCLUDE "event/bug_contest_2.asm" -INCLUDE "unknown/013a47.asm" +CorrectErrorsInPlayerParty: ; unreferenced + ld hl, PartyCount + ld a, [hl] + and a + ret z + + cp PARTY_LENGTH + 1 + jr c, .party_length_okay + ld a, PARTY_LENGTH + ld [hl], a +.party_length_okay + inc hl + + ld b, a + ld c, 0 +.loop1 + ld a, [hl] + and a + jr z, .invalid_species + cp NUM_POKEMON + 1 + jr z, .invalid_species + cp EGG + 1 + jr c, .next_species + +.invalid_species + ld [hl], SMEARGLE + push hl + push bc + ld a, c + ld hl, PartyMon1Species + call GetPartyLocation + ld [hl], SMEARGLE + pop bc + pop hl + +.next_species + inc hl + inc c + dec b + jr nz, .loop1 + ld [hl], $ff + + ld hl, PartyMon1 + ld a, [PartyCount] + ld d, a + ld e, 0 +.loop2 + push de + push hl + ld b, h + ld c, l + ld a, [hl] + and a + jr z, .invalid_species_2 + cp NUM_POKEMON + 1 + jr c, .check_level + +.invalid_species_2 + ld [hl], SMEARGLE + push de + ld d, 0 + ld hl, PartySpecies + add hl, de + pop de + ld a, SMEARGLE + ld [hl], a + +.check_level + ld [CurSpecies], a + call GetBaseData + ld hl, MON_LEVEL + add hl, bc + ld a, [hl] + cp MIN_LEVEL + ld a, MIN_LEVEL + jr c, .invalid_level + ld a, [hl] + cp MAX_LEVEL + jr c, .load_level + ld a, MAX_LEVEL +.invalid_level + ld [hl], a +.load_level + ld [CurPartyLevel], a + + ld hl, MON_MAXHP + add hl, bc + ld d, h + ld e, l + ld hl, MON_STAT_EXP - 1 + add hl, bc + ld b, $1 + predef CalcPkmnStats + pop hl + ld bc, PARTYMON_STRUCT_LENGTH + add hl, bc + pop de + inc e + dec d + jr nz, .loop2 + + ld de, PartyMonNicknames + ld a, [PartyCount] + ld b, a + ld c, 0 +.loop3 + push bc + call .GetLengthOfStringWith6CharCap + push de + callba CheckStringForErrors + pop hl + pop bc + jr nc, .valid_nickname + + push bc + push hl + ld hl, PartySpecies + push bc + ld b, 0 + add hl, bc + pop bc + ld a, [hl] + cp EGG + ld hl, .TAMAGO + jr z, .got_nickname + ld [wd265], a + call GetPokemonName + ld hl, StringBuffer1 +.got_nickname + pop de + ld bc, PKMN_NAME_LENGTH + call CopyBytes + pop bc + +.valid_nickname + inc c + dec b + jr nz, .loop3 + + ld de, PartyMonOT + ld a, [PartyCount] + ld b, a + ld c, 0 +.loop4 + push bc + call .GetLengthOfStringWith6CharCap + push de + callba CheckStringForErrors + pop hl + jr nc, .valid_ot_name + ld d, h + ld e, l + ld hl, PlayerName + ld bc, NAME_LENGTH + call CopyBytes +.valid_ot_name + pop bc + inc c + dec b + jr nz, .loop4 + + ld hl, PartyMon1Moves + ld a, [PartyCount] + ld b, a +.loop5 + push hl + ld c, NUM_MOVES + ld a, [hl] + and a + jr z, .invalid_move + cp NUM_ATTACKS + 1 + jr c, .moves_loop +.invalid_move + ld [hl], POUND + +.moves_loop + ld a, [hl] + and a + jr z, .fill_invalid_moves + cp NUM_ATTACKS + 1 + jr c, .next_move + +.fill_invalid_moves + xor a + ld [hli], a + dec c + jr nz, .fill_invalid_moves + jr .next_pokemon + +.next_move + inc hl + dec c + jr nz, .moves_loop + +.next_pokemon + pop hl + push bc + ld bc, PARTYMON_STRUCT_LENGTH + add hl, bc + pop bc + dec b + jr nz, .loop5 + ret +; 13b6b + +.TAMAGO: ; 13b6b + db "タマゴ@@@" +; 13b71 + +.GetLengthOfStringWith6CharCap: ; 13b71 + push de + ld c, 1 + ld b, NAME_LENGTH_JAPANESE +.search_loop + ld a, [de] + cp "@" + jr z, .done + inc de + inc c + dec b + jr nz, .search_loop + dec c + dec de + ld a, "@" + ld [de], a +.done + pop de + ret +; 13b87 GetSquareRoot: ; 13b87 ; Return the square root of de in b. @@ -5139,7 +5367,7 @@ INCLUDE "mobile/mobile_46.asm" SECTION "battle_tower_47", ROMX -INCLUDE "misc/battle_tower_47.asm" +INCLUDE "mobile/battle_tower_47.asm" SECTION "bank5B", ROMX @@ -5170,6 +5398,8 @@ _UpdateBattleHUDs: callba FinishBattleAnim ret +INCLUDE "mobile/mobile_5e.asm" + INCLUDE "mobile/mobile_5f.asm" @@ -5655,50 +5885,9 @@ SECTION "Battle Tower Trainer Data", ROMX INCLUDE "data/battle_tower_2.asm" -SECTION "bank7D", ROMX +SECTION "Mobile News Data", ROMX - db $cc, $6b, $1e ; XXX - -Function1f4003: ; 1f4003 -; XXX - ld a, $6 - call GetSRAMBank - ld hl, .unknown_data - ld de, $a000 - ld bc, $1000 - call CopyBytes - call CloseSRAM - ret - -.unknown_data -INCBIN "unknown/1f4018.bin" - -Function1f4dbe: ; 1f4dbe -; XXX - ld a, $6 - call GetSRAMBank - ld hl, .unknown_data - ld de, $a000 - ld bc, $1000 - call CopyBytes - call CloseSRAM - ret - -.unknown_data -INCBIN "unknown/1f4dd3.bin" - -Function1f5d9f: ; 1f5d9f - ld a, $6 - call GetSRAMBank - ld hl, .unknown_data - ld de, $a000 - ld bc, $1000 - call CopyBytes - call CloseSRAM - ret - -.unknown_data -INCBIN "unknown/1f5db4.bin" +INCLUDE "mobile/news/news.asm" SECTION "bank7E", ROMX @@ -5710,10 +5899,10 @@ INCLUDE "engine/odd_eggs.asm" SECTION "bank7F", ROMX -SECTION "stadium2", ROMX +SECTION "Mobile Stadium 2", ROMX IF DEF(CRYSTAL11) -INCBIN "misc/stadium2_2.bin" +INCBIN "mobile/stadium/stadium2_2.bin" ELSE -INCBIN "misc/stadium2_1.bin" +INCBIN "mobile/stadium/stadium2_1.bin" ENDC diff --git a/misc/battle_tower_47.asm b/mobile/battle_tower_47.asm similarity index 100% rename from misc/battle_tower_47.asm rename to mobile/battle_tower_47.asm diff --git a/misc/battle_tower_5c.asm b/mobile/battle_tower_5c.asm similarity index 100% rename from misc/battle_tower_5c.asm rename to mobile/battle_tower_5c.asm diff --git a/mobile/mobile_5c.asm b/mobile/mobile_5c.asm index 5b7418a0f..48f9cace9 100755 --- a/mobile/mobile_5c.asm +++ b/mobile/mobile_5c.asm @@ -75,7 +75,7 @@ Function17005a: ; 17005a ; 1700b0 -INCLUDE "misc/battle_tower_5c.asm" +INCLUDE "mobile/battle_tower_5c.asm" Function170be4: ; 170be4 ld a, $5 diff --git a/misc/crystal_misc.asm b/mobile/mobile_5e.asm similarity index 99% rename from misc/crystal_misc.asm rename to mobile/mobile_5e.asm index aa5c704fd..b22f714ea 100644 --- a/misc/crystal_misc.asm +++ b/mobile/mobile_5e.asm @@ -1,5 +1,3 @@ -INCLUDE "includes.asm" - SECTION "Misc Crystal", ROMX diff --git a/mobile/news/news.asm b/mobile/news/news.asm new file mode 100644 index 000000000..b95df06aa --- /dev/null +++ b/mobile/news/news.asm @@ -0,0 +1,44 @@ +; http://forums.glitchcity.info/index.php?topic=7509.msg206449#msg206449 + + db $cc, $6b, $1e ; XXX + +Function1f4003: ; 1f4003 +; XXX + ld a, $6 + call GetSRAMBank + ld hl, .news_data + ld de, $a000 + ld bc, $1000 + call CopyBytes + call CloseSRAM + ret + +.news_data +INCBIN "mobile/news/news_1.bin" + +Function1f4dbe: ; 1f4dbe +; XXX + ld a, $6 + call GetSRAMBank + ld hl, .news_data + ld de, $a000 + ld bc, $1000 + call CopyBytes + call CloseSRAM + ret + +.news_data +INCBIN "mobile/news/news_2.bin" + +Function1f5d9f: ; 1f5d9f + ld a, $6 + call GetSRAMBank + ld hl, .news_data + ld de, $a000 + ld bc, $1000 + call CopyBytes + call CloseSRAM + ret + +.news_data +INCBIN "mobile/news/news_3.bin" diff --git a/unknown/1f4018.bin b/mobile/news/news_1.bin similarity index 100% rename from unknown/1f4018.bin rename to mobile/news/news_1.bin diff --git a/unknown/1f4dd3.bin b/mobile/news/news_2.bin similarity index 100% rename from unknown/1f4dd3.bin rename to mobile/news/news_2.bin diff --git a/unknown/1f5db4.bin b/mobile/news/news_3.bin similarity index 100% rename from unknown/1f5db4.bin rename to mobile/news/news_3.bin diff --git a/misc/stadium2_1.bin b/mobile/stadium/stadium2_1.bin similarity index 100% rename from misc/stadium2_1.bin rename to mobile/stadium/stadium2_1.bin diff --git a/misc/stadium2_2.bin b/mobile/stadium/stadium2_2.bin similarity index 100% rename from misc/stadium2_2.bin rename to mobile/stadium/stadium2_2.bin diff --git a/pokecrystal.link b/pokecrystal.link index 2281ba6d7..60ff314ff 100644 --- a/pokecrystal.link +++ b/pokecrystal.link @@ -301,13 +301,13 @@ ROMX $7b ROMX $7c "Battle Tower Trainer Data" ROMX $7d - "bank7D" + "Mobile News Data" ROMX $7e "bank7E" ROMX $7f "bank7F" org $7de0 - "stadium2" + "Mobile Stadium 2" WRAM0 "Stack" "Audio RAM" diff --git a/unknown/013a47.asm b/unknown/013a47.asm deleted file mode 100755 index dd0d2b722..000000000 --- a/unknown/013a47.asm +++ /dev/null @@ -1,229 +0,0 @@ -CorrectErrorsInPlayerParty: ; unreferenced - ld hl, PartyCount - ld a, [hl] - and a - ret z - - cp PARTY_LENGTH + 1 - jr c, .party_length_okay - ld a, PARTY_LENGTH - ld [hl], a -.party_length_okay - inc hl - - ld b, a - ld c, 0 -.loop1 - ld a, [hl] - and a - jr z, .invalid_species - cp NUM_POKEMON + 1 - jr z, .invalid_species - cp EGG + 1 - jr c, .next_species - -.invalid_species - ld [hl], SMEARGLE - push hl - push bc - ld a, c - ld hl, PartyMon1Species - call GetPartyLocation - ld [hl], SMEARGLE - pop bc - pop hl - -.next_species - inc hl - inc c - dec b - jr nz, .loop1 - ld [hl], $ff - - ld hl, PartyMon1 - ld a, [PartyCount] - ld d, a - ld e, 0 -.loop2 - push de - push hl - ld b, h - ld c, l - ld a, [hl] - and a - jr z, .invalid_species_2 - cp NUM_POKEMON + 1 - jr c, .check_level - -.invalid_species_2 - ld [hl], SMEARGLE - push de - ld d, 0 - ld hl, PartySpecies - add hl, de - pop de - ld a, SMEARGLE - ld [hl], a - -.check_level - ld [CurSpecies], a - call GetBaseData - ld hl, MON_LEVEL - add hl, bc - ld a, [hl] - cp MIN_LEVEL - ld a, MIN_LEVEL - jr c, .invalid_level - ld a, [hl] - cp MAX_LEVEL - jr c, .load_level - ld a, MAX_LEVEL -.invalid_level - ld [hl], a -.load_level - ld [CurPartyLevel], a - - ld hl, MON_MAXHP - add hl, bc - ld d, h - ld e, l - ld hl, MON_STAT_EXP - 1 - add hl, bc - ld b, $1 - predef CalcPkmnStats - pop hl - ld bc, PARTYMON_STRUCT_LENGTH - add hl, bc - pop de - inc e - dec d - jr nz, .loop2 - - ld de, PartyMonNicknames - ld a, [PartyCount] - ld b, a - ld c, 0 -.loop3 - push bc - call .GetLengthOfStringWith6CharCap - push de - callba CheckStringForErrors - pop hl - pop bc - jr nc, .valid_nickname - - push bc - push hl - ld hl, PartySpecies - push bc - ld b, 0 - add hl, bc - pop bc - ld a, [hl] - cp EGG - ld hl, .TAMAGO - jr z, .got_nickname - ld [wd265], a - call GetPokemonName - ld hl, StringBuffer1 -.got_nickname - pop de - ld bc, PKMN_NAME_LENGTH - call CopyBytes - pop bc - -.valid_nickname - inc c - dec b - jr nz, .loop3 - - ld de, PartyMonOT - ld a, [PartyCount] - ld b, a - ld c, 0 -.loop4 - push bc - call .GetLengthOfStringWith6CharCap - push de - callba CheckStringForErrors - pop hl - jr nc, .valid_ot_name - ld d, h - ld e, l - ld hl, PlayerName - ld bc, NAME_LENGTH - call CopyBytes -.valid_ot_name - pop bc - inc c - dec b - jr nz, .loop4 - - ld hl, PartyMon1Moves - ld a, [PartyCount] - ld b, a -.loop5 - push hl - ld c, NUM_MOVES - ld a, [hl] - and a - jr z, .invalid_move - cp NUM_ATTACKS + 1 - jr c, .moves_loop -.invalid_move - ld [hl], POUND - -.moves_loop - ld a, [hl] - and a - jr z, .fill_invalid_moves - cp NUM_ATTACKS + 1 - jr c, .next_move - -.fill_invalid_moves - xor a - ld [hli], a - dec c - jr nz, .fill_invalid_moves - jr .next_pokemon - -.next_move - inc hl - dec c - jr nz, .moves_loop - -.next_pokemon - pop hl - push bc - ld bc, PARTYMON_STRUCT_LENGTH - add hl, bc - pop bc - dec b - jr nz, .loop5 - ret -; 13b6b - -.TAMAGO: ; 13b6b - db "タマゴ@@@" -; 13b71 - -.GetLengthOfStringWith6CharCap: ; 13b71 - push de - ld c, 1 - ld b, 6 -.search_loop - ld a, [de] - cp "@" - jr z, .done - inc de - inc c - dec b - jr nz, .search_loop - dec c - dec de - ld a, "@" - ld [de], a -.done - pop de - ret -; 13b87