-
Notifications
You must be signed in to change notification settings - Fork 68
Skybox
The game uses the fraction of a day (6 to 18 hours) in 0..255
range to copy 8 consecutive values from DREARY/DAYTIME.COL
into indices 1..8
of the VGA palette, and uses DITHER/DITHER2.IMG
to draw the sky gradient. The dither textures are 8x100 and are columns of pixels to fill the upper half of the screen.
placeSkyboxStatics(num, template, pos, var, randomht) <-
for i <- 0, num
x <- rnd() mod var
if x==0 then x<-var
< format x as 2 decimal digits and insert them into template at pos >
<load image>
if randomht then
yPos <- rnd() mod 64
< set Y image parameter to yPos >
endif
angle <- rnd() mod 512 # Arena angle units
< place the image at angle >
if currentCity.tileset==TEMPERATE then
template <- "temp00.img"
pos <- 4
var <- 10
else if currentCity.tileset==DESERT then
template <- "desert0.img"
pos <- 6
var <- 4
else # MOUNTAIN
template <- "mount000.img"
pos <- 6
var <- 11
endif
seed <- currentCity.seed
srand(seed)
nMount <- (rnd() mod 4) + 2
placeSkyboxStatics(nMount, template, pos, var, false)
if weather==0 then # clear
seed <- getRandomSeed() + (currentDay mod 32)
srand(seed)
placeSkyboxStatics(7, "cloud00.img", 5, 17, true)
endif
In Morrowind, the skybox contain the volcano image. It is positioned as if it was located at 132, 52 in the province coordinates. The filename is chosen from the list located @46f59
, if the ArenaDistance between the settlement and the volcano is less than 150, the second element is used, otherwise third. Probably, the first element was intended to be used when the distance is less than 80, but it doesn't, probably due to the bug.
Arena draws the sky by projecting stars onto the screen, depending on diurnal sky rotation, player angle, and the latitude.
getRndCoord() <-
d <- 0x800 + rnd() & 0x0FFF
if (d & 2) then d <- -(d)
stars <- []
planets <- [false, false, false]
srand(0x12345679)
for i <- 0, 39
star <- new Star
star.x <- getRndCoord()
star.y <- getRndCoord()
star.z <- getRndCoord()
s <- rnd() mod 4
if s then # constellation
starlist <- []
n <- 2 + rnd() mod 4
for j <- 0, n-1
ss <- new SubStar
ss.dx <- rnd() sar 9 # -64 .. 63
ss.dy <- rnd() sar 9
ss.color <- rnd() mod 10 + 64
starlist.append(ss)
star.sublist <- starlist
else # large star
do
var <- rnd() mod 8
while var>=5 and planets[var-5]
if var>=5 then planets[var-5] <- true
star.type <- var
endif
stars.append(star)
Stars are drawn either by drawing STARx.IMG
at projected screen coordinates, or putting a single pixel around that point. If any color component of that point in the sky is larger than 1/4, (during sunrise/sunset?) no star is drawn there.