void CocoImage::getSector(uint8_t side, uint16_t track, uint16_t sector, char *data) { uint32_t pos = findSector(side, track, sector); image.seek(pos); if (image.readBytes(data, sector_size) != sector_size) { Serial.println("Failed to read from image"); } };
void SkOpAngle::setSector() { SkPath::Verb verb = fSegment->verb(); if (SkPath::kLine_Verb != verb && small()) { fSectorStart = fSectorEnd = -1; fSectorMask = 0; fComputeSector = true; // can't determine sector until segment length can be found return; } fSectorStart = findSector(verb, fSweep[0].fX, fSweep[0].fY); if (!fIsCurve) { // if it's a line or line-like, note that both sectors are the same SkASSERT(fSectorStart >= 0); fSectorEnd = fSectorStart; fSectorMask = 1 << fSectorStart; return; } SkASSERT(SkPath::kLine_Verb != verb); fSectorEnd = findSector(verb, fSweep[1].fX, fSweep[1].fY); if (fSectorEnd == fSectorStart) { SkASSERT((fSectorStart & 3) != 3); // if the sector has no span, it can't be an exact angle fSectorMask = 1 << fSectorStart; return; } bool crossesZero = checkCrossesZero(); int start = SkTMin(fSectorStart, fSectorEnd); bool curveBendsCCW = (fSectorStart == start) ^ crossesZero; // bump the start and end of the sector span if they are on exact compass points if ((fSectorStart & 3) == 3) { fSectorStart = (fSectorStart + (curveBendsCCW ? 1 : 31)) & 0x1f; } if ((fSectorEnd & 3) == 3) { fSectorEnd = (fSectorEnd + (curveBendsCCW ? 31 : 1)) & 0x1f; } crossesZero = checkCrossesZero(); start = SkTMin(fSectorStart, fSectorEnd); int end = SkTMax(fSectorStart, fSectorEnd); if (!crossesZero) { fSectorMask = (unsigned) -1 >> (31 - end + start) << start; } else {
void AJettisonedGameMode::createSector(UWorld* world, FVector2D index){ FRotator rotation = FRotator(0,0,0); FVector2D location = FVector2D(index.X * 30000, index.Y * 30000); TActorIterator<AGalaxySector> existingSector = findSector(index.X, index.Y); AGalaxySector* sector; //findSector(index.X, index.Y, sector); if (existingSector){ GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Green, FString(TEXT("Found a sectorX: ")) + FString::SanitizeFloat(index.X) + FString(TEXT(" Y: ")) + FString::SanitizeFloat(index.Y)); } if (GetWorld() && !existingSector){ sector = SpawnBP<AGalaxySector>(world, deepSpaceBP, location, rotation); if (!sector){ GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Green, FString(TEXT("Sector creation failed! X: ")) + FString::SanitizeFloat(index.X) + FString(TEXT(" Y: ")) + FString::SanitizeFloat(index.Y)); return; } else{ GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Green, FString(TEXT("Sector creation successful!! X: ")) + FString::SanitizeFloat(index.X) + FString(TEXT(" Y: ")) + FString::SanitizeFloat(index.Y)); } sector->setIndex(index); } }
boolean CocoImage::putSector(uint8_t side, uint16_t track, uint16_t sector, char *data) { image.seek(findSector(side, track, sector)); image.write((uint8_t *)data, sector_size); return false; }