runrobot.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* $Id$
  2. * MegaZeux
  3. *
  4. * Copyright (C) 1996 Greg Janson
  5. * Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. // Prototypes for RUNROBOT.CPP
  22. #ifndef __RUNROBOT_H
  23. #define __RUNROBOT_H
  24. //Can use "ALL" or sensornames
  25. void send_robot(char far *robot,char far *mesg,char ignore_lock=0);
  26. //Returns non-0 if not possible
  27. char send_robot_id(int id,char far *mesg,char ignore_lock=0);
  28. //Prefixes a set of x/y pairs
  29. void prefix_xy(int&fx,int&fy,int&mx,int&my,int&lx,int&ly,int robotx,
  30. int roboty);
  31. //Move an x/y pair in a given direction. Returns non-0 if edge reached.
  32. char move_dir(int&x,int&y,char dir);
  33. //Returns the numeric value pointed to OR the numeric value represented
  34. //by the counter string pointed to. (the ptr is at the param within the
  35. //command)
  36. int parse_param(unsigned char far *robot,int id);
  37. extern unsigned char ibuff[161];//Use for most recent tr_msg
  38. extern unsigned char ibuff2[161];//Alternate buffer
  39. unsigned char far *tr_msg(unsigned char far *orig_mesg,int id,
  40. unsigned char far *buffer=ibuff);
  41. //Returns pos of next parameter, where pos is pos of current parameter
  42. unsigned int next_param(unsigned char far *ptr,unsigned int pos);
  43. char restore_label(unsigned char far *robot,unsigned char far *label);
  44. char zap_label(unsigned char far *robot,unsigned char far *label);
  45. //Turns a color (including those w/??) to a real color (0-255)
  46. unsigned char fix_color(int color,unsigned char def);
  47. extern char first_prefix;//1-3 normal 5-7 is 1-3 but from a REL FIRST cmd
  48. extern char mid_prefix;
  49. extern char last_prefix;//See first_prefix
  50. extern char far *item_to_counter[9];
  51. //Robot box message stuff
  52. void display_robot_line(unsigned char far *robot,int y,int id);
  53. void robot_frame(unsigned char far *robot,int id);
  54. void robot_box_display(unsigned char far *robot,int id,char far *label_storage);
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58. void send_robot_def(int robot_id,char mesg_id);
  59. //x/y to adjust struct's x/y incase the robot was moved by an outside force
  60. //such as pushing or a MOVE ALL command.
  61. void run_robot(int id,int x,int y);
  62. //Sends robot in struct of sensor #id to SENSORPUSHED
  63. void push_sensor(int id);
  64. //Sends robot in struct of sensor #id to SENSORON
  65. void step_sensor(int id);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif