forked from mirror/Archipelago
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
110 lines
2.0 KiB
YAML
110 lines
2.0 KiB
YAML
# return z iff the current group and room match c and b.
|
|
00//compareRoom: |
|
|
ld a,(wActiveGroup)
|
|
cp c
|
|
ret nz
|
|
ld a,(wActiveRoom)
|
|
cp b
|
|
ret
|
|
|
|
# searches for a value in a table starting at hl, with an entry matching
|
|
# keys b and subkey c, and values e bytes long. sets c if found. a key of
|
|
# ff ends the table.
|
|
00//searchDoubleKey: |
|
|
@loop:
|
|
ldi a,(hl)
|
|
cp $ff
|
|
ret z
|
|
cp b
|
|
jr nz,@next
|
|
ldi a,(hl)
|
|
cp c
|
|
jr nz,@done
|
|
scf
|
|
ret
|
|
@next:
|
|
inc hl
|
|
@done:
|
|
ld a,e
|
|
rst 10
|
|
jr @loop
|
|
|
|
# Look for an interaction of type treasure in the room, and return the address of the first one found
|
|
# in HL. Carry flag is set if found.
|
|
00//findTreasure: |
|
|
ld hl,$d041
|
|
@loop:
|
|
ld a,(hl)
|
|
cp INTERACID_TREASURE
|
|
jr nz,@next
|
|
scf
|
|
ret
|
|
|
|
@next:
|
|
ld a,h
|
|
cp $df
|
|
jr z,@endNotFound
|
|
inc h
|
|
jr @loop
|
|
|
|
@endNotFound:
|
|
scf
|
|
ccf
|
|
ret
|
|
|
|
# searches for a value in a table starting at hl, with an entry matching
|
|
# key "a" and values "e" bytes long. sets c if found. a key of ff ends the table.
|
|
00//searchKey: |
|
|
ld b,a
|
|
@loop:
|
|
ldi a,(hl)
|
|
cp $ff
|
|
ret z
|
|
cp b
|
|
jr nz,@next
|
|
scf
|
|
ret
|
|
@next:
|
|
ld a,e
|
|
rst 10
|
|
jr @loop
|
|
|
|
# b = treasure id
|
|
# c = treasure subid
|
|
00//spawnTreasureOnLink: |
|
|
call createTreasure
|
|
ret nz
|
|
push de
|
|
ld de,w1Link.yh
|
|
call objectCopyPosition_rawAddress
|
|
pop de
|
|
xor a
|
|
ret
|
|
|
|
# call a function hl in bank 02, preserving af. e can't be used as a
|
|
# parameter to that function, but it can be returned. this function only
|
|
# exists because banks 08 and 09 are so tight on space.
|
|
00//callBank2: |
|
|
push af
|
|
ld e,$02
|
|
call interBankCall
|
|
pop af
|
|
ret
|
|
|
|
# Add a "lose item" script command attached to unused byte 0xdc
|
|
0b//scriptCmd_loseItem: |
|
|
pop hl
|
|
inc hl
|
|
ldi a,(hl)
|
|
call loseTreasure
|
|
ret
|
|
0b/40c1/: dw scriptCmd_loseItem
|
|
|
|
# Puts the current amount of essences possessed into a
|
|
00//getEssenceCount: |
|
|
push bc
|
|
ld a,(wEssencesObtained)
|
|
call getNumSetBits
|
|
pop bc
|
|
ret
|