-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmps.ksy
195 lines (193 loc) · 3.88 KB
/
mps.ksy
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
meta:
id: mps
title: WolfRPG MapData .mps file
application: WolfRPG
file-extension: mps
license: MIT
endian: le
imports:
- common
- route
- event_command
enums:
event_trigger_condition:
0: 'confirm_key'
1: 'autorun'
2: 'parallel_process'
3: 'player_touch'
4: 'event_touch'
types:
event_trigger_switch:
seq:
- id: operator
type: b4
enum: common::operator
- id: enabled
type: b4
valid:
any-of: [0, 1]
mappixel:
seq:
- id: raw
type: u4
instances:
autotile_id:
value: 'raw / 100000'
autotile_enabled:
value: 'autotile_id > 0'
autotile_mode_top_left:
if: autotile_enabled
value: 'raw % 10000 / 1000'
autotile_mode_top_right:
if: autotile_enabled
value: 'raw % 1000 / 100'
autotile_mode_bottom_left:
if: autotile_enabled
value: 'raw % 100 / 10'
autotile_mode_bottom_right:
if: autotile_enabled
value: 'raw % 10'
basetile:
if: autotile_enabled == false
value: raw
page:
seq:
- id: header
type: u1
valid: 0x79
- id: event_graphic_chipid
type: u4
- id: event_graphic_filename
type: common::t_str
- id: event_graphic_row_in_tileset
type: u1
- id: event_graphic_col_in_tileset
type: u1
- id: event_graphic_opacity
type: u1
- id: event_graphic_display_type
type: u1
enum: common::graphic_render_mode
- id: event_trigger_condition
type: u1
enum: event_trigger_condition
- id: event_trigger_switch
type: event_trigger_switch
repeat: expr
repeat-expr: 4
- id: event_trigger_variable
type: common::magic_number
repeat: expr
repeat-expr: 4
- id: event_trigger_value
type: s4
repeat: expr
repeat-expr: 4
- id: route_info
type: route
- id: event_command_count
type: u4
- id: event_commands
type: event_command
repeat: expr
repeat-expr: event_command_count
- id: unknown3
type: u4
valid: 3
- id: shadow_graphic_id
doc: "id refer to sysdb9"
type: u1
- id: range_extension_x
type: u1
doc: "max 250"
- id: range_extension_y
type: u1
doc: "max 250"
- id: footer
type: u1
valid: 0x7a
event:
seq:
- id: header
type: u1
valid: 0x6f
- id: header2
type: u4
valid: 0x3039
- id: event_id
type: u4
- id: title
type: common::t_str
- id: map_x
type: u4
- id: map_y
type: u4
- id: page_count
type: u4
- id: separator
type: u4
valid: 0
- id: pages
type: page
repeat: expr
repeat-expr: page_count
- id: footer
type: u1
valid: 0x70
# workaround
# map not exists if first byte of map is 0xffffffff
mapdata_block:
params:
- id: width
type: u4
- id: height
type: u4
- id: pos
type: u4
seq:
- id: first_pixel
type: u4
- id: skip
size: width*height*12 - 4
if: first_pixel != 0xffffffff
instances:
mapdata:
pos: pos
type: mappixel
repeat: expr
repeat-expr: width*height*3
seq:
- id: magic
contents: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'WOLFM', 0]
- id: version_header
type: u1
enum: common::version_header
- id: magic2
contents: [0, 0, 0]
- id: unknown1
type: u4
valid: 0x64
- id: version
type: u1
valid:
# v2, v3
any-of: [0x65, 0x66]
- id: title
type: common::t_str
- id: tileset
type: u4
- id: width
type: u4
- id: height
type: u4
- id: event_count
type: u4
- id: mapdata
type: mapdata_block(width, height, _io.pos)
- id: events
type: event
repeat: expr
repeat-expr: event_count
- id: footer
type: u1
valid: 0x66