- [NEW] Es pot navegar entre habitacions pulsant el nombres de les vores
- [FIX] usar mouseClk() en el treeview - [FIX] Al crear nova habitació s¡obri la porta contraria en l'habitació des de la que se venia.
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
width: 3
|
||||
height: 1
|
||||
door-height-xp: 0
|
||||
door-height-xn: 0
|
||||
color: CYAN
|
||||
floor-texture: 0
|
||||
wall-texture: 2
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xp: 1
|
||||
exit-xn: 4
|
||||
|
||||
actor{
|
||||
name: MESITA
|
||||
@@ -18,36 +20,6 @@ actor{
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: FINESTRA01
|
||||
bmp: altres.gif
|
||||
bmp-rect: 0 75 20 33
|
||||
bmp-offset: 0 39
|
||||
pos: 0 23 6
|
||||
size: 1 1 9
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: FINESTRA
|
||||
bmp: altres.gif
|
||||
bmp-rect: 0 75 20 33
|
||||
bmp-offset: 0 39
|
||||
pos: 0 30 6
|
||||
size: 1 1 9
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: LAMPARA
|
||||
bmp: altres.gif
|
||||
bmp-rect: 128 0 20 41
|
||||
bmp-offset: -6 45
|
||||
pos: 1 41 0
|
||||
size: 6 6 16
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: LLIT
|
||||
bmp: altres.gif
|
||||
@@ -77,3 +49,33 @@ actor{
|
||||
size: 6 4 2
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: FINESTRA01
|
||||
bmp: altres.gif
|
||||
bmp-rect: 0 75 20 33
|
||||
bmp-offset: 0 39
|
||||
pos: 0 23 6
|
||||
size: 1 1 9
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: FINESTRA
|
||||
bmp: altres.gif
|
||||
bmp-rect: 0 75 20 33
|
||||
bmp-offset: 0 39
|
||||
pos: 0 30 6
|
||||
size: 1 1 9
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: LAMPARA
|
||||
bmp: altres.gif
|
||||
bmp-rect: 128 0 20 41
|
||||
bmp-offset: -6 45
|
||||
pos: 1 41 0
|
||||
size: 6 6 16
|
||||
movement: CW
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ floor-texture: 0
|
||||
wall-texture: 2
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xp: 2
|
||||
exit-xn: 0
|
||||
|
||||
actor{
|
||||
|
||||
11
data/rooms/02.txt
Normal file
11
data/rooms/02.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
width: 2
|
||||
height: 2
|
||||
door-height-xn: 0
|
||||
door-height-yn: 0
|
||||
color: CYAN
|
||||
floor-texture: 0
|
||||
wall-texture: 0
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xn: 1
|
||||
exit-yn: 3
|
||||
11
data/rooms/03.txt
Normal file
11
data/rooms/03.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
width: 2
|
||||
height: 2
|
||||
door-height-xn: 0
|
||||
door-height-yp: 0
|
||||
color: CYAN
|
||||
floor-texture: 0
|
||||
wall-texture: 0
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xn: 5
|
||||
exit-yp: 2
|
||||
9
data/rooms/04.txt
Normal file
9
data/rooms/04.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
width: 2
|
||||
height: 2
|
||||
door-height-xp: 0
|
||||
color: CYAN
|
||||
floor-texture: 0
|
||||
wall-texture: 0
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xp: 0
|
||||
11
data/rooms/05.txt
Normal file
11
data/rooms/05.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
width: 2
|
||||
height: 2
|
||||
door-height-xp: 0
|
||||
door-height-xn: 0
|
||||
color: CYAN
|
||||
floor-texture: 0
|
||||
wall-texture: 0
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xp: 3
|
||||
exit-xn: 6
|
||||
9
data/rooms/06.txt
Normal file
9
data/rooms/06.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
width: 2
|
||||
height: 2
|
||||
door-height-xp: 0
|
||||
color: CYAN
|
||||
floor-texture: 0
|
||||
wall-texture: 0
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xp: 5
|
||||
@@ -568,23 +568,29 @@ namespace draw
|
||||
for (int i=0;i<len;++i)
|
||||
{
|
||||
char chr = text[i]-32;
|
||||
draw((x+i)*8, y*8, 8, 8, (chr&15)*8, (chr>>4)*8, DRAW_FLIP_NONE,zoom&FONT_ZOOM_HORIZONTAL?16:8, zoom&FONT_ZOOM_VERTICAL?16:8);
|
||||
draw((x+(i*(zoom&FONT_ZOOM_HORIZONTAL?2:1)))*8, y*8, 8, 8, (chr&15)*8, (chr>>4)*8, DRAW_FLIP_NONE,zoom&FONT_ZOOM_HORIZONTAL?16:8, zoom&FONT_ZOOM_VERTICAL?16:8);
|
||||
}
|
||||
source = tmp;
|
||||
}
|
||||
|
||||
void print2(const int num, const int positions, const int x, const int y, const uint8_t color, const int zoom)
|
||||
{
|
||||
char buffer[positions+1];
|
||||
int digit = positions-1;
|
||||
int value = num;
|
||||
const char empty = positions < 0 ? '0' : ' ';
|
||||
const int pos = positions < 0 ? -positions : positions;
|
||||
char buffer[pos+1];
|
||||
int digit = pos-1;
|
||||
int value = num<0 ? -num : num;
|
||||
while (digit>=0)
|
||||
{
|
||||
buffer[digit] = (value%10)==0 && digit<positions-1 ? 32 : (value%10)+48;
|
||||
value = value/10;
|
||||
if (digit==0 && num<0) {
|
||||
buffer[digit] = '-';
|
||||
} else {
|
||||
buffer[digit] = (value%10)==0 && digit<pos-1 ? empty : (value%10)+48;
|
||||
value = value/10;
|
||||
}
|
||||
digit--;
|
||||
}
|
||||
buffer[positions]=0;
|
||||
buffer[pos]=0;
|
||||
print2(buffer, x, y, color, zoom);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
|
||||
game::params = argv;
|
||||
|
||||
game::init();
|
||||
input::init(draw::getZoom());
|
||||
input::init();
|
||||
|
||||
static unsigned int current_ticks = SDL_GetTicks();
|
||||
|
||||
|
||||
@@ -9,12 +9,10 @@ namespace input
|
||||
static uint8_t keydown = 0;
|
||||
static uint8_t btnClicked = 0;
|
||||
static int wheel = 0;
|
||||
static int screen_zoom = 1;
|
||||
|
||||
void init(const int zoom)
|
||||
void init()
|
||||
{
|
||||
keys = SDL_GetKeyboardState(NULL);
|
||||
screen_zoom = zoom;
|
||||
}
|
||||
|
||||
// Determina si la tecla especificada està sent polsada ara mateix
|
||||
@@ -76,7 +74,7 @@ namespace input
|
||||
{
|
||||
int x;
|
||||
SDL_GetMouseState(&x, NULL);
|
||||
return x/screen_zoom;
|
||||
return x/draw::getZoom();
|
||||
}
|
||||
|
||||
// Torna la posició Y actual del ratolí
|
||||
@@ -84,7 +82,7 @@ namespace input
|
||||
{
|
||||
int y;
|
||||
SDL_GetMouseState(NULL, &y);
|
||||
return y/screen_zoom;
|
||||
return y/draw::getZoom();
|
||||
}
|
||||
|
||||
// Determina si el botó del ratolí especificat està sent polsada ara mateix
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
namespace input
|
||||
{
|
||||
/// @brief Inicialitza els sistemes de teclat, ratolí i gamepad
|
||||
void init(const int zoom);
|
||||
void init();
|
||||
|
||||
/// @brief Determina si la tecla especificada està sent polsada ara mateix
|
||||
/// @param key tecla a consultar
|
||||
|
||||
@@ -375,7 +375,25 @@ namespace modules
|
||||
}
|
||||
|
||||
|
||||
draw::print2(room::getExit(XN), -2, 1, 1, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2(room::getExit(YN), -2, 38, 1, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2(room::getExit(XP), -2, 38, 28, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2(room::getExit(YP), -2, 1, 28, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2(room::getExit(ZP), -2, 19, 1, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2(room::getExit(ZN), -2, 19, 28, TEAL, FONT_ZOOM_NONE);
|
||||
|
||||
draw::print2(room::getCurrent(), -2, 4, 3, WHITE, FONT_ZOOM_BOTH);
|
||||
|
||||
if (input::mouseClk(1)) {
|
||||
const int mx = draw::getLocalX(input::mouseX());
|
||||
const int my = draw::getLocalY(input::mouseY());
|
||||
if (mx<32 && my<24) room::load(room::editor::refExit(XN), XP);
|
||||
if (mx>288 && my<24) room::load(room::editor::refExit(YN), YP);
|
||||
if (mx>288 && my>216) room::load(room::editor::refExit(XP), XN);
|
||||
if (mx<32 && my>216) room::load(room::editor::refExit(YP), YN);
|
||||
if (mx>144 && mx<176 && my<24) room::load(room::editor::refExit(ZP), ZN);
|
||||
if (mx>144 && mx<176 && my>216) room::load(room::editor::refExit(ZN), ZP);
|
||||
}
|
||||
|
||||
ui::start();
|
||||
|
||||
@@ -412,6 +430,7 @@ namespace modules
|
||||
const int mx = draw::getLocalX(input::mouseX());
|
||||
const int my = draw::getLocalY(input::mouseY());
|
||||
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
||||
const bool btnClk = input::mouseClk(1) || input::mouseClk(3);
|
||||
|
||||
if (mx>=0 && mx <=100 && my>=0 && my<=221)
|
||||
{
|
||||
@@ -449,7 +468,7 @@ namespace modules
|
||||
draw::color(LIGHT+BLUE);
|
||||
draw::fillrect(4, 2+line*9, 92, 9);
|
||||
}
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnClk) {
|
||||
if (i == room::editor::getCurrentRoom()) {
|
||||
section = SECTION_ACTOR;
|
||||
} else {
|
||||
@@ -464,7 +483,7 @@ namespace modules
|
||||
}
|
||||
} else if (section==SECTION_ACTOR)
|
||||
{
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnClk) {
|
||||
section = SECTION_ROOM;
|
||||
}
|
||||
|
||||
@@ -482,7 +501,7 @@ namespace modules
|
||||
draw::color(LIGHT+BLUE);
|
||||
draw::fillrect(4, 2+line*9, 92, 9);
|
||||
}
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnClk) {
|
||||
actor::select(act);
|
||||
section = SECTION_ACTOR;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace room
|
||||
if (room > MAX_ROOMS || room < 0) {
|
||||
room = find_next_room();
|
||||
exits[inverse_door(door)] = room;
|
||||
if (door<4 && door_height[door]==-1) door_height[door]=0;
|
||||
if (door<4 && door_height[inverse_door(door)]==-1) door_height[inverse_door(door)]=0;
|
||||
modified = true;
|
||||
}
|
||||
|
||||
@@ -446,6 +446,11 @@ namespace room
|
||||
num_color_cycles = times;
|
||||
}
|
||||
|
||||
int getCurrent()
|
||||
{
|
||||
return current_room;
|
||||
}
|
||||
|
||||
vec3_t getSize()
|
||||
{
|
||||
return size;
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace room
|
||||
void draw2();
|
||||
void cycleColor(int times);
|
||||
|
||||
int getCurrent();
|
||||
vec3_t getSize();
|
||||
vec3_t getMin();
|
||||
vec3_t getMax();
|
||||
|
||||
Reference in New Issue
Block a user