121
123
pixel_row_center = size_in_pixels.width / 2;
122
124
pixel_row_height = gui_row_height;
123
125
pixel_row_start = gui_row_start; // first position down the page...
126
128
pixel_text_size = NSMakeSize(pixel_row_height, pixel_row_height);
642
- (NSArray *) getLastLines; // text, colour, fade time - text, colour, fade time
644
if (n_rows <1) return nil;
646
// we have at least 1 row!
648
unsigned i = n_rows-1;
649
OORGBAComponents col = [(OOColor *)[rowColor objectAtIndex:i] rgbaComponents];
653
// we have at least 2 rows!
654
OORGBAComponents col0 = [(OOColor *)[rowColor objectAtIndex:i-1] rgbaComponents];
655
return [NSArray arrayWithObjects:[rowText oo_stringAtIndex:i-1],
656
[NSString stringWithFormat:@"%.3g %.3g %.3g %.3g", col0.r, col0.g, col0.b, col0.a],
657
[NSNumber numberWithFloat:rowFadeTime[i-1]],
658
[rowText oo_stringAtIndex:i],
659
[NSString stringWithFormat:@"%.3g %.3g %.3g %.3g", col.r, col.g, col.b, col.a],
660
[NSNumber numberWithFloat:rowFadeTime[i]], nil];
664
return [NSArray arrayWithObjects:[rowText oo_stringAtIndex:i],
665
[NSString stringWithFormat:@"%.3g %.3g %.3g %.3g", col.r, col.g, col.b, col.a],
666
[NSNumber numberWithFloat:rowFadeTime[i]], nil];
634
671
- (void) printLongText:(NSString *)str
635
672
align:(OOGUIAlignment) alignment
636
673
color:(OOColor *)text_color
1402
1444
// Cache nearby systems so that [UNIVERSE generateSystemData:] does not get called on every frame
1403
1445
// Caching code submitted by Y A J, 20091022
1404
1447
static Random_Seed saved_galaxy_seed;
1405
1448
static NSPoint saved_galaxy_coordinates;
1406
1449
static struct saved_system
1411
1454
} nearby_systems[ 256 ];
1412
1455
static int num_nearby_systems;
1414
if( !equal_seeds( [player galaxy_seed], saved_galaxy_seed ) ||
1457
if ( _refreshStarChart || !equal_seeds( [player galaxy_seed], saved_galaxy_seed ) ||
1415
1458
galaxy_coordinates.x != saved_galaxy_coordinates.x ||
1416
1459
galaxy_coordinates.y != saved_galaxy_coordinates.y )
1418
1461
// saved systems are stale; recompute
1462
_refreshStarChart = NO;
1419
1463
for (i = 0; i < num_nearby_systems; i++)
1420
1464
[nearby_systems[ i ].p_name release];
1432
1476
if ((dx < 20)&&(dy < 38))
1434
1478
NSDictionary* sys_info = [UNIVERSE generateSystemData:g_seed];
1479
if (EXPECT_NOT([sys_info oo_boolForKey:@"sun_gone_nova"]))
1481
nearby_systems[ num_nearby_systems ].gov = -1; // Flag up nova systems!
1485
nearby_systems[ num_nearby_systems ].tec = [sys_info oo_intForKey:KEY_TECHLEVEL];
1486
nearby_systems[ num_nearby_systems ].eco = [sys_info oo_intForKey:KEY_ECONOMY];
1487
nearby_systems[ num_nearby_systems ].gov = [sys_info oo_intForKey:KEY_GOVERNMENT];
1435
1489
nearby_systems[ num_nearby_systems ].seed_d = g_seed.d;
1436
1490
nearby_systems[ num_nearby_systems ].seed_b = g_seed.b;
1437
nearby_systems[ num_nearby_systems ].tec = [sys_info oo_intForKey:KEY_TECHLEVEL];
1438
nearby_systems[ num_nearby_systems ].eco = [sys_info oo_intForKey:KEY_ECONOMY];
1439
nearby_systems[ num_nearby_systems ].gov = [sys_info oo_intForKey:KEY_GOVERNMENT];
1440
1491
nearby_systems[ num_nearby_systems ].p_name = [[sys_info oo_stringForKey:KEY_NAME] retain];
1441
1492
num_nearby_systems++;
1471
OODrawPlanetInfo(sys->gov, sys->eco, sys->tec, x + star.x + 2.0, y + star.y + 2.0, z, NSMakeSize(pixel_row_height,pixel_row_height));
1522
if ( sys->gov >= 0 ) // Not a nova? Show the info.
1523
OODrawPlanetInfo(sys->gov, sys->eco, sys->tec, x + star.x + 2.0, y + star.y + 2.0, z, NSMakeSize(pixel_row_height,pixel_row_height));
1479
1531
sys = nearby_systems + targetIdx;
1480
1532
star.x = (float)(sys->seed_d * hscale + hoffset);
1481
1533
star.y = (float)(sys->seed_b * vscale + voffset);
1483
1535
if (![player showInfoFlag])
1485
1537
OODrawHilightedString(sys->p_name, x + star.x + 2.0, y + star.y, z, NSMakeSize(pixel_row_height,pixel_row_height));
1489
OODrawHilightedPlanetInfo(sys->gov, sys->eco, sys->tec, x + star.x + 2.0, y + star.y + 2.0, z, NSMakeSize(pixel_row_height,pixel_row_height));
1541
if ( sys->gov >= 0 ) // Not a nova? Show the info.
1542
OODrawHilightedPlanetInfo(sys->gov, sys->eco, sys->tec, x + star.x + 2.0, y + star.y + 2.0, z,
1543
NSMakeSize(pixel_row_height,pixel_row_height));
1511
1565
BOOL *systemsFound = [UNIVERSE systemsFound];
1512
1566
unsigned i, first = 0, last = 0, count = 0;
1513
1567
int systemIndex = foundSystem + direction;
1515
1569
if (direction == 0) systemIndex = 0;
1517
1571
for (i = 0; i <= kOOMaximumSystemID; i++)
1556
1610
NSPoint galaxy_coordinates = [player galaxy_coordinates];
1557
1611
NSPoint cursor_coordinates = [player cursor_coordinates];
1558
1612
Random_Seed galaxy_seed = [player galaxy_seed];
1560
1614
double fuel = 35.0 * [player dialFuel];
1562
1616
// get a list of systems marked as contract destinations
1563
1617
NSArray *markedDestinations = [player markedDestinations];
1600
1654
distance = distanceBetweenPlanetPositions(dest.d,dest.b,galaxy_coordinates.x,galaxy_coordinates.y);
1601
1655
time = distance * distance;
1604
1658
if (routeExists)
1606
1660
// distance-f & est-travel-time-f are identical between short & long range charts in standard Oolite, however can be alterered separately via OXPs
1669
1723
star.x = (float)(g_seed.d * hscale + hoffset);
1670
1724
star.y = (float)(g_seed.b * vscale + voffset);
1672
1726
float sz = (4.0f + 0.5f * (0x03 | (g_seed.f & 0x0f))) / 7.0f;
1674
1728
glVertex3f(x + star.x, y + star.y + sz, z);