#include "ui_local.h"#include "ui_shared.h"#include "../game/bg_public.h"#include "../game/anims.h"#include "../ghoul2/G2.h"#include "../namespace_begin.h"#include "../namespace_end.h"Go to the source code of this file.
|
|
Definition at line 1694 of file ui_shared.c. |
|
|
Definition at line 5976 of file ui_shared.c. Referenced by Item_ListBox_Paint(). |
|
|
Definition at line 119 of file ui_shared.c. Referenced by Item_ListBox_HandleKey(). |
|
|
Definition at line 257 of file ui_shared.c. Referenced by String_Init(). |
|
|
Definition at line 7324 of file ui_shared.c. Referenced by KeywordHash_Key(). |
|
|
Definition at line 1754 of file ui_shared.c. Referenced by Script_Defer(). |
|
|
Definition at line 141 of file ui_shared.c. Referenced by String_Report(), and UI_Alloc(). |
|
|
Definition at line 20 of file ui_shared.c. Referenced by Item_StartCapture(). |
|
|
Definition at line 21 of file ui_shared.c. |
|
|
Definition at line 22 of file ui_shared.c. |
|
|
Definition at line 19 of file ui_shared.c. Referenced by Item_StartCapture(). |
|
|
Definition at line 142 of file ui_shared.c. Referenced by UI_Alloc(), and UI_InitMemory(). |
|
|
|
|
|
Referenced by Item_Parse(), KeywordHash_Add(), KeywordHash_Find(), and Menu_Parse(). |
|
|
|
|
|
Referenced by String_Alloc(). |
|
|
Definition at line 7479 of file ui_shared.c. Referenced by UI_CleanupGhoul2(), UI_ClearG2Pointer(), and UI_InsertG2Pointer(). |
|
|
Definition at line 5410 of file ui_shared.c. References bind_t::bind1, bind_t::bind2, DC, g_nameBind1, g_nameBind2, displayContextDef_t::keynumToStringBuf, Q_stricmp(), strcat(), strcpy(), trap_SP_GetStringTextString(), and va(). Referenced by Item_Bind_Paint().
05410 {
05411 int i, b1, b2;
05412 char sOR[32];
05413
05414
05415 // iterate each command, set its default binding
05416 for (i=0; i < g_bindCount; i++)
05417 {
05418 if (Q_stricmp(cvar, g_bindings[i].command) == 0) {
05419 b1 = g_bindings[i].bind1;
05420 if (b1 == -1) {
05421 break;
05422 }
05423 DC->keynumToStringBuf( b1, g_nameBind1, 32 );
05424 // do NOT do this or it corrupts asian text!!! Q_strupr(g_nameBind1);
05425
05426 b2 = g_bindings[i].bind2;
05427 if (b2 != -1)
05428 {
05429 DC->keynumToStringBuf( b2, g_nameBind2, 32 );
05430 // do NOT do this or it corrupts asian text!!! Q_strupr(g_nameBind2);
05431
05432 trap_SP_GetStringTextString("MENUS_KEYBIND_OR",sOR, sizeof(sOR));
05433
05434 strcat( g_nameBind1, va(" %s ",sOR));
05435 strcat( g_nameBind1, g_nameBind2 );
05436 }
05437 return;
05438 }
05439 }
05440 strcpy(g_nameBind1, "???");
05441 }
|
|
|
Definition at line 5396 of file ui_shared.c. References name, and Q_stricmp(). Referenced by Item_Bind_HandleKey().
05396 {
05397 int i;
05398 for (i=0; i < g_bindCount; i++)
05399 {
05400 if (Q_stricmp(name, g_bindings[i].command) == 0) {
05401 return i;
05402 }
05403 }
05404 return -1;
05405 }
|
|
||||||||||||
|
Definition at line 492 of file ui_shared.c. References Float_Parse(), qboolean, qfalse, qtrue, and vec4_t. Referenced by Script_SetItemColor().
00492 {
00493 int i;
00494 float f;
00495
00496 for (i = 0; i < 4; i++) {
00497 if (!Float_Parse(p, &f)) {
00498 return qfalse;
00499 }
00500 (*c)[i] = f;
00501 }
00502 return qtrue;
00503 }
|
|
|
Definition at line 5332 of file ui_shared.c. References bind_t::bind1, and bind_t::bind2. Referenced by String_Init().
05333 {
05334 int i;
05335 int twokeys[2];
05336
05337 // iterate each command, get its numeric binding
05338 for (i=0; i < g_bindCount; i++)
05339 {
05340
05341 Controls_GetKeyAssignment(g_bindings[i].command, twokeys);
05342
05343 g_bindings[i].bind1 = twokeys[0];
05344 g_bindings[i].bind2 = twokeys[1];
05345 }
05346
05347 //s_controls.invertmouse.curvalue = DC->getCVarValue( "m_pitch" ) < 0;
05348 //s_controls.smoothmouse.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "m_filter" ) );
05349 //s_controls.alwaysrun.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_run" ) );
05350 //s_controls.autoswitch.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cg_autoswitch" ) );
05351 //s_controls.sensitivity.curvalue = UI_ClampCvar( 2, 30, Controls_GetCvarValue( "sensitivity" ) );
05352 //s_controls.joyenable.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "in_joystick" ) );
05353 //s_controls.joythreshold.curvalue = UI_ClampCvar( 0.05, 0.75, Controls_GetCvarValue( "joy_threshold" ) );
05354 //s_controls.freelook.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_freelook" ) );
05355 }
|
|
|
Definition at line 5362 of file ui_shared.c. References bind_t::bind1, bind_t::bind2, DC, and displayContextDef_t::setBinding. Referenced by Item_Bind_HandleKey().
05363 {
05364 int i;
05365
05366 // iterate each command, get its numeric binding
05367 for (i=0; i < g_bindCount; i++)
05368 {
05369 if (g_bindings[i].bind1 != -1)
05370 {
05371 DC->setBinding( g_bindings[i].bind1, g_bindings[i].command );
05372
05373 if (g_bindings[i].bind2 != -1)
05374 DC->setBinding( g_bindings[i].bind2, g_bindings[i].command );
05375 }
05376 }
05377
05378 //if ( s_controls.invertmouse.curvalue )
05379 // DC->setCVar("m_pitch", va("%f),-fabs( DC->getCVarValue( "m_pitch" ) ) );
05380 //else
05381 // trap_Cvar_SetValue( "m_pitch", fabs( trap_Cvar_VariableValue( "m_pitch" ) ) );
05382
05383 //trap_Cvar_SetValue( "m_filter", s_controls.smoothmouse.curvalue );
05384 //trap_Cvar_SetValue( "cl_run", s_controls.alwaysrun.curvalue );
05385 //trap_Cvar_SetValue( "cg_autoswitch", s_controls.autoswitch.curvalue );
05386 //trap_Cvar_SetValue( "sensitivity", s_controls.sensitivity.curvalue );
05387 //trap_Cvar_SetValue( "in_joystick", s_controls.joyenable.curvalue );
05388 //trap_Cvar_SetValue( "joy_threshold", s_controls.joythreshold.curvalue );
05389 //trap_Cvar_SetValue( "cl_freelook", s_controls.freelook.curvalue );
05390 //
05391 // DC->executeText(EXEC_APPEND, "in_restart\n");
05392 // ^--this is bad, it shows the cursor during map load, if you need to, add it as an exec cmd to use_joy or something.
05393 }
|
|
|
Definition at line 9960 of file ui_shared.c. References menuCount, and Menus.
09960 {
09961 int i;
09962 for (i = 0; i < menuCount; i++) {
09963 Menu_CacheContents(&Menus[i]);
09964 }
09965 }
|
|
||||||||||||
|
Definition at line 9858 of file ui_shared.c. References menuCount, Menus, NULL, and Rect_ContainsPoint(). Referenced by CG_KeyEvent(), and Display_HandleKey().
09858 {
09859 int i;
09860
09861 for (i = 0; i < menuCount; i++) {
09862 // turn off focus each item
09863 // menu->items[i].window.flags &= ~WINDOW_HASFOCUS;
09864 if (Rect_ContainsPoint(&Menus[i].window.rect, x, y)) {
09865 return &Menus[i];
09866 }
09867 }
09868 return NULL;
09869 }
|
|
||||||||||||
|
Definition at line 9903 of file ui_shared.c. References CURSOR_ARROW, CURSOR_SIZER, rectDef_t::h, menuCount, Menus, windowDef_t::rect, Rect_ContainsPoint(), rectDef_t::w, menuDef_t::window, rectDef_t::x, and rectDef_t::y. Referenced by CG_MouseEvent().
09903 {
09904 int i;
09905 for (i = 0; i < menuCount; i++) {
09906 rectDef_t r2;
09907 r2.x = Menus[i].window.rect.x - 3;
09908 r2.y = Menus[i].window.rect.y - 3;
09909 r2.w = r2.h = 7;
09910 if (Rect_ContainsPoint(&r2, x, y)) {
09911 return CURSOR_SIZER;
09912 }
09913 }
09914 return CURSOR_ARROW;
09915 }
|
|
|
Definition at line 9854 of file ui_shared.c. References DC.
09854 {
09855 return DC;
09856 }
|
|
||||||||||||||||||||
|
Definition at line 9918 of file ui_shared.c. References Display_CaptureItem(), Menu_GetFocused(), Menu_HandleKey(), and NULL. Referenced by CG_KeyEvent().
09918 {
09919 menuDef_t *menu = (menuDef_t *) Display_CaptureItem(x, y);
09920 if (menu == NULL) {
09921 menu = Menu_GetFocused();
09922 }
09923 if (menu) {
09924 Menu_HandleKey(menu, key, down );
09925 }
09926 }
|
|
|
Definition at line 5548 of file ui_shared.c. References qboolean. Referenced by Item_Paint().
05548 {
05549 return g_waitingForKey;
05550 }
|
|
||||||||||||||||
|
Definition at line 9873 of file ui_shared.c. References windowDef_t::flags, Menu_GetFocused(), Menu_HandleMouseMove(), Menu_UpdatePosition(), menuCount, Menus, NULL, qboolean, qtrue, windowDef_t::rect, menuDef_t::window, WINDOW_POPUP, rectDef_t::x, and rectDef_t::y. Referenced by _UI_MouseEvent(), CG_MouseEvent(), and Menu_HandleKey().
09873 {
09874
09875 //JLFMOUSE AGAIN I THINK THIS SHOULD BE MOOT
09876 #ifdef _XBOX
09877 return qtrue;
09878 #endif
09879 //END JLF
09880 int i;
09881 menuDef_t *menu = (menuDef_t *) p;
09882
09883 if (menu == NULL) {
09884 menu = Menu_GetFocused();
09885 if (menu) {
09886 if (menu->window.flags & WINDOW_POPUP) {
09887 Menu_HandleMouseMove(menu, x, y);
09888 return qtrue;
09889 }
09890 }
09891 for (i = 0; i < menuCount; i++) {
09892 Menu_HandleMouseMove(&Menus[i], x, y);
09893 }
09894 } else {
09895 menu->window.rect.x += x;
09896 menu->window.rect.y += y;
09897 Menu_UpdatePosition(menu);
09898 }
09899 return qtrue;
09900
09901 }
|
|
|
Definition at line 4442 of file ui_shared.c. References windowDef_t::flags, menuCount, Menus, menuDef_t::window, WINDOW_FORCED, and WINDOW_VISIBLE. Referenced by Menus_HandleOOBClick().
04442 {
04443 int i, count;
04444 count = 0;
04445 for (i = 0; i < menuCount; i++) {
04446 if (Menus[i].window.flags & (WINDOW_FORCED | WINDOW_VISIBLE)) {
04447 count++;
04448 }
04449 }
04450 return count;
04451 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 724 of file ui_shared.c. References DC, displayContextDef_t::realTime, WINDOW_FADINGIN, WINDOW_FADINGOUT, and WINDOW_VISIBLE. Referenced by Item_OwnerDraw_Paint(), Item_TextColor(), and Window_Paint().
00724 {
00725 if (*flags & (WINDOW_FADINGOUT | WINDOW_FADINGIN)) {
00726 if (DC->realTime > *nextTime) {
00727 *nextTime = DC->realTime + offsetTime;
00728 if (*flags & WINDOW_FADINGOUT) {
00729 *f -= fadeAmount;
00730 if (bFlags && *f <= 0.0) {
00731 *flags &= ~(WINDOW_FADINGOUT | WINDOW_VISIBLE);
00732 }
00733 } else {
00734 *f += fadeAmount;
00735 if (*f >= clamp) {
00736 *f = clamp;
00737 if (bFlags) {
00738 *flags &= ~WINDOW_FADINGIN;
00739 }
00740 }
00741 }
00742 }
00743 }
00744 }
|
|
||||||||||||
|
Definition at line 449 of file ui_shared.c. References atof(), COM_ParseExt(), qboolean, qfalse, and qtrue. Referenced by Color_Parse(), Rect_Parse(), Script_Orbit(), Script_Scale(), Script_SetColor(), and Script_Transition().
00449 {
00450 char *token;
00451 token = COM_ParseExt((const char **)p, qfalse);
00452 if (token && token[0] != 0) {
00453 *f = atof(token);
00454 return qtrue;
00455 } else {
00456 return qfalse;
00457 }
00458 }
|
|
||||||||||||
|
Definition at line 701 of file ui_shared.c. References displayContextDef_t::Assets, DC, displayContextDef_t::drawHandlePic, cachedAssets_t::gradientBar, rectDef_t::h, NULL, displayContextDef_t::setColor, vec4_t, rectDef_t::w, rectDef_t::x, and rectDef_t::y. Referenced by Window_Paint().
|
|
|
Definition at line 693 of file ui_shared.c. References DC. Referenced by _UI_Init(), and CG_LoadHudMenu().
00693 {
00694 DC = dc;
00695 }
|
|
||||||||||||
|
Definition at line 528 of file ui_shared.c. References atoi(), COM_ParseExt(), qboolean, qfalse, and qtrue. Referenced by Script_Disable(), Script_Orbit(), Script_Transition(), and Script_Transition2().
00528 {
00529 char *token;
00530 token = COM_ParseExt((const char **)p, qfalse);
00531
00532 if (token && token[0] != 0) {
00533 *i = atoi(token);
00534 return qtrue;
00535 } else {
00536 return qfalse;
00537 }
00538 }
|
|
|
Definition at line 1013 of file ui_shared.c. References qboolean, WINDOW_FADINGOUT, and WINDOW_VISIBLE. Referenced by Menu_HandleMouseMove().
01013 {
01014 return (flags & WINDOW_VISIBLE && !(flags & WINDOW_FADINGOUT));
01015 }
|
|
|
Definition at line 4321 of file ui_shared.c. References itemDef_s::action, Item_RunScript(), and itemDef_t. Referenced by Menu_HandleKey().
04321 {
04322 if (item) {
04323 Item_RunScript(item, item->action);
04324 }
04325 }
|
|
||||||||||||||||
|
Definition at line 5552 of file ui_shared.c. References A_BACKSPACE, A_ENTER, A_ESCAPE, A_MOUSE1, bind_t::bind1, bind_t::bind2, BindingIDFromName(), Controls_SetConfig(), displayContextDef_t::cursorx, displayContextDef_t::cursory, itemDef_s::cvar, DC, itemDef_t, K_CHAR_FLAG, NULL, qboolean, qfalse, qtrue, windowDef_t::rect, Rect_ContainsPoint(), displayContextDef_t::setBinding, and itemDef_s::window. Referenced by Item_HandleKey(), and Menu_HandleKey().
05552 {
05553 int id;
05554 int i;
05555
05556 if (key == A_MOUSE1 && Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && !g_waitingForKey)
05557 {
05558 if (down) {
05559 g_waitingForKey = qtrue;
05560 g_bindItem = item;
05561 }
05562 return qtrue;
05563 }
05564 else if (key == A_ENTER && !g_waitingForKey)
05565 {
05566 if (down)
05567 {
05568 g_waitingForKey = qtrue;
05569 g_bindItem = item;
05570 }
05571 return qtrue;
05572 }
05573 else
05574 {
05575 if (!g_waitingForKey || g_bindItem == NULL) {
05576 return qfalse;
05577 }
05578
05579 if (key & K_CHAR_FLAG) {
05580 return qtrue;
05581 }
05582
05583 switch (key)
05584 {
05585 case A_ESCAPE:
05586 g_waitingForKey = qfalse;
05587 return qtrue;
05588
05589 case A_BACKSPACE:
05590 id = BindingIDFromName(item->cvar);
05591 if (id != -1)
05592 {
05593 if ( g_bindings[id].bind1 != -1 )
05594 {
05595 DC->setBinding ( g_bindings[id].bind1, "" );
05596 }
05597
05598 if ( g_bindings[id].bind2 != -1 )
05599 {
05600 DC->setBinding ( g_bindings[id].bind2, "" );
05601 }
05602
05603 g_bindings[id].bind1 = -1;
05604 g_bindings[id].bind2 = -1;
05605 }
05606 Controls_SetConfig(qtrue);
05607 g_waitingForKey = qfalse;
05608 g_bindItem = NULL;
05609 return qtrue;
05610
05611 case '`':
05612 return qtrue;
05613 }
05614 }
05615
05616 if (key != -1)
05617 {
05618
05619 for (i=0; i < g_bindCount; i++)
05620 {
05621
05622 if (g_bindings[i].bind2 == key) {
05623 g_bindings[i].bind2 = -1;
05624 }
05625
05626 if (g_bindings[i].bind1 == key)
05627 {
05628 g_bindings[i].bind1 = g_bindings[i].bind2;
05629 g_bindings[i].bind2 = -1;
05630 }
05631 }
05632 }
05633
05634
05635 id = BindingIDFromName(item->cvar);
05636
05637 if (id != -1) {
05638 if (key == -1) {
05639 if( g_bindings[id].bind1 != -1 ) {
05640 DC->setBinding( g_bindings[id].bind1, "" );
05641 g_bindings[id].bind1 = -1;
05642 }
05643 if( g_bindings[id].bind2 != -1 ) {
05644 DC->setBinding( g_bindings[id].bind2, "" );
05645 g_bindings[id].bind2 = -1;
05646 }
05647 }
05648 else if (g_bindings[id].bind1 == -1) {
05649 g_bindings[id].bind1 = key;
05650 }
05651 else if (g_bindings[id].bind1 != key && g_bindings[id].bind2 == -1) {
05652 g_bindings[id].bind2 = key;
05653 }
05654 else {
05655 DC->setBinding( g_bindings[id].bind1, "" );
05656 DC->setBinding( g_bindings[id].bind2, "" );
05657 g_bindings[id].bind1 = key;
05658 g_bindings[id].bind2 = -1;
05659 }
05660 }
05661
05662 Controls_SetConfig(qtrue);
05663 g_waitingForKey = qfalse;
05664
05665 return qtrue;
05666 }
|
|
|
Definition at line 5475 of file ui_shared.c. References BindingFromName(), itemDef_s::cvar, DC, displayContextDef_t::drawText, editFieldDef_t, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, g_nameBind1, displayContextDef_t::getCVarValue, itemDef_s::iMenuFont, Item_Text_Paint(), itemDef_t, LerpColor(), editFieldDef_s::maxPaintChars, memcpy(), itemDef_s::parent, PULSE_DIVISOR, displayContextDef_t::realTime, SCREEN_WIDTH, sin(), itemDef_s::text, displayContextDef_t::textHeight, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, displayContextDef_t::textWidth, itemDef_s::typeData, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, and rectDef_t::y. Referenced by Item_Paint().
05476 {
05477 vec4_t newColor, lowLight;
05478 float value;
05479 int maxChars = 0;
05480 float textScale,textWidth;
05481 int textHeight,yAdj,startingXPos;
05482
05483
05484 menuDef_t *parent = (menuDef_t*)item->parent;
05485 editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData;
05486 if (editPtr)
05487 {
05488 maxChars = editPtr->maxPaintChars;
05489 }
05490
05491 value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0;
05492
05493 if (item->window.flags & WINDOW_HASFOCUS)
05494 {
05495 if (g_bindItem == item)
05496 {
05497 lowLight[0] = 0.8f * 1.0f;
05498 lowLight[1] = 0.8f * 0.0f;
05499 lowLight[2] = 0.8f * 0.0f;
05500 lowLight[3] = 0.8f * 1.0f;
05501 }
05502 else
05503 {
05504 lowLight[0] = 0.8f * parent->focusColor[0];
05505 lowLight[1] = 0.8f * parent->focusColor[1];
05506 lowLight[2] = 0.8f * parent->focusColor[2];
05507 lowLight[3] = 0.8f * parent->focusColor[3];
05508 }
05509 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
05510 }
05511 else
05512 {
05513 memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
05514 }
05515
05516 if (item->text)
05517 {
05518 Item_Text_Paint(item);
05519 BindingFromName(item->cvar);
05520
05521 // If the text runs past the limit bring the scale down until it fits.
05522 textScale = item->textscale;
05523 textWidth = DC->textWidth(g_nameBind1,(float) textScale, item->iMenuFont);
05524 startingXPos = (item->textRect.x + item->textRect.w + 8);
05525
05526 while ((startingXPos + textWidth) >= SCREEN_WIDTH)
05527 {
05528 textScale -= .05f;
05529 textWidth = DC->textWidth(g_nameBind1,(float) textScale, item->iMenuFont);
05530 }
05531
05532 // Try to adjust it's y placement if the scale has changed.
05533 yAdj = 0;
05534 if (textScale != item->textscale)
05535 {
05536 textHeight = DC->textHeight(g_nameBind1, item->textscale, item->iMenuFont);
05537 yAdj = textHeight - DC->textHeight(g_nameBind1, textScale, item->iMenuFont);
05538 }
05539
05540 DC->drawText(startingXPos, item->textRect.y + yAdj, textScale, newColor, g_nameBind1, 0, maxChars, item->textStyle,item->iMenuFont);
05541 }
05542 else
05543 {
05544 DC->drawText(item->textRect.x, item->textRect.y, item->textscale, newColor, (value != 0) ? "FIXME" : "FIXME", 0, maxChars, item->textStyle,item->iMenuFont);
05545 }
05546 }
|
|
||||||||||||
|
Definition at line 2360 of file ui_shared.c. References itemDef_s::cvarFlags, itemDef_s::cvarTest, DC, itemDef_s::enableCvar, displayContextDef_t::getCVarString, itemDef_t, Q_stricmp(), Q_strncpyz(), qboolean, qfalse, qtrue, and String_Parse(). Referenced by Item_MouseEnter(), Item_OwnerDraw_Paint(), Item_Paint(), Item_SetFocus(), Item_TextColor(), and Menu_HandleMouseMove().
02360 {
02361 char script[2048], *p;
02362 if (item && item->enableCvar && *item->enableCvar && item->cvarTest && *item->cvarTest) {
02363 char buff[2048];
02364 DC->getCVarString(item->cvarTest, buff, sizeof(buff));
02365
02366 Q_strncpyz(script, item->enableCvar, 2048);
02367 p = script;
02368 while (1) {
02369 const char *val;
02370 // expect value then ; or NULL, NULL ends list
02371 if (!String_Parse(&p, &val)) {
02372 return (item->cvarFlags & flag) ? qfalse : qtrue;
02373 }
02374
02375 if (val[0] == ';' && val[1] == '\0') {
02376 continue;
02377 }
02378
02379 // enable it if any of the values are true
02380 if (item->cvarFlags & flag) {
02381 if (Q_stricmp(buff, val) == 0) {
02382 return qtrue;
02383 }
02384 } else {
02385 // disable it if any of the values are true
02386 if (Q_stricmp(buff, val) == 0) {
02387 return qfalse;
02388 }
02389 }
02390
02391 }
02392 return (item->cvarFlags & flag) ? qfalse : qtrue;
02393 }
02394 return qtrue;
02395 }
|
|
|
Definition at line 4271 of file ui_shared.c. References itemDef_s::accept, Item_RunScript(), itemDef_t, qboolean, qfalse, and qtrue. Referenced by Menu_HandleKey().
04272 {
04273 if (item->accept)
04274 {
04275 Item_RunScript(item, item->accept);
04276 return qtrue;
04277 }
04278 return qfalse;
04279 }
|
|
||||||||||||||||
|
Definition at line 4176 of file ui_shared.c. References A_ENTER, A_MOUSE1, A_MOUSE2, A_MOUSE3, itemDef_s::cvar, editFieldDef_t, Item_Bind_HandleKey(), Item_ListBox_HandleKey(), Item_Multi_HandleKey(), Item_OwnerDraw_HandleKey(), Item_Slider_HandleKey(), Item_StartCapture(), Item_StopCapture(), Item_TextScroll_HandleKey(), ITEM_TYPE_BIND, ITEM_TYPE_BUTTON, ITEM_TYPE_CHECKBOX, ITEM_TYPE_COMBO, ITEM_TYPE_EDITFIELD, ITEM_TYPE_LISTBOX, ITEM_TYPE_MULTI, ITEM_TYPE_NUMERICFIELD, ITEM_TYPE_OWNERDRAW, ITEM_TYPE_RADIOBUTTON, ITEM_TYPE_SLIDER, ITEM_TYPE_TEXT, ITEM_TYPE_TEXTSCROLL, ITEM_TYPE_YESNO, Item_YesNo_HandleKey(), itemDef_t, NULL, editFieldDef_s::paintOffset, qboolean, qfalse, itemDef_s::type, and itemDef_s::typeData. Referenced by Menu_HandleKey().
04176 {
04177
04178 if (itemCapture) {
04179 Item_StopCapture(itemCapture);
04180 itemCapture = NULL;
04181 captureFunc = 0;
04182 captureData = NULL;
04183 } else {
04184 // bk001206 - parentheses
04185 if ( down && ( key == A_MOUSE1 || key == A_MOUSE2 || key == A_MOUSE3 ) ) {
04186 Item_StartCapture(item, key);
04187 }
04188 }
04189
04190 if (!down) {
04191 return qfalse;
04192 }
04193
04194 switch (item->type) {
04195 case ITEM_TYPE_BUTTON:
04196 #ifdef _XBOX
04197 return Item_Button_HandleKey(item, key);
04198 #else
04199 return qfalse;
04200 #endif
04201 break;
04202 case ITEM_TYPE_RADIOBUTTON:
04203 return qfalse;
04204 break;
04205 case ITEM_TYPE_CHECKBOX:
04206 return qfalse;
04207 break;
04208 case ITEM_TYPE_EDITFIELD:
04209 case ITEM_TYPE_NUMERICFIELD:
04210 if (key == A_MOUSE1 || key == A_MOUSE2 || key == A_ENTER)
04211 {
04212 editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData;
04213
04214 if (item->cvar && editPtr)
04215 {
04216 editPtr->paintOffset = 0;
04217 }
04218
04219 //return Item_TextField_HandleKey(item, key);
04220 }
04221 return qfalse;
04222 break;
04223 case ITEM_TYPE_COMBO:
04224 return qfalse;
04225 break;
04226 case ITEM_TYPE_LISTBOX:
04227 return Item_ListBox_HandleKey(item, key, down, qfalse);
04228 break;
04229 case ITEM_TYPE_TEXTSCROLL:
04230 return Item_TextScroll_HandleKey(item, key, down, qfalse);
04231 break;
04232 case ITEM_TYPE_YESNO:
04233 return Item_YesNo_HandleKey(item, key);
04234 break;
04235 case ITEM_TYPE_MULTI:
04236 return Item_Multi_HandleKey(item, key);
04237 break;
04238 case ITEM_TYPE_OWNERDRAW:
04239 return Item_OwnerDraw_HandleKey(item, key);
04240 break;
04241 case ITEM_TYPE_BIND:
04242 return Item_Bind_HandleKey(item, key, down);
04243 break;
04244 case ITEM_TYPE_SLIDER:
04245 return Item_Slider_HandleKey(item, key, down);
04246 break;
04247 #ifdef _XBOX
04248 case ITEM_TYPE_TEXT:
04249 return Item_Text_HandleKey(item, key);
04250 break;
04251 #endif
04252 //case ITEM_TYPE_IMAGE:
04253 // Item_Image_Paint(item);
04254 // break;
04255 default:
04256 return qfalse;
04257 break;
04258 }
04259
04260 //return qfalse;
04261 }
|
|
|
Definition at line 5903 of file ui_shared.c. References itemDef_s::asset, DC, displayContextDef_t::drawHandlePic, rectDef_t::h, itemDef_t, NULL, windowDef_t::rect, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y.
|
|
|
Definition at line 7120 of file ui_shared.c. References itemDef_t, memset(), itemDef_s::textscale, itemDef_s::window, and Window_Init(). Referenced by MenuParse_itemDef().
07120 {
07121 memset(item, 0, sizeof(itemDef_t));
07122 item->textscale = 0.55f;
07123 Window_Init(&item->window);
07124 }
|
|
|
Definition at line 9259 of file ui_shared.c. References listBoxDef_s::cursorPos, itemDef_s::cursorPos, listBoxDef_s::endPos, ITEM_TYPE_LISTBOX, itemDef_t, listBoxDef_t, NULL, listBoxDef_s::startPos, itemDef_s::type, and itemDef_s::typeData. Referenced by MenuParse_itemDef().
09260 {
09261 if (item == NULL)
09262 {
09263 return;
09264 }
09265
09266 switch ( item->type )
09267 {
09268 case ITEM_TYPE_LISTBOX:
09269 {
09270 listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
09271 item->cursorPos = 0;
09272 if (listPtr)
09273 {
09274 listPtr->cursorPos = 0;
09275 listPtr->startPos = 0;
09276 listPtr->endPos = 0;
09277 listPtr->cursorPos = 0;
09278 }
09279
09280 break;
09281 }
09282 }
09283 }
|
|
||||||||||||||||||||
|
Definition at line 3220 of file ui_shared.c. References A_CURSOR_DOWN, A_CURSOR_LEFT, A_CURSOR_RIGHT, A_CURSOR_UP, A_END, A_HOME, A_KP_1, A_KP_2, A_KP_3, A_KP_4, A_KP_6, A_KP_7, A_KP_8, A_KP_9, A_MOUSE1, A_MOUSE2, A_PAGE_DOWN, A_PAGE_UP, itemDef_s::cursorPos, listBoxDef_s::cursorPos, displayContextDef_t::cursorx, displayContextDef_t::cursory, DC, DOUBLE_CLICK_DELAY, listBoxDef_s::doubleClick, listBoxDef_s::elementHeight, listBoxDef_s::elementStyle, listBoxDef_s::elementWidth, displayContextDef_t::feederCount, displayContextDef_t::feederSelection, windowDef_t::flags, rectDef_t::h, Item_ListBox_MaxScroll(), Item_RunScript(), itemDef_t, LISTBOX_IMAGE, listBoxDef_t, listBoxDef_s::notselectable, NULL, qboolean, qfalse, qtrue, displayContextDef_t::realTime, windowDef_t::rect, Rect_ContainsPoint(), itemDef_s::special, listBoxDef_s::startPos, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, WINDOW_HORIZONTAL, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, and WINDOW_LB_THUMB. Referenced by Item_HandleKey(), and Menu_ScrollFeeder().
03220 {
03221 listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
03222 int count = DC->feederCount(item->special);
03223 int max, viewmax;
03224 //JLFMOUSE
03225 #ifndef _XBOX
03226 if (force || (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS))
03227 #else
03228 if (force || item->window.flags & WINDOW_HASFOCUS)
03229 #endif
03230 {
03231 max = Item_ListBox_MaxScroll(item);
03232 if (item->window.flags & WINDOW_HORIZONTAL) {
03233 viewmax = (item->window.rect.w / listPtr->elementWidth);
03234 if ( key == A_CURSOR_LEFT || key == A_KP_4 )
03235 {
03236 if (!listPtr->notselectable) {
03237 listPtr->cursorPos--;
03238 #ifdef _XBOX
03239 listPtr->startPos--;
03240 #endif
03241 if (listPtr->cursorPos < 0) {
03242 listPtr->cursorPos = 0;
03243 return qfalse;
03244 }
03245 if (listPtr->cursorPos < listPtr->startPos) {
03246 listPtr->startPos = listPtr->cursorPos;
03247 //JLF
03248 #ifndef _XBOX
03249 return qfalse;
03250 #endif
03251 }
03252 if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03253 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03254 }
03255 item->cursorPos = listPtr->cursorPos;
03256 DC->feederSelection(item->special, item->cursorPos, NULL);
03257 }
03258 else {
03259 listPtr->startPos--;
03260 if (listPtr->startPos < 0)
03261 listPtr->startPos = 0;
03262 }
03263 return qtrue;
03264 }
03265 if ( key == A_CURSOR_RIGHT || key == A_KP_6 )
03266 {
03267 if (!listPtr->notselectable) {
03268 listPtr->cursorPos++;
03269 if (listPtr->cursorPos < listPtr->startPos) {
03270 listPtr->startPos = listPtr->cursorPos;
03271 //JLF
03272 #ifndef _XBOX
03273 return qfalse;
03274 #endif
03275 }
03276 if (listPtr->cursorPos >= count) {
03277 listPtr->cursorPos = count-1;
03278 return qfalse;
03279 }
03280 if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03281 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03282 }
03283 item->cursorPos = listPtr->cursorPos;
03284 DC->feederSelection(item->special, item->cursorPos, NULL);
03285 }
03286 else {
03287 listPtr->startPos++;
03288 if (listPtr->startPos >= count)
03289 listPtr->startPos = count-1;
03290 }
03291 return qtrue;
03292 }
03293 }
03294 // Vertical scroll
03295 else {
03296
03297 // Multiple rows and columns (since it's more than twice as wide as an element)
03298 if (( item->window.rect.w > (listPtr->elementWidth*2)) && (listPtr->elementStyle == LISTBOX_IMAGE))
03299 {
03300 viewmax = (item->window.rect.w / listPtr->elementWidth);
03301 }
03302 else
03303 {
03304 viewmax = (item->window.rect.h / listPtr->elementHeight);
03305 }
03306
03307 if ( key == A_CURSOR_UP || key == A_KP_8 )
03308 {
03309 if (!listPtr->notselectable) {
03310 listPtr->cursorPos--;
03311 if (listPtr->cursorPos < 0) {
03312 listPtr->cursorPos = 0;
03313 return qfalse;
03314 }
03315 if (listPtr->cursorPos < listPtr->startPos) {
03316 listPtr->startPos = listPtr->cursorPos;
03317 //JLF
03318 #ifndef _XBOX
03319 return qfalse;
03320 #endif
03321 }
03322 if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03323 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03324 }
03325 item->cursorPos = listPtr->cursorPos;
03326 DC->feederSelection(item->special, item->cursorPos, NULL);
03327 }
03328 else {
03329 listPtr->startPos--;
03330 if (listPtr->startPos < 0)
03331 listPtr->startPos = 0;
03332 }
03333 return qtrue;
03334 }
03335 if ( key == A_CURSOR_DOWN || key == A_KP_2 )
03336 {
03337 if (!listPtr->notselectable) {
03338 listPtr->cursorPos++;
03339 if (listPtr->cursorPos < listPtr->startPos) {
03340 listPtr->startPos = listPtr->cursorPos;
03341 //JLF
03342 #ifndef _XBOX
03343 return qfalse;
03344 #endif
03345 }
03346 if (listPtr->cursorPos >= count) {
03347 listPtr->cursorPos = count-1;
03348 return qfalse;
03349 }
03350 if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03351 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03352 }
03353 item->cursorPos = listPtr->cursorPos;
03354 DC->feederSelection(item->special, item->cursorPos, NULL);
03355 }
03356 else {
03357 listPtr->startPos++;
03358 if (listPtr->startPos > max)
03359 listPtr->startPos = max;
03360 }
03361 return qtrue;
03362 }
03363 }
03364 // mouse hit
03365 if (key == A_MOUSE1 || key == A_MOUSE2) {
03366 if (item->window.flags & WINDOW_LB_LEFTARROW) {
03367 listPtr->startPos--;
03368 if (listPtr->startPos < 0) {
03369 listPtr->startPos = 0;
03370 }
03371 } else if (item->window.flags & WINDOW_LB_RIGHTARROW) {
03372 // one down
03373 listPtr->startPos++;
03374 if (listPtr->startPos > max) {
03375 listPtr->startPos = max;
03376 }
03377 } else if (item->window.flags & WINDOW_LB_PGUP) {
03378 // page up
03379 listPtr->startPos -= viewmax;
03380 if (listPtr->startPos < 0) {
03381 listPtr->startPos = 0;
03382 }
03383 } else if (item->window.flags & WINDOW_LB_PGDN) {
03384 // page down
03385 listPtr->startPos += viewmax;
03386 if (listPtr->startPos > (max)) {
03387 listPtr->startPos = (max);
03388 }
03389 } else if (item->window.flags & WINDOW_LB_THUMB) {
03390 // Display_SetCaptureItem(item);
03391 } else {
03392 // select an item
03393 #ifdef _XBOX
03394 if (listPtr->doubleClick) {
03395 #else
03396 if (DC->realTime < lastListBoxClickTime && listPtr->doubleClick) {
03397 #endif
03398 Item_RunScript(item, listPtr->doubleClick);
03399 }
03400 lastListBoxClickTime = DC->realTime + DOUBLE_CLICK_DELAY;
03401 // if (item->cursorPos != listPtr->cursorPos)
03402 {
03403 int prePos = item->cursorPos;
03404
03405 item->cursorPos = listPtr->cursorPos;
03406
03407 if (!DC->feederSelection(item->special, item->cursorPos, item))
03408 {
03409 item->cursorPos = listPtr->cursorPos = prePos;
03410 }
03411 }
03412 }
03413 return qtrue;
03414 }
03415 if ( key == A_HOME || key == A_KP_7) {
03416 // home
03417 listPtr->startPos = 0;
03418 return qtrue;
03419 }
03420 if ( key == A_END || key == A_KP_1) {
03421 // end
03422 listPtr->startPos = max;
03423 return qtrue;
03424 }
03425 if (key == A_PAGE_UP || key == A_KP_9 ) {
03426 // page up
03427 if (!listPtr->notselectable) {
03428 listPtr->cursorPos -= viewmax;
03429 if (listPtr->cursorPos < 0) {
03430 listPtr->cursorPos = 0;
03431 }
03432 if (listPtr->cursorPos < listPtr->startPos) {
03433 listPtr->startPos = listPtr->cursorPos;
03434 }
03435 if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03436 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03437 }
03438 item->cursorPos = listPtr->cursorPos;
03439 DC->feederSelection(item->special, item->cursorPos, NULL);
03440 }
03441 else {
03442 listPtr->startPos -= viewmax;
03443 if (listPtr->startPos < 0) {
03444 listPtr->startPos = 0;
03445 }
03446 }
03447 return qtrue;
03448 }
03449 if ( key == A_PAGE_DOWN || key == A_KP_3 ) {
03450 // page down
03451 if (!listPtr->notselectable) {
03452 listPtr->cursorPos += viewmax;
03453 if (listPtr->cursorPos < listPtr->startPos) {
03454 listPtr->startPos = listPtr->cursorPos;
03455 }
03456 if (listPtr->cursorPos >= count) {
03457 listPtr->cursorPos = count-1;
03458 }
03459 if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03460 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03461 }
03462 item->cursorPos = listPtr->cursorPos;
03463 DC->feederSelection(item->special, item->cursorPos, NULL);
03464 }
03465 else {
03466 listPtr->startPos += viewmax;
03467 if (listPtr->startPos > max) {
03468 listPtr->startPos = max;
03469 }
03470 }
03471 return qtrue;
03472 }
03473 }
03474 return qfalse;
03475 }
|
|
|
Definition at line 2707 of file ui_shared.c. References DC, listBoxDef_s::elementHeight, listBoxDef_s::elementWidth, displayContextDef_t::feederCount, windowDef_t::flags, rectDef_t::h, itemDef_t, listBoxDef_t, windowDef_t::rect, itemDef_s::special, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, and WINDOW_HORIZONTAL. Referenced by Item_ListBox_HandleKey(), Item_ListBox_Paint(), and Item_ListBox_ThumbPosition().
02707 {
02708 listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
02709 int count = DC->feederCount(item->special);
02710 int max;
02711
02712 if (item->window.flags & WINDOW_HORIZONTAL) {
02713 max = count - (item->window.rect.w / listPtr->elementWidth) + 1;
02714 }
02715 else {
02716 max = count - (item->window.rect.h / listPtr->elementHeight) + 1;
02717 }
02718 if (max < 0) {
02719 return 0;
02720 }
02721 return max;
02722 }
|
|
||||||||||||||||
|
Definition at line 2956 of file ui_shared.c. References listBoxDef_s::cursorPos, listBoxDef_s::drawPadding, listBoxDef_s::elementHeight, listBoxDef_s::elementStyle, listBoxDef_s::elementWidth, listBoxDef_s::endPos, windowDef_t::flags, rectDef_t::h, Item_ListBox_OverLB(), itemDef_t, LISTBOX_IMAGE, listBoxDef_t, windowDef_t::rect, Rect_ContainsPoint(), SCROLLBAR_SIZE, listBoxDef_s::startPos, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, WINDOW_LB_THUMB, rectDef_t::x, and rectDef_t::y. Referenced by Item_MouseEnter().
02957 {
02958 rectDef_t r;
02959 listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
02960
02961 item->window.flags &= ~(WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN);
02962 item->window.flags |= Item_ListBox_OverLB(item, x, y);
02963
02964 if (item->window.flags & WINDOW_HORIZONTAL)
02965 {
02966 if (!(item->window.flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN)))
02967 {
02968 // check for selection hit as we have exausted buttons and thumb
02969 if (listPtr->elementStyle == LISTBOX_IMAGE)
02970 {
02971 r.x = item->window.rect.x;
02972 r.y = item->window.rect.y;
02973 r.h = item->window.rect.h - SCROLLBAR_SIZE;
02974 r.w = item->window.rect.w - listPtr->drawPadding;
02975 if (Rect_ContainsPoint(&r, x, y))
02976 {
02977 listPtr->cursorPos = (int)((x - r.x) / listPtr->elementWidth) + listPtr->startPos;
02978 if (listPtr->cursorPos >= listPtr->endPos)
02979 {
02980 listPtr->cursorPos = listPtr->endPos;
02981 }
02982 }
02983 }
02984 else
02985 {
02986 // text hit..
02987 }
02988 }
02989 }
02990 // Window Vertical Scroll
02991 else if (!(item->window.flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN)))
02992 {
02993 // Calc which element the mouse is over
02994 r.x = item->window.rect.x;
02995 r.y = item->window.rect.y;
02996 r.w = item->window.rect.w - SCROLLBAR_SIZE;
02997 r.h = item->window.rect.h - listPtr->drawPadding;
02998 if (Rect_ContainsPoint(&r, x, y))
02999 {
03000 // Multiple rows and columns (since it's more than twice as wide as an element)
03001 if (( item->window.rect.w > (listPtr->elementWidth*2)) && (listPtr->elementStyle == LISTBOX_IMAGE))
03002 {
03003 int row,column,rowLength;
03004
03005 row = (int)((y - 2 - r.y) / listPtr->elementHeight);
03006 rowLength = (int) r.w / listPtr->elementWidth;
03007 column = (int)((x - r.x) / listPtr->elementWidth);
03008
03009 listPtr->cursorPos = (row * rowLength)+column + listPtr->startPos;
03010 if (listPtr->cursorPos >= listPtr->endPos)
03011 {
03012 listPtr->cursorPos = listPtr->endPos;
03013 }
03014 }
03015 // single column
03016 else
03017 {
03018 listPtr->cursorPos = (int)((y - 2 - r.y) / listPtr->elementHeight) + listPtr->startPos;
03019 if (listPtr->cursorPos > listPtr->endPos)
03020 {
03021 listPtr->cursorPos = listPtr->endPos;
03022 }
03023 }
03024 }
03025 }
03026 }
|
|
||||||||||||||||
|
Definition at line 2837 of file ui_shared.c. References DC, listBoxDef_s::elementStyle, listBoxDef_s::elementWidth, displayContextDef_t::feederCount, windowDef_t::flags, rectDef_t::h, Item_ListBox_ThumbPosition(), itemDef_t, LISTBOX_IMAGE, listBoxDef_t, windowDef_t::rect, Rect_ContainsPoint(), SCROLLBAR_SIZE, itemDef_s::special, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, WINDOW_LB_THUMB, rectDef_t::x, and rectDef_t::y. Referenced by Item_ListBox_MouseEnter(), and Item_StartCapture().
02838 {
02839 rectDef_t r;
02840 listBoxDef_t *listPtr;
02841 int thumbstart;
02842 int count;
02843
02844 count = DC->feederCount(item->special);
02845 listPtr = (listBoxDef_t*)item->typeData;
02846 if (item->window.flags & WINDOW_HORIZONTAL)
02847 {
02848 // check if on left arrow
02849 r.x = item->window.rect.x;
02850 r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02851 r.h = r.w = SCROLLBAR_SIZE;
02852 if (Rect_ContainsPoint(&r, x, y))
02853 {
02854 return WINDOW_LB_LEFTARROW;
02855 }
02856
02857 // check if on right arrow
02858 r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02859 if (Rect_ContainsPoint(&r, x, y))
02860 {
02861 return WINDOW_LB_RIGHTARROW;
02862 }
02863
02864 // check if on thumb
02865 thumbstart = Item_ListBox_ThumbPosition(item);
02866 r.x = thumbstart;
02867 if (Rect_ContainsPoint(&r, x, y))
02868 {
02869 return WINDOW_LB_THUMB;
02870 }
02871
02872 r.x = item->window.rect.x + SCROLLBAR_SIZE;
02873 r.w = thumbstart - r.x;
02874 if (Rect_ContainsPoint(&r, x, y))
02875 {
02876 return WINDOW_LB_PGUP;
02877 }
02878
02879 r.x = thumbstart + SCROLLBAR_SIZE;
02880 r.w = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02881 if (Rect_ContainsPoint(&r, x, y))
02882 {
02883 return WINDOW_LB_PGDN;
02884 }
02885 }
02886 // Vertical Scroll
02887 else
02888 {
02889 // Multiple rows and columns (since it's more than twice as wide as an element)
02890 if (( item->window.rect.w > (listPtr->elementWidth*2)) && (listPtr->elementStyle == LISTBOX_IMAGE))
02891 {
02892 r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02893 r.y = item->window.rect.y;
02894 r.h = r.w = SCROLLBAR_SIZE;
02895 if (Rect_ContainsPoint(&r, x, y))
02896 {
02897 return WINDOW_LB_PGUP;
02898 }
02899
02900 r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02901 if (Rect_ContainsPoint(&r, x, y))
02902 {
02903 return WINDOW_LB_PGDN;
02904 }
02905
02906 thumbstart = Item_ListBox_ThumbPosition(item);
02907 r.y = thumbstart;
02908 if (Rect_ContainsPoint(&r, x, y))
02909 {
02910 return WINDOW_LB_THUMB;
02911 }
02912
02913 }
02914 else
02915 {
02916 r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02917 r.y = item->window.rect.y;
02918 r.h = r.w = SCROLLBAR_SIZE;
02919 if (Rect_ContainsPoint(&r, x, y))
02920 {
02921 return WINDOW_LB_LEFTARROW;
02922 }
02923
02924 r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02925 if (Rect_ContainsPoint(&r, x, y))
02926 {
02927 return WINDOW_LB_RIGHTARROW;
02928 }
02929
02930 thumbstart = Item_ListBox_ThumbPosition(item);
02931 r.y = thumbstart;
02932 if (Rect_ContainsPoint(&r, x, y))
02933 {
02934 return WINDOW_LB_THUMB;
02935 }
02936
02937 r.y = item->window.rect.y + SCROLLBAR_SIZE;
02938 r.h = thumbstart - r.y;
02939 if (Rect_ContainsPoint(&r, x, y))
02940 {
02941 return WINDOW_LB_PGUP;
02942 }
02943
02944 r.y = thumbstart + SCROLLBAR_SIZE;
02945 r.h = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02946 if (Rect_ContainsPoint(&r, x, y))
02947 {
02948 return WINDOW_LB_PGDN;
02949 }
02950 }
02951 }
02952 return 0;
02953 }
|
|
|
Definition at line 5979 of file ui_shared.c. References displayContextDef_t::Assets, windowDef_t::borderColor, windowDef_t::borderSize, COLOR_MAX, listBoxDef_s::columnInfo, itemDef_s::cursorPos, listBoxDef_s::cursorPos, DC, displayContextDef_t::drawHandlePic, listBoxDef_s::drawPadding, displayContextDef_t::drawRect, displayContextDef_t::drawText, listBoxDef_s::elementHeight, listBoxDef_s::elementStyle, listBoxDef_s::elementWidth, listBoxDef_s::endPos, displayContextDef_t::feederCount, displayContextDef_t::feederItemImage, displayContextDef_t::feederItemText, displayContextDef_t::feederSelection, displayContextDef_t::fillRect, windowDef_t::flags, windowDef_t::foreColor, rectDef_t::h, itemDef_s::iMenuFont, vmCvar_t::integer, Item_ListBox_MaxScroll(), Item_ListBox_ThumbDrawPosition(), itemDef_t, LISTBOX_IMAGE, listBoxDef_t, MAX_STRING_CHARS, columnInfo_s::maxChars, NULL, listBoxDef_s::numColumns, windowDef_t::outlineColor, columnInfo_s::pos, qhandle_t, windowDef_t::rect, cachedAssets_t::scrollBar, SCROLLBAR_SIZE, cachedAssets_t::scrollBarArrowDown, cachedAssets_t::scrollBarArrowLeft, cachedAssets_t::scrollBarArrowRight, cachedAssets_t::scrollBarArrowUp, cachedAssets_t::scrollBarThumb, listBoxDef_s::scrollhidden, displayContextDef_t::setColor, itemDef_s::special, listBoxDef_s::startPos, itemDef_s::textaligny, displayContextDef_t::textHeight, itemDef_s::textscale, itemDef_s::textStyle, trap_SP_GetStringTextString(), itemDef_s::typeData, ui_char_color_blue, ui_char_color_green, ui_char_color_red, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, WINDOW_PLAYERCOLOR, rectDef_t::x, and rectDef_t::y. Referenced by Item_Paint().
05979 {
05980 float x, y, sizeWidth, count, i, i2,sizeHeight, thumb;
05981 int startPos;
05982 qhandle_t image;
05983 qhandle_t optionalImage1, optionalImage2, optionalImage3;
05984 listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
05985 //JLF MPMOVED
05986 int numlines;
05987
05988
05989 // the listbox is horizontal or vertical and has a fixed size scroll bar going either direction
05990 // elements are enumerated from the DC and either text or image handles are acquired from the DC as well
05991 // textscale is used to size the text, textalignx and textaligny are used to size image elements
05992 // there is no clipping available so only the last completely visible item is painted
05993 count = DC->feederCount(item->special);
05994
05995 //JLFLISTBOX MPMOVED
05996 #ifdef _XBOX
05997 listPtr->startPos = listPtr->cursorPos;
05998 //item->cursorPos = listPtr->startPos;
05999 #endif
06000 //JLFLISTBOX MPMOVED
06001 if (listPtr->startPos > (count?count-1:count))
06002 {//probably changed feeders, so reset
06003 listPtr->startPos = 0;
06004 }
06005 //JLF END
06006 if (item->cursorPos > (count?count-1:count))
06007 {//probably changed feeders, so reset
06008 item->cursorPos = (count?count-1:count);
06009 // NOTE : might consider moving this to any spot in here we change the cursor position
06010 DC->feederSelection( item->special, item->cursorPos, NULL );
06011 }
06012
06013
06014
06015 // default is vertical if horizontal flag is not here
06016 if (item->window.flags & WINDOW_HORIZONTAL)
06017 {
06018 #ifdef _DEBUG
06019 const char *text;
06020 #endif
06021
06022 //JLF new variable (code just indented) MPMOVED
06023 if (!listPtr->scrollhidden)
06024 {
06025 // draw scrollbar in bottom of the window
06026 // bar
06027 if (Item_ListBox_MaxScroll(item) > 0)
06028 {
06029 x = item->window.rect.x + 1;
06030 y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE - 1;
06031 DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowLeft);
06032 x += SCROLLBAR_SIZE - 1;
06033 sizeWidth = item->window.rect.w - (SCROLLBAR_SIZE * 2);
06034 DC->drawHandlePic(x, y, sizeWidth+1, SCROLLBAR_SIZE, DC->Assets.scrollBar);
06035 x += sizeWidth - 1;
06036 DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowRight);
06037 // thumb
06038 thumb = Item_ListBox_ThumbDrawPosition(item);//Item_ListBox_ThumbPosition(item);
06039 if (thumb > x - SCROLLBAR_SIZE - 1) {
06040 thumb = x - SCROLLBAR_SIZE - 1;
06041 }
06042 DC->drawHandlePic(thumb, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb);
06043 }
06044 else if (listPtr->startPos > 0)
06045 {
06046 listPtr->startPos = 0;
06047 }
06048 }
06049 //JLF end
06050 //
06051 listPtr->endPos = listPtr->startPos;
06052 sizeWidth = item->window.rect.w - 2;
06053 // items
06054 // size contains max available space
06055 if (listPtr->elementStyle == LISTBOX_IMAGE)
06056 {
06057 // fit = 0;
06058 x = item->window.rect.x + 1;
06059 y = item->window.rect.y + 1;
06060 for (i = listPtr->startPos; i < count; i++)
06061 {
06062 // always draw at least one
06063 // which may overdraw the box if it is too small for the element
06064 image = DC->feederItemImage(item->special, i);
06065 if (image)
06066 {
06067 #ifndef CGAME
06068 if (item->window.flags & WINDOW_PLAYERCOLOR)
06069 {
06070 vec4_t color;
06071
06072 color[0] = ui_char_color_red.integer/COLOR_MAX;
06073 color[1] = ui_char_color_green.integer/COLOR_MAX;
06074 color[2] = ui_char_color_blue.integer/COLOR_MAX;
06075 color[3] = 1.0f;
06076 DC->setColor(color);
06077 }
06078 #endif
06079 DC->drawHandlePic(x+1, y+1, listPtr->elementWidth - 2, listPtr->elementHeight - 2, image);
06080 }
06081
06082 if (i == item->cursorPos)
06083 {
06084 DC->drawRect(x, y, listPtr->elementWidth-1, listPtr->elementHeight-1, item->window.borderSize, item->window.borderColor);
06085 }
06086
06087 sizeWidth -= listPtr->elementWidth;
06088 if (sizeWidth < listPtr->elementWidth)
06089 {
06090 listPtr->drawPadding = sizeWidth; //listPtr->elementWidth - size;
06091 break;
06092 }
06093 x += listPtr->elementWidth;
06094 listPtr->endPos++;
06095 // fit++;
06096 }
06097 }
06098 else
06099 {
06100 //
06101 }
06102
06103 #ifdef _DEBUG
06104 // Show pic name
06105 text = DC->feederItemText(item->special, item->cursorPos, 0, &optionalImage1, &optionalImage2, &optionalImage3);
06106 if (text)
06107 {
06108 DC->drawText(item->window.rect.x, item->window.rect.y+item->window.rect.h, item->textscale, item->window.foreColor, text, 0, 0, item->textStyle, item->iMenuFont);
06109 }
06110 #endif
06111
06112 }
06113 // A vertical list box
06114 else
06115 {
06116 //JLF MPMOVED
06117 numlines = item->window.rect.h / listPtr->elementHeight;
06118 //JLFEND
06119 //JLF new variable (code idented with if)
06120 if (!listPtr->scrollhidden)
06121 {
06122
06123 // draw scrollbar to right side of the window
06124 x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE - 1;
06125 y = item->window.rect.y + 1;
06126 DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowUp);
06127 y += SCROLLBAR_SIZE - 1;
06128
06129 listPtr->endPos = listPtr->startPos;
06130 sizeHeight = item->window.rect.h - (SCROLLBAR_SIZE * 2);
06131 DC->drawHandlePic(x, y, SCROLLBAR_SIZE, sizeHeight+1, DC->Assets.scrollBar);
06132 y += sizeHeight - 1;
06133 DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowDown);
06134 // thumb
06135 thumb = Item_ListBox_ThumbDrawPosition(item);//Item_ListBox_ThumbPosition(item);
06136 if (thumb > y - SCROLLBAR_SIZE - 1) {
06137 thumb = y - SCROLLBAR_SIZE - 1;
06138 }
06139 DC->drawHandlePic(x, thumb, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb);
06140 }
06141 //JLF end
06142
06143 // adjust size for item painting
06144 sizeWidth = item->window.rect.w - 2;
06145 sizeHeight = item->window.rect.h - 2;
06146
06147 if (listPtr->elementStyle == LISTBOX_IMAGE)
06148 {
06149 // Multiple rows and columns (since it's more than twice as wide as an element)
06150 if ( item->window.rect.w > (listPtr->elementWidth*2) )
06151 {
06152 startPos = listPtr->startPos;
06153 x = item->window.rect.x + 1;
06154 y = item->window.rect.y + 1;
06155 // Next row
06156 for (i2 = startPos; i2 < count; i2++)
06157 {
06158 x = item->window.rect.x + 1;
06159 sizeWidth = item->window.rect.w - 2;
06160 // print a row
06161 for (i = startPos; i < count; i++)
06162 {
06163 // always draw at least one
06164 // which may overdraw the box if it is too small for the element
06165 image = DC->feederItemImage(item->special, i);
06166 if (image)
06167 {
06168 #ifndef CGAME
06169 if (item->window.flags & WINDOW_PLAYERCOLOR)
06170 {
06171 vec4_t color;
06172
06173 color[0] = ui_char_color_red.integer/COLOR_MAX;
06174 color[1] = ui_char_color_green.integer/COLOR_MAX;
06175 color[2] = ui_char_color_blue.integer/COLOR_MAX;
06176 color[3] = 1.0f;
06177 DC->setColor(color);
06178 }
06179 #endif
06180 DC->drawHandlePic(x+1, y+1, listPtr->elementWidth - 2, listPtr->elementHeight - 2, image);
06181 }
06182
06183 if (i == item->cursorPos)
06184 {
06185 DC->drawRect(x, y, listPtr->elementWidth-1, listPtr->elementHeight-1, item->window.borderSize, item->window.borderColor);
06186 }
06187
06188 sizeWidth -= listPtr->elementWidth;
06189 if (sizeWidth < listPtr->elementWidth)
06190 {
06191 listPtr->drawPadding = sizeWidth; //listPtr->elementWidth - size;
06192 break;
06193 }
06194 x += listPtr->elementWidth;
06195 listPtr->endPos++;
06196 }
06197
06198 sizeHeight -= listPtr->elementHeight;
06199 if (sizeHeight < listPtr->elementHeight)
06200 {
06201 listPtr->drawPadding = sizeHeight; //listPtr->elementWidth - size;
06202 break;
06203 }
06204 // NOTE : Is endPos supposed to be valid or not? It was being used as a valid entry but I changed those
06205 // few spots that were causing bugs
06206 listPtr->endPos++;
06207 startPos = listPtr->endPos;
06208 y += listPtr->elementHeight;
06209
06210 }
06211 }
06212 // single column
06213 else
06214 {
06215 x = item->window.rect.x + 1;
06216 y = item->window.rect.y + 1;
06217 for (i = listPtr->startPos; i < count; i++)
06218 {
06219 // always draw at least one
06220 // which may overdraw the box if it is too small for the element
06221 image = DC->feederItemImage(item->special, i);
06222 if (image)
06223 {
06224 DC->drawHandlePic(x+1, y+1, listPtr->elementWidth - 2, listPtr->elementHeight - 2, image);
06225 }
06226
06227 if (i == item->cursorPos)
06228 {
06229 DC->drawRect(x, y, listPtr->elementWidth - 1, listPtr->elementHeight - 1, item->window.borderSize, item->window.borderColor);
06230 }
06231
06232 listPtr->endPos++;
06233 sizeHeight -= listPtr->elementHeight;
06234 if (sizeHeight < listPtr->elementHeight)
06235 {
06236 listPtr->drawPadding = listPtr->elementHeight - sizeHeight;
06237 break;
06238 }
06239 y += listPtr->elementHeight;
06240 // fit++;
06241 }
06242 }
06243 }
06244 else
06245 {
06246 x = item->window.rect.x + 1;
06247 y = item->window.rect.y + 1;
06248 //JLF MPMOVED
06249 y = item->window.rect.y + 1 - listPtr->elementHeight;
06250 #ifdef _XBOX
06251 i = listPtr->startPos - (numlines/2);
06252 #else
06253 i = listPtr->startPos;
06254 #endif
06255
06256 for (; i < count; i++)
06257 //JLF END
06258 {
06259 const char *text;
06260 // always draw at least one
06261 // which may overdraw the box if it is too small for the element
06262 if (listPtr->numColumns > 0) {
06263 int j;//, subX = listPtr->elementHeight;
06264
06265 for (j = 0; j < listPtr->numColumns; j++)
06266 {
06267 char temp[MAX_STRING_CHARS];
06268 int imageStartX = listPtr->columnInfo[j].pos;
06269 text = DC->feederItemText(item->special, i, j, &optionalImage1, &optionalImage2, &optionalImage3);
06270
06271 if( !text )
06272 {
06273 continue;
06274 }
06275
06276 if (text[0]=='@')
06277 {
06278 trap_SP_GetStringTextString( &text[1] , temp, sizeof(temp));
06279 text = temp;
06280 }
06281
06282 /*
06283 if (optionalImage >= 0) {
06284 DC->drawHandlePic(x + 4 + listPtr->columnInfo[j].pos, y - 1 + listPtr->elementHeight / 2, listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage);
06285 }
06286 else
06287 */
06288 if ( text )
06289 {
06290 //JLF MPMOVED
06291 #ifdef _XBOX
06292 float fScaleA = item->textscale;
06293 #endif
06294 int textyOffset;
06295 #ifdef _XBOX
06296 textyOffset = DC->textHeight (text, fScaleA, item->iMenuFont);
06297 textyOffset *= -1;
06298 textyOffset /=2;
06299 textyOffset += listPtr->elementHeight/2;
06300 #else
06301 textyOffset = 0;
06302 #endif
06303 // DC->drawText(x + 4 + listPtr->columnInfo[j].pos, y + listPtr->elementHeight, item->textscale, item->window.foreColor, text, 0, listPtr->columnInfo[j].maxChars, item->textStyle);
06304 //WAS LAST DC->drawText(x + 4 + listPtr->columnInfo[j].pos, y, item->textscale, item->window.foreColor, text, 0, listPtr->columnInfo[j].maxChars, item->textStyle, item->iMenuFont);
06305 DC->drawText(x + 4 + listPtr->columnInfo[j].pos, y + listPtr->elementHeight+ textyOffset + item->textaligny, item->textscale, item->window.foreColor, text, 0,listPtr->columnInfo[j].maxChars, item->textStyle, item->iMenuFont);
06306
06307
06308 //JLF END
06309 }
06310 if ( j < listPtr->numColumns - 1 )
06311 {
06312 imageStartX = listPtr->columnInfo[j+1].pos;
06313 }
06314 DC->setColor( NULL );
06315 if (optionalImage3 >= 0)
06316 {
06317 DC->drawHandlePic(imageStartX - listPtr->elementHeight*3, y+listPtr->elementHeight+2, listPtr->elementHeight, listPtr->elementHeight, optionalImage3);
06318 }
06319 if (optionalImage2 >= 0)
06320 {
06321 DC->drawHandlePic(imageStartX - listPtr->elementHeight*2, y+listPtr->elementHeight+2, listPtr->elementHeight, listPtr->elementHeight, optionalImage2);
06322 }
06323 if (optionalImage1 >= 0)
06324 {
06325 DC->drawHandlePic(imageStartX - listPtr->elementHeight, y+listPtr->elementHeight+2, listPtr->elementHeight, listPtr->elementHeight, optionalImage1);
06326 }
06327 }
06328 }
06329 else
06330 {
06331 #ifdef _XBOX
06332 if (i >= 0)
06333 {
06334 #endif
06335 text = DC->feederItemText(item->special, i, 0, &optionalImage1, &optionalImage2, &optionalImage3 );
06336 if ( optionalImage1 >= 0 || optionalImage2 >= 0 || optionalImage3 >= 0)
06337 {
06338 //DC->drawHandlePic(x + 4 + listPtr->elementHeight, y, listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage);
06339 }
06340 else if (text)
06341 {
06342 // DC->drawText(x + 4, y + listPtr->elementHeight, item->textscale, item->window.foreColor, text, 0, 0, item->textStyle);
06343 DC->drawText(x + 4, y + item->textaligny, item->textscale, item->window.foreColor, text, 0, 0, item->textStyle, item->iMenuFont);
06344 }
06345 #ifdef _XBOX
06346 }
06347 #endif
06348 }
06349
06350 if (i == item->cursorPos)
06351 {
06352 DC->fillRect(x + 2, y + listPtr->elementHeight + 2, item->window.rect.w - SCROLLBAR_SIZE - 4, listPtr->elementHeight, item->window.outlineColor);
06353 }
06354
06355 sizeHeight -= listPtr->elementHeight;
06356 if (sizeHeight < listPtr->elementHeight)
06357 {
06358 listPtr->drawPadding = listPtr->elementHeight - sizeHeight;
06359 break;
06360 }
06361 listPtr->endPos++;
06362 y += listPtr->elementHeight;
06363 // fit++;
06364 }
06365 }
06366 }
06367 }
|
|
|
Definition at line 2751 of file ui_shared.c. References displayContextDef_t::cursorx, displayContextDef_t::cursory, DC, windowDef_t::flags, rectDef_t::h, Item_ListBox_ThumbPosition(), itemDef_t, min, windowDef_t::rect, SCROLLBAR_SIZE, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, rectDef_t::x, and rectDef_t::y. Referenced by Item_ListBox_Paint().
02752 {
02753 int min, max;
02754
02755 if (itemCapture == item)
02756 {
02757 if (item->window.flags & WINDOW_HORIZONTAL)
02758 {
02759 min = item->window.rect.x + SCROLLBAR_SIZE + 1;
02760 max = item->window.rect.x + item->window.rect.w - 2*SCROLLBAR_SIZE - 1;
02761 if (DC->cursorx >= min + SCROLLBAR_SIZE/2 && DC->cursorx <= max + SCROLLBAR_SIZE/2)
02762 {
02763 return DC->cursorx - SCROLLBAR_SIZE/2;
02764 }
02765 else
02766 {
02767 return Item_ListBox_ThumbPosition(item);
02768 }
02769 }
02770 else
02771 {
02772 min = item->window.rect.y + SCROLLBAR_SIZE + 1;
02773 max = item->window.rect.y + item->window.rect.h - 2*SCROLLBAR_SIZE - 1;
02774 if (DC->cursory >= min + SCROLLBAR_SIZE/2 && DC->cursory <= max + SCROLLBAR_SIZE/2)
02775 {
02776 return DC->cursory - SCROLLBAR_SIZE/2;
02777 }
02778 else
02779 {
02780 return Item_ListBox_ThumbPosition(item);
02781 }
02782 }
02783 }
02784 else
02785 {
02786 return Item_ListBox_ThumbPosition(item);
02787 }
02788 }
|
|
|
Definition at line 2724 of file ui_shared.c. References windowDef_t::flags, rectDef_t::h, Item_ListBox_MaxScroll(), itemDef_t, listBoxDef_t, windowDef_t::rect, SCROLLBAR_SIZE, listBoxDef_s::startPos, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, rectDef_t::x, and rectDef_t::y. Referenced by Item_ListBox_OverLB(), and Item_ListBox_ThumbDrawPosition().
02724 {
02725 float max, pos, size;
02726 listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
02727
02728 max = Item_ListBox_MaxScroll(item);
02729 if (item->window.flags & WINDOW_HORIZONTAL) {
02730 size = item->window.rect.w - (SCROLLBAR_SIZE * 2) - 2;
02731 if (max > 0) {
02732 pos = (size-SCROLLBAR_SIZE) / (float) max;
02733 } else {
02734 pos = 0;
02735 }
02736 pos *= listPtr->startPos;
02737 return item->window.rect.x + 1 + SCROLLBAR_SIZE + pos;
02738 }
02739 else {
02740 size = item->window.rect.h - (SCROLLBAR_SIZE * 2) - 2;
02741 if (max > 0) {
02742 pos = (size-SCROLLBAR_SIZE) / (float) max;
02743 } else {
02744 pos = 0;
02745 }
02746 pos *= listPtr->startPos;
02747 return item->window.rect.y + 1 + SCROLLBAR_SIZE + pos;
02748 }
02749 }
|
|
|
Definition at line 5694 of file ui_shared.c. References displayContextDef_t::addRefEntityToScene, modelDef_s::angle, AnglesToAxis(), animTable, itemDef_s::asset, displayContextDef_t::Assets, atan2(), refEntity_t::axis, AxisClear(), BOTH_FORCE_GETUP_F1, BOTH_FORCEINAIR1, BOTH_FORCEJUMP1, BOTH_FORCELAND1, BOTH_FORCELONGLEAP_LAND, BOTH_FORCELONGLEAP_START, BOTH_FORCEWALLREBOUND_FORWARD, BOTH_FORCEWALLRUNFLIP_END, BOTH_FORCEWALLRUNFLIP_START, BOTH_GETUP_BROLL_F, BOTH_GETUP_BROLL_R, BOTH_KNOCKDOWN1, BOTH_KNOCKDOWN2, BOTH_KNOCKDOWN3, CHAN_LOCAL, displayContextDef_t::clearScene, Com_sprintf(), refEntity_t::customSkin, DC, itemDef_s::flags, modelDef_s::fov_x, refdef_t::fov_x, modelDef_s::fov_y, refdef_t::fov_y, modelDef_s::g2anim, modelDef_s::g2maxs, modelDef_s::g2mins, modelDef_s::g2scale, modelDef_s::g2skin, refEntity_t::ghoul2, itemDef_s::ghoul2, rectDef_t::h, refdef_t::height, refEntity_t::hModel, vmCvar_t::integer, itemDef_t, ItemParse_asset_model_go(), ItemParse_model_g2anim_go(), ITF_ISANYSABER, ITF_ISCHARACTER, refEntity_t::lightingOrigin, M_PI, MAX_QPATH, memset(), displayContextDef_t::modelBounds, modelDef_t, refEntity_t::modelScale, uiInfo_t::moveAnimTime, cachedAssets_t::moveJumpSound, cachedAssets_t::moveRollSound, uiInfo_t::movesBaseAnim, name, NULL, refEntity_t::oldorigin, refEntity_t::origin, qtrue, refEntity_t::radius, RDF_NOWORLDMODEL, refdef_t::rdflags, displayContextDef_t::realTime, windowDef_t::rect, refEntity_t::renderfx, displayContextDef_t::renderScene, RF_LIGHTING_ORIGIN, RF_NOSHADOW, modelDef_s::rotationSpeed, refEntity_t::shaderRGBA, tan(), itemDef_s::textscale, refdef_t::time, trap_S_StartLocalSound(), itemDef_s::typeData, ui_char_color_blue, ui_char_color_green, ui_char_color_red, UI_Cvar_VariableString(), UI_SaberAttachToChar(), UI_SaberDrawBlades(), UI_ScaleModelAxis(), UI_UpdateCharacterSkin(), uiInfo_t::uiDC, uiInfo, vec3_t, VectorCopy, VectorSet, refdef_t::viewaxis, rectDef_t::w, refdef_t::width, itemDef_s::window, refdef_t::x, rectDef_t::x, displayContextDef_t::xscale, refdef_t::y, rectDef_t::y, and displayContextDef_t::yscale. Referenced by Item_Paint().
05695 {
05696 float x, y, w, h;
05697 refdef_t refdef;
05698 refEntity_t ent;
05699 vec3_t mins, maxs, origin;
05700 vec3_t angles;
05701 modelDef_t *modelPtr = (modelDef_t*)item->typeData;
05702
05703 if (modelPtr == NULL)
05704 {
05705 return;
05706 }
05707
05708 // a moves datapad anim is playing
05709 #ifndef CGAME
05710 if (uiInfo.moveAnimTime && (uiInfo.moveAnimTime < uiInfo.uiDC.realTime))
05711 {
05712 modelDef_t *modelPtr;
05713 modelPtr = (modelDef_t*)item->typeData;
05714 if (modelPtr)
05715 {
05716 char modelPath[MAX_QPATH];
05717
05718 Com_sprintf( modelPath, sizeof( modelPath ), "models/players/%s/model.glm", UI_Cvar_VariableString ( "ui_char_model" ) );
05719 //HACKHACKHACK: check for any multi-part anim sequences, and play the next anim, if needbe
05720 switch( modelPtr->g2anim )
05721 {
05722 case BOTH_FORCEWALLREBOUND_FORWARD:
05723 case BOTH_FORCEJUMP1:
05724 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCEINAIR1].name );
05725 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05726 if ( !uiInfo.moveAnimTime )
05727 {
05728 uiInfo.moveAnimTime = 500;
05729 }
05730 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05731 break;
05732 case BOTH_FORCEINAIR1:
05733 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCELAND1].name );
05734 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05735 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05736 break;
05737 case BOTH_FORCEWALLRUNFLIP_START:
05738 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCEWALLRUNFLIP_END].name );
05739 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05740 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05741 break;
05742 case BOTH_FORCELONGLEAP_START:
05743 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCELONGLEAP_LAND].name );
05744 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05745 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05746 break;
05747 case BOTH_KNOCKDOWN3://on front - into force getup
05748 trap_S_StartLocalSound( uiInfo.uiDC.Assets.moveJumpSound, CHAN_LOCAL );
05749 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCE_GETUP_F1].name );
05750 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05751 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05752 break;
05753 case BOTH_KNOCKDOWN2://on back - kick forward getup
05754 trap_S_StartLocalSound( uiInfo.uiDC.Assets.moveJumpSound, CHAN_LOCAL );
05755 ItemParse_model_g2anim_go( item, animTable[BOTH_GETUP_BROLL_F].name );
05756 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05757 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05758 break;
05759 case BOTH_KNOCKDOWN1://on back - roll-away
05760 trap_S_StartLocalSound( uiInfo.uiDC.Assets.moveRollSound, CHAN_LOCAL );
05761 ItemParse_model_g2anim_go( item, animTable[BOTH_GETUP_BROLL_R].name );
05762 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05763 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05764 break;
05765 default:
05766 ItemParse_model_g2anim_go( item, uiInfo.movesBaseAnim );
05767 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05768 uiInfo.moveAnimTime = 0;
05769 break;
05770 }
05771
05772 UI_UpdateCharacterSkin();
05773
05774 //update saber models
05775 UI_SaberAttachToChar( item );
05776 }
05777 }
05778 #endif
05779
05780 // setup the refdef
05781 memset( &refdef, 0, sizeof( refdef ) );
05782
05783 refdef.rdflags = RDF_NOWORLDMODEL;
05784 AxisClear( refdef.viewaxis );
05785 x = item->window.rect.x+1;
05786 y = item->window.rect.y+1;
05787 w = item->window.rect.w-2;
05788 h = item->window.rect.h-2;
05789
05790 refdef.x = x * DC->xscale;
05791 refdef.y = y * DC->yscale;
05792 refdef.width = w * DC->xscale;
05793 refdef.height = h * DC->yscale;
05794
05795 if (item->ghoul2)
05796 { //ghoul2 models don't have bounds, so we have to parse them.
05797 VectorCopy(modelPtr->g2mins, mins);
05798 VectorCopy(modelPtr->g2maxs, maxs);
05799
05800 if (!mins[0] && !mins[1] && !mins[2] &&
05801 !maxs[0] && !maxs[1] && !maxs[2])
05802 { //we'll use defaults then I suppose.
05803 VectorSet(mins, -16, -16, -24);
05804 VectorSet(maxs, 16, 16, 32);
05805 }
05806 }
05807 else
05808 {
05809 DC->modelBounds( item->asset, mins, maxs );
05810 }
05811
05812 origin[2] = -0.5 * ( mins[2] + maxs[2] );
05813 origin[1] = 0.5 * ( mins[1] + maxs[1] );
05814
05815 // calculate distance so the model nearly fills the box
05816 if (qtrue)
05817 {
05818 float len = 0.5 * ( maxs[2] - mins[2] );
05819 origin[0] = len / 0.268; // len / tan( fov/2 )
05820 //origin[0] = len / tan(w/2);
05821 }
05822 else
05823 {
05824 origin[0] = item->textscale;
05825 }
05826 refdef.fov_x = (modelPtr->fov_x) ? modelPtr->fov_x : (int)((float)refdef.width / 640.0f * 90.0f);
05827 refdef.fov_y = (modelPtr->fov_y) ? modelPtr->fov_y : atan2( refdef.height, refdef.width / tan( refdef.fov_x / 360 * M_PI ) ) * ( 360 / M_PI );
05828
05829 //refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
05830 //refdef.fov_y = atan2( refdef.height, refdef.width / tan( refdef.fov_x / 360 * M_PI ) ) * ( 360 / M_PI );
05831
05832 DC->clearScene();
05833
05834 refdef.time = DC->realTime;
05835
05836 // add the model
05837
05838 memset( &ent, 0, sizeof(ent) );
05839
05840 // use item storage to track
05841 if ( (item->flags&ITF_ISANYSABER) && !(item->flags&ITF_ISCHARACTER) )
05842 {//hack to put saber on it's side
05843 if (modelPtr->rotationSpeed)
05844 {
05845 VectorSet( angles, modelPtr->angle+(float)refdef.time/modelPtr->rotationSpeed, 0, 90 );
05846 }
05847 else
05848 {
05849 VectorSet( angles, modelPtr->angle, 0, 90 );
05850 }
05851 }
05852 else if (modelPtr->rotationSpeed)
05853 {
05854 VectorSet( angles, 0, modelPtr->angle + (float)refdef.time/modelPtr->rotationSpeed, 0 );
05855 }
05856 else
05857 {
05858 VectorSet( angles, 0, modelPtr->angle, 0 );
05859 }
05860
05861 AnglesToAxis( angles, ent.axis );
05862
05863 if (item->ghoul2)
05864 {
05865 ent.ghoul2 = item->ghoul2;
05866 ent.radius = 1000;
05867 ent.customSkin = modelPtr->g2skin;
05868
05869 VectorCopy(modelPtr->g2scale, ent.modelScale);
05870 UI_ScaleModelAxis(&ent);
05871 #ifndef CGAME
05872 if ( (item->flags&ITF_ISCHARACTER) )
05873 {
05874 ent.shaderRGBA[0] = ui_char_color_red.integer;
05875 ent.shaderRGBA[1] = ui_char_color_green.integer;
05876 ent.shaderRGBA[2] = ui_char_color_blue.integer;
05877 ent.shaderRGBA[3] = 255;
05878 // UI_TalkingHead(item);
05879 }
05880 if ( item->flags&ITF_ISANYSABER )
05881 {//UGH, draw the saber blade!
05882 UI_SaberDrawBlades( item, origin, angles );
05883 }
05884 #endif
05885 }
05886 else
05887 {
05888 ent.hModel = item->asset;
05889 }
05890 VectorCopy( origin, ent.origin );
05891 VectorCopy( ent.origin, ent.oldorigin );
05892
05893 // Set up lighting
05894 VectorCopy( origin, ent.lightingOrigin );
05895 ent.renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW;
05896
05897 DC->addRefEntityToScene( &ent );
05898 DC->renderScene( &refdef );
05899
05900 }
|
|
||||||||||||||||
|
Definition at line 3028 of file ui_shared.c. References CVAR_DISABLE, CVAR_ENABLE, CVAR_HIDE, CVAR_SHOW, itemDef_s::cvarFlags, itemDef_s::disabled, windowDef_t::flags, itemDef_s::flags, rectDef_t::h, Item_EnableShowViaCvar(), Item_ListBox_MouseEnter(), Item_RunScript(), Item_TextScroll_MouseEnter(), ITEM_TYPE_LISTBOX, ITEM_TYPE_TEXTSCROLL, itemDef_t, itemDef_s::mouseEnter, itemDef_s::mouseEnterText, itemDef_s::mouseExitText, Rect_ContainsPoint(), itemDef_s::textRect, itemDef_s::type, itemDef_s::window, WINDOW_HASFOCUS, WINDOW_MOUSEOVER, WINDOW_MOUSEOVERTEXT, and rectDef_t::y. Referenced by Menu_HandleMouseMove().
03028 {
03029
03030 rectDef_t r;
03031 if (item) {
03032 r = item->textRect;
03033 r.y -= r.h;
03034 // in the text rect?
03035
03036 // items can be enabled and disabled
03037 if (item->disabled)
03038 {
03039 return;
03040 }
03041
03042 // items can be enabled and disabled based on cvars
03043 if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
03044 return;
03045 }
03046
03047 if (item->cvarFlags & (CVAR_SHOW | CVAR_HIDE) && !Item_EnableShowViaCvar(item, CVAR_SHOW)) {
03048 return;
03049 }
03050
03051 //JLFMOUSE
03052 #ifndef _XBOX
03053 if (Rect_ContainsPoint(&r, x, y))
03054 #else
03055 if (item->flags & WINDOW_HASFOCUS)
03056 #endif
03057 {
03058 if (!(item->window.flags & WINDOW_MOUSEOVERTEXT)) {
03059 Item_RunScript(item, item->mouseEnterText);
03060 item->window.flags |= WINDOW_MOUSEOVERTEXT;
03061 }
03062 if (!(item->window.flags & WINDOW_MOUSEOVER)) {
03063 Item_RunScript(item, item->mouseEnter);
03064 item->window.flags |= WINDOW_MOUSEOVER;
03065 }
03066
03067 } else {
03068 // not in the text rect
03069 if (item->window.flags & WINDOW_MOUSEOVERTEXT) {
03070 // if we were
03071 Item_RunScript(item, item->mouseExitText);
03072 item->window.flags &= ~WINDOW_MOUSEOVERTEXT;
03073 }
03074 if (!(item->window.flags & WINDOW_MOUSEOVER)) {
03075 Item_RunScript(item, item->mouseEnter);
03076 item->window.flags |= WINDOW_MOUSEOVER;
03077 }
03078
03079 if (item->type == ITEM_TYPE_LISTBOX) {
03080 Item_ListBox_MouseEnter(item, x, y);
03081 }
03082 else if ( item->type == ITEM_TYPE_TEXTSCROLL )
03083 {
03084 Item_TextScroll_MouseEnter ( item, x, y );
03085 }
03086 }
03087 }
03088 }
|
|
|
Definition at line 3090 of file ui_shared.c. References windowDef_t::flags, Item_RunScript(), itemDef_t, itemDef_s::mouseExit, itemDef_s::mouseExitText, itemDef_s::window, WINDOW_LB_LEFTARROW, WINDOW_LB_RIGHTARROW, and WINDOW_MOUSEOVERTEXT. Referenced by Menu_HandleMouseMove().
03090 {
03091 if (item) {
03092 if (item->window.flags & WINDOW_MOUSEOVERTEXT) {
03093 Item_RunScript(item, item->mouseExitText);
03094 item->window.flags &= ~WINDOW_MOUSEOVERTEXT;
03095 }
03096 Item_RunScript(item, item->mouseExit);
03097 item->window.flags &= ~(WINDOW_LB_RIGHTARROW | WINDOW_LB_LEFTARROW);
03098 }
03099 }
|
|
|
Definition at line 3504 of file ui_shared.c. References multiDef_s::count, itemDef_t, multiDef_t, NULL, and itemDef_s::typeData. Referenced by Item_Multi_HandleKey().
03504 {
03505 multiDef_t *multiPtr = (multiDef_t*)item->typeData;
03506 if (multiPtr == NULL) {
03507 return 0;
03508 }
03509 return multiPtr->count;
03510 }
|
|
|
Definition at line 3512 of file ui_shared.c. References multiDef_s::count, itemDef_s::cvar, multiDef_s::cvarStr, multiDef_s::cvarValue, DC, displayContextDef_t::getCVarString, displayContextDef_t::getCVarValue, itemDef_t, multiDef_t, Q_stricmp(), multiDef_s::strDef, and itemDef_s::typeData. Referenced by Item_Multi_HandleKey().
03512 {
03513 char buff[2048];
03514 float value = 0;
03515 int i;
03516 multiDef_t *multiPtr = (multiDef_t*)item->typeData;
03517 if (multiPtr) {
03518 if (multiPtr->strDef) {
03519 DC->getCVarString(item->cvar, buff, sizeof(buff));
03520 } else {
03521 value = DC->getCVarValue(item->cvar);
03522 }
03523 for (i = 0; i < multiPtr->count; i++) {
03524 if (multiPtr->strDef) {
03525 if (Q_stricmp(buff, multiPtr->cvarStr[i]) == 0) {
03526 return i;
03527 }
03528 } else {
03529 if (multiPtr->cvarValue[i] == value) {
03530 return i;
03531 }
03532 }
03533 }
03534 }
03535 return 0;
03536 }
|
|
||||||||||||
|
Definition at line 3581 of file ui_shared.c. References A_CURSOR_LEFT, A_CURSOR_RIGHT, A_ENTER, A_MOUSE1, A_MOUSE2, A_MOUSE3, displayContextDef_t::cursorx, displayContextDef_t::cursory, itemDef_s::cvar, multiDef_s::cvarStr, multiDef_s::cvarValue, DC, displayContextDef_t::feederSelection, windowDef_t::flags, Item_Multi_CountSettings(), Item_Multi_FindCvarByValue(), itemDef_t, multiDef_t, qboolean, qfalse, qtrue, windowDef_t::rect, Rect_ContainsPoint(), displayContextDef_t::setCVar, itemDef_s::special, multiDef_s::strDef, itemDef_s::typeData, va(), itemDef_s::window, and WINDOW_HASFOCUS. Referenced by Item_HandleKey().
03582 {
03583 multiDef_t *multiPtr = (multiDef_t*)item->typeData;
03584 if (multiPtr)
03585 {
03586 //JLF MPMOVED
03587 #ifndef _XBOX
03588 if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS)
03589 #else
03590 if (item->window.flags & WINDOW_HASFOCUS)// JLF* && item->cvar)
03591 #endif
03592 {
03593 #ifndef _XBOX
03594
03595 if (key == A_MOUSE1 || key == A_ENTER || key == A_MOUSE2 || key == A_MOUSE3)
03596 #else
03597 //JLFDPAD MPMOVED
03598 if ( key == A_CURSOR_RIGHT || key == A_CURSOR_LEFT)
03599 //end JLFDPAD
03600 #endif
03601 {
03602 int current = Item_Multi_FindCvarByValue(item);
03603 int max = Item_Multi_CountSettings(item);
03604
03605 if (key == A_MOUSE2 || key == A_CURSOR_LEFT) // Xbox uses CURSOR_LEFT
03606 {
03607 current--;
03608 if ( current < 0 )
03609 {
03610 current = max-1;
03611 }
03612 }
03613 else
03614 {
03615 current++;
03616 if ( current >= max )
03617 {
03618 current = 0;
03619 }
03620 }
03621
03622 if (multiPtr->strDef)
03623 {
03624 DC->setCVar(item->cvar, multiPtr->cvarStr[current]);
03625 }
03626 else
03627 {
03628 float value = multiPtr->cvarValue[current];
03629 if (((float)((int) value)) == value)
03630 {
03631 DC->setCVar(item->cvar, va("%i", (int) value ));
03632 }
03633 else
03634 {
03635 DC->setCVar(item->cvar, va("%f", value ));
03636 }
03637 }
03638 if (item->special)
03639 {//its a feeder?
03640 DC->feederSelection(item->special, current, item);
03641 }
03642
03643 return qtrue;
03644 }
03645 }
03646 }
03647 return qfalse;
03648 }
|
|
|
Definition at line 5128 of file ui_shared.c. References DC, displayContextDef_t::drawText, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, displayContextDef_t::getCVarString, itemDef_s::iMenuFont, Item_Multi_Setting(), Item_Text_Paint(), itemDef_t, LerpColor(), MAX_STRING_CHARS, memcpy(), itemDef_s::parent, PULSE_DIVISOR, displayContextDef_t::realTime, sin(), itemDef_s::text, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, trap_SP_GetStringTextString(), vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, itemDef_s::xoffset, and rectDef_t::y. Referenced by Item_Paint().
05128 {
05129 vec4_t newColor, lowLight;
05130 const char *text = "";
05131 menuDef_t *parent = (menuDef_t*)item->parent;
05132 char temp[MAX_STRING_CHARS];
05133
05134 if (item->window.flags & WINDOW_HASFOCUS) {
05135 lowLight[0] = 0.8 * parent->focusColor[0];
05136 lowLight[1] = 0.8 * parent->focusColor[1];
05137 lowLight[2] = 0.8 * parent->focusColor[2];
05138 lowLight[3] = 0.8 * parent->focusColor[3];
05139 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
05140 } else {
05141 memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
05142 }
05143
05144 text = Item_Multi_Setting(item);
05145 if (*text == '@') // string reference
05146 {
05147 trap_SP_GetStringTextString( &text[1] , temp, sizeof(temp));
05148 text = temp;
05149 }
05150 // Is is specifying a cvar to get the item name from?
05151 else if (*text == '*')
05152 {
05153 DC->getCVarString(&text[1], temp, sizeof(temp));
05154 text = temp;
05155 }
05156
05157 if (item->text) {
05158 Item_Text_Paint(item);
05159 //JLF MPMOVED
05160 #ifdef _XBOX
05161 if ( item->xoffset)
05162 DC->drawText(item->textRect.x + item->textRect.w + item->xoffset, item->textRect.y, item->textscale, newColor, text, 0,0, item->textStyle, item->iMenuFont);
05163 else
05164 #endif
05165 DC->drawText(item->textRect.x + item->textRect.w + 8, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle,item->iMenuFont);
05166 } else {
05167 //JLF added xoffset
05168 DC->drawText(item->textRect.x+item->xoffset, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle,item->iMenuFont);
05169 }
05170 }
|
|
|
Definition at line 3538 of file ui_shared.c. References multiDef_s::count, itemDef_s::cvar, multiDef_s::cvarList, multiDef_s::cvarStr, multiDef_s::cvarValue, DC, displayContextDef_t::getCVarString, displayContextDef_t::getCVarValue, itemDef_t, multiDef_t, Q_stricmp(), multiDef_s::strDef, and itemDef_s::typeData. Referenced by Item_Multi_Paint().
03538 {
03539 char buff[2048];
03540 float value = 0;
03541 int i;
03542 multiDef_t *multiPtr = (multiDef_t*)item->typeData;
03543 if (multiPtr)
03544 {
03545 if (multiPtr->strDef)
03546 {
03547 if (item->cvar)
03548 {
03549 DC->getCVarString(item->cvar, buff, sizeof(buff));
03550 }
03551 }
03552 else
03553 {
03554 if (item->cvar) // Was a cvar given?
03555 {
03556 value = DC->getCVarValue(item->cvar);
03557 }
03558 }
03559
03560 for (i = 0; i < multiPtr->count; i++)
03561 {
03562 if (multiPtr->strDef)
03563 {
03564 if (Q_stricmp(buff, multiPtr->cvarStr[i]) == 0)
03565 {
03566 return multiPtr->cvarList[i];
03567 }
03568 }
03569 else
03570 {
03571 if (multiPtr->cvarValue[i] == value)
03572 {
03573 return multiPtr->cvarList[i];
03574 }
03575 }
03576 }
03577 }
03578 return "";
03579 }
|
|
||||||||||||
|
|
Definition at line 6370 of file ui_shared.c. References itemDef_s::alignment, windowDef_t::background, BLINK_DIVISOR, colorRangeDef_t::color, itemDef_s::colorRanges, CVAR_DISABLE, CVAR_ENABLE, itemDef_s::cvarFlags, DC, menuDef_t::disableColor, itemDef_s::disabled, Fade(), menuDef_t::fadeAmount, menuDef_t::fadeClamp, menuDef_t::fadeCycle, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, displayContextDef_t::getValue, rectDef_t::h, colorRangeDef_t::high, itemDef_s::iMenuFont, Item_EnableShowViaCvar(), Item_Text_Paint(), ITEM_TEXTSTYLE_BLINK, itemDef_t, LerpColor(), colorRangeDef_t::low, memcpy(), windowDef_t::nextTime, NULL, itemDef_s::numColors, windowDef_t::ownerDraw, windowDef_t::ownerDrawFlags, displayContextDef_t::ownerDrawItem, itemDef_s::parent, PULSE_DIVISOR, qtrue, displayContextDef_t::realTime, windowDef_t::rect, sin(), itemDef_s::special, itemDef_s::text, itemDef_s::textalignx, itemDef_s::textaligny, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, and rectDef_t::y. Referenced by Item_Paint().
06370 {
06371 menuDef_t *parent;
06372
06373 if (item == NULL) {
06374 return;
06375 }
06376 parent = (menuDef_t*)item->parent;
06377
06378 if (DC->ownerDrawItem) {
06379 vec4_t color, lowLight;
06380 menuDef_t *parent = (menuDef_t*)item->parent;
06381 Fade(&item->window.flags, &item->window.foreColor[3], parent->fadeClamp, &item->window.nextTime, parent->fadeCycle, qtrue, parent->fadeAmount);
06382 memcpy(&color, &item->window.foreColor, sizeof(color));
06383 if (item->numColors > 0 && DC->getValue) {
06384 // if the value is within one of the ranges then set color to that, otherwise leave at default
06385 int i;
06386 float f = DC->getValue(item->window.ownerDraw);
06387 for (i = 0; i < item->numColors; i++) {
06388 if (f >= item->colorRanges[i].low && f <= item->colorRanges[i].high) {
06389 memcpy(&color, &item->colorRanges[i].color, sizeof(color));
06390 break;
06391 }
06392 }
06393 }
06394
06395 if (item->window.flags & WINDOW_HASFOCUS) {
06396 lowLight[0] = 0.8 * parent->focusColor[0];
06397 lowLight[1] = 0.8 * parent->focusColor[1];
06398 lowLight[2] = 0.8 * parent->focusColor[2];
06399 lowLight[3] = 0.8 * parent->focusColor[3];
06400 LerpColor(parent->focusColor,lowLight,color,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
06401 } else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime/BLINK_DIVISOR) & 1)) {
06402 lowLight[0] = 0.8 * item->window.foreColor[0];
06403 lowLight[1] = 0.8 * item->window.foreColor[1];
06404 lowLight[2] = 0.8 * item->window.foreColor[2];
06405 lowLight[3] = 0.8 * item->window.foreColor[3];
06406 LerpColor(item->window.foreColor,lowLight,color,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
06407 }
06408
06409 if (item->disabled)
06410 {
06411 memcpy(color, parent->disableColor, sizeof(vec4_t)); // bk001207 - FIXME: Com_Memcpy
06412 }
06413
06414 if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
06415 memcpy(color, parent->disableColor, sizeof(vec4_t)); // bk001207 - FIXME: Com_Memcpy
06416 }
06417
06418 if (item->text) {
06419 Item_Text_Paint(item);
06420 if (item->text[0]) {
06421 // +8 is an offset kludge to properly align owner draw items that have text combined with them
06422 DC->ownerDrawItem(item->textRect.x + item->textRect.w + 8, item->window.rect.y, item->window.rect.w, item->window.rect.h, 0, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle,item->iMenuFont);
06423 } else {
06424 DC->ownerDrawItem(item->textRect.x + item->textRect.w, item->window.rect.y, item->window.rect.w, item->window.rect.h, 0, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle,item->iMenuFont);
06425 }
06426 } else {
06427 DC->ownerDrawItem(item->window.rect.x, item->window.rect.y, item->window.rect.w, item->window.rect.h, item->textalignx, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle,item->iMenuFont);
06428 }
06429 }
06430 }
|
|
|
Definition at line 6433 of file ui_shared.c. References cos(), CVAR_HIDE, CVAR_SHOW, itemDef_s::cvarFlags, DC, menuDef_t::descAlignment, menuDef_t::descColor, menuDef_t::descScale, itemDef_s::descText, menuDef_t::descX, menuDef_t::descY, Display_KeyBindPending(), displayContextDef_t::drawRect, displayContextDef_t::drawText, menuDef_t::fadeAmount, menuDef_t::fadeClamp, menuDef_t::fadeCycle, windowDef_t::flags, FONT_MEDIUM, FONT_SMALL2, modelDef_s::fov_Effectx, modelDef_s::fov_Effecty, modelDef_s::fov_x, modelDef_s::fov_x2, modelDef_s::fov_y, modelDef_s::fov_y2, modelDef_s::g2maxs, modelDef_s::g2maxs2, modelDef_s::g2maxsEffect, modelDef_s::g2mins, modelDef_s::g2mins2, modelDef_s::g2minsEffect, rectDef_t::h, ITEM_ALIGN_CENTER, ITEM_ALIGN_RIGHT, Item_Bind_Paint(), Item_EnableShowViaCvar(), Item_ListBox_Paint(), Item_Model_Paint(), Item_Multi_Paint(), Item_OwnerDraw_Paint(), Item_Slider_Paint(), Item_Text_Paint(), Item_TextColor(), Item_TextField_Paint(), Item_TextScroll_Paint(), ITEM_TYPE_BIND, ITEM_TYPE_BUTTON, ITEM_TYPE_CHECKBOX, ITEM_TYPE_COMBO, ITEM_TYPE_EDITFIELD, ITEM_TYPE_LISTBOX, ITEM_TYPE_MODEL, ITEM_TYPE_MULTI, ITEM_TYPE_NUMERICFIELD, ITEM_TYPE_OWNERDRAW, ITEM_TYPE_RADIOBUTTON, ITEM_TYPE_SLIDER, ITEM_TYPE_TEXT, ITEM_TYPE_TEXTSCROLL, ITEM_TYPE_YESNO, Item_UpdatePosition(), Item_YesNo_Paint(), itemDef_t, M_PI, MAX_STRING_CHARS, modelDef_t, windowDef_t::nextTime, NULL, windowDef_t::offsetTime, windowDef_t::ownerDrawFlags, displayContextDef_t::ownerDrawVisible, itemDef_s::parent, displayContextDef_t::realTime, windowDef_t::rect, windowDef_t::rectClient, windowDef_t::rectEffects, windowDef_t::rectEffects2, SCREEN_WIDTH, sin(), displayContextDef_t::textHeight, itemDef_s::textStyle, displayContextDef_t::textWidth, trap_SP_GetStringTextString(), itemDef_s::type, itemDef_s::typeData, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, WINDOW_INTRANSITION, WINDOW_INTRANSITIONMODEL, WINDOW_MOUSEOVER, WINDOW_ORBITING, Window_Paint(), WINDOW_TIMEDVISIBLE, WINDOW_VISIBLE, rectDef_t::x, and rectDef_t::y. Referenced by Menu_Paint().
06434 {
06435 vec4_t red;
06436 menuDef_t *parent = (menuDef_t*)item->parent;
06437 int xPos,textWidth;
06438 vec4_t color = {1, 1, 1, 1};
06439
06440 red[0] = red[3] = 1;
06441 red[1] = red[2] = 0;
06442
06443 if (item == NULL)
06444 {
06445 return;
06446 }
06447
06448 if (item->window.flags & WINDOW_ORBITING)
06449 {
06450 if (DC->realTime > item->window.nextTime)
06451 {
06452 float rx, ry, a, c, s, w, h;
06453
06454 item->window.nextTime = DC->realTime + item->window.offsetTime;
06455 // translate
06456 w = item->window.rectClient.w / 2;
06457 h = item->window.rectClient.h / 2;
06458 rx = item->window.rectClient.x + w - item->window.rectEffects.x;
06459 ry = item->window.rectClient.y + h - item->window.rectEffects.y;
06460 a = 3 * M_PI / 180;
06461 c = cos(a);
06462 s = sin(a);
06463 item->window.rectClient.x = (rx * c - ry * s) + item->window.rectEffects.x - w;
06464 item->window.rectClient.y = (rx * s + ry * c) + item->window.rectEffects.y - h;
06465 Item_UpdatePosition(item);
06466 }
06467 }
06468
06469
06470 if (item->window.flags & WINDOW_INTRANSITION)
06471 {
06472 if (DC->realTime > item->window.nextTime)
06473 {
06474 int done = 0;
06475 item->window.nextTime = DC->realTime + item->window.offsetTime;
06476
06477 // transition the x,y
06478 if (item->window.rectClient.x == item->window.rectEffects.x)
06479 {
06480 done++;
06481 }
06482 else
06483 {
06484 if (item->window.rectClient.x < item->window.rectEffects.x)
06485 {
06486 item->window.rectClient.x += item->window.rectEffects2.x;
06487 if (item->window.rectClient.x > item->window.rectEffects.x)
06488 {
06489 item->window.rectClient.x = item->window.rectEffects.x;
06490 done++;
06491 }
06492 }
06493 else
06494 {
06495 item->window.rectClient.x -= item->window.rectEffects2.x;
06496 if (item->window.rectClient.x < item->window.rectEffects.x)
06497 {
06498 item->window.rectClient.x = item->window.rectEffects.x;
06499 done++;
06500 }
06501 }
06502 }
06503
06504 if (item->window.rectClient.y == item->window.rectEffects.y)
06505 {
06506 done++;
06507 }
06508 else
06509 {
06510 if (item->window.rectClient.y < item->window.rectEffects.y)
06511 {
06512 item->window.rectClient.y += item->window.rectEffects2.y;
06513 if (item->window.rectClient.y > item->window.rectEffects.y)
06514 {
06515 item->window.rectClient.y = item->window.rectEffects.y;
06516 done++;
06517 }
06518 }
06519 else
06520 {
06521 item->window.rectClient.y -= item->window.rectEffects2.y;
06522 if (item->window.rectClient.y < item->window.rectEffects.y)
06523 {
06524 item->window.rectClient.y = item->window.rectEffects.y;
06525 done++;
06526 }
06527 }
06528 }
06529
06530 if (item->window.rectClient.w == item->window.rectEffects.w)
06531 {
06532 done++;
06533 }
06534 else
06535 {
06536 if (item->window.rectClient.w < item->window.rectEffects.w)
06537 {
06538 item->window.rectClient.w += item->window.rectEffects2.w;
06539 if (item->window.rectClient.w > item->window.rectEffects.w)
06540 {
06541 item->window.rectClient.w = item->window.rectEffects.w;
06542 done++;
06543 }
06544 }
06545 else
06546 {
06547 item->window.rectClient.w -= item->window.rectEffects2.w;
06548 if (item->window.rectClient.w < item->window.rectEffects.w)
06549 {
06550 item->window.rectClient.w = item->window.rectEffects.w;
06551 done++;
06552 }
06553 }
06554 }
06555
06556 if (item->window.rectClient.h == item->window.rectEffects.h)
06557 {
06558 done++;
06559 }
06560 else
06561 {
06562 if (item->window.rectClient.h < item->window.rectEffects.h)
06563 {
06564 item->window.rectClient.h += item->window.rectEffects2.h;
06565 if (item->window.rectClient.h > item->window.rectEffects.h)
06566 {
06567 item->window.rectClient.h = item->window.rectEffects.h;
06568 done++;
06569 }
06570 }
06571 else
06572 {
06573 item->window.rectClient.h -= item->window.rectEffects2.h;
06574 if (item->window.rectClient.h < item->window.rectEffects.h)
06575 {
06576 item->window.rectClient.h = item->window.rectEffects.h;
06577 done++;
06578 }
06579 }
06580 }
06581
06582 Item_UpdatePosition(item);
06583
06584 if (done == 4)
06585 {
06586 item->window.flags &= ~WINDOW_INTRANSITION;
06587 }
06588
06589 }
06590 }
06591
06592 #ifdef _TRANS3
06593
06594 //JLF begin model transition stuff
06595 if (item->window.flags & WINDOW_INTRANSITIONMODEL)
06596 {
06597 if ( item->type == ITEM_TYPE_MODEL)
06598 {
06599 //fields ing modelptr
06600 // vec3_t g2mins2, g2maxs2, g2minsEffect, g2maxsEffect;
06601 // float fov_x2, fov_y2, fov_Effectx, fov_Effecty;
06602
06603 modelDef_t * modelptr = (modelDef_t *)item->typeData;
06604
06605 if (DC->realTime > item->window.nextTime)
06606 {
06607 int done = 0;
06608 item->window.nextTime = DC->realTime + item->window.offsetTime;
06609
06610
06611 // transition the x,y,z max
06612 if (modelptr->g2maxs[0] == modelptr->g2maxs2[0])
06613 {
06614 done++;
06615 }
06616 else
06617 {
06618 if (modelptr->g2maxs[0] < modelptr->g2maxs2[0])
06619 {
06620 modelptr->g2maxs[0] += modelptr->g2maxsEffect[0];
06621 if (modelptr->g2maxs[0] > modelptr->g2maxs2[0])
06622 {
06623 modelptr->g2maxs[0] = modelptr->g2maxs2[0];
06624 done++;
06625 }
06626 }
06627 else
06628 {
06629 modelptr->g2maxs[0] -= modelptr->g2maxsEffect[0];
06630 if (modelptr->g2maxs[0] < modelptr->g2maxs2[0])
06631 {
06632 modelptr->g2maxs[0] = modelptr->g2maxs2[0];
06633 done++;
06634 }
06635 }
06636 }
06637 //y
06638 if (modelptr->g2maxs[1] == modelptr->g2maxs2[1])
06639 {
06640 done++;
06641 }
06642 else
06643 {
06644 if (modelptr->g2maxs[1] < modelptr->g2maxs2[1])
06645 {
06646 modelptr->g2maxs[1] += modelptr->g2maxsEffect[1];
06647 if (modelptr->g2maxs[1] > modelptr->g2maxs2[1])
06648 {
06649 modelptr->g2maxs[1] = modelptr->g2maxs2[1];
06650 done++;
06651 }
06652 }
06653 else
06654 {
06655 modelptr->g2maxs[1] -= modelptr->g2maxsEffect[1];
06656 if (modelptr->g2maxs[1] < modelptr->g2maxs2[1])
06657 {
06658 modelptr->g2maxs[1] = modelptr->g2maxs2[1];
06659 done++;
06660 }
06661 }
06662 }
06663
06664
06665 //z
06666
06667 if (modelptr->g2maxs[2] == modelptr->g2maxs2[2])
06668 {
06669 done++;
06670 }
06671 else
06672 {
06673 if (modelptr->g2maxs[2] < modelptr->g2maxs2[2])
06674 {
06675 modelptr->g2maxs[2] += modelptr->g2maxsEffect[2];
06676 if (modelptr->g2maxs[2] > modelptr->g2maxs2[2])
06677 {
06678 modelptr->g2maxs[2] = modelptr->g2maxs2[2];
06679 done++;
06680 }
06681 }
06682 else
06683 {
06684 modelptr->g2maxs[2] -= modelptr->g2maxsEffect[2];
06685 if (modelptr->g2maxs[2] < modelptr->g2maxs2[2])
06686 {
06687 modelptr->g2maxs[2] = modelptr->g2maxs2[2];
06688 done++;
06689 }
06690 }
06691 }
06692
06693 // transition the x,y,z min
06694 if (modelptr->g2mins[0] == modelptr->g2mins2[0])
06695 {
06696 done++;
06697 }
06698 else
06699 {
06700 if (modelptr->g2mins[0] < modelptr->g2mins2[0])
06701 {
06702 modelptr->g2mins[0] += modelptr->g2minsEffect[0];
06703 if (modelptr->g2mins[0] > modelptr->g2mins2[0])
06704 {
06705 modelptr->g2mins[0] = modelptr->g2mins2[0];
06706 done++;
06707 }
06708 }
06709 else
06710 {
06711 modelptr-> |