diff options
author | mid-kid <esteve.varela@gmail.com> | 2018-03-13 13:07:16 +0100 |
---|---|---|
committer | mid-kid <esteve.varela@gmail.com> | 2018-03-13 13:21:40 +0100 |
commit | baa0dc5a963a79843b37888bcfe1d2dfe833ade9 (patch) | |
tree | 968c86105bd67a3121d8f3f20018bfc59191f4c9 /engine/search.asm | |
parent | 12070ca50067d3abe36a730190f88ee43f2cace9 (diff) |
Organize the engine/ directory
This is an informed attempt at reorganizing the engine/ directory by
creating categorized subdirectories, in order to make it easier to
navigate and find things.
The directories created are as follows:
* engine/game: Contains all "minigames", things like the unown puzzle
and slot machine.
* engine/gfx: Contains all handling of graphics. From loading palettes
to playing animations.
* engine/link: Contains all multiplayer functionality.
* engine/menu: Contains all generic/misc. menus and menu code.
Other, more specialized menus are in their own subdirectories (pokedex,
pokegear, party menu, etc).
* engine/overworld: Contains all handling of the overworld. From loading
and connecting maps to wild encounters and the scripting engine.
* engine/pokegear: In the same vein as engine/pokedex, except it could
use some more splitting up.
* engine/pokemon: Contains everything related to manipulating pokemon
data. From the pokemon storage system to evolution and mail.
* engine/printer: Contains everything related to printing things as well
as the printer communication.
* engine/title: Contains intro sequences, title screens and credits.
Diffstat (limited to 'engine/search.asm')
-rwxr-xr-x | engine/search.asm | 276 |
1 files changed, 0 insertions, 276 deletions
diff --git a/engine/search.asm b/engine/search.asm deleted file mode 100755 index 57b489a37..000000000 --- a/engine/search.asm +++ /dev/null @@ -1,276 +0,0 @@ -BeastsCheck: ; 0x4a6e8 -; Check if the player owns all three legendary beasts. -; They must exist in either party or PC, and have the player's OT and ID. -; Return the result in wScriptVar. - - ld a, RAIKOU - ld [wScriptVar], a - call CheckOwnMonAnywhere - jr nc, .notexist - - ld a, ENTEI - ld [wScriptVar], a - call CheckOwnMonAnywhere - jr nc, .notexist - - ld a, SUICUNE - ld [wScriptVar], a - call CheckOwnMonAnywhere - jr nc, .notexist - - ; they exist - ld a, 1 - ld [wScriptVar], a - ret - -.notexist - xor a - ld [wScriptVar], a - ret - - -MonCheck: ; 0x4a711 -; Check if the player owns any Pokémon of the species in wScriptVar. -; Return the result in wScriptVar. - - call CheckOwnMonAnywhere - jr c, .exists - - ; doesn't exist - xor a - ld [wScriptVar], a - ret - -.exists - ld a, 1 - ld [wScriptVar], a - ret - - -CheckOwnMonAnywhere: ; 0x4a721 -; Check if the player owns any monsters of the species in wScriptVar. -; It must exist in either party or PC, and have the player's OT and ID. - - ; If there are no monsters in the party, - ; the player must not own any yet. - ld a, [wPartyCount] - and a - ret z - - ld d, a - ld e, 0 - ld hl, wPartyMon1Species - ld bc, wPartyMonOT - - ; Run CheckOwnMon on each Pokémon in the party. -.partymon - call CheckOwnMon - ret c ; found! - - push bc - ld bc, PARTYMON_STRUCT_LENGTH - add hl, bc - pop bc - call UpdateOTPointer - dec d - jr nz, .partymon - - ; Run CheckOwnMon on each Pokémon in the PC. - ld a, BANK(sBoxCount) - call GetSRAMBank - ld a, [sBoxCount] - and a - jr z, .boxes - - ld d, a - ld hl, sBoxMon1Species - ld bc, sBoxMonOT -.openboxmon - call CheckOwnMon - jr nc, .loop - - ; found! - call CloseSRAM - ret - -.loop - push bc - ld bc, BOXMON_STRUCT_LENGTH - add hl, bc - pop bc - call UpdateOTPointer - dec d - jr nz, .openboxmon - - ; Run CheckOwnMon on each monster in the other 13 PC boxes. -.boxes - call CloseSRAM - - ld c, 0 -.box - ; Don't search the current box again. - ld a, [wCurBox] - and $f - cp c - jr z, .loopbox - - ; Load the box. - ld hl, BoxAddressTable1 - ld b, 0 - add hl, bc - add hl, bc - add hl, bc - ld a, [hli] - call GetSRAMBank - ld a, [hli] - ld h, [hl] - ld l, a - - ; Number of monsters in the box - ld a, [hl] - and a - jr z, .loopbox - - push bc - - push hl - ld de, sBoxMons - sBoxCount - add hl, de - ld d, h - ld e, l - pop hl - push de - ld de, sBoxMonOT - sBoxCount - add hl, de - ld b, h - ld c, l - pop hl - - ld d, a - -.boxmon - call CheckOwnMon - jr nc, .loopboxmon - - ; found! - pop bc - call CloseSRAM - ret - -.loopboxmon - push bc - ld bc, BOXMON_STRUCT_LENGTH - add hl, bc - pop bc - call UpdateOTPointer - dec d - jr nz, .boxmon - pop bc - -.loopbox - inc c - ld a, c - cp NUM_BOXES - jr c, .box - - ; not found - call CloseSRAM - and a - ret - - -CheckOwnMon: ; 0x4a7ba -; Check if a Pokémon belongs to the player and is of a specific species. - -; inputs: -; hl, pointer to PartyMonNSpecies -; bc, pointer to PartyMonNOT -; wScriptVar should contain the species we're looking for - -; outputs: -; sets carry if monster matches species, ID, and OT name. - - push bc - push hl - push de - ld d, b - ld e, c - -; check species - ld a, [wScriptVar] ; species we're looking for - ld b, [hl] ; species we have - cp b - jr nz, .notfound ; species doesn't match - -; check ID number - ld bc, MON_ID - add hl, bc ; now hl points to ID number - ld a, [wPlayerID] - cp [hl] - jr nz, .notfound ; ID doesn't match - inc hl - ld a, [wPlayerID + 1] - cp [hl] - jr nz, .notfound ; ID doesn't match - -; check OT -; This only checks five characters, which is fine for the Japanese version, -; but in the English version the player name is 7 characters, so this is wrong. - - ld hl, wPlayerName - -rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2 - ld a, [de] - cp [hl] - jr nz, .notfound - cp "@" - jr z, .found ; reached end of string - inc hl - inc de -endr - - ld a, [de] - cp [hl] - jr z, .found - -.notfound - pop de - pop hl - pop bc - and a - ret - -.found - pop de - pop hl - pop bc - scf - ret -; 0x4a810 - -BoxAddressTable1: ; 4a810 - dba sBox1 - dba sBox2 - dba sBox3 - dba sBox4 - dba sBox5 - dba sBox6 - dba sBox7 - dba sBox8 - dba sBox9 - dba sBox10 - dba sBox11 - dba sBox12 - dba sBox13 - dba sBox14 -; 4a83a - -UpdateOTPointer: ; 0x4a83a - push hl - ld hl, NAME_LENGTH - add hl, bc - ld b, h - ld c, l - pop hl - ret -; 0x4a843 |