Skip to content

Commit

Permalink
All Games|Menu: Added MNList method for getting item's data
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jun 23, 2012
1 parent 0655512 commit ec81cf2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doomsday/plugins/common/include/hu_lib.h
Expand Up @@ -623,6 +623,9 @@ void MNList_UpdateGeometry(mn_object_t* ob, mn_page_t* page);
/// @return Index of the currently selected item else -1.
int MNList_Selection(mn_object_t* ob);

/// @return Data of item at position @a index. 0 if index is out of bounds.
int MNList_ItemData(const mn_object_t* obj, int index);

/// @return @c true if the currently selected item is presently visible.
boolean MNList_SelectionIsVisible(mn_object_t* ob);

Expand Down
15 changes: 15 additions & 0 deletions doomsday/plugins/common/src/hu_lib.c
Expand Up @@ -2229,6 +2229,18 @@ boolean MNList_SelectionIsVisible(mn_object_t* obj)
return (list->selection >= list->first && list->selection < list->first + list->numvis);
}

int MNList_ItemData(const mn_object_t* obj, int index)
{
mndata_list_t* list = (mndata_list_t*)obj->_typedata;
mndata_listitem_t* item;

assert(obj && (obj->_type == MN_LIST || obj->_type == MN_LISTINLINE));
if(index < 0 || index >= list->count) return 0;

item = &((mndata_listitem_t*) list->items)[index];
return item->data;
}

int MNList_FindItem(const mn_object_t* obj, int dataValue)
{
mndata_list_t* list = (mndata_list_t*)obj->_typedata;
Expand Down Expand Up @@ -3417,6 +3429,7 @@ void MNMobjPreview_Drawer(mn_object_t* ob, const Point2Raw* offset)
float s, t, scale;
Point2Raw origin;
Size2Raw size;

assert(ob->_type == MN_MOBJPREVIEW);

if(MT_NONE == mop->mobjType) return;
Expand All @@ -3439,7 +3452,9 @@ void MNMobjPreview_Drawer(mn_object_t* ob, const Point2Raw* offset)
tMap = mop->tMap;
// Are we cycling the translation map?
if(tMap == NUMPLAYERCOLORS)
{
tMap = menuTime / 5 % NUMPLAYERCOLORS;
}
#if __JHEXEN__
if(mop->plrClass >= PCLASS_FIGHTER)
R_GetTranslation(mop->plrClass, tMap, &tClass, &tMap);
Expand Down

0 comments on commit ec81cf2

Please sign in to comment.