Difference between revisions of "Source:NetHack 3.6.0/src/windows.c"
Jump to navigation
Jump to search
Line 127: | Line 127: | ||
<span id="line120">120. };</span> | <span id="line120">120. };</span> | ||
<span id="line121">121. </span> | <span id="line121">121. </span> | ||
+ | |||
+ | == Window chain functions == | ||
+ | |||
<span id="line122">122. #ifdef WINCHAIN</span> | <span id="line122">122. #ifdef WINCHAIN</span> | ||
<span id="line123">123. struct winlink {</span> | <span id="line123">123. struct winlink {</span> | ||
Line 137: | Line 140: | ||
<span id="line130">130. static struct winlink *chain = 0;</span> | <span id="line130">130. static struct winlink *chain = 0;</span> | ||
<span id="line131">131. </span> | <span id="line131">131. </span> | ||
+ | |||
+ | === wl_new === | ||
+ | |||
<span id="line132">132. static struct winlink *</span> | <span id="line132">132. static struct winlink *</span> | ||
<span id="line133">133. wl_new()</span> | <span id="line133">133. wl_new()</span> | ||
Line 142: | Line 148: | ||
<span id="line135">135. return calloc(1, sizeof(struct winlink));</span> | <span id="line135">135. return calloc(1, sizeof(struct winlink));</span> | ||
<span id="line136">136. }</span> | <span id="line136">136. }</span> | ||
+ | |||
+ | === wl_addhead === | ||
+ | |||
<span id="line137">137. static void</span> | <span id="line137">137. static void</span> | ||
<span id="line138">138. wl_addhead(struct winlink *wl)</span> | <span id="line138">138. wl_addhead(struct winlink *wl)</span> | ||
Line 148: | Line 157: | ||
<span id="line141">141. chain = wl;</span> | <span id="line141">141. chain = wl;</span> | ||
<span id="line142">142. }</span> | <span id="line142">142. }</span> | ||
+ | |||
+ | === wl_addtail === | ||
+ | |||
<span id="line143">143. static void</span> | <span id="line143">143. static void</span> | ||
<span id="line144">144. wl_addtail(struct winlink *wl)</span> | <span id="line144">144. wl_addtail(struct winlink *wl)</span> | ||
Line 165: | Line 177: | ||
<span id="line158">158. #endif /* WINCHAIN */</span> | <span id="line158">158. #endif /* WINCHAIN */</span> | ||
<span id="line159">159. </span> | <span id="line159">159. </span> | ||
+ | |||
+ | |||
<span id="line160">160. static struct win_choices *last_winchoice = 0;</span> | <span id="line160">160. static struct win_choices *last_winchoice = 0;</span> | ||
<span id="line161">161. </span> | <span id="line161">161. </span> | ||
+ | |||
+ | === genl_can_suspend_no === | ||
+ | |||
<span id="line162">162. boolean</span> | <span id="line162">162. boolean</span> | ||
<span id="line163">163. genl_can_suspend_no(VOID_ARGS)</span> | <span id="line163">163. genl_can_suspend_no(VOID_ARGS)</span> | ||
Line 173: | Line 190: | ||
<span id="line166">166. }</span> | <span id="line166">166. }</span> | ||
<span id="line167">167. </span> | <span id="line167">167. </span> | ||
+ | |||
+ | === genl_can_suspend_yes === | ||
+ | |||
<span id="line168">168. boolean</span> | <span id="line168">168. boolean</span> | ||
<span id="line169">169. genl_can_suspend_yes(VOID_ARGS)</span> | <span id="line169">169. genl_can_suspend_yes(VOID_ARGS)</span> | ||
Line 179: | Line 199: | ||
<span id="line172">172. }</span> | <span id="line172">172. }</span> | ||
<span id="line173">173. </span> | <span id="line173">173. </span> | ||
+ | |||
+ | === def_raw_print === | ||
+ | |||
<span id="line174">174. STATIC_OVL</span> | <span id="line174">174. STATIC_OVL</span> | ||
<span id="line175">175. void</span> | <span id="line175">175. void</span> | ||
Line 187: | Line 210: | ||
<span id="line180">180. }</span> | <span id="line180">180. }</span> | ||
<span id="line181">181. </span> | <span id="line181">181. </span> | ||
+ | |||
+ | === win_choices_find === | ||
+ | |||
<span id="line182">182. #ifdef WINCHAIN</span> | <span id="line182">182. #ifdef WINCHAIN</span> | ||
<span id="line183">183. static struct win_choices *</span> | <span id="line183">183. static struct win_choices *</span> | ||
Line 203: | Line 229: | ||
<span id="line196">196. #endif</span> | <span id="line196">196. #endif</span> | ||
<span id="line197">197. </span> | <span id="line197">197. </span> | ||
+ | |||
+ | === choose_windows === | ||
+ | |||
<span id="line198">198. void</span> | <span id="line198">198. void</span> | ||
<span id="line199">199. choose_windows(s)</span> | <span id="line199">199. choose_windows(s)</span> | ||
Line 252: | Line 281: | ||
<span id="line245">245. }</span> | <span id="line245">245. }</span> | ||
<span id="line246">246. </span> | <span id="line246">246. </span> | ||
+ | |||
+ | === addto_windowchain === | ||
+ | |||
<span id="line247">247. #ifdef WINCHAIN</span> | <span id="line247">247. #ifdef WINCHAIN</span> | ||
<span id="line248">248. void</span> | <span id="line248">248. void</span> | ||
Line 283: | Line 315: | ||
<span id="line276">276. }</span> | <span id="line276">276. }</span> | ||
<span id="line277">277. </span> | <span id="line277">277. </span> | ||
+ | |||
+ | === commit_windowchain === | ||
+ | |||
<span id="line278">278. void</span> | <span id="line278">278. void</span> | ||
<span id="line279">279. commit_windowchain()</span> | <span id="line279">279. commit_windowchain()</span> | ||
Line 357: | Line 392: | ||
<span id="line350">350. #endif /* WINCHAIN */</span> | <span id="line350">350. #endif /* WINCHAIN */</span> | ||
<span id="line351">351. </span> | <span id="line351">351. </span> | ||
+ | |||
+ | == genl_message_menu == | ||
+ | |||
<span id="line352">352. /*</span> | <span id="line352">352. /*</span> | ||
<span id="line353">353. * tty_message_menu() provides a means to get feedback from the</span> | <span id="line353">353. * tty_message_menu() provides a means to get feedback from the</span> | ||
Line 372: | Line 410: | ||
<span id="line365">365. }</span> | <span id="line365">365. }</span> | ||
<span id="line366">366. </span> | <span id="line366">366. </span> | ||
+ | |||
+ | == genl_preference_update == | ||
+ | |||
<span id="line367">367. /*ARGSUSED*/</span> | <span id="line367">367. /*ARGSUSED*/</span> | ||
<span id="line368">368. void</span> | <span id="line368">368. void</span> | ||
Line 385: | Line 426: | ||
<span id="line378">378. }</span> | <span id="line378">378. }</span> | ||
<span id="line379">379. </span> | <span id="line379">379. </span> | ||
+ | |||
+ | == genl_getmsghistory == | ||
+ | |||
<span id="line380">380. char *</span> | <span id="line380">380. char *</span> | ||
<span id="line381">381. genl_getmsghistory(init)</span> | <span id="line381">381. genl_getmsghistory(init)</span> | ||
Line 403: | Line 447: | ||
<span id="line396">396. }</span> | <span id="line396">396. }</span> | ||
<span id="line397">397. </span> | <span id="line397">397. </span> | ||
+ | |||
+ | == genl_putmsghistory == | ||
+ | |||
<span id="line398">398. void</span> | <span id="line398">398. void</span> | ||
<span id="line399">399. genl_putmsghistory(msg, is_restoring)</span> | <span id="line399">399. genl_putmsghistory(msg, is_restoring)</span> | ||
Line 434: | Line 481: | ||
<span id="line427">427. }</span> | <span id="line427">427. }</span> | ||
<span id="line428">428. </span> | <span id="line428">428. </span> | ||
+ | |||
+ | == Hangup handling == | ||
+ | |||
<span id="line429">429. #ifdef HANGUPHANDLING</span> | <span id="line429">429. #ifdef HANGUPHANDLING</span> | ||
<span id="line430">430. /*</span> | <span id="line430">430. /*</span> | ||
Line 532: | Line 582: | ||
<span id="line525">525. static void FDECL((*previnterface_exit_nhwindows), (const char *)) = 0;</span> | <span id="line525">525. static void FDECL((*previnterface_exit_nhwindows), (const char *)) = 0;</span> | ||
<span id="line526">526. </span> | <span id="line526">526. </span> | ||
+ | |||
+ | === nhwindows_hangup === | ||
+ | |||
<span id="line527">527. /* hangup has occurred; switch to no-op user interface */</span> | <span id="line527">527. /* hangup has occurred; switch to no-op user interface */</span> | ||
<span id="line528">528. void</span> | <span id="line528">528. void</span> | ||
Line 561: | Line 614: | ||
<span id="line554">554. }</span> | <span id="line554">554. }</span> | ||
<span id="line555">555. </span> | <span id="line555">555. </span> | ||
+ | |||
+ | === hup_exit_nhwindows === | ||
+ | |||
<span id="line556">556. static void</span> | <span id="line556">556. static void</span> | ||
<span id="line557">557. hup_exit_nhwindows(lastgasp)</span> | <span id="line557">557. hup_exit_nhwindows(lastgasp)</span> | ||
Line 576: | Line 632: | ||
<span id="line569">569. }</span> | <span id="line569">569. }</span> | ||
<span id="line570">570. </span> | <span id="line570">570. </span> | ||
+ | |||
+ | === hup_nhgetch === | ||
+ | |||
<span id="line571">571. static int</span> | <span id="line571">571. static int</span> | ||
<span id="line572">572. hup_nhgetch(VOID_ARGS)</span> | <span id="line572">572. hup_nhgetch(VOID_ARGS)</span> | ||
Line 582: | Line 641: | ||
<span id="line575">575. }</span> | <span id="line575">575. }</span> | ||
<span id="line576">576. </span> | <span id="line576">576. </span> | ||
+ | |||
+ | === hup_yn_function === | ||
+ | |||
<span id="line577">577. /*ARGSUSED*/</span> | <span id="line577">577. /*ARGSUSED*/</span> | ||
<span id="line578">578. static char</span> | <span id="line578">578. static char</span> | ||
Line 593: | Line 655: | ||
<span id="line586">586. }</span> | <span id="line586">586. }</span> | ||
<span id="line587">587. </span> | <span id="line587">587. </span> | ||
+ | |||
+ | === hup_nh_poskey === | ||
+ | |||
<span id="line588">588. /*ARGSUSED*/</span> | <span id="line588">588. /*ARGSUSED*/</span> | ||
<span id="line589">589. static int</span> | <span id="line589">589. static int</span> | ||
Line 601: | Line 666: | ||
<span id="line594">594. }</span> | <span id="line594">594. }</span> | ||
<span id="line595">595. </span> | <span id="line595">595. </span> | ||
+ | |||
+ | === hup_getlin === | ||
+ | |||
<span id="line596">596. /*ARGSUSED*/</span> | <span id="line596">596. /*ARGSUSED*/</span> | ||
<span id="line597">597. static void</span> | <span id="line597">597. static void</span> | ||
Line 610: | Line 678: | ||
<span id="line603">603. }</span> | <span id="line603">603. }</span> | ||
<span id="line604">604. </span> | <span id="line604">604. </span> | ||
+ | |||
+ | === hup_init_nhwindows === | ||
+ | |||
<span id="line605">605. /*ARGSUSED*/</span> | <span id="line605">605. /*ARGSUSED*/</span> | ||
<span id="line606">606. static void</span> | <span id="line606">606. static void</span> | ||
Line 619: | Line 690: | ||
<span id="line612">612. }</span> | <span id="line612">612. }</span> | ||
<span id="line613">613. </span> | <span id="line613">613. </span> | ||
+ | |||
+ | === hup_create_nhwindow === | ||
+ | |||
<span id="line614">614. /*ARGUSED*/</span> | <span id="line614">614. /*ARGUSED*/</span> | ||
<span id="line615">615. static winid</span> | <span id="line615">615. static winid</span> | ||
Line 627: | Line 701: | ||
<span id="line620">620. }</span> | <span id="line620">620. }</span> | ||
<span id="line621">621. </span> | <span id="line621">621. </span> | ||
+ | |||
+ | === hup_select_menu === | ||
+ | |||
<span id="line622">622. /*ARGSUSED*/</span> | <span id="line622">622. /*ARGSUSED*/</span> | ||
<span id="line623">623. static int</span> | <span id="line623">623. static int</span> | ||
Line 637: | Line 714: | ||
<span id="line630">630. }</span> | <span id="line630">630. }</span> | ||
<span id="line631">631. </span> | <span id="line631">631. </span> | ||
+ | |||
+ | === hup_add_menu === | ||
+ | |||
<span id="line632">632. /*ARGSUSED*/</span> | <span id="line632">632. /*ARGSUSED*/</span> | ||
<span id="line633">633. static void</span> | <span id="line633">633. static void</span> | ||
Line 650: | Line 730: | ||
<span id="line643">643. }</span> | <span id="line643">643. }</span> | ||
<span id="line644">644. </span> | <span id="line644">644. </span> | ||
+ | |||
+ | === hup_end_menu === | ||
+ | |||
<span id="line645">645. /*ARGSUSED*/</span> | <span id="line645">645. /*ARGSUSED*/</span> | ||
<span id="line646">646. static void</span> | <span id="line646">646. static void</span> | ||
Line 659: | Line 742: | ||
<span id="line652">652. }</span> | <span id="line652">652. }</span> | ||
<span id="line653">653. </span> | <span id="line653">653. </span> | ||
+ | |||
+ | === hup_putstr === | ||
+ | |||
<span id="line654">654. /*ARGSUSED*/</span> | <span id="line654">654. /*ARGSUSED*/</span> | ||
<span id="line655">655. static void</span> | <span id="line655">655. static void</span> | ||
Line 669: | Line 755: | ||
<span id="line662">662. }</span> | <span id="line662">662. }</span> | ||
<span id="line663">663. </span> | <span id="line663">663. </span> | ||
+ | |||
+ | === hup_print_glyph === | ||
+ | |||
<span id="line664">664. /*ARGSUSED*/</span> | <span id="line664">664. /*ARGSUSED*/</span> | ||
<span id="line665">665. static void</span> | <span id="line665">665. static void</span> | ||
Line 680: | Line 769: | ||
<span id="line673">673. }</span> | <span id="line673">673. }</span> | ||
<span id="line674">674. </span> | <span id="line674">674. </span> | ||
+ | |||
+ | === hup_outrip === | ||
+ | |||
<span id="line675">675. /*ARGSUSED*/</span> | <span id="line675">675. /*ARGSUSED*/</span> | ||
<span id="line676">676. static void</span> | <span id="line676">676. static void</span> | ||
Line 690: | Line 782: | ||
<span id="line683">683. }</span> | <span id="line683">683. }</span> | ||
<span id="line684">684. </span> | <span id="line684">684. </span> | ||
+ | |||
+ | === hup_curs === | ||
+ | |||
<span id="line685">685. /*ARGSUSED*/</span> | <span id="line685">685. /*ARGSUSED*/</span> | ||
<span id="line686">686. static void</span> | <span id="line686">686. static void</span> | ||
Line 699: | Line 794: | ||
<span id="line692">692. }</span> | <span id="line692">692. }</span> | ||
<span id="line693">693. </span> | <span id="line693">693. </span> | ||
+ | |||
+ | === hup_display_nhwindow === | ||
+ | |||
<span id="line694">694. /*ARGSUSED*/</span> | <span id="line694">694. /*ARGSUSED*/</span> | ||
<span id="line695">695. static void</span> | <span id="line695">695. static void</span> | ||
Line 708: | Line 806: | ||
<span id="line701">701. }</span> | <span id="line701">701. }</span> | ||
<span id="line702">702. </span> | <span id="line702">702. </span> | ||
+ | |||
+ | === hup_display_file === | ||
+ | |||
<span id="line703">703. /*ARGSUSED*/</span> | <span id="line703">703. /*ARGSUSED*/</span> | ||
<span id="line704">704. static void</span> | <span id="line704">704. static void</span> | ||
Line 717: | Line 818: | ||
<span id="line710">710. }</span> | <span id="line710">710. }</span> | ||
<span id="line711">711. </span> | <span id="line711">711. </span> | ||
+ | |||
+ | === hup_cliparound == === | ||
+ | |||
<span id="line712">712. #ifdef CLIPPING</span> | <span id="line712">712. #ifdef CLIPPING</span> | ||
<span id="line713">713. /*ARGSUSED*/</span> | <span id="line713">713. /*ARGSUSED*/</span> | ||
Line 727: | Line 831: | ||
<span id="line720">720. #endif</span> | <span id="line720">720. #endif</span> | ||
<span id="line721">721. </span> | <span id="line721">721. </span> | ||
+ | |||
+ | === hup_change_color === | ||
+ | |||
<span id="line722">722. #ifdef CHANGE_COLOR</span> | <span id="line722">722. #ifdef CHANGE_COLOR</span> | ||
<span id="line723">723. /*ARGSUSED*/</span> | <span id="line723">723. /*ARGSUSED*/</span> | ||
Line 737: | Line 844: | ||
<span id="line730">730. }</span> | <span id="line730">730. }</span> | ||
<span id="line731">731. </span> | <span id="line731">731. </span> | ||
+ | |||
+ | === hup_set_font_name === | ||
+ | |||
<span id="line732">732. #ifdef MAC</span> | <span id="line732">732. #ifdef MAC</span> | ||
<span id="line733">733. /*ARGSUSED*/</span> | <span id="line733">733. /*ARGSUSED*/</span> | ||
Line 748: | Line 858: | ||
<span id="line741">741. #endif /* MAC */</span> | <span id="line741">741. #endif /* MAC */</span> | ||
<span id="line742">742. </span> | <span id="line742">742. </span> | ||
+ | |||
+ | === hup_get_color_string === | ||
+ | |||
<span id="line743">743. static char *</span> | <span id="line743">743. static char *</span> | ||
<span id="line744">744. hup_get_color_string(VOID_ARGS)</span> | <span id="line744">744. hup_get_color_string(VOID_ARGS)</span> | ||
Line 755: | Line 868: | ||
<span id="line748">748. #endif /* CHANGE_COLOR */</span> | <span id="line748">748. #endif /* CHANGE_COLOR */</span> | ||
<span id="line749">749. </span> | <span id="line749">749. </span> | ||
+ | |||
+ | === hup_status_update === | ||
+ | |||
<span id="line750">750. #ifdef STATUS_VIA_WINDOWPORT</span> | <span id="line750">750. #ifdef STATUS_VIA_WINDOWPORT</span> | ||
<span id="line751">751. /*ARGSUSED*/</span> | <span id="line751">751. /*ARGSUSED*/</span> | ||
Line 766: | Line 882: | ||
<span id="line759">759. #endif /* STATUS_VIA_WINDOWPORT */</span> | <span id="line759">759. #endif /* STATUS_VIA_WINDOWPORT */</span> | ||
<span id="line760">760. </span> | <span id="line760">760. </span> | ||
+ | |||
+ | === hup_int_ndecl === | ||
+ | |||
<span id="line761">761. /*</span> | <span id="line761">761. /*</span> | ||
<span id="line762">762. * Non-specific stubs.</span> | <span id="line762">762. * Non-specific stubs.</span> | ||
Line 776: | Line 895: | ||
<span id="line769">769. }</span> | <span id="line769">769. }</span> | ||
<span id="line770">770. </span> | <span id="line770">770. </span> | ||
+ | |||
+ | === hup_void_ndecl === | ||
+ | |||
<span id="line771">771. static void</span> | <span id="line771">771. static void</span> | ||
<span id="line772">772. hup_void_ndecl(VOID_ARGS)</span> | <span id="line772">772. hup_void_ndecl(VOID_ARGS)</span> | ||
Line 782: | Line 904: | ||
<span id="line775">775. }</span> | <span id="line775">775. }</span> | ||
<span id="line776">776. </span> | <span id="line776">776. </span> | ||
+ | |||
+ | === hup_void_fdecl_int === | ||
+ | |||
<span id="line777">777. /*ARGUSED*/</span> | <span id="line777">777. /*ARGUSED*/</span> | ||
<span id="line778">778. static void</span> | <span id="line778">778. static void</span> | ||
Line 790: | Line 915: | ||
<span id="line783">783. }</span> | <span id="line783">783. }</span> | ||
<span id="line784">784. </span> | <span id="line784">784. </span> | ||
+ | |||
+ | === hup_void_fdecl_winid === | ||
+ | |||
<span id="line785">785. /*ARGUSED*/</span> | <span id="line785">785. /*ARGUSED*/</span> | ||
<span id="line786">786. static void</span> | <span id="line786">786. static void</span> | ||
Line 798: | Line 926: | ||
<span id="line791">791. }</span> | <span id="line791">791. }</span> | ||
<span id="line792">792. </span> | <span id="line792">792. </span> | ||
+ | |||
+ | === hup_void_fdecl_constchar_p === | ||
+ | |||
<span id="line793">793. /*ARGUSED*/</span> | <span id="line793">793. /*ARGUSED*/</span> | ||
<span id="line794">794. static void</span> | <span id="line794">794. static void</span> | ||
Line 808: | Line 939: | ||
<span id="line801">801. #endif /* HANGUPHANDLING */</span> | <span id="line801">801. #endif /* HANGUPHANDLING */</span> | ||
<span id="line802">802. </span> | <span id="line802">802. </span> | ||
+ | |||
+ | == genl backward compatibility == | ||
+ | |||
<span id="line803">803. #ifdef STATUS_VIA_WINDOWPORT</span> | <span id="line803">803. #ifdef STATUS_VIA_WINDOWPORT</span> | ||
<span id="line804">804. </span> | <span id="line804">804. </span> | ||
Line 820: | Line 954: | ||
<span id="line813">813. NEARDATA winid WIN_STATUS;</span> | <span id="line813">813. NEARDATA winid WIN_STATUS;</span> | ||
<span id="line814">814. </span> | <span id="line814">814. </span> | ||
+ | |||
+ | === genl_status_init === | ||
+ | |||
<span id="line815">815. void</span> | <span id="line815">815. void</span> | ||
<span id="line816">816. genl_status_init()</span> | <span id="line816">816. genl_status_init()</span> | ||
Line 835: | Line 972: | ||
<span id="line828">828. }</span> | <span id="line828">828. }</span> | ||
<span id="line829">829. </span> | <span id="line829">829. </span> | ||
+ | |||
+ | === genl_status_finish === | ||
+ | |||
<span id="line830">830. void</span> | <span id="line830">830. void</span> | ||
<span id="line831">831. genl_status_finish()</span> | <span id="line831">831. genl_status_finish()</span> | ||
Line 849: | Line 989: | ||
<span id="line842">842. }</span> | <span id="line842">842. }</span> | ||
<span id="line843">843. </span> | <span id="line843">843. </span> | ||
+ | |||
+ | === genl_status_enablefield === | ||
+ | |||
<span id="line844">844. void</span> | <span id="line844">844. void</span> | ||
<span id="line845">845. genl_status_enablefield(fieldidx, nm, fmt, enable)</span> | <span id="line845">845. genl_status_enablefield(fieldidx, nm, fmt, enable)</span> | ||
Line 861: | Line 1,004: | ||
<span id="line854">854. }</span> | <span id="line854">854. }</span> | ||
<span id="line855">855. </span> | <span id="line855">855. </span> | ||
+ | |||
+ | === genl_status_update === | ||
+ | |||
<span id="line856">856. void</span> | <span id="line856">856. void</span> | ||
<span id="line857">857. genl_status_update(idx, ptr, chg, percent)</span> | <span id="line857">857. genl_status_update(idx, ptr, chg, percent)</span> | ||
Line 928: | Line 1,074: | ||
<span id="line921">921. }</span> | <span id="line921">921. }</span> | ||
<span id="line922">922. </span> | <span id="line922">922. </span> | ||
+ | |||
+ | === genl_status_threshold === | ||
+ | |||
<span id="line923">923. #ifdef STATUS_HILITES</span> | <span id="line923">923. #ifdef STATUS_HILITES</span> | ||
<span id="line924">924. void</span> | <span id="line924">924. void</span> |
Latest revision as of 22:18, 3 January 2016
Below is the full text to windows.c from the source code of NetHack 3.6.0. To link to a particular line, write [[Source:NetHack 3.6.0/src/windows.c#line123]], for example.
The NetHack General Public License applies to screenshots, source code and other content from NetHack.
This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.
Contents
- 1 Top of file
- 2 Window chain functions
- 3 genl_message_menu
- 4 genl_preference_update
- 5 genl_getmsghistory
- 6 genl_putmsghistory
- 7 Hangup handling
- 7.1 nhwindows_hangup
- 7.2 hup_exit_nhwindows
- 7.3 hup_nhgetch
- 7.4 hup_yn_function
- 7.5 hup_nh_poskey
- 7.6 hup_getlin
- 7.7 hup_init_nhwindows
- 7.8 hup_create_nhwindow
- 7.9 hup_select_menu
- 7.10 hup_add_menu
- 7.11 hup_end_menu
- 7.12 hup_putstr
- 7.13 hup_print_glyph
- 7.14 hup_outrip
- 7.15 hup_curs
- 7.16 hup_display_nhwindow
- 7.17 hup_display_file
- 7.18 hup_cliparound ==
- 7.19 hup_change_color
- 7.20 hup_set_font_name
- 7.21 hup_get_color_string
- 7.22 hup_status_update
- 7.23 hup_int_ndecl
- 7.24 hup_void_ndecl
- 7.25 hup_void_fdecl_int
- 7.26 hup_void_fdecl_winid
- 7.27 hup_void_fdecl_constchar_p
- 8 genl backward compatibility
Top of file
/* NetHack 3.6 windows.c $NHDT-Date: 1448013599 2015/11/20 09:59:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */
/* Copyright (c) D. Cohrs, 1993. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#ifdef TTY_GRAPHICS
#include "wintty.h"
#endif
#ifdef X11_GRAPHICS
/* Cannot just blindly include winX.h without including all of X11 stuff
and must get the order of include files right. Don't bother. */
extern struct window_procs X11_procs;
extern void FDECL(win_X11_init, (int));
#endif
#ifdef QT_GRAPHICS
extern struct window_procs Qt_procs;
#endif
#ifdef GEM_GRAPHICS
#include "wingem.h"
#endif
#ifdef MAC
extern struct window_procs mac_procs;
#endif
#ifdef BEOS_GRAPHICS
extern struct window_procs beos_procs;
extern void FDECL(be_win_init, (int));
FAIL /* be_win_init doesn't exist? XXX*/
#endif
#ifdef AMIGA_INTUITION
extern struct window_procs amii_procs;
extern struct window_procs amiv_procs;
extern void FDECL(ami_wininit_data, (int));
#endif
#ifdef WIN32_GRAPHICS
extern struct window_procs win32_procs;
#endif
#ifdef GNOME_GRAPHICS
#include "winGnome.h"
extern struct window_procs Gnome_procs;
#endif
#ifdef MSWIN_GRAPHICS
extern struct window_procs mswin_procs;
#endif
#ifdef WINCHAIN
extern struct window_procs chainin_procs;
extern void FDECL(chainin_procs_init, (int));
extern void *FDECL(chainin_procs_chain, (int, int, void *, void *, void *));
extern struct chain_procs chainout_procs;
extern void FDECL(chainout_procs_init, (int));
extern void *FDECL(chainout_procs_chain, (int, int, void *, void *, void *));
extern struct chain_procs trace_procs;
extern void FDECL(trace_procs_init, (int));
extern void *FDECL(trace_procs_chain, (int, int, void *, void *, void *));
#endif
STATIC_DCL void FDECL(def_raw_print, (const char *s));
#ifdef HANGUPHANDLING
volatile
#endif
NEARDATA struct window_procs windowprocs;
#ifdef WINCHAIN
#define CHAINR(x) , x
#else
#define CHAINR(x)
#endif
static struct win_choices {
struct window_procs *procs;
void FDECL((*ini_routine), (int)); /* optional (can be 0) */
#ifdef WINCHAIN
void *FDECL((*chain_routine), (int, int, void *, void *, void *));
#endif
} winchoices[] = {
#ifdef TTY_GRAPHICS
{ &tty_procs, win_tty_init CHAINR(0) },
#endif
#ifdef X11_GRAPHICS
{ &X11_procs, win_X11_init CHAINR(0) },
#endif
#ifdef QT_GRAPHICS
{ &Qt_procs, 0 CHAINR(0) },
#endif
#ifdef GEM_GRAPHICS
{ &Gem_procs, win_Gem_init CHAINR(0) },
#endif
#ifdef MAC
{ &mac_procs, 0 CHAINR(0) },
#endif
#ifdef BEOS_GRAPHICS
{ &beos_procs, be_win_init CHAINR(0) },
#endif
#ifdef AMIGA_INTUITION
{ &amii_procs,
ami_wininit_data CHAINR(0) }, /* Old font version of the game */
{ &amiv_procs,
ami_wininit_data CHAINR(0) }, /* Tile version of the game */
#endif
#ifdef WIN32_GRAPHICS
{ &win32_procs, 0 CHAINR(0) },
#endif
#ifdef GNOME_GRAPHICS
{ &Gnome_procs, 0 CHAINR(0) },
#endif
#ifdef MSWIN_GRAPHICS
{ &mswin_procs, 0 CHAINR(0) },
#endif
#ifdef WINCHAIN
{ &chainin_procs, chainin_procs_init, chainin_procs_chain },
{ (struct window_procs *) &chainout_procs, chainout_procs_init,
chainout_procs_chain },
{ (struct window_procs *) &trace_procs, trace_procs_init,
trace_procs_chain },
#endif
{ 0, 0 CHAINR(0) } /* must be last */
};
Window chain functions
#ifdef WINCHAIN
struct winlink {
struct winlink *nextlink;
struct win_choices *wincp;
void *linkdata;
};
/* NB: this chain does not contain the terminal real window system pointer */
static struct winlink *chain = 0;
wl_new
static struct winlink *
wl_new()
{
return calloc(1, sizeof(struct winlink));
}
wl_addhead
static void
wl_addhead(struct winlink *wl)
{
wl->nextlink = chain;
chain = wl;
}
wl_addtail
static void
wl_addtail(struct winlink *wl)
{
struct winlink *p = chain;
if (!chain) {
chain = wl;
return;
}
while (p->nextlink) {
p = p->nextlink;
}
p->nextlink = wl;
return;
}
#endif /* WINCHAIN */
static struct win_choices *last_winchoice = 0;
genl_can_suspend_no
boolean
genl_can_suspend_no(VOID_ARGS)
{
return FALSE;
}
genl_can_suspend_yes
boolean
genl_can_suspend_yes(VOID_ARGS)
{
return TRUE;
}
def_raw_print
STATIC_OVL
void
def_raw_print(s)
const char *s;
{
puts(s);
}
win_choices_find
#ifdef WINCHAIN
static struct win_choices *
win_choices_find(s)
const char *s;
{
register int i;
for (i = 0; winchoices[i].procs; i++) {
if (!strcmpi(s, winchoices[i].procs->name)) {
return &winchoices[i];
}
}
return (struct win_choices *) 0;
}
#endif
choose_windows
void
choose_windows(s)
const char *s;
{
register int i;
for (i = 0; winchoices[i].procs; i++) {
if ('+' == winchoices[i].procs->name[0])
continue;
if ('-' == winchoices[i].procs->name[0])
continue;
if (!strcmpi(s, winchoices[i].procs->name)) {
windowprocs = *winchoices[i].procs;
if (last_winchoice && last_winchoice->ini_routine)
(*last_winchoice->ini_routine)(WININIT_UNDO);
if (winchoices[i].ini_routine)
(*winchoices[i].ini_routine)(WININIT);
last_winchoice = &winchoices[i];
return;
}
}
if (!windowprocs.win_raw_print)
windowprocs.win_raw_print = def_raw_print;
if (!winchoices[0].procs) {
raw_printf("No window types?");
exit(EXIT_FAILURE);
}
if (!winchoices[1].procs) {
raw_printf("Window type %s not recognized. The only choice is: %s.",
s, winchoices[0].procs->name);
} else {
raw_printf("Window type %s not recognized. Choices are:", s);
for (i = 0; winchoices[i].procs; i++) {
if ('+' == winchoices[i].procs->name[0])
continue;
if ('-' == winchoices[i].procs->name[0])
continue;
raw_printf(" %s", winchoices[i].procs->name);
}
}
if (windowprocs.win_raw_print == def_raw_print)
terminate(EXIT_SUCCESS);
wait_synch();
}
addto_windowchain
#ifdef WINCHAIN
void
addto_windowchain(s)
const char *s;
{
register int i;
for (i = 0; winchoices[i].procs; i++) {
if ('+' != winchoices[i].procs->name[0])
continue;
if (!strcmpi(s, winchoices[i].procs->name)) {
struct winlink *p = wl_new();
p->wincp = &winchoices[i];
wl_addtail(p);
/* NB: The ini_routine() will be called during commit. */
return;
}
}
windowprocs.win_raw_print = def_raw_print;
raw_printf("Window processor %s not recognized. Choices are:", s);
for (i = 0; winchoices[i].procs; i++) {
if ('+' != winchoices[i].procs->name[0])
continue;
raw_printf(" %s", winchoices[i].procs->name);
}
exit(EXIT_FAILURE);
}
commit_windowchain
void
commit_windowchain()
{
struct winlink *p;
int n;
int wincap, wincap2;
if (!chain)
return;
/* Save wincap* from the real window system - we'll restore it below. */
wincap = windowprocs.wincap;
wincap2 = windowprocs.wincap2;
/* add -chainin at head and -chainout at tail */
p = wl_new();
p->wincp = win_choices_find("-chainin");
if (!p->wincp) {
raw_printf("Can't locate processor '-chainin'");
exit(EXIT_FAILURE);
}
wl_addhead(p);
p = wl_new();
p->wincp = win_choices_find("-chainout");
if (!p->wincp) {
raw_printf("Can't locate processor '-chainout'");
exit(EXIT_FAILURE);
}
wl_addtail(p);
/* Now alloc() init() similar to Objective-C. */
for (n = 1, p = chain; p; n++, p = p->nextlink) {
p->linkdata = (*p->wincp->chain_routine)(WINCHAIN_ALLOC, n, 0, 0, 0);
}
for (n = 1, p = chain; p; n++, p = p->nextlink) {
if (p->nextlink) {
(void) (*p->wincp->chain_routine)(WINCHAIN_INIT, n, p->linkdata,
p->nextlink->wincp->procs,
p->nextlink->linkdata);
} else {
(void) (*p->wincp->chain_routine)(WINCHAIN_INIT, n, p->linkdata,
last_winchoice->procs, 0);
}
}
/* Restore the saved wincap* values. We do it here to give the
* ini_routine()s a chance to change or check them. */
chain->wincp->procs->wincap = wincap;
chain->wincp->procs->wincap2 = wincap2;
/* Call the init procs. Do not re-init the terminal real win. */
p = chain;
while (p->nextlink) {
if (p->wincp->ini_routine) {
(*p->wincp->ini_routine)(WININIT);
}
p = p->nextlink;
}
/* Install the chain into window procs very late so ini_routine()s
* can raw_print on error. */
windowprocs = *chain->wincp->procs;
p = chain;
while (p) {
struct winlink *np = p->nextlink;
free(p);
p = np; /* assignment, not proof */
}
}
#endif /* WINCHAIN */
/*
* tty_message_menu() provides a means to get feedback from the
* --More-- prompt; other interfaces generally don't need that.
*/
/*ARGSUSED*/
char
genl_message_menu(let, how, mesg)
char let UNUSED;
int how UNUSED;
const char *mesg;
{
pline("%s", mesg);
return 0;
}
genl_preference_update
/*ARGSUSED*/
void
genl_preference_update(pref)
const char *pref UNUSED;
{
/* window ports are expected to provide
their own preference update routine
for the preference capabilities that
they support.
Just return in this genl one. */
return;
}
genl_getmsghistory
char *
genl_getmsghistory(init)
boolean init UNUSED;
{
/* window ports can provide
their own getmsghistory() routine to
preserve message history between games.
The routine is called repeatedly from
the core save routine, and the window
port is expected to successively return
each message that it wants saved, starting
with the oldest message first, finishing
with the most recent.
Return null pointer when finished.
*/
return (char *) 0;
}
genl_putmsghistory
void
genl_putmsghistory(msg, is_restoring)
const char *msg;
boolean is_restoring;
{
/* window ports can provide
their own putmsghistory() routine to
load message history from a saved game.
The routine is called repeatedly from
the core restore routine, starting with
the oldest saved message first, and
finishing with the latest.
The window port routine is expected to
load the message recall buffers in such
a way that the ordering is preserved.
The window port routine should make no
assumptions about how many messages are
forthcoming, nor should it assume that
another message will follow this one,
so it should keep all pointers/indexes
intact at the end of each call.
*/
/* this doesn't provide for reloading the message window with the
previous session's messages upon restore, but it does put the quest
message summary lines there by treating them as ordinary messages */
if (!is_restoring)
pline("%s", msg);
return;
}
Hangup handling
#ifdef HANGUPHANDLING
/*
* Dummy windowing scheme used to replace current one with no-ops
* in order to avoid all terminal I/O after hangup/disconnect.
*/
static int NDECL(hup_nhgetch);
static char FDECL(hup_yn_function, (const char *, const char *, CHAR_P));
static int FDECL(hup_nh_poskey, (int *, int *, int *));
static void FDECL(hup_getlin, (const char *, char *));
static void FDECL(hup_init_nhwindows, (int *, char **));
static void FDECL(hup_exit_nhwindows, (const char *));
static winid FDECL(hup_create_nhwindow, (int));
static int FDECL(hup_select_menu, (winid, int, MENU_ITEM_P **));
static void FDECL(hup_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P,
int, const char *, BOOLEAN_P));
static void FDECL(hup_end_menu, (winid, const char *));
static void FDECL(hup_putstr, (winid, int, const char *));
static void FDECL(hup_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int));
static void FDECL(hup_outrip, (winid, int, time_t));
static void FDECL(hup_curs, (winid, int, int));
static void FDECL(hup_display_nhwindow, (winid, BOOLEAN_P));
static void FDECL(hup_display_file, (const char *, BOOLEAN_P));
#ifdef CLIPPING
static void FDECL(hup_cliparound, (int, int));
#endif
#ifdef CHANGE_COLOR
static void FDECL(hup_change_color, (int, long, int));
#ifdef MAC
static short FDECL(hup_set_font_name, (winid, char *));
#endif
static char *NDECL(hup_get_color_string);
#endif /* CHANGE_COLOR */
#ifdef STATUS_VIA_WINDOWPORT
static void FDECL(hup_status_update, (int, genericptr_t, int, int));
#endif
static int NDECL(hup_int_ndecl);
static void NDECL(hup_void_ndecl);
static void FDECL(hup_void_fdecl_int, (int));
static void FDECL(hup_void_fdecl_winid, (winid));
static void FDECL(hup_void_fdecl_constchar_p, (const char *));
static struct window_procs hup_procs = {
"hup", 0L, 0L, hup_init_nhwindows,
hup_void_ndecl, /* player_selection */
hup_void_ndecl, /* askname */
hup_void_ndecl, /* get_nh_event */
hup_exit_nhwindows, hup_void_fdecl_constchar_p, /* suspend_nhwindows */
hup_void_ndecl, /* resume_nhwindows */
hup_create_nhwindow, hup_void_fdecl_winid, /* clear_nhwindow */
hup_display_nhwindow, hup_void_fdecl_winid, /* destroy_nhwindow */
hup_curs, hup_putstr, hup_putstr, /* putmixed */
hup_display_file, hup_void_fdecl_winid, /* start_menu */
hup_add_menu, hup_end_menu, hup_select_menu, genl_message_menu,
hup_void_ndecl, /* update_inventory */
hup_void_ndecl, /* mark_synch */
hup_void_ndecl, /* wait_synch */
#ifdef CLIPPING
hup_cliparound,
#endif
#ifdef POSITIONBAR
(void FDECL((*), (char *))) hup_void_fdecl_constchar_p,
/* update_positionbar */
#endif
hup_print_glyph,
hup_void_fdecl_constchar_p, /* raw_print */
hup_void_fdecl_constchar_p, /* raw_print_bold */
hup_nhgetch, hup_nh_poskey, hup_void_ndecl, /* nhbell */
hup_int_ndecl, /* doprev_message */
hup_yn_function, hup_getlin, hup_int_ndecl, /* get_ext_cmd */
hup_void_fdecl_int, /* number_pad */
hup_void_ndecl, /* delay_output */
#ifdef CHANGE_COLOR
hup_change_color,
#ifdef MAC
hup_void_fdecl_int, /* change_background */
hup_set_font_name,
#endif
hup_get_color_string,
#endif /* CHANGE_COLOR */
hup_void_ndecl, /* start_screen */
hup_void_ndecl, /* end_screen */
hup_outrip, genl_preference_update, genl_getmsghistory,
genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
hup_void_ndecl, /* status_init */
hup_void_ndecl, /* status_finish */
genl_status_enablefield, hup_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#endif
#endif /* STATUS_VIA_WINDOWPORT */
genl_can_suspend_no,
};
static void FDECL((*previnterface_exit_nhwindows), (const char *)) = 0;
nhwindows_hangup
/* hangup has occurred; switch to no-op user interface */
void
nhwindows_hangup()
{
char *FDECL((*previnterface_getmsghistory), (BOOLEAN_P)) = 0;
#ifdef ALTMETA
/* command processor shouldn't look for 2nd char after seeing ESC */
iflags.altmeta = FALSE;
#endif
/* don't call exit_nhwindows() directly here; if a hangup occurs
while interface code is executing, exit_nhwindows could knock
the interface's active data structures out from under itself */
if (iflags.window_inited
&& windowprocs.win_exit_nhwindows != hup_exit_nhwindows)
previnterface_exit_nhwindows = windowprocs.win_exit_nhwindows;
/* also, we have to leave the old interface's getmsghistory()
in place because it will be called while saving the game */
if (windowprocs.win_getmsghistory != hup_procs.win_getmsghistory)
previnterface_getmsghistory = windowprocs.win_getmsghistory;
windowprocs = hup_procs;
if (previnterface_getmsghistory)
windowprocs.win_getmsghistory = previnterface_getmsghistory;
}
hup_exit_nhwindows
static void
hup_exit_nhwindows(lastgasp)
const char *lastgasp;
{
/* core has called exit_nhwindows(); call the previous interface's
shutdown routine now; xxx_exit_nhwindows() needs to call other
xxx_ routines directly rather than through windowprocs pointers */
if (previnterface_exit_nhwindows) {
lastgasp = 0; /* don't want exit routine to attempt extra output */
(*previnterface_exit_nhwindows)(lastgasp);
previnterface_exit_nhwindows = 0;
}
iflags.window_inited = 0;
}
hup_nhgetch
static int
hup_nhgetch(VOID_ARGS)
{
return '\033'; /* ESC */
}
hup_yn_function
/*ARGSUSED*/
static char
hup_yn_function(prompt, resp, deflt)
const char *prompt UNUSED, *resp UNUSED;
char deflt;
{
if (!deflt)
deflt = '\033';
return deflt;
}
hup_nh_poskey
/*ARGSUSED*/
static int
hup_nh_poskey(x, y, mod)
int *x UNUSED, *y UNUSED, *mod UNUSED;
{
return '\033';
}
hup_getlin
/*ARGSUSED*/
static void
hup_getlin(prompt, outbuf)
const char *prompt UNUSED;
char *outbuf;
{
Strcpy(outbuf, "\033");
}
hup_init_nhwindows
/*ARGSUSED*/
static void
hup_init_nhwindows(argc_p, argv)
int *argc_p UNUSED;
char **argv UNUSED;
{
iflags.window_inited = 1;
}
hup_create_nhwindow
/*ARGUSED*/
static winid
hup_create_nhwindow(type)
int type UNUSED;
{
return WIN_ERR;
}
/*ARGSUSED*/
static int
hup_select_menu(window, how, menu_list)
winid window UNUSED;
int how UNUSED;
struct mi **menu_list UNUSED;
{
return -1;
}
/*ARGSUSED*/
static void
hup_add_menu(window, glyph, identifier, sel, grpsel, attr, txt, preselected)
winid window UNUSED;
int glyph UNUSED, attr UNUSED;
const anything *identifier UNUSED;
char sel UNUSED, grpsel UNUSED;
const char *txt UNUSED;
boolean preselected UNUSED;
{
return;
}
/*ARGSUSED*/
static void
hup_end_menu(window, prompt)
winid window UNUSED;
const char *prompt UNUSED;
{
return;
}
hup_putstr
/*ARGSUSED*/
static void
hup_putstr(window, attr, text)
winid window UNUSED;
int attr UNUSED;
const char *text UNUSED;
{
return;
}
hup_print_glyph
/*ARGSUSED*/
static void
hup_print_glyph(window, x, y, glyph, bkglyph)
winid window UNUSED;
xchar x UNUSED, y UNUSED;
int glyph UNUSED;
int bkglyph UNUSED;
{
return;
}
hup_outrip
/*ARGSUSED*/
static void
hup_outrip(tmpwin, how, when)
winid tmpwin UNUSED;
int how UNUSED;
time_t when UNUSED;
{
return;
}
hup_curs
/*ARGSUSED*/
static void
hup_curs(window, x, y)
winid window UNUSED;
int x UNUSED, y UNUSED;
{
return;
}
hup_display_nhwindow
/*ARGSUSED*/
static void
hup_display_nhwindow(window, blocking)
winid window UNUSED;
boolean blocking UNUSED;
{
return;
}
hup_display_file
/*ARGSUSED*/
static void
hup_display_file(fname, complain)
const char *fname UNUSED;
boolean complain UNUSED;
{
return;
}
hup_cliparound ==
#ifdef CLIPPING
/*ARGSUSED*/
static void
hup_cliparound(x, y)
int x UNUSED, y UNUSED;
{
return;
}
#endif
hup_change_color
#ifdef CHANGE_COLOR
/*ARGSUSED*/
static void
hup_change_color(color, rgb, reverse)
int color, reverse;
long rgb;
{
return;
}
hup_set_font_name
#ifdef MAC
/*ARGSUSED*/
static short
hup_set_font_name(window, fontname)
winid window;
char *fontname;
{
return 0;
}
#endif /* MAC */
hup_get_color_string
static char *
hup_get_color_string(VOID_ARGS)
{
return (char *) 0;
}
#endif /* CHANGE_COLOR */
hup_status_update
#ifdef STATUS_VIA_WINDOWPORT
/*ARGSUSED*/
static void
hup_status_update(idx, ptr, chg, percent)
int idx UNUSED, chg UNUSED, percent UNUSED;
genericptr_t ptr UNUSED;
{
return;
}
#endif /* STATUS_VIA_WINDOWPORT */
hup_int_ndecl
/*
* Non-specific stubs.
*/
static int
hup_int_ndecl(VOID_ARGS)
{
return -1;
}
hup_void_ndecl
static void
hup_void_ndecl(VOID_ARGS)
{
return;
}
hup_void_fdecl_int
/*ARGUSED*/
static void
hup_void_fdecl_int(arg)
int arg UNUSED;
{
return;
}
hup_void_fdecl_winid
/*ARGUSED*/
static void
hup_void_fdecl_winid(window)
winid window UNUSED;
{
return;
}
hup_void_fdecl_constchar_p
/*ARGUSED*/
static void
hup_void_fdecl_constchar_p(string)
const char *string UNUSED;
{
return;
}
#endif /* HANGUPHANDLING */
genl backward compatibility
#ifdef STATUS_VIA_WINDOWPORT
/****************************************************************************/
/* genl backward compat stuff */
/****************************************************************************/
const char *status_fieldnm[MAXBLSTATS];
const char *status_fieldfmt[MAXBLSTATS];
char *status_vals[MAXBLSTATS];
boolean status_activefields[MAXBLSTATS];
NEARDATA winid WIN_STATUS;
genl_status_init
void
genl_status_init()
{
int i;
for (i = 0; i < MAXBLSTATS; ++i) {
status_vals[i] = (char *) alloc(MAXCO);
*status_vals[i] = '\0';
status_activefields[i] = FALSE;
status_fieldfmt[i] = (const char *) 0;
}
/* Use a window for the genl version; backward port compatibility */
WIN_STATUS = create_nhwindow(NHW_STATUS);
display_nhwindow(WIN_STATUS, FALSE);
}
genl_status_finish
void
genl_status_finish()
{
/* tear down routine */
int i;
/* free alloc'd memory here */
for (i = 0; i < MAXBLSTATS; ++i) {
if (status_vals[i])
free((genericptr_t) status_vals[i]);
status_vals[i] = (char *) 0;
}
}
genl_status_enablefield
void
genl_status_enablefield(fieldidx, nm, fmt, enable)
int fieldidx;
const char *nm;
const char *fmt;
boolean enable;
{
status_fieldfmt[fieldidx] = fmt;
status_fieldnm[fieldidx] = nm;
status_activefields[fieldidx] = enable;
}
genl_status_update
void
genl_status_update(idx, ptr, chg, percent)
int idx, chg, percent;
genericptr_t ptr;
{
char newbot1[MAXCO], newbot2[MAXCO];
long cond, *condptr = (long *) ptr;
register int i;
char *text = (char *) ptr;
enum statusfields fieldorder[2][15] = {
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
BL_FLUSH },
{ BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX,
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, BL_FLUSH }
};
if (idx != BL_FLUSH) {
if (!status_activefields[idx])
return;
switch (idx) {
case BL_CONDITION:
cond = *condptr;
*status_vals[idx] = '\0';
if (cond & BL_MASK_BLIND)
Strcat(status_vals[idx], " Blind");
if (cond & BL_MASK_CONF)
Strcat(status_vals[idx], " Conf");
if (cond & BL_MASK_FOODPOIS)
Strcat(status_vals[idx], " FoodPois");
if (cond & BL_MASK_ILL)
Strcat(status_vals[idx], " Ill");
if (cond & BL_MASK_STUNNED)
Strcat(status_vals[idx], " Stun");
if (cond & BL_MASK_HALLU)
Strcat(status_vals[idx], " Hallu");
if (cond & BL_MASK_SLIMED)
Strcat(status_vals[idx], " Slime");
break;
default:
Sprintf(status_vals[idx],
status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s", text);
break;
}
}
/* This genl version updates everything on the display, everytime */
newbot1[0] = '\0';
for (i = 0; fieldorder[0][i] != BL_FLUSH; ++i) {
int idx1 = fieldorder[0][i];
if (status_activefields[idx1])
Strcat(newbot1, status_vals[idx1]);
}
newbot2[0] = '\0';
for (i = 0; fieldorder[1][i] != BL_FLUSH; ++i) {
int idx2 = fieldorder[1][i];
if (status_activefields[idx2])
Strcat(newbot2, status_vals[idx2]);
}
curs(WIN_STATUS, 1, 0);
putstr(WIN_STATUS, 0, newbot1);
curs(WIN_STATUS, 1, 1);
putmixed(WIN_STATUS, 0, newbot2); /* putmixed() due to GOLD glyph */
}
genl_status_threshold
#ifdef STATUS_HILITES
void
genl_status_threshold(fldidx, thresholdtype, threshold, behavior, under, over)
int fldidx, thresholdtype;
int behavior, under, over;
anything threshold;
{
return;
}
#endif /* STATUS_HILITES */
#endif /* STATUS_VIA_WINDOWPORT */
/*windows.c*/