home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / nethack-3.1 / sys / msdos / trampoli.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-18  |  14.8 KB  |  618 lines

  1. /*    SCCS Id: @(#)trampoli.c     3.1    93/01/18      */
  2. /* Copyright (c) 1989 - 1993 by Norm Meluch and Stephen Spackman  */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #include "hack.h"
  6.  
  7. /****************************************************************************/
  8. /*                                        */
  9. /*    This file contains a series of definitions of "one liner"        */
  10. /*    functions corresponding to *all* functions that NetHack calls        */
  11. /*    via pointers.                                */
  12. /*         IF ANY CALLS TO FUNCTIONS VIA POINTERS ARE ADDED            */
  13. /*         TO THE CODE, AN ENTRY FOR THE FUNCTION CALLED MUST            */
  14. /*         BE ADDED TO THIS FILE AND TO TRAMPOLI.H.                */
  15. /*    This mess is necessary for the Microsoft Compiler implementation    */
  16. /*    of overlaid code (v5.1 - 6.0ax).                    */
  17. /*                                        */
  18. /*    The original function (eg foo) has been #defined to be foo_        */
  19. /*    via double inclusion of trampoli.h in hack.h, and            */
  20. /*    now the definition of foo is placed in this file calling foo        */
  21. /*    directly.  This module is _never_ placed in an overlay so        */
  22. /*    calls via pointers to these functions will not cause difficulties.  */
  23. /*                                        */
  24. /*    This leads to what could be called a "trampoline" effect, and        */
  25. /*    hence the silly name for these files. :-)                */
  26. /*                                        */
  27. /****************************************************************************/
  28.  
  29. #ifdef OVERLAY
  30.  
  31. /* ### apply.c ### */
  32. #undef dig
  33. #undef doapply
  34. #undef dojump
  35. #undef dorub
  36.  
  37. int dig()     { return dig_();     }
  38. int doapply() { return doapply_(); }
  39. int dojump()  { return dojump_();  }
  40. int dorub()   { return dorub_();   }
  41.  
  42.  
  43. /* ### cmd.c ### */
  44. #undef doextcmd
  45. #undef doextlist
  46. #undef doprev_message
  47.  
  48. #ifdef POLYSELF
  49. #undef domonability
  50. #endif /* POLYSELF */
  51.  
  52. #ifdef EXPLORE_MODE
  53. #undef enter_explore_mode
  54.  
  55. int enter_explore_mode() { return enter_explore_mode_(); }
  56. #endif
  57.  
  58. #undef timed_occupation
  59.  
  60. #if defined(WIZARD) || defined(EXPLORE_MODE)
  61. #undef wiz_attributes
  62. #endif
  63.  
  64. #ifdef WIZARD
  65. #undef wiz_detect
  66. #undef wiz_genesis
  67. #undef wiz_identify
  68. #undef wiz_level_tele
  69. #undef wiz_map
  70. #undef wiz_where
  71. #undef wiz_wish
  72. #endif
  73.  
  74. int doextcmd()         { return doextcmd_();         }
  75. int doextlist()        { return doextlist_();        }
  76. int doprev_message()   { return doprev_message_();   }
  77.  
  78. #ifdef POLYSELF
  79. int domonability()     { return domonability_();     }
  80. #endif /* POLYSELF */
  81.  
  82. int timed_occupation() { return timed_occupation_(); }
  83.  
  84. #if defined(WIZARD) || defined(EXPLORE_MODE)
  85. int wiz_attributes()   { return wiz_attributes_();   }
  86. #endif
  87.  
  88. #ifdef WIZARD
  89. int wiz_detect()       { return wiz_detect_();       }
  90. int wiz_genesis()      { return wiz_genesis_();      }
  91. int wiz_identify()     { return wiz_identify_();     }
  92. int wiz_level_tele()   { return wiz_level_tele_();   }
  93. int wiz_map()          { return wiz_map_();          }
  94. int wiz_where()        { return wiz_where_();        }
  95. int wiz_wish()         { return wiz_wish_();         }
  96. #endif
  97.  
  98.  
  99. /* ### do.c ### */
  100. #undef doddrop
  101. #undef dodown
  102. #undef dodrop
  103. #undef donull
  104. #undef doup
  105. #undef dowipe
  106. #undef drop
  107. #undef wipeoff
  108.  
  109. int doddrop()             { return doddrop_(); }
  110. int dodown()              { return dodown_();  }
  111. int dodrop()              { return dodrop_();  }
  112. int donull()              { return donull_();  }
  113. int doup()                { return doup_();    }
  114. int dowipe()              { return dowipe_();  }
  115. int drop(obj)
  116. register struct obj *obj; { return drop_(obj); }
  117. int wipeoff()             { return wipeoff_(); }
  118.  
  119.  
  120. /* ### do_name.c ### */
  121. #undef ddocall
  122. #undef do_mname
  123.  
  124. int ddocall()  { return ddocall_();  }
  125. int do_mname() { return do_mname_(); } 
  126.  
  127.  
  128. /* ### do_wear.c ### */
  129. #undef Armor_off
  130. #undef Boots_off
  131. #undef Gloves_off
  132. #undef Helmet_off
  133. #undef Armor_on
  134. #undef Boots_on
  135. #undef Gloves_on
  136. #undef Helmet_on
  137. #undef doddoremarm
  138. #undef doputon
  139. #undef doremring
  140. #undef dotakeoff
  141. #undef dowear
  142. #undef select_off
  143. #undef take_off
  144.  
  145. int Armor_off()   { return Armor_off_();   }
  146. int Boots_off()   { return Boots_off_();   }
  147. int Gloves_off()  { return Gloves_off_();  }
  148. int Helmet_off()  { return Helmet_off_();  }
  149. int Armor_on()    { return Armor_on_();    }
  150. int Boots_on()    { return Boots_on_();    }
  151. int Gloves_on()   { return Gloves_on_();   }
  152. int Helmet_on()   { return Helmet_on_();   }
  153. int doddoremarm() { return doddoremarm_(); }
  154. int doputon()     { return doputon_();     }
  155. int doremring()   { return doremring_();   }
  156. int dotakeoff()   { return dotakeoff_();   }
  157. int dowear()      { return dowear_();      }
  158. int select_off(otmp) struct obj *otmp; { return select_off_(otmp); }
  159. int take_off()    { return take_off_();    }
  160.  
  161.  
  162. /* ### dogmove ### */
  163. #undef wantdoor
  164.  
  165. void wantdoor(x, y, dummy)
  166. int x, y; genericptr_t dummy; { return wantdoor_(x, y, dummy); }
  167.  
  168.  
  169. /* ### dokick.c ### */
  170. #undef dokick
  171.  
  172. int dokick() { return dokick_(); }
  173.  
  174.  
  175. /* ### dothrow.c ### */
  176. #undef dothrow
  177.  
  178. int dothrow() { return dothrow_(); }
  179.  
  180.  
  181. /* ### eat.c ### */
  182. #undef Hear_again
  183. #undef eatmdone
  184. #undef doeat
  185. #undef eatfood
  186. #undef opentin
  187. #undef unfaint
  188.  
  189. int Hear_again()  { return Hear_again_(); }
  190. int eatmdone()    { return eatmdone_();   }
  191. int doeat()       { return doeat_();      }
  192. int eatfood()     { return eatfood_();    }
  193. int opentin()     { return opentin_();    }
  194. int unfaint()     { return unfaint_();    }
  195.  
  196.  
  197. /* ### end.c ### */
  198. #undef done1
  199. #undef done2
  200. #undef hangup
  201. #undef done_intr
  202.  
  203. #if defined(UNIX) || defined(VMS)
  204. #undef done_hangup
  205. #endif /* UNIX || VMS */
  206.  
  207. int done1()     { return done1_();     }
  208. int done2()     { return done2_();     }
  209. int hangup()    { return hangup_();    }
  210. int done_intr() { return done_intr_(); }
  211.  
  212. #if defined(UNIX) || defined(VMS)
  213. int done_hangup() { return done_hangup_(); }
  214. #endif /* UNIX || VMS */
  215.  
  216.  
  217. /* ### engrave.c ### */
  218. #undef doengrave
  219.  
  220. int doengrave() { return doengrave_(); }
  221.  
  222.  
  223. /* ### fountain.c ### */
  224. #undef gush
  225.  
  226. void gush(x, y, poolcnt)
  227. int x, y; genericptr_t poolcnt; { return gush_(x, y, poolcnt); }
  228.  
  229.  
  230. /* ### hack.c ### */
  231. #undef dopickup
  232. #undef identify
  233.  
  234. int dopickup() { return dopickup_(); }
  235. int identify(otmp) struct obj *otmp; { return identify_(otmp); }
  236.  
  237.  
  238. /* ### invent.c ### */
  239. #undef ckunpaid
  240. #undef ddoinv
  241. #undef dolook
  242. #undef dopramulet
  243. #undef doprarm
  244. #undef doprgold
  245. #undef doprring
  246. #undef doprtool
  247. #undef doprwep
  248. #undef dotypeinv
  249. #undef doorganize
  250.  
  251. int ckunpaid(obj) struct obj *obj; { return ckunpaid_(obj); }
  252. int ddoinv()     { return ddoinv_();     }
  253. int dolook()     { return dolook_();     }
  254. int dopramulet() { return dopramulet_(); }
  255. int doprarm()    { return doprarm_();    }
  256. int doprgold()   { return doprgold_();   }
  257. int doprring()   { return doprring_();   }
  258. int doprtool()   { return doprtool_();   }
  259. int doprwep()    { return doprwep_();    }
  260. int dotypeinv()  { return dotypeinv_();  }
  261. int doorganize() { return doorganize_(); }
  262.  
  263.  
  264. /* ### ioctl.c ### */
  265. #ifdef UNIX
  266. # ifdef SUSPEND
  267. #undef dosuspend
  268.  
  269. int dosuspend() { return dosuspend_(); }
  270. # endif /* SUSPEND */
  271. #endif /* UNIX */
  272.  
  273.  
  274. /* ### lock.c ### */
  275. #undef doclose
  276. #undef doforce
  277. #undef doopen
  278. #undef forcelock
  279. #undef picklock
  280.  
  281. int doclose()   { return doclose_();   }
  282. int doforce()   { return doforce_();   }
  283. int doopen()    { return doopen_();    }
  284. int forcelock() { return forcelock_(); }
  285. int picklock()  { return picklock_();  }
  286.  
  287.  
  288. /* ### mklev.c ### */
  289. #undef do_comp
  290.  
  291. int do_comp(vx, vy) genericptr_t vx, vy;  { return comp_(vx, vy); }
  292.  
  293.  
  294. /* ### mondata.c ### */
  295. /* canseemon() is only called by a macro e_boolean.  If e_boolean ever does
  296.    become a function, this may need to return. */
  297.  
  298. /* #undef canseemon */
  299.  
  300. /* boolean canseemon(x) struct monst *x; { return canseemon_(x); } */
  301.  
  302.  
  303. /* ### muse.c ### */
  304. #undef mbhitm
  305.  
  306. int mbhitm(mtmp, otmp) struct monst *mtmp; struct obj *otmp;
  307.     { return mbhitm_(mtmp, otmp); }
  308.  
  309.  
  310. /* ### o_init.c ### */
  311. #undef dodiscovered
  312.  
  313. int dodiscovered() { return dodiscovered_(); }
  314.  
  315.  
  316. /* ### objnam.c ### */
  317. #undef doname
  318. #undef xname
  319.  
  320. char *doname(obj) struct obj *obj; { return doname_(obj); }
  321. char *xname(obj)  struct obj *obj; { return xname_(obj); }
  322.  
  323.  
  324. /* ### options.c ### */
  325. #undef doset
  326. #undef dotogglepickup
  327.  
  328. int doset()          { return doset_();         }
  329. int dotogglepickup() { return dotogglepickup_(); }
  330.  
  331.  
  332. /* ### pager.c ### */
  333. #undef dohelp
  334. #undef dohistory
  335. #undef dowhatdoes
  336. #undef dowhatis
  337. #undef doquickwhatis
  338.  
  339. int dohelp()        { return dohelp_();        }
  340. int dohistory()     { return dohistory_();     }
  341. int dowhatdoes()    { return dowhatdoes_();    }
  342. int dowhatis()      { return dowhatis_();      }
  343. int doquickwhatis() { return doquickwhatis_(); }
  344.  
  345.  
  346. /* ### pcsys.c ### */
  347. #ifdef SHELL
  348. #undef dosh
  349.  
  350. int dosh()          { return dosh_();          }
  351. #endif /* SHELL */
  352.  
  353.  
  354. /* ### pickup.c ### */
  355. #undef ck_bag
  356. #undef doloot
  357. #undef in_container
  358. #undef out_container
  359.  
  360. int ck_bag(obj) struct obj *obj; { return ck_bag_(obj);  }
  361. int doloot() { return doloot_(); }
  362. int in_container(obj)  struct obj *obj; { return in_container_(obj); }
  363. int out_container(obj) struct obj *obj; { return out_container_(obj); }
  364.  
  365.  
  366. /* ### potion.c ### */
  367. #undef dodrink
  368. #undef dodip
  369.  
  370. int dodrink() { return dodrink_(); }
  371. int dodip()   { return dodip_();   }
  372.  
  373.  
  374. /* ### pray.c ### */
  375. #undef doturn
  376. #undef dopray
  377. #undef prayer_done
  378. #undef dosacrifice
  379.  
  380. int doturn()      { return doturn_();      }
  381. int dopray()      { return dopray_();      }
  382. int prayer_done() { return prayer_done_(); }
  383. int dosacrifice() { return dosacrifice_(); }
  384.  
  385.  
  386. /* ### print.c ### */
  387. #undef doredraw
  388.  
  389. int doredraw()    { return doredraw_(); }
  390.  
  391.  
  392. /* ### read.c ### */
  393. #undef doread
  394. #undef set_lit
  395.  
  396. int doread()            { return doread_(); }
  397. void set_lit(x, y, val)
  398. int x, y; genericptr_t val; { return set_lit_(x, y, val); }
  399.  
  400.  
  401. /* ### save.c ### */
  402. #undef dosave
  403.  
  404. int dosave() { return dosave_(); }
  405.  
  406.  
  407. /* ### search.c ### */
  408. #undef findone
  409. #undef openone
  410. #undef doidtrap
  411. #undef dosearch
  412.  
  413. void findone(zx, zy, num)
  414. int zx, zy; genericptr_t num; { return findone_(zx, zy, num); }
  415. void openone(zx, zy, num)
  416. int zx, zy; genericptr_t num; { return openone_(zx, zy, num); }
  417. int doidtrap()              { return doidtrap_(); }
  418. int dosearch()              { return dosearch_(); }
  419.  
  420.  
  421. /* ### shk.c ### */
  422. #undef dopay
  423.  
  424. int dopay() { return dopay_(); }
  425.  
  426.  
  427. /* ### sit.c ### */
  428. #undef dosit
  429.  
  430. int dosit() { return dosit_(); }
  431.  
  432.  
  433. /* ### sounds.c ### */
  434. #undef dotalk
  435.  
  436. int dotalk() { return dotalk_(); }
  437.  
  438.  
  439. /* ### spell.c ### */
  440. #undef learn
  441. #undef docast
  442. #undef dovspell
  443.  
  444. int learn() { return learn_(); }
  445. int docast()   { return docast_();   }
  446. int dovspell() { return dovspell_(); }
  447.  
  448.  
  449. /* ### steal.c ### */
  450. #undef stealarm
  451.  
  452. int stealarm() { return stealarm_(); }
  453.  
  454.  
  455. /* ### trap.c ### */
  456. #undef dotele
  457. #undef dountrap
  458. #undef float_down
  459.  
  460. int dotele()     { return dotele_();     }
  461. int dountrap()   { return dountrap_();   }
  462. int float_down() { return float_down_(); }
  463.  
  464.  
  465. /* ### version.c ### */
  466. #undef doversion
  467. #undef doextversion
  468.  
  469. int doversion()    { return doversion_();    }
  470. int doextversion() { return doextversion_(); }
  471.  
  472.  
  473. /* ### wield.c ### */
  474. #undef dowield
  475.  
  476. int dowield() { return dowield_(); }
  477.  
  478.  
  479. /* ### zap.c ### */
  480. #undef bhitm
  481. #undef bhito
  482. #undef dozap
  483.  
  484. int bhitm(mtmp, otmp) struct monst *mtmp; struct obj *otmp;
  485.     { return bhitm_(mtmp, otmp); }
  486. int bhito(obj, otmp) struct obj *obj, *otmp; { return bhito_(obj,  otmp); }
  487. int dozap() { return dozap_(); }
  488.  
  489. /* 
  490.  * Window Implementation Specific Functions.
  491.  */
  492.  
  493.  
  494. /* ### getline.c ### */
  495. #undef tty_getlin
  496. #ifdef COM_COMPL
  497. #undef tty_get_ext_cmd
  498.  
  499. void tty_get_ext_cmd(bufp)
  500.   char *bufp;            { tty_get_ext_cmd_(bufp);    }
  501. #endif /* COM_COMPL */
  502. void tty_getlin(query,bufp)
  503.   const char *query; char *bufp;{ tty_getlin_(query,bufp);    }
  504.  
  505.  
  506. /* ### termcap.c ### */
  507. #undef tty_nhbell
  508. #undef tty_number_pad
  509. #undef tty_delay_output
  510. #undef tty_start_screen
  511. #undef tty_end_screen
  512.  
  513. void tty_nhbell()        { tty_nhbell_();         }
  514. void tty_number_pad(state)
  515.   int state;            { tty_number_pad_(state);    }
  516. void tty_delay_output()        { tty_delay_output_();         }
  517. /* other defs that really should go away (they're tty specific) */
  518. void tty_start_screen()        { tty_start_screen_();         }
  519. void tty_end_screen()        { tty_end_screen_();         }
  520.  
  521.  
  522. /* ### topl.c ### */
  523. #undef tty_doprev_message
  524. #undef tty_yn_function
  525.  
  526. int tty_doprev_message()    { tty_doprev_message_();     }
  527. char tty_yn_function(query,resp,def)
  528.   const char *query, *resp; char def;
  529.                 { tty_yn_function_(query,resp,def); }
  530.  
  531.  
  532. /* ### wintty.c ### */
  533. #undef tty_init_nhwindows
  534. #undef tty_player_selection
  535. #undef tty_askname
  536. #undef tty_get_nh_event
  537. #undef tty_exit_nhwindows
  538. #undef tty_suspend_nhwindows
  539. #undef tty_resume_nhwindows
  540. #undef tty_create_nhwindow
  541. #undef tty_clear_nhwindow
  542. #undef tty_display_nhwindow
  543. #undef tty_destroy_nhwindow
  544. #undef tty_curs
  545. #undef tty_putstr
  546. #undef tty_display_file
  547. #undef tty_start_menu
  548. #undef tty_add_menu
  549. #undef tty_end_menu
  550. #undef tty_select_menu
  551. #undef tty_update_inventory
  552. #undef tty_mark_synch
  553. #undef tty_wait_synch
  554. #ifdef CLIPPING
  555. #undef tty_cliparound
  556. #endif
  557. #undef tty_print_glyph
  558. #undef tty_raw_print
  559. #undef tty_raw_print_bold
  560. #undef tty_nhgetch
  561. #undef tty_nh_poskey
  562.  
  563. void tty_init_nhwindows()    { tty_init_nhwindows_();    }
  564. void tty_player_selection()    { tty_player_selection_();     }
  565. void tty_askname()        { tty_askname_();         }
  566. void tty_get_nh_event()        { tty_get_nh_event_();         }
  567. void tty_exit_nhwindows(str)
  568.   const char *str;        { tty_exit_nhwindows_(str);    }
  569. void tty_suspend_nhwindows(str)
  570.   const char *str;        { tty_suspend_nhwindows_(str);    }
  571. void tty_resume_nhwindows()    { tty_resume_nhwindows_();     }
  572. winid tty_create_nhwindow(type)
  573.   int type;            { tty_create_nhwindow_(type);    }
  574. void tty_clear_nhwindow(window)
  575.   winid window;            { tty_clear_nhwindow_(window);    }
  576. void tty_display_nhwindow(window, blocking)
  577.   winid window; boolean blocking;
  578.                 { tty_display_nhwindow_(window,blocking); }
  579. void tty_destroy_nhwindow(window)
  580.   winid window;            { tty_destroy_nhwindow_(window); }
  581. void tty_curs(window,x,y)
  582.   winid window; int x,y;    { tty_curs_(window,x,y);    }
  583. void tty_putstr(window,attr,str)
  584.   winid window; int attr; const char *str;
  585.                 { tty_putstr_(window,attr,str); }
  586. void tty_display_file(fname, complain)
  587.   const char *fname; boolean complain;
  588.                 { tty_display_file_(fname,complain); }
  589. void tty_start_menu(window)
  590.   winid window;            { tty_start_menu_(window);    }
  591. void tty_add_menu(window,ch,attr,str)
  592.   winid window; char ch; int attr; const char *str;
  593.                 { tty_add_menu_(window,ch,attr,str); }
  594. void tty_end_menu(window,ch,str,morestr)
  595.   winid window; char ch; const char *str, *morestr;
  596.                 { tty_end_menu_(window,ch,str,morestr);    }
  597. char tty_select_menu(window)
  598.   winid window;            { tty_select_menu_(window);    }
  599. void tty_update_inventory()    { tty_update_inventory_();     }
  600. void tty_mark_synch()        { tty_mark_synch_();         }
  601. void tty_wait_synch()        { tty_wait_synch_();         }
  602. #ifdef CLIPPING
  603. void tty_cliparound(x,y)
  604.   int x,y;            { tty_cliparound_(x,y);        }
  605. #endif
  606. void tty_print_glyph(window,x,y,glyph)
  607.   winid window; xchar x,y; int glyph;
  608.                 { tty_print_glyph_(window,x,y,glyph); }
  609. void tty_raw_print(str)
  610.   const char *str;        { tty_raw_print_(str);         }
  611. void tty_raw_print_bold(str)
  612.   const char *str;        { tty_raw_print_bold_(str);     }
  613. int tty_nhgetch()        { tty_nhgetch_();         }
  614. int tty_nh_poskey(x,y,pos)
  615.   int *x,*y,*pos;        { tty_nh_poskey_(x,y,pos);    }
  616.  
  617. #endif /* OVERLAY */
  618.