… | |
… | |
1883 | CODE: |
1883 | CODE: |
1884 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
1884 | RETVAL = SvROK (obj) && mg_find (SvRV (obj), PERL_MAGIC_ext); |
1885 | OUTPUT: |
1885 | OUTPUT: |
1886 | RETVAL |
1886 | RETVAL |
1887 | |
1887 | |
|
|
1888 | bool should_invoke (attachable *obj, int event) |
|
|
1889 | CODE: |
|
|
1890 | RETVAL = obj->should_invoke ((event_type)event); |
|
|
1891 | OUTPUT: RETVAL |
|
|
1892 | |
1888 | void |
1893 | void |
1889 | debug_trace (attachable *obj, bool on = true) |
1894 | debug_trace (attachable *obj, bool on = true) |
1890 | CODE: |
1895 | CODE: |
1891 | obj->attachable_flags &= ~attachable::F_DEBUG_TRACE; |
1896 | obj->attachable_flags &= ~attachable::F_DEBUG_TRACE; |
1892 | if (on) |
1897 | if (on) |
… | |
… | |
2453 | if (oblinkpt *obp = map->find_link (connection)) |
2458 | if (oblinkpt *obp = map->find_link (connection)) |
2454 | for (objectlink *ol = obp->link; ol; ol = ol->next) |
2459 | for (objectlink *ol = obp->link; ol; ol = ol->next) |
2455 | XPUSHs (sv_2mortal (to_sv ((object *)ol->ob))); |
2460 | XPUSHs (sv_2mortal (to_sv ((object *)ol->ob))); |
2456 | |
2461 | |
2457 | void |
2462 | void |
2458 | get_map_flags (maptile *map, int x, int y) |
2463 | normalise (maptile *map, int x, int y, int dir = 0) |
2459 | PPCODE: |
2464 | PPCODE: |
2460 | { |
2465 | { |
2461 | maptile *nmap = 0; |
2466 | mapxy pos (map, x, y); |
2462 | I16 nx = 0, ny = 0; |
2467 | if (!pos.move (dir).normalise ()) |
|
|
2468 | XSRETURN_EMPTY; |
2463 | |
2469 | |
2464 | PUTBACK; |
|
|
2465 | int flags = get_map_flags (map, &nmap, x, y, &nx, &ny); |
|
|
2466 | SPAGAIN; |
|
|
2467 | |
|
|
2468 | EXTEND (SP, 4); |
2470 | EXTEND (SP, 3); |
2469 | PUSHs (sv_2mortal (newSViv (flags))); |
|
|
2470 | |
|
|
2471 | if (GIMME_V == G_ARRAY) |
|
|
2472 | { |
|
|
2473 | PUSHs (sv_2mortal (to_sv (nmap))); |
2471 | PUSHs (sv_2mortal (to_sv (pos.m))); |
2474 | PUSHs (sv_2mortal (newSViv (nx))); |
2472 | PUSHs (sv_2mortal (to_sv (pos.x))); |
2475 | PUSHs (sv_2mortal (newSViv (ny))); |
2473 | PUSHs (sv_2mortal (to_sv (pos.y))); |
2476 | } |
|
|
2477 | } |
2474 | } |
2478 | |
2475 | |
2479 | mapspace * |
2476 | mapspace * |
2480 | ms (maptile *map, unsigned int x, unsigned int y) |
2477 | ms (maptile *map, unsigned int x, unsigned int y, int dir = 0) |
2481 | PROTOTYPE: $$$ |
2478 | PROTOTYPE: $$$;$ |
2482 | CODE: |
2479 | CODE: |
2483 | { |
2480 | { |
2484 | maptile *nmap = 0; |
2481 | mapxy pos (map, x, y); |
2485 | I16 nx, ny; |
2482 | if (!pos.move (dir).normalise ()) |
2486 | |
|
|
2487 | PUTBACK; |
|
|
2488 | get_map_flags (map, &nmap, x, y, &nx, &ny); |
|
|
2489 | SPAGAIN; |
|
|
2490 | |
|
|
2491 | if (!nmap) |
|
|
2492 | XSRETURN_UNDEF; |
2483 | XSRETURN_UNDEF; |
2493 | |
2484 | |
2494 | RETVAL = &nmap->at (nx, ny); |
2485 | RETVAL = &*pos; |
2495 | } |
2486 | } |
2496 | OUTPUT: |
2487 | OUTPUT: |
2497 | RETVAL |
2488 | RETVAL |
2498 | |
2489 | |
2499 | void |
2490 | void |
2500 | at (maptile *map, unsigned int x, unsigned int y) |
2491 | at (maptile *map, unsigned int x, unsigned int y, int dir = 0) |
2501 | PROTOTYPE: $$$ |
2492 | PROTOTYPE: $$$;$ |
2502 | PPCODE: |
2493 | PPCODE: |
2503 | { |
2494 | mapxy pos (map, x, y); |
2504 | maptile *nmap = 0; |
2495 | if (pos.move (dir).normalise ()) |
2505 | I16 nx, ny; |
|
|
2506 | |
|
|
2507 | PUTBACK; |
|
|
2508 | get_map_flags (map, &nmap, x, y, &nx, &ny); |
|
|
2509 | SPAGAIN; |
|
|
2510 | |
|
|
2511 | if (nmap) |
|
|
2512 | for (object *o = nmap->at (nx, ny).bot; o; o = o->above) |
2496 | for (object *o = pos->bot; o; o = o->above) |
2513 | XPUSHs (sv_2mortal (to_sv (o))); |
2497 | XPUSHs (sv_2mortal (to_sv (o))); |
2514 | } |
|
|
2515 | |
2498 | |
2516 | SV * |
2499 | SV * |
2517 | bot_at (maptile *map, unsigned int x, unsigned int y) |
2500 | bot_at (maptile *map, unsigned int x, unsigned int y, int dir = 0) |
2518 | PROTOTYPE: $$$ |
2501 | PROTOTYPE: $$$;$ |
2519 | ALIAS: |
2502 | ALIAS: |
2520 | top_at = 1 |
2503 | top_at = 1 |
2521 | flags_at = 2 |
2504 | flags_at = 2 |
2522 | light_at = 3 |
2505 | light_at = 3 |
2523 | move_block_at = 4 |
2506 | move_block_at = 4 |
2524 | move_slow_at = 5 |
2507 | move_slow_at = 5 |
2525 | move_on_at = 6 |
2508 | move_on_at = 6 |
2526 | move_off_at = 7 |
2509 | move_off_at = 7 |
2527 | CODE: |
2510 | CODE: |
2528 | { |
2511 | { |
2529 | sint16 nx = x; |
2512 | mapxy pos (map, x, y); |
2530 | sint16 ny = y; |
2513 | if (!pos.move (dir).normalise ()) |
2531 | |
|
|
2532 | if (!xy_normalise (map, nx, ny)) |
|
|
2533 | XSRETURN_UNDEF; |
2514 | XSRETURN_UNDEF; |
2534 | |
2515 | |
2535 | mapspace &ms = map->at (nx, ny); |
2516 | mapspace &ms = *pos; |
2536 | |
2517 | |
2537 | ms.update (); |
2518 | ms.update (); |
2538 | |
2519 | |
2539 | switch (ix) |
2520 | switch (ix) |
2540 | { |
2521 | { |