From f123dd89d49f6f70d823947a47a3ce117d6cd01a Mon Sep 17 00:00:00 2001 From: 2Tie Date: Sun, 17 Jun 2018 01:05:52 -0600 Subject: more npc code and some audio stuff, slimmin down the shim --- home/audio.asm | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++ home/talk_to_npc.asm | 20 +++++++- 2 files changed, 145 insertions(+), 2 deletions(-) (limited to 'home') diff --git a/home/audio.asm b/home/audio.asm index 03a0990..e50abc1 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -140,3 +140,130 @@ PlaySFX:: ; 3d63 ret WaitPlaySFX:: ; 3d7f + call WaitSFX + call PlaySFX + ret + +WaitSFX:: ; 3d86 + push hl +.loop + ld hl, wChannel5Flags1 + bit 0, [hl] + jr nz, .loop + ld hl, wChannel6Flags1 + bit 0, [hl] + jr nz, .loop + ld hl, wChannel7Flags1 + bit 0, [hl] + jr nz, .loop + ld hl, wChannel8Flags1 + bit 0, [hl] + jr nz, .loop + pop hl + ret + +MaxVolume:: ; 3DA5 + ld a, $77 + ld [wVolume], a + ret + +LowVolume:: ; 3DAB + ld a, $33 + ld [wVolume], a + ret + +VolumeOff:: ; 3DB1 + xor a + ld [wVolume], a + ret + +UpdateSoundNTimes:: ; 3DB6 +.loop + and a + ret z + dec a + call UpdateSound + jr .loop + +FadeToMapMusic:: ; 3DBE + push hl + push de + push bc + push af + call GetMapMusic + ld a, [wMapMusic] + cp e + jr z, .jump + ld a, $08 + ld [wMusicFade], a + ld a, e + ld [wMusicFadeID], a + ld a, d + ld [wMusicFadeID+1], a + ld a, e + ld [wMapMusic], a +.jump + pop af + pop bc + pop de + pop hl + ret + +PlayMapMusic:: ; 3DE1 + push hl + push de + push bc + push af + call GetMapMusic + ld a, [wMapMusic] + cp e + jr z, .jump + push de + ld de, $0000 + call PlayMusic + call DelayFrame + pop de + ld a, e + ld [wMapMusic], a + call PlayMusic +.jump + pop af + pop bc + pop de + pop hl + ret + +SpecialMapMusic:: ; 3E05 + ld a, [wPlayerBikeSurfState] + and a + jr z, .normal + cp $02 + jr z, .state2 + ld de, $0009 + scf + ret + +.state2 ; 3E14 + ld de, $0000 + scf + ret + +.normal ; 3E19 + and a + ret + +GetMapMusic:: ; 3E1B + call SpecialMapMusic + ret c + ld a, [wMapPermissions] + cp $01 + jr z, .jump + cp $03 + jr z, .jump + ld de, $0002 + ret +.jump ; 3E2E + ld de, $0007 + ret + +; 3E32, this is likely not a function. \ No newline at end of file diff --git a/home/talk_to_npc.asm b/home/talk_to_npc.asm index 1820692..3371b3c 100644 --- a/home/talk_to_npc.asm +++ b/home/talk_to_npc.asm @@ -260,7 +260,7 @@ CheckInlineTrainer:: ; 00:31C4 add hl, de ld a, [hl] call GetObjectStruct ; de is the address of the number of object we want - call $31EB + call GetInlineMapObject jr nc, .escape ; if c flag isn't set, leave ld hl, $000B ; map_object script add hl, de @@ -354,4 +354,20 @@ SetFFInAccumulator:: ; 3240 dec a ret -; 3243 \ No newline at end of file +Function3243:: ; 3243 + ldh a, [hROMBank] + push af + ld a, $03 + call Bankswitch + push hl + push de + push bc + call _TossItem + pop bc + pop de + pop hl + pop af + call Bankswitch + ret + +;3259 \ No newline at end of file -- cgit v1.2.3