MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Script_SetItemRect

Function Script_SetItemRect

code/ui/ui_shared.cpp:2002–2038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2000}
2001
2002qboolean Script_SetItemRect(itemDef_t *item, const char **args)
2003{
2004 const char *itemname;
2005 rectDef_t *out;
2006 rectDef_t rect;
2007
2008 // expecting type of color to set and 4 args for the color
2009 if (String_Parse(args, &itemname))
2010 {
2011 itemDef_t *item2;
2012 int j;
2013 int count = Menu_ItemsMatchingGroup((menuDef_t *) item->parent, itemname);
2014
2015 if (!Rect_Parse(args, &rect))
2016 {
2017 return qtrue;
2018 }
2019
2020 for (j = 0; j < count; j++)
2021 {
2022 item2 = Menu_GetMatchingItemByNumber((menuDef_t *) item->parent, j, itemname);
2023 if (item2 != NULL)
2024 {
2025 out = &item2->window.rect;
2026
2027 if (out)
2028 {
2029 item2->window.rect.x = rect.x;
2030 item2->window.rect.y = rect.y;
2031 item2->window.rect.w = rect.w;
2032 item2->window.rect.h = rect.h;
2033 }
2034 }
2035 }
2036 }
2037 return qtrue;
2038}
2039
2040/*
2041=================

Callers

nothing calls this directly

Calls 4

String_ParseFunction · 0.70
Menu_ItemsMatchingGroupFunction · 0.70
Rect_ParseFunction · 0.70

Tested by

no test coverage detected