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