// Create the appropriate GUI proxy for a given set of device info. void create_proxy(device_t *device, opt_t *opt, mainwnd_t *mainwnd, playerc_client_t *client) { switch (device->addr.interf) { case PLAYER_ACTARRAY_CODE: device->proxy = actarray_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) actarray_destroy; device->fnupdate = (fnupdate_t) actarray_update; break; case PLAYER_AIO_CODE: device->proxy = aio_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) aio_destroy; device->fnupdate = (fnupdate_t) aio_update; break; case PLAYER_BUMPER_CODE: device->proxy = bumper_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) bumper_destroy; device->fnupdate = (fnupdate_t) bumper_update; break; case PLAYER_DIO_CODE: device->proxy = dio_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) dio_destroy; device->fnupdate = (fnupdate_t) dio_update; break; case PLAYER_IR_CODE: device->proxy = ir_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) ir_destroy; device->fnupdate = (fnupdate_t) ir_update; break; case PLAYER_LASER_CODE: device->proxy = laser_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) laser_destroy; device->fnupdate = (fnupdate_t) laser_update; break; case PLAYER_POWER_CODE: device->proxy = power_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) power_destroy; device->fnupdate = (fnupdate_t) power_update; break; case PLAYER_POSITION2D_CODE: device->proxy = position2d_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) position2d_destroy; device->fnupdate = (fnupdate_t) position2d_update; break; case PLAYER_PTZ_CODE: device->proxy = ptz_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) ptz_destroy; device->fnupdate = (fnupdate_t) ptz_update; break; case PLAYER_RANGER_CODE: device->proxy = ranger_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) ranger_destroy; device->fnupdate = (fnupdate_t) ranger_update; break; case PLAYER_SONAR_CODE: device->proxy = sonar_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) sonar_destroy; device->fnupdate = (fnupdate_t) sonar_update; break; case PLAYER_WIFI_CODE: device->proxy = wifi_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) wifi_destroy; device->fnupdate = (fnupdate_t) wifi_update; break; case PLAYER_BLOBFINDER_CODE: device->proxy = blobfinder_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) blobfinder_destroy; device->fnupdate = (fnupdate_t) blobfinder_update; break; case PLAYER_CAMERA_CODE: device->proxy = camera_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) camera_destroy; device->fnupdate = (fnupdate_t) camera_update; break; case PLAYER_FIDUCIAL_CODE: device->proxy = fiducial_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) fiducial_destroy; device->fnupdate = (fnupdate_t) fiducial_update; break; case PLAYER_GRIPPER_CODE: device->proxy = gripper_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) gripper_destroy; device->fnupdate = (fnupdate_t) gripper_update; break; case PLAYER_MAP_CODE: device->proxy = map_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) map_destroy; device->fnupdate = (fnupdate_t) map_update; break; case PLAYER_VECTORMAP_CODE: device->proxy = vectormap_create(mainwnd, opt, client, device->addr.index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) vectormap_destroy; device->fnupdate = (fnupdate_t) vectormap_update; break; #if 0 case PLAYER_LOCALIZE_CODE: device->proxy = localize_create(mainwnd, opt, client, device->index, device->drivername, device->subscribe); device->fndestroy = (fndestroy_t) localize_destroy; device->fnupdate = (fnupdate_t) localize_update; break; #endif default: device->proxy = NULL; device->fndestroy = NULL; device->fnupdate = NULL; break; } return; }
/* * item_create() * Creates a new item */ item_t *item_create(int type) { item_t *item = NULL; switch(type) { case IT_RING: item = collectible_create(); break; case IT_BOUNCINGRING: item = bouncingcollectible_create(); break; case IT_LIFEBOX: item = lifebox_create(); break; case IT_RINGBOX: item = collectiblebox_create(); break; case IT_STARBOX: item = starbox_create(); break; case IT_SPEEDBOX: item = speedbox_create(); break; case IT_GLASSESBOX: item = glassesbox_create(); break; case IT_SHIELDBOX: item = shieldbox_create(); break; case IT_FIRESHIELDBOX: item = fireshieldbox_create(); break; case IT_THUNDERSHIELDBOX: item = thundershieldbox_create(); break; case IT_WATERSHIELDBOX: item = watershieldbox_create(); break; case IT_ACIDSHIELDBOX: item = acidshieldbox_create(); break; case IT_WINDSHIELDBOX: item = windshieldbox_create(); break; case IT_TRAPBOX: item = trapbox_create(); break; case IT_EMPTYBOX: item = emptybox_create(); break; case IT_CRUSHEDBOX: item = crushedbox_create(); break; case IT_ICON: item = icon_create(); break; case IT_EXPLOSION: item = explosion_create(); break; case IT_FLYINGTEXT: item = flyingtext_create(); break; case IT_ANIMAL: item = animal_create(); break; case IT_LOOPRIGHT: item = loopright_create(); break; case IT_LOOPMIDDLE: item = looptop_create(); break; case IT_LOOPLEFT: item = loopleft_create(); break; case IT_LOOPNONE: item = loopnone_create(); break; case IT_LOOPFLOOR: item = loopfloor_create(); break; case IT_LOOPFLOORNONE: item = loopfloornone_create(); break; case IT_LOOPFLOORTOP: item = loopfloortop_create(); break; case IT_YELLOWSPRING: item = yellowspring_create(); break; case IT_BYELLOWSPRING: item = byellowspring_create(); break; case IT_TRYELLOWSPRING: item = tryellowspring_create(); break; case IT_RYELLOWSPRING: item = ryellowspring_create(); break; case IT_BRYELLOWSPRING: item = bryellowspring_create(); break; case IT_BLYELLOWSPRING: item = blyellowspring_create(); break; case IT_LYELLOWSPRING: item = lyellowspring_create(); break; case IT_TLYELLOWSPRING: item = tlyellowspring_create(); break; case IT_REDSPRING: item = redspring_create(); break; case IT_BREDSPRING: item = bredspring_create(); break; case IT_TRREDSPRING: item = trredspring_create(); break; case IT_RREDSPRING: item = rredspring_create(); break; case IT_BRREDSPRING: item = brredspring_create(); break; case IT_BLREDSPRING: item = blredspring_create(); break; case IT_LREDSPRING: item = lredspring_create(); break; case IT_TLREDSPRING: item = tlredspring_create(); break; case IT_BLUESPRING: item = bluespring_create(); break; case IT_BBLUESPRING: item = bbluespring_create(); break; case IT_TRBLUESPRING: item = trbluespring_create(); break; case IT_RBLUESPRING: item = rbluespring_create(); break; case IT_BRBLUESPRING: item = brbluespring_create(); break; case IT_BLBLUESPRING: item = blbluespring_create(); break; case IT_LBLUESPRING: item = lbluespring_create(); break; case IT_TLBLUESPRING: item = tlbluespring_create(); break; case IT_BLUERING: item = supercollectible_create(); break; case IT_SWITCH: item = switch_create(); break; case IT_DOOR: item = door_create(); break; case IT_TELEPORTER: item = teleporter_create(); break; case IT_BIGRING: item = bigring_create(); break; case IT_CHECKPOINT: item = checkpointorb_create(); break; case IT_GOAL: item = goalsign_create(); break; case IT_ENDSIGN: item = endsign_create(); break; case IT_ENDLEVEL: item = animalprison_create(); break; case IT_BUMPER: item = bumper_create(); break; case IT_DANGER: item = horizontaldanger_create(); break; case IT_VDANGER: item = verticaldanger_create(); break; case IT_FIREDANGER: item = horizontalfiredanger_create(); break; case IT_VFIREDANGER: item = verticalfiredanger_create(); break; case IT_SPIKES: item = floorspikes_create(); break; case IT_CEILSPIKES: item = ceilingspikes_create(); break; case IT_LWSPIKES: item = leftwallspikes_create(); break; case IT_RWSPIKES: item = rightwallspikes_create(); break; case IT_PERSPIKES: item = periodic_floorspikes_create(); break; case IT_PERCEILSPIKES: item = periodic_ceilingspikes_create(); break; case IT_PERLWSPIKES: item = periodic_leftwallspikes_create(); break; case IT_PERRWSPIKES: item = periodic_rightwallspikes_create(); break; case IT_DNADOOR: item = surge_dnadoor_create(); break; case IT_DNADOORNEON: item = neon_dnadoor_create(); break; case IT_DNADOORCHARGE: item = charge_dnadoor_create(); break; case IT_HDNADOOR: item = surge_horizontal_dnadoor_create(); break; case IT_HDNADOORNEON: item = neon_horizontal_dnadoor_create(); break; case IT_HDNADOORCHARGE: item = charge_horizontal_dnadoor_create(); break; case IT_LOOPGREEN: item = loopgreen_create(); break; case IT_LOOPYELLOW: item = loopyellow_create(); break; } if(item != NULL) { item->type = type; item->state = IS_IDLE; item->init(item); } return item; }