; TRIES LES ENTITEES SELON UNE FORME DE Z-BUFFER ld a,(nomb_entitee) ld b,a push bc cp 1 jp z,absence_entitee ld hl,entitee+3 ld d,(hl) inc hl ld e,(hl) dec b Boucle_tries_entitee: push bc ld bc,9 add hl,bc ld b,(hl) inc hl ld c,(hl) ld a,d inc b cp b dec b jr nc,trie ld a,e dec a cp c jr c,trie_pas trie: push hl push bc dec hl dec hl dec hl dec hl push hl ld bc,10 ld de,entite_zbuffer ldir dec hl ld a,(hl) ld hl,pointeur_entite ld d,0 ld e,a add hl,de ld a,(hl) sub 10 ld (hl),a pop hl ld d,h ld e,l ld bc,10 sbc hl,bc push hl ld bc,10 ldir dec hl ld a,(hl) ld hl,pointeur_entite ld d,0 ld e,a add hl,de ld a,(hl) add a,10 ld (hl),a pop de ; passage hl > de ld hl,entite_zbuffer ld bc,10 ldir pop bc pop hl trie_pas: ld d,b ld e,c pop bc djnz Boucle_tries_entitee ; GERENCE AFFICHAGE DES ENTITEES absence_entitee: pop bc ld hl,entitee Boucle_gerence_entitee: push bc ld a,(hl) ld (entitee_type),a inc hl cp 255 ; AFFICHE LE HEROS jp nz,entitee_non_heros inc hl inc hl ld de,(heros_y) ld (hl),d inc hl ld (hl),e inc hl push hl ld a,(heros_invisible) cp 1 jp z,fin_detection_entitee ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ld hl,(heros_x) ; calcule de coordonnees du heros a l'ecran push hl ld hl,(ecran_x) ld d,h ld e,l pop hl sbc hl,de ld a,l add a,158 ld c,a ld hl,(heros_y) push hl ld hl,(ecran_y) ld d,h ld e,l pop hl sbc hl,de ld a,l add a,101 ld b,a ld a,(heros_oriente) cp 0 jr nz,heros_pas_de_face ld hl,corp_face push hl ld hl,tete_face jr heros_fin_orientation heros_pas_de_face: cp 1 jr nz,heros_pas_de_droite ld hl,corp_droite push hl ld hl,tete_droite jr heros_fin_orientation heros_pas_de_droite: cp 2 jr nz,heros_pas_de_dos ld hl,corp_face push hl ld hl,tete_dos jr heros_fin_orientation heros_pas_de_dos: cp 3 jr nz,heros_pas_de_gauche ld hl,corp_gauche push hl ld hl,tete_gauche heros_fin_orientation: call dessine ;affiche tete du heros pop hl ld a,b add a,7 ld b,a ld de,13 ld a,(heros_bouge_flag) cp 0 jr z,hero_image_arret2 ld a,(heros_anime) ld e,a ld d,0 hero_image_arret2: add hl,de call dessine ;affiche corp du heros heros_pas_de_gauche: ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> jp fin_detection_entitee entitee_non_heros: ; CONTINU ld b,(hl) inc hl ld c,(hl) inc hl ld (entitee_coordx),bc ld d,(hl) inc hl ld e,(hl) inc hl ld (entitee_coordy),de push hl push hl ld h,d ld l,e push hl ld hl,(ecran_y) ld d,h ld e,l pop hl sbc hl,de ld a,l add a,100 ld d,a or a ; reset carry flag ld h,b ld l,c push hl ld hl,(ecran_x) ld b,h ld c,l pop hl sbc hl,bc ld a,l add a,160 ld c,a ld b,d ld a,(entitee_type) pop hl ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cp 0 jp nz,pas_smile ld hl,smiley call dessine ld a,(entitee_coordy) ; centre la collision des smiley sans que ca depasse ld b,20+14 cp b jr c,smiley_trop_haut sub b jr smiley_haut_bon smiley_trop_haut: xor a smiley_haut_bon: ld (entitee_coordy),a ld (dessine_1),a ld a,(entitee_coordx) ; centre la collision des smiley sans que ca depasse ld b,20-4 cp b jr c,smiley_trop_gauche sub b jr smiley_gauche_bon smiley_trop_gauche: xor a smiley_gauche_bon: ld (entitee_coordx),a ld (dessine_1+1),a ld hl,smiley_data_collision_large jp detecte_collision_barils pas_smile: ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cp 1 jp nz,pas_perso ld a,(hl) ld (hl),0 inc hl cp 0 ld e,a ld a,1 ld (perso_bouge),a jr nz,bouger_perso ld a,0 ld (perso_bouge),a ld a,(hl) ld e,a bouger_perso: ld a,e ld (hl),a inc hl ld d,(hl) ld (entitee_flag2),hl push bc push de ld bc,(entitee_coordx) ld de,(entitee_coordy) cp 1 jr nz,perso_pas_de_face ld hl,corp_face ld (entitee_flag),hl ld hl,tete_face inc de jr perso_fin_orientation perso_pas_de_face: cp 2 jr nz,perso_pas_de_droite ld hl,corp_droite ld (entitee_flag),hl ld hl,tete_droite inc bc jr perso_fin_orientation perso_pas_de_droite: cp 3 jr nz,perso_pas_de_dos ld hl,corp_face ld (entitee_flag),hl ld hl,tete_dos dec de jr perso_fin_orientation perso_pas_de_dos: ld hl,corp_gauche ld (entitee_flag),hl ld hl,tete_gauche dec bc perso_fin_orientation: ld a,(perso_bouge) cp 0 jr z,bouge_pas_perso2 push hl ld hl,(entitee_flag2) or a ; reset carry flag push de ld de,6 sbc hl,de pop de ld (hl),b inc hl ld (hl),c inc hl ld (hl),d inc hl ld (hl),e pop hl bouge_pas_perso2: pop de pop bc ld a,d cp 1 jr nz,tete_base ld de,15 add hl,de tete_base: cp 2 jp nz,soldat ld de,30 add hl,de call dessine jp fin_detection_entitee soldat: cp 3 jp nz,roi ld hl,roi_gauche call dessine ld a,c add a,8 ld c,a ld hl,roi_droite call dessine jp fin_detection_entitee roi: cp 4 jp nz,tigre_rouge ld de,57 add hl,de call dessine jp fin_detection_entitee tigre_rouge: call dessine ;affiche tete du perso ld hl,(entitee_flag) ld a,b add a,7 ld b,a ld a,(perso_bouge) cp 0 jr z,bouge_pas_perso ld a,(heros_anime) ld e,a ld d,0 add hl,de bouge_pas_perso: call dessine ;affiche corp du perso jp fin_detection_entitee pas_perso: ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cp 2 jp nz,pas_trone ld hl,siege_gauche call dessine ld a,c add a,8 ld c,a ld hl,siege_droite call dessine jp fin_detection_entitee pas_trone: cp 3 jp nz,soldat_died_1 ld a,b add a,5 ld b,a ld hl,soldat_mort1 call dessine ld a,c add a,8 ld c,a ld hl,soldat_mort2 call dessine jp fin_detection_entitee soldat_died_1: cp 4 jp nz,soldat_died_2 ld a,b add a,5 ld b,a ld a,c sub 8 ld c,a ld hl,soldat_mort3 call dessine ld a,c add a,8 ld c,a ld hl,soldat_mort4 call dessine jp fin_detection_entitee soldat_died_2: ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ZONE DE COLLISION cp 5 jp nz,entitee_zone_collision detecte_collision_barils: push hl ld DE,(heros_x) ld HL,(entitee_coordx) call HL_inferieur_DE jp nc,en_dehors_collision pop hl ld a,(hl) inc hl push hl ld HL,(entitee_coordx) add a,l ld l,a call HL_inferieur_DE jp c,en_dehors_collision ld DE,(heros_y) ld HL,(entitee_coordy) call HL_inferieur_DE jp nc,en_dehors_collision pop hl ld a,(hl) inc hl push hl ld HL,(entitee_coordy) add a,l ld l,a call HL_inferieur_DE jp c,en_dehors_collision pop hl ld a,(hl) ; detection zone smiley ///////////////////////////////////////// cp 255 jr nz,zone_smiley_poursuit ld a,(dessine_1) ld (entitee_coordy),a ld a,(dessine_1+1) ld (entitee_coordx),a ld hl,smiley_data_collision_petite jp detecte_collision_barils zone_smiley_poursuit: cp 254 jr nz,zone_smiley_attrape ; LANCE COMBAT TADAM!!! ld b,110 ld c,170 ld hl,dragon_1 call dessine ld c,178 ld hl,dragon_2 call dessine ld c,186 ld hl,dragon_3 call dessine ld c,194 ld hl,dragon_4 call dessine ld c,202 ld hl,dragon_5 call dessine ld c,210 ld hl,dragon_6 call dessine jp fin_detection_entitee zone_smiley_attrape: ; les detections de barils ////////////////////////////////////// cp 250 jr nz,touche_au_barils ld a,(flag_entrer) cp 1 jp nz,fin_detection_entitee inc hl ld (hl),1 jp fin_detection_entitee touche_au_barils: ; les autres detections push hl cp 99 jr nc,collision_de_sortie pop hl inc a inc a ld (num_scene),a ld hl,0 ld (avance_scene),hl jp fin_detection_entitee collision_de_sortie: call fondue_au_noir pop hl ld a,(hl) cp 100 jr nz,sort_de_la_maison ld hl,48 ld (heros_x),hl ld hl,16 ld (heros_y),hl ld hl,carte_3 sort_de_la_maison: cp 101 jr nz,rentre_dans_la_maison ld hl,76 ld (heros_x),hl ld hl,40 ld (heros_y),hl ld hl,0 ld (ecran_x),hl ld (ecran_y),hl ld hl,carte_2 rentre_dans_la_maison: cp 102 jr nz,va_a_etage ld hl,carte_4 va_a_etage: cp 103 jr nz,va_rez_de_chausse ld hl,carte_2 va_rez_de_chausse: cp 104 jr nz,va_baraque_a_chsouris ld hl,9 ld (heros_x),hl ld hl,51 ld (heros_y),hl ld hl,0 ld (ecran_x),hl ld hl,16 ld (ecran_y),hl ld hl,maison_chauve_souris va_baraque_a_chsouris: cp 105 jr nz,de_chsouris_a_ville ld hl,139 ld (heros_x),hl ld hl,146 ld (heros_y),hl ld hl,88 ld (ecran_x),hl ld hl,112 ld (ecran_y),hl ld hl,carte_3 de_chsouris_a_ville: cp 106 jr nz,vers_msecret ld hl,67 ld (heros_x),hl ld hl,5 ld (heros_y),hl ld hl,0 ld (ecran_x),hl ld (ecran_y),hl ld hl,maison_passage_secret vers_msecret: cp 107 jr nz,de_msecret_a_ville ld hl,173 ld (heros_x),hl ld hl,18 ld (heros_y),hl ld hl,88 ld (ecran_x),hl ld hl,0 ld (ecran_y),hl ld hl,carte_3 de_msecret_a_ville: cp 108 jr nz,de_ville_vers_magasin ld hl,80 ld (heros_x),hl ld hl,16 ld (heros_y),hl ld hl,0 ld (ecran_x),hl ld (ecran_y),hl ld hl,magasin de_ville_vers_magasin: cp 109 jr nz,de_magasin_vers_ville ld hl,27 ld (heros_x),hl ld hl,55 ld (heros_y),hl ld hl,25 ld (ecran_y),hl ld hl,carte_3 de_magasin_vers_ville: cp 110 jr nz,passage_secret_vers_ville ld hl,168 ld (heros_x),hl ld hl,70 ld (heros_y),hl ld hl,56 ld (ecran_y),hl ld hl,88 ld (ecran_x),hl ld hl,carte_3 passage_secret_vers_ville: cp 111 jr nz,de_ville_vers_passage_secret ld hl,76 ld (heros_x),hl ld hl,44 ld (heros_y),hl ld hl,0 ld (ecran_y),hl ld (ecran_x),hl ld hl,maison_passage_secret de_ville_vers_passage_secret: call charge_map call drawcarte pop hl pop bc jp BOUCLE_PRINCIPALE en_dehors_collision: pop hl jp fin_detection_entitee entitee_zone_collision: ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cp 6 jp nz,baril push hl ld hl,tonneau call dessine pop hl push hl inc hl ; si le heros porte le tonneau inc hl inc hl ld a,(hl) cp 2 jr c,tonneau_en_vol ld bc,(entitee_coordx) ld de,(entitee_coordy) cp 2 jr nz,tonneau_vol_bas inc de inc de tonneau_vol_bas: cp 3 jr nz,tonneau_vol_droite inc bc inc bc tonneau_vol_droite: cp 4 jr nz,tonneau_vol_haut dec de dec de tonneau_vol_haut: cp 5 jr nz,tonneau_vol_gauche dec bc dec bc tonneau_vol_gauche: pop hl push hl inc hl ld a,(hl) dec a cp 0 jr nz,tonneau_scrache push hl ld de,6 sbc hl,de ld (hl),254 ld hl,(entitee_coordy) ld de,(entitee_coordx) call divise_coord_8 cp 55+128 jr nz,tonneau_defonce_mur ld (hl),56 call drawcarte tonneau_defonce_mur: pop hl tonneau_scrache: ld (hl),a dec hl dec hl ld (hl),e dec hl ld (hl),d dec hl ld (hl),c dec hl ld (hl),b xor a tonneau_en_vol: cp 1 jr nz,tonneau_sur_tete_heros ld a,(flag_entrer) cp 1 jp nz,lance_tonneau ld a,(heros_oriente) inc a inc a ld (hl),a lance_tonneau: ld hl,(heros_y) ld de,6 sbc hl,de ld d,h ld e,l pop hl dec hl ld (hl),e dec hl ld (hl),d ld de,(heros_x) dec de dec de dec hl ld (hl),e dec hl ld (hl),d jp fin_detection_entitee tonneau_sur_tete_heros: ld de,9 ld hl,(entitee_coordy) sbc hl,de ld (entitee_coordy),hl pop hl jp detecte_collision_barils baril: fin_detection_entitee: pop hl ld de,5 add hl,de pop bc dec b ld a,b cp 0 jp nz,Boucle_gerence_entitee .end