@@ -13,78 +13,54 @@ static void inputHandler(u16,u16,u16);
1313void main (u16 hard ){
1414 if (!hard ){
1515 SYS_hardReset (); //si se hace Soft-Reset, probocamos limpieza total de la RAM!
16- KLog ("RESET!" );
16+ KLog ("Soft RESET!" );
1717 }
1818
19- if (IS_PALSYSTEM ){
20- KLog ("PAL-240" );
19+ if (IS_PALSYSTEM ){ //KLog("PAL-240");
2120 VDP_setScreenHeight240 ();//29(30) tiles x8 (Solo para PAL = 50FPS) NTSC No puede usar este modo!
2221 ScreenY = 29 ;
2322 ScreTile8 = 8 ;
2423 }
25- else {
26- KLog ("NTSC-224" );
24+ else { //KLog("NTSC-224");
2725 ScreenY = 27 ;
2826 ScreTile8 = 0 ;
2927 }
30-
31- //KLog_U1("ScreenY:",ScreenY);
32- //KLog_S1("fixAlturaY:",fixAlturaY);
3328 ScreenTY = 8 + (ScreenY * 8 );//224/240
3429 ScreenMY = ScreenTY /2 ;//112/120
35-
36- //KLog_U1("ScreenTY:",ScreenTY);
37- //KLog_U1("ScreenMY:",ScreenMY);
3830 //--------------------------------------
39- //KLog("---------------");
40-
41- padtipo = JOY_getPortType (PORT_1 );//13 =
42- //padtipo=15;//NINGUNO
43- //padtipo=13;//PAD3,6
44- //padtipo=0;//MOUSE
4531
32+ padtipo = JOY_getPortType (PORT_1 );
4633 padraton = JOY_getPortType (PORT_2 );
47- if (padraton == PORT_TYPE_MOUSE ) JOY_setSupport (PORT_2 , JOY_SUPPORT_MOUSE ); //3
48- //padraton=15;//NINGUNO
49- //padraton=13;//PAD3,6
50- //padraton=3;//MOUSE
51-
52- SYS_doVBlankProcess (); // Renderizamos la pantalla
53-
34+ if (padraton == PORT_TYPE_MOUSE ) JOY_setSupport (PORT_2 , JOY_SUPPORT_MOUSE );
35+ SYS_doVBlankProcess (); // Necesario para detecte el JoypadType
5436 pad6 = JOY_getJoypadType (JOY_1 );
55- //0=3 botones
56- //1=6 botones
57- //15=NINGUNO
58-
5937 JOY_setEventHandler (& inputHandler );
6038
6139 //TITUTLO();
6240
63- //PAL_setColors(0,palette_black,64,CPU);
41+
42+ VDP_setWindowVPos (1 ,ScreenY - 2 );// 27max vertical Windows
43+ VDP_setTextPlane (WINDOW );//Textos "normales SGDK" se pintan en Window es temporal
44+ PAL_setColors (0 ,palette_black ,64 ,CPU );//para iniciacion Debug
45+
6446 ZoneMap ();
6547
6648}
6749
68- /*
69- void play_music(u8 indice){
70- switch(indice){
71- case 1:XGM_startPlay(M_titulo);break;
72- case 2:XGM_startPlay(M_zone1);break;
73- default: XGM_stopPlay();
74- }
75- }
76- */
7750
7851//https://github.com/diegomtassis/yamd-library/blob/master/src/fwk/commons.c#L40
7952u8 randU8 (u8 lower , u8 higher ) {
8053 return lower + random () % (higher + 1 - lower );
8154}
8255
56+ //https://danibus.wordpress.com/2019/08/29/99-aventuras-en-megadrive-debug/
57+ //PROBLEMAS DE CONVERSIÓN CON SPRINTF -> ¿Y si quiero usar variables de 32 bits?
8358void VDP_drawInt (s32 valor ,u8 ceros ,u8 x , u8 y ){
8459 intToStr (valor ,char_salida ,ceros ); //MIN -500.000.000 - MAX 500.000.000
8560 VDP_drawText (char_salida ,x ,y );
8661}
8762
63+
8864/**
8965 * Manejador de entrada
9066 * joy-> Indica el mando que ha activado la entrada
@@ -103,21 +79,24 @@ void inputHandler(u16 joy, u16 state, u16 changed){
10379 BUTTONS [4 ]= changed & BUTTON_RIGHT ;
10480
10581 BUTTONS [8 ]= changed & BUTTON_START ;
106- // if(pad6==1){
82+ if (pad6 == 1 ){
10783 BUTTONS [9 ]= changed & BUTTON_X ;
10884 BUTTONS [10 ]= changed & BUTTON_Y ;
10985 BUTTONS [11 ]= changed & BUTTON_Z ;
11086 BUTTONS [12 ]= changed & BUTTON_MODE ;
111- // }
87+ }
11288 }
113-
89+ //necesario para que el mouse puerto 2 funcione los 3 botones
11490 BUTTONS [5 ]= changed & BUTTON_A ;//Boton Central
11591 BUTTONS [6 ]= changed & BUTTON_B ;//Boton Izquiero
11692 BUTTONS [7 ]= changed & BUTTON_C ;//Boton Derecho
11793
11894}
11995
120-
96+ /* Bug Hunt - https://github.com/moon-watcher/BugHuntMD
97+ * @CODE: => Mun | Twitter: @MoonWatcherMD
98+ * @CODE-ASSISTANT: => Jack Nolddor | Twitter: @nolddor, Mail to:
99+ */
121100void _JOYsetXY ( s16 x , s16 y )
122101{
123102 readedX = JOY_readJoypadX (JOY_2 );
@@ -127,7 +106,6 @@ void _JOYsetXY ( s16 x, s16 y )
127106 joypos .y = y ;
128107}
129108
130-
131109void _JOYupdateMouse ()
132110{
133111 s16 readX = JOY_readJoypadX (JOY_2 );
0 commit comments