MCPcopy Create free account
hub / github.com/NetHack/NetHack / calc_std_winplace

Function calc_std_winplace

outdated/win/gem/wingem1.c:2135–2198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2133 window_border(0, 0, 0, z_ob->ob_width, z_ob->ob_height, area);
2134}
2135void
2136calc_std_winplace(int which, GRECT *place)
2137{
2138 static int todo = TRUE;
2139 static GRECT me, ma, st;
2140
2141 if (todo || which < 0) {
2142 OBJECT *z_ob;
2143 int map_h_off, foo;
2144
2145 /* First the messagewin */
2146 recalc_msg_win(&me);
2147
2148 /* Now the map */
2149 wind_calc(WC_BORDER, MAP_GADGETS, 0, 0,
2150 scroll_map.px_hline * (COLNO - 1),
2151 scroll_map.px_vline * ROWNO, &foo, &foo, &foo, &map_h_off);
2152 map_h_off -= scroll_map.px_vline * ROWNO;
2153 window_border(MAP_GADGETS, 0, 0, scroll_map.px_hline * (COLNO - 1),
2154 scroll_map.px_vline * ROWNO, &ma);
2155
2156 /* Next the statuswin */
2157 recalc_status_win(&st);
2158
2159 /* And last but not least a final test */
2160 ma.g_h = map_h_off + scroll_map.px_vline * ROWNO;
2161 while (me.g_h + ma.g_h + st.g_h >= desk.g_h)
2162 ma.g_h -= scroll_map.px_vline;
2163 /* stack the windows */
2164 ma.g_y = me.g_y = st.g_y = desk.g_y;
2165 if (status_align) {
2166 ma.g_y += st.g_h;
2167 if (msg_align) {
2168 st.g_y += me.g_h;
2169 ma.g_y += me.g_h;
2170 } else {
2171 me.g_y += st.g_h + ma.g_h;
2172 }
2173 } else {
2174 if (msg_align) {
2175 ma.g_y += me.g_h;
2176 } else {
2177 me.g_y += ma.g_h;
2178 }
2179 st.g_y += me.g_h + ma.g_h;
2180 }
2181
2182 if (which)
2183 todo = FALSE;
2184 }
2185 switch (which) {
2186 case NHW_MESSAGE:
2187 *place = me;
2188 break;
2189 case NHW_MAP:
2190 *place = ma;
2191 break;
2192 case NHW_STATUS:

Callers 2

rearrange_windowsFunction · 0.85
mar_display_nhwindowFunction · 0.85

Calls 2

recalc_msg_winFunction · 0.85
recalc_status_winFunction · 0.85

Tested by

no test coverage detected