From 1b6361594b7a831263284f66651589d61a2fb9d4 Mon Sep 17 00:00:00 2001 From: phobos2077 Date: Thu, 9 May 2024 13:52:40 +0200 Subject: [PATCH] New crafting button - Smaller, more descriptive custom button near INV button. - Use actual IFACE window coordinates to position the button (works with both HRP variants) --- root/data/pcx/cftbtndn.pcx | Bin 0 -> 1419 bytes root/data/pcx/cftbtnup.pcx | Bin 0 -> 1400 bytes scripts_src/_pbs_craft/gl_pbs_craft.ssl | 23 +++++++++++++---------- 3 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 root/data/pcx/cftbtndn.pcx create mode 100644 root/data/pcx/cftbtnup.pcx diff --git a/root/data/pcx/cftbtndn.pcx b/root/data/pcx/cftbtndn.pcx new file mode 100644 index 0000000000000000000000000000000000000000..511601cc4d3bc4d9a2cfdb606a194909246e0b59 GIT binary patch literal 1419 zcmb7CPiWg#82LLIl#UMRD2*m`bVREV-Tmu4hR%nv;A)AX zf6)ZU=H4!QcFqn7FohD0hF>MG5(NPn$@S3`j4fRq((5!u=c#;fN|#hH*cduhA~%V~ z==2FXRShCwY?aUyowK{cjU0nLyGDrj+iqJ$L-hBJ zFd^G$Z1>yG+I^c?8WK89d=qxy-4ELR0~-ZsLeT5eqW15k{$c-sSonaJSR>Z<>~=t? zwLpFH@g7kRjlC;saLtXV*Y~?NXA}6LUE3x;J_@S=F)<`oYG{JaKZ>yAVe)i7pwXC$ z+)}SRu%*~grBwn=Xf+>+U8%CWPlLTuuooD?9$PZlr&s16AidvE(JaWLDYZ=#Y(|<$ zRuzaqlqk$7bQ(m+poX(Nsh|K>%jI&hSWG69zzuaq3c$$Xy$U7Bq^y>hUZfZ!^PvvC7#chqtU|m zXP$TBx_-Srs8l+--Y6EWT+WmvEtOJuKEp7nc$~xjF^170cB`Ph%c|OD^DF)*+ zjGZ@gYI2l3>Is9U=vusEGG#5U$zfRvr3K&^nB(5dd82z&vAR1umYmhng2YwyLQzgj zB4=8Kip5n-LDzXD#}lM?*t0s8=4e?nD`}dj$U-i|Wl~9zPY6t$i!&k<=c#Zq6iPsd zf>w|4yGFB9aNKOUC2Fmd;t07iC+#Ffg%Ps7!9bGDf~IL^L&_FNOAiNK&viPE-ZT|Q zOIKvx$Rso|j3*Q9`?%Z1j)M&Y%Q6;44DcFY1n>gD1*igO09gS1`V5ac_{hSCI_}B1 zlfumec3@G46CDNxXym|5gTjNz!265A+_%m=9ul)3m$A}mv(ObGDX#ruoncPHMZ-?;S3mz|w? zy?9cQU+7u4AX!;a7kQaaN=(9dV7(k&QLm67FMlzW+3z8^st%@#70!2}oOr~5d zTMet(X?6x3&D8aZnRyS=ML7L3E_M<^mAo~+T+U`k&8|~0wM-$)r-dXFCw~=)Y~;t! z*K4uOU)J~cf7tu}=kNC0@cg&^KUXV&e*m6uMpi$;>H&NMPy_hmdM5krN1KlyY<_+3 U&ZE0`?rq(^yLp?mdbL{p2ao6+f&c&j literal 0 HcmV?d00001 diff --git a/root/data/pcx/cftbtnup.pcx b/root/data/pcx/cftbtnup.pcx new file mode 100644 index 0000000000000000000000000000000000000000..d98597f931498346ad8dff881be49242d0c3c42a GIT binary patch literal 1400 zcmb7?L1^1n7{|YW%Smjfl@?>{OGsShYjQQY04?XnYLk>Lz_Q3n%mi65C(0fmR z{l5SE-uHC<+DaU-eF~p}g8if0N*Y!^I_N{dD8VL%Y=R{bn;5ZWNNhhlNs^OcGQ66S zVFWmBY-f*8vO`qHu)`)aa-@bhgz74;$dQ&H|Kb8I78DA4L+8znOPCk+E7|$_P(Lgn5=>2WbqhKYNdAJMXu`-Ccap0@45T zLW?Ulys~}y?f}`fAJrjp;TTVQB`yuJA-fi`sQF<9Lt8fKFuN{}eInJ9-im&p;< zD}wB{^$`2c(AvSdoXnyYCXdQ&`E$0+YMaS2;5vbJ6Z8u4wnAn&(U4*Q7W4UhHk(CJ zbZ~GG1VO*w_kF+7Xw+&o%d#q!ilQj8EQ_MZ^E^d*I-QM1lOQsuYX*Merw^Xua*~sNoK`3xs zE|ubGa4|BU*n+916`9G4DM5${8HS_um{RZcl!^8;`#o{cl6+V2Y_4jg3?;6}vAhU8 z2UFU6I&F6M9k;u+J=p~OT6vsj>|i?Xqtjr5>V;w_1unYct+7K%7!7S zidZV}gQOlx=LM4d;yaE^j zJOS_lY5)d65rDorrlStscj=xgn{+ z3KJ{DfWDbso*%qD>|X@Ui+=T@vo&p04jtu*S@d<;ElQ>&C_+Z&($;G$-A%&)bX|ce zwA;;0CS&WeB=T*?RAiB1m_ngYtySHo+v>DBgN|XFrehZ_K|YV?pQfZvTCCw+(~J3J zvft`@x@{EnqL3FeTnhhHK-<;tKUsT}T>p7(clXae&AUjjS=_-#4j`m1~En|Ig0*tm7?&aI8xH}9<9#8NL7i~j(f1`!Pa literal 0 HcmV?d00001 diff --git a/scripts_src/_pbs_craft/gl_pbs_craft.ssl b/scripts_src/_pbs_craft/gl_pbs_craft.ssl index 4dbfa16..cb0ad26 100644 --- a/scripts_src/_pbs_craft/gl_pbs_craft.ssl +++ b/scripts_src/_pbs_craft/gl_pbs_craft.ssl @@ -21,14 +21,18 @@ procedure delete_button; #include "crafting.h" variable crafting_hotkey; -variable warning_msg, show_crafting_scheduled, crafting_button_shown, screen_center_x; +variable warning_msg, show_crafting_scheduled, crafting_button_shown; #define WIN_CRAFT_BTN "helwin" #define SFX_BUTTON_DOWN "butin4" #define SFX_BUTTON_UP "IB2LU1X1" #define SFX_ERROR "IISXXXX1" -#define PCX_BUTTON_DOWN pcx_path(mfdown) -#define PCX_BUTTON_UP pcx_path(mfup) +#define PCX_BUTTON_DOWN pcx_path(cftbtndn) +#define PCX_BUTTON_UP pcx_path(cftbtnup) +#define BUTTON_WIDTH 19 +#define BUTTON_HEIGHT 24 +#define BUTTON_BOTTOM_OFFSET 62 +#define BUTTON_RIGHT_OFFSET 399 procedure warning_combat begin @@ -126,10 +130,12 @@ end // Create the button procedure create_button begin if crafting_button_shown then return; - - create_win_flag(WIN_CRAFT_BTN, (screen_center_x + 238), (get_screen_height - 98), 24, 23, WIN_FLAG_DONTMOVE bwor WIN_FLAG_TRANSPARENT); + variable + x := get_interface_x(WINTYPE_IFACEBAR) + get_interface_width(WINTYPE_IFACEBAR) - BUTTON_RIGHT_OFFSET, + y := (get_screen_height - BUTTON_BOTTOM_OFFSET); + create_win_flag(WIN_CRAFT_BTN, x, y, BUTTON_WIDTH, BUTTON_HEIGHT, WIN_FLAG_DONTMOVE bwor WIN_FLAG_TRANSPARENT); SelectWin(WIN_CRAFT_BTN); - AddButton("but", 0, 0, 24, 23); + AddButton("but", 0, 0, BUTTON_WIDTH, BUTTON_HEIGHT); AddButtonGFX("but", PCX_BUTTON_DOWN, PCX_BUTTON_UP, PCX_BUTTON_UP); AddButtonProc("but", do_on, do_off, do_down, do_up); ShowWin; @@ -160,10 +166,7 @@ procedure start begin register_hook_proc(HOOK_KEYPRESS, keypress_handler); register_hook_proc(HOOK_GAMEMODECHANGE, gamemodechange_handler); - screen_center_x := (get_screen_width / 2); - if ((get_ini_setting("f2_res.ini|IFACE|IFACE_BAR_WIDTH") != 800) or (screen_center_x < 400)) then begin - screen_center_x -= 80; - end + //display_msg(string_format("iface x: %d, w: %d", get_interface_x(WINTYPE_IFACEBAR), get_interface_width(WINTYPE_IFACEBAR))); call create_button; set_global_script_type(1);