This commit is contained in:
pikalaxalt
2016-03-19 19:46:39 -04:00
9 changed files with 765 additions and 877 deletions

View File

@@ -1,6 +1,8 @@
The source files are assembled into a rom using [**rgbds**](https://github.com/bentley/rgbds). The source files are assembled into a rom using [**rgbds**](https://github.com/bentley/rgbds).
These instructions explain how to set up the tools required to build. These instructions explain how to set up the tools required to build.
If you run into trouble, ask on irc ([**freenode#pret**](https://kiwiirc.com/client/irc.freenode.net/?#pret)).
# Linux # Linux
@@ -50,12 +52,12 @@ make
# Windows # Windows
To build on Windows, use [**Cygwin**](http://cygwin.com/install.html). Use the default settings. To build on Windows, install [**Cygwin**](http://cygwin.com/install.html) with the default settings.
In the installer, select the following packages: `make` `git` `python` `gettext` In the installer, select the following packages: `make` `git` `python` `gettext`
Then get the most recent version of [**rgbds**](https://github.com/bentley/rgbds/releases/). Then get the most recent version of [**rgbds**](https://github.com/bentley/rgbds/releases/).
Extract the archive and put `rgbasm.exe`, `rgblink.exe` and `rgbfix.exe` in `C:\cygwin\usr\local\bin`. Extract the archive and put `rgbasm.exe`, `rgblink.exe` and `rgbfix.exe` in `C:\cygwin64\usr\local\bin`.
In the **Cygwin terminal**: In the **Cygwin terminal**:

View File

@@ -53,11 +53,11 @@ compare: pokecrystal.gbc pokecrystal11.gbc
rgbasm -o $@ $< rgbasm -o $@ $<
pokecrystal11.gbc: $(crystal11_obj) pokecrystal11.gbc: $(crystal11_obj)
rgblink -n $*.sym -m $*.map -o $@ $^ rgblink -n pokecrystal11.sym -m pokecrystal11.map -o $@ $^
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -n 1 -p 0 -r 3 -t PM_CRYSTAL $@ rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -n 1 -p 0 -r 3 -t PM_CRYSTAL $@
pokecrystal.gbc: $(crystal_obj) pokecrystal.gbc: $(crystal_obj)
rgblink -n $*.sym -m $*.map -o $@ $^ rgblink -n pokecrystal.sym -m pokecrystal.map -o $@ $^
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@ rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
%.png: ; %.png: ;

View File

@@ -13,7 +13,7 @@ To set up the repository, see [**INSTALL.md**](INSTALL.md).
## See also ## See also
* Disassembly of [**Pokémon Red/Blue**][pokered] * Disassembly of [**Pokémon Red/Blue**][pokered]
* irc: **irc.freenode.net** [**#pret**][irc] * irc: [**freenode#pret**][irc]
[pokered]: https://github.com/iimarckus/pokered [pokered]: https://github.com/iimarckus/pokered
[irc]: https://kiwiirc.com/client/irc.freenode.net/?#pret [irc]: https://kiwiirc.com/client/irc.freenode.net/?#pret

View File

@@ -212,3 +212,26 @@ NUM_JOHTO_BADGES EQU const_value
NUM_KANTO_BADGES EQU const_value NUM_KANTO_BADGES EQU const_value
NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES
NUM_KANA EQU $2d NUM_KANA EQU $2d
SWARM_DUNSPARCE EQU 0
SWARM_YANMA EQU 1
FISHSWARM_QWILFISH EQU 1
FISHSWARM_REMORAID EQU 2
const_def
const FISHGROUP_NONE
const FISHGROUP_SHORE
const FISHGROUP_OCEAN
const FISHGROUP_LAKE
const FISHGROUP_POND
const FISHGROUP_DRATINI
const FISHGROUP_QWILFISH_SWARM
const FISHGROUP_REMORAID_SWARM
const FISHGROUP_GYARADOS
const FISHGROUP_DRATINI_2
const FISHGROUP_WHIRL_ISLANDS
const FISHGROUP_QWILFISH
const FISHGROUP_REMORAID
const FISHGROUP_QWILFISH_NO_SWARM

File diff suppressed because it is too large Load Diff

135
engine/fish.asm Normal file
View File

@@ -0,0 +1,135 @@
Fish: ; 92402
; Using a fishing rod.
; Fish for monsters with rod e in encounter group d.
; Return monster e at level d.
push af
push bc
push hl
ld b, e
call GetFishGroupIndex
ld hl, FishGroups
rept 7
add hl, de
endr
call .Fish
pop hl
pop bc
pop af
ret
; 9241a
.Fish: ; 9241a
; Fish for monsters with rod b from encounter data in FishGroup at hl.
; Return monster e at level d.
call Random
cp [hl]
jr nc, .no_bite
; Get encounter data by rod:
; 0: Old
; 1: Good
; 2: Super
inc hl
ld e, b
ld d, 0
rept 2
add hl, de
endr
ld a, [hli]
ld h, [hl]
ld l, a
; Compare the encounter chance to select a Pokemon.
call Random
.loop
cp [hl]
jr z, .ok
jr c, .ok
rept 3
inc hl
endr
jr .loop
.ok
inc hl
; Species 0 reads from a time-based encounter table.
ld a, [hli]
ld d, a
and a
call z, .TimeEncounter
ld e, [hl]
ret
.no_bite
ld de, 0
ret
.TimeEncounter:
; The level byte is repurposed as the index for the new table.
ld e, [hl]
ld d, 0
ld hl, TimeFishGroups
rept 4
add hl, de
endr
ld a, [TimeOfDay]
and 3
cp NITE
jr c, .time_species
rept 2
inc hl
endr
.time_species
ld d, [hl]
inc hl
ret
; 9245b
GetFishGroupIndex: ; 9245b
; Return the index of fishgroup d in de.
push hl
ld hl, DailyFlags
bit 2, [hl]
pop hl
jr z, .done
ld a, d
cp FISHGROUP_QWILFISH
jr z, .qwilfish
cp FISHGROUP_REMORAID
jr z, .remoraid
.done
dec d
ld e, d
ld d, 0
ret
.qwilfish
ld a, [wFishingSwarmFlag]
cp FISHSWARM_QWILFISH
jr nz, .done
ld d, FISHGROUP_QWILFISH_SWARM
jr .done
.remoraid
ld a, [wFishingSwarmFlag]
cp FISHSWARM_REMORAID
jr nz, .done
ld d, FISHGROUP_REMORAID_SWARM
jr .done
; 92488
INCLUDE "data/wild/fish.asm"

View File

@@ -1,6 +1,3 @@
SWARM_DUNSPARCE EQU 0
SWARM_YANMA EQU 1
UnusedPhoneScript: ; 0xbcea5 UnusedPhoneScript: ; 0xbcea5
farwritetext UnusedPhoneText farwritetext UnusedPhoneText
end end
@@ -832,7 +829,7 @@ Ralph_SetUpSwarm:
setflag ENGINE_SPECIAL_WILDDATA setflag ENGINE_SPECIAL_WILDDATA
pokenamemem QWILFISH, $1 pokenamemem QWILFISH, $1
landmarktotext ROUTE_32, $2 landmarktotext ROUTE_32, $2
writebyte $1 writebyte FISHSWARM_QWILFISH
special Special_ActivateFishingSwarm special Special_ActivateFishingSwarm
farjump UnknownScript_0xa05d6 farjump UnknownScript_0xa05d6

View File

@@ -3605,7 +3605,7 @@ FishFunction: ; cf8e
ld d, a ld d, a
ld a, [Buffer2] ld a, [Buffer2]
ld e, a ld e, a
callba FishAction callba Fish
ld a, d ld a, d
and a and a
jr z, .nonibble jr z, .nonibble
@@ -10536,7 +10536,7 @@ INCLUDE "engine/phone.asm"
INCLUDE "engine/timeset.asm" INCLUDE "engine/timeset.asm"
INCLUDE "engine/pokegear.asm" INCLUDE "engine/pokegear.asm"
INCLUDE "data/wild/fish.asm" INCLUDE "engine/fish.asm"
INCLUDE "engine/slot_machine.asm" INCLUDE "engine/slot_machine.asm"
SECTION "Phone Engine", ROMX, BANK[$28] SECTION "Phone Engine", ROMX, BANK[$28]

File diff suppressed because it is too large Load Diff