Skip to content

Commit 9dff771

Browse files
committed
+Creacion de cuadro de dialogo 32x32 por Sprites V.1.0, + Añadido compatiblidad con Pad3/6 para emular el SEGA MOUSE al puerto 2
1 parent a7be30e commit 9dff771

18 files changed

Lines changed: 175 additions & 94 deletions

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Plataforma: **SEGA Mega Drive/Genesis**
1111

1212
**+4 Zonas de pruebas** in game , aun en desarrollo:
1313

14+
**Sistema de cuadros de dialogos! Primera version Alpha Test**
15+
1416
![Test Zone 2](https://raw.githubusercontent.com/alicesim1/Penguin-World/main/screenshot/Zona2.JPG)
1517
![Test Zone 4](https://raw.githubusercontent.com/alicesim1/Penguin-World/main/screenshot/Zona4.JPG)
1618

@@ -27,9 +29,14 @@ Resolucion vertical a 240p para PAL 50Hrz, 224 para NTSC(EEUU/JAP) 60Hrz (Difere
2729
## Botones: ##
2830
**A + Start = Hard-Reset**
2931

32+
**A = Test dialogo 1**
33+
**B = Test dialogo 2**
34+
**C = Test dialogo 3**
35+
3036

3137
## SEGA Mouse##
32-
[[Puerto 2]] Opcionalmente!
38+
[[Puerto 2]] Opcionalmente!
39+
[Tambien compatible con PAD3/6 botones]
3340
Se visualiza un cursor de color verde, que se puede controlar con el raton!
3441
Por el momento no tiene interacion con nada... esta en desarrollo y estudio.
3542

@@ -47,5 +54,7 @@ Creado con [SGDK de Stephane](https://github.com/Stephane-D/SGDK)
4754

4855
Redes sociales:
4956
https://twitter.com/Alice_Sim1
57+
5058
https://www.twitch.tv/AliceSim1
59+
5160
https://www.youtube.com/user/simulatorone/

inc/global.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ u8 padtipo; //JOY_getPortType(PORT_1);
1414
u8 pad6; //JOY_getJoypadType(JOY_1);
1515
u8 padraton; //JOY_getPortType(PORT_2);
1616

17-
u16 BUTTONS[13];
17+
u16 BUTTONS[20];
1818
bool gat;
19-
20-
s16 readedX;
21-
s16 readedY;
22-
Vect2D_s16 joypos;
23-
2419

20+
Sprite* cursorsp;
21+
s16 readedX,readedY;
22+
Vect2D_s16 joypos;
2523
void _JOYsetXY ( s16 x, s16 y );
2624
void _JOYupdateMouse ();
2725

res/DiagBox1.png

168 Bytes
Loading

res/DiagBox2.png

176 Bytes
Loading

res/DiagBox3.png

158 Bytes
Loading

res/basicos.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#ifndef _RES_BASICOS_H_
22
#define _RES_BASICOS_H_
33

4+
extern const TileSet font2;
45
extern const SpriteDefinition penguin;
56
extern const SpriteDefinition cursor;
67
extern const SpriteDefinition dig_marco1;
78
extern const SpriteDefinition dig_marco2;
9+
extern const SpriteDefinition dig_marco3;
10+
extern const SpriteDefinition dig_marco4;
811

912
#endif // _RES_BASICOS_H_

res/basicos.res

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
//TILESET font1 "font_1c.png" BEST NONE
1+
TILESET font2 "font_1b.png" BEST NONE
22
SPRITE penguin "pingu1.png" 3 4 BEST
33
SPRITE cursor "cursor.png" 1 1 BEST
4-
SPRITE dig_marco1 "DiagBoxF.png" 28 8 BEST
5-
SPRITE dig_marco2 "DiagBoxD.png" 24 4 BEST
4+
SPRITE dig_marco1 "DiagBox1.png" 1 1 BEST
5+
SPRITE dig_marco2 "DiagBox2.png" 4 1 BEST
6+
SPRITE dig_marco3 "DiagBox3.png" 1 4 BEST
7+
SPRITE dig_marco4 "sombra-dirtering32.png" 4 4 BEST
8+
//SPRITE dig_marco4 "sombra-Num.png" 4 4 BEST

res/sombra-Num.png

680 Bytes
Loading
427 Bytes
Loading

src/main.c

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#include "../inc/global.h"
77
//-----------------------------------------------------
88

9+
10+
s16 readX,readY; //_JOYupdateMouse(); Coordenadas absolutas del puntero raton
11+
912
//Definiciones de las funciones---------------------------------------------------
1013
static void inputHandler(u16,u16,u16);
1114

@@ -28,10 +31,12 @@ void main(u16 hard){
2831
ScreenTY=8+(ScreenY*8);//224/240
2932
ScreenMY=ScreenTY/2;//112/120
3033
//--------------------------------------
31-
32-
padtipo=JOY_getPortType(PORT_1);
34+
35+
padtipo=JOY_getPortType(PORT_1); JOY_setSupport(PORT_1,JOY_SUPPORT_6BTN);
3336
padraton=JOY_getPortType(PORT_2);
3437
if(padraton==PORT_TYPE_MOUSE) JOY_setSupport(PORT_2, JOY_SUPPORT_MOUSE);
38+
else JOY_setSupport(PORT_1,JOY_SUPPORT_3BTN);
39+
3540
SYS_doVBlankProcess(); // Necesario para detecte el JoypadType
3641
pad6=JOY_getJoypadType(JOY_1);
3742
JOY_setEventHandler(&inputHandler);
@@ -71,25 +76,36 @@ void inputHandler(u16 joy, u16 state, u16 changed){
7176

7277
BUTTONS[0]=changed;
7378

74-
if(joy==JOY_1){
75-
79+
if(joy==JOY_1){ //PORT 1
7680
BUTTONS[1]=changed & BUTTON_UP;
7781
BUTTONS[2]=changed & BUTTON_DOWN;
7882
BUTTONS[3]=changed & BUTTON_LEFT;
7983
BUTTONS[4]=changed & BUTTON_RIGHT;
8084

85+
BUTTONS[5]=changed & BUTTON_A;//Boton Central
86+
BUTTONS[6]=changed & BUTTON_B;//Boton Izquiero
87+
BUTTONS[7]=changed & BUTTON_C;//Boton Derecho
88+
8189
BUTTONS[8]=changed & BUTTON_START;
8290
if(pad6==1){
8391
BUTTONS[9]=changed & BUTTON_X;
8492
BUTTONS[10]=changed & BUTTON_Y;
8593
BUTTONS[11]=changed & BUTTON_Z;
8694
BUTTONS[12]=changed & BUTTON_MODE;
8795
}
96+
}else { //PORT 2
97+
98+
if(padraton==PORT_TYPE_PAD){
99+
BUTTONS[13]=changed & BUTTON_UP;
100+
BUTTONS[14]=changed & BUTTON_DOWN;
101+
BUTTONS[15]=changed & BUTTON_LEFT;
102+
BUTTONS[16]=changed & BUTTON_RIGHT;
103+
}
104+
105+
BUTTONS[17]=changed & BUTTON_A;//Boton Central
106+
BUTTONS[18]=changed & BUTTON_B;//Boton Izquiero
107+
BUTTONS[19]=changed & BUTTON_C;//Boton Derecho
88108
}
89-
//necesario para que el mouse puerto 2 funcione los 3 botones
90-
BUTTONS[5]=changed & BUTTON_A;//Boton Central
91-
BUTTONS[6]=changed & BUTTON_B;//Boton Izquiero
92-
BUTTONS[7]=changed & BUTTON_C;//Boton Derecho
93109

94110
}
95111

@@ -102,15 +118,29 @@ void _JOYsetXY ( s16 x, s16 y )
102118
readedX = JOY_readJoypadX(JOY_2);
103119
readedY = JOY_readJoypadY(JOY_2);
104120

121+
readX=readY=0;
122+
105123
joypos.x = x;
106124
joypos.y = y;
125+
126+
SPR_setPosition(cursorsp,x,y);
107127
}
108128

109129
void _JOYupdateMouse ()
110130
{
111-
s16 readX = JOY_readJoypadX(JOY_2);
112-
s16 readY = JOY_readJoypadY(JOY_2);
113-
131+
if(padraton==PORT_TYPE_MOUSE){
132+
readX = JOY_readJoypadX(JOY_2);
133+
readY = JOY_readJoypadY(JOY_2);
134+
}else{
135+
//BUG Solo en emulador GENS! No funciona los diagonales!
136+
//usando un Gamepad!! teclado si funciona!
137+
if(BUTTONS[13]) readY-=2;
138+
else if(BUTTONS[14]) readY+=2;
139+
140+
if(BUTTONS[15]) readX-=2;
141+
else if(BUTTONS[16]) readX+=2;
142+
}
143+
114144
joypos.x -= readedX - readX;
115145
joypos.y -= readedY - readY;
116146

@@ -122,5 +152,7 @@ void _JOYupdateMouse ()
122152

123153
readedX = readX;
124154
readedY = readY;
155+
156+
SPR_setPosition(cursorsp,joypos.x,joypos.y);
125157
}
126158

0 commit comments

Comments
 (0)