home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / spiele / pilotmin / pilotmin.exe / pmines / src / mine.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-19  |  1.1 KB  |  50 lines

  1. #ifndef _MINE_H
  2. #define _MINE_H
  3.  
  4. #ifdef OLDGCC
  5. /* 
  6.  * a bug in the gcc port -- it doesn't save %a4, as it isn't 
  7.  * supposed to be destroyed; SysTraps() however do this casually;
  8.  * place these macros in EventHandler routines and callback functions.
  9.  *
  10.  * the egcs port doesn't have it anymore :-)
  11.  */
  12. register void *reg_a4 asm("%a4");
  13. #  define CALLBACK_PROLOGUE \
  14.     void *save_a4 = reg_a4; asm("move.l %%a5,%%a4; sub.l #edata,%%a4" : :);
  15. #  define CALLBACK_EPILOGUE reg_a4 = save_a4;
  16. #else
  17. #  define CALLBACK_PROLOGUE
  18. #  define CALLBACK_EPILOGUE
  19. #endif
  20.           
  21. // max board dimensions
  22. #define WIDTH           26
  23. #define HEIGHT          24
  24.  
  25. #define NAMLEN          11
  26.  
  27. typedef int (*func) (SWord, SWord);
  28.  
  29. typedef struct {
  30.   int  version;
  31.   Byte options;
  32.   Byte level;
  33.   Byte minefield[WIDTH][HEIGHT];
  34.   Byte done;
  35.   Short seconds;
  36.   struct {
  37.     char name[NAMLEN];
  38.     int score;
  39.     ULong date;
  40.   } hscore[12][5]; // 12 level a 5 high score entries
  41. } Game;
  42.  
  43. extern long score;
  44. extern Game game;
  45.  
  46. enum { IsRunning, IsWon, IsLost, IsFinishedWon, IsFinishedLost, 
  47.        IsToBeStarted, Restart, HighScoreWon, HighScoreLost };
  48.  
  49. #endif
  50.