0++&Ͽغ;]W%;)%i/I>K;jlV p2TvͫgE#2Tv2TvT޼zE3#2T2TvxwwwfE4 """"""""""""""""""""""""""""""""33333333333333333333333333333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUffffffffffffffffffffffffffffffffwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwẅ̬̬̬̬̬̬̬̈̬̬33333333333333333333333333333333030303030303030303030000000000000000000000000000000000033000033000000330000330330033330033330033330033333< 0 00 03333̬̬̬̪쬪̬̬̬̪쬪33333333333333333333333333333333 pwpwpwpwwwwwwwwwwwʽݭݻʽݭ03333333ww33ww33333111333333318333833383333"""(83333333"""8333833383338383("83(833333338((883333"(""838333333"""338833383338333833383338333833333333333333333wpppwpwwʽݭݻʽݭ0001301103113113103833383333338333333888888333833833883883333338333333333833338888833383333338383833888833383338333833833833333333"""(8333833383338338338338333333333"""(8333833383338338338338333333333"""(833383338333833833833333333"""(8333833383338338338338333333333"""(8333833383338338338338333333333"""(8333833383338333833383338333333333333333338333833383388383383338388333833383833333388333833833333833383338338383383338388333833383833333388333833833333ݙ ݙݙЙ0303 а Ј3333333833333388888DDDD{ww{{{{DDDt{{ww{{{{{D@fdf@df@ff@fDf@dlDDDDflll̻ ̼̼ ̻̼ ;330300033333330330300wwww ݰ Йݙݙ{{{{{DDwwww{{{{DD{{{wwww@dDdLfdLdLldLDdLdLdLDDDDlDDDD kƼk̼k̼k̼k̼k̼k̼;""""""!"""!""2!"""!"""""2"2"#32"2"23q7w317s317s313372w333#3333ܪ @DDD@DDDDDDDDDDDdff@ff@ff@ffDDDDDDDDDdFDDfFfffFfffFfffFfffF00330330003303300331331003313310  !"""!"""!"""""""""""""""""""1313!3!33"3!21! @ff@ffdffdffDDDDDDDD@DDDDDDfffFfffFfffFfffFdffDDfFDDDDDD003303300033033003313310033133108338""8338""8338#"3333""33""33"2333313333   ̠ Ъ ̚33333333333103010311303310303 ܪ ͪ" ! "   " ! "   8333833383338338338338333333333"""(833383338333833833833333333"""(8333833383338338338338333333333"""(8333833383338338338338333333333"""(ȌȀ̈̈̀ȌȌȌȌȌ̈Ȍ̈ȌȌ" !"! "g&"!ygfvwgvwwiv!ag"rf"gwffwggwwvi       83338333333333383338333833383338333383338338383333333383338333333333333̌ȈȌ̈̈Ȍ" !"! "g&"!ygfvwgvwwi!q"r"gwfwwwwiff-f""m""m"-fffm"""m""ff-f""m""m"-fffm"""m""33.3"">"">".333>""">""33.3"">"">".333>""">""ff}fwwmwwmw}fffmwwwmwwff}fwwmwwmw}fffmwwwmwwffxfwwhwwhwxfffhwwwhwwffxfwwhwwhwxfffhwwwhwwʾʾ!23!!ff-f""m""m"-fffm"""m""ff-f""m""m"-fffm"""m""33.3"">"">".333>""">""33.3"">"">".333>""">""ff}fwwmwwmw}fffmwwwmwwff}fwwmwwmw}fffmwwwmwwffxfwwhwwhwxfffhwwwhwwffxfwwhwwhwxfffhwwwhwwʾʾ 33333333333383333833HDDDHDDDDDDDHDDDHDDDXXUUUUUUUXUXUXUUhffUhffUfUfUfUfUhffUhffffffwxwxwxxxwxwwwwhwwfffffwwfwwffffXfffXfXfXfffXfffXfXfXUUUUUUXXXXXwwwwpwwYpwU 3 0 !Uywwwwywww'wwwwwwDDDDDDDHDDDDDDDDD3338333888888888333DDDDDDDHDHHHHDDDDUUUUUUUUUUUUhfUUhfUhUhfUUhfUhXhfffxffwwfwfwwffwwwwhwwwhwhwhwwwhwwwhwhffffffhhffffpwpWUUpWUUpWUUpWU%p!" wwUUUUU%"RU"U Q""!"wwwwywy.U..U"UUwwUww~~~wwwDD333HUUhfffwwhff!0  "  ""R ""UUUUPUU.U..U"UUwwUwwU ~~~wwT~343434343434343434343434343434뒓CDCDCDCDCDCDCDCDCDCDCDCDCDCDCD34343434pqpqpqpq璓CDCDCDCD3434뒓CDCD3434pqpqpq璓CDCDpqpq钓3434pqpqpqpqpqpqpqCDuvCD3434rst34뒓鐑pqpqpqpqpqCDCDCD343434343434343434343434343434뒓CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDuv풓uvuv풓풓뒓풓Ғpquvuvuvrstpqrstrstpq텆rst풓rst풓343434CDCDCD343434343434pqCDCDCDCDCDCD34343434CDCDCDCD343434CDCDCD343434343434CDCDCDCDCDCD34CDpqpq䶸䶷䶷䷷䶷䶷䷷䦦䶷䶦䶸䦦䶷䶷䶸䶦 7 5p0`0P0@00000000000000000000000000 QRRTVWY[]^____________________ `@@ [5J08000000 0000000000000 0 000000005`0`0`0P0@000 00000000000000000000000lPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPe PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 3`3p3 37777;;;;>>>>??????????????j`````````````````````````````` PPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 01345678:<>???????????????????800000000000000000000000000000  @Pp\`PP PPPpPPPPPPPPPPPPPPPPPPPPPPPPP   @Pp{ `PP@P`PpP`P0PPPPPPPPPPPPPPPPPPPPPPPP  +}P0l P3`3p3 37777;;;;>>>>??????????????[0Pp]PPPP P PPPPP P PPPPP P P PPPP P P PPPPPPC `o` o````` ` ` ` `0`0`0`0`@`@`@`@`P`P`P`P```@````j@0@@ @@@@ @ @ @ @ @     @@@@@@@@@@@ @ @B b b b b b bB b b bbbb b ba    HHHHhh @@d` @d`@@d`@@d`@@d`@@@```` ` ````` ` ```` ` ` `` ` ` ` ` `` ` ` aaaa   @  @ Hh hh h h Hh hhhh Hhh H Hhh h h h h h hH qH qH HqHqH qHH qH HqH HqHH qH qH HqHqH qHH qHHqhHqHy,@  @`@ @ dqqqqqqqqqqpp@q@q@@@q@q@@@q@q@@@q@ @ q@@q@p, @`y,`@  @`@d@d`@dhP@@@L M =  ?ʽʽʽ̽ʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽ<33333333333333333333333333333333333333ݭ<33333333333333333333333333333333333333û<33333333333333333333333333333333333333êʽʽʽ<3<<<<33333<<33êʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽ<3<<3333<33ݻ<333333333333333333393<3<3í<33333333<33333333<33333<3<3ýʽʽʽ<33333333<33333333<333<3<3Ðʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽ<333333<33333333333<3<3ݭ<3<<33<3333<33<3<3Ù<33<33<33333<33<3<3Èʽʽʽ<33333333333333333333333333333333333333Èʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽ<333333333<<<33ݻ<3<<33333<33ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<33<3<<3333333<33393<3<3ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽʽ<333<3<<3333333<333<3<3ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽʽʽ<333<3<3<333333<3<3<3ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDݭ<333<3<3<333333<<333<3<3ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<333<3<3333333<3333ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽʽ<333333<33333333<33<33ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽʽ<33333333333333333333333333333333333333ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDݻ<33333333333333333333333333333333333333ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<33333333333333333333333333333333333333ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽʽffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽʽʽDDffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDݭDDffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽʽDDffffffffffffffffffffffffffffffffffffff̬DDffffffffffffffffffffffffffffffffffffff333333333333333333333333333333333333333333333333333333333333ݻDDDDDDDDDDffffffffffffffffffffffffffffffffffffff333333333333333333333333333333333333333333333333333333333333DDDDDDDDDDffffffffffffffffffffffffffffffffffffff333333333333333333333333333333333333333333333333333333333333ʽʽDDDDDDDDDDffffffffffffffffffffffffffffffffffffff33<3333333<33333333333<3<<3<33DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<333<3333<<<33333333333<3<3<33ݭDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<333<3333333<3<3<333<333333<3<33<<33333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<333<33333<3<33<333<33333<3<3<33<<<33ʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3<33333<3<33<333333333333<3<33<<33DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3<3333333<3<33<3333<333333<3<3<33<33333 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<333<3333<33<3<3333333<3<<33DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<333<33333333<3<3333333<<3<<333<33ʽʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3333333333333333333333333333333333333333333333333333333333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3<3<33333333<<3333339333333 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3<3<33333333<<<33339333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3<<3<33333333333<333<<<333<3<333339333333ʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3<<3<333333333<3<<<3<3<3333939333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<33<3<333333333<33<333333<33339333333 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<33<3<33333333333<3333<33333333333339333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<33<3<3<33333<3<33333<3<3333939333333ʽʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<33<3<3<33333<3<33333<3<3333939333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3333333333333333333333333333333333333333333333333333333333333 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3333333333333333333333333333333333333333333333333333333333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3333333333333333333333333333333333333333333333333333333333333ʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDĎDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffʽʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDtDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDtdffffffvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdffffffvdffffffvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdffffffvdvwwwwgvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvwwwwgvdvdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvdvdvdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvdvdvifdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvfffdvdvffdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvfdvdvdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvfdvdvdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvfffdvdvffdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvdvdvffdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvdvdvDDDDdvDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvDDDDdvdffffffvDDDDDDDDDDDDDDDD<33333333333333333333333333333333333333333333333333333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdffffffvdffffffvDDDDDDDDDDDDDDDD<33333333333333333333333333333333333333333333333333333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdffffffvwwwwwwwwDDDDDDDDDDDDDDDD<33333333333333333333333333333333333333333333333333333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDwwwwwwwwDDDDDDDDDDDDDDDD<333<<<3333<33333<<<<3DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<333<<3333<33333<<3DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽDDDDDDDDDDDDDDDD<333<33333<3333333333333333333333333333333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDʽʽDDDDDDDDDDDDDDDD<333<333<333333333<333333333333<33333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDݭDDDDDDDDDDDDDDDD<3<3<333333333333333333333<33333ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<3<333<<333333333333333333333333<33333ffffDDDDDDDDDDDDDDDDDDDDDDDDDDʽDDDDDDDDDDDDDDDD<333<3<3333<33333<<33<3ffffDDDDDDDDDDDDDDDDDDDDDDDDDDʽDDDDDDDDDDDDDDDD<333<33<3333<<333333<33<3ffffDDDDDDDDDDDDDDDDDDDDDDDDDDݻDDDDDDDDDDDDDDDD<33333333333333333333333333333333333333333333333333333333ffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD<33333333333333333333333333333333333333333333333333333333ffffDDDDDDDDDDDDDDDDDDDDDDADʽʽDDDDDDDDDDDDDDDD<33333333333333333333333333333333333333333333333333333333ffffDDDDDDDDDDDDDDDDDDDDDAʽʽDDDDDDDDDDDDDDDDffffDDDDDDDDDDDDDDDDDDDDݭDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDʽDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDʽDDDDDDDDDDDDDDDDDDDDffffffffffffffffffffffffffffffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDDAݻDDDDDDDDDDDDffffffffffffffffffffhfffffffffffffffffffffffffffffffDDDDDDDDDDDDDDDDDADDDDDDDDDDDDffffffffffffffffffff833333fffffffffffffffffffffffffffffffDDDDDDDDDffgwwwKDDDAʽʽʽʽDDDDDDDDDDDDffffffffffffffffffff833333fffffffffffffffffffffffffffffffDDDDDDDDdfvvwwwDDDAʽʽDDDDDDDDDDDDffffffffffffffffffff833333fffffffffffffffffffffffffffffffDDDDDDDDdfgwwwwKDDDݭDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD3DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDffgwwwwwKDDDADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD""""DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDfvvwwwwwKDDDDDAAʽʽʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDfvvwwwwwDDDDDDDAʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD83DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDvdgwwwwwvKDDDDDDAݻDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD833333DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDvdDDDDDvKDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD8333HDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdvGfgwwwwkvDDDDDDDʽʽʽʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD33333HDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdwGvvwwwwkwDDDDDDDʽʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD338HDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdwGgwwwwwkwDDDDDDDݭDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD88HDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdwGDDDDDkwDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD8HDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdwGvwwwwwkwDDDDDDDʽʽʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD8D8DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdwGvwwwwwkwDDDDʽDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDHDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDdwGDDDDDDkwDDDDݻʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽݭʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽݻʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽݭʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽʽ""",",",",,",""",,,",",","",","",","",""",",,",,",,"""",,,"",","",","",""")",",,"",",""",""","",",","""",",""",","",","",",""",,"",",,",,"""""""""""",",","",",","""",,",""",,","",","",",,,,"",",,"","","""""""",",","",","""","",""",,","",",""""""",,",""""""""",",,"",",""",""",",",",",,",""",,",""""""""""""""""""","",""""""",",""",","","",",,""",",""""","",",","""""",","""",",","",,"",",,,""",",,"""","""",,,",",","%-- title: Jimi can not read -- author: verysoftwares -- desc: lettroidvania -- script: lua -- saveid: JIMI DEBUG=false t=0 sc_t=0 x=16*6 y=16*6 fmt=string.format ins=table.insert rem=table.remove sub=string.sub pi=math.pi cos=math.cos sin=math.sin atan2=math.atan2 sqrt=math.sqrt flr=math.floor abs=math.abs dy=0 mapx=0; mapy=0 mypop=0 enemies={} function fade_pal(c) if c==0 then return 0 end if c==1 then return 14 end if c==2 then return 15 end if c==3 then return 2 end if c==4 then return 5 end if c==5 then return 6 end if c==6 then return 7 end if c==7 then return 9 end if c==8 then return 0 end if c==9 then return 8 end if c==10 then return 9 end if c==11 then return 10 end if c==12 then return 13 end if c==13 then return 8 end if c==14 then return 8 end if c==15 then return 1 end end function sfx2(plr,id,note,dur,chan) if not starroom(plr) and plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then sfx(id,note,dur,chan) end end function gameover() if Jimi.lastsp2>=200 then pal(8,12) end if t%12<6 then pal(8,9); pal(3,9); pal(2,9) end local offx=0 if Jimi.lastsp2>=200 and Jimi.lastdx<0 then offx=-2 end spr(Jimi.lastsp2,Jimi.x+offx,Jimi.y,0,1,(Jimi.lastsp~=59 and Jimi.lastdx>=0) and 0 or 1,0,2,2) pal() trace(Jimi.y) if t-gm_t>=100 then shots={} Jimi.dx=0; Jimi.dy=0 for i,tb in ipairs(txtbox) do if tb.bounce and tb.by then tb.y=tb.by; tb.bounce=nil; tb.bt=nil end end lastsave=nil loadgame(Jimi) TIC=update if hw_mode then deaths=deaths+1 end end t=t+1 end function enemy_update(plr) for i=#enemies,1,-1 do local nmy=enemies[i] if not nmy.dod and nmy.mapx==plr.mapx and nmy.mapy==plr.mapy then nmy.x=nmy.x+nmy.dx if nmy.x<=0 or nmy.x>=240-16 then nmy.dx=-nmy.dx end if (mget(nmy.mapx+nmy.x/8,nmy.mapy+nmy.y/8)>0 and not fget(mget(nmy.mapx+nmy.x/8,nmy.mapy+nmy.y/8),2)) or (mget(nmy.mapx+nmy.x/8+2,nmy.mapy+nmy.y/8)>0 and not fget(mget(nmy.mapx+nmy.x/8+2,nmy.mapy+nmy.y/8),2)) then nmy.dx=-nmy.dx end if nmy.dy then nmy.y=nmy.y+nmy.dy if nmy.y<0 or nmy.y>=136-16 then nmy.dy=-nmy.dy end if (mget(nmy.mapx+nmy.x//8,nmy.mapy+nmy.y//8)>0 and not fget(mget(nmy.mapx+nmy.x//8,nmy.mapy+nmy.y//8),2)) or (mget(nmy.mapx+nmy.x//8,nmy.mapy+nmy.y//8+1)>0 and not fget(mget(nmy.mapx+nmy.x//8,nmy.mapy+nmy.y//8+1),2)) then nmy.dy=-nmy.dy end end for j,sh in ipairs(shots) do if AABB(sh.x,sh.y,8,8,nmy.x,nmy.y,16,8) then sh.fall=true nmy.dod=true --rem(enemies,i) sfx2(sh.plr,10,'G-3',80,1) end end if nmy.sp~=167 then spr(nmy.sp+math.floor(t*0.2%2)*16,nmy.x,nmy.y,9,1,nmy.dx<0 and 0 or 1,0,2,1) else spr(nmy.sp-math.floor(t*0.2%2)*16,nmy.x,nmy.y,9,1,nmy.dx<0 and 0 or 1,0,2,1) end end end end function enemy_coll(plr) for i=#enemies,1,-1 do local nmy=enemies[i] if not nmy.dod and nmy.mapx==plr.mapx and nmy.mapy==plr.mapy and AABB(nmy.x,nmy.y,16-3,8-1,plr.x,plr.y,14,16) then sfx2(plr,10,'G-3',80,1) if plr==Jimi then --trace(Jimi.y) Jimi.lastsp2=Jimi.lastsp; Jimi.lastdx=Jimi.dx TIC=gameover gm_t=t+1 else plr.lastsp2=plr.lastsp; plr.lastdx=plr.dx plr.dod=t+1 end --return end end for mx=plr.mapx,plr.mapx+30-1 do for my=plr.mapy,plr.mapy+17-2 do if mget(mx,my)==166 and AABB(plr.x,plr.y,14,16,(mx-plr.mapx)*8,(my-plr.mapy)*8+5,8,3) or mget(mx,my)==182 and AABB(plr.x,plr.y,14,16,(mx-plr.mapx)*8,(my-plr.mapy)*8,3,8) or mget(mx,my)==183 and AABB(plr.x,plr.y,14,16,(mx-plr.mapx)*8,(my-plr.mapy)*8,8,3) or mget(mx,my)==184 and AABB(plr.x,plr.y,14,16,(mx-plr.mapx)*8+5,(my-plr.mapy)*8,3,8) then sfx2(plr,10,'G-3',80,1) Jimi.lastsp2=Jimi.lastsp; Jimi.lastdx=Jimi.dx TIC=gameover gm_t=t+1 end end end end function txtbox_update(plr) txtbox_spawn(plr) for i=#txtbox,1,-1 do local tb=txtbox[i] if not tb.dod and ((tb.mapx==plr.mapx and tb.mapy==plr.mapy) or (tb.bouncee and tb.bouncee~=plr)) then if tb.bounce then if not tb.bx then tb.bx=tb.x; tb.by=tb.y end if not tb.bt then tb.bt=t; sfx2(plr,19,12*3+2-math.random(0,24),120,2) end tb.y=tb.by-tb.bounce*sin((t-tb.bt)*0.2)*8*1/((t-tb.bt)*0.1+1) if t-tb.bt>60 then tb.y=tb.by; tb.bounce=nil; tb.bt=nil end end if tb.active and tb.mapx==plr.mapx and tb.mapy==plr.mapy then -- shadow for sx=0,tb.w-1 do for sy=0,tb.h-1 do --if ((flr(tb.x)+sx)+(flr(tb.y)+sy))%2==0 then pix(tb.x+sx+8,tb.y+sy+8,14) end local ax,ay=flr(tb.x)+sx+8,flr(tb.y)+sy+8 pix(ax,ay,fade_pal(fade_pal(pix(ax,ay)))) end end rect(tb.x,tb.y,tb.w,tb.h,3) rectb(tb.x,tb.y,tb.w,tb.h,12) tb.w=tb.w+(tb.tgtw-tb.w)*0.1 if abs(tb.w-tb.tgtw)<0.5 then tb.w=tb.tgtw; if tb.w==4+4 or only_empty(tb) then tb.dod=true; pop(tb,plr); if tb.bouncee~=Jimi then mypop=mypop-1 end end end tb.h=tb.h+(tb.tgth-tb.h)*0.1 if abs(tb.h-tb.tgth)<0.5 then tb.h=tb.tgth end clip(flr(tb.x),flr(tb.y),flr(tb.w-1),flr(tb.h-1)) local th=0 local tw=0 for j=1,#tb.msg do local char=sub(tb.msg,j,j) if char=='\n' then th=th+9; tw=0 elseif char==' ' then tw=tw+9 else tw=tw+font(char,tb.x+4+tw,tb.y+4+th,0) end if unlocks[char] and not (tb.chat2 and not tb.answer and char==string.sub(chat2_cur,j,j)) then recolor_font(tb.x+4+tw-9,tb.y+4+th,9) elseif tb.chat2 and not tb.answer and char==string.sub(chat2_cur,j,j) then if char==string.sub(chat2_cur,j,j) then recolor_font(tb.x+4+tw-9,tb.y+4+th,11) end end end clip() end end end end function climb(plr) if plr.btn(0) or plr.btn(1) then local onladder2=false for mx=0,240-16,16 do for my=0,136-16,16 do if mget(plr.mapx+mx/8,plr.mapy+my/8)==146 and (AABB(plr.x,plr.y,14,16,mx,my,16,16) or (btn(1) and AABB(plr.x,plr.y+1,14,16,mx,my,16,16))) then plr.onladder=true onladder2=true plr.x=mx+1 end end end if not onladder2 then if plr.onladder then plr.holdup=true end; plr.onladder=nil end end if plr.onladder then plr.dy=0 if plr.btn(0) then plr.dy=-1; if t%16==0 then sfx2(plr,18,'A-3',2,3) end end if plr.btn(1) then plr.dy= 1; if t%16==0 then sfx2(plr,18,'A-3',2,3) end end end end function coll_y(plr) plr.onground=false plr.txtboxhit=false if not (plr.dash and plr.dash>0) then plr.y=plr.y+plr.dy end for i,tb in ipairs(txtbox) do if not plr.onground2 or i~=5 then if tb.active and not tb.dod and tb.mapx==plr.mapx and tb.mapy==plr.mapy and AABB(tb.x,tb.y,tb.w,tb.h,plr.x,plr.y,14,16) then if plr.y3 or tb.h==tb.tgth) then plr.y=tb.y-16; plr.onground=true; if plr.dy>0.6 then tb.bounce=-1; tb.bouncee=plr; spawn_letters(tb,plr) end; plr.dy=0 else plr.y=tb.y+tb.h; tb.bounce=1; tb.bouncee=plr; spawn_letters(tb,plr) end plr.txtboxhit=true goto colly2 end end end ::colly2:: plr.onground2=false for mx=plr.mapx-1,plr.mapx+30 do for my=plr.mapy-1,plr.mapy+17-1 do local h=13 local my2=my if my2==plr.mapy-1 then my2=(plr.mapy-2)%136 h=16 end if my2==plr.mapy+17-1 then if starroom(plr) and not waterroom(plr) then -- loop y axis my2=plr.mapy else my2=(plr.mapy+17+1)%136 end end if mget(mx,my2)>0 and (not fget(mget(mx,my2),2) or (not plr.onladder and (my2-plr.mapy)*8>plr.y+15 and (mget(mx,my2)==146 or mget(mx,my2)==147) and mget(mx,my2-2)==0)) and AABB((mx-plr.mapx)*8,(my-plr.mapy)*8,8,8,plr.x,plr.y+(16-h),14,h) then if plr.dy>0 then plr.y=(my-plr.mapy)*8-16; plr.onground=true; plr.onground2=true; plr.dy=0 elseif not plr.txtboxhit then plr.y=(my-plr.mapy)*8+8-(16-h) end return end end end end function coll_x(plr) if plr.onladder or TIC==gameover then return end if plr.x<0 and ((plr.mapx==0 and plr.mapy==17 and plr.y>16)) then plr.x=0 end if plr.x>240-14-1 and ((plr.mapx==210 and plr.mapy==51) or (plr.mapx==210 and plr.mapy==34) or (plr.mapx==210 and plr.mapy==17 and plr.y>16)) then plr.x=240-14-1 end for mx=plr.mapx-1,plr.mapx+30 do for my=plr.mapy-1,plr.mapy+17 do if mget(mx,my)>0 and not fget(mget(mx,my),2) and AABB((mx-plr.mapx)*8,(my-plr.mapy)*8,8,8,plr.x,plr.y+3,14,13) then if plr.dx>0 then plr.x=(mx-plr.mapx)*8-14 elseif plr.dx<0 then plr.x=(mx-plr.mapx)*8+8 end return end end end --if not plr.txtboxhit then for i,tb in ipairs(txtbox) do if tb.active and not tb.dod and not tb.bounce and (tb.mapx==plr.mapx or tb.mapx==plr.mapx+30) and tb.mapy==plr.mapy and AABB(tb.x+(tb.mapx-plr.mapx)*8,tb.y,tb.w,tb.h,plr.x,plr.y,14,16) then if plr.dx>0 then plr.x=tb.x+(tb.mapx-plr.mapx)*8-14 elseif plr.dx<0 then plr.x=tb.x+tb.w end return end end --end end function draw_plr_swim(plr) local flip=0 local offx=0 if plr.lastdx and plr.lastdx<0 then flip=1; offx=-2 end pal(8,12) spr(200+math.floor(t*0.12)%4*2,plr.x+offx,plr.y,0,1,flip,0,2,2) plr.lastsp=200+math.floor(t*0.12)%4*2 pal() plr.onladder=false end function draw_plr(plr) --plr.dx=0 if plr.onladder or TIC==gameover then return end if plr.btn(2) and not (plr.dash and plr.dash>0) then --if not xturn or t-xturn<8 then --spr(57,x,y,0,1,1,0,2,2) --if not xturn then xturn=t end --elseif xturn then plr.x=plr.x-1 plr.dx=-1 plr.lastdx=-1 if plr.dy>=0 then plr.lastsp=80+flr(t*0.2)%6*2 if plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then if plr==Dimi then pal(3,1); pal(8,3) end spr(plr.lastsp,plr.x-1,plr.y,0,1,1,0,2,2) pal() if plr==Dimi then local ry=0 if plr.lastsp==80 or plr.lastsp==86 then ry=1 end rect(plr.x+3,plr.y+5+ry,4,2,12) end end else plr.lastsp=59 if plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then if plr==Dimi then pal(3,1); pal(8,3) end spr(plr.lastsp,plr.x,plr.y,0,1,0,0,2,2) pal() if plr==Dimi then spr(121,plr.x,plr.y-2,0,1,0,0,2,1) end end end if t%12==0 and plr.onground then sfx2(plr,18,'A-4',2,3) end --xturn2=nil --end elseif plr.btn(3) and not (plr.dash and plr.dash>0) then --if not xturn2 or t-xturn2<8 then --spr(57,x,y,0,1,0,0,2,2) --if not xturn2 then xturn2=t end --elseif xturn2 then plr.x=plr.x+1 plr.dx=1 plr.lastdx=1 if plr.dy>=0 then plr.lastsp=80+flr(t*0.2)%6*2 if plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then if plr==Dimi then pal(3,1); pal(8,3) end spr(plr.lastsp,plr.x,plr.y,0,1,0,0,2,2) pal() if plr==Dimi then local ry=0 if plr.lastsp==80 or plr.lastsp==86 then ry=1 end rect(plr.x+8,plr.y+5+ry,4,2,7) end end else plr.lastsp=59 if plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then if plr==Dimi then pal(3,1); pal(8,3) end spr(plr.lastsp,plr.x,plr.y,0,1,0,0,2,2) pal() if plr==Dimi then spr(121,plr.x,plr.y-2,0,1,0,0,2,1) end end end if t%12==0 and plr.onground then sfx2(plr,18,'A-4',2,3) end --xturn=nil --end elseif plr.dy>=0 then --xturn=nil --xturn2=nil plr.lastsp=55 if plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then if plr==Dimi then pal(3,1); pal(8,3) end spr(plr.lastsp,plr.x,plr.y,0,1,0,0,2,2) if plr==Dimi then spr(121,plr.x,plr.y,0,1,0,0,2,1) end pal() end else plr.lastsp=59 if plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then if plr==Dimi then pal(3,1); pal(8,3) end spr(plr.lastsp,plr.x,plr.y,0,1,0,0,2,2) if plr==Dimi then spr(121,plr.x,plr.y-2,0,1,0,0,2,1) end pal() end end end function scroll_get(plr) for k,sc in pairs(scrolls) do local kx,ky=strpos(k) if mget(kx,ky)==144 and AABB(kx,ky,2,2,plr.mapx,plr.mapy,30,17) then if AABB((kx-plr.mapx)*8,(ky-plr.mapy)*8,16,16,plr.x,plr.y,14,16) then mset(kx,ky,0); mset(kx+1,ky,0) mset(kx,ky+1,0); mset(kx+1,ky+1,0) unlocks[sc.char]=true --scrolls[k]=nil sfx2(plr,20,'E-5',30,2) break end end end end function endgame_msg(msg,h,typ,msgi,msgl) if typ==0 then for i=1,#msg do if msgi>msgl then break end font(sub(msg,i,i),240/2-#msg/2*9+(i-1)*9,8+12+h*16+sin(msgi+t*0.2)*3) recolor_font(240/2-#msg/2*9+(i-1)*9,8+12+h*16+sin(msgi+t*0.2)*3,1+(msgi+t*0.2)%6) msgi=msgi+1 end return msgi end if typ==1 then for i=1,#msg do if msgi>msgl then break end font(sub(msg,i,i),240/2-#msg/2*9+(i-1)*9-sin(t*0.1)*12,24+12+16+16+16+32) recolor_font(240/2-#msg/2*9+(i-1)*9-sin(t*0.1)*12,24+12+16+16+16+32,12+(i+t*0.2)%4) msgi=msgi+1 end return msgi end end function endgame() cls(0) end_t=end_t or t+1 if t-end_t<500+120 then local msgl=(t-end_t)/3 local msgl2=(t-end_t-120)/3 if t-end_t>=500 then msgl=500+120-(t-end_t); msgl2=msgl end local msgi=0 for i,msg in ipairs({'WHAT ARE THE','QUESTS FOR','AND','WILL JIMI LEARN','TO READ'}) do msgi=endgame_msg(msg,i-1,0,msgi,msgl) end local msg='YOU WILL FIND OUT SOON' msgi=endgame_msg(msg,6,1,msgi,msgl2) end if t-end_t>=500+120 and t-end_t<=(500+120)*2 then local msgl=(t-end_t-500-120)/3 local msgl2=(t-end_t-500-120-120)/3 if t-end_t>=500+120+500 then msgl=500+120+500+120-(t-end_t); msgl2=msgl end local msgi=0 for i,msg in ipairs({'IN THE MEANTIME','CONSIDER DONATING','TO','MAKE THIS','GAME HAPPEN'}) do msgi=endgame_msg(msg,i-1,0,msgi,msgl) end local msg='EVERY LITTLE BIT HELPS' msgi=endgame_msg(msg,6,1,msgi,msgl2) end if t-end_t>=(500+120)*2 and t-end_t<=(500+120)*3 then local msgl=(t-end_t-(500+120)*2)/3 local msgl2=(t-end_t-(500+120)*2-120)/3 if t-end_t>=(500+120)*2+500 then msgl=(500+120)*2+500+120-(t-end_t); msgl2=msgl end local msgi=0 for i,msg in ipairs({'THIS GAME WAS MADE','WITH TIC80','BY','VERYSOFTWARES','IN 2023'}) do msgi=endgame_msg(msg,i-1,0,msgi,msgl) end local msg='AS A LABOR OF LOVE' msgi=endgame_msg(msg,6,1,msgi,msgl2) end if t-end_t>=(500+120)*3 then local msgl=(t-end_t-(500+120)*3)/3 local msgl2=(t-end_t-(500+120)*3-120)/3 local msgi=0 local msg='PEACE' msgi=endgame_msg(msg,3,0,msgi,msgl) msgi=endgame_msg(fmt('RESET IN%d',(t-end_t-((500+120)*4-60*2-40-15-5+1))//60),5,1,msgi,msgl2) if t-end_t==(500+120)*4-60*2-40-15-5+1 then reset() end end t=t+1 end deaths=0 timer=0 function endgame2() cls(0) end_t=end_t or t+1 if t-end_t<500+120 then local msgl=(t-end_t)/3 local msgl2=(t-end_t-120)/3 if t-end_t>=500 then msgl=500+120-(t-end_t); msgl2=msgl end local msgi=0 for i,msg in ipairs({'HALLOWEEN MODE CLEAR',fmt('WITH %d DEATHS',deaths),'AND','WITH A TIME OF',fmt('%d MINUTES %d SECONDS',timer//60//60,timer//60%60)}) do msgi=endgame_msg(msg,i-1,0,msgi,msgl) end local msg='IMPRESSIVE' msgi=endgame_msg(msg,6,1,msgi,msgl2) end if t-end_t>=500+120 and t-end_t<=(500+120)*2 then local msgl=(t-end_t-500-120)/3 local msgl2=(t-end_t-500-120-120)/3 if t-end_t>=500+120+500 then msgl=500+120+500+120-(t-end_t); msgl2=msgl end local msgi=0 for i,msg in ipairs({'IN THE MEANTIME','CONSIDER DONATING','TO','MAKE THIS','GAME HAPPEN'}) do msgi=endgame_msg(msg,i-1,0,msgi,msgl) end local msg='EVERY LITTLE BIT HELPS' msgi=endgame_msg(msg,6,1,msgi,msgl2) end if t-end_t>=(500+120)*2 and t-end_t<=(500+120)*3 then local msgl=(t-end_t-(500+120)*2)/3 local msgl2=(t-end_t-(500+120)*2-120)/3 if t-end_t>=(500+120)*2+500 then msgl=(500+120)*2+500+120-(t-end_t); msgl2=msgl end local msgi=0 for i,msg in ipairs({'THIS GAME WAS MADE','WITH TIC80','BY','VERYSOFTWARES','IN 2023'}) do msgi=endgame_msg(msg,i-1,0,msgi,msgl) end local msg='AS A LABOR OF LOVE' msgi=endgame_msg(msg,6,1,msgi,msgl2) end if t-end_t>=(500+120)*3 then local msgl=(t-end_t-(500+120)*3)/3 local msgl2=(t-end_t-(500+120)*3-120)/3 local msgi=0 local msg='PEACE' msgi=endgame_msg(msg,3,0,msgi,msgl) msgi=endgame_msg(fmt('RESET IN%d',(t-end_t-((500+120)*4-60*2-40-15-5+1))//60),5,1,msgi,msgl2) if t-end_t==(500+120)*4-60*2-40-15-5+1 then reset() end end t=t+1 end function fadeout() if t%40==0 then local allblack=true for px=0,240-1 do for py=0,136-1 do local p=pix(px,py) if p~=0 then allblack=false end pix(px,py,fade_pal(p)) end end if allblack then if hw_mode then TIC=endgame2 else TIC=endgame end music(5) end end t=t+1 end function titlefade() if t%10==0 then local allblack=true for px=0,240-1 do for py=0,136-1 do local p=pix(px,py) if p~=0 then allblack=false end pix(px,py,fade_pal(p)) end end if allblack then TIC=update music() sc_t=t+1 if cycle==1 then clear_halloween(Jimi) end if cycle==2 then halloween(Jimi) end if cycle==3 then loadgame(Jimi) end end end t=t+1 end function questroom(plr) return plr.mapy==68 end function map_switch(plr) --if plr.mapx==0 and plr.mapy==17 and plr.x<240/2 then -- TIC=fadeout -- return --end if questroom(plr) then if plr.y<0 then plr.y=0 end if plr.y>136-16-8 then plr.y=136-16-8 end if plr.x<0 then plr.x=0 end if plr.x>240-14 then plr.x=240-14 end end if not starroom(plr) or waterroom(plr) then if plr.mapx==30*3 and plr.mapy==17 then if plr.x>240-14 then plr.x=240-14 end end if plr.x<0 then prev_mapx=plr.mapx; prev_mapy=plr.mapy plr.x=240-14; plr.mapx=(plr.mapx-30)%240 if plr==Jimi then for i,e in ipairs(enemies) do e.dod=false end shots={} waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] or 136 end sc_t=t+1 end if plr.x>240-14 then prev_mapx=plr.mapx; prev_mapy=plr.mapy plr.x=0; plr.mapx=(plr.mapx+30)%240 if plr==Jimi then for i,e in ipairs(enemies) do e.dod=false end shots={} waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] or 136 end sc_t=t+1 end if plr.y<0 then prev_mapx=plr.mapx; prev_mapy=plr.mapy if plr.mapx==30 and plr.mapy==17 then activate_textbox(21) end plr.y=136-16-8; plr.mapy=(plr.mapy-17)%136 if plr==Jimi then for i,e in ipairs(enemies) do e.dod=false end shots={} waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] or 136 end sc_t=t+1 end if plr.y>136-16-8 then prev_mapx=plr.mapx; prev_mapy=plr.mapy plr.y=0; plr.mapy=(plr.mapy+17)%136 if plr==Jimi then for i,e in ipairs(enemies) do e.dod=false end shots={} waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] or 136 end sc_t=t+1 end else if plr.mapx==30*4 and plr.mapy==0 then if plr.x<0 then plr.x=0 end if plr.x>240-14 then plr.x=240-14 end end if plr.mapx==30*3 and plr.mapy==17 then if plr.x>240-14 then plr.x=240-14 end end if plr.x<0 then prev_mapx=plr.mapx; prev_mapy=plr.mapy plr.x=240-14; plr.mapx=(plr.mapx-30)%240 if plr==Jimi then for i,e in ipairs(enemies) do e.dod=false end shots={} end sc_t=t+1 waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] or 136 end if plr.x>240-14 then prev_mapx=plr.mapx; prev_mapy=plr.mapy plr.x=0; plr.mapx=(plr.mapx+30)%240 if plr==Jimi then for i,e in ipairs(enemies) do e.dod=false end shots={} end sc_t=t+1 waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] or 136 end if plr.y>136-16-8 then plr.y=0 end if plr.mapx==30*4 and plr.mapy==0 then if plr==Jimi and plr.y<0 then prev_mapx=plr.mapx; prev_mapy=plr.mapy particles={} plr.y=136-16-8; plr.mapx=30; plr.mapy=17 sc_t=t+1 waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] or 136 TIC=tport end end end if sc_t==t+1 then for mx=plr.mapx,plr.mapx+30-1 do for my=plr.mapy,plr.mapy+17-1 do if mget(mx,my)==151 or mget(mx,my)==210 then ins(enemies,{x=(mx-plr.mapx)*8,y=(my-plr.mapy)*8,dx=-1,mapx=plr.mapx,mapy=plr.mapy,origtile=posstr(mx,my),sp=mget(mx,my)}) mset(mx,my,0) end if mget(mx,my)==167 then ins(enemies,{x=(mx-plr.mapx)*8,y=(my-plr.mapy)*8,dx=0,dy=-1,mapx=plr.mapx,mapy=plr.mapy,origtile=posstr(mx,my),sp=mget(mx,my)}) mset(mx,my,0) end end end end end function swim(plr) local spd=0.1 if plr.btn(0) then plr.dy=plr.dy-spd end if plr.btn(1) then plr.dy=plr.dy+spd end if plr.btn(2) then plr.dx=plr.dx-spd; plr.lastdx=-spd end if plr.btn(3) then plr.dx=plr.dx+spd; plr.lastdx= spd end plr.x=plr.x+plr.dx coll_x(plr) plr.y=plr.y+plr.dy coll_y(plr) plr.dy=plr.dy+0.05 plr.dx=plr.dx*0.88 plr.dy=plr.dy*0.88 end function post_coll(plr) if not plr.onladder then if not (plr.dash and plr.dash>0) then plr.dy=plr.dy+0.2 plr.dy=plr.dy*0.95 end if dash then if plr.onground then plr.dash=0 end if plr.dash and plr.dash>0 then plr.x=plr.x+plr.dx coll_x(plr) plr.dx=plr.dx*0.75 plr.dy=0 plr.dash=plr.dash-1 end if keyp(64) and plr.dash==0 then plr.hordir=plr.hordir or 1 plr.dx=plr.dx+(plr.hordir*2-1)*11.7 plr.dy=0 plr.dash=30 sfx(23,'A-5',30,0) end end -- jump if plr.onground and plr.btn(0) then if not plr.holdup then sfx2(plr,25,4*12+9-math.random(0,9),20,3) plr.dy=plr.dy-4.7 end end if doublejump then if plr.onground then plr.doublejump=0 end if plr.doublejump and plr.doublejump>0 then plr.doublejump=plr.doublejump-1 end if not plr.onground and plr.doublejump==0 and plr.btnp(0) then plr.doublejump=60 sfx2(plr,25,5*12+9-math.random(0,9),20,3) plr.dy=plr.dy-4.7; if plr.dy<-4.7 then plr.dy=-4.7 end plr.dash=0 end end if not plr.btn(0) then plr.holdup=false end else if plr.dy~=0 then plr.lastsp=62+flr(t*0.08%2)*32 end if TIC~=gameover then if plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then if plr==Dimi then pal(3,1); pal(8,3) end spr(plr.lastsp,plr.x,plr.y,0,1,0,0,2,2) pal() end end end if plr.btn(2) or plr.btn(3) then plr.onladder=nil end end function ctrl_player(plr) if not plr.dod then enemy_coll(plr) if TIC==gameover then return end if plr==Jimi then local old_dir=plr.dir if plr.btn(0) then if old_dir~=0 and not plr.btn(old_dir) then plr.dir_t=t+1 end; plr.dir=0 end if plr.btn(1) then if old_dir~=1 and not plr.btn(old_dir) then plr.dir_t=t+1 end; plr.dir=1 end if plr.btn(2) then if old_dir~=2 and not plr.btn(old_dir) then plr.dir_t=t+1 end; plr.dir=2; plr.hordir=0 end if plr.btn(3) then if old_dir~=3 and not plr.btn(old_dir) then plr.dir_t=t+1 end; plr.dir=3; plr.hordir=1 end end plr.underwater=false if plr==Jimi and AABB(0,waterlevel,240,136-waterlevel,plr.x,plr.y,16,16) then plr.underwater=true swim(plr) draw_plr_swim(plr) else climb(plr) coll_y(plr) draw_plr(plr) coll_x(plr) post_coll(plr) end if plr==Jimi then draw_dir(plr) end if plr==Jimi then scroll_get(plr) save_get(plr) end map_switch(plr) else if plr==Dimi then if plr.mapx==Jimi.mapx and plr.mapy==Jimi.mapy then if t%12<6 then pal(8,9); pal(3,9); pal(2,9) else pal(3,1); pal(8,3) end spr(plr.lastsp2,plr.x,plr.y,0,1,(plr.lastsp~=59 and plr.lastdx>0) and 0 or 1,0,2,2) pal() if t%12>=6 then if plr.lastsp2==59 then spr(121,plr.x+2,plr.y-2,0,1,0,0,2,1) elseif plr.lastsp2==55 then spr(121,plr.x+2,plr.y,0,1,0,0,2,1) else if plr.lastdx>0 then local ry=0 if plr.lastsp==80 or plr.lastsp==86 then ry=1 end rect(plr.x+8,plr.y+5+ry,4,2,7) else local ry=0 if plr.lastsp==80 or plr.lastsp==86 then ry=1 end rect(plr.x+3,plr.y+5+ry,4,2,12) end end end end if t-plr.dod==100 then rep.i=1 Dimi={x=(112-30*3)*8,y=(29-17)*8,dx=0,dy=0,mapx=30*3,mapy=17,btn=rep_btn,btnp=btnp,key=key,keyp=keyp} end end end end function draw_dir(plr) if plr.dir_t and t-plr.dir_t<40 then local sp=27+plr.dir if plr.dir==0 then spr(sp,plr.x+3,plr.y-12,0) end if plr.dir==2 then spr(sp,plr.x-12,plr.y+3,0) end if plr.dir==3 then spr(sp,plr.x+14+3,plr.y+3,0) end end end function draw_bg(plr) if plr.mapx==3*30 then cls(5) elseif plr.mapx==2*30 then cls(6) elseif plr.mapx==1*30 then cls(5) elseif plr.mapx==0 and plr.mapy==17 then cls(15) elseif plr.mapx==0 then cls(4) elseif plr.mapx==240-30 then cls(5) elseif plr.mapx==240-30-30 then cls(13) else cls(5) end clip(0,waterlevel,240,136-waterlevel) cls(12) clip() --pal(3,13) clip(0,waterlevel,240,136-8-waterlevel) for wx=0,240+16,16 do for wy=waterlevel,136+16,16 do spr(176,wx-math.floor(t*0.25)%16,wy,12,1,0,0,2,2) end end clip() --pal() map(plr.mapx,plr.mapy,30,17,0,0,0) if plr.mapx==180 and plr.mapy==34 then if not pearl then spr(240,6*8+4,10*8+5,0) if plr==Jimi and AABB(plr.x,plr.y,16,16,6*8,10*8,16,16) then pearl=true TIC=modal3 md_t3=t+1 end end end scroll_draw(plr) trigger_draw(plr) if starroom(plr) and not waterroom(plr) then for mx=plr.mapx,plr.mapx+30-1 do if mget(mx,plr.mapy)>0 and mget(mx,plr.mapy+17-2)==0 then rect((mx-plr.mapx)*8,136-8-2,8,2,7) end end end end function scroll_draw(plr) for k,sc in pairs(scrolls) do local kx,ky=strpos(k) if mget(kx,ky)==144 and AABB(kx,ky,2,2,plr.mapx,plr.mapy,30,17) then font(sc.char,(kx-plr.mapx)*8+5,(ky-plr.mapy)*8+4) recolor_font((kx-plr.mapx)*8+5,(ky-plr.mapy)*8+4,9) end end end function save_get(plr) for mx=plr.mapx,plr.mapx+30-1 do for my=plr.mapy,plr.mapy+17-1 do if mget(mx,my)==164 and AABB(plr.x,plr.y,14,16,(mx-plr.mapx)*8,(my-plr.mapy)*8,16,16) then savegame(mx,my,plr) end end end end function trigger_draw(plr) for k,trig in pairs(triggers) do local kx,ky=strpos(k) if AABB(kx,ky,2,2,plr.mapx,plr.mapy,30,17) and mget(kx,ky)>0 then font(trig.char,(kx-plr.mapx)*8+4,(ky-plr.mapy)*8+4) recolor_font((kx-plr.mapx)*8+4,(ky-plr.mapy)*8+4,9) end end end function letter_draw(plr) inventory_draw(plr) floating_draw(plr) end function floating_draw(plr) for i=#floating,1,-1 do local fl=floating[i] if fl.plr==plr then fl.x=fl.x+(fl.tgtx-fl.x)*0.1 fl.y=fl.y+(fl.tgty-fl.y)*0.1 font(fl.char,fl.x,fl.y) recolor_font(fl.x,fl.y,9) if abs(fl.x-fl.tgtx)<1 and abs(fl.y-fl.tgty)<1 then if plr==Jimi then inventory[fl.char]=inventory[fl.char] or 0 inventory[fl.char]=inventory[fl.char]+1 end rem(floating,i) end end end end function shoot(plr) for i=1,26 do if plr.keyp(i) and not (i==20 and (plr.key(35) or plr.key(43))) and (plr~=Jimi or (inventory[string.char(i+64)] and inventory[string.char(i+64)]>0)) then sfx2(plr,22,12*3+math.random(0,24),18,2) local sdx=1 if plr.lastdx then if plr.lastdx<0 then sdx=-1 end end ins(shots,{x=plr.x,y=plr.y+4,plr=plr,dx=sdx,dy=0,char=string.char(i+64)}) if plr.dir==0 then shots[#shots].dx=0 shots[#shots].dy=-1 end if plr.underwater then shots[#shots].dx=shots[#shots].dx*0.5; shots[#shots].dy=shots[#shots].dy*0.5 end if plr==Jimi then inventory[string.char(i+64)]=inventory[string.char(i+64)]-1 if inventory[string.char(i+64)]==0 then inventory[string.char(i+64)]=nil end end end end end function post_save(plr) if save_msg_t and lastsave then local sx,sy=strpos(lastsave) local msg='Game saved!' local tw=print(msg,0,-6,0,false,1,true) print(msg,(sx-plr.mapx)*8+8-tw/2+1,(sy-plr.mapy)*8-8,8,false,1,true) print(msg,(sx-plr.mapx)*8+8-tw/2,(sy-plr.mapy)*8-8+1,8,false,1,true) print(msg,(sx-plr.mapx)*8+8-tw/2-1,(sy-plr.mapy)*8-8,8,false,1,true) print(msg,(sx-plr.mapx)*8+8-tw/2,(sy-plr.mapy)*8-8-1,8,false,1,true) print(msg,(sx-plr.mapx)*8+8-tw/2,(sy-plr.mapy)*8-8,4,false,1,true) if t-save_msg_t>=90 then save_msg_t=nil end end if lastsave then local sx,sy=strpos(lastsave) if not AABB((sx-plr.mapx)*8,(sy-plr.mapy)*8,16,16,plr.x,plr.y,14,16) then lastsave=nil end end end function starrooms_update(plr) if waterroom(plr) then waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] if waterlevel>64 then waterlevel=waterlevel-0.5 waterrooms[posstr(plr.mapx,plr.mapy)]=waterlevel end elseif starroom(plr) then for ch=0,3 do sfx(-1,nil,nil,ch) end for px=0,240-1 do pix(px,0,(t+px)%16) end if t%3==0 then local id=119+math.random(0,1) local px if id==119 then px=math.random(0,240-5) else px=math.random(0,240-7) end ins(particles,{x=px,y=-7,dx=0,dy=math.random(1,4)/2,id=id}) end if pearl and (plr.key(35) or plr.key(43)) and plr.keyp(20) and (legal_waterroom(plr.mapx,plr.mapy)) then waterrooms[posstr(plr.mapx,plr.mapy)]=136 if plr.mapx==90 and plr.mapy==17 then waterrooms[posstr(plr.mapx,plr.mapy+17)]=0 end pearl=false if not md_t4 then TIC=modal4 md_t4=t+1 end end else local pop=mypop for i,tb in ipairs(txtbox) do if tb.dod then pop=pop+1 end end if pop>0 and (plr.key(35) or plr.key(43)) and plr.keyp(20) and legal_starroom(plr.mapx,plr.mapy) then --starrooms={} starrooms[posstr(plr.mapx,plr.mapy)]=true --local j=0 --for k,s in pairs(starrooms) do j=j+1 end --trace(j,3) --trace(posstr(mapx,mapy),2) mypop=mypop-1 if plr.mapx==30*3 and plr.mapy==17 then activate_textbox(28) seen2=true if not md_t2 then TIC=modal2 md_t2=t+1 end end end for i=#particles,1,-1 do local pt=particles[i] if not pt.grav then rem(particles,i) end end end end function pop_update(plr) local pop=mypop for i,tb in ipairs(txtbox) do if tb.dod then pop=pop+1 end end if pop>0 then clip(240-16-6,0,16,16) spr(120,240-16-6+2,1+1+1,0) spr(119,240-16+8-6,1+1,0) spr(119,240-16+8-6,1+6+1,0) clip() if not legal_starroom(plr.mapx,plr.mapy) then spr(169,240-16-6+2-1,1+1-1-1,0,1,0,0,2,2) end print(pop,240-8+1,1+2+1,3) end if pearl then spr(240,240-8-8-2,8+8,0) if not legal_waterroom(plr.mapx,plr.mapy) then spr(169,240-16-6+2-1,1+1-1-1+8+5,0,1,0,0,2,2) end print(1,240-8+2,8+8+1,3) end end function particles_update(plr) for i=#particles,1,-1 do local pt=particles[i] pt.x=pt.x+pt.dx; pt.y=pt.y+pt.dy spr(pt.id,pt.x,pt.y,0) if pt.grav then pt.dy=pt.dy+0.2 end if pt.y>=136 then rem(particles,i) end end end function shots_update(plr) shoot(plr) for i=#shots,1,-1 do local sh=shots[i] if AABB(sh.x,sh.y,8,8,0,0,240,136) and sh.plr==plr then sh.dy=sh.dy or 0 if not sh.fall then for mx=plr.mapx,plr.mapx+30-1 do for my=plr.mapy,plr.mapy+17-1 do if fget(mget(mx,my),1) and triggers[posstr(mx,my)] and triggers[posstr(mx,my)].char==sh.char and AABB((mx-plr.mapx)*8,(my-plr.mapy)*8,16,16,sh.x-2,sh.y-2,12,12) then mset(mx,my,0); mset(mx+1,my,0) mset(mx,my+1,0); mset(mx+1,my+1,0) shots[i].dod=true rem(shots,i) sfx2(plr,20,'E-5',30,2) goto endloop end end end end ::endloop:: if not sh.dod then if sh.dy~=0 then if not sh.fall then sh.y=sh.y+sh.dy for mx=plr.mapx-1,plr.mapx+30 do for my=plr.mapy-1,plr.mapy+17 do if mget(mx,my)>0 and not fget(mget(mx,my),2) and AABB((mx-plr.mapx)*8,(my-plr.mapy)*8,8,8,sh.x,sh.y,8,8) then sh.fall=true sh.dy=0 sh.y=(my-plr.mapy)*8+8 end end end end end if not sh.fall then sh.x=sh.x+sh.dx*2 end if sh.fall then sh.y=sh.y+sh.dy sh.dy=sh.dy+0.2 end if sh.x<=0 or sh.x>=240-8 then sh.fall=true end for mx=plr.mapx-1,plr.mapx+30 do for my=plr.mapy-1,plr.mapy+17 do if mget(mx,my)>0 and not fget(mget(mx,my),2) and AABB((mx-plr.mapx)*8,(my-plr.mapy)*8,8,8,sh.x,sh.y,8,8) then if not sh.fall then sh.fall=true if sh.dx>0 then sh.x=(mx-plr.mapx)*8-8 else sh.x=(mx-plr.mapx)*8+8 end else sh.y=(my-plr.mapy)*8-8 sh.dy=0 end end end end if sh.y>136-8-8 then sh.y=136-8-8; sh.dy=0 end if sh.y<0 then sh.y=0; sh.fall=true; sh.dy=0 end for i,tb in ipairs(txtbox) do if not tb.bounce and tb.active and not tb.dod and tb.mapx==plr.mapx and tb.mapy==plr.mapy and AABB(sh.x,sh.y,8,8,tb.x,tb.y,tb.w,tb.h) then if not sh.fall then sh.fall=true if sh.dy~=0 then if sh.dy<0 then sh.y=tb.y+tb.h; sh.dy=0; sh.fall=true end else if sh.dx>0 then sh.x=tb.x-8 else sh.x=tb.x+tb.w end end else sh.y=tb.y-8 sh.dy=0 end end end end if sh.fall and not sh.dod then if AABB(sh.x,sh.y,8,8,plr.x,plr.y,14,16) then rem(shots,i) if plr==Jimi then inventory[sh.char]=inventory[sh.char] or 0 inventory[sh.char]=inventory[sh.char]+1 end sh.dod=true end end if not txtbox[28].active and plr.mapx==30*3 and plr.mapy==17 and sh.plr==Jimi and AABB(sh.x,sh.y,8,8,(112-plr.mapx)*8,(29-plr.mapy)*8,16,16) then chat1(sh.char) rem(shots,i) sh.dod=true seen2=true end if plr.mapx==30*0 and plr.mapy==17 and sh.plr==Jimi and AABB(sh.x,sh.y,8,8,(14-plr.mapx)*8,(21-plr.mapy)*8,16,16) then --trace(sh.x,2) --trace(sh.y,2) --trace(AABB(sh.x,sh.y,8,8,(14-plr.mapx)*8,(21-plr.mapy)*8,16,16),3) chat2(sh.char) rem(shots,i) sh.dod=true seen1=true end if not sh.dod then font(sh.char,sh.x,sh.y) recolor_font(sh.x,sh.y,(t*0.25)%16) end end end end function txtbox_spawn(plr) local mapx,mapy=plr.mapx,plr.mapy if mapx==0 and mapy==0 then if t-sc_t==60 then activate_textbox(1) end if t-sc_t==180 then activate_textbox(2) end if t-sc_t==180+120 and not hw_mode then activate_textbox(3) end end if mapx==210 and mapy==0 then if t-sc_t==60 then activate_textbox(4) end if t-sc_t==180 then activate_textbox(5) end if t-sc_t==180+120 then activate_textbox(6) end end if mapx==30 and mapy==0 then if t-sc_t==60 then activate_textbox(7) end if t-sc_t==180 then activate_textbox(8) end end if mapx==30*2 and mapy==0 then if t-sc_t==30 then activate_textbox(9) end if t-sc_t==30+120 then activate_textbox(10) end end if mapx==210 and mapy==17 then if t-sc_t==0 then if prev_mapx==210 and prev_mapy==0 and not txtbox[30].active then activate_textbox(12); txtbox[12].w=txtbox[12].tgtw else txtbox[12].active=false end end end if mapx==30*3 and mapy==0 then if t-sc_t==30 then activate_textbox(13) end if t-sc_t==30+60 then activate_textbox(14) end end if mapx==30*4 and mapy==0 then --if t-sc_t==30 then activate_textbox(11) end --if t-sc_t==30+120 then activate_textbox(15) end --if t-sc_t==30+120+120 then activate_textbox(16) end if plr.x>240/2 and not sc_t2 then sc_t2=t+1; activate_textbox(17) end if sc_t2 and t-sc_t2==60 then activate_textbox(18) end end if mapx==30 and mapy==17 then end if mapx==0 and mapy==17 then if t-sc_t==60 and not txtbox[29].disabled then activate_textbox(29) end end if mapx==210 and mapy==17 then if prev_mapx==0 and prev_mapy==17 then --trace(t-sc_t,4) if t-sc_t==60 then activate_textbox(30) end if t-sc_t==120 then activate_textbox(31) end end end end function inventory_draw(plr) rect(0,136-8,240,8,2) local msg='ABCDEFGHIJKLMNOPQRSTUVWXYZ' local tw=0 for i=1,#msg do local char=sub(msg,i,i) if inventory[char] and (i*0.4+t*0.12)%8<4 then local count=math.min(inventory[char],9) local tw2=print(count,0,-6) print(count,4+tw+2+3-tw2/2,136-8+1,10) tw=tw+9 else tw=tw+font(char,4+tw,136-8) end if unlocks[char] and not inventory[char] then recolor_font(4+tw-9,136-8,9) end if inventory[char] then recolor_font(4+tw-9,136-8,10) end end end function activate_textbox(i) if not txtbox[i].active then sfx2(Jimi,21,'A-4',90,2) end txtbox[i].active=true end function starroom(plr) return (plr.mapx==30*4 and plr.mapy==0) or (plr.mapx==30*2 and plr.mapy==17) or starrooms[posstr(plr.mapx,plr.mapy)] end function waterroom(plr) return waterrooms[posstr(plr.mapx,plr.mapy)] end local fs={i=1,'F','W','R','I','G','S','D','A','Y','H'} cycle=1 function titlescr() fs.i=1 local sp=51--228+flr(t*0.1208)%(2*6-1) --if sp==228 then cls(3) end --if sp==230 then cls(5) end --if t%60==0 then cls(5) end --if t%12==0 then cls(4) clip(16*3,0,240-16*6,16) local msg='Greets to >>>> BORB, for additional code such as palette swapping and bitpacking >>>> nespi from the TIC-80 Discord, for early bug reports >>>> SoundOfSpouting from Hempuli\'s Discord, for suggesting a save file improvement >>>> and everyone who\'s given nice feedback!' local tw=0 for i=1,#msg do local c=flr((i+t*0.5)*0.2%3) if c==0 then c=1 elseif c==1 then c=3 elseif c==2 then c=5 end tw=tw+print(sub(msg,i,i),-(t%(#msg*6))+200+tw,1,c) end clip() for ry=0,136,16 do spr(sp,0,ry,0,1,0,0,2,2) spr(sp,16,ry,0,1,0,0,2,2) spr(sp,16+16,ry,0,1,0,0,2,2) spr(sp,240-16,ry,0,1,0,0,2,2) spr(sp,240-16-16,ry,0,1,0,0,2,2) spr(sp,240-16-16-16,ry,0,1,0,0,2,2) --[[if ry%32==0 then spr(112,240-16-ry%48,ry,0,1,0,0,2,2) spr(112,ry%48,ry,0,1,0,0,2,2) font(fs[fs.i],ry%48+4,ry+4) recolor_font(ry%48+4,ry+4,9) fs.i=fs.i+1 font(fs[fs.i],240-16-ry%48+4,ry+4) recolor_font(240-16-ry%48+4,ry+4,9) fs.i=fs.i+1 end]] local msg1='LEONARD' local msg2='SOMERO' if ry>=16 and ry<16+16*7 then spr(112,16,ry,0,1,0,0,2,2) font(sub(msg1,ry/16,ry/16),16+4,ry+4) recolor_font(16+4,ry+4,9) if ry<16+16*6 then spr(112,240-16-16,ry,0,1,0,0,2,2) font(sub(msg2,ry/16,ry/16),240-16-16+4,ry+4) recolor_font(240-16-16+4,ry+4,9) end end end --end local cx,cy=240/2,136/2-16 local cw,ch=(9*8+2)*2,9*4+2 local chyp=sqrt((cy-(cy-ch/2))^2+(cx-(cx-cw/2))^2) chyp=chyp*(sin(t*0.07)*0.25+0.75) local a=0+sin(t*0.02)*0.3 local a2=0.25 local ax,ay=cx+cos(a+pi-a2)*chyp,cy+sin(a+pi-a2)*chyp local bx,by=cx+cos(a-a2)*chyp,cy+sin(a-a2)*chyp local dx,dy=cx+cos(a+pi+a2)*chyp,cy+sin(a+pi+a2)*chyp ttri(dx,dy,bx,by,ax,ay, 7,256+256-16-8-1,7+9*8+2,256+256-16-8-1,7,256+256-8+2, 0,0) local ex,ey=cx+cos(a+a2)*chyp,cy+sin(a+a2)*chyp ttri(ax,ay,bx,by,ex,ey, 7,256+256-8+2,7+9*8+2,256+256-16-8-1,7+9*8+2,256+256-8+2, 0,0) local msg='NEW GAME' if cycle==1 then if t%24<12 then msg='> '..msg..' <' else msg=' >'..msg..'< ' end end for i=1,#msg do local char=sub(msg,i,i) font(char,240/2-9*#msg/2+(i-1)*9,136-24-24+12+12-6-12) local offx=0 if #msg>#'NEW GAME' then offx=offx-2 end local c=flr((i+t*0.5+offx)*0.2%3) if c==0 then c=1 elseif c==1 then c=3 elseif c==2 then c=5 end recolor_font(240/2-9*#msg/2+(i-1)*9,136-24-24+12+12-6-12,c) end local msg='HALLOWEEN' if cycle==2 then if t%24<12 then msg='> '..msg..' <' else msg=' >'..msg..'< ' end end for i=1,#msg do local char=sub(msg,i,i) font(char,240/2-9*#msg/2+(i-1)*9,136-24-24+12+12-6) local offx=2 if #msg>#'HALLOWEEN' then offx=offx-2 end local c=flr((i+t*0.5+offx)*0.2%3) if c==0 then c=1 elseif c==1 then c=3 elseif c==2 then c=5 end recolor_font(240/2-9*#msg/2+(i-1)*9,136-24-24+12+12-6,c) end local msg='CONTINUE' if cycle==3 then if t%24<12 then msg='> '..msg..' <' else msg=' >'..msg..'< ' end end for i=1,#msg do local char=sub(msg,i,i) local offx=4 if #msg>#'CONTINUE' then offx=offx-2 end local c=flr((i+t*0.5+offx)*0.2%3) if c==0 then c=1 elseif c==1 then c=3 elseif c==2 then c=5 end font(char,240/2-9*#msg/2+(i-1)*9,136-24-24+12+9+3+12-6) recolor_font(240/2-9*#msg/2+(i-1)*9,136-24-24+12+9+3+12-6,c) end --local _,_,click=mouse() --if btnp(0) or btnp(1) or btnp(2) or btnp(3) or btnp(4) or (t>0 and keyp(50)) or click then music(); TIC=update; sc_t=t+1 end if btnp(0) then cycle=cycle-1; if cycle<1 then cycle=3 end end if btnp(1) then cycle=cycle+1; if cycle>3 then cycle=1 end end if btnp(4) or (t>0 and keyp(50)) then TIC=titlefade end t=t+1 end unlocks={ ['A']=true, } --if DEBUG then unlocks['E']=true end txtbox={ {msg='HERE IS JIMI',x=16+4+16+16-4,y=136-4-8*8+4+2+4-2,tgtw=8*14+4,tgth=4+4+8}, {msg='JIMI CAN\nNOT READ',x=16+4+8,y=2,tgtw=8*10,tgth=4+4+8+1+8}, {msg='HE ONLY KNOWS\nTHE LETTER A',x=16+4+8+8*12-4-4-4,y=16+4+8+4-4+4-2,tgtw=8*16-4+1,tgth=4+4+8+1+8}, {msg='AA',mapx=210,mapy=0,x=16*8,y=16*3-4-2-1-1-2,tgtw=8*4-4-2,tgth=8*2}, {msg='SAID JIMI',mapx=210,mapy=0,x=16*8-3*8,y=16*3+16*2-2-1-1-1,tgtw=9*9+8,tgth=8*2}, {msg='BUT I CAN LEARN',mapx=210,mapy=0,x=16*8-7*8,y=16*3+16*2+16*2,tgtw=9*15+8,tgth=8*2}, {msg='AND SO',mapx=30,mapy=0,x=2,y=6,tgtw=9*6+4+4+1,tgth=4+4+8}, {msg='THE ADVENTURE COULD BEGIN',mapx=30,mapy=0,x=6,y=136-16-2-8,tgtw=9*24+4+4+9,tgth=4+4+8}, {msg='BATS',mapx=30*2,mapy=0,x=6,y=8,tgtw=4*9+4+4,tgth=8+4+4}, {msg='IT IS\nALWAYS BATS',mapx=30*2,mapy=0,x=240-9*11-8-6,y=6-1-1,tgtw=9*11+4+4,tgth=4+4+8+1+8}, {msg='AND THEN\nJIMI FELL INTO THE VOID',mapx=30*4,mapy=0,x=240/2-9*(32-8)/2,y=8,tgtw=9*(32-8)+4+4,tgth=4+4+8+1+8}, {msg='YOU WERE NOT SUPPOSED\nTO BE HERE YET',mapx=210,mapy=17,x=240-9*22,y=19,tgtw=9*21+4+4,tgth=4+4+8+1+8}, {msg='DO YOU WANT\nTO PROGRESS',mapx=30*3,mapy=0,x=240/2-9*6,y=136-24-16+2,tgtw=9*11+4+4,tgth=4+4+8+1+8}, {msg='OR ARE YOU STALLING',mapx=30*3,mapy=0,x=240/2-9*10,y=2,tgtw=9*19+4+4,tgth=4+4+8}, {msg='THE END',mapx=30*4,mapy=0,x=240/2-9*7/2,y=8+24+8+8,tgtw=9*7+4+4,tgth=4+4+8}, {msg='STAY TUNED FOR\nMORE CONTENT SOON',mapx=30*4,mapy=0,x=240/2-9*17/2,y=8+24+8+8+24+8,tgtw=9*17+4+4,tgth=4+4+8+1+8}, {msg='JUST\nONE\nMISSTEP',mapx=4*30,mapy=0,x=240-9*7-4-4-4,y=19,tgtw=9*7+4+4,tgth=4+4+8+8+1+8+1}, {msg='COULD\nCOST\nSO\nMUCH',mapx=4*30,mapy=0,x=0,y=136-4-4-8-1-8-1-8-1-8-8-4-8,tgtw=9*5+4+4,tgth=4+4+8+1+8+1+8+1+8}, {msg='SOMTMS',mapx=30,mapy=17,x=(46-30)*8-16-6-8,y=(27-17)*8+2,w=9*6+4+4,tgtw=9*6+4+4,h=4+4+8,tgth=4+4+8,active=true}, {msg='YOU FND YOURSLF\nBACK WHR YOU STARTD',mapx=30,mapy=17,x=240-#('BACK WHERE YOU STARTED')*9-4-4,y=8-4-2-1,w=#('BACK WHR YOU STARTD')*9+4+4,tgtw=#('BACK WHR YOU STARTD')*9+4+4,h=4+4+8,tgth=4+4+8+1+8,active=true}, {msg='AND THAT IS OKAY',mapx=30,mapy=0,x=2,y=8*8-3,tgtw=16*9+4+4,tgth=4+4+8}, {msg='NO\nYOU ARE NOT\nTHE ONE',mapx=30*3,mapy=17,x=240-11*9-4-4,y=8,tgtw=9*11+4+4,tgth=4+4+8+8+1+8+1}, {msg='PRESS START',mapx=30*3,mapy=17,x=240-9*11-4-4,y=4+6,tgtw=9*11+4+4,tgth=4+4+8}, {msg='PRESS START',mapx=30*3,mapy=17,x=240-9*11-4-4,y=4+4+4+8+2+6,tgtw=9*11+4+4,tgth=4+4+8}, {msg='PRESS STAR T',mapx=30*3,mapy=17,x=240-9*12-4-4,y=4+4+4+8+2+4+4+8+2+6,tgtw=9*12+4+4,tgth=4+4+8}, {msg='PRESS STAR\nAND T',mapx=30*3,mapy=17,x=240-9*10-4-4,y=4+4+4+8+2+4+4+8+2+4+4+8+2+6,tgtw=9*10+4+4,tgth=4+4+8+1+8}, {msg='ARGH',mapx=30*3,mapy=17,x=240-9*4-4-4,y=136-4-4-8-8,tgtw=9*4+4+4,tgth=4+4+8}, {msg='YESS',mapx=30*3,mapy=17,x=240-9*4-4-4,y=136-4-4-8-8-8-4-4-4,tgtw=9*4+4+4,tgth=4+4+8}, {msg='AND THE\nWORLD WILL\nFALL SILENT\nON THAT DAY',mapx=0,mapy=17,x=4,y=4,tgtw=9*11+4+4,tgth=4+4+8+(8+1)*3}, {msg='JIMI CAN SWIM',mapx=210,mapy=17,x=16*3,y=16,tgtw=9*13+4+4,tgth=4+4+8}, {msg='BUT BE QUICK',mapx=210,mapy=17,x=16*8,y=16*6-2,tgtw=9*12+4+4,tgth=4+4+8}, } for i,tb in ipairs(txtbox) do if not tb.w then tb.w=0; tb.h=0; tb.active=false end; tb.origmsg=tb.msg; tb.origw=tb.w; tb.origh=tb.h if not tb.mapx then tb.mapx=0; tb.mapy=0 end end inventory={} floating={} shots={} triggerlist={'0:8','28:8','48:2','50:2','52:2','54:2','54:6','56:6','58:6','50:10','52:10','54:10','210:12','68:10','68:12','74:10','74:12','80:10','80:12','86:10','86:12','230:55','190:46','10:29','18:29','188:36','214:27'} triggers={ ['0:8']={char='A'}, ['28:8']={char='E'}, ['48:2']={char='T'}, ['50:2']={char='E'}, ['52:2']={char='C'}, ['54:2']={char='H'}, ['54:6']={char='E'}, ['56:6']={char='A'}, ['58:6']={char='T'}, ['50:10']={char='A'}, ['52:10']={char='R'}, ['54:10']={char='T'}, ['210:12']={char='S'}, ['68:10']={char='T'}, ['68:12']={char='T'}, ['74:10']={char='E'}, ['74:12']={char='E'}, ['80:10']={char='A'}, ['80:12']={char='A'}, ['86:10']={char='L'}, ['86:12']={char='L'}, ['230:55']={char='B'}, ['190:46']={char='F'}, ['10:29']={char='G'}, ['18:29']={char='H'}, ['188:36']={char='S'}, ['214:27']={char='A'}, } scrolls={ ['212:4']={char='E'}, ['38:4']={char='T'}, ['74:2']={char='P'}, --['227:25']={char='H'}, ['64:12']={char='I'}, ['86:29']={char='R'}, ['104:23']={char='S'}, ['104:46']={char='Q'}, ['221:63']={char='U'}, ['230:44']={char='C'}, ['194:10']={char='H'}, } function legal_starroom(mx,my) return (mx==90 and my==17 and not starrooms[posstr(mx,my)]) end function legal_waterroom(mx,my) return (mx==90 and my==17 and Dimi.mapx==0 and Dimi.mapy==17)-- or (mx==210 and my==17) end function spawn_letters(tb,plr) local i=1 while i<=#tb.msg do local out={} local char=sub(tb.msg,i,i) if char~='' and (unlocks[char] or plr==Dimi) then i=i-1 out.char=char -- determine starting location local th,tw=0,0 for j=1,#tb.msg do local char2=sub(tb.msg,j,j) if char2=='\n' then th=th+9; tw=0 elseif char2==' ' then tw=tw+9 else tw=tw+font(char2,240,tb.y+4+th,0) end if char2==char then tb.msg=sub(tb.msg,1,j-1)..sub(tb.msg,j+1,#tb.msg) -- prepare for saving tb.rem=tb.rem or {} --[[local remj=j for l=1,31 do if tb.rem[l] and l<=remj then remj=remj+1 end end tb.rem[remj]=true]] tb.rem[string.byte(char)-65+1]=true out.x,out.y=tb.x+4+tw,tb.y+4+th break end end -- determine ending location out.tgtx=4+(string.byte(char)-65)*9 out.tgty=136-8+1 out.plr=plr ins(floating,out) sfx2(plr,9,'B-4',20,1) end i=i+1 end -- did the textbox size change? resize_textbox(tb) end function recolor_font(gx,gy,gc) for rx=0,8-1 do for ry=0,8-1 do if pix(gx+rx,gy+ry)==12 then pix(gx+rx,gy+ry,gc) end end end end -- particle effects for -- disappearing textboxes particles={} function pop(tb,plr) for i=0,24-1 do ins(particles,{x=tb.x,y=tb.y,id=119+math.random(0,1),dx=(math.random(10)-5)/2,dy=-math.random(3)/2,grav=true}) end sfx2(plr,10,'G-3',80,1) if not md_t then md_t=t+1 TIC=modal --music(5) end end function modal() if t-md_t==0 or t-md_t==30 then if t-md_t==0 then old_t=t end for sx=0,240-1 do for sy=0,136-1 do pix(sx,sy,fade_pal(pix(sx,sy))) end end end if t-md_t<60 then t=t+1; return end if t-md_t==60 then music(5) end if t-md_t<75 then t=t+1; return end insta_textbox('EMPTIED A TEXTBOX',8) if t-md_t<90 then t=t+1; return end insta_textbox('GOT A STAR EMBLEM',136-4-4-9-8) if t-md_t<105 then t=t+1; return end for i=0,15 do pal(i,math.floor((t*0.2)%16)) end spr(120,240/2-6*4+2*4-4,136/2-24+1*4+1*4,0,4) spr(120,240/2-6*4+2*4+4,136/2-24+1*4+1*4,0,4) spr(120,240/2-6*4+2*4,136/2-24+1*4+1*4-4,0,4) spr(120,240/2-6*4+2*4,136/2-24+1*4+1*4+4,0,4) spr(119,240/2-6*4+8*4-4,136/2-24+1*4,0,4) spr(119,240/2-6*4+8*4+4,136/2-24+1*4,0,4) spr(119,240/2-6*4+8*4,136/2-24+1*4-4,0,4) spr(119,240/2-6*4+8*4,136/2-24+1*4+4,0,4) spr(119,240/2-6*4+8*4-4,136/2-24+6*4+1*4,0,4) spr(119,240/2-6*4+8*4+4,136/2-24+6*4+1*4,0,4) spr(119,240/2-6*4+8*4,136/2-24+6*4+1*4-4,0,4) spr(119,240/2-6*4+8*4,136/2-24+6*4+1*4+4,0,4) pal() spr(120,240/2-6*4+2*4,136/2-24+1*4+1*4,0,4) spr(119,240/2-6*4+8*4,136/2-24+1*4,0,4) spr(119,240/2-6*4+8*4,136/2-24+6*4+1*4,0,4) for i=1,26 do if keyp(i) then TIC=update; music(); t=old_t end end if keyp(50) then TIC=update; music(); t=old_t end t=t+1 end function modal2() if t-md_t2==0 or t-md_t2==30 then if t-md_t2==0 then old_t=t end for sx=0,240-1 do for sy=0,136-1 do pix(sx,sy,fade_pal(pix(sx,sy))) end end end if t-md_t2<60 then t=t+1; return end if t-md_t2==60 then music(5) end if t-md_t2<75 then t=t+1; return end insta_textbox('USED A STAR EMBLEM',8) if t-md_t2<90 then t=t+1; return end insta_textbox('THE ROOM IS NOW STARS',136-4-4-9-8) if t-md_t2<105 then t=t+1; return end for i=0,15 do pal(i,math.floor((t*0.2)%16)) end spr(120,240/2-6*4+2*4-4,136/2-24+1*4+1*4,0,4) spr(120,240/2-6*4+2*4+4,136/2-24+1*4+1*4,0,4) spr(120,240/2-6*4+2*4,136/2-24+1*4+1*4-4,0,4) spr(120,240/2-6*4+2*4,136/2-24+1*4+1*4+4,0,4) spr(119,240/2-6*4+8*4-4,136/2-24+1*4,0,4) spr(119,240/2-6*4+8*4+4,136/2-24+1*4,0,4) spr(119,240/2-6*4+8*4,136/2-24+1*4-4,0,4) spr(119,240/2-6*4+8*4,136/2-24+1*4+4,0,4) spr(119,240/2-6*4+8*4-4,136/2-24+6*4+1*4,0,4) spr(119,240/2-6*4+8*4+4,136/2-24+6*4+1*4,0,4) spr(119,240/2-6*4+8*4,136/2-24+6*4+1*4-4,0,4) spr(119,240/2-6*4+8*4,136/2-24+6*4+1*4+4,0,4) pal() spr(120,240/2-6*4+2*4,136/2-24+1*4+1*4,0,4) spr(119,240/2-6*4+8*4,136/2-24+1*4,0,4) spr(119,240/2-6*4+8*4,136/2-24+6*4+1*4,0,4) for i=1,26 do if keyp(i) then TIC=update; music(); t=old_t end end if keyp(50) then TIC=update; music(); t=old_t end t=t+1 end function modal3() if t-md_t3==0 or t-md_t3==30 then if t-md_t3==0 then old_t=t end for sx=0,240-1 do for sy=0,136-1 do pix(sx,sy,fade_pal(pix(sx,sy))) end end end if t-md_t3<60 then t=t+1; return end if t-md_t3==60 then music(5) end if t-md_t3<75 then t=t+1; return end insta_textbox('FOUND A PEARL',8) if t-md_t3<90 then t=t+1; return end insta_textbox('IT TURNS STARS TO WATER',136-4-4-9-8) if t-md_t3<105 then t=t+1; return end for i=0,15 do pal(i,math.floor((t*0.2)%16)) end spr(240,240/2-6*4+2*4-4,136/2-24+1*4+1*4,0,4) spr(240,240/2-6*4+2*4+4,136/2-24+1*4+1*4,0,4) spr(240,240/2-6*4+2*4,136/2-24+1*4+1*4-4,0,4) spr(240,240/2-6*4+2*4,136/2-24+1*4+1*4+4,0,4) pal() spr(240,240/2-6*4+2*4,136/2-24+1*4+1*4,0,4) for i=1,26 do if keyp(i) then TIC=update; music(); t=old_t end end if keyp(50) then TIC=update; music(); t=old_t end t=t+1 end function modal4() if t-md_t4==0 or t-md_t4==30 then if t-md_t4==0 then old_t=t end for sx=0,240-1 do for sy=0,136-1 do pix(sx,sy,fade_pal(pix(sx,sy))) end end end if t-md_t4<60 then t=t+1; return end if t-md_t4==60 then music(5) end if t-md_t4<75 then t=t+1; return end insta_textbox('USED A PEARL',8) if t-md_t4<90 then t=t+1; return end insta_textbox('WATER FLOODS THE ROOM',136-4-4-9-8) if t-md_t4<105 then t=t+1; return end for i=0,15 do pal(i,math.floor((t*0.2)%16)) end spr(240,240/2-6*4+2*4-4,136/2-24+1*4+1*4,0,4) spr(240,240/2-6*4+2*4+4,136/2-24+1*4+1*4,0,4) spr(240,240/2-6*4+2*4,136/2-24+1*4+1*4-4,0,4) spr(240,240/2-6*4+2*4,136/2-24+1*4+1*4+4,0,4) pal() spr(240,240/2-6*4+2*4,136/2-24+1*4+1*4,0,4) for i=1,26 do if keyp(i) then TIC=update; music(); t=old_t end end if keyp(50) then TIC=update; music(); t=old_t end t=t+1 end function modal5() if t-md_t5==0 or t-md_t5==30 then if t-md_t5==0 then old_t=t end for sx=0,240-1 do for sy=0,136-1 do pix(sx,sy,fade_pal(pix(sx,sy))) end end end if t-md_t5<60 then t=t+1; return end if t-md_t5==60 then music(5) end if t-md_t5<75 then t=t+1; return end insta_textbox('QUEST FINISHED',8) if t-md_t5<90 then t=t+1; return end insta_textbox('RETURNING TO HUB',136-4-4-9-8) if t-md_t5<105 then t=t+1; return end for i=0,15 do pal(i,math.floor((t*0.2)%16)) end spr(21,240/2-6*4-4,136/2-24-8,2,4,0,0,2,2) spr(21,240/2-6*4+4,136/2-24-8,2,4,0,0,2,2) spr(21,240/2-6*4,136/2-24-8-4,2,4,0,0,2,2) spr(21,240/2-6*4,136/2-24-8+4,2,4,0,0,2,2) pal() spr(21,240/2-6*4,136/2-24-8,2,4,0,0,2,2) for i=1,26 do if keyp(i) then music() TIC=tport; sc_t=t+1 if Jimi.mapx==60 and Jimi.mapy==68 then goal1=true end if Jimi.mapx==60+30 and Jimi.mapy==68 then goal2=true end Jimi.mapx=0; Jimi.mapy=17; Jimi.x=4*8; Jimi.y=2*8 t=old_t break end end if keyp(50) then music() TIC=tport; sc_t=t+1 if Jimi.mapx==60 and Jimi.mapy==68 then goal1=true end if Jimi.mapx==60+30 and Jimi.mapy==68 then goal2=true end Jimi.mapx=0; Jimi.mapy=17; Jimi.x=4*8; Jimi.y=2*8 t=old_t end t=t+1 end function insta_textbox(tbmsg,tby) local tbx=240/2-(4+4+9*#tbmsg)/2 local tw,th=0,0 for sx=0,4+4+9*#tbmsg-1 do for sy=0,4+4+8-1 do local ax,ay=tbx+sx+8,tby+sy+8 pix(ax,ay,fade_pal(fade_pal(pix(ax,ay)))) end end rect(tbx,tby,4+4+9*#tbmsg,4+4+8,3) rectb(tbx,tby,4+4+9*#tbmsg,4+4+8,12) for j=1,#tbmsg do local char=sub(tbmsg,j,j) if char=='\n' then th=th+9; tw=0 elseif char==' ' then tw=tw+9 else tw=tw+font(char,tbx+4+tw,tby+4+th,0) end if unlocks[char] then recolor_font(tbx+4+tw-9,tby+4+th,9) end end end function only_empty(tb) for i=1,#tb.msg do local char=sub(tb.msg,i,i) if char~=' ' and char~='\n' then return false end end return true end function savegame(sx,sy,plr) if lastsave==posstr(sx,sy) then return end lastsave=posstr(sx,sy) uldata={} local msg='ABCDEFGHIJKLMNOPQRSTUVWXYZ' for i=1,#msg do local char=sub(msg,i,i) if unlocks[char] then ins(uldata,true) else ins(uldata,false) end end local out1,out2=to32(uldata,0,0) pmem(0,out1) trace(out1,11) mapdata={plr.mapx,plr.mapy,(sx-plr.mapx)*8,(sy-plr.mapy)*8} local out1,out2=to32(mapdata,0,0) pmem(1,out1) trace(out1,11) trigdata={} for i,k in ipairs(triggerlist) do if mget(strpos(k))>0 then ins(trigdata,true) else ins(trigdata,false) end end local out1,out2=to32(trigdata,0,0) pmem(2,out1) trace(out1,11) local msg='ABCDEFGH' local out={} for i=1,#msg do local char=sub(msg,i,i) local inv=inventory[char] or 0 for j,sh in ipairs(shots) do if sh.char==char then inv=inv+1 end end if inv then ins(out,math.min(inv,15)) else ins(out,0) end end local out1,out2=to32(out,0,0,true) pmem(5,out1) msg='IJKLMNOP' out={} for i=1,#msg do local char=sub(msg,i,i) local inv=inventory[char] or 0 for j,sh in ipairs(shots) do if sh.char==char then inv=inv+1 end end if inv then ins(out,math.min(inv,15)) else ins(out,0) end end local out1,out2=to32(out,0,0,true) pmem(6,out1) msg='QRSTUVWX' out={} for i=1,#msg do local char=sub(msg,i,i) local inv=inventory[char] or 0 for j,sh in ipairs(shots) do if sh.char==char then inv=inv+1 end end if inv then ins(out,math.min(inv,15)) else ins(out,0) end end local out1,out2=to32(out,0,0,true) pmem(7,out1) msg='YZ' out={} for i=1,#msg do local char=sub(msg,i,i) local inv=inventory[char] or 0 for j,sh in ipairs(shots) do if sh.char==char then inv=inv+1 end end if inv then ins(out,math.min(inv,15)) else ins(out,0) end end local out1,out2=to32(out,0,0,true) pmem(8,out1) for i,tb in ipairs(txtbox) do local out={} tb.rem=tb.rem or {} for j=1,31 do if tb.rem[j] then ins(out,true) else ins(out,false) end end out[32]=tb.active local out1,out2=to32(out,0,0) pmem(10+(i-1),out1) trace(out1,12) end for i=0,55 do local out={255,255,255,255} local out1,out2=to32(out,0,0) pmem(200+i,out1) end local i=0 for k,s in pairs(starrooms) do local kx,ky=strpos(k) local out={kx,ky,255,255} local out1,out2=to32(out,0,0) trace(k) pmem(200+i,out1) i=i+1 end pmem(255,mypop) trace('Game saved!') sfx2(plr,25,'E-6',38,2) save_msg_t=t+1 --sc_t=t+1 if hw_mode then pmem(254,1) pmem(253,deaths) pmem(252,timer) else pmem(254,0) pmem(253,0) pmem(252,0) end end uldata={} for i=1,26 do uldata[i]=false end mapdata={0,0,0,0} trigdata={} for i,tr in ipairs(triggerlist) do trigdata[i]=false end function loadgame(plr) if pmem(0)==0 then return end from32(pmem(0),uldata,0) local msg='ABCDEFGHIJKLMNOPQRSTUVWXYZ' for i,u in ipairs(uldata) do unlocks[sub(msg,i,i)]=u if i==26 then break end end for k,s in pairs(scrolls) do local sx,sy=strpos(k) if unlocks[s.char] then mset(sx,sy,0); mset(sx+1,sy,0) mset(sx,sy+1,0); mset(sx+1,sy+1,0) else mset(sx,sy,144); mset(sx+1,sy,144+1) mset(sx,sy+1,144+16); mset(sx+1,sy+1,144+16+1) end end from32(pmem(1),mapdata,0) plr.mapx=mapdata[1]; plr.mapy=mapdata[2] plr.x=mapdata[3]; plr.y=mapdata[4] from32(pmem(2),trigdata,0) for i,tr in ipairs(trigdata) do local tx,ty=strpos(triggerlist[i]) if tr then mset(tx,ty,112); mset(tx+1,ty,112+1) mset(tx,ty+1,112+16); mset(tx+1,ty+1,112+16+1) else mset(tx,ty,0); mset(tx+1,ty,0) mset(tx,ty+1,0); mset(tx+1,ty+1,0) end end for i,tb in ipairs(txtbox) do local out={} for j=1,32 do ins(out,false) end from32(pmem(10+(i-1)),out,0) tb.msg=tb.origmsg tb.rem={} for l=1,26 do --if out[l] then tb.msg=sub(tb.msg,1,l-1)..sub(tb.msg,l+1,#tb.msg); tb.rem[l]=true end if out[l] then tb.rem[l]=true for j=#tb.msg,1,-1 do local char=sub(tb.msg,j,j) if char==string.char(l-1+65) then tb.msg=sub(tb.msg,1,j-1)..sub(tb.msg,j+1,#tb.msg) end end end end resize_textbox(tb) if tb.tgtw==4+4 or only_empty(tb) then tb.dod=true end if out[32] then tb.active=true tb.w=tb.tgtw; tb.h=tb.tgth else tb.active=false tb.w=tb.origw; tb.h=tb.origh end end for i,e in ipairs(enemies) do local ex,ey=strpos(e.origtile) mset(ex,ey,e.sp) end enemies={} local invdata={} for i=1,8 do ins(invdata,0) end from32(pmem(5),invdata,0,true) for i,n in ipairs(invdata) do inventory[sub(msg,i,i)]=n end from32(pmem(6),invdata,0,true) for i,n in ipairs(invdata) do inventory[sub(msg,i+8,i+8)]=n end from32(pmem(7),invdata,0,true) for i,n in ipairs(invdata) do inventory[sub(msg,i+16,i+16)]=n end from32(pmem(8),invdata,0,true) for i,n in ipairs(invdata) do inventory[sub(msg,i+24,i+24)]=n if i+24==26 then break end end for k,p in pairs(inventory) do if p==0 then inventory[k]=nil end end starrooms={} for i=0,54 do local out={255,255,255,255} from32(pmem(200+i),out,0) if out[1]==255 then break else starrooms[posstr(out[1],out[2])]=true end end mypop=pmem(255) shots={} if not (Dimi.mapx==0 and Dimi.mapy==17) then Dimi={x=(112-30*3)*8,y=(29-17)*8,dx=0,dy=0,mapx=30*3,mapy=17,btn=rep_btn,btnp=btnp,key=key,keyp=keyp} rep.i=1 end plr.lastsp=55 waterlevel=waterrooms[posstr(plr.mapx,plr.mapy)] or 136 if Jimi.mapx==0 and Jimi.mapy==17 then txtbox[29].disabled=true end chat2_cur='' hw_mode=pmem(254)==1 if hw_mode then halloween(Jimi) deaths=pmem(253) timer=pmem(252) else clear_halloween(Jimi) end sc_t=t+1 end function resize_textbox(tb) -- strip trailing spaces local i=#tb.msg while i>=1 do if i==#tb.msg or sub(tb.msg,i+1,i+1)=='\n' then while sub(tb.msg,i,i)==' ' do tb.msg=sub(tb.msg,1,i-1)..sub(tb.msg,i+1,#tb.msg) i=i-1 end end i=i-1 end local tw,th=0,0 local ltw=0 for j=1,#tb.msg do local char2=sub(tb.msg,j,j) if char2=='\n' then th=th+9; if tw>ltw then ltw=tw end; tw=0 elseif char2==' ' then tw=tw+9 else tw=tw+font(char2,240,tb.y+4+th,0) end if j>=#tb.msg and tw>ltw then ltw=tw end end if ltw+4+4~=tb.tgtw then tb.tgtw=ltw+4+4 end end starrooms={} waterrooms={ ['210:17']=64, ['210:34']=0, ['210:51']=0, ['180:17']=64, ['180:34']=0, ['180:51']=0, } -- palette swapping by BORB function pal(c0,c1) if(c0==nil and c1==nil)then for i=0,15 do poke4(0x3FF0*2+i,i) end else poke4(0x3FF0*2+c0,c1) end end -- save/load funcs by BORB flr=math.floor function has(tbl,val)--returns which key for k,v in pairs(tbl)do if v==val then return k end end return false end function boolToBin(b)return b and 1 or 0 end function binToBool(b)return b==1 and true or false end function to32(tbl,bit,j,nibble) for i,v in ipairs(tbl) do if has({"boolean","nil"},type(v))then bit=bit+(boolToBin(v)<32 then trace("liian iso taulukko")end end return bit,j end function from32(val,tbl,j,nibble) for i,v in ipairs(tbl) do if has({"boolean","nil"},type(v))then tbl[i]=binToBool(val>>j&1) j=j+1 elseif nibble then tbl[i]=val>>j&15 j=j+4 elseif type(v)=="number" then tbl[i]=val>>j&255 j=j+8 elseif type(v)=="table" then tbl[i],j=from32(val,tbl[i],j) end end return tbl,j end -- you give this the numbers 0 and 1, it will return a string '0:1'. -- table keys use this format consistently. function posstr(x,y) return string.format('%d:%d',math.floor(x),math.floor(y)) end -- you give this the string '0:1', it will return 0 and 1. function strpos(pos) local delim=string.find(pos,':') local x=string.sub(pos,1,delim-1) local y=string.sub(pos,delim+1) --important tonumber calls --Lua will handle a string+number addition until it doesn't return tonumber(x),tonumber(y) end -- basic AABB collision. function AABB(x1,y1,w1,h1, x2,y2,w2,h2) return (x1 < x2 + w2 and x1 + w1 > x2 and y1 < y2 + h2 and y1 + h1 > y2) end --pmem(0,0) --loadgame() function chat1(char) local pop=mypop for i,tb in ipairs(txtbox) do if tb.dod then pop=pop+1 end end if pop<=0 and not txtbox[23].active then activate_textbox(22) return else txtbox[22].active=false end for i=0,5-1 do if not txtbox[23+i].active then activate_textbox(23+i); return end end end chat2_keywords={ 'EAT','ENERGY','QUEST','READ','ROOM','START', } chat2_answer={ ['EAT']=function() table.insert(txtbox,{msg='YOU HUNGRY',mapx=0,mapy=17,x=8,y=8+(tb_found+1)*16,tgtw=9*#'YOU HUNGRY'+4+4,tgth=4+4+8,chat2=true,answer=true}) activate_textbox(#txtbox) --trace('activated') mset(14,19,171); mset(14+1,19,171+1) mset(14,19+1,171+16); mset(14+1,19+1,171+16+1) end, ['START']=function() table.insert(txtbox,{msg='IT IS\nIMPORTANT\nTO CONVERT\nROOMS',mapx=0,mapy=17,x=8,y=8+(tb_found+1)*16,tgtw=9*#'TO CONVERT'+4+4,tgth=4+4+8+1+8+1+8+1+8,chat2=true,answer=true}) activate_textbox(#txtbox) end, ['QUEST']=function() --TIC=fadeout --sfx(26,'B-4',180,0) table.insert(txtbox,{msg='ENTER THIS\nSUMMONER ORB',mapx=0,mapy=17,x=4,y=4+32+4+8,tgtw=9*12+4+4,tgth=4+4+8+1+8}) activate_textbox(#txtbox) table.insert(txtbox,{msg='THERE WE CAN TALK\nWITHOUT SPEAKING',mapx=0,mapy=17,x=4,y=4+32+4+8+4+4+8+1+8+4,tgtw=9*17+4+4,tgth=4+4+8+1+8}) activate_textbox(#txtbox) --mset(14,19,108); mset(14+1,19,108+1) --mset(14,19+1,108+16); mset(14+1,19+1,108+16+1) sorb={mapx=Jimi.mapx,mapy=Jimi.mapy,x=14*8,y=2*8} end } chat2_cur='' function chat2(char) if hw_mode then TIC=fadeout sfx(26,'B-4',180,0) return end txtbox[29].active=false txtbox[29].disabled=true --txtbox[29].dod=true --if chat2_cur=='' and not (txtbox[29] and txtbox[29].dod) then --table.remove(txtbox,29) --end --[[if char=='E' then table.insert(txtbox,{msg='AND THE\nWORLD WILL\nFALL SILENT\nON THAT DAY',mapx=0,mapy=17,x=4,y=4,tgtw=9*11+4+4,tgth=4+4+8+(8+1)*3,active=true}) for i,tb in ipairs(txtbox) do if not tb.w then tb.w=0; tb.h=0; tb.active=false end; tb.origmsg=tb.msg; tb.origw=tb.w; tb.origh=tb.h if not tb.mapx then tb.mapx=0; tb.mapy=0 end end activate_textbox(#txtbox) end]] chat2_cur=chat2_cur..char tb_found=0 for i,kw in ipairs(chat2_keywords) do if string.sub(kw,1,#chat2_cur)==chat2_cur then local exist=nil for i,tb in ipairs(txtbox) do if tb.chat2 and tb.origmsg==kw then exist=tb break end end if not exist then table.insert(txtbox,{msg=kw,mapx=0,mapy=17,x=8,y=8+tb_found*16,tgtw=9*#kw+4+4,tgth=4+4+8,chat2=true}) activate_textbox(#txtbox) else exist.y=8+tb_found*16 end  if chat2_cur==kw then if chat2_answer[kw] then for i,tb in ipairs(txtbox) do if tb.mapx==Jimi.mapx and tb.mapy==Jimi.mapy then tb.active=false end end chat2_answer[kw]() end end tb_found=tb_found+1 end end for i,tb in ipairs(txtbox) do if not tb.w then tb.w=0; tb.h=0 end; tb.origmsg=tb.msg; tb.origw=tb.w; tb.origh=tb.h end for i=#txtbox,1,-1 do local tb=txtbox[i] if tb.chat2 and not tb.answer and string.sub(tb.origmsg,1,#chat2_cur)~=chat2_cur then table.remove(txtbox,i) end end if tb_found==0 then for i=#txtbox,1,-1 do local tb=txtbox[i] if tb.chat2 then table.remove(txtbox,i) end end for i=1,#chat2_cur do local c=string.sub(chat2_cur,i,i) sfx2(Jimi,22,12*3+math.random(0,24),18,2) ins(shots,{x=14*8+16+(i-1)*8,y=(21-17)*8+4,plr=Jimi,dx=1,dy=0,char=c}) end chat2_cur='' else sfx2(Jimi,21,'A-4',90,2) end nr_t=t+1 end if DEBUG then local msg='ABCDEFGHIJKLMNOPQRSTUVWXYZ' for i=1,#msg do local char=sub(msg,i,i) unlocks[char]=true inventory[char]=15 end end function update() if t-sc_t==0 then local plr=Jimi for mx=plr.mapx,plr.mapx+30-1 do for my=plr.mapy,plr.mapy+17-1 do if mget(mx,my)==151 or mget(mx,my)==210 then ins(enemies,{x=(mx-plr.mapx)*8,y=(my-plr.mapy)*8,dx=-1,mapx=plr.mapx,mapy=plr.mapy,origtile=posstr(mx,my),sp=mget(mx,my)}) mset(mx,my,0) end if mget(mx,my)==167 then ins(enemies,{x=(mx-plr.mapx)*8,y=(my-plr.mapy)*8,dx=0,dy=-1,mapx=plr.mapx,mapy=plr.mapy,origtile=posstr(mx,my),sp=mget(mx,my)}) mset(mx,my,0) end end end end draw_bg(Jimi) enemy_update(Jimi) if txtbox[28].active or (starroom({mapx=90,mapy=17})) then ctrl_player(Dimi) rep.i=rep.i+1 else if Jimi.mapx==Dimi.mapx and Jimi.mapy==Dimi.mapy then spr(53,Dimi.x,Dimi.y,0,1,0,0,2,2) end end if Jimi.mapx==Narrator.mapx and Jimi.mapy==Narrator.mapy then local anim=0 if nr_t and t-nr_t<30 then anim=2 end spr(196+anim--[[+math.floor(t*0.02)%2*2]],Narrator.x,Narrator.y,0,1,0,0,2,2) end ctrl_player(Jimi) txtbox_update(Jimi) letter_draw(Jimi) shots_update(Jimi) starrooms_update(Jimi) spec_update(Jimi) t=t+1 if RECORD then ins(rec,{}) end if hw_mode then timer=timer+1 end --print(posstr(Dimi.x,Dimi.y),0,0,13) end function spec_update(plr) post_save(plr) particles_update(plr) pop_update(plr) if sorb and sorb.mapx==plr.mapx and sorb.mapy==plr.mapy then spr(108,sorb.x,sorb.y,9,1,0,0,2,2) if AABB(plr.x,plr.y,16,16,sorb.x,sorb.y,16,16) then sorb.follow=true end end if sorb and sorb.follow then sorb.mapx=plr.mapx; sorb.mapy=plr.mapy; sorb.x=plr.x-1; sorb.y=plr.y-16 if keyp(50) then TIC=sorb_dialogue --cls(0) t=-1 end end if not seen1 then if plr.mapx==Narrator.mapx and plr.mapy==Narrator.mapy then if t%64<56 then spr(49,Narrator.x,Narrator.y-16,0,1,0,0,2,2) end end end if not seen2 then if plr.mapx==Dimi.mapx and plr.mapy==Dimi.mapy then if t%64<56 then spr(49,Dimi.x-1,Dimi.y-16,0,1,0,0,2,2) end end end for i,g in ipairs(goals) do if g.mapx==plr.mapx and g.mapy==plr.mapy then spr(21,g.x,g.y,2,1,0,0,2,2) if AABB(plr.x,plr.y,14,16,g.x+4,g.y+4,8,8) then TIC=modal5 md_t5=t+1 if i==3 then TIC=fadeout sfx(26,'B-4',180,0) end end end end end function dbtn() return true end function pass() end RECORD=false rec={{}} function find(tbl,var) for i,v in ipairs(tbl) do if v==var then return i end end end rep={i=1,{},{},{},{},{},{},{},{},{},{}, {},{},{},{},{},{},{},{},{},{},{},{},{},{ },{},{2},{2},{2},{2},{2},{2},{2},{2},{2} ,{2},{2},{2},{2},{2},{2},{2},{2},{2},{2} ,{2},{2},{},{},{},{},{},{},{},{},{},{},{ },{},{},{},{},{},{},{},{},{},{},{},{},{} ,{},{},{},{},{},{},{},{},{},{},{},{},{}, {},{},{0},{0,2},{0,2},{0,2},{0,2},{0,2}, {0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{},{},{},{},{},{},{},{},{},{},{},{},{} ,{},{},{},{},{},{},{},{},{},{},{},{},{}, {},{},{},{2},{2},{2},{2},{2},{2},{2},{2} ,{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0, 2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{ 0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{},{} ,{},{},{},{},{},{},{},{},{},{},{},{},{}, {},{},{},{},{},{},{0},{0},{0},{0},{0,2}, {0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2 },{0,2},{0,2},{0,2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{},{},{},{},{},{ },{},{},{},{},{},{},{},{},{},{},{},{},{} ,{},{},{},{},{},{2},{2},{2},{2},{2},{2}, {2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2}, {0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2 },{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0 ,2},{0,2},{0,2},{0,2},{0,2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{},{},{},{},{},{},{} ,{},{},{},{},{},{},{},{},{},{},{},{},{}, {},{},{},{},{},{},{},{2},{2},{2},{2},{2} ,{2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2} ,{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0, 2},{0,2},{0,2},{0,2},{0,2},{0,2},{2},{2} ,{2},{2},{2},{2},{2},{2},{2},{2},{2},{2} ,{2},{2},{2},{2},{2},{2},{2},{2},{2},{2} ,{2},{2},{2},{},{},{},{},{},{},{},{},{}, {},{},{},{},{},{},{},{},{},{},{},{},{},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{},{},{}, {},{},{},{},{},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{ 2},{2},{2},{2},{2},{2},{2},{2},{2},{},{} ,{},{},{},{},{},{},{},{},{},{},{},{},{}, {},{},{},{},{},{},{},{},{},{},{},{},{},{ },{},{0},{0},{0},{0},{0},{0},{0},{0},{0} ,{0},{0},{0},{0},{0},{0},{0},{0},{},{},{ },{},{},{},{},{},{},{},{},{},{},{},{},{} ,{},{},{},{},{},{},{},{},{},{},{},{},{}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0,3},{0,3}, {0,3},{0,3},{0,3},{0,3},{0,3},{3},{3},{3 },{3},{3},{3},{3},{3},{3},{},{},{},{},{} ,{},{},{},{},{},{},{0,3},{0,3},{0,3},{0, 3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3},{ 0,3},{3},{3},{3},{3},{3},{3},{3},{3},{}, {},{},{},{},{},{},{},{},{3},{3},{3},{3}, {3},{3},{3},{3},{3},{3},{0,3},{0,3},{0,3 },{0,3},{0,3},{0,3},{0,3},{0,3},{0,3},{3 },{3},{3},{3},{3},{3},{3},{3},{3},{3},{3 },{3},{3},{3},{3},{3},{3},{3},{3},{3},{3 },{3},{3},{3},{3},{3},{3},{3},{3},{3},{3 },{3},{3},{3},{3},{3},{3},{3},{3},{3},{3 },{3},{3},{3},{3},{3},{3},{3},{3},{3},{0 },{0},{0},{0},{0},{0},{0},{0},{0},{0},{0 },{0},{0},{0},{0},{0},{0},{0},{0},{0},{0 },{0},{0},{0},{0},{0},{0},{0},{0},{0},{0 },{0},{0},{0},{0},{0},{0},{0},{0},{0},{0 },{0},{0},{0},{0},{0},{0},{0},{0},{0},{0 },{0},{0,2},{0,2},{0,2},{2},{2},{2},{2}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2}, {2},{2},{0,2},{0,2},{0,2},{0,2},{0,2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{2},{2 },{2},{2},{2},{2},{2},{2},{2},{2},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, {2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{2},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3},{3}} function rec_btn(i) if keyp(18) and not rec_output then local out='rep={i=1,' for i,r in ipairs(rec) do if #r>0 then out=out..'{' for i2,r2 in ipairs(r) do out=out..tostring(r2)..',' end out=sub(out,1,#out-1) out=out..'},' else out=out..'{},' end end out=sub(out,1,#out-1) out=out..'}' trace(out) rec_output=true end if btn(i) and not find(rec[#rec],i) then ins(rec[#rec],i) end return btn(i) end function rep_btn(i) if rep[rep.i] and find(rep[rep.i],i) then return true end return false end Jimi={x=16*6+16*6-3,y=16*6,dx=0,dy=0,mapx=0,mapy=0,btn=btn,btnp=btnp,key=key,keyp=keyp} Dimi={x=(112-30*3)*8,y=(29-17)*8,dx=0,dy=0,mapx=30*3,mapy=17,btn=rep_btn,btnp=pass,key=pass,keyp=pass} Narrator={x=(14-0)*8,y=(21-17)*8,dx=0,dy=0,mapx=0,mapy=17,btn=pass,btnp=pass,key=pass,keyp=pass} --local out={30*3,17,255,255} --local out1,out2=to32(out,0,0) --pmem(200,out1) -- water effect waterlevel=136 function SCN(scnline) if Jimi.mapx==0 and Jimi.mapy==17 and TIC==update then --poke(0x3FC0,0x2B+0x8+math.sin(scnline//8+t*0.05)*0x2B) --poke(0x3FC0+15*3,0x4B+math.sin(scnline//8+t*0.05)*0x3B) --poke(0x3FC0+15*3+1,0x3B+math.sin(scnline//8+t*0.05)*0x3B) --poke(0x3FC0+15*3+2,0x9C+math.sin(scnline//8+t*0.05)*0x3B) poke(0x3FC0+15*3,0x2B) poke(0x3FC0+15*3+1,0x2B) poke(0x3FC0+15*3+2,0x26+0x8+math.sin(scnline//8+t*0.05)*0x2B) --poke(0x3FC0+13*3,0x2B+0x8+math.sin(scnline//8+t*0.05)*0x2B) --poke(0x3FC0,0x2B+0x8+math.sin(scnline*0.15+t*0.05)*0x2B) --poke(0x3FC0+1,0x2B+0x8+math.sin(scnline*0.05+t*0.05)*0x2B) --poke(0x3FC0+2,0x2B+0x8+math.sin(scnline*0.25+t*0.05)*0x2B) return else poke(0x3FC0,0x2B) poke(0x3FC0+1,0x2B) poke(0x3FC0+2,0x26) poke(0x3FC0+13*3,0x4B) poke(0x3FC0+13*3+1,0x3B) poke(0x3FC0+13*3+2,0x9C) poke(0x3FC0+14*3,0x6A) poke(0x3FC0+14*3+1,0x6C) poke(0x3FC0+14*3+2,0x56) poke(0x3FC0+15*3,0xAD) poke(0x3FC0+15*3+1,0xAC) poke(0x3FC0+15*3+2,0x8E) --poke(0x3FC0+13*3,0x4B) end poke(0x3FF9,0) if scnline>=waterlevel and scnline<136-8 then poke(0x3FF9,math.sin(scnline*0.2+t*0.05)*2) end end hw_bats={ --{24,2},{25,4},{26,6},{25,8},{23,10},{19,12}, --{220,5},{224,4},{224,8},{228,5},{232,4},{234,6},{236,8},{234,10}, } hw_save={ [posstr(21,12)]=true, [posstr(234,10)]=true, [posstr(84,4)]=true, } def_bats={ [posstr(78,4)]=true, [posstr(82,6)]=true, [posstr(70,21)]=true, [posstr(72,21)]=true, [posstr(76,23)]=true, [posstr(78,23)]=true, [posstr(82,25)]=true, [posstr(84,25)]=true, [posstr(94,40)]=true, [posstr(96,42)]=true, [posstr(98,44)]=true, [posstr(102,46)]=true, [posstr(106,46)]=true, [posstr(110,44)]=true, [posstr(112,42)]=true, [posstr(114,40)]=true, [posstr(36,25)]=true, [posstr(42,23)]=true, } function clear_halloween(plr) for mx=0,240-1 do for my=0,136-1 do if mget(mx,my)==151 or mget(mx,my)==167 then if not def_bats[posstr(mx,my)] then mset(mx,my,0) end end if mget(mx,my)==164 and hw_save[posstr(mx,my)] then mset(mx,my,0); mset(mx+1,my,0); mset(mx,my+1,0); mset(mx+1,my+1,0); end end end end function halloween(plr) hw_mode=true for i,bat in ipairs(hw_bats) do mset(bat[1],bat[2],151) end for i,save in ipairs(hw_save) do mset(save[1],save[2],164); mset(save[1]+1,save[2],164+1) mset(save[1],save[2]+1,164+16); mset(save[1]+1,save[2]+1,164+1+16) end txtbox[1].msg='WELCOME TO JIMI\nHALLOWEEN EDITION' txtbox[1].tgtw=4+4+8*(#'HALLOWEEN EDITION'+2) txtbox[1].tgth=4+4+8+1+8 txtbox[1].y=136-4-8*8+4+2+4-2-8 txtbox[2].msg='NOW DIE' txtbox[2].tgtw=4+4+8*(#txtbox[2].msg+1) txtbox[2].tgth=4+4+8 txtbox[4].msg='AAAAAAAA' txtbox[4].x=16*8-4*8 txtbox[4].tgtw=4+4+8*(#txtbox[4].msg+1) txtbox[6].msg='BATS EVERYWHERE' txtbox[6].tgtw=4+4+4+1+8*(#txtbox[6].msg+1) end bullets={} function tport() cls(3) sfx(8,12*4+t*3%20+t*2%22,9,0) for i=0,36-1 do local a=i*2*math.pi/36 line(240/2,136/2,240/2+math.cos(a)*140,136/2+math.sin(a)*140,t*0.2) circb(240/2,136/2,i*16,t*0.2) end for i=0,16 do local a=(i*0.2+1)*t*0.5 table.insert(bullets,{x=240/2,y=136/2,dx=math.cos(a)*1.5,dy=math.sin(a)*1.5,i=#bullets}) end for i=#bullets,1,-1 do local b=bullets[i] b.x=b.x+b.dx; b.y=b.y+b.dy pal(9,b.i*0.4) spr(39,b.x-4,b.y-4,0) pal() --circ(b.x,b.y,16,b.i*0.4) if b.x<-8 or b.y<-8 or b.x>240+8 or b.y>136+8 then table.remove(bullets,i) end end if t-sc_t==300 then TIC=update; sc_t=t+1; bullets={}; sfx(-1) end t=t+1 end function floodfill(fx,fy,c) return coroutine.create(function() local fill={[posstr(fx,fy)]=true,[1]=posstr(fx,fy)} local sc=pix(fx,fy) for i,v in ipairs(fill) do local fx2,fy2=strpos(v) if pix(fx2,fy2)==sc then if c~=9 or (c==9 and ((fx2+fy2)%2==1 or (fx2+fy2)%4==2)) then pix(fx2,fy2,c) end--else pix(fx2,fy2,0) end local p=posstr(fx2-1,fy2) if not fill[p] then fill[p]=true; table.insert(fill,p) end p=posstr(fx2+1,fy2) if not fill[p] then fill[p]=true; table.insert(fill,p) end p=posstr(fx2,fy2-1) if not fill[p] then fill[p]=true; table.insert(fill,p) end p=posstr(fx2,fy2+1) if not fill[p] then fill[p]=true; table.insert(fill,p) end end coroutine.yield() end end) end function sorb_choice(tbl) if tbl.i==nil then tbl.i=1 end if btnp(0) then tbl.i=tbl.i-1; if tbl.i<1 then tbl.i=#tbl end end if btnp(1) then tbl.i=tbl.i+1; if tbl.i>#tbl then tbl.i=1 end end for i,s in ipairs(tbl) do local ty=136-50+4-#tbl/2*8+(i-1)*8-1 if i==tbl.i then rect(136-8+24+4,ty,(240-(136-8))-24*2-4*2,8,12) end local tx=0 local col=15 if string.sub(s[1],1,5)=='Quest' and tonumber(string.sub(s[1],7,7))>3 then col=9 end for j=1,#s[1] do tx=tx+print(string.sub(s[1],j,j),136-8+(240-(136-8))/2-print(s[1],0,-99)/2+tx+math.cos(j+t*0.2)+1,ty+math.sin(j+t*0.17+i)+1,col) end end if btnp(4) then if tbl==summonables then summonables=nil; t=-1 end tbl[tbl.i][2](tbl[tbl.i][1]) end end function sorb_dialogue() if not summonables then if Jimi.mapx==0 and Jimi.mapy==17 then summonables={c=0,i=1,{'CatPerson',function() TIC=dialogue_cat end},{'Dimi',function() TIC=dialogue_dimi end}} sum_msg='Who to summon?' else summonables={c=0,i=1,{'Leave',function() TIC=update end}} sum_msg='Nobody nearby.' end sfx(27,'D-3',140-4,0) end if summonables.c<240 then summonables.c=summonables.c+3 circ(sorb.x+8,sorb.y+8,summonables.c,0) return end cls(0) rectb(0,0,136-8,136-8,1) rectb(2,2,136-8-4,136-8-4,1) rectb(136-8+0+24,136-80,240-(136-8)-24*2,80-8-8,1) rectb(136-8+2+24,136-80+2,240-(136-8)-4-24*2,80-8-8-4,1) sorb_choice(summonables) local tx=0 for j=1,#sum_msg do tx=tx+print(string.sub(sum_msg,j,j),136-8+(240-(136-8))/2-print(sum_msg,0,-6)/2+tx+math.cos(j+t*0.2)+1,136-60-40-18+math.sin(j+t*0.17)+1,12) end inventory_draw(Jimi) t=t+1 end function cat_diag_setup() cat_msg='So!\n\nYou wish to embark\non a quest?' local qprep=function(q) if (q=='Quest 1' and (not dash or not doublejump)) or (q=='Quest 2' and not goal1) or (q=='Quest 3' and not goal2) then cat_msg='You are not\nready yet.' else if q=='Quest 1' then Jimi.mapx=60; Jimi.mapy=68; Jimi.x=2*8; Jimi.y=12*8 end if q=='Quest 2' then Jimi.mapx=60+30; Jimi.mapy=68; Jimi.x=5*8; Jimi.y=12*8 end if q=='Quest 3' then Jimi.mapx=60+30*2; Jimi.mapy=68; Jimi.x=(147-Jimi.mapx)*8; Jimi.y=(79-Jimi.mapy)*8 end cat_msg='See you on the\nother side.' cat_undo=true t=(w*45) end end quest1=quest1 or {{'Explain',cat_diag_setup2},{'Quest 1',qprep},{'Quest 2',qprep},{'Quest 3',qprep},{'Quest 4',qprep},{'Quest 5',qprep}} quest=quest1 end function cat_diag_setup2() cat_msg='Precision\nplatforming\nis the key to\nsalvation.' quest2=quest2 or {{'Prepare',cat_diag_setup3},{'Return',cat_diag_setup}} quest=quest2 end function cat_diag_setup3() cat_msg='You will need two\nabilities: dash and\ndouble jump.' quest3=quest3 or {{'Dash',cat_diag_setup4},{'DoubleJump',cat_diag_setup5},{'Return',cat_diag_setup}} quest=quest3 end function cat_diag_setup4() dash=true cat_msg='Dash with Shift\nto cover horizontal\nground.' end function cat_diag_setup5() doublejump=true cat_msg='Jump again in mid-air\nto cover vertical\nground.' end function dialogue_cat() local oy=-16 w=w or 60 local v=0.009 if t==0 then cat_diag_setup() w=w/2 end if t==0 or cat_undo then cls(0) end rectb(0,0,136-8,136-8,1) --rectb(1,1,136-8-2,136-8-2,9) rectb(2,2,136-8-4,136-8-4,1) --spr(196,2,2,0,6,0,0,2,2) clip(136-8+0+24,136-80,240-(136-8)-24*2,80-8-8) cls(0) clip() rectb(136-8+0+24,136-80,240-(136-8)-24*2,80-8-8,1) rectb(136-8+2+24,136-80+2,240-(136-8)-4-24*2,80-8-8-4,1) local prog=t/(w*45+w*(12+1)) if prog>1 then prog=1 end --prog=1 clip(136-8,0,240-(136-8),136/2-8-8) cls(0) if prog<1 and not cat_undo then local tx=0 local msg='Summoning...' for j=1,#msg do tx=tx+print(string.sub(msg,j,j),136-8+(240-(136-8))/2-print(msg,0,-6)/2+tx+math.cos(j+t*0.2)+1,136-60-40-18+math.sin(j+t*0.17)+1,12) end end if prog==1 or cat_undo then local tx=0 local ty=0 if old_cat_msg~=cat_msg then old_cat_msg=cat_msg cat_msg_t=t end for j=1,#cat_msg do if not cat_undo and j>=t-cat_msg_t then break end local char=string.sub(cat_msg,j,j) if char=='\n' then tx=0; ty=ty+8 else tx=tx+print(char,136-8+(240-(136-8))/2-print(cat_msg,0,-6)/2+tx+math.cos(j+t*0.2+ty)+1,136-60-40-18-6+math.sin(j+t*0.17+ty)+1+ty,12) end end end clip() if prog==1 then sorb_choice(quest) end line(1,1,1+(136-8-2-1)*prog,1,12) line(1+136-8-2-1,1,1+136-8-2-1,1+(136-8-2-1)*prog,12) line(1+136-8-2-1,1+136-8-2-1,1+136-8-2-1-(136-8-2-1)*prog,1+136-8-2-1,12) line(1,1+136-8-2-1,1,1+136-8-2-1-(136-8-2-1)*prog,12) clip(3,3,136-8-6,136-8-6) if not cat_undo then if t%w==0 and not (t>=w*43 and t<=w*45) and not (t>=w*45+w*(12+1)) then sfx(8,'A-4',5,0) end if t==w*45+w*(12+1) then sfx(8,'A-5',40,0) end end bezier(dot(30,45+oy),dot(30,00+oy),dot(55,40+oy),0,t*v,14) bezier(dot(30+5-2,45+oy),dot(30+5-2,00+5+oy),dot(55-5-2,40+5+oy),0,(t-w)*v,2) bezier(dot(55-5-2,40+5+oy),dot(30+5-2,40+5+6+oy),dot(30+5-2,45+oy),0,(t-w*2)*v,2) local e=136-8 bezier(dot(e-30,45+oy),dot(e-30,00+oy),dot(e-55,40+oy),0,(t-w*3)*v,14) bezier(dot(e-(30+5-2),45+oy),dot(e-(30+5-2),00+5+oy),dot(e-(55-5-2),40+5+oy),0,(t-w*4)*v,2) bezier(dot(e-(55-5-2),40+5+oy),dot(e-(30+5-2),40+5+6+oy),dot(e-(30+5-2),45+oy),0,(t-w*5)*v,2) bezier(dot(50+2,30+12+oy),dot(50+15,30+5+oy),dot(e-(50+2),30+12+oy),0,(t-w*6)*v,14) bezier(dot(30,45+oy),dot(30-10,54+oy),dot(30,45+10+oy),0,(t-w*7)*v,14) bezier(dot(e-30,45+oy),dot(e-(30-10),54+oy),dot(e-30,45+10+oy),0,(t-w*8)*v,14) local p=12 local r=-8 bezier(dot(30,45+10+oy),dot(20+r,60+p+oy),dot(20+r,65+p+oy),dot(20+5,65+p+oy),0,(t-w*9)*v,14) bezier(dot(e-30,45+10+oy),dot(e-(20+r),60+p+oy),dot(e-(20+r),65+p+oy),dot(e-(20+5),65+p+oy),0,(t-w*10)*v,14) bezier(dot(20+5-2,65+p-5+oy),dot(20+10,65+20-5+p-5+oy),dot(20+40+5,65+20+5+p-5+oy),0,(t-w*11)*v,14) bezier(dot(e-(20+5-2),65+p-5+oy),dot(e-(20+10),65+20-5+p-5+oy),dot(e-(20+40+5),65+20+5+p-5+oy),0,(t-w*12)*v,14) bezier(dot(40,60+1+oy),dot(40+10,60+10+oy),dot(40+20,60+5+oy),0,(t-w*13)*v,9) bezier(dot(e-40,60+1+oy),dot(e-(40+10),60+10+oy),dot(e-(40+20),60+5+oy),0,(t-w*14)*v,9) bezier(dot(60,75+oy),dot(e-60,75+oy),0,(t-w*15)*v,9) local c=(60+(e-60))/2 bezier(dot(c,75+4+oy),dot(c,75+oy),0,(t-w*16)*v,9) bezier(dot(c-5,75+4+6+oy),dot(c,75+4+oy),0,(t-w*17)*v,9) bezier(dot(c+5,75+4+6+oy),dot(c,75+4+oy),0,(t-w*18)*v,9) bezier(dot(30-7-2,60-20+4+2),dot(30-8,-16),dot(30+20,10),0,(t-w*19)*v,10) bezier(dot(e-(30-7-2)-1,60-20+4+2),dot(e-(30-8),-16),dot(e-(30+20),10),0,(t-w*20)*v,10) bezier(dot(30+20,10),dot((30+20+e-(30+20))/2,15),dot(e-(30+20),10),0,(t-w*21)*v,10) bezier(dot(30-7-2-2,60+1),dot(30-7-2-25,60+10),dot(30-7-2-30,60+5),0,(t-w*22)*v,10) bezier(dot(e-(30-7-2-2),60+1),dot(e-(30-7-2-25),60+10),dot(e-(30-7-2-30),60+5),0,(t-w*23)*v,10) bezier(dot(136/2,60+20),dot(136/2-4,60+5+20),dot(136/2-8,60+20+20),0,(t-w*24)*v,10) bezier(dot(e-136/2,60+20),dot(e-(136/2-4),60+5+20),dot(e-(136/2-5),60+20+6),0,(t-w*25)*v,10) local oy=24 bezier(dot(30-7-2-2+1,60+1+oy),dot(30-7-2-25,60+10+oy),dot(30-7-2-30,60+5+oy),0,(t-w*26)*v,10) bezier(dot(e-(30-7-2-2),60+1+oy),dot(e-(30-7-2-25),60+10+oy),dot(e-(30-7-2-30),60+5+oy),0,(t-w*27)*v,10) bezier(dot(30-7-2-2,60+1+oy),dot(30-7-2+25-15,60+10+oy+20-10),dot(30-7-2+10,60+5+oy+20-10),0,(t-w*28)*v,10) bezier(dot(30-7-2+10,60+5+oy+20-10),dot(30-7-2+10-30,60+5+oy+20-10+10),dot(30-7-2+10-30,60+5+oy+20-10+20),0,(t-w*29)*v,10) bezier(dot(e-(30-7-2-2),60+1+oy),dot(e-(30-7-2+25-15),60+10+oy+20-10),dot(e-(30-7-2+10),60+5+oy+20-10),0,(t-w*30)*v,10) bezier(dot(e-(30-7-2+10),60+5+oy+20-10),dot(e-(30-7-2+10-30),60+5+oy+20-10+10),dot(e-(30-7-2+10-30),60+5+oy+20-10+20),0,(t-w*31)*v,10) bezier(dot(30-10,136-8-4-10),dot(30+8,136-8-4-30+10),dot(30+20+16,136-8-4-30+10-6),0,(t-w*32)*v,10) bezier(dot(30+20+16,136-8-4-30+10-6),dot(30+20+16+8,136-8-4-30+10-6+8),dot(30+20+16+16-3,136-8-4-30+10-6+20),0,(t-w*33)*v,10) bezier(dot(30+20+16+16-3,136-8-4-30+10-6+20),dot(30+20+16+16-3-6,136-8-4-30+10-6+20+6),dot(30+20+16+16-3-20,136-8-4-30+10-6+20+10),0,(t-w*34)*v,10) --bezier(dot(e-(30-10),136-8-4-10),dot(e-(30+8),136-8-4-30+10),dot(e-(30+20),136-8-4-30+10),0,(t-w*32)*0.02,9) local c,d=30+20+16+1+20+6+2+10+6,136-8-4-30+10-6+10-1 bezier(dot(30+20+16+1+6-1-1,136-8-4-30+10-6+4),dot(30+20+16+1+10-5,136-8-4-30+10-6-6),dot(c,d),0,(t-w*35)*v,14) bezier(dot(c,d),dot(c+10,d+8),dot(c,d+9),0,(t-w*36)*0.02,14) bezier(dot(c,d+9),dot(c+12,d+9+8+2+2),dot(c-3-2,d+9+7),0,(t-w*37)*v,14) bezier(dot(c-16-8+3+1,136-24+5),dot(c,136-12),dot(c-8,136),0,(t-w*38)*v,14) bezier(dot(30+20+16+1+20+6+2+10+6-10-10,136-8-4-30+10-6+10+10-1),dot(30+20+16+1+20+6+2+10+6-40+10,136-8-4-30+10-6+10-1+6-5-2+4),dot(30+20+16+1+20+6+2+10+6-40+5-1,136-8-4-30+10-6+10-1+6-1),0,(t-w*39)*v,10) local f,g=30-10,136-8-4-10 bezier(dot(f,g-2),dot(f-2,g-10),dot(f+6,g-6),0,(t-w*40)*v,14) bezier(dot(f+6-2,g-2-4-2),dot(f-2+6-2,g-10-4-2),dot(f+6+6+2-2,g-6-2-2),0,(t-w*41)*v,14) bezier(dot(f+6+6,g-2-4-4),dot(f-2+6+6,g-10-4-4),dot(f+6+6+6+8,g-6-4-2+1),0,(t-w*42)*v,14) fills=fills or {} for i,v in ipairs({{63,41,1},{136/2+20,136/2+10,9},{136/2-20,136/2+10,9},{53,110,9},{62,18,9},{85,119,9},{119,116,9},{29,101,9},{38,19,2},{87,19,2},{76,104,1},{28,106,1}}) do if not cat_undo and t==w*45+w*i then table.insert(fills,floodfill(v[1],v[2],v[3])) end end for j,fill in ipairs(fills) do if not cat_undo then for i=1,13 do coroutine.resume(fill) end end end clip() --local mox,moy=mouse() --trace(mox,8) --trace(moy,9) inventory_draw(Jimi) t=t+1 if cat_undo then t=t-8; if t<0 then t=0; TIC=tport; sc_t=t cat_undo=nil for i,tb in ipairs(txtbox) do if tb.mapx==Narrator.mapx and tb.mapy==Narrator.mapy then tb.active=false end end end end end function dimi_diag_setup() dimi_msg='Thanks for saving\nme out there.' dimitalk1=dimitalk1 or {{'No prob',dimi_diag_setup2},{'Yes prob',dimi_diag_setup3}} dimitalk=dimitalk1 end function dimi_diag_setup2() dimi_msg='Name\'s Dimi,\nby the way.' dimitalk2=dimitalk2 or {{'Return',dimi_diag_setup}} dimitalk=dimitalk2 end function dimi_diag_setup3() dimi_msg='Oh? Just leave me\nalone then.' dimitalk3=dimitalk3 or {{'Fine',function() dimi_undo=true; t=w2*27 end}} dimitalk=dimitalk3 end function dialogue_dimi() w2=w2 or 60 local v=0.009 local oy=-2 if t==0 then dimi_diag_setup() w2=w2/2 end if t==0 or dimi_undo then cls(0) end clip(136-8+0+24,136-80,240-(136-8)-24*2,80-8-8) cls(0) clip() rectb(0,0,136-8,136-8,1) rectb(2,2,136-8-4,136-8-4,1) rectb(136-8+0+24,136-80,240-(136-8)-24*2,80-8-8,1) rectb(136-8+2+24,136-80+2,240-(136-8)-4-24*2,80-8-8-4,1) local prog=t/(w2*27+w2*(10+1)) if prog>1 then prog=1 end clip(136-8,0,240-(136-8),136/2-8-8) cls(0) if prog<1 and not dimi_undo then local tx=0 local msg='Summoning...' for j=1,#msg do tx=tx+print(string.sub(msg,j,j),136-8+(240-(136-8))/2-print(msg,0,-6)/2+tx+math.cos(j+t*0.2)+1,136-60-40-18+math.sin(j+t*0.17)+1,12) end end if prog==1 or dimi_undo then local tx=0 local ty=0 if old_dimi_msg~=dimi_msg then old_dimi_msg=dimi_msg dimi_msg_t=t end for j=1,#dimi_msg do if not dimi_undo and j>=t-dimi_msg_t then break end local char=string.sub(dimi_msg,j,j) if char=='\n' then tx=0; ty=ty+8 else tx=tx+print(char,136-8+(240-(136-8))/2-print(dimi_msg,0,-6)/2+tx+math.cos(j+t*0.2+ty)+1,136-60-40-18-6+math.sin(j+t*0.17+ty)+1+ty,12) end end end clip() if prog==1 then sorb_choice(dimitalk) end line(1,1,1+(136-8-2-1)*prog,1,12) line(1+136-8-2-1,1,1+136-8-2-1,1+(136-8-2-1)*prog,12) line(1+136-8-2-1,1+136-8-2-1,1+136-8-2-1-(136-8-2-1)*prog,1+136-8-2-1,12) line(1,1+136-8-2-1,1,1+136-8-2-1-(136-8-2-1)*prog,12) clip(2+1,2+1,136-8-4-2,136-8-4-2) if not dimi_undo then if t%w2==0 and (t<=w2*24 or (t>w2*27 and t<=w2*26+w2*(10+1))) then sfx(8,'A-4',5,0) end if t==w2*27+w2*(10+1) then sfx(8,'A-5',40,0) end end local ox=-4 bezier(dot(30-10+ox,30+oy),dot(30-10+ox,10+oy),dot(80-10+ox,10+oy),0,t*v,3) bezier(dot(136-(30-10)+ox,30+oy),dot(136-(30-10)+ox,10+oy),dot(136-(80-10)+ox,10+oy),0,(t-w2)*v,3) bezier(dot(30-10+ox,30+oy),dot(30-10+ox,70+oy),dot(40-10+ox,70+oy),0,(t-w2*2)*v,3) bezier(dot(136-(30-10)+ox,30+oy),dot(136-(30-10)+ox,70+oy),dot(136-(40-10)+ox,70+oy),0,(t-w2*3)*v,3) local armw=2 bezier(dot(40-10+ox,70+oy),dot(40-20+ox,70+oy),dot(40-20+ox,100+oy),0,(t-w2*4)*v,3) bezier(dot(40-20+ox,100+oy),dot(40-10+ox,130+oy),dot(40+armw+ox,80+oy),0,(t-w2*5)*v,3) bezier(dot(136-(40-10)+ox,70+oy),dot(136-(40-20)+ox,70+oy),dot(136-(40-20)+ox,100+oy),0,(t-w2*6)*v,3) bezier(dot(136-(40-20)+ox,100+oy),dot(136-(40-10)+ox,130+oy),dot(136-(40+armw)+ox,80+oy),0,(t-w2*7)*v,3) bezier(dot(40+armw+ox,80+oy),dot(40+ox,110+4+oy),dot(40-20+8+4+ox,110+4+oy),0,(t-w2*8)*v,3) bezier(dot(40-20+8+4+ox,110+4+oy),dot(40-30+ox,110+4+oy),dot(20+ox,130+oy),0,(t-w2*9)*v,3) bezier(dot(136-(40+armw)+ox,80+oy),dot(136-(40)+ox,110+4+oy),dot(136-(40-20+8+4)+ox,110+4+oy),0,(t-w2*10)*v,3) bezier(dot(136-(40-20+8+4)+ox,110+4+oy),dot(136-(40-30)+ox,110+4+oy),dot(136-(20)+ox,130+oy),0,(t-w2*11)*v,3) bezier(dot(136/2-20-4,136),dot(136/2-4,50),dot(136/2+20-4,136),0,(t-w2*12)*v,3) local oy2=24 bezier(dot(30-10+ox,20+oy+oy2),dot(30-10+ox,10+oy+oy2),dot(80-10+ox,10+oy+oy2),0,(t-w2*13)*v,3) bezier(dot(136-(30-10)+ox,20+oy+oy2),dot(136-(30-10)+ox,10+oy+oy2),dot(136-(80-10)+ox,10+oy+oy2),0,(t-w2*14)*v,3) local oy3=48 bezier(dot(30-10+ox+2,10+oy+oy3),dot(30+10+ox,18+oy+oy3),dot(30+38+ox,10-2+oy+oy3),0,(t-w2*15)*v,3) bezier(dot(136-(30-10+2)+ox,10+oy+oy3),dot(136-(30+10)+ox,18+oy+oy3),dot(136-(30+38)+ox,10-2+oy+oy3),0,(t-w2*16)*v,3) local oy4=29 local ox3=1 bezier(dot(30-10+ox3,10+oy4),dot(30-10+30+ox3,10-6+oy4),dot(30-10+40+ox3,10+oy4),0,(t-w2*17)*v,7) oy4=29+14 bezier(dot(30-10+3+ox3,10+oy4),dot(30-10+30+ox3,10+6+oy4),dot(30-10+40-3+ox3,10+oy4),0,(t-w2*18)*v,7) bezier(dot(30-10+ox3,10+29),dot(30-10-2+ox3,10+29+6),dot(30-10+3+ox3,10+29+14),0,(t-w2*19)*v,7) bezier(dot(30-10+40+ox3,10+29),dot(30-10+40+2+ox3,10+29),dot(30-10+40-3+ox3,10+29+14+1),0,(t-w2*20)*v,7) local oy4=29 local ox2=-9 bezier(dot(136-(30-10)+ox2,10+oy4),dot(136-(30-10+30)+ox2,10-6+oy4),dot(136-(30-10+40)+ox2,10+oy4),0,(t-w2*21)*v,12) oy4=29+14 bezier(dot(136-(30-10+3)+ox2,10+oy4),dot(136-(30-10+30)+ox2,10+6+oy4),dot(136-(30-10+40-3)+ox2,10+oy4),0,(t-w2*22)*v,12) bezier(dot(136-(30-10)+ox2,10+29),dot(136-(30-10-2)+ox2,10+29+6),dot(136-(30-10+3)+ox2,10+29+14),0,(t-w2*23)*v,12) bezier(dot(136-(30-10+40)+ox2,10+29),dot(136-(30-10+40+2)+ox2,10+29),dot(136-(30-10+40-3)+ox2,10+29+14+1),0,(t-w2*24)*v,12) fills=fills or {} local ox3=-8 for i,v in ipairs({{136/2,10,1},{23,101,1},{136-23+ox3,101,1},{22,118,1},{136-22+ox3,118,1},{63,35,3},{19,54,3},{136-19+ox3,54,3},{40,46,7},{136-40+ox3,46,12}}) do if not dimi_undo and t==w2*27+w2*i then table.insert(fills,floodfill(v[1],v[2],v[3])) end end for j,fill in ipairs(fills) do if not dimi_undo then for i=1,13 do coroutine.resume(fill) end end end local mox,moy=mouse() trace(string.format('%d,%d',mox,moy),2) clip() t=t+1 if dimi_undo then t=t-8; if t<0 then TIC=update; t=0; sc_t=t dimi_undo=nil end end end function dot(x,y) return {x=x,y=y} end function linear(dot1,dot2,t) return dot((1-t)*dot1.x+t*dot2.x, (1-t)*dot1.y+t*dot2.y) end -- modified from LOVECTOR function bezier(dot1,dot2,dot3,dot4,start_t,end_t,color) local process if type(dot4)=='table' then process='cubic'; color=color or 1; end_t=end_t or 1; start_t=start_t or 0 elseif type(dot3)=='table' then process='quadratic'; color=end_t or 1; end_t=start_t or 1; start_t=dot4 or 0 elseif type(dot2)=='table' then process='linear'; color=start_t or 1; end_t=dot4 or 1; start_t=dot3 or 0 elseif type(dot1)=='table' then process='point'; color=dot4 or 1 else return end local precision=0.65 if process=='point' then pix(dot1.x,dot1.y,color) end if process=='linear' then local len=math.sqrt((dot2.x-dot1.x)^2+(dot2.y-dot1.y)^2) for dt=math.max(start_t,0),math.min(end_t,1),1/len*precision do local lin=linear(dot1,dot2,dt) pix(lin.x,lin.y,color) end end if process=='quadratic' then local len=math.sqrt((dot2.x-dot1.x)^2+(dot2.y-dot1.y)^2)+math.sqrt((dot3.x-dot2.x)^2+(dot3.y-dot2.y)^2) for dt=math.max(start_t,0),math.min(end_t,1),1/len*precision do local lin=linear(dot1,dot2,dt) local lin2=linear(dot2,dot3,dt) local quad=linear(lin,lin2,dt) pix(quad.x,quad.y,color) end end if process=='cubic' then local len=math.sqrt((dot2.x-dot1.x)^2+(dot2.y-dot1.y)^2)+math.sqrt((dot3.x-dot2.x)^2+(dot3.y-dot2.y)^2)+math.sqrt((dot4.x-dot3.x)^2+(dot4.y-dot3.y)^2) for dt=math.max(start_t,0),math.min(end_t,1),1/len*precision do local lin=linear(dot1,dot2,dt) local lin2=linear(dot2,dot3,dt) local quad=linear(lin,lin2,dt) local lin3=linear(dot3,dot4,dt) local quad2=linear(lin2,lin3,dt) local cubic=linear(quad,quad2,dt) pix(cubic.x,cubic.y,color) end end end if DEBUG then Jimi.mapx=30; Jimi.mapy=17 Jimi.x=16-3; Jimi.y=136-16 mypop=2 end goals={ {mapx=60,mapy=68,x=27*8,y=6*8}, {mapx=60+30,mapy=68,x=11*8,y=1*8}, {mapx=60+30+30,mapy=68,x=(123-120)*8,y=(80-68+1)*8}, } --[[Jimi.mapx=30; Jimi.mapy=68 Jimi.x=8*3; Jimi.y=8*10 Jimi.doublejump=0 Jimi.dash=0]] TIC=titlescr music(7) --[[Jimi.mapx=60+30; Jimi.mapy=68 Jimi.x=4*8; Jimi.y=4*8 Jimi.mapx=60+30*2; Jimi.mapy=68; Jimi.x=(147-Jimi.mapx)*8; Jimi.y=(79-Jimi.mapy)*8 Dimi.mapx=0; Dimi.mapy=17 dash=true; doublejump=true inventory['Q']=1 inventory['U']=1 inventory['E']=1 inventory['S']=1 inventory['T']=1 --TIC=tport cls(0) mypop=2 pearl=true --TIC=dialogue --TIC=dialogue_dimi ]]