From 7365d72360800b46921d67ea1f85a01231047429 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Wed, 10 Jul 2024 19:44:23 +0200 Subject: [PATCH] =?UTF-8?q?-=20[FIX]=20Ja=20eix=20correctament=20del=20edi?= =?UTF-8?q?tor=20-=20[NEW]=20M=C3=A9s=20gr=C3=A0fics=20-=20[NEW]=20Ara=20e?= =?UTF-8?q?s=20pot=20modificar=20el=20valor=20dels=20camps=20escribint=20e?= =?UTF-8?q?l=20numero?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/altres.gif | Bin 2763 -> 3292 bytes data/rooms/00.txt | 18 ++--- data/rooms/09.txt | 179 ++++++++++++++++++++++++++++++++++++++++++++- data/templates.txt | 10 +++ source/jui.cpp | 35 ++++++--- source/jui.h | 3 +- source/m_game.cpp | 11 +-- source/main.cpp | 8 +- 8 files changed, 229 insertions(+), 35 deletions(-) diff --git a/data/altres.gif b/data/altres.gif index bcb423daca28029d49ff8acb95f4210935e85568..83ef21489f501ab8162f508aadaedcac6c7aaa6c 100644 GIT binary patch delta 2088 zcmV+@2-o+^72FxH%mjZ`f;)%#7vm#benIDVf7rZCurIgT*0`@AYU&5xQ?B>7uNeOO z>#tM&w@Z=U3Nyg`IZA+NLm&W6mZDBUjYC zXDu;`XnJEqaKn)BLCzjCDia>v!n2(};&y7_=DlxM}AxzuXB$gxv(=|fgr zfil-IHM9rV>(5)s$X5WS>8cCrt6(38*ZJjTu!w!0nG(xb+flHwkR|N8B1>7BTBNd= zRp)9l%h|Ceth0%&D`-cnIEa$=v_KUtYDw!y)2@Fuvyf8lYb)yysm}JbtMcbO(_CE27PSfWip1<#z<6!Syyw;F19fY`WWLY76uBC7^UJG%-HS_c zyJmkxA9YCL7I?DnBcKg~BEjpP_rc6DEX&>-;By%_xftG10$Bzeh=9;&9A<2Y4cJo> zYtzJ2LNRj%yW-8ZSBcYACNi(a-_h3CzY9jNdikZB0*RLlySrXn3DaN=h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|KA$%z_w`4o_o>lSVrbZQC3~z z@pwZxoUZH+>|KQZ?jq58b(Sj|VX%IgyjH8RWH?u=^rZG53CC(#O3323&dGm}1}%5= zvU4zGy<4tpJTZ6KbM6Gq7j|?q7bp~kB zMQ(LxUbaA_*sj`%>Ca6a%8QjsKpnr{&F`tfnos%Ca}{g4^xm5a&OCk8Tqdq^()Bvd z_v7W-U{#kDOL|7Ha^qIvu2z3s>Lq18)g^ZDk-uv9NYs8k_uBKQ(>(cM-F_)+Z+Ylv zA86_~8PubO_b0=D{N7c_*E1IV^y7bU4nluu!cs`$7gmtdUkLYm6n1|GICO{?7;#2U ztk+#~79?)PT}0Pwo|9=Y^iFWsLAvl`!DMrnhH-}#IpC#aCgxBIsDcZ(0TV7LXf+c8 F06S2E_ErD@ diff --git a/data/rooms/00.txt b/data/rooms/00.txt index b6554fb..061bf88 100644 --- a/data/rooms/00.txt +++ b/data/rooms/00.txt @@ -11,15 +11,6 @@ exit-xp: 5 exit-xn: 1 exit-zn: 2 -actor{ - name: PLATFORM02 - bmp: test.gif - bmp-rect: 64 0 32 24 - bmp-offset: 0 24 - pos: 16 20 0 - size: 8 8 4 -} - actor{ name: PLATFORM00 bmp: test.gif @@ -29,6 +20,15 @@ actor{ size: 8 8 4 } +actor{ + name: PLATFORM02 + bmp: test.gif + bmp-rect: 64 0 32 24 + bmp-offset: 0 24 + pos: 16 20 0 + size: 8 8 4 +} + actor{ name: PLATFORM01 bmp: test.gif diff --git a/data/rooms/09.txt b/data/rooms/09.txt index 5410409..b1f2fb5 100644 --- a/data/rooms/09.txt +++ b/data/rooms/09.txt @@ -6,12 +6,189 @@ wall-texture: 0 door-texture: 0 under-door-texture: 0 +actor{ + name: BOX + bmp: caixes.gif + bmp-rect: 0 64 32 32 + bmp-offset: 0 32 + pos: 0 0 0 + size: 8 8 4 + movement: CW +} + +actor{ + name: BOX05 + bmp: altres.gif + bmp-rect: 128 0 20 42 + bmp-offset: -5 46 + pos: 0 0 4 + size: 8 8 8 + movement: CW +} + +actor{ + name: KALLAX-A + bmp: altres.gif + bmp-rect: 0 48 24 27 + bmp-offset: 0 31 + pos: 0 8 0 + size: 4 8 8 + movement: CW +} + +actor{ + name: KALLAX-A03 + bmp: altres.gif + bmp-rect: 72 48 24 27 + bmp-offset: 0 31 + pos: 0 16 0 + size: 4 8 8 + movement: CW +} + +actor{ + name: KALLAX-A04 + bmp: altres.gif + bmp-rect: 72 48 24 27 + bmp-offset: -8 31 + pos: 8 0 0 + size: 8 4 8 + orient: YP + flags: ORIENTABLE + movement: CW +} + +actor{ + name: KALLAX-A05 + bmp: altres.gif + bmp-rect: 96 48 24 27 + bmp-offset: -8 31 + pos: 8 0 8 + size: 8 4 8 + orient: YP + flags: ORIENTABLE + movement: CW +} + actor{ name: ARCADE bmp: altres.gif bmp-rect: 160 0 30 48 bmp-offset: 0 48 - pos: 0 0 0 + pos: 16 0 0 size: 8 8 16 movement: CW } + +actor{ + name: BOX01 + bmp: caixes.gif + bmp-rect: 128 32 32 32 + bmp-offset: 0 32 + pos: 16 24 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: KALLAX-A07 + bmp: altres.gif + bmp-rect: 96 48 24 27 + bmp-offset: -8 31 + pos: 24 0 0 + size: 8 4 8 + orient: YP + flags: ORIENTABLE + movement: CW +} + +actor{ + name: BOX02 + bmp: caixes.gif + bmp-rect: 160 32 32 32 + bmp-offset: 0 32 + pos: 24 24 0 + size: 8 8 8 + react-push: XP + movement: CW +} + +actor{ + name: KALLAX-A08 + bmp: altres.gif + bmp-rect: 24 48 24 27 + bmp-offset: -8 31 + pos: 32 0 0 + size: 8 4 8 + orient: YP + flags: ORIENTABLE + movement: CW +} + +actor{ + name: KALLAX-A01 + bmp: altres.gif + bmp-rect: 24 48 24 27 + bmp-offset: 0 31 + pos: 0 8 8 + size: 4 8 8 + movement: CW +} + +actor{ + name: KALLAX-A02 + bmp: altres.gif + bmp-rect: 48 48 24 27 + bmp-offset: 0 31 + pos: 0 16 8 + size: 4 8 8 + movement: CW +} + +actor{ + name: BOX03 + bmp: caixes.gif + bmp-rect: 128 0 32 32 + bmp-offset: 0 32 + pos: 16 24 8 + size: 8 8 8 + react-push: XP + movement: CW +} + +actor{ + name: KALLAX-A06 + bmp: altres.gif + bmp-rect: 72 48 24 27 + bmp-offset: -8 31 + pos: 24 0 8 + size: 8 4 8 + orient: YP + flags: ORIENTABLE + movement: CW +} + +actor{ + name: BOX04 + bmp: caixes.gif + bmp-rect: 32 64 32 32 + bmp-offset: 0 32 + pos: 24 24 8 + size: 8 8 8 + orient: YP + flags: ORIENTABLE + react-push: XP + movement: CW +} + +actor{ + name: KALLAX-A09 + bmp: altres.gif + bmp-rect: 0 48 24 27 + bmp-offset: -8 31 + pos: 32 0 8 + size: 8 4 8 + orient: YP + flags: ORIENTABLE + movement: CW +} diff --git a/data/templates.txt b/data/templates.txt index 28a4b07..bc2a357 100644 --- a/data/templates.txt +++ b/data/templates.txt @@ -177,3 +177,13 @@ actor{ size: 16 16 6 movement: CW } + +actor{ + name: KALLAX-A + bmp: altres.gif + bmp-rect: 0 48 24 27 + bmp-offset: 0 31 + pos: 0 0 0 + size: 8 4 8 + movement: CW +} diff --git a/source/jui.cpp b/source/jui.cpp index 10f9912..e7f299d 100644 --- a/source/jui.cpp +++ b/source/jui.cpp @@ -6,7 +6,14 @@ namespace ui { - static bool select = false; + static int current_spin = -1; + static int selected_spin = -1; + static int hovering_spin = -1; + + void start() + { + current_spin = -1; + } void label(const char *label, const int x, const int y, const int w, const int h, const int color) { @@ -121,14 +128,20 @@ namespace ui const char *spin(const char *lbl, const int x, const int y, const int w, const int h) { + current_spin++; 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 inside = (mx>=x) && (mx=y) && (my=SDL_SCANCODE_1 && key<=SDL_SCANCODE_9) { + } else if ( (key>=SDL_SCANCODE_1 && key<=SDL_SCANCODE_9) || (key>=SDL_SCANCODE_KP_1 && key<=SDL_SCANCODE_KP_9) ) { + selected_spin=current_spin; strcpy(temp, label); const int size = strlen(label); - temp[size] = key+19; temp[size+1] = '\0'; + temp[size] = key<40 ? key+19 : key-40; temp[size+1] = '\0'; return temp; } const int wheel = input::mouseWheel(); if (wheel != 0) { + selected_spin=current_spin; const int value = SDL_atoi(lbl)+wheel*(input::keyDown(SDL_SCANCODE_LCTRL)?32:1); SDL_itoa(value, temp, 10); return temp; @@ -191,10 +208,4 @@ namespace ui } return 0; } - - void selected(const bool value) - { - select = value; - } - } diff --git a/source/jui.h b/source/jui.h index 34a957a..2a7e9d9 100644 --- a/source/jui.h +++ b/source/jui.h @@ -4,12 +4,11 @@ namespace ui { + void start(); void label(const char *label, const int x, const int y, const int w, const int h, const int color=WHITE+LIGHT); const bool button(const char *label, const int x, const int y, const int w, const int h, const bool pressed=false); const int check(const char *label, const int x, const int y, const int w, const int h, const bool checked); const int combo(const char *label, const int x, const int y, const int w, const int h); const char *spin(const char *lbl, const int x, const int y, const int w, const int h); const int textbox(const char *label, const int x, const int y, const int w, const int h); - - void selected(const bool value); } diff --git a/source/m_game.cpp b/source/m_game.cpp index 19f7a04..0b5cd5f 100644 --- a/source/m_game.cpp +++ b/source/m_game.cpp @@ -16,8 +16,6 @@ namespace modules std::vector gifs; int treeview_scroll = 0; - int *current_field = nullptr; - void init() { actor::clear(true); @@ -63,18 +61,11 @@ namespace modules const bool btn_small(const int x, const int y, int &var, int min, int max) { char buffer[100]; - if (current_field == &var) { - ui::selected(false); - } else { - ui::selected(true); - } const char *result=ui::spin(SDL_itoa(var, buffer, 10), x, y, 17, 11); - ui::selected(false); if (result) { const int value = SDL_atoi(result); var=SDL_max(min, SDL_min(max, value)); - current_field = &var; return true; } return false; @@ -338,7 +329,7 @@ namespace modules - + ui::start(); actor::actor_t *act = nullptr; diff --git a/source/main.cpp b/source/main.cpp index e5b83ef..94b46ed 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -109,7 +109,13 @@ bool game::loop() } break; case M_GAME: - if (!modules::game::loop()) { modules::ingame::init(); current_module = M_INGAME; } + if (!modules::game::loop()) { + if (editor::isDevMode()) { + return false; + } else { + modules::ingame::init(); current_module = M_INGAME; + } + } break; case M_INGAME: option = modules::ingame::loop();