Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. //
  2. //      ID Engine
  3. //      ID_US.h - Header file for the User Manager
  4. //      v1.0d1
  5. //      By Jason Blochowiak
  6. //
  7.  
  8. #ifndef __ID_US__
  9. #define __ID_US__
  10.  
  11. #ifdef  __DEBUG__
  12. #define __DEBUG_UserMgr__
  13. #endif
  14.  
  15. //#define       HELPTEXTLINKED
  16.  
  17. #define MaxX    320
  18. #define MaxY    200
  19.  
  20. #define MaxHelpLines    500
  21.  
  22. #define MaxHighName     57
  23. #define MaxScores       7
  24. typedef struct
  25. {
  26.     char        name[MaxHighName + 1];
  27.     int32_t     score;
  28.     word        completed,episode;
  29. } HighScore;
  30.  
  31. #define MaxGameName             32
  32. #define MaxSaveGames    6
  33. typedef struct
  34. {
  35.     char        signature[4];
  36.     word        *oldtest;
  37.     boolean     present;
  38.     char        name[MaxGameName + 1];
  39. } SaveGame;
  40.  
  41. #define MaxString       128     // Maximum input string size
  42.  
  43. typedef struct
  44. {
  45.     int x,y,
  46.         w,h,
  47.         px,py;
  48. } WindowRec;    // Record used to save & restore screen windows
  49.  
  50. extern  boolean         ingame,         // Set by game code if a game is in progress
  51.                                         loadedgame;     // Set if the current game was loaded
  52. extern  word            PrintX,PrintY;  // Current printing location in the window
  53. extern  word            WindowX,WindowY,// Current location of window
  54.                                         WindowW,WindowH;// Current size of window
  55.  
  56. extern  void            (*USL_MeasureString)(const char *,word *,word *);
  57. extern void                     (*USL_DrawString)(const char *);
  58.  
  59. extern  boolean         (*USL_SaveGame)(int),(*USL_LoadGame)(int);
  60. extern  void            (*USL_ResetGame)(void);
  61. extern  SaveGame        Games[MaxSaveGames];
  62. extern  HighScore       Scores[];
  63.  
  64. #define US_HomeWindow() {PrintX = WindowX; PrintY = WindowY;}
  65.  
  66. void            US_Startup(void);
  67. void            US_Shutdown(void);
  68. void                    US_TextScreen(void),
  69.                                 US_UpdateTextScreen(void),
  70.                                 US_FinishTextScreen(void);
  71. void                    US_DrawWindow(word x,word y,word w,word h);
  72. void                    US_CenterWindow(word,word);
  73. void                    US_SaveWindow(WindowRec *win),
  74.                                 US_RestoreWindow(WindowRec *win);
  75. void                    US_ClearWindow(void);
  76. void                    US_SetPrintRoutines(void (*measure)(const char *,word *,word *),
  77.                                                                         void (*print)(const char *));
  78. void                    US_PrintCentered(const char *s),
  79.                                 US_CPrint(const char *s),
  80.                                 US_CPrintLine(const char *s),
  81.                                 US_Print(const char *s);
  82. void                    US_Printf(const char *formatStr, ...);
  83. void                    US_CPrintf(const char *formatStr, ...);
  84.  
  85. void                    US_PrintUnsigned(longword n);
  86. void                    US_PrintSigned(int32_t n);
  87. void                    US_StartCursor(void),
  88.                                 US_ShutCursor(void);
  89. void                    US_CheckHighScore(int32_t score,word other);
  90. void                    US_DisplayHighScores(int which);
  91. extern  boolean US_UpdateCursor(void);
  92. boolean         US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
  93.                              int maxchars,int maxwidth);
  94.  
  95. void            USL_PrintInCenter(const char *s,Rect r);
  96. char            *USL_GiveSaveName(word game);
  97.  
  98. void            US_InitRndT(int randomize);
  99. int             US_RndT();
  100.  
  101. #endif
  102.