Files
Paradise/code/modules/fancytitle/fancytitle.dm
Tigercat2000 756de5a716 Serverside map icons.
This adjusts our titlescreen system to allow for hosting title screens
seperately from the codebase, for licensing reasons and other. It
supports both per-map title screens and "rare" screens, which are both
done by parsing in the form of naming the file.

Usage is covered in config/title_screens/README.txt, to summarize:
 - All title screens must have unique names. These can be anything, so
 long as they do not use the + or . characters. Example: NewLobby.png,
 DeadCats.jpg.
 - Any format BYOND can read is supported, the file extension doesn't
 really matter; Only exception is that .dmi files must only have *one*
 state, and it must not have a name.
 - Map-specific title screens are parsed by adding the MAP_NAME to the
 start of the image. Example: MetaStation+NewLobby.png,
 Cyberiad+NewLobby.png
   - I changed the MAP_NAME of the NSS Cyberiad from NSS Cyberiad to
   Cyberiad for this reason, to avoid any compatibility issues between
   filesystems.
 - Rare title screens can be made by using the format rare+name.ext.
 Example: rare+NyanCat.gif, rare+Mrowl.dmi
   - You cannot use both map-specific and rare modifiers at the same
   time to reduce parsing complexity.
2017-04-24 10:23:21 -07:00

33 lines
935 B
Plaintext

/hook/startup/proc/setup_title_screen()
var/list/provisional_title_screens = flist("config/title_screens/images/")
var/list/title_screens = list()
var/use_rare_screens = prob(1)
for(var/S in provisional_title_screens)
var/list/L = splittext(S,"+")
if(L.len == 1 && L[1] != "blank.png")
title_screens += S
else if(L.len > 1)
if(use_rare_screens && lowertext(L[1]) == "rare")
title_screens += S
else if(lowertext(L[1]) == lowertext(MAP_NAME))
title_screens += S
if(!isemptylist(title_screens))
if(length(title_screens) > 1)
for(var/S in title_screens)
var/list/L = splittext(S,".")
if(L.len != 2 || L[1] != "default")
continue
title_screens -= S
break
var/file_path = "config/title_screens/images/[pick(title_screens)]"
var/icon/icon = new(fcopy_rsc(file_path))
for(var/turf/unsimulated/wall/splashscreen/splash in world)
splash.icon = icon
return TRUE
return FALSE