diff -r -u -N lure.orig/anim.h lure/anim.h
old
|
new
|
|
8 | 8 | |
9 | 9 | namespace Lure { |
10 | 10 | |
11 | | #pragma pack(1) |
| 11 | #pragma START_PACK_STRUCTS |
12 | 12 | |
13 | 13 | struct AnimationResource { |
14 | 14 | uint16 diskId; |
… |
… |
|
27 | 27 | uint32 unknown4; |
28 | 28 | uint16 unknown5; |
29 | 29 | uint8 colourOffset; |
30 | | }; |
| 30 | } GCC_PACK; |
31 | 31 | |
32 | | #pragma pack() |
| 32 | #pragma END_PACK_STRUCTS |
33 | 33 | |
34 | 34 | class Animation { |
35 | 35 | private: |
diff -r -u -N lure.orig/decode.cpp lure/decode.cpp
old
|
new
|
|
144 | 144 | carry = result; |
145 | 145 | } |
146 | 146 | |
147 | | #define GET_BYTE ax.l = *pSrc++ |
| 147 | #define GET_BYTE ax.s.l = *pSrc++ |
148 | 148 | #define BX_VAL(x) *((byte *) (dest->data() + bx.v + x)) |
149 | 149 | |
150 | 150 | void AnimationDecoder::decode_data_2(byte *&pSrc, Register &ax, Register &cx, |
151 | 151 | Register &dx, bool &carry) { |
152 | | dx.h = ax.h; |
| 152 | dx.s.h = ax.s.h; |
153 | 153 | |
154 | 154 | for (int v = 0; v < 8; ++v) { |
155 | 155 | rcl(ax, carry); |
156 | 156 | if (--cx.v == 0) { |
157 | 157 | GET_BYTE; |
158 | | cx.l = 8; |
| 158 | cx.s.l = 8; |
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
… |
… |
|
172 | 172 | for (int numBytes = 0; numBytes < 16; ++numBytes, ++pDest) { |
173 | 173 | // Split up next byte to pDest and pDest+0x10 |
174 | 174 | GET_BYTE; |
175 | | *(pDest + 0x10) = ax.l & 0xf; |
176 | | *pDest = ax.l >> 4; |
| 175 | *(pDest + 0x10) = ax.s.l & 0xf; |
| 176 | *pDest = ax.s.l >> 4; |
177 | 177 | |
178 | 178 | // Split up next byte to pDest+0x20 and pDest+0x30 |
179 | 179 | GET_BYTE; |
180 | | *(pDest + 0x30) = ax.l & 0x0f; |
181 | | *(pDest + 0x20) = ax.l >> 4; |
| 180 | *(pDest + 0x30) = ax.s.l & 0x0f; |
| 181 | *(pDest + 0x20) = ax.s.l >> 4; |
182 | 182 | } |
183 | 183 | |
184 | 184 | pDest = (byte *) (dest->data() + 0x40); |
185 | 185 | GET_BYTE; |
186 | | ax.h = ax.l; |
| 186 | ax.s.h = ax.s.l; |
187 | 187 | GET_BYTE; |
188 | 188 | cx.v = 4; |
189 | | *pDest = ax.h & 0xf0; |
190 | | bx.v = ax.h >> 4; |
| 189 | *pDest = ax.s.h & 0xf0; |
| 190 | bx.v = ax.s.h >> 4; |
191 | 191 | ax.v <<= 4; |
192 | 192 | dx.v = 1; |
193 | 193 | |
… |
… |
|
203 | 203 | rcl(ax, carry); |
204 | 204 | if (--cx.v == 0) { |
205 | 205 | GET_BYTE; |
206 | | cx.l = 8; |
| 206 | cx.s.l = 8; |
207 | 207 | } |
208 | 208 | if (carry) goto loc_1441; |
209 | | bx.l = BX_VAL(0); |
| 209 | bx.s.l = BX_VAL(0); |
210 | 210 | |
211 | 211 | loc_1439: |
212 | | dx.l ^= 1; |
213 | | if ((dx.l & 1) != 0) { |
214 | | dx.h = bx.l << 4; |
215 | | *pDest = dx.h; |
| 212 | dx.s.l ^= 1; |
| 213 | if ((dx.s.l & 1) != 0) { |
| 214 | dx.s.h = bx.s.l << 4; |
| 215 | *pDest = dx.s.h; |
216 | 216 | } else { |
217 | | *pDest++ |= bx.l; |
| 217 | *pDest++ |= bx.s.l; |
218 | 218 | } |
219 | 219 | continue; |
220 | 220 | |
… |
… |
|
222 | 222 | rcl(ax, carry); |
223 | 223 | if (--cx.v == 0) { |
224 | 224 | GET_BYTE; |
225 | | cx.l = 8; |
| 225 | cx.s.l = 8; |
226 | 226 | } |
227 | 227 | if (!carry) { |
228 | 228 | rcl(ax, carry); |
229 | 229 | if (--cx.v == 0) { |
230 | 230 | GET_BYTE; |
231 | | cx.l = 8; |
| 231 | cx.s.l = 8; |
232 | 232 | } |
233 | 233 | |
234 | 234 | if (!carry) { |
235 | | bx.l = BX_VAL(0x10); |
| 235 | bx.s.l = BX_VAL(0x10); |
236 | 236 | } else { |
237 | | bx.l = BX_VAL(0x20); |
| 237 | bx.s.l = BX_VAL(0x20); |
238 | 238 | } |
239 | 239 | goto loc_1439; |
240 | 240 | } |
… |
… |
|
243 | 243 | rcl(ax, carry); |
244 | 244 | if (--cx.v == 0) { |
245 | 245 | GET_BYTE; |
246 | | cx.l = 8; |
| 246 | cx.s.l = 8; |
247 | 247 | } |
248 | 248 | if (!carry) { |
249 | | bx.l = BX_VAL(0x30); |
| 249 | bx.s.l = BX_VAL(0x30); |
250 | 250 | goto loc_1439; |
251 | 251 | } |
252 | 252 | |
253 | | dx.h = ax.h >> 4; |
| 253 | dx.s.h = ax.s.h >> 4; |
254 | 254 | for (int ctr = 0; ctr < 4; ++ctr) { |
255 | 255 | rcl(ax, carry); |
256 | 256 | if (--cx.v == 0) { |
257 | 257 | GET_BYTE; |
258 | | cx.l = 8; |
| 258 | cx.s.l = 8; |
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | | if (dx.h == BX_VAL(0)) { |
| 262 | if (dx.s.h == BX_VAL(0)) { |
263 | 263 | tempReg1 = cx; |
264 | 264 | tempReg2 = dx; |
265 | 265 | decode_data_2(pSrc, ax, cx, dx, carry); |
266 | 266 | |
267 | | dx.l = dx.h; |
| 267 | dx.s.l = dx.s.h; |
268 | 268 | decode_data_2(pSrc, ax, cx, dx, carry); |
269 | | cx.h = dx.l; |
270 | | cx.l = dx.h; |
| 269 | cx.s.h = dx.s.l; |
| 270 | cx.s.l = dx.s.h; |
271 | 271 | dx = tempReg2; |
272 | 272 | |
273 | 273 | if (cx.v == 0) |
274 | 274 | // Exit out of infinite loop |
275 | 275 | break; |
276 | 276 | |
277 | | } else if (dx.h == BX_VAL(0x10)) { |
| 277 | } else if (dx.s.h == BX_VAL(0x10)) { |
278 | 278 | tempReg1 = cx; |
279 | 279 | decode_data_2(pSrc, ax, cx, dx, carry); |
280 | | cx.v = dx.h; |
| 280 | cx.v = dx.s.h; |
281 | 281 | |
282 | | } else if (dx.h == BX_VAL(0x20)) { |
283 | | dx.h = ax.h >> 2; |
| 282 | } else if (dx.s.h == BX_VAL(0x20)) { |
| 283 | dx.s.h = ax.s.h >> 2; |
284 | 284 | |
285 | 285 | for (v = 0; v < 6; ++v) { |
286 | 286 | rcl(ax, carry); |
287 | 287 | if (--cx.v == 0) { |
288 | 288 | GET_BYTE; |
289 | | cx.l = 8; |
| 289 | cx.s.l = 8; |
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
293 | 293 | tempReg1 = cx; |
294 | | cx.v = dx.h; |
| 294 | cx.v = dx.s.h; |
295 | 295 | |
296 | | } else if (dx.h == BX_VAL(0x30)) { |
297 | | dx.h = ax.h >> 3; |
| 296 | } else if (dx.s.h == BX_VAL(0x30)) { |
| 297 | dx.s.h = ax.s.h >> 3; |
298 | 298 | |
299 | 299 | for (v = 0; v < 5; ++v) { |
300 | 300 | rcl(ax, carry); |
301 | 301 | if (--cx.v == 0) { |
302 | 302 | GET_BYTE; |
303 | | cx.l = 8; |
| 303 | cx.s.l = 8; |
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | 307 | tempReg1 = cx; |
308 | | cx.v = dx.h; |
| 308 | cx.v = dx.s.h; |
309 | 309 | |
310 | 310 | } else { |
311 | | bx.l = dx.h; |
| 311 | bx.s.l = dx.s.h; |
312 | 312 | goto loc_1439; |
313 | 313 | } |
314 | 314 | |
315 | | if ((dx.l & 1) == 1) { |
316 | | *pDest++ |= bx.l; |
| 315 | if ((dx.s.l & 1) == 1) { |
| 316 | *pDest++ |= bx.s.l; |
317 | 317 | --cx.v; |
318 | | dx.l &= 0xfe; |
| 318 | dx.s.l &= 0xfe; |
319 | 319 | } |
320 | 320 | |
321 | | dx.h = bx.l << 4; |
322 | | bx.l |= dx.h; |
| 321 | dx.s.h = bx.s.l << 4; |
| 322 | bx.s.l |= dx.s.h; |
323 | 323 | |
324 | 324 | v = cx.v >> 1; |
325 | | while (v-- > 0) *pDest++ = bx.l; |
| 325 | while (v-- > 0) *pDest++ = bx.s.l; |
326 | 326 | |
327 | 327 | cx.v &= 1; |
328 | 328 | if (cx.v != 0) { |
329 | | *pDest = bx.l & 0xf0; |
330 | | dx.l |= 1; |
| 329 | *pDest = bx.s.l & 0xf0; |
| 330 | dx.s.l |= 1; |
331 | 331 | } |
332 | 332 | |
333 | 333 | cx = tempReg1; |
334 | | bx.l &= 0x0f; |
| 334 | bx.s.l &= 0x0f; |
335 | 335 | } |
336 | 336 | |
337 | 337 | // Return number of bytes written |
diff -r -u -N lure.orig/decode.h lure/decode.h
old
|
new
|
|
8 | 8 | |
9 | 9 | namespace Lure { |
10 | 10 | |
11 | | #pragma pack(1) |
| 11 | #pragma START_PACK_STRUCTS |
12 | 12 | |
13 | 13 | union Register_Union { |
14 | 14 | union { |
… |
… |
|
16 | 16 | struct { |
17 | 17 | uint8 l; |
18 | 18 | uint8 h; |
19 | | }; |
| 19 | } GCC_PACK s; |
20 | 20 | }; |
21 | | }; |
| 21 | } GCC_PACK; |
22 | 22 | |
23 | | #pragma pack() |
| 23 | #pragma END_PACK_STRUCTS |
24 | 24 | |
25 | 25 | typedef union Register_Union Register; |
26 | 26 | |
diff -r -u -N lure.orig/disk.h lure/disk.h
old
|
new
|
|
17 | 17 | #define HEADER_IDENT_STRING "heywow" |
18 | 18 | #define HEADER_ENTRY_UNUSED_ID 0xffff |
19 | 19 | |
20 | | #pragma pack(1) |
| 20 | #pragma START_PACK_STRUCTS |
21 | 21 | |
22 | 22 | struct FileEntry { |
23 | 23 | uint16 id; |
… |
… |
|
25 | 25 | byte sizeExtension; |
26 | 26 | uint16 size; |
27 | 27 | uint16 offset; |
28 | | }; |
| 28 | } GCC_PACK; |
29 | 29 | |
30 | | #pragma pack() |
| 30 | #pragma END_PACK_STRUCTS |
31 | 31 | |
32 | 32 | class Disk { |
33 | 33 | private: |
diff -r -u -N lure.orig/game.cpp lure/game.cpp
old
|
new
|
|
51 | 51 | |
52 | 52 | if (events.pollEvent()) { |
53 | 53 | if (events.type() == OSystem::EVENT_KEYDOWN) { |
54 | | Room &r = Room::getReference(); |
55 | 54 | uint8 roomNum = r.roomNumber(); |
56 | 55 | |
57 | 56 | #ifdef LURE_DEBUG |
diff -r -u -N lure.orig/lure.cpp lure/lure.cpp
old
|
new
|
|
28 | 28 | kMD5FileSizeLimit = 1024 * 1024 |
29 | 29 | }; |
30 | 30 | |
31 | | #pragma pack(1) |
| 31 | #pragma START_PACK_STRUCTS |
32 | 32 | |
33 | 33 | struct VersionStructure { |
34 | 34 | uint16 id; |
35 | 35 | byte vMajor; |
36 | 36 | byte vMinor; |
37 | | }; |
| 37 | } GCC_PACK; |
38 | 38 | |
39 | | #pragma pack() |
| 39 | #pragma END_PACK_STRUCTS |
40 | 40 | |
41 | 41 | struct LureGameSettings { |
42 | 42 | const char *name; |
… |
… |
|
236 | 236 | _system->endGFXTransaction(); |
237 | 237 | |
238 | 238 | // for now we prefer MIDI-to-Adlib conversion over native midi |
239 | | int midiDrv = MidiDriver::detectMusicDriver(MDT_NATIVE | MDT_ADLIB/* | MDT_PREFER_NATIVE*/); |
| 239 | int midiDrv = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB/* | MDT_PREFER_MIDI*/); |
240 | 240 | bool native_mt32 = (ConfMan.getBool("native_mt32") || (midiDrv == MD_MT32)); |
241 | 241 | |
242 | 242 | MidiDriver *driver = MidiDriver::createMidi(midiDrv); |
diff -r -u -N lure.orig/module.mk lure/module.mk
old
|
new
|
|
| 1 | MODULE := lure |
| 2 | |
| 3 | MODULE_OBJS := \ |
| 4 | lure/anim.o \ |
| 5 | lure/animseq.o \ |
| 6 | lure/decode.o \ |
| 7 | lure/disk.o \ |
| 8 | lure/events.o \ |
| 9 | lure/game.o \ |
| 10 | lure/intro.o \ |
| 11 | lure/lure.o \ |
| 12 | lure/memory.o \ |
| 13 | lure/menu.o \ |
| 14 | lure/palette.o \ |
| 15 | lure/res.o \ |
| 16 | lure/room.o \ |
| 17 | lure/screen.o \ |
| 18 | lure/strings.o \ |
| 19 | lure/surface.o \ |
| 20 | lure/system.o \ |
| 21 | lure/debug/input.o |
| 22 | |
| 23 | MODULE_DIRS += \ |
| 24 | lure |
| 25 | |
| 26 | # This module can be built as a plugin |
| 27 | ifdef BUILD_PLUGINS |
| 28 | PLUGIN := 1 |
| 29 | endif |
| 30 | |
| 31 | # Include common rules |
| 32 | include $(srcdir)/common.rules |
diff -r -u -N lure.orig/room.cpp lure/room.cpp
old
|
new
|
|
276 | 276 | while ((res->hotspotId != 0xffff) && (res->hotspotId != rec->hotspotId)) |
277 | 277 | ++res; |
278 | 278 | |
279 | | itoa(rec->hotspotId, s, 16); |
| 279 | sprintf(s, "%x", rec->hotspotId); |
280 | 280 | s += strlen(s); |
281 | 281 | |
282 | 282 | if (res->hotspotId == 0xffff) |
… |
… |
|
306 | 306 | delete surface; |
307 | 307 | } |
308 | 308 | |
309 | | } // end of namespace Lure |
310 | | No newline at end of file |
| 309 | } // end of namespace Lure |
diff -r -u -N lure.orig/surface.cpp lure/surface.cpp
old
|
new
|
|
117 | 117 | |
118 | 118 | byte *pSrc = _data->data(); |
119 | 119 | byte *pDest = dest->data().data(); |
120 | | uint16 numBytes = min(_height,dest->height()) * FULL_SCREEN_WIDTH; |
| 120 | uint16 numBytes = MIN(_height,dest->height()) * FULL_SCREEN_WIDTH; |
121 | 121 | |
122 | 122 | while (numBytes-- > 0) { |
123 | 123 | if (*pSrc) *pDest = *pSrc; |