int daEnFlipBlock_c::onCreate() { allocator.link(-1, GameHeaps[0], 0, 0x20); resFile.data = getResource("block_rotate", "g3d/block_rotate.brres"); model.setup(resFile.GetResMdl("block_rotate"), &allocator, 0, 1, 0); SetupTextures_MapObj(&model, 0); allocator.unlink(); blockInit(pos.y); physicsInfo.x1 = -8; physicsInfo.y1 = 8; physicsInfo.x2 = 8; physicsInfo.y2 = -8; physicsInfo.otherCallback1 = &daEnBlockMain_c::OPhysicsCallback1; physicsInfo.otherCallback2 = &daEnBlockMain_c::OPhysicsCallback2; physicsInfo.otherCallback3 = &daEnBlockMain_c::OPhysicsCallback3; physics.setup(this, &physicsInfo, 3, currentLayerID); physics.flagsMaybe = 0x260; physics.callback1 = &daEnBlockMain_c::PhysicsCallback1; physics.callback2 = &daEnBlockMain_c::PhysicsCallback2; physics.callback3 = &daEnBlockMain_c::PhysicsCallback3; physics.addToList(); doStateChange(&daEnFlipBlock_c::StateID_Wait); return true; }
/* ===================================================== = General FTC / Robot functions ===================================================== */ void initializeRobot(){ bDisplayDiagnostics = false; bFloatDuringInactiveMotorPWM = false; blockInit(); bucketInit(); servo[servoFlagAdjust] = 127; return; }
void blockInitWithKind(block* b, block_kind k) { blockInit(b, 4, (block_type)k); if (k >= kind_end) blockFree(b); else { for (uint16_t i = 0; i < 4; ++i) b->pos[i] = blocks[(uint16_t)k][i]; } }
void A2dpInit(Task clientTask, uint16 role, service_record_type *service_records, uint16 size_seps, sep_data_type *seps, uint16 linkloss_timeout) { /* Initialise the task data */ if ( !a2dp ) { uint8 device_id; a2dp = PanicUnlessNew(A2DP); memset( a2dp, 0, sizeof(A2DP) ); for (device_id=0; device_id<A2DP_MAX_REMOTE_DEVICES_DEFAULT; device_id++) { a2dpInitialiseRemoteDevice(&a2dp->remote_conn[device_id],device_id); } PRINT(("sizeof(A2DP)=0x%u\n", sizeof(A2DP))); /* Set the handler function */ a2dp->task.handler = a2dpProfileHandler; /* Set up the lib client */ a2dp->clientTask = clientTask; a2dp->linkloss_timeout = linkloss_timeout; a2dp->max_remote_devs = A2DP_MAX_REMOTE_DEVICES_DEFAULT; a2dp->profile_role = role; blockInit(); if ( seps && size_seps && validateSeps(seps, size_seps) ) { for (device_id=0; device_id<A2DP_MAX_REMOTE_DEVICES; device_id++) { sep_data_type *sep_list = (sep_data_type *)PanicNull( blockAdd( device_id, data_block_sep_list, size_seps, sizeof(sep_data_type) ) ); memmove( sep_list, (sep_data_type *)seps, size_seps*sizeof(sep_data_type) ); } } else { a2dpSendInitCfmToClient(a2dp_invalid_parameters); return; } /* Used to count the number of SDP records registered. Decremented again by a2dpHandleSdpRegisterCfm() and will kick off a call to a2dpRegisterL2cap() when it hits zero - i.e. all CFM messages for SDP regsitering process have been received. */ a2dp->sdp_register_outstanding = 0; if (service_records) { if (service_records->size_service_record_a && service_records->service_record_a) { /* Client has supplied their own record so register it without checking */ ConnectionRegisterServiceRecord(&a2dp->task, service_records->size_service_record_a, service_records->service_record_a); a2dp->sdp_register_outstanding++; } if (service_records->size_service_record_b && service_records->service_record_b) { /* Client has supplied their own record so register it without checking */ ConnectionRegisterServiceRecord(&a2dp->task, service_records->size_service_record_b, service_records->service_record_b); a2dp->sdp_register_outstanding++; } } else { /* Client using default library record */ if (role & A2DP_INIT_ROLE_SINK) { ConnectionRegisterServiceRecord(&a2dp->task, sizeof(a2dp_sink_service_record), a2dp_sink_service_record); PRINT(("Register Sink Service Rec\n")); a2dp->sdp_register_outstanding++; } if (role & A2DP_INIT_ROLE_SOURCE) { ConnectionRegisterServiceRecord(&a2dp->task, sizeof(a2dp_source_service_record), a2dp_source_service_record); PRINT(("Register Source Service Rec\n")); a2dp->sdp_register_outstanding++; } } if ( a2dp->sdp_register_outstanding==0 ) { /* Skip the service record registering if the user doesn't require any at this point. */ a2dpRegisterL2cap(); } } }