summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-06-22 16:51:56 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-06-22 16:51:56 -0400
commitc257a3898a94b79d6fc3b38c2e786b439d8f0d83 (patch)
treec6005c6a7dc882697d3063adab0a2f04dea1ad6d
parent154442459626ee351bd955b51d797673ae24fd2a (diff)
More functions in bank 3
-rw-r--r--engine/billspctop.asm2
-rwxr-xr-xengine/color.asm2
-rwxr-xr-xengine/main_menu.asm2
-rwxr-xr-xengine/move_mon.asm13
-rwxr-xr-xengine/specials.asm8
-rw-r--r--home.asm12
-rw-r--r--main.asm234
-rw-r--r--wram.asm55
8 files changed, 230 insertions, 98 deletions
diff --git a/engine/billspctop.asm b/engine/billspctop.asm
index bbdf7e62..4cb456ed 100644
--- a/engine/billspctop.asm
+++ b/engine/billspctop.asm
@@ -297,7 +297,7 @@ Function65b4:
ld a, [hl]
ld [de], a
inc de
- ld [wce60], a
+ ld [wCurSpecies], a
call GetBaseData
pop bc
pop hl
diff --git a/engine/color.asm b/engine/color.asm
index bdcfca66..16e4c29d 100755
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -647,7 +647,7 @@ Function9bba: ; 9bba (2:5bba)
callba Function3d907
ld c, l
ld b, h
- ld a, [wd0ed]
+ ld a, [wTempEnemyMonSpecies]
call Function9bd3
pop de
ret
diff --git a/engine/main_menu.asm b/engine/main_menu.asm
index f02db06a..dc386990 100755
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -752,7 +752,7 @@ OakSpeech: ; 5fa5 (1:5fa5)
call ClearTileMap
ld a, MARILL
- ld [wce60], a
+ ld [wCurSpecies], a
ld [wCurPartySpecies], a
call GetBaseData
hlcoord 6, 4
diff --git a/engine/move_mon.asm b/engine/move_mon.asm
index f4d65683..f6e63d88 100755
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -62,11 +62,12 @@ TryAddMonToParty:: ; d892 (3:5892)
dec a
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
+GeneratePartyMonStats:
ld e, l
ld d, h
push hl
ld a, [wCurPartySpecies]
- ld [wce60], a
+ ld [wCurSpecies], a
call GetBaseData
ld a, [wd120]
ld [de], a
@@ -723,7 +724,7 @@ Functiondd6a: ; dd6a (3:5d6a)
ld de, wdc7a
.asm_dd8c
ld [hli], a
- ld [wce60], a
+ ld [wCurSpecies], a
ld a, $ff
ld [hl], a
ld hl, wPartyMon1Nickname
@@ -843,7 +844,7 @@ SentPkmnIntoBox: ; de74 (3:5e74)
inc a
ld [de], a
ld a, [wd004]
- ld [wce60], a
+ ld [wCurSpecies], a
ld c, a
.asm_de8b
inc de
@@ -1221,7 +1222,7 @@ ComputeNPCTrademonStats:
ld a, MON_SPECIES
call GetPartyParamLocation
ld a, [hl]
- ld [wce60], a
+ ld [wCurSpecies], a
call GetBaseData
ld a, MON_MAXHP
call GetPartyParamLocation
@@ -1506,7 +1507,7 @@ GivePoke: ; Give a Pokemon from script
.asm_e2c9
ld a, [wCurPartySpecies]
- ld [wd0ed], a
+ ld [wTempEnemyMonSpecies], a
callab LoadEnemyMon
call SentPkmnIntoBox
jp nc, Functione3af
@@ -1529,7 +1530,7 @@ GivePoke: ; Give a Pokemon from script
.asm_e2fa
ld a, [wd004]
ld [wd151], a
- ld [wd0ed], a
+ ld [wTempEnemyMonSpecies], a
call GetPokemonName
ld hl, wStringBuffer1
ld de, wMonOrItemNameBuffer
diff --git a/engine/specials.asm b/engine/specials.asm
index 98f19abb..a3279a57 100755
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -153,28 +153,28 @@ SpecialSeenMon: ; c3ac
Special_FindGreaterThanThatLevel: ; c3b4
ld a, [wScriptVar]
ld b, a
- callba Functione6a9 ; same bank
+ callba PartySearch_MaximumLevel ; same bank
jr z, asm_c3f2
jr asm_c3ec
Special_FindAtLeastThatHappy: ; c3c2
ld a, [wScriptVar]
ld b, a
- callba Functione6b0 ; same bank
+ callba PartySearch_MinimumHappiness ; same bank
jr z, asm_c3f2
jr asm_c3ec
Special_FindThatSpecies: ; c3d0
ld a, [wScriptVar]
ld b, a
- callba Functione6b7 ; same bank
+ callba PartySearch_SameSpecies ; same bank
jr z, asm_c3f2
jr asm_c3ec
Special_FindThatSpeciesYourTrainerID: ; c3de
ld a, [wScriptVar]
ld b, a
- callba Functione6bd ; same bank
+ callba PartySearch_SameSpeciesAndYourID ; same bank
jr z, asm_c3f2
jr asm_c3ec
diff --git a/home.asm b/home.asm
index e292edf0..2e28b95f 100644
--- a/home.asm
+++ b/home.asm
@@ -939,7 +939,7 @@ GetName:: ; 3606
ld a, [wce61]
cp $1
jr nz, .asm_3624
- ld a, [wce60]
+ ld a, [wCurSpecies]
ld [wd151], a
call GetPokemonName
ld hl, $b
@@ -961,7 +961,7 @@ GetName:: ; 3606
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wce60]
+ ld a, [wCurSpecies]
dec a
call GetNthString
ld de, wStringBuffer1
@@ -1046,7 +1046,7 @@ GetItemName::
ld a, [wd151]
cp TM01
jr nc, .TM
- ld [wce60], a
+ ld [wCurSpecies], a
ld a, $4
ld [wce61], a
call GetName
@@ -1142,7 +1142,7 @@ GetMoveName::
ld a, $2
ld [wce61], a
ld a, [wd151]
- ld [wce60], a
+ ld [wCurSpecies], a
call GetName
ld de, wStringBuffer1
pop hl
@@ -1666,7 +1666,7 @@ GetBaseData::
push af
ld a, BANK(BaseData) ; $14
rst Bankswitch
- ld a, [wce60]
+ ld a, [wCurSpecies]
cp EGG
jr z, .egg
dec a
@@ -1694,7 +1694,7 @@ GetBaseData::
jr .asm_3ab3
.asm_3ab3
- ld a, [wce60]
+ ld a, [wCurSpecies]
ld [wd120], a
pop af
rst Bankswitch
diff --git a/main.asm b/main.asm
index a66c1a22..108926bf 100644
--- a/main.asm
+++ b/main.asm
@@ -411,20 +411,199 @@ INCLUDE "engine/anim_hp_bar.asm"
INCLUDE "engine/move_mon.asm"
INCLUDE "engine/billspctop.asm"
-Functione673:
-IF DEF(GOLD)
- dr $e673, $e68e
-Functione68e:
- dr $e68e, $e6a9
-Functione6a9:
- dr $e6a9, $e6b0
-Functione6b0:
- dr $e6b0, $e6b7
-Functione6b7:
- dr $e6b7, $e6bd
-Functione6bd:
- dr $e6bd, $e7a6
+Functione673: ; e673 (3:6673)
+ ld hl, wBreedMon1Species
+ ld de, wTempMonSpecies
+ ld bc, $20
+ call CopyBytes
+ callab CalcLevel
+ ld a, [wBreedMon1Level]
+ ld b, a
+ ld a, d
+ ld e, a
+ sub b
+ ld d, a
+ ret
+
+Functione68e: ; e68e (3:668e)
+ ld hl, wBreedMon2Species
+ ld de, wTempMon
+ ld bc, $20
+ call CopyBytes
+ callab CalcLevel
+ ld a, [wBreedMon2Level]
+ ld b, a
+ ld a, d
+ ld e, a
+ sub b
+ ld d, a
+ ret
+
+PartySearch_MaximumLevel: ; e6a9 (3:66a9)
+ ld hl, wPartyMon1Level
+ call PartySearch_LessThanValue
+ ret
+
+PartySearch_MinimumHappiness: ; e6b0 (3:66b0)
+ ld hl, wPartyMon1Happiness
+ call PartySearch_GreaterThanOrEqualToValue
+ ret
+
+PartySearch_SameSpecies: ; e6b7 (3:66b7)
+ ld hl, wPartyMons
+ jp PartySearch_GetIndexOfSpeciesInParty
+
+PartySearch_SameSpeciesAndYourID: ; e6bd (3:66bd)
+ ld hl, wPartyMon1
+ call PartySearch_GetIndexOfSpeciesInParty
+ ret z
+ ld a, c
+ ld hl, wPartyMon1ID
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld a, [wPlayerID]
+ cp [hl]
+ jr nz, .nope
+ inc hl
+ ld a, [wPlayerID + 1]
+ cp [hl]
+ jr nz, .nope
+ ld a, $1
+ and a
+ ret
+
+.nope
+ xor a
+ ret
+
+PartySearch_GreaterThanOrEqualToValue: ; e6e1 (3:66e1)
+ ld c, $0
+ ld a, [wPartyCount]
+ ld d, a
+.loop
+ ld a, d
+ dec a
+ push hl
+ push bc
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ pop bc
+ ld a, b
+ cp [hl]
+ pop hl
+ jr z, .shift
+ jr nc, .skip
+.shift
+ ld a, c
+ or $1
+ ld c, a
+.skip
+ sla c
+ dec d
+ jr nz, .loop
+ call PartySearch_FilterEggs
+ ld a, c
+ and a
+ ret
+
+PartySearch_LessThanValue: ; e708 (3:6708)
+ ld c, $0
+ ld a, [wPokemonData]
+ ld d, a
+.loop
+ ld a, d
+ dec a
+ push hl
+ push bc
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ pop bc
+ ld a, b
+ cp [hl]
+ pop hl
+ jr c, .skip
+ ld a, c
+ or $1
+ ld c, a
+.skip
+ sla c
+ dec d
+ jr nz, .loop
+ call PartySearch_FilterEggs
+ ld a, c
+ and a
+ ret
+
+PartySearch_GetIndexOfSpeciesInParty: ; e72d (3:672d)
+ ld c, -1
+ ld hl, wPartySpecies
+.loop
+ ld a, [hli]
+ cp $ff
+ ret z
+ inc c
+ cp b
+ jr nz, .loop
+ ld a, $1
+ and a
+ ret
+
+PartySearch_FilterEggs: ; e73e (3:673e)
+ ld e, $FF ^ 1
+ ld hl, wPartySpecies
+.loop
+ ld a, [hli]
+ cp $ff
+ ret z
+ cp EGG
+ jr nz, .not_egg
+ ld a, c
+ and e
+ ld c, a
+.not_egg
+ rlc e
+ jr .loop
+
+BugContest_SetCaughtContestMon:
+ ld a, [wContestMonSpecies]
+ and a
+ jr z, .asm_e76e
+ ld [wd151], a
+ callba DisplayAlreadyCaughtText
+ callba DisplayCaughtContestMonStats
+ lb bc, 14, 7
+ call PlaceYesNoBox
+ ret c
+.asm_e76e
+ call GenerateBugContestMonStats
+ ld a, [wTempEnemyMonSpecies]
+ ld [wd151], a
+ call GetPokemonName
+ ld hl, Text_CaughtBugMon
+ call PrintText
+ ret
+
+GenerateBugContestMonStats: ; e781 (3:6781)
+ ld a, [wTempEnemyMonSpecies]
+ ld [wCurSpecies], a
+ ld [wd004], a
+ call GetBaseData
+ xor a
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld hl, wContestMon
+ call ByteFill
+ xor a
+ ld [wMonType], a
+ ld hl, wContestMon
+ jp GeneratePartyMonStats
+
+Text_CaughtBugMon:
+ ; Caught @ !
+ text_jump Text_CaughtBugMon_
+ db "@"
+
DoItemEffect_::
+IF DEF(GOLD)
dr $e7a6, $f900
Functionf900:
dr $f900, $f933
@@ -433,18 +612,6 @@ GetMaxPPOfMove:
ENDC
IF DEF(SILVER)
- dr $e671, $e68c
-Functione68e:
- dr $e68c, $e6a7
-Functione6a9:
- dr $e6a7, $e6ae
-Functione6b0:
- dr $e6ae, $e6b5
-Functione6b7:
- dr $e6b5, $e6bb
-Functione6bd:
- dr $e6bb, $e7a4
-DoItemEffect_::
dr $e7a4, $f8fe
Functionf900:
dr $f8fe, $f931
@@ -1087,15 +1254,21 @@ LoadPoisonBGPals::
dr $cbc76, $cc000
SECTION "bank33", ROMX, BANK[$33]
-BattleAnimCommands:: ; Not actually where it is, I just needed the label for BANK to work
- dr $cc000, $cc0d6
+DisplayCaughtContestMonStats:
+ dr $cc000, $cc0c8
+
+DisplayAlreadyCaughtText:
+ dr $cc0c8, $cc0d6
Predef38::
Predef39::
ret
PlayBattleAnim::
- dr $cc0d7, $d0000
+ dr $cc0d7, $cc283
+
+BattleAnimCommands::
+ dr $cc283, $d0000
SECTION "bank34", ROMX, BANK[$34]
dr $d0000, $d4000
@@ -1475,7 +1648,10 @@ Text_ItsYourLastPokemon_::
dr $1949e8, $194a0a
Text_CantTakeAnyMorePokemon_::
- dr $194a0a, $195610
+ dr $194a0a, $194a28
+
+Text_CaughtBugMon_::
+ dr $194a28, $195610
ClockTimeUnknownText_:: ; 195610
dr $195610, $195624
diff --git a/wram.asm b/wram.asm
index 32504ec6..8547edd0 100644
--- a/wram.asm
+++ b/wram.asm
@@ -2038,7 +2038,7 @@ wce5a:: ds 1 ; ce5a
wLinkTimeoutFrames:: ds 2
wce5d:: ds 2 ; ce5d
wMonType:: ds 1 ; ce5f
-wce60:: ds 1 ; ce60
+wCurSpecies:: ds 1 ; ce60
wce61:: ds 1 ; ce61
wce62:: ds 1 ; ce62
wce63:: ds 1 ; ce63
@@ -2571,7 +2571,7 @@ wd0e9:: ds 1 ; d0e9
wd0ea:: ds 1 ; d0ea
wd0eb:: ds 1 ; d0eb
wd0ec:: ds 1 ; d0ec
-wd0ed:: ds 1 ; d0ed
+wTempEnemyMonSpecies:: ds 1 ; d0ed
wd0ee:: ds 1 ; d0ee
wEnemyMon:: battle_struct wEnemyMon ; d0ef
@@ -3803,54 +3803,9 @@ wdce3:: ds 1 ; dce3
wdce4:: ds 1 ; dce4
wdce5:: ds 1 ; dce5
wdce6:: ds 1 ; dce6
-wdce7:: ds 1 ; dce7
-wdce8:: ds 1 ; dce8
-wdce9:: ds 1 ; dce9
-wdcea:: ds 1 ; dcea
-wdceb:: ds 1 ; dceb
-wdcec:: ds 1 ; dcec
-wdced:: ds 1 ; dced
-wdcee:: ds 1 ; dcee
-wdcef:: ds 1 ; dcef
-wdcf0:: ds 1 ; dcf0
-wdcf1:: ds 1 ; dcf1
-wdcf2:: ds 1 ; dcf2
-wdcf3:: ds 1 ; dcf3
-wdcf4:: ds 1 ; dcf4
-wdcf5:: ds 1 ; dcf5
-wdcf6:: ds 1 ; dcf6
-wdcf7:: ds 1 ; dcf7
-wdcf8:: ds 1 ; dcf8
-wdcf9:: ds 1 ; dcf9
-wdcfa:: ds 1 ; dcfa
-wdcfb:: ds 1 ; dcfb
-wdcfc:: ds 1 ; dcfc
-wdcfd:: ds 1 ; dcfd
-wdcfe:: ds 1 ; dcfe
-wdcff:: ds 1 ; dcff
-wdd00:: ds 1 ; dd00
-wdd01:: ds 1 ; dd01
-wdd02:: ds 1 ; dd02
-wdd03:: ds 1 ; dd03
-wdd04:: ds 1 ; dd04
-wdd05:: ds 1 ; dd05
-wdd06:: ds 1 ; dd06
-wdd07:: ds 1 ; dd07
-wdd08:: ds 1 ; dd08
-wdd09:: ds 1 ; dd09
-wdd0a:: ds 1 ; dd0a
-wdd0b:: ds 1 ; dd0b
-wdd0c:: ds 1 ; dd0c
-wdd0d:: ds 1 ; dd0d
-wdd0e:: ds 1 ; dd0e
-wdd0f:: ds 1 ; dd0f
-wdd10:: ds 1 ; dd10
-wdd11:: ds 1 ; dd11
-wdd12:: ds 1 ; dd12
-wdd13:: ds 1 ; dd13
-wdd14:: ds 1 ; dd14
-wdd15:: ds 1 ; dd15
-wdd16:: ds 1 ; dd16
+
+wContestMon:: party_struct wContestMon ; dce7
+
wdd17:: ds 1 ; dd17
wdd18:: ds 1 ; dd18
wdd19:: ds 1 ; dd19