{────────────────────────────────────────────────────────────────────────── PEPE EL PINTOR Versió 1.0 Sergi Valor Martínez Juliol-Agost 1999 Versió 1.70 Build 3 Març 2000 (Windows2000) ──────────────────────────────────────────────────────────────────────────} uses grafix,crt,jinput,dos,pepe_vell, midiplay,WavPlay; const codi_sense_tecla = 86; {jinput} max_m_y = 6; { amplaria matriu personatge } max_m_x = 6; { alçada matriu personatge } VGA = $A000; ample = 248; alt = 192; max_pintura = 255; color_pared = 80; l0 = 10; l1 = 232; l2 = 182; l3 = 10; es_un_bloc_per_pintar = 0; es_pepe = 239; es_un_bloc_pintat = 2; es_un_bicho = 50; es_una_paret = 1; es_casa = 5; max_malos = 3; amunt = 0; avall = 2; esquerra = 3; dreta = 1; verticalment = 0; horitzontalment = 1; no_mou = 3; max_fondos = 13; max_fondos_story = 11; color_marcador_pintura_fondo = 34; color_borde_m_p = 239; tamany_m_p = 5; pos_esq_m_p = 266; { on comença el marcador de pintura per l'esquerra } pos_dreta_m_p = 276; { on comença el marcador de pintura per la dreta } pos_base_m_p = 180; { on comença el marcador de pintura per la base } pos_ini_x_pepe = 238; pos_ini_y_pepe = 96; vides_de_pepe = 5; blocs_fase_0 = 1102; blocs_fase_3 = 990; blocs_fase_7 = 778; blocs_fase_1 = 1026; blocs_fase_4 = 896; blocs_fase_5 = 989; blocs_fase_6 = 782; blocs_fase_2 = 729; blocs_fase_8 = 866; blocs_fase_9 = 800; blocs_fase_10 = 700; ultima_fase = 10; color_fondo_marcador_punts = 15; naiximent_del_malo = 0; mos_a_pepe = 1; pot_ple = 3; pot_buit = 2; vida_extra = 4; facil = 4; normal = 2; dificil = 0; Left = 0; Right = 1; musica_fase01 = '.\datos\mfase01.dat'; musica_fase02 = '.\datos\mfase02.dat'; musica_fase10 = '.\datos\mfase10.dat'; musica_logo = '.\datos\mlogo.dat'; musica_historia = '.\datos\mhist.dat'; musica_canvi_fase = '.\datos\mlevelc.dat'; musica_canvi_fase_n = '.\datos\mlevelcn.dat'; musica_title = '.\datos\mtitle.dat'; musica_game_over = '.\datos\mgover.dat'; musica_time_attack = '.\datos\mtimea.dat'; musica_final_joc = '.\datos\mfinalbo.dat'; musica_final_fals = '.\datos\mfinalf.dat'; musica_nit = '.\datos\mnit.dat'; musica_fase_nit = '.\datos\mnitfase.dat'; musica_campanes = '.\datos\mcampana.dat'; musica_options = '.\datos\moptions.dat'; sring = '.\datos\ring.wav'; spot = '.\datos\pot.wav'; smort = '.\datos\mort.wav'; smalo = '.\datos\malo.wav'; sfletxa = '.\datos\fletxa.wav'; senter = '.\datos\enter.wav'; sbomba = '.\datos\bomba.wav'; DONE01 = 1; FINAL01 = 2; FINAL02 = 3; FINAL03 = 4; HIST01 = 5; HIST02 = 6; HIST03 = 7; HIST04 = 8; MENU = 9; INTRO_N = 10; INTRO_N2 = 11; LOGO = 12; PEPE01 = 13; PEPE02 = 14; PEPE03 = 15; PEPE04 = 16; PEPE05 = 17; PEPE06 = 18; PEPE07 = 19; PEPE08 = 20; PEPE09 = 21; PEPE10 = 22; PEPE11 = 23; PEPEFINS = 24; RECORDS = 25; SELECT = 26; TIME = 27; TIME_FIN = 28; ULT_FASE = 29; CLASSIC = 30; FINALF1 = 31; MENU_NIT = 32; IN_NIT = 33; SELECT_N = 34; OPTIONS = 35; MENU_S = 36; DONE05 = 37; FONS_NIT = 38; TITOL = 39; CREDITSF = 40; FINALF2 = 41; FASES = 42; FINALN01 = 43; FINALN02 = 44; FINALN03 = 45; FINALN04 = 46; so_ring = 0; so_bomba = 1; so_pot = 2; so_mort = 3; so_malo = 4; so_fletxa = 5; so_enter = 6; rosita_enabled = 99; job_enabled = 199; pepe_facil = 5; pepe_normal = 15; pepe_dificil = 25; rosita_facil = 6; rosita_normal = 16; rosita_dificil = 26; Dream_tour = 7; pepe_malo=0+56; d_malo1=132+56; gorro=6+56; d_malo2=138+56; pepe_gorro=12+56; d_malo3=144+56; pepe=18+56; amic=150+56; pepe_b=24+56; amic_m2=156+56; pepe_m=30+56; amic_a=162+56; pepe_m2=36+56; amic_a2=168+56; pepe_a=42+56; amic_b=174+56; pepe_a2=48+56; dib_pot=180+56; rosita3=54+56; dib_pared=186+56; rosita=60+56; dos_p=192+56; rosita2=66+56; num1=198+56; rosita_chillido=72+56; num2=204+56; rosita_m=78+56; num3=210+56; rosita_m2=84+56; num4=216+56; rosita_a=90+56; num5=222+56; rosita_a2=96+56; num6=228+56; rosita_p=102+56; num7=234+56; preso=108+56; num8=240+56; rellontge_dib=114+56; num9=246+56; rellontge_dib_x=120+56; num0=252+56; rellontge_dib_y=126+56; amic_m=314; tick=0+(320*6); num_11=198+(320*6); fletxa=9+(320*6); lletra_a=207+(320*6); fletxa2=18+(320*6); lletra_b=216+(320*6); fletxa3=27+(320*6); lletra_c=225+(320*6); fletxa_final01=36+(320*6); lletra_d=234+(320*6); fletxa_final02=45+(320*6); lletra_e=243+(320*6); fletxa_final03=54+(320*6); lletra_f=252+(320*6); fletxa_final04=63+(320*6); lletra_g=261+(320*6); help_1=72+(320*6); lletra_h=270+(320*6); help_2=81+(320*6); lletra_i=279+(320*6); altaveu_on=90+(320*6); lletra_j=288+(320*6); altaveu_off=99+(320*6); lletra_k=297+(320*6); num_1=108+(320*6); lletra_l=306+(320*6); num_2=117+(320*6); lletra_m=0+(320*15); num_3=126+(320*6); lletra_n=9+(320*15); num_4=135+(320*6); lletra_o=18+(320*15); num_5=144+(320*6); lletra_p=27+(320*15); num_6=153+(320*6); lletra_q=36+(320*15); num_7=162+(320*6); lletra_r=45+(320*15); num_8=171+(320*6); lletra_s=54+(320*15); num_9=180+(320*6); lletra_t=63+(320*15); num_0=189+(320*6); lletra_u=72+(320*15); lletra_y=108+(320*15); lletra_v=81+(320*15); lletra_z=117+(320*15); lletra_w=90+(320*15); lletra_parentesis_o=126+(320*15); lletra_x=99+(320*15); lletra_parentesis_t=135+(320*15); lletra_dos_punts=171+(320*15); lletra_exclamacio_o=144+(320*15); lletra_exclamacio_t=180+(320*15); lletra_apostrof=153+(320*15); lletra_punt=189+(320*15); lletra_guio=162+(320*15); lletra_espai=198+(320*15); type pos_pant = ARRAY [1..38,1..29] of byte; var Virscr : Ptr_pantalla; VirScr2 : Ptr_pantalla; VirScrSP : Ptr_pantalla; Vaddr : word; Vaddr2 : word; VaddrSP : word; blocs_per_pintar : word; total_blocs_per_pintar : word; h, m, s, c, temps, hora: word; temps_final : word; tecla_amunt_dib, tecla_avall_dib, tecla_dreta_dib, tecla_esquerra_dib : word; x,y : byte; i,j : byte; pintura : byte; que_hi_ha : byte; el_que_hi_havia : byte; velocitat_joc : byte; dificultat : byte; antiga_direccio : byte; valor_del_bloc : byte; cap_on_va_Pepe : byte; vides : byte; num_fase : byte; mode_rosita, mode_amic, mode_easy, mode_normal, mode_hard : byte; mode_easy_r, mode_normal_r, mode_hard_r, mode_Dream_tour : byte; color_pintura, color_marcador_pintura : byte; R, G, B : byte; volumen : byte; tecla_amunt, tecla_avall, tecla_esquerra, tecla_dreta : byte; contador_de_menus : byte; retard_pepe : byte; velocitat_pepe : byte; rosita_selected, no_queden_vides : boolean; naiximent : boolean; map : boolean; menejant : boolean; time_attack_mode : boolean; story_mode_mode : boolean; amic_selected : boolean; fletxa_final_fase : boolean; malos_quets : boolean; amb_so : boolean; donar_vida : boolean; mode_nocturne : boolean; fin_historia : boolean; eixir_del_joc : boolean; en_casa : boolean; final_fase : boolean; GM : boolean; midi : boolean; sense_rellontge : boolean; pantalla : pos_pant; path : ARRAY[1..20] of byte; nom,nom2 : ARRAY[1..20] of string; paleta : tpaleta; frase : string; numero_G : ARRAY [0..90] of word; puntuacio : ARRAY [1..5] of longint; minuts,segons_tabla : ARRAY [1..5] of byte; numero : ARRAY [0..9] of word; punts : longint; contador : longint; estreles : ARRAY[1..10] of RECORD velocitat : byte; x,y : word; end; sample : array[0..6] of WaveData; Puerto, DMA, IRQ : byte; BPort : String[10]; rellontge : RECORD i,j : byte; viu : boolean; temps : byte; END; malo : ARRAY [1..max_malos] of RECORD i,j : byte; sentit : byte; viu : boolean; dibuix : word; END; {──────────────────────────────────────────────────────────────────────────} procedure power_off(where:word); var i : word; j : byte; begin fadedown(0,0,0,0); cls32(0,where); volcar32(where,$A000); set_color(1,63,63,63); for i:=0 to 319 do putpixel(i,100,1,where); for i:=0 to 160 do begin putpixel(i,100,0,where); putpixel(320-i,100,0,where); if i mod 2 = 0 then volcar32(where,$A000); end; for j:=0 to 20 do espera_VGA; end; {──────────────────────────────────────────────────────────────────────────} procedure arxius_wav(carrega:boolean); begin if carrega then begin LoadWAV(sample[so_ring],sring); LoadWAV(sample[so_pot],spot); LoadWAV(sample[so_mort],smort); LoadWAV(sample[so_malo],smalo); LoadWAV(sample[so_fletxa],sfletxa); LoadWAV(sample[so_enter],senter); LoadWAV(sample[so_bomba],sbomba); end else begin UnLoadWav(sample[so_ring]); UnLoadWav(sample[so_pot]); UnLoadWav(sample[so_mort]); UnLoadWav(sample[so_malo]); UnLoadWav(sample[so_fletxa]); UnLoadWav(sample[so_enter]); UnLoadWav(sample[so_bomba]); end; end; {──────────────────────────────────────────────────────────────────────────} procedure Play_Wav(nom:Wavedata); begin if amb_so then PlayWav(nom); end; {──────────────────────────────────────────────────────────────────────────} procedure load_mif(num:integer; where:word); const tamany_dibuix = 64768; var fich : file of byte; num_dibuixos : byte; temp : byte; i : byte; j : word; paleta : tpaleta; pos : longint; begin espera_VGA; cls32(0,VGA); Assign(fich,'datos\graf.mif'); Reset(fich); Read(fich,num_dibuixos); pos:=1+(8*num_dibuixos)+((num-1)*tamany_dibuix); Seek(fich,pos); For j:=0 to 63999 do Read(fich,mem[where:j]); For i:=0 to 255 do begin Read(Fich,Paleta[i].red); Read(Fich,Paleta[i].green); Read(Fich,Paleta[i].blue); end; setpaleta(paleta); Close(fich); end; {──────────────────────────────────────────────────────────────────────────} procedure save_cfg; var aux1, aux2 : byte; fich : text; frase1,frase2,frase3,frase4 : string; begin frase1:='PC SPEAKER: OFF=0, ON=1'; frase2:='VOLUMEN MIDI(0-10): OFF=0, MAX=10'; frase3:='SYNTHESIZER: General Midi=1, FM Synthesizer=0'; frase4:='GAME KEYS:'; if GM then aux2:=1 else aux2:=0; if amb_so then aux1:=1 else aux1:=0; Assign(fich,'pepe.ini'); Rewrite(fich); begin writeln(fich,frase1); writeln(fich,aux1); writeln(fich,frase2); writeln(fich,volumen); writeln(fich,frase3); writeln(fich,aux2); writeln(fich,frase4); writeln(fich,tecla_amunt); writeln(fich,tecla_amunt_dib); writeln(fich,tecla_avall); writeln(fich,tecla_avall_dib); writeln(fich,tecla_dreta); writeln(fich,tecla_dreta_dib); writeln(fich,tecla_esquerra); writeln(fich,tecla_esquerra_dib); end; Close(fich); end; {──────────────────────────────────────────────────────────────────────────} procedure load_cfg; var aux1, aux2 : byte; fich : text; S: PathStr; begin S := FSearch('pepe.ini',''); if not(S = '') then begin Assign(fich,'pepe.ini'); Reset(fich); readln(fich); readln(fich,aux1); readln(fich); readln(fich,volumen); readln(fich); readln(fich,aux2); readln(fich); readln(fich,tecla_amunt); readln(fich,tecla_amunt_dib); readln(fich,tecla_avall); readln(fich,tecla_avall_dib); readln(fich,tecla_dreta); readln(fich,tecla_dreta_dib); readln(fich,tecla_esquerra); readln(fich,tecla_esquerra_dib); Close(fich); end else begin aux1:=1; aux2:=2; volumen:=0; amb_so:=false; GM := true; tecla_amunt := 16; tecla_amunt_dib := 14157; tecla_avall := 30; tecla_avall_dib := 4485; tecla_dreta := 25; tecla_dreta_dib := 14133; tecla_esquerra := 24; tecla_esquerra_dib := 14109; save_cfg; end; { revisa posibles errors } if aux1>1 then aux1:=1; if aux2>1 then aux2:=1; if volumen>10 then volumen:=5; if aux1=0 then amb_so := false else amb_so := true; if aux2=0 then GM := false else GM := true; { so bloquejat } amb_so:=false; end; {──────────────────────────────────────────────────────────────────────────} procedure ini_midi(midi_titol:string); var aux : boolean; intents : word; begin intents := 0; if volumen>0 then begin if midi then begin StopMIDI; unloadmidi; midi:=false; end; if GM then begin aux:=setGM; end else begin aux:=setFM; end; if aux then begin repeat until (loadMIDI(midi_titol)); SetVol(25*volumen); midi := true; end else begin volumen := 0; midi := false; end; save_cfg; end; end; {──────────────────────────────────────────────────────────────────────────} procedure load_records; var x:byte; fich : text; fichbyte : file of byte; begin Assign(fich,'datos\story.dat'); Reset(fich); x:=1; while x<6 do begin readln(fich,nom[x]); readln(fich,puntuacio[x]); inc(x); end; Close(fich); Assign(fich,'datos\time.dat'); Reset(fich); x:=1; while x<6 do begin readln(fich,nom2[x]); readln(fich,minuts[x]); readln(fich,segons_tabla[x]); inc(x); end; Close(fich); Assign(fichbyte,'datos\comp.dat'); Reset(fichbyte); seek(fichbyte,filesize(fichbyte)-9); begin read(fichbyte,mode_rosita); read(fichbyte,mode_amic); read(fichbyte,mode_easy); read(fichbyte,mode_normal); read(fichbyte,mode_hard); read(fichbyte,mode_easy_r); read(fichbyte,mode_normal_r); read(fichbyte,mode_hard_r); read(fichbyte,mode_Dream_tour); end; Close(fichbyte); end; {──────────────────────────────────────────────────────────────────────────} procedure save_records; var x:word; fich : text; fichbyte : file of byte; begin Assign(fich,'datos\story.dat'); Rewrite(fich); x:=1; while x<6 do begin writeln(fich,nom[x]); writeln(fich,puntuacio[x]); inc(x); end; Close(fich); Assign(fich,'datos\time.dat'); Rewrite(fich); x:=1; while x<6 do begin writeln(fich,nom2[x]); writeln(fich,minuts[x]); writeln(fich,segons_tabla[x]); inc(x); end; Close(fich); Assign(fichbyte,'datos\comp.dat'); Reset(fichbyte); seek(fichbyte,filesize(fichbyte)-9); begin write(fichbyte,mode_rosita); write(fichbyte,mode_amic); write(fichbyte,mode_easy); write(fichbyte,mode_normal); write(fichbyte,mode_hard); write(fichbyte,mode_easy_r); write(fichbyte,mode_normal_r); write(fichbyte,mode_hard_r); write(fichbyte,mode_Dream_Tour); end; Close(fichbyte); end; {──────────────────────────────────────────────────────────────────────────} procedure pinta(offset:word; color:byte; x,y:word; where:word); var i,j : byte; begin inc(x); inc(y); for i:=0 to 5 do for j:=0 to 5 do if color<>255 then mem[where:(x+i)+((y+j)*320)]:=color else if mem[vaddrSP:offset+i+(j*320)]<>255 then mem[where:(x+i)+((y+j)*320)]:=mem[vaddrSP:offset+i+(j*320)]; end; {──────────────────────────────────────────────────────────────────────────} procedure pinta_zoom(zoom:byte; offset:word; color:byte; x,y:word; where:word); var i,j : byte; begin inc(x); inc(y); for i:=0 to 5 do for j:=0 to 5 do if color<>255 then mem[where:(x+i)+((y+j)*320)]:=color else if mem[vaddrSP:offset+i+(j*320)]<>255 then mem[where:(x+i)+((y+j)*320)]:=mem[vaddrSP:offset+i+(j*320)]; end; {──────────────────────────────────────────────────────────────────────────} procedure pinta_number(offset:word; color:byte; x,y:word; where:word); var i,j : byte; begin inc(x); inc(y); for i:=0 to 8 do for j:=0 to 8 do if color<>255 then mem[where:(x+i)+((y+j)*320)]:=color else if mem[vaddrSP:offset+i+(j*320)]<>255 then mem[where:(x+i)+((y+j)*320)]:=mem[vaddrSP:offset+i+(j*320)]; end; {──────────────────────────────────────────────────────────────────────────} procedure pinta_number2(offset:word; color,color_determinat:byte; x,y:word; where:word); var i,j : byte; begin inc(x); inc(y); for i:=0 to 8 do for j:=0 to 8 do if color<>255 then mem[where:(x+i)+((y+j)*320)]:=color else if (mem[vaddrSP:offset+i+(j*320)]<>255) and (mem[vaddrSP:offset+i+(j*320)]<>254) then mem[where:(x+i)+((y+j)*320)]:=mem[vaddrSP:offset+i+(j*320)] else if (mem[vaddrSP:offset+i+(j*320)]=254) then mem[where:(x+i)+((y+j)*320)]:=color_determinat; end; {──────────────────────────────────────────────────────────────────────────} procedure pinta_number_zoom(zoom:byte; offset:word; color:byte; x,y:word; where:word); var i,j : integer; begin inc(x); inc(y); for i:=0 to ((9*zoom)-1) do for j:=0 to ((9*zoom)-1) do if color<>255 then mem[where:(x+i)+((y+j)*320)]:=color else if mem[vaddrSP:offset+(i div zoom)+((j div zoom)*320)]<>255 then mem[where:(x+i)+((y+j)*320)]:=mem[vaddrSP:offset+(i div zoom)+((j div zoom)*320)]; end; {──────────────────────────────────────────────────────────────────────────} procedure retard(centesimes:integer); var h,m,s,c : word; temps1, temps2 : longint; begin gettime(h,m,s,c); temps1:=c+(s*100)+(m*6000)+(h*360000); if centesimes>0 then repeat if (not(playing)) and (midi) then PlayMIDI; gettime(h,m,s,c); temps2:=c+(s*100)+(m*6000)+(h*360000); until (temps2-temps1>=centesimes) or (TeclaPuls(KeySPACE)); end; {──────────────────────────────────────────────────────────────────────────} procedure escriu_frase(nom:string;color_determinat:byte;x,y,where,velocitat:word;mode,mode2:byte); var aux : byte; quina_lletra : word; begin for aux:=1 to length(nom) do begin if (mode2=0) and (TeclaPuls(KeySPACE)) then break; if mode=0 then volcar32(VGA,where); case nom[aux] of 'A' : quina_lletra:=lletra_a; 'B' : quina_lletra:=lletra_b; 'C' : quina_lletra:=lletra_c; 'D' : quina_lletra:=lletra_d; 'E' : quina_lletra:=lletra_e; 'F' : quina_lletra:=lletra_f; 'G' : quina_lletra:=lletra_g; 'H' : quina_lletra:=lletra_h; 'I' : quina_lletra:=lletra_i; 'J' : quina_lletra:=lletra_j; 'K' : quina_lletra:=lletra_k; 'L' : quina_lletra:=lletra_l; 'M' : quina_lletra:=lletra_m; 'N' : quina_lletra:=lletra_n; 'O' : quina_lletra:=lletra_o; 'P' : quina_lletra:=lletra_p; 'Q' : quina_lletra:=lletra_q; 'R' : quina_lletra:=lletra_r; 'S' : quina_lletra:=lletra_s; 'T' : quina_lletra:=lletra_t; 'U' : quina_lletra:=lletra_u; 'V' : quina_lletra:=lletra_v; 'W' : quina_lletra:=lletra_w; 'X' : quina_lletra:=lletra_x; 'Y' : quina_lletra:=lletra_y; 'Z' : quina_lletra:=lletra_z; '0' : quina_lletra:=num_0; '1' : quina_lletra:=num_1; '2' : quina_lletra:=num_2; '3' : quina_lletra:=num_3; '4' : quina_lletra:=num_4; '5' : quina_lletra:=num_5; '6' : quina_lletra:=num_6; '7' : quina_lletra:=num_7; '8' : quina_lletra:=num_8; '9' : quina_lletra:=num_9; ' ' : quina_lletra:=lletra_espai; ':' : quina_lletra:=lletra_dos_punts; '(' : quina_lletra:=lletra_parentesis_o; ')' : quina_lletra:=lletra_parentesis_t; '' : quina_lletra:=lletra_exclamacio_o; '!' : quina_lletra:=lletra_exclamacio_t; '*' : quina_lletra:=lletra_apostrof; '.' : quina_lletra:=lletra_punt; '-' : quina_lletra:=lletra_guio; end; pinta_number2(quina_lletra,255,color_determinat,x+(aux*8),y,where); retard(velocitat); if mode=0 then begin espera_VGA; volcar32(where,VGA); end; end; end; {──────────────────────────────────────────────────────────────────────────} procedure borrar_frase(temps:integer;zona_mem1,zona_mem2:word); begin retard(temps); volcar32(zona_mem1,zona_mem2); espera_VGA; volcar32(zona_mem2,VGA); end; {──────────────────────────────────────────────────────────────────────────} procedure borrat_de_pantalla(where:word); var i,j : word; begin for i:=0 to 31 do begin for j:=0 to 199 do begin putpixel(i,j,0,where); putpixel(i+32,j,0,where); putpixel(i+288,j,0,where); putpixel(i+64,j,0,where); putpixel(i+96,j,0,where); putpixel(i+128,j,0,where); putpixel(i+160,j,0,where); putpixel(i+192,j,0,where); putpixel(i+224,j,0,where); putpixel(i+256,j,0,where); end; espera_vga; volcar32(where,vga); end; end; {──────────────────────────────────────────────────────────────────────────} procedure intro_nom(var nom:string;color:word); var lletra : byte; x,y : word; aux : byte; quina_lletra : byte; begin volcar32(VGA,vaddr); lletra:=1; nom:=''; x:=210; y:=45; escriu_frase('ENHORABONA',color,110,10,vaddr,0,0,1); escriu_frase('HAS ACONSEGUIT',color,92,20,vaddr,0,0,1); escriu_frase('UN NOU RECORD',color,97,30,vaddr,0,0,1); escriu_frase('INTRODUEIX EL TEU NOM:',color,35,45,vaddr,0,0,1); repeat if QteclaPuls then begin aux:=agarrartecla; repeat until not(QteclaPuls); inc(lletra); case aux of KeyA : quina_lletra:=ord('A'); KeyB : quina_lletra:=ord('B'); KeyC : quina_lletra:=ord('C'); KeyD : quina_lletra:=ord('D'); KeyE : quina_lletra:=ord('E'); KeyF : quina_lletra:=ord('F'); KeyG : quina_lletra:=ord('G'); KeyH : quina_lletra:=ord('H'); KeyI : quina_lletra:=ord('I'); KeyJ : quina_lletra:=ord('J'); KeyK : quina_lletra:=ord('K'); KeyL : quina_lletra:=ord('L'); KeyM : quina_lletra:=ord('M'); KeyN : quina_lletra:=ord('N'); KeyO : quina_lletra:=ord('O'); KeyP : quina_lletra:=ord('P'); KeyQ : quina_lletra:=ord('Q'); KeyR : quina_lletra:=ord('R'); KeyS : quina_lletra:=ord('S'); KeyT : quina_lletra:=ord('T'); KeyU : quina_lletra:=ord('U'); KeyV : quina_lletra:=ord('V'); KeyW : quina_lletra:=ord('W'); KeyX : quina_lletra:=ord('X'); KeyY : quina_lletra:=ord('Y'); KeyZ : quina_lletra:=ord('Z'); KeySPACE : quina_lletra:=ord(' '); KeyENTER : begin lletra:=9; quina_lletra:=ord(' '); end; end; escriu_frase(chr(quina_lletra),color,x,y,vaddr,0,0,0); x:=x+8; nom:=nom+chr(quina_lletra); end; until (lletra=9); cls32(color,vaddr2); espera_VGA; volcar32(vaddr2,VGA); espera_VGA; volcar32(vaddr,VGA); retard(50); end; {──────────────────────────────────────────────────────────────────────────} procedure escriu_records(segons:byte); var x:byte; num1,num2,num3,num4,num5,num6,num7 : byte; i,j : word; temps,temps2:word; begin load_mif(records,vaddr2); volcar32(vaddr2,vaddr); espera_VGA; volcar32(vaddr2,VGA); { story mode } if (story_mode_mode) or ((not(story_mode_mode)) and (not(time_attack_mode))) then begin escriu_frase('- WORLD TOUR SCORE -',1,42,30,vaddr,0,0,1); i:=150; for x:=1 to 5 do begin j:=x*20+50; escriu_frase(nom[x],2,60,x*20+50,vaddr,0,0,1); num1:=puntuacio[x] div 1000000; num2:=(puntuacio[x] mod 1000000) div 100000; num3:=((puntuacio[x] mod 1000000) mod 100000) div 10000; num4:=(((puntuacio[x] mod 1000000) mod 100000) mod 10000) div 1000; num5:=((((puntuacio[x] mod 1000000) mod 100000) mod 10000) mod 1000) div 100; num6:=(((((puntuacio[x] mod 1000000) mod 100000) mod 10000) mod 1000) mod 100) div 10; num7:=(((((puntuacio[x] mod 1000000) mod 100000) mod 10000) mod 100) mod 10); if num1<>0 then pinta_number(numero_G[num1],255,i,j,vaddr); if (num2<>0) or (num1<>0) then pinta_number(numero_G[num2],255,i+6,j,vaddr); if (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num3],255,i+12,j,vaddr); if (num4<>0) or (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num4],255,i+18,j,vaddr); if (num5<>0) or (num4<>0) or (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num5],255,i+24,j,vaddr); if (num6<>0) or (num5<>0) or (num4<>0) or (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num6],255,i+30,j,vaddr); if (num7<>0) or (num6<>0) or (num5<>0) or (num4<>0) or (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num7],255,i+36,j,vaddr); espera_VGA; volcar32(vaddr,VGA); end; espera_VGA; volcar32(vaddr,VGA); gettime(h,m,s,c); temps:=h*3600+m*60+s; repeat gettime(h,m,s,c); temps2:=h*3600+m*60+s; until ((temps2-temps)>=segons) or (QteclaPuls); end; { time attack } if (time_attack_mode) or ((not(story_mode_mode)) and (not(time_attack_mode))) then begin volcar32(vaddr2,vaddr); espera_VGA; volcar32(vaddr2,VGA); escriu_frase('- TIME ATTACK BEST TIMES -',1,20,30,vaddr,0,0,1); i:=150; for x:=1 to 5 do begin j:=x*20+50; escriu_frase(nom2[x],2,60,x*20+50,vaddr,0,0,1); pinta_number(numero_G[minuts[x]],255,i,j,vaddr); pinta_number(num_11,255,i+6,j,vaddr); pinta_number(numero_G[segons_tabla[x] div 10],255,i+12,j,vaddr); pinta_number(numero_G[segons_tabla[x] mod 10],255,i+18,j,vaddr); espera_VGA; volcar32(vaddr,VGA); end; espera_VGA; volcar32(vaddr,VGA); gettime(h,m,s,c); temps:=h*3600+m*60+s; repeat gettime(h,m,s,c); temps2:=h*3600+m*60+s; until ((temps2-temps)>=segons) or (QteclaPuls); end; borrat_de_pantalla(vaddr); end; {──────────────────────────────────────────────────────────────────────────} procedure gestio_records(color:word); var trobat: boolean; cont,i:byte; minuts_prov,segons_prov:word; begin { world tour } if story_mode_mode then begin trobat:=false; cont:=1; while (not(trobat)) and (cont<6) do begin if (puntuacio[cont]minuts_prov) then {if (segons_tabla[cont]>=segons_prov) and (not(trobat)) then }trobat:=true; if (minuts[cont]=minuts_prov) then if (segons_tabla[cont]>=segons_prov) and (not(trobat)) then trobat:=true; if trobat then begin for i:=5 downto cont do begin nom2[i]:=nom2[i-1]; minuts[i]:=minuts[i-1]; segons_tabla[i]:=segons_tabla[i-1]; end; intro_nom(nom2[cont],color); minuts[cont]:=minuts_prov; segons_tabla[cont]:=segons_prov; end; inc(cont); end; end; save_records; end; {──────────────────────────────────────────────────────────────────────────} procedure text_rosita; begin load_mif(pepe01,vaddr); cls32(0,vaddr); escriu_frase('FELICITATS!',64,10,90,vaddr,0,0,0); escriu_frase('HAS SUPERAT TOTS ELS NIVELLS',64,10,110,vaddr,0,0,0); escriu_frase('DE DIFICULTAT AMB PEPE.',64,10,120,vaddr,0,0,0); escriu_frase('ARA JA POTS JUGAR AMB ROSITA.',64,10,130,vaddr,0,0,0); escriu_frase('A ROSITA NO SE LI ACABA LA PINTURA.',64,10,150,vaddr,0,0,0); retard(1000); borrat_de_pantalla(vaddr); end; {──────────────────────────────────────────────────────────────────────────} procedure text_amic; begin load_mif(pepe01,vaddr); cls32(0,vaddr); escriu_frase('FELICITATS!',64,10,90,vaddr,0,0,0); escriu_frase('HAS SUPERAT TOTS ELS NIVELLS',64,10,110,vaddr,0,0,0); escriu_frase('DE DIFICULTAT AMB ROSITA.',64,10,120,vaddr,0,0,0); escriu_frase('ARA JA POTS JUGAR AMB JOB.',64,10,130,vaddr,0,0,0); escriu_frase('JOB GUANYA EL DOBLE DE PUNTS.',64,10,150,vaddr,0,0,0); escriu_frase('A PER EL RECORD !!',64,10,170,vaddr,0,0,0); retard(1000); borrat_de_pantalla(vaddr); end; {──────────────────────────────────────────────────────────────────────────} procedure so_de(quin_so:byte); var a,b : word; begin case quin_so of naiximent_del_malo : begin for a:=0 to 5 do for b:=0 to 40 do begin delay(1);sound(b*200);end; nosound; end; mos_a_pepe : begin a:=10000; while a>1000 do begin sound(a);delay(1);a:=a-250;end; nosound; end; pot_ple : begin sound(5000);delay(velocitat_joc*10);nosound; end; pot_buit : begin sound(1000);delay(velocitat_joc*10);nosound; end; vida_extra : begin for a:=0 to 5 do for b:=40 to 80 do begin delay(1); sound(b*50); end; nosound; end; end; end; {──────────────────────────────────────────────────────────────────────────} procedure pepe_text; begin load_mif(classic,vaddr); espera_vga; volcar32(vaddr,VGA); retard(400); fadedown(0,0,0,1); setmode(3); pepe_clasic; setmode($13); end; {──────────────────────────────────────────────────────────────────────────} procedure final_fals; var temps,temps2 : word; VirScr3 : Ptr_pantalla; Vaddr3 : word; begin setupvirtual(virscr3,vaddr3); cls32(0,vaddr); load_mif(finalf1,vaddr2); load_mif(finalf2,vaddr3); getpaleta(paleta); ini_midi(musica_final_fals); if midi then Playmidi; for i:=1 to 3 do begin espera_VGA; volcar32(vaddr,VGA); Gettime(h,m,s,c); temps:=h*3600+m*60+s; Repeat if not(playing) then begin ini_midi(musica_final_fals); if midi then Playmidi; end; Gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (QteclaPuls) or ((temps2-temps)>=5); espera_VGA; volcar32(vaddr3,VGA); setpaleta(paleta); Play_WAV (sample[so_bomba]); if i<3 then fadedown(0,0,0,0); end; PutSprite(vaddr2,vaddr,8683,234,151,43,27); espera_VGA; volcar32(vaddr,VGA); setpaleta(paleta); for i:=1 to 2 do begin espera_VGA; volcar32(vaddr,VGA); Gettime(h,m,s,c); temps:=h*3600+m*60+s; Repeat if not(playing) then begin ini_midi(musica_final_fals); if midi then Playmidi; end; Gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (QteclaPuls) or ((temps2-temps)>=5); espera_VGA; volcar32(vaddr3,VGA); Play_WAV (sample[so_bomba]); Gettime(h,m,s,c); temps:=h*3600+m*60+s; Repeat if not(playing) then begin ini_midi(musica_final_fals); if midi then Playmidi; end; Gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (QteclaPuls) or ((temps2-temps)>=1); end; PutSprite(vaddr2,vaddr,400,138,26,170,148); PutSprite(vaddr2,vaddr3,400,138,26,170,148); i:=0; repeat inc(i); espera_VGA; volcar32(vaddr,VGA); Gettime(h,m,s,c); temps:=h*3600+m*60+s; Repeat if not(playing) then begin ini_midi(musica_final_fals); if midi then Playmidi; end; Gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (QteclaPuls) or ((temps2-temps)>=5); espera_VGA; volcar32(vaddr3,VGA); Play_WAV (sample[so_bomba]); Gettime(h,m,s,c); temps:=h*3600+m*60+s; Repeat if not(playing) then begin ini_midi(musica_final_fals); if midi then Playmidi; end; Gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (QteclaPuls) or ((temps2-temps)>=2); Until (Qteclapuls) or (i=3); fadedown(0,0,0,0); if midi then begin StopMIDI; unloadmidi; midi:=false; end; Tancarvirtual(virscr3); end; {──────────────────────────────────────────────────────────────────────────} procedure intro_logo; var paleta_blanca : tpaleta; i, aux : byte; temps,temps2 : word; begin load_mif(logo,vaddr); getpaleta(paleta); for i:=1 to 255 do set_color(i,63,63,63); getpaleta(paleta_blanca); setpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); ini_midi(musica_logo); if midi then Playmidi; fadeup(paleta,1); Gettime(h,m,s,c); temps:=h*3600+m*60+s; Repeat Gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (QteclaPuls) or ((temps2-temps)>=6); fadeup(paleta_blanca,1); fadedown(0,0,0,0); if midi then begin StopMIDI; unloadmidi; midi:=false; end; end; {──────────────────────────────────────────────────────────────────────────} procedure titol_del_joc; var salta_intro : boolean; i : word; j : byte; R,G,B : byte; temps, temps2 : word; begin salta_intro := false; gettime(h,m,s,c); if (h>=22) or (h<=8) then begin load_mif(intro_n,vaddr); load_mif(intro_n2,vaddr2); mode_nocturne:=true; end else begin load_mif(titol,vaddr2); mode_nocturne:=false; espera_VGA; volcar32(vaddr2,VGA); Gettime(h,m,s,c); temps:=(h*3600)+(m*60)+s; Repeat Gettime(h,m,s,c); temps2:=(h*3600)+(m*60)+s; until (QteclaPuls) or ((temps2-temps)>=6); end; if mode_nocturne then begin if not(midi) then ini_midi(musica_nit); if (not(playing)) and (midi) then Playmidi; i:=0; repeat if (not(playing)) and (midi) then PlayMIDI; j:=0; while (j<100) do begin espera_VGA; inc(j); end; espera_VGA; volcar32(vaddr2,VGA); j:=0; while (j<100) do begin espera_VGA; inc(j); end; espera_VGA; volcar32(vaddr,VGA); inc(i); until (i>10) or (QteclaPuls); if QteclaPuls then salta_intro:=true; end else ; if TeclaPuls(KeySPACE) then salta_intro:=true; fadedown(0,0,0,0); end; {──────────────────────────────────────────────────────────────────────────} procedure historia; begin if mode_nocturne then begin cls32(0,VGA); load_mif(in_nit,vaddr); getpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); if (not(playing)) and (midi) then Playmidi; fadeup(paleta,0); retard(300); fadedown(0,0,0,0); end else begin fin_historia:=false; cls32(0,VGA); load_mif(hist01,vaddr); getpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); ini_midi(musica_historia); if midi then Playmidi; fadeup(paleta,0); escriu_frase('QUE BON DIA FA NO CREUS PEPE',2,40,90,vaddr2,10,0,0); borrar_frase(150,vaddr,vaddr2); escriu_frase('EEEE..SS..SSIII.SI',10,50,80,vaddr2,10,0,0); borrar_frase(150,vaddr,vaddr2); escriu_frase('(SEMPRE QUE M*ACOSTE',2,140,140,vaddr2,10,0,0); escriu_frase('A PEPE ES POSA RARO)',2,140,150,vaddr2,10,0,0); borrar_frase(150,vaddr,vaddr2); retard(200); if QTeclaPuls then fin_historia:=true; fadedown(0,0,0,0); if not(fin_historia) then begin load_mif(hist02,vaddr); getpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); fadeup(paleta,0); escriu_frase('AAAAY !',10,100,140,vaddr2,0,0,0); borrar_frase(150,vaddr,vaddr2); escriu_frase('JA T*HE PILLAT PEPE',3,100,55,vaddr2,10,0,0); borrar_frase(150,vaddr,vaddr2); escriu_frase('AUXILI!',2,145,125,vaddr2,0,0,0); borrar_frase(150,vaddr,vaddr2); retard(200); end; if QTeclaPuls then fin_historia:=true; fadedown(0,0,0,0); if not(fin_historia) then begin load_mif(hist03,vaddr); getpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); fadeup(paleta,0); escriu_frase('ARA ROSITA ES MEUA',5,50,80,vaddr2,10,0,0); borrar_frase(150,vaddr,vaddr2); escriu_frase('SI VOLS ACONSEGUIR-LA',5,50,80,vaddr2,10,0,0); escriu_frase('HAURAS DE SEGUIR-ME',5,50,90,vaddr2,10,0,0); escriu_frase('PER TOT EL MON.',5,50,100,vaddr2,10,0,0); borrar_frase(150,vaddr,vaddr2); escriu_frase('JA JA JA JA JA !!',5,60,80,vaddr2,0,0,0); borrar_frase(150,vaddr,vaddr2); retard(200); end; if QTeclaPuls then fin_historia:=true; fadedown(0,0,0,0); if not(fin_historia) then begin load_mif(hist04,vaddr); getpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); fadeup(paleta,0); escriu_frase('AJUDA*M PEPE!',2,120,60,vaddr2,5,0,0); borrar_frase(150,vaddr,vaddr2); escriu_frase('MALEIT SIGUES',7,50,50,vaddr2,60,0,0); escriu_frase('ET TROBARE...',7,50,60,vaddr2,40,0,0); retard(200); end; fadedown(0,0,0,0); end; end; {──────────────────────────────────────────────────────────────────────────} procedure credits; var i_int:integer; velocitat:longint; num : byte; x,y,ample,alt,xo,yo:integer; temps, temps2 : word; offset : word; begin load_mif(creditsf,vaddr2); cls32(0,vaddr); Gettime(h,m,s,c); temps:=(h*3600)+(m*60)+s; repeat gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (Qteclapuls) or ((temps2-temps)>=3); for num:=1 to 5 do begin case num of 1 : begin x := 95; y := 18; ample := 124; alt := 31; end; 2 : begin x := 92; y := 48; ample := 134; alt := 67; end; 3 : begin x := 107; y := 115; ample := 98; alt := 24; end; 4 : begin x := 113; y := 138; ample := 86; alt := 13; end; 5 : begin x := 51; y := 151; ample := 213; alt := 30; end; end; i_int:=200; velocitat:=0; offset:=x+(y*320); while (i_int>80) do begin if (not(playing)) and (midi) then begin ini_midi(musica_final_joc); if midi then Playmidi; end; Put_Sprite_ICE_baix(vaddr2,vaddr,offset,ample,alt,x,i_int); espera_VGA; volcar32(vaddr,VGA); inc(velocitat); if velocitat mod 5=0 then dec(i_int,1); end; if num<5 then while (i_int>-alt) do begin if (not(playing)) and (midi) then begin ini_midi(musica_final_joc); if midi then Playmidi; end; Put_Sprite_ICE_dalt(vaddr2,vaddr,offset,ample,alt,x,i_int); espera_VGA; volcar32(vaddr,VGA); inc(velocitat); if velocitat mod 5=0 then dec(i_int,1); end; end; Gettime(h,m,s,c); temps:=(h*3600)+(m*60)+s; repeat gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (Qteclapuls) or ((temps2-temps)>=10); fadedown(0,0,0,3); if midi then begin StopMIDI; unloadmidi; midi:=false; end; end; {──────────────────────────────────────────────────────────────────────────} procedure historia_final; var temps,temps2 : integer; i,j : integer; procedure reixa(posx:word; long:byte; where:word); const posy = 30; begin line(posx, posy,posx, 197-long,0,where); line(posx+1,posy,posx+1,197-long,0,where); line(posx+2,posy,posx+2,198-long,0,where); line(posx+3,posy,posx+3,198-long,0,where); line(posx+4,posy,posx+4,199-long,0,where); line(posx+5,posy,posx+5,199-long,0,where); line(posx+6,posy,posx+6,198-long,0,where); line(posx+7,posy,posx+7,198-long,0,where); line(posx+8,posy,posx+8,197-long,0,where); line(posx+9,posy,posx+9,197-long,0,where); end; begin cls32(0,VGA); ini_midi(musica_final_joc); if midi then Playmidi; { dibuix 1 } if mode_nocturne then load_mif(finaln01,vaddr) else load_mif(final01,vaddr); getpaleta(paleta); blackout; volcar32(vaddr,vaddr2); if mode_nocturne then for i:=0 to 3 do reixa(100+(i*40),0,vaddr2); espera_VGA; volcar32(vaddr2,VGA); fadeup(paleta,0); if mode_nocturne then for j:=0 to 166 do begin volcar32(vaddr,vaddr2); for i:=0 to 3 do reixa(100+(i*40)+(j mod 2),j,vaddr2); espera_VGA; espera_VGA; volcar32(vaddr2,VGA); end; if mode_nocturne then retard(200) else retard(600); fadedown(0,0,0,0); { dibuix 2 } if mode_nocturne then load_mif(finaln02,vaddr) else load_mif(final02,vaddr); set_color(1,32,0,0); getpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); fadeup(paleta,0); if mode_nocturne then for i:=0 to 200 do begin j:=63-(ABS(32-(i mod 64))); set_color(1,j,0,0); espera_VGA;espera_VGA;espera_VGA;espera_VGA; end; if not(mode_nocturne) then retard(600); fadedown(0,0,0,0); { dibuix 3 } if mode_nocturne then load_mif(finaln03,vaddr) else load_mif(final03,vaddr); set_color(253,39, 0,48); set_color(254, 0,63, 6); set_color(255, 0, 3,63); getpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); fadeup(paleta,0); gettime(h,m,s,c); temps:=h*3600+m*60+s; repeat retard(10); espera_VGA; set_color(253,39, 0,48); set_color(254, 0,63, 6); set_color(255, 0, 3,63); retard(10); espera_VGA; set_color(253, 0, 3,63); set_color(254,39, 0,48); set_color(255, 0,63, 6); retard(10); espera_VGA; set_color(253, 0,63, 6); set_color(254, 0, 3,63); set_color(255,39, 0,48); gettime(h,m,s,c); temps2:=h*3600+m*60+s; until (Qteclapuls) or ((temps2-temps)>=10); fadedown(0,0,0,0); { dibuix 4 } if mode_nocturne then begin load_mif(finaln04,vaddr); getpaleta(paleta); blackout; espera_VGA; volcar32(vaddr,VGA); fadeup(paleta,0); retard(600); fadedown(0,0,0,0); end; credits; end; {──────────────────────────────────────────────────────────────────────────} procedure put_map(nom:pos_pant;color:byte; x,y: word;i,j: byte; desti:word); { nom : nom de la matriu; color: 255 = original o color; x,y = posició pantalla; i,j = tamany matriu; desti = VGA o vaddr)} var a,b:word; begin for a:=x+1 to x+i do for b:=y+1 to y+j do begin if color<>255 then putpixel(a,b,color,desti) else putpixel(a,b,nom[a-x,b-y],desti); end; end; {──────────────────────────────────────────────────────────────────────────} procedure pilla_temps; begin gettime(h,m,s,c); hora := (s)+(m*60)+(h*3600); end; {──────────────────────────────────────────────────────────────────────────} procedure posa_el_temps(where:word); var h1,m1,s1,c1,minuts,segons,i : word; begin gettime(h1,m1,s1,c1); {temps:=temps+(((h1-h)*24)+((m1-m)*60)+(s1-s));} {if (s1-s)>0 then temps:=temps+(100-c+c1) else temps:=temps+(c1-c);} temps := (s1)+(m1*60)+(h1*3600) - hora; minuts :=(temps) div 60; segons :=(temps) mod 60; i:= 255; pinta_number(num_0,180,i,82,where); pinta_number(num_0,180,i+12,82,where); pinta_number(num_0,180,i+18,82,where); pinta_number(num_11,255,i+6,82,where); pinta_number(numero_G[minuts],255,i,82,where); pinta_number(numero_G[segons div 10],255,i+12,82,where); pinta_number(numero_G[segons mod 10],255,i+18,82,where); end; {──────────────────────────────────────────────────────────────────────────} procedure resultat_time_attack; var i,minuts,segons : word; begin fadedown(0,0,0,1); load_mif(time_fin,vaddr2); volcar32(vaddr2,vaddr); ini_midi(musica_game_over); if midi then Playmidi; minuts:=(temps_final mod 3600) div 60; segons:=(temps_final mod 3600) mod 60; i:=180; pinta_number_zoom(4,numero_G[minuts],255,i,126,vaddr); pinta_number_zoom(4,num_11,255,i+6*4,126,vaddr); pinta_number_zoom(4,numero_G[segons div 10],255,i+12*4,126,vaddr); pinta_number_zoom(4,numero_G[segons mod 10],255,i+18*4,126,vaddr); espera_vga; volcar32(vaddr,VGA); retard(300); gestio_records(43); retard(100); escriu_records(10); borrat_de_pantalla(vaddr); save_records; if midi then begin StopMIDI; unloadmidi; midi:=false; end; end; {──────────────────────────────────────────────────────────────────────────} procedure missatge_game_over; var i,j : word; k : byte; num1,num2,num3,num4,num5,num6,num7 : byte; begin fadedown(0,0,0,2); load_mif(pepefins,vaddr); ini_midi(musica_game_over); if midi then Playmidi; if time_attack_mode then for i:=50 to 280 do for j:=130 to 190 do putpixel(i,j,239,vaddr); if story_mode_mode then begin volcar32(vaddr,vaddr2); for i:=50 to 280 do for j:=130 to 190 do putpixel(i,j,239,vaddr2); espera_VGA; volcar32(vaddr2,VGA); retard(200); end; if story_mode_mode then begin i:=125{135}; j:=170; num1:=punts div 1000000; num2:=(punts mod 1000000) div 100000; num3:=((punts mod 1000000) mod 100000) div 10000; num4:=(((punts mod 1000000) mod 100000) mod 10000) div 1000; num5:=((((punts mod 1000000) mod 100000) mod 10000) mod 1000) div 100; num6:=(((((punts mod 1000000) mod 100000) mod 10000) mod 1000) mod 100) div 10; num7:=(((((punts mod 1000000) mod 100000) mod 10000) mod 100) mod 10); if num1<>0 then pinta_number(numero_G[num1],255,i,j,vaddr); if (num2<>0) or (num1<>0) then pinta_number(numero_G[num2],255,i+6,j,vaddr); if (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num3],255,i+12,j,vaddr); if (num4<>0) or (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num4],255,i+18,j,vaddr); if (num5<>0) or (num4<>0) or (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num5],255,i+24,j,vaddr); if (num6<>0) or (num5<>0) or (num4<>0) or (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num6],255,i+30,j,vaddr); if (num7<>0) or (num6<>0) or (num5<>0) or (num4<>0) or (num3<>0) or (num2<>0) or (num1<>0) then pinta_number(numero_G[num7],255,i+36,j,vaddr); {pinta_number(numero_G[num1],255,i,j,vaddr); pinta_number(numero_G[num2],255,i+6,j,vaddr); pinta_number(numero_G[num3],255,i+12,j,vaddr); pinta_number(numero_G[num4],255,i+18,j,vaddr); pinta_number(numero_G[num5],255,i+24,j,vaddr); pinta_number(numero_G[num6],255,i+30,j,vaddr); pinta_number(numero_G[num7],255,i+36,j,vaddr);} end; espera_vga; volcar32(vaddr,VGA); retard(300); if story_mode_mode then gestio_records(144); fadedown(0,0,0,0); escriu_records(10); borrat_de_pantalla(vaddr); vides:=0; no_queden_vides:=true; save_records; if midi then begin StopMIDI; unloadmidi; midi:=false; end; end; {──────────────────────────────────────────────────────────────────────────} procedure comprobar_comp_i_sprites; const tamany_comp = 2415; tamany_sprites = 968792; var fich : file of byte; i : word; temp : longint; aux : byte; error : boolean; begin temp:=0; error:=false; assign(fich,'datos\comp.dat'); reset(fich); for i:=1 to filesize(fich)-9 do begin read(fich,aux); inc(temp,aux); end; if temp<>tamany_comp then error:=true; Close(fich); temp:=0; assign(fich,'datos\sprites.dat'); reset(fich); for i:=1 to filesize(fich) do begin read(fich,aux); inc(temp,aux); end; if temp<>tamany_sprites then error:=true; Close(fich); if error then begin setmode($3); Writeln('Algun fitxer ha estat modificat'); Writeln('No puc executar el programa...'); halt; end; end; {──────────────────────────────────────────────────────────────────────────} procedure ini_vars(num_fase:byte); {----------------------------------------------------} procedure carrega_pantalla(num:byte); var fich : file of byte; i,j,k : byte; temp : byte; begin if num = 0 then for i:=1 to 38 do for j:=1 to 29 do pantalla[i,j]:=0 else begin Assign(fich,'datos/comp.dat'); Reset(fich); for k:=1 to num do begin for i:=1 to 38 do begin for j:=1 to 29 do begin read(fich,temp); pantalla[i,j] := temp; end; end; end; Close(fich); end; end; {----------------------------------------------------} begin malos_quets := false; sense_rellontge:=true; velocitat_pepe := 5; x:=pos_ini_x_pepe; y:=pos_ini_y_pepe; fletxa_final_fase:=false; if num_fase=0 then vides:=0 else if num_fase=1 then vides:=vides_de_pepe else vides:=vides; pintura:=max_pintura; en_casa:=true; final_fase:=false; rellontge.viu := false; rellontge.temps := 0; temps := 0; carrega_pantalla(num_fase); case num_fase of 0 : total_blocs_per_pintar:=blocs_fase_0; 1 : total_blocs_per_pintar:=blocs_fase_1; 2 : total_blocs_per_pintar:=blocs_fase_2; 3 : total_blocs_per_pintar:=blocs_fase_3; 4 : total_blocs_per_pintar:=blocs_fase_4; 5 : total_blocs_per_pintar:=blocs_fase_5; 6 : total_blocs_per_pintar:=blocs_fase_6; 7 : total_blocs_per_pintar:=blocs_fase_7; 8 : total_blocs_per_pintar:=blocs_fase_8; 9 : total_blocs_per_pintar:=blocs_fase_9; 10 : total_blocs_per_pintar:=blocs_fase_10; end; blocs_per_pintar:=total_blocs_per_pintar; temps:=0; velocitat_joc:=1; no_queden_vides:=false; naiximent:=false; map:=false; { ini malos } if num_fase=ultima_fase then begin for i:=1 to max_malos do begin malo[i].viu:=false; end; malo[1].dibuix:=d_malo1; malo[2].dibuix:=d_malo2; malo[3].dibuix:=pepe_malo; end else begin for i:=1 to max_malos do begin malo[i].viu:=false; end; malo[1].dibuix:=d_malo1; malo[2].dibuix:=d_malo2; malo[3].dibuix:=d_malo3; end; end; {──────────────────────────────────────────────────────────────────────────} procedure ini_matrius; begin { fondos } path[1]:=pepe01; path[2]:=pepe02; path[3]:=pepe03; path[4]:=pepe04; path[5]:=pepe05; path[6]:=pepe06; path[7]:=pepe07; path[8]:=pepe08; path[9]:=pepe09; path[10]:=pepe10; path[11]:=pepe11; path[12]:=ult_fase; path[13]:=time; path[14]:=fons_nit; { matriu de numeros } numero[0]:=num0; numero[1]:=num1; numero[2]:=num2; numero[3]:=num3; numero[4]:=num4; numero[5]:=num5; numero[6]:=num6; numero[7]:=num7; numero[8]:=num8; numero[9]:=num9; numero_G[0]:=num_0; numero_G[1]:=num_1; numero_G[2]:=num_2; numero_G[3]:=num_3; numero_G[4]:=num_4; numero_G[5]:=num_5; numero_G[6]:=num_6; numero_G[7]:=num_7; numero_G[8]:=num_8; numero_G[9]:=num_9; numero_G[10]:=num_11; load_records; end; {──────────────────────────────────────────────────────────────────────────} procedure pinta_marcadors; var i,j : word; begin { pintura } for i:=pos_esq_m_p to pos_dreta_m_p do for j:= (pos_base_m_p-(max_pintura div tamany_m_p)) to pos_base_m_p do putpixel(i,j,color_marcador_pintura_fondo,vaddr); for i:=pos_esq_m_p to pos_dreta_m_p do for j:= (pos_base_m_p-(pintura div tamany_m_p)) to pos_base_m_p do putpixel(i,j,color_marcador_pintura,vaddr); if pintura=0 then for i:=pos_esq_m_p to pos_dreta_m_p do for j:= (pos_base_m_p-(pintura div tamany_m_p)) to pos_base_m_p do putpixel(i,(pos_base_m_p),color_marcador_pintura_fondo,vaddr); if num_fase>0 then begin { vides } pinta_number(numero_G[vides],255,268,169,vaddr); { punts } i:=265; j:=73; pinta_number(numero_G[punts],color_fondo_marcador_punts,i,j,vaddr); pinta_number(numero_G[punts],color_fondo_marcador_punts,i+6,j,vaddr); pinta_number(numero_G[punts],color_fondo_marcador_punts,i+12,j,vaddr); pinta_number(numero_G[punts],color_fondo_marcador_punts,i+18,j,vaddr); pinta_number(numero_G[punts],color_fondo_marcador_punts,i+24,j,vaddr); pinta_number(numero_G[punts],color_fondo_marcador_punts,i+30,j,vaddr); pinta_number(numero_G[punts],color_fondo_marcador_punts,i+36,j,vaddr); pinta_number(numero_G[punts div 1000000],255,i,j,vaddr); pinta_number(numero_G[(punts mod 1000000) div 100000],255,i+6,j,vaddr); pinta_number(numero_G[((punts mod 1000000) mod 100000) div 10000],255,i+12,j,vaddr); pinta_number(numero_G[(((punts mod 1000000) mod 100000) mod 10000) div 1000],255,i+18,j,vaddr); pinta_number(numero_G[((((punts mod 1000000) mod 100000) mod 10000) mod 1000) div 100],255,i+24,j,vaddr); pinta_number(numero_G[(((((punts mod 1000000) mod 100000) mod 10000) mod 1000) mod 100) div 10],255,i+30,j,vaddr); pinta_number(numero_G[(((((punts mod 1000000) mod 100000) mod 10000) mod 100) mod 10)],255,i+36,j,vaddr); { blocs } {pinta(numero[blocs_per_pintar],239,i,60,vaddr); pinta(numero[blocs_per_pintar],239,i+4,60,vaddr); pinta(numero[blocs_per_pintar],239,i+8,60,vaddr); pinta(numero[blocs_per_pintar],239,i+12,60,vaddr); pinta(numero[blocs_per_pintar div 1000],255,i,60,vaddr); pinta(numero[((blocs_per_pintar mod 1000) div 100)],255,i+4,60,vaddr); pinta(numero[(((blocs_per_pintar mod 1000) mod 100) div 10)],255,i+8,60,vaddr); pinta(numero[(((blocs_per_pintar mod 1000) mod 100) mod 10)],255,i+12,60,vaddr);} { altaveu } {if amb_so then begin pinta_number(altaveu_on,255,1,189,vaddr); end else begin pinta_number(altaveu_off,255,1,189,vaddr); end;} { mapa } end; end; {──────────────────────────────────────────────────────────────────────────} procedure ini_pantalla; var i,j : word; i_int:integer; offset : word; VirscrFase : Ptr_pantalla; VaddrFase : Word; begin getmem(virscrFase,6400); vaddrFase:=seg(virscrFase^); load_mif(fases,vaddr); Cls32(0,vaddrFase); offset:=((num_fase div 6)*160)+((((num_fase-1) mod 5)*40)*320); PutSprite(vaddr,vaddrFase,offset,160,40,0,0); if not(mode_nocturne) then begin if num_fase>0 then load_mif(path[random(max_fondos_story)+1],vaddr2) else load_mif(path[13],vaddr2); end else load_mif(path[14],vaddr2); if (num_fase=ultima_fase) and not(mode_nocturne) then load_mif(path[12],vaddr2); { pinta numero de fase } if (num_fase>0) and (num_fase<10) then pinta_number(numero_G[num_fase],255,1,1,vaddr2); { pinta les pareds } for i:=1 to 38 do for j:=1 to 29 do if pantalla[i,j]=es_una_paret then pinta(dib_pared,255,(i*6)+4,(j+1)*6,vaddr2) {put_matrix(pepe,color_pared,(i*6)+4,(j+1)*6,6,6,vaddr2)}; { pinta a Rosita i a la presó } if num_fase=ultima_fase then begin pinta(rosita,255,16,96,vaddr2); pinta(preso,255,22,96,vaddr2); for i:=97 to 102 do putpixel(16,i,237,vaddr2); putpixel(17,97,237,vaddr2); putpixel(22,97,237,vaddr2); putpixel(17,102,237,vaddr2); putpixel(22,102,237,vaddr2); end; { pinta el marcador de pintura } for i:=pos_esq_m_p to pos_dreta_m_p do for j:= (pos_base_m_p-(pintura div tamany_m_p)) to pos_base_m_p do begin putpixel(i,j,color_marcador_pintura,vaddr2); putpixel(pos_esq_m_p-1,j,color_borde_m_p,vaddr2); putpixel(pos_dreta_m_p+1,j,color_borde_m_p,vaddr2); putpixel(i,(pos_base_m_p-(max_pintura div tamany_m_p)-1),color_borde_m_p,vaddr2); putpixel(i,(pos_base_m_p+1),color_borde_m_p,vaddr2); end; { coloca la fase } getpaleta(paleta); blackout; cls32(0,vaddr); PutBloc(vaddr2,0,vaddr,249,200,0,0); volcar32(vaddr,VGA); fadeup(paleta,0); { posa el marcador } For j:=0 to 49 do begin i:=j shl 1; PutBloc(vaddr2,248+((99-i)*320),vaddr,72,i+1,248,0); PutBloc(vaddr2,32248,vaddr,72,i+1,248,199-i); PutBloc(vaddr2,0,vaddr,249,200,0,0); espera_VGA; volcar32(vaddr,VGA); end; { posa el lletrero de fase X } if story_mode_mode then for i_int:=-40 to 80 do begin volcar32(vaddr2,vaddr); if i_int<20 then Put_Sprite_ICE_esquerra(vaddrFase,vaddr,0,160,40,i_int shl 2,80) else Put_Sprite_ICE_dreta(vaddrFase,vaddr,0,160,40,i_int shl 2,80); if i_int=14 then delay(2000); espera_VGA; Volcar32(vaddr,VGA); end; Freemem(virscrFase,6400); end; {──────────────────────────────────────────────────────────────────────────} procedure level_complete; var i,temps,temps2 : word; begin if midi then begin StopMIDI; unloadmidi; midi:=false; end; if not(mode_nocturne) then begin load_mif(done01,vaddr); espera_vga; volcar32(vaddr,VGA); ini_midi(musica_canvi_fase); if midi then Playmidi; Gettime(h,m,s,c); temps:=h*3600+m*60+s; Repeat Gettime(h,m,s,c); temps2:=h*3600+m*60+s; until {(QteclaPuls) or} ((temps2-temps)>=4); borrat_de_pantalla(vaddr); end else begin load_mif(done05,vaddr); espera_vga; volcar32(vaddr,VGA); ini_midi(musica_canvi_fase_n); if midi then Playmidi; if midi then repeat until not(playing) else for i:=0 to 300 do espera_VGA; borrat_de_pantalla(vaddr); if midi then begin StopMIDI; unloadmidi; midi:=false; end; end; end; {──────────────────────────────────────────────────────────────────────────} procedure volcat_de_pantalla; begin volcar32(vaddr,vaddr2); { inicialització i comprobació de la fletxa de GO! } fletxa_final_fase := true; for i:=1 to 38 do for j:=1 to 29 do if (pantalla[i,j]=es_un_bloc_per_pintar) then fletxa_final_fase:=false; { pinta el rellontge } if rellontge.viu then case (c mod 50) of 0..12 : pinta(rellontge_dib,255,rellontge.i,rellontge.j,vaddr2); 13..25 : pinta(rellontge_dib_X,255,rellontge.i,rellontge.j,vaddr2); 26..37 : pinta(rellontge_dib,255,rellontge.i,rellontge.j,vaddr2); 38..49 : pinta(rellontge_dib_Y,255,rellontge.i,rellontge.j,vaddr2); end; if (x=pos_ini_x_pepe) and (y=pos_ini_y_pepe) then en_casa:=true; { pinta a PEPE, ROSITA o JOB } if (mode_nocturne) and (not(rosita_selected)) and (not(amic_selected)) then pinta(gorro,255,x,y-6,vaddr2); if pintura>0 then if rosita_selected then pinta(rosita_p,255,x,y,vaddr2) else if amic_selected then pinta(amic,255,x,y,vaddr2) else if mode_nocturne then pinta(pepe_gorro,255,x,y,vaddr2) else pinta(pepe,255,x,y,vaddr2) else if amic_selected then pinta(amic_b,255,x,y,vaddr2) else if mode_nocturne then pinta(pepe_gorro,255,x,y,vaddr2) else pinta(pepe_b,255,x,y,vaddr2); if not(en_casa) then pinta(dib_pot,255,238,96,vaddr2) else begin pinta(dib_pot,255,238,96,vaddr2); if rosita_selected then pinta(rosita_p,255,x,y,vaddr2) else if amic_selected then pinta(amic,255,x,y,vaddr2) else if mode_nocturne then pinta(pepe_gorro,255,x,y,vaddr2) else pinta(pepe,255,x,y,vaddr2); end; { pinta a rosita en la pressó } if num_fase=ultima_fase then begin if (s mod 4)=0 then pinta(rosita,255,16,96,vaddr2) else if (s mod 4)=1 then pinta(rosita2,255,16,96,vaddr2) else if (s mod 4)=2 then pinta(rosita,255,16,96,vaddr2) else pinta(rosita3,255,16,96,vaddr2); if ((s mod 10)=0) or ((s mod 10)=1) then begin pinta(rosita_chillido,255,16,96,vaddr2); pinta_number(help_1,255,12,87,vaddr2); pinta_number(help_2,255,21,87,vaddr2); end; end; { pinta el mapa } if map then put_map(pantalla,255,270,1,38,29,vaddr2); { pinta l'altaveu } if amb_so then pinta_number(altaveu_on,255,2,188,vaddr2) else pinta_number(altaveu_off,255,2,188,vaddr2); { pinta la fletxa de GO! } if fletxa_final_fase then if (c mod 99 < 50) then begin pinta_number(fletxa_final01,255,250,90,vaddr2); pinta_number(fletxa_final02,255,259,90,vaddr2); pinta_number(fletxa_final03,255,250,99,vaddr2); pinta_number(fletxa_final04,255,259,99,vaddr2); end else begin pinta_number(fletxa_final01,255,248,90,vaddr2); pinta_number(fletxa_final02,255,257,90,vaddr2); pinta_number(fletxa_final03,255,248,99,vaddr2); pinta_number(fletxa_final04,255,257,99,vaddr2); end; espera_vga; volcar32(vaddr2,VGA); end; {──────────────────────────────────────────────────────────────────────────} procedure omplir_pot; var i,j : byte; begin temps_final:=temps; final_fase:=true; for i:=1 to 38 do for j:=1 to 29 do if pantalla[i,j]=es_un_bloc_per_pintar {if blocs_per_pintar=0} then final_fase:=false; if not(final_fase) then begin pinta(pepe,color_pintura,x,y,vaddr); pantalla[(x div 6),((y div 6)-1)]:=es_un_bloc_pintat; x:=pos_ini_x_pepe; y:=pos_ini_y_pepe; if mode_nocturne then pinta(pepe_gorro,255,x,y,vaddr) else pinta(pepe,255,x,y,vaddr); Play_WAV (sample[so_pot]); while pintura0 then begin {if amb_so then so_de(pot_ple);} if not(rosita_selected) then dec(pintura); pinta(pepe,color,x,y,vaddr); pantalla[(x div 6),((y div 6)-1)]:=es_un_bloc_pintat; if el_que_hi_havia=es_un_bloc_per_pintar then begin dec(blocs_per_pintar); if not(amic_selected) then punts:=punts+(25-(5*dificultat))+valor_del_bloc else punts:=punts+(((25-(5*dificultat))+valor_del_bloc)*2); if (punts mod 20000)>(25-(5*dificultat)+valor_del_bloc) then donar_vida:=true; if (vides<9) and (story_mode_mode) and (donar_vida) then if punts>100 then if (punts mod 20000)<(25-(5*dificultat)+valor_del_bloc) then if not(amic_selected) then begin donar_vida:=false; inc(vides); pinta_number_zoom(5,numero_G[vides],255,260,150,VGA); if amb_so then PlayWav(sample[so_ring]){so_de(vida_extra)} else retard(40); end; end; end else if el_que_hi_havia=es_un_bloc_pintat then begin {if amb_so then so_de(pot_buit);} pinta(pepe,color,x,y,vaddr); pantalla[(x div 6),((y div 6)-1)]:=es_un_bloc_pintat; end else if el_que_hi_havia=es_un_bloc_per_pintar then begin {if amb_so then so_de(pot_buit);} pantalla[(x div 6),((y div 6)-1)]:=es_un_bloc_per_pintar; end; antiga_direccio:=cap_on_va_Pepe; end; {──────────────────────────────────────────────────────────────────────────} procedure animacio_mort; var i: byte; begin Play_WAV (sample[so_mort]); for i:=1 to 5 do begin retard(10); if rosita_selected then pinta(rosita_m,255,x,y,VGA) else if amic_selected then pinta(amic_m,255,x,y,VGA) else pinta(pepe_m,255,x,y,VGA); {if amb_so then sound(2000);} retard(10); if rosita_selected then pinta(rosita_m2,255,x,y,VGA) else if amic_selected then pinta(amic_m2,255,x,y,VGA) else pinta(pepe_m2,255,x,y,VGA); {if amb_so then sound(1000);} end; nosound; end; {──────────────────────────────────────────────────────────────────────────} procedure animacio_alegria; var i: byte; begin if (mode_nocturne) and (not(rosita_selected)) and (not(amic_selected)) then begin que_hi_ha:=pantalla[((x-max_m_x) div 6),(((y-max_m_y) div 6)-1)]; if que_hi_ha=es_un_bloc_pintat then pinta(gorro,color_pintura,x-6,y-6,VGA) else if que_hi_ha=es_una_paret then pinta(dib_pared,255,x-6,y-6,VGA); pinta(gorro,255,x,y-6,VGA); end; for i:=1 to 10 do begin retard(10); if rosita_selected then pinta(rosita_a,255,x,y,VGA) else if amic_selected then pinta(amic_a,255,x,y,VGA) else if mode_nocturne then pinta(pepe_gorro,255,x,y,VGA) else pinta(pepe_a,255,x,y,VGA); retard(10); if rosita_selected then pinta(rosita_a2,255,x,y,VGA) else if amic_selected then pinta(amic_a2,255,x,y,VGA) else if mode_nocturne then pinta(pepe_gorro,255,x,y,VGA) else pinta(pepe_a2,255,x,y,VGA); end; end; {──────────────────────────────────────────────────────────────────────────} procedure mort; begin if vides=0 then begin no_queden_vides:=true; pinta(pepe,color_pintura,x,y,vaddr); volcat_de_pantalla; animacio_mort; x:=pos_ini_x_pepe; y:=pos_ini_y_pepe; en_casa:=true; end else begin if vides>0 then dec(vides); if el_que_hi_havia=es_un_bloc_pintat then pinta(pepe,color_pintura,x,y,vaddr); volcat_de_pantalla; {so_de(mos_a_pepe);}Play_WAV (sample[so_mort]); animacio_mort; pantalla[(x div 6),(y div 6)-1]:=el_que_hi_havia{es_un_bloc_pintat}; x:=pos_ini_x_pepe; y:=pos_ini_y_pepe; en_casa:=true; volcat_de_pantalla; if mode_nocturne then pinta(pepe_gorro,255,x,y,vaddr2) else pinta(pepe,255,x,y,vaddr2); omplir_pot; volcat_de_pantalla; retard_pepe:=velocitat_pepe; end; end; {──────────────────────────────────────────────────────────────────────────} procedure mira_el_que_hi_ha(cap_on_vaig:byte); begin el_que_hi_havia:=que_hi_ha; case cap_on_vaig of amunt:que_hi_ha:=pantalla[(x div 6),(((y-max_m_y) div 6)-1)]; dreta:que_hi_ha:=pantalla[((x+max_m_x) div 6),((y div 6)-1)]; avall:que_hi_ha:=pantalla[(x div 6),(((y+max_m_y) div 6)-1)]; esquerra:que_hi_ha:=pantalla[((x-max_m_x) div 6),((y div 6)-1)]; end; end; {──────────────────────────────────────────────────────────────────────────} procedure ja_no_pots_eixir; begin escriu_frase('JA NO POTS EIXIR',64,50,96,vaddr,10,0,1); animacio_mort; x:=0; y:=0; no_queden_vides:=true; end; {──────────────────────────────────────────────────────────────────────────} procedure munta_velocitat_joc; begin if velocitat_pepe<9 then inc(velocitat_pepe); pinta_number_zoom(6,numero_G[velocitat_pepe],255,110,80,VGA); if amb_so then begin sound(velocitat_pepe*150); retard(1); nosound; end; end; {──────────────────────────────────────────────────────────────────────────} procedure baixa_velocitat_joc; begin if velocitat_pepe>1 then dec(velocitat_pepe); pinta_number_zoom(6,numero_G[velocitat_pepe],255,110,80,VGA); if amb_so then begin sound(velocitat_pepe*150); retard(1); nosound; end; end; {──────────────────────────────────────────────────────────────────────────} procedure moure(direccio:byte); var desp_pixel:byte; begin cap_on_va_Pepe:=direccio; case direccio of amunt:if ((y-max_m_y)>=l0) and (not(en_casa)) and (not(pantalla[(x div 6),(((y-max_m_y) div 6)-1)]=es_una_paret)) then begin mira_el_que_hi_ha(direccio); if que_hi_ha=es_un_bicho then mort else begin pinta_un_bloc(color_pintura,pintura); {for desp_pixel:=1 to max_m_y do begin dec(y); volcat_de_pantalla; end;} y:=y-max_m_y; {if not(amb_so) then }{retard(velocitat_joc);} retard_pepe:=velocitat_pepe; menejant:=true; pantalla[(x div 6),((y div 6)-1)]:=es_pepe; end; end; dreta:begin if (not(en_casa)) and (not(pantalla[((x+max_m_x) div 6),((y div 6)-1)]=es_una_paret)) then if ((x+max_m_x)<=l1) then begin mira_el_que_hi_ha(direccio); if que_hi_ha=es_un_bicho then mort else begin pinta_un_bloc(color_pintura,pintura); x:=x+max_m_x; {if not(amb_so) then }{retard(velocitat_joc);} retard_pepe:=velocitat_pepe; menejant:=true; pantalla[(x div 6),((y div 6)-1)]:=es_pepe; end; end else if (x=232) and (y=96) {and (pintura=l3) and (not(pantalla[((x-max_m_x) div 6),((y div 6)-1)]=es_una_paret)) then begin mira_el_que_hi_ha(direccio); if (en_casa) and (que_hi_ha=es_un_bicho) then ja_no_pots_eixir; {if en_casa then x:=x-max_m_x else} if {(not(en_casa)) and} (que_hi_ha=es_un_bicho) then mort else begin pinta_un_bloc(color_pintura,pintura); x:=x-max_m_x; {if not(amb_so) then }{retard(velocitat_joc);} retard_pepe:=velocitat_pepe; menejant:=true; pantalla[(x div 6),((y div 6)-1)]:=es_pepe; end; en_casa:=false; end; end; pinta_marcadors; end; {──────────────────────────────────────────────────────────────────────────} procedure ini_rellontge; var a,b : byte; begin {randomize;} repeat a:=random(38)+1; b:=random(29)+1; until not(pantalla[a,b]=es_una_paret); rellontge.i := (a*6)+4; rellontge.j := (b+1)*6; rellontge.viu := true; Play_WAV (sample[so_ring]); sense_rellontge := false; end; {──────────────────────────────────────────────────────────────────────────} procedure naix_malo(numero:byte); var a,b : byte; cont : word; begin malo[numero].viu:=true; {randomize;} cont := 0; repeat a:=random(38)+1; b:=random(29)+1; inc(cont); if cont>10000 then begin a:=38; b:=15; break; end; until (pantalla[a,b]=es_un_bloc_pintat) and (abs(a-(x div 6))>5) and (abs(b-((y div 6)-1))>5); malo[numero].i:=a; malo[numero].j:=b; {so_de(naiximent_del_malo);}Play_WAV (sample[so_malo]); pinta(malo[numero].dibuix,255,((malo[numero].i*6)+4),(malo[numero].j+1)*6,vaddr); end; {──────────────────────────────────────────────────────────────────────────} procedure mou_malo(numero,direccio:byte); begin case direccio of amunt:if (pantalla[malo[numero].i,malo[numero].j-1]=es_un_bloc_pintat) and (not(pantalla[malo[numero].i,malo[numero].j-1]=es_un_bicho)) then begin pinta(malo[numero].dibuix,color_pintura,(malo[numero].i*6)+4,(malo[numero].j+1)*6,vaddr); pantalla[malo[numero].i,malo[numero].j]:=es_un_bloc_pintat; dec(malo[numero].j); pinta(malo[numero].dibuix,255,(malo[numero].i*6)+4,(malo[numero].j+1)*6,vaddr); pantalla[malo[numero].i,malo[numero].j]:=es_un_bicho; end else if (pantalla[malo[numero].i,malo[numero].j-1]=es_pepe) and (not(en_casa)) and (pintura>0) then mort else if (pintura=0) and (que_hi_ha=es_un_bloc_pintat) and (pantalla[malo[numero].i,malo[numero].j-1]=es_pepe) and (not(en_casa)) then mort; avall:if (pantalla[malo[numero].i,malo[numero].j+1]=es_un_bloc_pintat) and (not(pantalla[malo[numero].i,malo[numero].j+1]=es_un_bicho)) then begin pinta(malo[numero].dibuix,color_pintura,(malo[numero].i*6)+4,(malo[numero].j+1)*6,vaddr); pantalla[malo[numero].i,malo[numero].j]:=es_un_bloc_pintat; inc(malo[numero].j); pinta(malo[numero].dibuix,255,(malo[numero].i*6)+4,(malo[numero].j+1)*6,vaddr); pantalla[malo[numero].i,malo[numero].j]:=es_un_bicho; end else if (pantalla[malo[numero].i,malo[numero].j+1]=es_pepe) and (not(en_casa)) and (pintura>0) then mort else if (pintura=0) and (que_hi_ha=es_un_bloc_pintat) and (pantalla[malo[numero].i,malo[numero].j+1]=es_pepe) and (not(en_casa)) then mort; dreta:if (pantalla[malo[numero].i+1,malo[numero].j]=es_un_bloc_pintat) and (not(pantalla[malo[numero].i+1,malo[numero].j]=es_un_bicho)) and (not((malo[numero].i+1)=39)) then begin pinta(malo[numero].dibuix,color_pintura,(malo[numero].i*6)+4,(malo[numero].j+1)*6,vaddr); pantalla[malo[numero].i,malo[numero].j]:=es_un_bloc_pintat; inc(malo[numero].i); pinta(malo[numero].dibuix,255,(malo[numero].i*6)+4,(malo[numero].j+1)*6,vaddr); pantalla[malo[numero].i,malo[numero].j]:=es_un_bicho; end else if (pantalla[malo[numero].i+1,malo[numero].j]=es_pepe) or ((malo[numero].i+1)=39) then if (not(en_casa)) and (pintura>0) then mort else if (pantalla[malo[numero].i+1,malo[numero].j]=es_pepe) or ((malo[numero].i+1)=39) then if (pintura=0) and (que_hi_ha=es_un_bloc_pintat) and (pantalla[malo[numero].i+1,malo[numero].j]=es_pepe) and (not(en_casa)) then mort else if ((malo[numero].i+1)=39) and (malo[numero].j=15) and (en_casa) then ja_no_pots_eixir; esquerra:if (pantalla[malo[numero].i-1,malo[numero].j]=es_un_bloc_pintat) and (not(pantalla[malo[numero].i-1,malo[numero].j]=es_un_bicho)) then begin pinta(malo[numero].dibuix,color_pintura,(malo[numero].i*6)+4,(malo[numero].j+1)*6,vaddr); pantalla[malo[numero].i,malo[numero].j]:=es_un_bloc_pintat; dec(malo[numero].i); pinta(malo[numero].dibuix,255,(malo[numero].i*6)+4,(malo[numero].j+1)*6,vaddr); pantalla[malo[numero].i,malo[numero].j]:=es_un_bicho; end else if (pantalla[malo[numero].i-1,malo[numero].j]=es_pepe) and (not(en_casa)) and (pintura>0) then mort else if (pintura=0) and (que_hi_ha=es_un_bloc_pintat) and (pantalla[malo[numero].i-1,malo[numero].j]=es_pepe) and (not(en_casa)) then mort; end; end; {──────────────────────────────────────────────────────────────────────────} procedure moure_malos; begin for i:=1 to max_malos do if malo[i].viu then begin {randomize;} case malo[i].sentit of horitzontalment:if ((malo[i].i*6)+4)>x then begin mou_malo(i,esquerra); malo[i].sentit:=random(2+dificultat); end else if ((malo[i].i*6)+4)y then begin mou_malo(i,amunt); malo[i].sentit:=random(2+dificultat); end else if ((malo[i].j+1)*6)'') and (P<>'') then escriu_frase('DATOS DEL JOC CARREGATS',color,20,110,vaddr,0,0,1); escriu_frase('PULSA UNA TECLA PER A CONTINUAR...',color,20,180,vaddr,0,0,1); Repeat until QteclaPuls; end; {──────────────────────────────────────────────────────────────────────────} procedure story_mode; var eixir : boolean; s_vella : byte; musica_fase:string; begin historia; num_fase:=1; repeat contador:=0; ini_vars(num_fase); case num_fase of 1,3,5,7,9 : musica_fase:=musica_fase01; 2,4,6,8 : musica_fase:=musica_fase02; 10 : musica_fase:=musica_fase10; end; if num_fase=1 then punts:=0; {if not(mode_nocturne) then pantalla_presentacio(num_fase);} ini_pantalla; volcar32(vaddr2,vaddr); pinta_marcadors; eixir:=false; if midi then begin StopMIDI; unloadmidi; midi:=false; end; if mode_nocturne then ini_midi(musica_fase_nit) else ini_midi(musica_fase); if midi then Playmidi; {------------------------------} repeat if (not(playing)) and (midi) then PlayMIDI; s_vella := s; gettime(h,m,s,c); menejant:=false; inc(contador); if retard_pepe>0 then dec(retard_pepe); if teclapuls(KeyKeypadPlus) then begin munta_velocitat_joc; repeat until not(TeclaPuls(KeyKeypadPlus)); end; if teclapuls(KeyKeypadminus) then begin baixa_velocitat_joc; repeat until not(TeclaPuls(KeyKeypadMinus)); end; if retard_pepe=0 then if teclapuls(tecla_amunt) then moure(amunt) else if teclapuls(tecla_avall) then moure(avall) else if teclapuls(tecla_dreta) then moure(dreta) else if teclapuls(tecla_esquerra) then moure(esquerra); if TeclaPuls(KeyM) then begin map:=not(map); repeat until not(TeclaPuls(KeyM)); end; {---------} { if TeclaPuls(KeyN) then begin final_fase:=true; num_fase:=9; end; if TeclaPuls(KeyB) then final_fase:=true;} {---------} if teclapuls(Key1) then begin amb_so:={not(amb_so);}false; repeat until not(TeclaPuls(Key1)); end; if teclapuls(KeyESC) then begin escriu_frase('JOC DETINGUT',147,69,89,vaddr2,0,0,0); escriu_frase('(*ESC* PER A EIXIR)',147,38,101,vaddr2,0,0,0); espera_VGA; volcar32(vaddr2,VGA); repeat until not(TeclaPuls(KeyESC)); repeat until (QteclaPuls); if TeclaPuls(KeyESC) then eixir:=true; end; if rellontge.viu then if (x = rellontge.i) and (y = rellontge.j) then begin malos_quets := true; rellontge.temps := 0; rellontge.viu := false; if midi then begin StopMIDI; unloadmidi; midi:=false; end; ini_midi(musica_campanes); if midi then Playmidi; end; fer_apareixer_els_malos; if not(malos_quets) then begin if contador mod velocitat_pepe = 0 then moure_malos end else begin if (s_vella<>s) then inc(rellontge.temps); if rellontge.temps = 10 then begin malos_quets:=false; if midi then begin StopMIDI; unloadmidi; midi:=false; end; if mode_nocturne then ini_midi(musica_fase_nit) else ini_midi(musica_fase); if midi then Playmidi; end; end; if not(no_queden_vides) then volcat_de_pantalla; {------------------------------} until (eixir) or (final_fase) or (no_queden_vides); if final_fase then if num_fase0 then dec(retard_pepe); menejant:=false; if retard_pepe=0 then begin if teclapuls(tecla_amunt) then moure(amunt) else if teclapuls(tecla_avall) then moure(avall) else if teclapuls(tecla_dreta) then moure(dreta) else if teclapuls(tecla_esquerra) then moure(esquerra); end; if teclapuls(Key1) then begin amb_so:={not(amb_so);}false; repeat until not(TeclaPuls(Key1)); end; if teclapuls(KeyESC) then begin eixir:=true; end; {if TeclaPuls(KeyN) then final_fase:=true;} fer_apareixer_els_malos; posa_el_temps(vaddr); if (contador mod velocitat_pepe) = 0 then moure_malos; if not(no_queden_vides) then volcat_de_pantalla; {------------------------------} until (eixir) or (final_fase) or (no_queden_vides); if midi then begin StopMIDI; unloadmidi; midi:=false; end; if final_fase then begin pinta(pepe,color_pintura,x,y,VGA); x:=pos_ini_x_pepe; y:=pos_ini_y_pepe; animacio_alegria; if midi then begin StopMIDI; unloadmidi; midi:=false; end; resultat_time_attack; end else if (eixir) then begin fadedown(0,0,0,0); if midi then begin StopMIDI; unloadmidi; midi:=false; end; end; if no_queden_vides then begin missatge_game_over; if midi then begin StopMIDI; unloadmidi; midi:=false; end; end; end; {──────────────────────────────────────────────────────────────────────────} procedure menu_joc; var temps,temps2 : word; pos,pos_dif,pos_m,cord_y : byte; i,j,a_on_pinte_el_marc : word; aux : byte; tecla_incorrecta : boolean; i_int:integer; dib_aux : word; percentatge : byte; procedure ini_estreles; var i : byte; begin cls32(0,vaddr); for i:=1 to 10 do begin estreles[i].x:=random(290); estreles[i].y:=1; estreles[i].velocitat:=random(3)+1; end; end; procedure fondo_estreles(from,where:word); var i,a,b : byte; begin for i:=1 to 10 do begin if (estreles[i].y + estreles[i].velocitat) > 191 then begin estreles[i].x := random(290); estreles[i].y := 1; estreles[i].velocitat := random(3) + 1; end else estreles[i].y := estreles[i].y + (estreles[i].velocitat); Putsprite(from,where,26747,9,8,estreles[i].x,estreles[i].y); end; end; procedure actualitza_options(from,where:word); var i,j:byte; begin cls32(0,vaddr2); for i:=0 to 3 do for j:=0 to 5 do Putsprite(vaddr,where,48000,50,50,j*50,i*50); fondo_estreles(vaddr,vaddr2); Putsprite(from,where,30400,165,28,70,5); Putsprite(from,where,39733,116,18,22,43); if amb_so then Putsprite(from,where,40492,25,17,149,45) else Putsprite(from,where,39557,28,20,150,42); Putsprite(from,where,57332,113,19,20,81); if GM then Putsprite(from,where,51573,107,17,141,81) else Putsprite(from,where,51684,130,20,141,81); Putsprite(from,where,45172,39,20,22,61); case volumen of 0 : Putsprite(from,where,45551,32,18,70,62); 1 : Putsprite(from,where,45580,16,18,70,62); 2 : Putsprite(from,where,45596,16,18,70,62); 3 : Putsprite(from,where,45611,16,18,70,62); 4 : Putsprite(from,where,45626,16,18,70,62); 5 : Putsprite(from,where,45642,16,18,70,62); 6 : Putsprite(from,where,45658,16,18,70,62); 7 : Putsprite(from,where,45673,16,18,70,62); 8 : Putsprite(from,where,45689,16,18,70,62); 9 : Putsprite(from,where,45705,14,18,71,62); 10 : Putsprite(from,where,45720,40,18,70,62); end; Putsprite(from,where,21673,84,73,22,117); Putsprite(vaddr,vaddr2,tecla_amunt_dib,21,21,135,110); Putsprite(vaddr,vaddr2,tecla_avall_dib,21,21,135,131); Putsprite(vaddr,vaddr2,tecla_esquerra_dib,21,21,135,152); Putsprite(vaddr,vaddr2,tecla_dreta_dib,21,21,135,173); { fletxes i ESC } Putsprite(vaddr,vaddr2,31527,47,24,238,172); { Complet + percentatge } Putsprite(vaddr,vaddr2,58405,70,17,200,120); Putsprite(vaddr,vaddr2,percentatge*29,29,14,220,142); Pinta_number(fletxa3,255,13,cord_y,vaddr2); end; procedure pinta_marcs(posicio:word); var i : word; begin volcar32(vaddr,vaddr2); for i:=posicio to posicio+75 do begin putpixel(i,11,15,vaddr2); putpixel(i,12,15,vaddr2); putpixel(i,90,15,vaddr2); putpixel(i,91,15,vaddr2); end; for i:=11 to 91 do begin putpixel(posicio,i,15,vaddr2); putpixel(posicio+1,i,15,vaddr2); putpixel(posicio+74,i,15,vaddr2); putpixel(posicio+75,i,15,vaddr2); end; if mode_nocturne then begin if mode_Dream_Tour=Dream_tour then pinta_number_zoom(2,tick,255,216,143,vaddr2); end else if (pos=1) or (pos=3) then begin if mode_easy=pepe_facil then pinta_number_zoom(2,tick,255,216,118,vaddr2); if mode_normal=pepe_normal then pinta_number_zoom(2,tick,255,216,143,vaddr2); if mode_hard=pepe_dificil then pinta_number_zoom(2,tick,255,216,168,vaddr2); end else begin if mode_easy_r=rosita_facil then pinta_number_zoom(2,tick,255,216,118,vaddr2); if mode_normal_r=rosita_normal then pinta_number_zoom(2,tick,255,216,143,vaddr2); if mode_hard_r=rosita_dificil then pinta_number_zoom(2,tick,255,216,168,vaddr2); end; if pos_dif=1 then pinta_number(fletxa,255,98,118,vaddr2); if pos_dif=2 then pinta_number(fletxa,255,98,143,vaddr2); if pos_dif=3 then pinta_number(fletxa,255,98,168,vaddr2); espera_VGA; volcar32(vaddr2,VGA); end; procedure desp_marc(direccio:byte); begin case direccio of Left: if pos=3 then begin i:=219; while i>136 do begin pinta_marcs(i); i:=i-3; if i<137 then pinta_marcs(137); end; end else if pos=2 then begin i:=137; while i>54 do begin pinta_marcs(i); i:=i-3; if i<55 then pinta_marcs(55); end; end; Right:if pos=1 then begin i:=55; while i<138 do begin pinta_marcs(i); i:=i+3; if i>137 then pinta_marcs(137); end; end else if pos=2 then begin i:=137; while i<220 do begin pinta_marcs(i); i:=i+3; if i>219 then pinta_marcs(219); end; end; end; end; begin time_attack_mode:=false; story_mode_mode:=false; percentatge:=0; if mode_easy=pepe_facil then inc(percentatge); if mode_normal=pepe_normal then inc(percentatge); if mode_hard=pepe_dificil then inc(percentatge); if mode_easy_r=rosita_facil then inc(percentatge); if mode_normal_r=rosita_normal then inc(percentatge); if mode_hard_r=rosita_dificil then inc(percentatge); if mode_Dream_tour=Dream_tour then inc(percentatge); if mode_nocturne then load_mif(menu_nit,vaddr) else load_mif(menu,vaddr); load_mif(menu_s,vaddr2); espera_vga; volcar32(vaddr,VGA); if not(mode_nocturne) then begin if midi then begin StopMIDI; unloadmidi; midi:=false; end; ini_midi(musica_title); if midi then Playmidi; end else begin if midi then begin StopMIDI; unloadmidi; midi:=false; end; ini_midi(musica_nit); if midi then Playmidi; if not(midi) then ini_midi(musica_nit); if (not(Playing)) and (midi) then PlayMidi; end; i:=320; if not(mode_nocturne) then while (i>20) do begin espera_VGA; volcar32(vaddr,VGA); Put_Sprite_ICE_dreta(vaddr2,VGA,16983,142,26,i,53); dec(i,10); if i=20 then Put_Sprite_ICE_dreta(vaddr2,vaddr,16983,142,26,i,53); end; i:=320; while (i>20) do begin espera_VGA; volcar32(vaddr,VGA); if not(mode_nocturne) then Put_Sprite_ICE_dreta(vaddr2,VGA,28822,132,25,i,90) else Put_Sprite_ICE_dreta(vaddr2,VGA,28958,132,25,i,90); dec(i,10); if i=20 then if not(mode_nocturne) then Put_Sprite_ICE_dreta(vaddr2,vaddr,28822,132,25,i,90) else Put_Sprite_ICE_dreta(vaddr2,vaddr,28958,132,25,i,90); end; i:=320; while (i>20) do begin espera_VGA; volcar32(vaddr,VGA); Put_Sprite_ICE_dreta(vaddr2,VGA,40982,152,24,i,128); dec(i,10); if i=20 then Put_Sprite_ICE_dreta(vaddr2,vaddr,40982,152,24,i,128); end; i:=320; while (i>20) do begin espera_VGA; volcar32(vaddr,VGA); Put_Sprite_ICE_dreta(vaddr2,VGA,52182,103,30,i,163); dec(i,10); if i=20 then Put_Sprite_ICE_dreta(vaddr2,vaddr,52182,103,30,i,163); end; i_int:=-35; while (i_int<15) do begin espera_VGA; volcar32(vaddr,VGA); espera_VGA; Put_Sprite_ICE_dalt(vaddr2,VGA,5463,133,33,23,i_int); inc(i_int,10); if i_int=15 then Put_Sprite_ICE_dalt(vaddr2,vaddr,5463,133,33,23,i_int); end; espera_VGA; volcar32(vaddr,VGA); gettime(h,m,s,c); temps:=h*3600+m*60+s; eixir_del_joc:=false; pos_m:=2; pinta_number(fletxa2,255,13,100,VGA); cord_y:=100; repeat if (not(playing)) then if (mode_nocturne) then begin ini_midi(musica_nit); if midi then PlayMIDI; end else begin ini_midi(musica_title); if midi then PlayMIDI; end; gettime(h,m,s,c); temps2:=h*3600+m*60+s; if (TeclaPuls(KeyArrowDown)) and (pos_m<4) then begin inc(pos_m); case pos_m of 1:cord_y:=62; 2:cord_y:=100; 3:cord_y:=138; 4:cord_y:=174; end; volcar32(vaddr,vaddr2); pinta_number(fletxa2,255,13,cord_y,vaddr2); espera_VGA; volcar32(vaddr2,VGA); gettime(h,m,s,c); temps:=h*3600+m*60+s; temps2:=h*3600+m*60+s+1; Play_WAV (sample[so_fletxa]); repeat until not(TeclaPuls(KeyArrowDown)); end; if (TeclaPuls(KeyArrowUp)) and (pos_m>1) then begin dec(pos_m); if (mode_nocturne) and (pos_m=1) then pos_m:=2; case pos_m of 1:cord_y:=62; 2:cord_y:=100; 3:cord_y:=138; 4:cord_y:=174; end; volcar32(vaddr,vaddr2); pinta_number(fletxa2,255,13,cord_y,vaddr2); espera_VGA; volcar32(vaddr2,VGA); gettime(h,m,s,c); temps:=h*3600+m*60+s; temps2:=h*3600+m*60+s+1; Play_WAV (sample[so_fletxa]); repeat until not(TeclaPuls(KeyArrowUp)); end; volcar32(vaddr,vaddr2); if (temps2 mod 2)=0 then pinta_number(fletxa2,255,13,cord_y,vaddr2) else pinta_number(fletxa2,255,15,cord_y,vaddr2); espera_VGA; volcar32(vaddr2,VGA); until (TeclaPuls(KeyENTER)) or (TeclaPuls(KeyESC)) or ((temps2-temps)>=10); if TeclaPuls(KeyENTER) then Play_WAV (sample[so_enter]); if teclapuls(keyESC) then begin pos_m:=5; StopMIDI; power_off(vaddr); eixir_del_joc:=true; end; if (Temps2-temps)>=10 then begin pos_m:=5; fadedown(0,0,0,0); escriu_records(10); titol_del_joc; end; { TIME ATTACK } if (pos_m=1) and (not(mode_nocturne)) then begin time_attack_mode:=true; fadedown(0,0,0,1); if midi then begin StopMIDI; unloadmidi; midi:=false; end; time_attack; end; { PEPE VELL } if (pos_m=3) then begin fadedown(0,0,0,1); if midi then begin StopMIDI; unloadmidi; midi:=false; end; pepe_text; end; { STORY MODE } if (pos_m=2) then begin borrat_de_pantalla(vaddr); repeat until not(TeclaPuls(KeyENTER)); story_mode_mode:=true; rosita_selected:=false; amic_selected:=false; if (mode_nocturne) then load_mif(select_n,vaddr) else load_mif(select,vaddr); if not(mode_rosita=rosita_enabled) then begin for i:=137 to 212 do for j:=11 to 91 do putpixel(i,j,0,vaddr); putpixel(145,19,14,vaddr); putpixel(197,44,14,vaddr); putpixel(149,78,14,vaddr); putpixel(194,77,14,vaddr); putpixel(172,54,14,vaddr); putpixel(198,65,14,vaddr); putpixel(177,38,9,vaddr); putpixel(169,82,9,vaddr); putpixel(183,12,9,vaddr); putpixel(139,37,9,vaddr); putpixel(211,81,9,vaddr); end; if not(mode_amic=job_enabled) then begin for i:=219 to 294 do for j:=11 to 91 do putpixel(i,j,0,vaddr); putpixel(228,65,14,vaddr); putpixel(290,26,14,vaddr); putpixel(264,63,14,vaddr); putpixel(284,85,14,vaddr); putpixel(262,13,14,vaddr); putpixel(239,46,14,vaddr); putpixel(266,74,9,vaddr); putpixel(264,21,9,vaddr); putpixel(248,84,9,vaddr); putpixel(279,87,9,vaddr); putpixel(254,39,9,vaddr); end; espera_vga; volcar32(vaddr,vga); pinta_marcs(55); pos:=1; if mode_nocturne then pos_dif:=0 else pos_dif:=1; a_on_pinte_el_marc:=55; get_color(15,R,G,B); i:=0; G:=0; B:=0; repeat i:=(i+1) mod 127; i_int:=(63-i); B:=ABS(i_int); G:=B; set_color(15,R,G,B); if (not(playing)) and (midi) then PlayMIDI; if (TeclaPuls(KeyArrowLeft)) and (pos>1) then if not(mode_nocturne) then begin desp_marc(Left); dec(pos); end; if (TeclaPuls(KeyArrowRight)) and (pos<3) then if not(mode_nocturne) then begin if (pos=1) and (mode_rosita=99) then begin desp_marc(Right); inc(pos); end else if (pos=2) and (mode_amic=199) then begin desp_marc(Right); inc(pos); end; end; if (TeclaPuls(KeyArrowDown)) and (pos_dif<3) and not(mode_nocturne) then begin inc(pos_dif); pinta_marcs(a_on_pinte_el_marc); Play_WAV (sample[so_fletxa]); repeat until not(TeclaPuls(KeyArrowDown)); end; if (TeclaPuls(KeyArrowUp)) and (pos_dif>1) and not(mode_nocturne) then begin dec(pos_dif); pinta_marcs(a_on_pinte_el_marc); Play_WAV (sample[so_fletxa]); repeat until not(TeclaPuls(KeyArrowUp)); end; if pos=2 then if mode_rosita=99 then begin pinta_marcs(137); a_on_pinte_el_marc:=137; end; if pos=3 then if mode_amic=199 then begin pinta_marcs(219); a_on_pinte_el_marc:=219; end; if pos=1 then begin pinta_marcs(55); a_on_pinte_el_marc:=55; end; until (TeclaPuls(KeyENTER)) or (TeclaPuls(KeyESC)); if TeclaPuls(KeyENTER) then Play_WAV (sample[so_enter]); if TeclaPuls(KeyESC) then pos:=4; if pos_dif=1 then dificultat:=facil; if pos_dif=2 then dificultat:=normal; if pos_dif=3 then dificultat:=dificil; if mode_nocturne then dificultat:=normal; if pos=1 then begin amic_selected:=false; rosita_selected:=false; color_pintura:=162; color_marcador_pintura:=162; end; if pos=2 then begin amic_selected:=false; rosita_selected:=true; color_pintura:=199; color_marcador_pintura:=199; end; if pos=3 then begin amic_selected:=true; rosita_selected:=false; color_pintura:=48; color_marcador_pintura:=48; end; if pos=4 then borrat_de_pantalla(vaddr) else fadedown(0,0,0,0); if not(pos=4) then begin if (midi) and not(mode_nocturne) then begin StopMIDI; unloadmidi; midi:=false; end; Story_mode; end; end; { opcions } if (pos_m=4) then begin ini_estreles; pos_m:=1; if midi then begin StopMIDI; unloadmidi; midi:=false; end; ini_midi(musica_options); if midi then Playmidi; cord_y := 47; load_mif(options,vaddr); actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); repeat if (not(playing)) and (midi) then PlayMIDI; if (TeclaPuls(KeyArrowDown)) and (pos_m<7) then begin inc(pos_m); case pos_m of 1:cord_y:=47; 2:cord_y:=65; 3:cord_y:=83; 4:cord_y:=122; 5:cord_y:=140; 6:cord_y:=158; 7:cord_y:=176; end; Play_WAV (sample[so_fletxa]); actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); repeat actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); until not(TeclaPuls(KeyArrowDown)); end; if (TeclaPuls(KeyArrowUp)) and (pos_m>1) then begin dec(pos_m); case pos_m of 1:cord_y:=47; 2:cord_y:=65; 3:cord_y:=83; 4:cord_y:=122; 5:cord_y:=140; 6:cord_y:=158; 7:cord_y:=176; end; Play_WAV (sample[so_fletxa]); actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); repeat actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); until not(TeclaPuls(KeyArrowUp)); end; if (TeclaPuls(KeyArrowRight)) then begin if (pos_m=1) then begin amb_so:={not(amb_so);}false; if Puerto=255 then amb_so:=false; {if amb_so then InitWAV(Puerto,DMA,IRQ) else EndWav; if amb_so then arxius_wav(amb_so);} end else if (pos_m=2) then begin if volumen<10 then inc(volumen) end else if (pos_m=3) then GM:=not(GM); actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); repeat actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); until not(QTeclaPuls); end; if (TeclaPuls(KeyArrowLeft)) then begin if (pos_m=1) then begin amb_so:={not(amb_so);}false; if Puerto=255 then amb_so:=false; {if amb_so then InitWAV(Puerto,DMA,IRQ) else EndWav; if amb_so then arxius_wav(amb_so);} end else if (pos_m=2) then begin if volumen>0 then dec(volumen) end else if (pos_m=3) then GM:=not(GM); actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); repeat actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); until not(QTeclaPuls); end; if ((TeclaPuls(KeyENTER))) and (pos_m>3) then begin repeat actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); Play_WAV (sample[so_enter]); until not(TeclaPuls(KeyENTER)); aux := 0; dib_aux := 23781; actualitza_options(vaddr,vaddr2); case pos_m of 4 : begin tecla_amunt:=aux; tecla_amunt_dib := dib_aux; end; 5 : begin tecla_avall:=aux; tecla_avall_dib := dib_aux; end; 6 : begin tecla_esquerra:=aux; tecla_esquerra_dib := dib_aux; end; 7 : begin tecla_dreta:=aux; tecla_dreta_dib := dib_aux; end; end; espera_VGA; volcar32(vaddr2,VGA); repeat tecla_incorrecta:=true; repeat actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); until Qteclapuls; aux:=AgarrarTecla; repeat actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); until not(QTeclaPuls); case aux of KeyA,KeyB,KeyC,KeyD,KeyE,KeyF,KeyG,KeyH,KeyI,KeyJ,KeyK,KeyL,KeyM,KeyN, KeyO,KeyP,KeyQ,KeyR,KeyS,KeyT,KeyU,KeyV,KeyW,KeyX,KeyY,KeyZ, KeyArrowUp,KeyArrowDown,KeyArrowLeft,KeyArrowRight : tecla_incorrecta:=false; else tecla_incorrecta:=true; end; until (not(tecla_incorrecta)); case aux of KeyA : dib_aux := 4485; KeyB : dib_aux := 4509; KeyC : dib_aux := 4533; KeyD : dib_aux := 4557; KeyE : dib_aux := 4581; KeyF : dib_aux := 4605; KeyG : dib_aux := 4629; KeyH : dib_aux := 4653; KeyI : dib_aux := 4677; KeyJ : dib_aux := 4702; KeyK : dib_aux := 4726; KeyL : dib_aux := 4750; KeyM : dib_aux := 4774; KeyN : dib_aux := 14085; KeyO : dib_aux := 14109; KeyP : dib_aux := 14133; KeyQ : dib_aux := 14157; KeyR : dib_aux := 14181; KeyS : dib_aux := 14205; KeyT : dib_aux := 14229; KeyU : dib_aux := 14253; KeyV : dib_aux := 14277; KeyW : dib_aux := 14302; KeyX : dib_aux := 14326; KeyY : dib_aux := 14350; KeyZ : dib_aux := 14374; KeyArrowUp : dib_aux := 23709; KeyArrowDown : dib_aux := 23685; KeyArrowLeft : dib_aux := 23757; KeyArrowRight : dib_aux := 23733; end; case pos_m of 4 : begin tecla_amunt:=aux; tecla_amunt_dib := dib_aux; end; 5 : begin tecla_avall:=aux; tecla_avall_dib := dib_aux; end; 6 : begin tecla_esquerra:=aux; tecla_esquerra_dib := dib_aux; end; 7 : begin tecla_dreta:=aux; tecla_dreta_dib := dib_aux; end; end; actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); end; actualitza_options(vaddr,vaddr2); espera_VGA; volcar32(vaddr2,VGA); until TeclaPuls(KeyESC); borrat_de_pantalla(vaddr2); if midi then begin StopMIDI; unloadmidi; midi:=false; end; save_cfg; end; end; {──────────────────────────────────────────────────────────────────────────} {──────────────────────────────────────────────────────────────────────────} begin comprobar_comp_i_sprites; randomize; instalarkb; setmode($13); setupvirtual(virscr,vaddr); setupvirtual(virscr2,vaddr2); getmem(virscrSP,7680); vaddrSP:=seg(virscrSP^); loadPCX('datos\sprites.dat',vaddrSP); load_setup_i_versio; ini_matrius; load_cfg; intro_logo; titol_del_joc; { if amb_so then InitWAV(Puerto,DMA,IRQ); if amb_so then arxius_wav(TRUE);} repeat menu_joc; until eixir_del_joc; Tancarvirtual(virscr); Tancarvirtual(virscr2); Freemem(virscrSP,7680); { if amb_so then arxius_wav(FALSE); if amb_so then EndWAV;} DesinstalarKB; setmode($3); end. { ini_midi('.\music\logo.mid'); if midi then Playmidi; if (not(playing)) and (midi) then PlayMIDI; if midi then begin StopMIDI; unloadmidi; midi:=false; end; }