@@ -283,7 +283,8 @@ unsigned char clipped[384]; // HSP index +1 ou zero si rien
283283int adr ;
284284};
285285
286-
286+ //#define DBG printf("line %d\n",__LINE__);
287+ #define DBG ;
287288
288289int compare_hsp (const void * a , const void * b )
289290{
@@ -452,7 +453,7 @@ enum e_module {
452453 TxtReplace (scrfilename1 ,".bmp" ,".sc1" ,0 );
453454 strcpy (scrfilename2 ,filename );
454455 TxtReplace (scrfilename2 ,".bmp" ,".sc2" ,0 );
455-
456+ printf ( "load BMP file\n" );
456457 if (loadBMP (filename ,& bpixels ,& bwidth ,& bheight )) {
457458 logerr ("cannot read BMP" );
458459 exit (ABORT_ERROR );
@@ -462,6 +463,7 @@ enum e_module {
462463 photo -> color_type = PNG_COLOR_TYPE_RGB ;
463464 photo -> width = bwidth ;
464465 photo -> height = bheight ;
466+ photo -> bit_depth = 8 ;
465467 photo -> data = MemMalloc (bwidth * bheight * 3 );
466468 // from RGBA to RGB
467469 for (l = 0 ;l < bwidth * bheight ;l ++ ) {
@@ -478,7 +480,7 @@ enum e_module {
478480 logerr ("cannot read BMP" );
479481 exit (ABORT_ERROR );
480482 }
481- loginfo ("PNG image is %dx%dx%d" ,photo -> width ,photo -> height ,photo -> bit_depth );
483+ loginfo ("BMP image is %dx%dx%d" ,photo -> width ,photo -> height ,photo -> bit_depth );
482484 if (photo -> color_type != PNG_COLOR_TYPE_RGB ) {
483485 logerr ("PNG image must be RGB without transparency" ,filename );
484486 exit (ABORT_ERROR );
@@ -744,6 +746,7 @@ enum e_module {
744746 }
745747 }
746748 }
749+ DBG
747750 /************************************ compute GFX colorz ***********************************/
748751 if (computeglobal ) {
749752 unsigned char * newpix ;
@@ -804,6 +807,7 @@ enum e_module {
804807 if (wasmoving ) wasmoving = 1 + curhsp ;
805808 }
806809 }
810+ DBG
807811
808812 /* on découpe en groupes selon l'espacement vertical entre les sprites hards */
809813 group = 0 ;
@@ -854,7 +858,7 @@ enum e_module {
854858 rawinfo .nbcolor ++ ;
855859 }
856860 /* on met à jour le clipped mask de l'écran */
857- for (i = 0 ;i < nbhsp ;i ++ ) {
861+ for (i = lastsp = 0 ;i < nbhsp ;i ++ ) {
858862 if (hsp [i ].group == igroup ) {
859863 memcpy (hsp [i ].palette ,tmppalette ,sizeof (tmppalette ));
860864 lasty = hsp [i ].y + 16 ;
@@ -880,6 +884,7 @@ enum e_module {
880884 x ++ ;
881885 }
882886 } else {
887+ DBG
883888 /* insert colors in rastamix */
884889 asicad = 0x6422 ;
885890 x = 0 ;
@@ -893,8 +898,10 @@ enum e_module {
893898 }
894899 }
895900 previouslasty = lasty ;
901+ DBG
896902 ImageRAWFreeStruct (& rawinfo );
897903 }
904+ DBG
898905
899906 /*************************************************************************************************************
900907 **************************************************************************************************************
@@ -914,6 +921,7 @@ enum e_module {
914921 scanline [j * 3 + 1 ]= (photo -> data [j * 6 + 1 ]+ photo -> data [j * 6 + 4 ])* 0.5 ;
915922 scanline [j * 3 + 2 ]= (photo -> data [j * 6 + 2 ]+ photo -> data [j * 6 + 5 ])* 0.5 ;
916923 }
924+ DBG
917925 /*****************************************************************
918926 on élimine les données cachées par les sprites hard
919927 *****************************************************************/
@@ -937,6 +945,7 @@ enum e_module {
937945 refl = rastamix [0 ].l = colorz_create_palette (clippedscanline ,sizeclip ,rastamix [0 ].palette ,0 );
938946 rastamix [1 ].l = refl ;
939947 memcpy (rastamix [1 ].palette ,rastamix [0 ].palette ,sizeof (rastamix [0 ].palette ));
948+ DBG
940949
941950 /****************************************************************************************
942951 l i g n e s s u i v a n t e s . . .
@@ -957,6 +966,7 @@ enum e_module {
957966 sizeclip ++ ;
958967 }
959968 }
969+ DBG
960970
961971 /****************************************************************************************
962972 on fait une première passe pour avoir une palette complète dès la première ligne
@@ -994,6 +1004,7 @@ enum e_module {
9941004 /****************************************************************************************
9951005 A F T E R R E B O O T
9961006 ****************************************************************************************/
1007+ DBG
9971008
9981009 /* on s'fait pas chier, on garde les 12 couleurs les plus utilisées avec la palette de la ligne précédente */
9991010 memset (cptrefpal ,0 ,sizeof (cptrefpal ));
0 commit comments