-
Notifications
You must be signed in to change notification settings - Fork 5
/
gamevars.go
255 lines (250 loc) · 6.72 KB
/
gamevars.go
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
package main // unit: GameVars
const (
MAX_STAT = 150
MAX_ELEMENT = 53
MAX_BOARD = 100
MAX_FLAG = 10
BOARD_WIDTH = 60
BOARD_HEIGHT = 25
HIGH_SCORE_COUNT = 30
TORCH_DURATION = 200
TORCH_DX = 8
TORCH_DY = 5
TORCH_DIST_SQR = 50
)
const (
SizeOfBoardName = 50 + 1
SizeOfRleTile = 3
SizeOfBoardInfo = 86
SizeOfStat = 33
SizeOfBoardInfoMessage = 58 + 1
SizeOfWorldInfo = 275
SizeOfHighScoreList = 53 * HIGH_SCORE_COUNT
)
type (
TString50 string
TCoord struct {
X int16
Y int16
}
TTile struct {
Element byte
Color byte
}
TElementDrawProc func(x, y int16, ch *byte)
TElementTickProc func(statId int16)
TElementTouchProc func(x, y int16, sourceStatId int16, deltaX, deltaY *int16)
TElementDef struct {
Character byte
Color byte
Destructible bool
Pushable bool
VisibleInDark bool
PlaceableOnTop bool
Walkable bool
HasDrawProc bool
DrawProc TElementDrawProc
Cycle int16
TickProc TElementTickProc
TouchProc TElementTouchProc
EditorCategory int16
EditorShortcut byte
Name string
CategoryName string
Param1Name string
Param2Name string
ParamBulletTypeName string
ParamBoardName string
ParamDirName string
ParamTextName string
ScoreValue int16
}
TStat struct {
X, Y byte
StepX, StepY int16
Cycle int16
P1, P2, P3 byte
Follower int16
Leader int16
Under TTile
Data string // TODO: this should probably be []byte as ZAP/RESTORE modify it
DataPos int16
DataLen int16
unk1, unk2 *uintptr
}
TRleTile struct {
Count byte
Tile TTile
}
TBoardInfo struct {
MaxShots byte
IsDark bool
NeighborBoards [4]byte
ReenterWhenZapped bool
Message string
StartPlayerX byte
StartPlayerY byte
TimeLimitSec int16
unk1 [16]byte
}
TWorldInfo struct {
Ammo int16
Gems int16
Keys [7]bool
Health int16
CurrentBoard int16
Torches int16
TorchTicks int16
EnergizerTicks int16
padding1 int16 // TODO: remove
Score int16
Name string
Flags [MAX_FLAG]string
BoardTimeSec int16
BoardTimeHsec int16
IsSave bool
padding2 [14]byte // TODO: remove
}
TEditorStatSetting struct {
P1, P2, P3 byte
StepX, StepY int16
}
TBoard struct {
Name string
Tiles [BOARD_WIDTH + 1 + 1][BOARD_HEIGHT + 1 + 1]TTile
StatCount int16
Stats [MAX_STAT + 1 + 1]TStat
Info TBoardInfo
}
TWorld struct {
BoardCount int16
BoardData [MAX_BOARD + 1][]byte
BoardLen [MAX_BOARD + 1]int16
Info TWorldInfo
EditorStatSettings [MAX_ELEMENT + 1]TEditorStatSetting
}
THighScoreEntry struct {
Name string
Score int16
}
THighScoreList [HIGH_SCORE_COUNT]THighScoreEntry
TIoTmpBuf [20000]byte
)
var (
PlayerDirX int16
PlayerDirY int16
unkVar_0476 int16
unkVar_0478 int16
TransitionTable [80 * 25]TCoord
LoadedGameFileName string
SavedGameFileName string
SavedBoardFileName string
StartupWorldFileName string
Board TBoard
World TWorld
MessageAmmoNotShown bool
MessageOutOfAmmoNotShown bool
MessageNoShootingNotShown bool
MessageTorchNotShown bool
MessageOutOfTorchesNotShown bool
MessageRoomNotDarkNotShown bool
MessageHintTorchNotShown bool
MessageForestNotShown bool
MessageFakeNotShown bool
MessageGemNotShown bool
MessageEnergizerNotShown bool
unkVar_4ABA [15]byte
GameTitleExitRequested bool
GamePlayExitRequested bool
GameStateElement int16
ReturnBoardId int16
TransitionTableSize int16
TickSpeed byte
IoTmpBuf TIoTmpBuf
ElementDefs [MAX_ELEMENT + 1]TElementDef
EditorPatternCount int16
EditorPatterns [10]byte
TickTimeDuration int16
CurrentTick int16
CurrentStatTicked int16
GamePaused bool
TickTimeCounter int16
ForceDarknessOff bool
OopChar byte
OopWord string
OopValue int16
DebugEnabled bool
HighScoreList THighScoreList
ConfigRegistration string
ConfigWorldFile string
EditorEnabled bool
JustStarted bool
WorldFileDescCount int16
WorldFileDescKeys [10]string
WorldFileDescValues [10]string
)
const (
E_EMPTY = 0
E_BOARD_EDGE = 1
E_MESSAGE_TIMER = 2
E_MONITOR = 3
E_PLAYER = 4
E_AMMO = 5
E_TORCH = 6
E_GEM = 7
E_KEY = 8
E_DOOR = 9
E_SCROLL = 10
E_PASSAGE = 11
E_DUPLICATOR = 12
E_BOMB = 13
E_ENERGIZER = 14
E_STAR = 15
E_CONVEYOR_CW = 16
E_CONVEYOR_CCW = 17
E_BULLET = 18
E_WATER = 19
E_FOREST = 20
E_SOLID = 21
E_NORMAL = 22
E_BREAKABLE = 23
E_BOULDER = 24
E_SLIDER_NS = 25
E_SLIDER_EW = 26
E_FAKE = 27
E_INVISIBLE = 28
E_BLINK_WALL = 29
E_TRANSPORTER = 30
E_LINE = 31
E_RICOCHET = 32
E_BLINK_RAY_EW = 33
E_BEAR = 34
E_RUFFIAN = 35
E_OBJECT = 36
E_SLIME = 37
E_SHARK = 38
E_SPINNING_GUN = 39
E_PUSHER = 40
E_LION = 41
E_TIGER = 42
E_BLINK_RAY_NS = 43
E_CENTIPEDE_HEAD = 44
E_CENTIPEDE_SEGMENT = 45
E_TEXT_BLUE = 47
E_TEXT_GREEN = 48
E_TEXT_CYAN = 49
E_TEXT_RED = 50
E_TEXT_PURPLE = 51
E_TEXT_YELLOW = 52
E_TEXT_WHITE = 53
E_TEXT_MIN = E_TEXT_BLUE
CATEGORY_ITEM = 1
CATEGORY_CREATURE = 2
CATEGORY_TERRAIN = 3
COLOR_SPECIAL_MIN = 0xF0
COLOR_CHOICE_ON_BLACK = 0xFF
COLOR_WHITE_ON_CHOICE = 0xFE
COLOR_CHOICE_ON_CHOICE = 0xFD
SHOT_SOURCE_PLAYER = 0
SHOT_SOURCE_ENEMY = 1
)