-
Notifications
You must be signed in to change notification settings - Fork 0
/
omnitype.h
113 lines (85 loc) · 2.34 KB
/
omnitype.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
103
104
105
106
107
108
109
110
111
112
#ifndef _OMNITYPE_H
#define _OMNITYPE_H 1
#include <stdlib.h>
/**************************************
Constants
**************************************/
#define MAX_FIGURE_SIZE 8
#define MAX_GLASS_WIDTH 32 /*UINT_WIDTH*/
#define MAX_GLASS_HEIGHT 256
enum GoalTypes {
FILL_GOAL,
TOUCH_GOAL,
FLAT_GOAL,
MAX_GOAL
};
/**************************************
Omnimino types
**************************************/
struct Coord {
int x, y;
};
typedef void (*bfunc) (struct Coord *, int *);
struct OmniParms {
unsigned int Aperture;
unsigned int Metric; /* 0 - abs(x1-x0)+abs(y1-y0), 1 - max(abs(x1-x0),abs(y1-y0)) */
unsigned int WeightMax;
unsigned int WeightMin;
unsigned int Gravity;
unsigned int SingleLayer; /* moving figure can not overlap placed blocks */
unsigned int DiscardFullRows;
unsigned int Goal;
unsigned int GlassWidth;
unsigned int GlassHeightBuf;
unsigned int FillLevel;
unsigned int FillRatio; /* < GlassWidth */
unsigned int FixedSequence;
};
#define PARNUM (sizeof(struct OmniParms) / sizeof(unsigned int))
struct OmniConsts { /* Parameters' derivatives */
unsigned int FigureSize;
unsigned int TotalArea;
unsigned int FullRow;
};
struct OmniData {
struct Coord **LastFigure;
struct Coord **NextFigure; /* used to navigate through figures */
unsigned int TimeStamp;
};
struct OmniVars {
struct Coord **CurFigure;
struct Coord **LastTouched; /* latest modified */
struct Coord **FigureBuf;
unsigned int GameType;
unsigned int GlassHeight; /* can change during game if DiscardFullRows */
unsigned int FieldSize; /* follows GlassHeight with FigureSize + 1 bias */
unsigned int GlassLevel; /* lowest free line */
unsigned int EmptyCells;
int GameOver;
int GoalReached;
int GameModified;
};
struct OmniMem {
unsigned int FillBuf[MAX_GLASS_HEIGHT];
size_t GameBufSize;
struct Coord **Figure;
struct Coord *Block;
unsigned int *GlassRow; /* used by SaveGame too */
size_t StoreBufSize;
};
#define OM_STRLEN 80
struct OmniStrings {
char MsgBuf[OM_STRLEN + 1];
char GameName[OM_STRLEN + 1];
char ParentName[OM_STRLEN + 1];
char PlayerName[OM_STRLEN + 1];
};
struct Omnimino {
struct OmniParms P;
struct OmniConsts C;
struct OmniData D;
struct OmniVars V;
struct OmniMem M;
struct OmniStrings S;
};
#endif