Path: blob/master/engine/events/hidden_objects/bench_guys.asm
1271 views
PrintBenchGuyText:1call EnableAutoTextBoxDrawing2ld hl, BenchGuyTextPointers3ld a, [wCurMap]4ld b, a5.loop6ld a, [hli]7cp -18ret z9cp b10jr z, .match11inc hl12inc hl13jr .loop14.match15ld a, [hli]16ld b, a17ld a, [wSpritePlayerStateData1FacingDirection]18cp b1920; bug: an 'inc hl' instruction is needed before looping back. When trying to21; talk to a bench guy from above, this Sprite Facing test will fail, and the22; next loop iteration will be misaligned within BenchGuyTextPointers table.23; As a result, the routine will miss the terminator byte, and continue to24; process data beyond the table boundary.25; It seems that it will only return after starting to read data from VRAM26; (According to Pan Docs, during PPU mode 3, reads return garbage value,27; usually $FF).28jr nz, .loop ; player isn't facing the bench guy29ld a, [hl]30jp PrintPredefTextID3132INCLUDE "data/events/bench_guys.asm"3334ViridianCityPokecenterBenchGuyText::35text_far _ViridianCityPokecenterGuyText36text_end3738PewterCityPokecenterBenchGuyText::39text_far _PewterCityPokecenterGuyText40text_end4142CeruleanCityPokecenterBenchGuyText::43text_far _CeruleanPokecenterGuyText44text_end4546LavenderCityPokecenterBenchGuyText::47text_far _LavenderPokecenterGuyText48text_end4950MtMoonPokecenterBenchGuyText::51text_far _MtMoonPokecenterBenchGuyText52text_end5354RockTunnelPokecenterBenchGuyText::55text_far _RockTunnelPokecenterGuyText56text_end5758UnusedBenchGuyText1::59text_far _UnusedBenchGuyText160text_end6162UnusedBenchGuyText2::63text_far _UnusedBenchGuyText264text_end6566UnusedBenchGuyText3::67text_far _UnusedBenchGuyText368text_end6970VermilionCityPokecenterBenchGuyText::71text_far _VermilionPokecenterGuyText72text_end7374CeladonCityPokecenterBenchGuyText::75text_far _CeladonCityPokecenterGuyText76text_end7778FuchsiaCityPokecenterBenchGuyText::79text_far _FuchsiaCityPokecenterGuyText80text_end8182CinnabarIslandPokecenterBenchGuyText::83text_far _CinnabarPokecenterGuyText84text_end8586SaffronCityPokecenterBenchGuyText::87text_asm88CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI89ld hl, SaffronCityPokecenterBenchGuyText290jr nz, .printText91ld hl, SaffronCityPokecenterBenchGuyText192.printText93call PrintText94jp TextScriptEnd9596SaffronCityPokecenterBenchGuyText1:97text_far _SaffronCityPokecenterGuyText198text_end99100SaffronCityPokecenterBenchGuyText2:101text_far _SaffronCityPokecenterGuyText2102text_end103104CeladonCityHotelText::105text_far _CeladonCityHotelText106text_end107108109