306 | 306 |
st off, c
|
307 | 307 |
} else {
|
308 | 308 |
st on, c
|
309 | |
trash n
|
310 | |
trash a
|
311 | |
trash z
|
|
309 |
}
|
|
310 |
|
|
311 |
// FIXME these trashes, strictly speaking, probably shouldn't be needed,
|
|
312 |
// but currently the compiler cares a little too much about values that are
|
|
313 |
// initialized in one branch of an `if`, but not the other, but are trashed
|
|
314 |
// at the end of the routine anyway.
|
|
315 |
trash ptr
|
|
316 |
trash y
|
|
317 |
trash v
|
|
318 |
} else {
|
|
319 |
st off, c
|
|
320 |
}
|
|
321 |
}
|
|
322 |
|
|
323 |
define enemy_logic logic_routine
|
|
324 |
{
|
|
325 |
call calculate_new_position
|
|
326 |
call check_new_position_in_bounds
|
|
327 |
|
|
328 |
if c {
|
|
329 |
copy ^screen, ptr
|
|
330 |
st off, c
|
|
331 |
add ptr, new_pos
|
|
332 |
ld y, 0
|
|
333 |
|
|
334 |
// check collision.
|
|
335 |
ld a, [ptr] + y
|
|
336 |
// if "collision" is with your own self, treat it as if it's blank space!
|
|
337 |
cmp a, 82
|
|
338 |
if z {
|
|
339 |
ld a, 32
|
|
340 |
}
|
|
341 |
cmp a, 32
|
|
342 |
if z {
|
|
343 |
copy ^screen, ptr
|
|
344 |
st off, c
|
|
345 |
add ptr, pos
|
|
346 |
copy 32, [ptr] + y
|
|
347 |
|
|
348 |
copy new_pos, pos
|
|
349 |
|
|
350 |
copy ^screen, ptr
|
|
351 |
st off, c
|
|
352 |
add ptr, pos
|
|
353 |
copy 82, [ptr] + y
|
|
354 |
|
|
355 |
st off, c
|
|
356 |
} else {
|
|
357 |
st on, c
|
312 | 358 |
}
|
313 | 359 |
|
314 | 360 |
// FIXME these trashes, strictly speaking, probably shouldn't be needed,
|
|
317 | 363 |
// at the end of the routine anyway.
|
318 | 364 |
trash ptr
|
319 | 365 |
trash y
|
320 | |
trash a
|
321 | |
trash v
|
322 | |
} else {
|
323 | |
st off, c
|
324 | |
}
|
325 | |
}
|
326 | |
|
327 | |
define enemy_logic logic_routine
|
328 | |
{
|
329 | |
call calculate_new_position
|
330 | |
call check_new_position_in_bounds
|
331 | |
|
332 | |
if c {
|
333 | |
copy ^screen, ptr
|
334 | |
st off, c
|
335 | |
add ptr, new_pos
|
336 | |
ld y, 0
|
337 | |
|
338 | |
// check collision.
|
339 | |
ld a, [ptr] + y
|
340 | |
// if "collision" is with your own self, treat it as if it's blank space!
|
341 | |
cmp a, 82
|
342 | |
if z {
|
343 | |
ld a, 32
|
344 | |
}
|
345 | |
cmp a, 32
|
346 | |
if z {
|
347 | |
copy ^screen, ptr
|
348 | |
st off, c
|
349 | |
add ptr, pos
|
350 | |
copy 32, [ptr] + y
|
351 | |
|
352 | |
copy new_pos, pos
|
353 | |
|
354 | |
copy ^screen, ptr
|
355 | |
st off, c
|
356 | |
add ptr, pos
|
357 | |
copy 82, [ptr] + y
|
358 | |
|
359 | |
st off, c
|
360 | |
} else {
|
361 | |
st on, c
|
362 | |
trash n
|
363 | |
trash a
|
364 | |
trash z
|
365 | |
}
|
366 | |
|
367 | |
// FIXME these trashes, strictly speaking, probably shouldn't be needed,
|
368 | |
// but currently the compiler cares too much about values that are
|
369 | |
// initialized in one branch of an `if`, but not the other, but trashed
|
370 | |
// at the end of the routine anyway.
|
371 | |
trash ptr
|
372 | |
trash y
|
373 | |
trash a
|
374 | 366 |
} else {
|
375 | 367 |
copy delta, compare_target
|
376 | 368 |
st on, c
|
|
411 | 403 |
call clear_screen
|
412 | 404 |
call init_game
|
413 | 405 |
copy forward game_state_play, dispatch_game_state
|
414 | |
|
415 | |
// FIXME these trashes, strictly speaking, probably shouldn't be needed,
|
416 | |
// but currently the compiler cares too much about values that are
|
417 | |
// initialized in one branch of an `if`, but not the other, but trashed
|
418 | |
// at the end of the routine anyway.
|
419 | |
trash a
|
420 | |
trash n
|
421 | |
trash z
|
422 | |
} else {
|
423 | |
trash y
|
424 | |
trash c
|
425 | |
trash v
|
426 | 406 |
}
|
427 | 407 |
|
428 | 408 |
goto save_cinv
|
|
447 | 427 |
ld x, 15
|
448 | 428 |
} else {
|
449 | 429 |
ld x, save_x
|
450 | |
trash c
|
451 | 430 |
}
|
452 | 431 |
|
453 | 432 |
copy pos, actor_pos + x
|
|
469 | 448 |
call clear_screen
|
470 | 449 |
call init_game
|
471 | 450 |
copy game_state_title_screen, dispatch_game_state
|
472 | |
|
473 | |
// FIXME these trashes, strictly speaking, probably shouldn't be needed,
|
474 | |
// but currently the compiler cares too much about values that are
|
475 | |
// initialized in one branch of an `if`, but not the other, but trashed
|
476 | |
// at the end of the routine anyway.
|
477 | |
trash a
|
478 | |
trash n
|
479 | |
trash z
|
480 | |
} else {
|
481 | |
trash y
|
482 | |
trash c
|
483 | |
trash v
|
484 | 451 |
}
|
485 | 452 |
|
486 | 453 |
goto save_cinv
|