… | |
… | |
52 | static f_plug_api gethook; |
52 | static f_plug_api gethook; |
53 | static f_plug_api registerGlobalEvent; |
53 | static f_plug_api registerGlobalEvent; |
54 | static f_plug_api unregisterGlobalEvent; |
54 | static f_plug_api unregisterGlobalEvent; |
55 | static f_plug_api systemDirectory; |
55 | static f_plug_api systemDirectory; |
56 | static f_plug_api object_set_property; |
56 | static f_plug_api object_set_property; |
|
|
57 | static f_plug_api map_get_map; |
57 | |
58 | |
58 | typedef struct |
59 | typedef struct |
59 | { |
60 | { |
60 | object* who; |
61 | object* who; |
61 | object* activator; |
62 | object* activator; |
… | |
… | |
336 | |
337 | |
337 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
338 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
338 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
339 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
339 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
340 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
340 | object_set_property = gethook (&rtype, hooktype, "cfapi_object_set_property"); |
341 | object_set_property = gethook (&rtype, hooktype, "cfapi_object_set_property"); |
|
|
342 | map_get_map = gethook (&rtype, hooktype, "cfapi_map_get_map"); |
|
|
343 | |
341 | cf_init_plugin (gethook); |
344 | cf_init_plugin (gethook); |
342 | |
345 | |
343 | /* Pick the global events you want to monitor from this plugin */ |
346 | /* Pick the global events you want to monitor from this plugin */ |
344 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
347 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
345 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
348 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
… | |
… | |
834 | const_iv (F_CURSED) |
837 | const_iv (F_CURSED) |
835 | const_iv (F_DAMNED) |
838 | const_iv (F_DAMNED) |
836 | const_iv (F_OPEN) |
839 | const_iv (F_OPEN) |
837 | const_iv (F_NOPICK) |
840 | const_iv (F_NOPICK) |
838 | const_iv (F_LOCKED) |
841 | const_iv (F_LOCKED) |
|
|
842 | |
|
|
843 | const_iv (P_BLOCKSVIEW) |
|
|
844 | const_iv (P_NO_MAGIC) |
|
|
845 | const_iv (P_IS_ALIVE) |
|
|
846 | const_iv (P_NO_CLERIC) |
|
|
847 | const_iv (P_NEED_UPDATE) |
|
|
848 | const_iv (P_NO_ERROR) |
|
|
849 | const_iv (P_OUT_OF_MAP) |
|
|
850 | const_iv (P_NEW_MAP) |
839 | }; |
851 | }; |
840 | |
852 | |
841 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
853 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
842 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
854 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
843 | |
855 | |
… | |
… | |
1245 | break; |
1257 | break; |
1246 | default: |
1258 | default: |
1247 | croak ("unhandled type '%d' in set_property '%d'", type, idx); |
1259 | croak ("unhandled type '%d' in set_property '%d'", type, idx); |
1248 | } |
1260 | } |
1249 | |
1261 | |
|
|
1262 | mapstruct *new (int width, int height) |
|
|
1263 | PROTOTYPE: |
|
|
1264 | CODE: |
|
|
1265 | { |
|
|
1266 | int unused_type; |
|
|
1267 | RETVAL = map_get_map (&unused_type, 0, width, height); |
|
|
1268 | } |
|
|
1269 | OUTPUT: |
|
|
1270 | RETVAL |
|
|
1271 | |
1250 | mapstruct *cf_map_get_map (char *name) |
1272 | mapstruct *cf_map_get_map (char *name) |
1251 | PROTOTYPE: $ |
1273 | PROTOTYPE: $ |
1252 | ALIAS: map = 0 |
1274 | ALIAS: map = 0 |
1253 | |
1275 | |
1254 | mapstruct *cf_map_get_first () |
1276 | mapstruct *cf_map_get_first () |
… | |
… | |
1262 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
1284 | object* cf_map_present_arch_by_name (mapstruct *map, const char* str, int nx, int ny) |
1263 | C_ARGS: str, map, nx, ny |
1285 | C_ARGS: str, map, nx, ny |
1264 | |
1286 | |
1265 | #int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) |
1287 | #int cf_map_get_flags (mapstruct* map, mapstruct** nmap, I16 x, I16 y, I16 *nx, I16 *ny) |
1266 | |
1288 | |
|
|
1289 | SV *at (mapstruct *obj, unsigned int x, unsigned int y) |
|
|
1290 | PROTOTYPE: $$$ |
|
|
1291 | INIT: |
|
|
1292 | if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_UNDEF; |
|
|
1293 | PPCODE: |
|
|
1294 | { |
|
|
1295 | object *o; |
|
|
1296 | for (o = GET_MAP_OB (obj, x, y); o; o = o->above) |
|
|
1297 | XPUSHs (newSVcfapi (CFAPI_POBJECT, o)); |
|
|
1298 | } |
|
|
1299 | |
|
|
1300 | SV *bot_at (mapstruct *obj, unsigned int x, unsigned int y) |
|
|
1301 | PROTOTYPE: $$$ |
|
|
1302 | ALIAS: |
|
|
1303 | top_at = 1 |
|
|
1304 | flags_at = 2 |
|
|
1305 | light_at = 3 |
|
|
1306 | move_block_at = 4 |
|
|
1307 | move_slow_at = 5 |
|
|
1308 | move_on_at = 6 |
|
|
1309 | move_off_at = 7 |
|
|
1310 | INIT: |
|
|
1311 | if (x >= MAP_WIDTH (obj) || y >= MAP_HEIGHT (obj)) XSRETURN_UNDEF; |
|
|
1312 | CODE: |
|
|
1313 | switch (ix) |
|
|
1314 | { |
|
|
1315 | case 0: RETVAL = newSVcfapi (CFAPI_POBJECT, GET_MAP_OB (obj, x, y)); break; |
|
|
1316 | case 1: RETVAL = newSVcfapi (CFAPI_POBJECT, GET_MAP_TOP (obj, x, y)); break; |
|
|
1317 | case 2: RETVAL = newSVuv ( GET_MAP_FLAGS (obj, x, y)); break; |
|
|
1318 | case 3: RETVAL = newSViv ( GET_MAP_LIGHT (obj, x, y)); break; |
|
|
1319 | case 4: RETVAL = newSVuv ( GET_MAP_MOVE_BLOCK (obj, x, y)); break; |
|
|
1320 | case 5: RETVAL = newSVuv ( GET_MAP_MOVE_SLOW (obj, x, y)); break; |
|
|
1321 | case 6: RETVAL = newSVuv ( GET_MAP_MOVE_ON (obj, x, y)); break; |
|
|
1322 | case 7: RETVAL = newSVuv ( GET_MAP_MOVE_OFF (obj, x, y)); break; |
|
|
1323 | } |
|
|
1324 | OUTPUT: |
|
|
1325 | RETVAL |
1267 | |
1326 | |
1268 | |
1327 | |
1269 | MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ |
1328 | MODULE = cf PACKAGE = cf::arch PREFIX = cf_archetype_ |
1270 | |
1329 | |
1271 | archetype*cf_archetype_get_first() |
1330 | archetype*cf_archetype_get_first() |