-
1 Attachment(s)
Does somebody spot the error? I'm trying around for some time, but I just can't find it:
PHP Code:
#define ITEM(_rect, _dvar) \
itemDef \
{ \
name "window" \
group ingamebox \
visible 1 \
rect _rect \
origin ORIGIN_QUICKMESSAGEWINDOW \
forecolor 1 1 1 1 \
textfont UI_FONT_NORMAL \
textscale .24 \
textaligny 8 \
dvar _dvar \
decoration \
}
ITEM(16 20 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_1")
ITEM(16 36 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_2")
ITEM(16 52 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_3")
ITEM(16 68 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_4")
ITEM(16 84 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_5")
ITEM(16 100 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_6")
ITEM(16 116 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_7")
ITEM(16 132 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_8")
ITEM(16 148 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_9")
ITEM(16 164 0 0 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN, "menu_0")
(when I unpack the macro everything looks fine)
It's supposed to generate a quickmenu, but the font becomes messed up:
-
Did you try with normal spaces between numbers in (first) rect argument?
-
It looks like ORIGIN_QUICKMESSAGEWINDOW is not defined. Try putting in the raw coordinates instead of a definition.
-
I think it is defined, but I also think its not fullscreen align, but rather a center_safearea thingy.
It should align correctly on 4:3 aspect ratio though, but try center_safearea first (or dig through cod2 source to find possible values)
-
Thanks for all the answers, I was already kinda giving up on this :D
IzNoGods fullscreen align thought and the search through ui/menudefinition.h got me the answer, now it's nice and clean :)
PHP Code:
#define RECT4(_rect_) \
rect _rect_ HORIZONTAL_ALIGN_DEFAULT VERTICAL_ALIGN_DEFAULT
#define ITEM(_rect, _dvar) \
itemDef \
{ \
name "window" \
group ingamebox \
visible 1 \
RECT4(_rect) \
origin ORIGIN_QUICKMESSAGEWINDOW \
forecolor 1 1 1 1 \
textfont UI_FONT_NORMAL \
textscale .24 \
textaligny 8 \
dvar _dvar \
decoration \
}
ITEM(16 20 0 0, "menu_1")
ITEM(16 36 0 0, "menu_2")
ITEM(16 52 0 0, "menu_3")
ITEM(16 68 0 0, "menu_4")
ITEM(16 84 0 0, "menu_5")
ITEM(16 100 0 0, "menu_6")
ITEM(16 116 0 0, "menu_7")
ITEM(16 132 0 0, "menu_8")
ITEM(16 148 0 0, "menu_9")
ITEM(16 164 0 0, "menu_0")
So basically just replaced:
HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
with:
HORIZONTAL_ALIGN_DEFAULT VERTICAL_ALIGN_DEFAULT
Here are the other definitions, they may help somebody out later:
PHP Code:
// Edge relative placement values for rect->h_align and rect->v_align
#define HORIZONTAL_ALIGN_SUBLEFT 0 // left edge of a 4:3 screen (safe area not included)
#define HORIZONTAL_ALIGN_LEFT 1 // left viewable (safe area) edge
#define HORIZONTAL_ALIGN_CENTER 2 // center of the screen (reticle)
#define HORIZONTAL_ALIGN_RIGHT 3 // right viewable (safe area) edge
#define HORIZONTAL_ALIGN_FULLSCREEN 4 // disregards safe area
#define HORIZONTAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
#define HORIZONTAL_ALIGN_TO640 6 // scales a real-screen resolution x down into the 0 - 640 range
#define HORIZONTAL_ALIGN_CENTER_SAFEAREA 7 // center of the safearea
#define HORIZONTAL_ALIGN_MAX HORIZONTAL_ALIGN_CENTER_SAFEAREA
#define HORIZONTAL_ALIGN_DEFAULT HORIZONTAL_ALIGN_SUBLEFT
#define VERTICAL_ALIGN_SUBTOP 0 // top edge of the 4:3 screen (safe area not included)
#define VERTICAL_ALIGN_TOP 1 // top viewable (safe area) edge
#define VERTICAL_ALIGN_CENTER 2 // center of the screen (reticle)
#define VERTICAL_ALIGN_BOTTOM 3 // bottom viewable (safe area) edge
#define VERTICAL_ALIGN_FULLSCREEN 4 // disregards safe area
#define VERTICAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
#define VERTICAL_ALIGN_TO480 6 // scales a real-screen resolution y down into the 0 - 480 range
#define VERTICAL_ALIGN_CENTER_SAFEAREA 7 // center of the save area
#define VERTICAL_ALIGN_MAX VERTICAL_ALIGN_CENTER_SAFEAREA
#define VERTICAL_ALIGN_DEFAULT VERTICAL_ALIGN_SUBTOP
-
Basically created a simple && for menus (logical AND, in case if(a && b) set c 100)
code:
PHP Code:
execnow "set first_ok 0";
execnow "set second_ok 0";
execnowondvarintvalue first_check 100 "set first_ok 1";
execnowondvarintvalue second_check 200 "setfromdvar second_ok first_ok";
execnowondvarintvalue second_ok 1 "set result 10";
execnowondvarintvalue second_ok 0 "set result -10";
which basically does this:
PHP Code:
first_ok = false;
second_ok = false;
if(first_check == 100)
first_ok = true;
if(second_check == 200)
second_ok = first_ok;
if(second_ok)
result = 10;
else
result = -10;
It is however not very possible that you can use this for a double &&, as the amount of execnow's and execnowondvarint's is limited per action. You'll need a second menu then.