mirror of
https://github.com/irmen/prog8.git
synced 2024-12-01 15:52:54 +00:00
tweak planet name display in starmap
This commit is contained in:
parent
bfd3edb617
commit
8ba5a0d90c
@ -493,7 +493,7 @@ galaxy {
|
|||||||
ubyte current_planet = planet.number
|
ubyte current_planet = planet.number
|
||||||
ubyte px = planet.x
|
ubyte px = planet.x
|
||||||
ubyte py = planet.y
|
ubyte py = planet.y
|
||||||
uword current_name = &planet.name
|
str current_name = " " ; 8 max
|
||||||
ubyte pn = 0
|
ubyte pn = 0
|
||||||
uword scaling = 8
|
uword scaling = 8
|
||||||
if local
|
if local
|
||||||
@ -501,6 +501,7 @@ galaxy {
|
|||||||
if txt.width() > 60
|
if txt.width() > 60
|
||||||
scaling /= 2
|
scaling /= 2
|
||||||
|
|
||||||
|
current_name = planet.name
|
||||||
init(number)
|
init(number)
|
||||||
txt.clear_screen()
|
txt.clear_screen()
|
||||||
txt.print("Galaxy #")
|
txt.print("Galaxy #")
|
||||||
@ -513,6 +514,10 @@ galaxy {
|
|||||||
ubyte max_distance = 255
|
ubyte max_distance = 255
|
||||||
if local
|
if local
|
||||||
max_distance = ship.Max_fuel
|
max_distance = ship.Max_fuel
|
||||||
|
ubyte home_sx
|
||||||
|
ubyte home_sy
|
||||||
|
ubyte home_distance
|
||||||
|
|
||||||
do {
|
do {
|
||||||
generate_next_planet()
|
generate_next_planet()
|
||||||
ubyte distance = planet.distance(px, py)
|
ubyte distance = planet.distance(px, py)
|
||||||
@ -532,20 +537,21 @@ galaxy {
|
|||||||
ubyte char = '*'
|
ubyte char = '*'
|
||||||
if planet.number==current_planet
|
if planet.number==current_planet
|
||||||
char = '%'
|
char = '%'
|
||||||
if local or planet.number==current_planet {
|
if local {
|
||||||
txt.plot(2+sx-2, 2+sy+1)
|
print_planet_details(planet.name, sx, sy, distance)
|
||||||
txt.print(current_name)
|
} else if planet.number==current_planet {
|
||||||
if distance {
|
home_distance = distance
|
||||||
txt.plot(2+sx-2, 2+sy+2)
|
home_sx = sx
|
||||||
util.print_10s(distance)
|
home_sy = sy
|
||||||
txt.print(" LY")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
txt.setchr(2+sx, 2+sy, char)
|
txt.setchr(2+sx, 2+sy, char)
|
||||||
}
|
}
|
||||||
pn++
|
pn++
|
||||||
} until pn==0
|
} until pn==0
|
||||||
|
|
||||||
|
if not local
|
||||||
|
print_planet_details(current_name, home_sx, home_sy, home_distance)
|
||||||
|
|
||||||
if txt.width() < 80
|
if txt.width() < 80
|
||||||
txt.plot(0,20)
|
txt.plot(0,20)
|
||||||
else
|
else
|
||||||
@ -553,6 +559,16 @@ galaxy {
|
|||||||
|
|
||||||
|
|
||||||
travel_to(number, current_planet)
|
travel_to(number, current_planet)
|
||||||
|
|
||||||
|
sub print_planet_details(str name, ubyte sx, ubyte sy, ubyte d) {
|
||||||
|
txt.plot(2+sx-2, 2+sy+1)
|
||||||
|
txt.print(name)
|
||||||
|
if d!=0 {
|
||||||
|
txt.plot(2+sx-2, 2+sy+2)
|
||||||
|
util.print_10s(d)
|
||||||
|
txt.print(" LY")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ubyte pn_pair1
|
ubyte pn_pair1
|
||||||
|
@ -434,12 +434,12 @@ galaxy {
|
|||||||
ubyte current_planet = planet.number
|
ubyte current_planet = planet.number
|
||||||
ubyte px = planet.x
|
ubyte px = planet.x
|
||||||
ubyte py = planet.y
|
ubyte py = planet.y
|
||||||
uword current_name = &planet.name
|
str current_name = " " ; 8 max
|
||||||
ubyte pn = 0
|
ubyte pn = 0
|
||||||
uword scaling = 2
|
uword scaling = 2
|
||||||
if local
|
if local
|
||||||
scaling = 1
|
scaling = 1
|
||||||
|
current_name = planet.name
|
||||||
init(number)
|
init(number)
|
||||||
txt.clear_screen()
|
txt.clear_screen()
|
||||||
txt.print("Galaxy #")
|
txt.print("Galaxy #")
|
||||||
@ -452,6 +452,10 @@ galaxy {
|
|||||||
ubyte max_distance = 255
|
ubyte max_distance = 255
|
||||||
if local
|
if local
|
||||||
max_distance = ship.Max_fuel
|
max_distance = ship.Max_fuel
|
||||||
|
ubyte home_sx
|
||||||
|
ubyte home_sy
|
||||||
|
ubyte home_distance
|
||||||
|
|
||||||
do {
|
do {
|
||||||
generate_next_planet()
|
generate_next_planet()
|
||||||
ubyte distance = planet.distance(px, py)
|
ubyte distance = planet.distance(px, py)
|
||||||
@ -471,14 +475,12 @@ galaxy {
|
|||||||
ubyte char = '*'
|
ubyte char = '*'
|
||||||
if planet.number==current_planet
|
if planet.number==current_planet
|
||||||
char = '%'
|
char = '%'
|
||||||
if local or planet.number==current_planet {
|
if local {
|
||||||
txt.plot(2+sx-2, 2+sy+1)
|
print_planet_details(planet.name, sx, sy, distance)
|
||||||
txt.print(current_name)
|
} else if planet.number==current_planet {
|
||||||
if distance {
|
home_distance = distance
|
||||||
txt.plot(2+sx-2, 2+sy+2)
|
home_sx = sx
|
||||||
util.print_10s(distance)
|
home_sy = sy
|
||||||
txt.print(" LY")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
txt.setchr(2+sx, 2+sy, char)
|
txt.setchr(2+sx, 2+sy, char)
|
||||||
}
|
}
|
||||||
@ -487,11 +489,23 @@ galaxy {
|
|||||||
|
|
||||||
if local
|
if local
|
||||||
txt.plot(0, 20)
|
txt.plot(0, 20)
|
||||||
else
|
else {
|
||||||
|
print_planet_details(current_name, home_sx, home_sy, home_distance)
|
||||||
txt.plot(0, 33)
|
txt.plot(0, 33)
|
||||||
|
}
|
||||||
txt.nl()
|
txt.nl()
|
||||||
|
|
||||||
travel_to(number, current_planet)
|
travel_to(number, current_planet)
|
||||||
|
|
||||||
|
sub print_planet_details(str name, ubyte sx, ubyte sy, ubyte d) {
|
||||||
|
txt.plot(2+sx-2, 2+sy+1)
|
||||||
|
txt.print(name)
|
||||||
|
if d!=0 {
|
||||||
|
txt.plot(2+sx-2, 2+sy+2)
|
||||||
|
util.print_10s(d)
|
||||||
|
txt.print(" LY")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ubyte pn_pair1
|
ubyte pn_pair1
|
||||||
|
Loading…
Reference in New Issue
Block a user