This commit is contained in:
Rangi
2018-04-04 23:56:40 -04:00
274 changed files with 667 additions and 554 deletions

0
engine/events/basement_key.asm Executable file → Normal file
View File

0
engine/events/battle_tower/battle_tower.asm Executable file → Normal file
View File

0
engine/events/battle_tower/trainer_text.asm Executable file → Normal file
View File

0
engine/events/bug_contest/contest_2.asm Executable file → Normal file
View File

0
engine/events/bug_contest/judging.asm Executable file → Normal file
View File

0
engine/events/card_key.asm Executable file → Normal file
View File

0
engine/events/celebi.asm Executable file → Normal file
View File

View File

@@ -0,0 +1,20 @@
CheckSave:: ; 4cffe
ld a, BANK(sCheckValue1) ; BANK(sCheckValue2)
call GetSRAMBank
ld a, [sCheckValue1]
ld b, a
ld a, [sCheckValue2]
ld c, a
call CloseSRAM
ld a, b
cp SAVE_CHECK_VALUE_1
jr nz, .ok
ld a, c
cp SAVE_CHECK_VALUE_2
jr nz, .ok
ld c, $1
ret
.ok
ld c, $0
ret

View File

@@ -0,0 +1,19 @@
CheckTime:: ; c000
ld a, [wTimeOfDay]
ld hl, .TimeOfDayTable
ld de, 2
call IsInArray
inc hl
ld c, [hl]
ret c
xor a
ld c, a
ret
.TimeOfDayTable: ; c012
db MORN_F, MORN
db DAY_F, DAY
db NITE_F, NITE
db NITE_F, NITE
db -1

0
engine/events/daycare.asm Executable file → Normal file
View File

93
engine/events/diploma.asm Normal file
View File

@@ -0,0 +1,93 @@
_Diploma: ; 1dd702
call PlaceDiplomaOnScreen
call WaitPressAorB_BlinkCursor
ret
; 1dd709
PlaceDiplomaOnScreen: ; 1dd709
call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
ld hl, DiplomaGFX
ld de, vTiles2
call Decompress
ld hl, DiplomaPage1Tilemap
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ld de, .Player
hlcoord 2, 5
call PlaceString
ld de, .EmptyString
hlcoord 15, 5
call PlaceString
ld de, wPlayerName
hlcoord 9, 5
call PlaceString
ld de, .Certification
hlcoord 2, 8
call PlaceString
call EnableLCD
call WaitBGMap
ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
call DelayFrame
ret
; 1dd760
.Player:
db "PLAYER@"
.EmptyString:
db "@"
.Certification:
db "This certifies"
next "that you have"
next "completed the"
next "new #DEX."
next "Congratulations!"
db "@"
; 1dd7ae
PrintDiplomaPage2: ; 1dd7ae
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
ld hl, DiplomaPage2Tilemap
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ld de, .GameFreak
hlcoord 8, 0
call PlaceString
ld de, .PlayTime
hlcoord 3, 15
call PlaceString
hlcoord 12, 15
ld de, wGameTimeHours
lb bc, 2, 4
call PrintNum
ld [hl], $67 ; colon
inc hl
ld de, wGameTimeMinutes
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ret
; 1dd7f0
.PlayTime: db "PLAY TIME@"
.GameFreak: db "GAME FREAK@"
; 1dd805
DiplomaGFX: ; 1dd805
INCBIN "gfx/diploma/diploma.2bpp.lz"
DiplomaPage1Tilemap: ; 1ddc4b
INCBIN "gfx/diploma/page1.tilemap"
DiplomaPage2Tilemap: ; 1dddb3
INCBIN "gfx/diploma/page2.tilemap"

0
engine/events/elevator.asm Executable file → Normal file
View File

View File

@@ -0,0 +1,86 @@
EngineFlagAction:: ; 80430
; Do action b on engine flag de
;
; b = 0: reset flag
; = 1: set flag
; > 1: check flag, result in c
;
; Setting/resetting does not return a result.
; 16-bit flag ids are considered invalid, but it's nice
; to know that the infrastructure is there.
ld a, d
cp 0
jr z, .ceiling
jr c, .read ; cp 0 can't set carry!
jr .invalid
; There are only $a2 engine flags, so
; anything beyond that is invalid too.
.ceiling
ld a, e
cp NUM_ENGINE_FLAGS
jr c, .read
; Invalid flags are treated as flag 00.
.invalid
xor a
ld e, a
ld d, a
; Get this flag's location.
.read
ld hl, EngineFlags
; location
add hl, de
add hl, de
; bit
add hl, de
; location
ld e, [hl]
inc hl
ld d, [hl]
inc hl
; bit
ld c, [hl]
; What are we doing with this flag?
ld a, b
cp 1
jr c, .reset ; b = 0
jr z, .set ; b = 1
; Return the given flag in c.
.check
ld a, [de]
and c
ld c, a
ret
; Set the given flag.
.set
ld a, [de]
or c
ld [de], a
ret
; Reset the given flag.
.reset
ld a, c
cpl ; AND all bits except the one in question
ld c, a
ld a, [de]
and c
ld [de], a
ret
; 80462
INCLUDE "data/engine_flags.asm"

0
engine/events/field_moves.asm Executable file → Normal file
View File

0
engine/events/forced_movement.asm Executable file → Normal file
View File

82
engine/events/haircut.asm Normal file
View File

@@ -0,0 +1,82 @@
BillsGrandfather: ; 73f7
farcall SelectMonFromParty
jr c, .cancel
ld a, [wCurPartySpecies]
ld [wScriptVar], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
jp CopyPokemonName_Buffer1_Buffer3
.cancel
xor a
ld [wScriptVar], a
ret
YoungerHaircutBrother: ; 7413
ld hl, HappinessData_YoungerHaircutBrother
jr HaircutOrGrooming
OlderHaircutBrother: ; 7418
ld hl, HappinessData_OlderHaircutBrother
jr HaircutOrGrooming
DaisysGrooming: ; 741d
ld hl, HappinessData_DaisysGrooming
; fallthrough
HaircutOrGrooming: ; 7420
push hl
farcall SelectMonFromParty
pop hl
jr c, .nope
ld a, [wCurPartySpecies]
cp EGG
jr z, .egg
push hl
call GetCurNick
call CopyPokemonName_Buffer1_Buffer3
pop hl
call Random
; Bug: Subtracting $ff from $ff fails to set c.
; This can result in overflow into the next data array.
; In the case of getting a grooming from Daisy, we bleed
; into CopyPokemonName_Buffer1_Buffer3, which passes
; $d0 to ChangeHappiness and returns $73 to the script.
; The end result is that there is a 0.4% chance your
; Pokemon's happiness will not change at all.
.loop
sub [hl]
jr c, .ok
inc hl
inc hl
inc hl
jr .loop
.ok
inc hl
ld a, [hli]
ld [wScriptVar], a
ld c, [hl]
call ChangeHappiness
ret
.nope
xor a
ld [wScriptVar], a
ret
.egg
ld a, 1
ld [wScriptVar], a
ret
INCLUDE "data/events/happiness_probabilities.asm"
CopyPokemonName_Buffer1_Buffer3: ; 746e
ld hl, wStringBuffer1
ld de, wStringBuffer3
ld bc, MON_NAME_LENGTH
jp CopyBytes
DummyPredef1: ; 747a
ret

0
engine/events/halloffame.asm Executable file → Normal file
View File

0
engine/events/happiness_egg.asm Executable file → Normal file
View File

0
engine/events/heal_machine_anim.asm Executable file → Normal file
View File

Some files were not shown because too many files have changed in this diff Show More