# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils games DESCRIPTION="Unreal Tournament 99 - futuristic deathmatch shooter" HOMEPAGE="http://www.unrealtournament.com/ http://utpg.org/" SRC_URI="mirror://lokigames/../beta/ut/ut-install-436-GOTY.run mirror://lokigames/../patches/ut/ut-install-436.run http://utpg.org/patches/UTPGPatch${PV}.tar.bz2" LICENSE="as-is" SLOT="0" KEYWORDS="-* ~amd64 ~x86" IUSE="3dfx dedicated doc linguas_es linguas_fr linguas_it openal S3TC" RESTRICT="strip" RDEPEND="x86? ( x11-libs/libXext x11-libs/libX11 x11-libs/libXau x11-libs/libXdmcp 3dfx? ( media-libs/glide-v3 ) !3dfx? ( virtual/opengl =media-libs/libsdl-1.2* ) ) amd64? ( app-emulation/emul-linux-x86-xlibs app-emulation/emul-linux-x86-sdl app-emulation/emul-linux-x86-soundlibs ) dedicated? ( games-server/unreal-tournament-ded )" DEPEND=">=app-arch/unshield-0.5-r1 dev-util/xdelta !games-fps/unreal-tournament-goty" S=${WORKDIR} dir=${GAMES_PREFIX_OPT}/${PN} Ddir=${D}/${dir} QA_TEXTRELS="${dir:1}/System/NullDrv.so ${dir:1}/System/NullRender.so ${dir:1}/System/Core.so ${dir:1}/System/Editor.so ${dir:1}/System/NullNetDriver.so ${dir:1}/System/Engine.so ${dir:1}/System/SDLSoftDrv.so ${dir:1}/System/Render.so" set_dirs() { # The top-level directory names can change per CD. if [[ "${UT_SOURCE}" == "anthology" ]] || [[ -e "${CDROM_ROOT}/System" ]] ; then HELP_DIR="Help" MUSIC_DIR="Music" SOUNDS_DIR="Sounds" SYSTEM_DIR="System" TEXTURES_DIR="Textures" else HELP_DIR="HELP" MUSIC_DIR="MUSIC" SOUNDS_DIR="SOUNDS" SYSTEM_DIR="SYSTEM" TEXTURES_DIR="TEXTURES" fi if [[ "${UT_SOURCE}" == "anthology" ]] || [[ -e "${CDROM_ROOT}/Maps" ]] ; then MAPS_DIR="Maps" elif [[ -e "${CDROM_ROOT}/MAPS" ]] ; then MAPS_DIR="MAPS" else MAPS_DIR="maps" fi } unpack_patches() { local f # We patch to 451. Engine.u changed with almost every version so we can decide what # patching is needed based on its MD5. The Windows -> Linux transition is done at # version 436 but it's okay to accept all the later Windows and Linux versions # because all the the files modified by those patches are either unused by Linux # or replaced by the 451 Linux patch. case `md5sum System/Engine.u | head -c32` in "949edbb406a958ae40d8102c3c2b8162") UT_VERSION="400" einfo "UT version 400 (original unpatched) detected" ;; "659efcacbab279e56a2865268e0ec004") UT_VERSION="432" einfo "UT version 432 (GOTY or patched) detected" ;; "e6fbb28182bc82a9414cc96a744eda1b") UT_VERSION="436" einfo "UT version 436/440 (GOTY or patched) detected" ;; "30991ebeb67c50d2a1ff996947fac7aa") UT_VERSION="451" einfo "UT version 451 (UTPG patched) detected" ;; "9aecf807f585ac7543ca67e5c831a714") UT_VERSION="451b" einfo "UT version 451b (UTPG patched) detected" ;; *) UT_VERSION="Unknown" ewarn "Unsupported UT version detected" ewarn "Continuing anyway but the game may not work correctly. It is recommended" ewarn "that you install from the original CD or DVD instead." ;; esac mkdir patch-ut cd patch-ut if [[ "${UT_VERSION}" == "400" ]] || [[ "${UT_VERSION}" == "Unknown" ]] ; then unpack_makeself ut-install-436.run else unpack_makeself ut-install-436-GOTY.run fi cd .. # Copy startup script and hard-code game path. sed "s:\`FindPath \$0\`:${dir}:" patch-ut/bin/x86/ut > ut || die "sed ut" # Apply any appropriate patches. if [[ "${UT_VERSION}" == "400" ]] || [[ "${UT_VERSION}" == "432" ]] ; then for patch in patch-ut/setup.data/data/System/*.0 ; do xdelta patch ${patch} System/`basename ${patch} .0` patched || die "xdelta patch ${patch}" mv -f patched System/`basename ${patch} .0` || die "mv patched" done fi # Unpack 436 and 451 files. unpack ./patch-ut/{data,Credits,OpenGL.ini}.tar.gz unpack UTPGPatch${PV}.tar.bz2 rm -f {,System/}{checkfiles.sh,patch.md5} # Tweak the default settings for today's original of PCs and good preferences. sed -i -r \ -e "s/CacheSizeMegs=[0-9]+/CacheSizeMegs=64/" \ -e "s/DoPrecache=.*$/DoPrecache=1/" \ -e "s/UseTrilinear=.*$/UseTrilinear=True/" \ -e "s/ScreenFlashes=.*$/ScreenFlashes=False/" \ -e "s/OutputRate=[0-9]+Hz/OutputRate=44100Hz/" \ -e "s/Channels=[0-9]+/Channels=24/" \ System/UnrealTournament.ini || die "sed UnrealTournament.ini" if use 3dfx ; then # Maybe someone still uses them! RENDERER="GlideDrv\.GlideRenderDevice" else # Recommended at http://icculus.org/lgfaq/#renderer RENDERER="OpenGLDrv\.OpenGLRenderDevice" fi if use openal ; then # Provides more effects. AUDIO="ALAudio\.ALAudioSubsystem" else # Less problematic. AUDIO="Audio.GenericAudioSubsystem" fi if use S3TC ; then S3TC=1 else S3TC=0 fi # Set the appropriate drivers. sed -i \ -e "s/GameRenderDevice=.*$/GameRenderDevice=${RENDERER}/" \ -e "s/WindowedRenderDevice=.*$/WindowedRenderDevice=${RENDERER}/" \ -e "s/RenderDevice=.*$/RenderDevice=${RENDERER}/" \ -e "s/AudioDevice=.*$/AudioDevice=${AUDIO}/" \ -e "s/UseS3TC=.*$/UseS3TC=${S3TC}/" \ System/UnrealTournament.ini || die "sed UnrealTournament.ini (drivers)" # Fix server vulnerability - part of bug #44351. sed -i \ -e "/^LoadClassMismatch/s:%s.%s:%s:" \ System/Core.int || die "sed Core.int" # Remove duplicate-cased files. rm -f System/OpenGLDrv.int local lower for f in System/*.int ; do lower=System/`basename ${f} | tr [A-Z] [a-z]` [[ ${lower} == ${f} ]] && continue # Globbing is case-insensitive. if [[ -e ${lower} ]] ; then mv -f "${lower}" "${f}" || die fi done # These files are from the original Unreal. Not sure why the 451 patch includes them. rm -f System/Female{1,2}Skins.int System/Male{1,2,3}Skins.int System/SkTrooperSkins.int # Remove other unneeded files. rm -f System/{libSDL-1.1.so.0,UnrealTournament.ini.PATCH,{Manifest,d3ddrv,galaxy,windrv}.int} } pkg_setup() { games_pkg_setup local extra if use S3TC ; then # This allows the high resolution textures to be copied from a previous installation. However, # the file must be checked to ensure that it really is a high resolution texture file because # there are no high resolution textures files without a low resolution equivalent. if [[ -n "${CD_ROOT}" ]] && [[ -e "${CD_ROOT}/Textures/UT.utx" ]] && [[ `md5sum "${CD_ROOT}/Textures/UT.utx" | head -c32` == "0717a53dfb125585659207c8021359a2" ]] ; then extra=":Textures/UT.utx" fi CDROM_NAME_SET=( "UT Game CD or Unreal Anthology DVD" "UT High Resolution Textures CD" ) cdrom_get_cds System/UTMenu.u:SYSTEM/UTMenu.u:AutoRunData/Unreal.ico Help/chaosut:UnrealEd/UnrealEdInstaller.exe${extra} else CDROM_NAME="UT Game CD or Unreal Anthology DVD" cdrom_get_cds System/UTMenu.u:SYSTEM/UTMenu.u:AutoRunData/Unreal.ico fi case ${CDROM_SET} in 0|1) UT_SOURCE="normal" einfo 'Found UT Game CD or previous installation' ;; 2) UT_SOURCE="anthology" einfo 'Found Unreal Anthology DVD' ;; esac set_dirs } src_unpack() { local lang f j mkdir Help Maps Music Sounds System Textures # Explicitly name files to copy in case we are using some existing installation with additional files. HELP={Logo.bmp,ReadMe.htm,Unreal{.ico,Ed.ico,TournamentLogo.bmp,TournamentSetupLogo.bmp}} MAPS={AS-{Frigate,Guardia,HiSpeed,Mazon,OceanFloor,Overlord,Rook,Tutorial},CTF-{Command,Coret,Dreary,EternalCave,Face,Gauntlet,LavaGiant,Niven,November,Tutorial},CityIntro,DM-{Barricade,Codex,Conveyor,Curse][,Deck16][,Fetid,Fractal,Gothic,Grinder,HyperBlast,KGalleon,Liandri,Morbias][,Morpheus,Oblivion,Peak,Phobos,Pressure,Pyramid,Stalwart,StalwartXL,Tempest,Turbine,Tutorial,Zeto},DOM-{Cinder,Condemned,Cryptic,Gearbolt,Ghardhen,Lament,Leadworks,MetalDream,Olden,Sesmar,Tutorial},EOL_{Assault,CTF,Challenge,Deathmatch,Domination,Statues},Entry,UT-Logo-Map,UTCredits}.unr MUSIC={Botmca9,Botpck10,Cannon,Colossus,Course,Credits,Ending,Enigma,Foregone,Godown,Lock,Mech8,Mission,Nether,Organic,Phantom,Razor-ub,Run,SaveMe,Savemeg,Seeker,Seeker2,Skyward,Strider,Suprfist,UnWorld2,Uttitle,Wheels,firebr,utmenu23}.umx SOUNDS={Activates,Addon1,Amb{Ancient,City,Modern,Outside},DDay,DMatch,DoorsAnc,DoorsMod,Extro,FemaleSounds,LadderSounds,MaleSounds,Pan1,VRikers,noxxsnd,rain}.uax SYSTEM={BotPack.u,Botpack.int,CommandoSkins.int,Core.{int,u},Editor.{int,u},Engine.{int,u},FCommandoSkins.int,Fire.u,GlideDrv.int,IpDrv.{int,u},IpServer.{int,u},[Ll]icense.int,OpenGlDrv.ini,OpenGlDrv.int,SGirlSkins.int,SoftDrv.int,SoldierSkins.int,UBrowser.{int,u},UMenu.{int,u},UTBrowser.u,UTMenu.{int,u},UTServerAdmin.int,UTServerAdmin.u,UWeb.int,UWeb.u,UWindow.u,Unreal{I.{int,u},Share.{int,u},Tournament.in{i,t}},User.ini,Window.int,mput.mpi} # Some files are localized. UTMenu.frt is sometimes lower-cased. LOCALIZED_SOUNDS={Announcer,BossVoice,Female{1,2}Voice,Male{1,2}Voice,TutVoice{AS,CTF,DM,DOM},openingwave}.uax LOCALIZED_SYSTEM={{Boss,Commando,FCommando,SGirl,Soldier}Skins,Editor,Engine,GlideDrv,IpDrv,IpServer,OpenGlDrv,SoftDrv,UBrowser,UMenu,[Uu][Tt][Mm]enu,Unreal{,I,Share,Tournament},Window,as-{frigate,guardia,hispeed,mazon,oceanfloor,overlord,rook,tutorial},botpack,ctf-{command,coret,dreary,eternalcave,face,gauntlet,lavagiant,niven,november,tutorial},dm-{barricade,codex,conveyor,curse][,deck16][,fetid,fractal,gothic,grinder,hyperblast,kgalleon,liandri,morbias][,morpheus,oblivion,peak,phobos,pressure,pyramid,stalwart,tempest,turbine,tutorial,zeto},dom-{cinder,condemned,cryptic,gearbolt,ghardhen,lament,leadworks,metaldream,olden,sesmar,tutorial},eol_{assault,challenge,ctf,deathmatch,domination,statues},utbrowser,uwindow} # Some low resolution texture files have no high resolution equivalent. TEXTURES_LOW={{Boss,Dacoma,FCommando,Female{1,2},Goth,Male{1,2,3},SGirl,SkTrooper}Skins,AlfaFX,Belt_fx,BluffFX,ChizraEFX,Creative,Crypt,DMeffects,DacomaFem,Detail,FireEng,GothFem,GreatFire{,2},ISVFX,LadderFonts,Ladr{Arrow,Static},LavaFX,Liquids,Logo,MenuGr,NivenFX,Palettes,PhraelFx,Render,RotatingU,Scripted,Soldierskins,SpaceFX,Terranius,UT_ArtFX,UWindowFonts,XFX,commandoskins,credits}.utx TEXTURES_BOTH={Ancient,ArenaTex,CTF,Coret_FX,Crypt{2,_FX},DDayFX,DecayedS,Egypt{,Pan},Faces,FlareFX,FractalFX,Gen{Earth,FX,Fluid,In,Terra,Warp},HubEffects,Indus{1,2,3,4,5,6,7},JWSky,Lian-X,Metalmys,Mine,Nali{Cast,FX},Old_FX,PlayrShp,Queen,RainFX,Shane{Church,Day,Sky},Skaarj,Sky{Box,City},Slums,Starship,TCrystal,TrenchesFX,UT,UTbase1,UTcrypt,UTtech{1,2,3},XbpFX,Xtortion,castle1,city,eol,of1}.utx if [[ "${UT_SOURCE}" == "anthology" ]] ; then if use S3TC ; then ewarn "The Unreal Anthology DVD does not include the high resolution textures" ewarn "but you may install them if you have them available from another source." ewarn "Otherwise, please disable the S3TC USE flag." fi # Symlinks for unshield. ln -sfn "${CDROM_ROOT}"/Disk1/data1.hdr "${T}" ln -sfn "${CDROM_ROOT}"/Disk*/data*.cab "${T}" CAB_GROUPS="Help Maps Music Sounds_All Sounds_English System_All System_English Textures" # The manual is pretty heavy at 17MB! use doc && CAB_GROUPS="${CAB_GROUPS} Manual_English" # Add requested language components. The manuals are all in English!? use linguas_es && CAB_GROUPS="${CAB_GROUPS} Sounds_Spanish System_Spanish" use linguas_fr && CAB_GROUPS="${CAB_GROUPS} Sounds_French System_French" use linguas_it && CAB_GROUPS="${CAB_GROUPS} Sounds_Italian System_Italian" for j in ${CAB_GROUPS} ; do unshield -g 3_UnrealTournament_${j} x "${T}"/data1.cab || die "unshield" done # Rename Spanish sounds. if use linguas_es ; then for j in 3_UnrealTournament_Sounds_Spanish/*.uax ; do mv -f ${j} ${j/.uax}.uax_est || die "mv ${j}" done fi # Rename French sounds. if use linguas_fr ; then for j in 3_UnrealTournament_Sounds_French/*.uax ; do mv -f ${j} ${j/.uax}.uax_frt || die "mv ${j}" done fi # Rename Italian sounds. if use linguas_it ; then for j in 3_UnrealTournament_Sounds_Italian/*.uax ; do mv -f ${j} ${j/.uax}.uax_itt || die "mv ${j}" done fi # Retrieve the manual. if use doc ; then mv 3_UnrealTournament_Manual_English/Manual.pdf . || die fi eval mv -f 3_UnrealTournament_Help/${HELP} Help || die "mv Help" eval mv -f 3_UnrealTournament_Maps/${MAPS} Maps || die "mv Maps" eval mv -f 3_UnrealTournament_Music/${MUSIC} Music || die "mv Music" eval mv -f 3_UnrealTournament_Sounds_All/${SOUNDS} Sounds || die "mv Sounds (generic)" eval mv -f 3_UnrealTournament_Sounds_*/${LOCALIZED_SOUNDS}* Sounds || die "mv Sounds (localized)" eval mv -f 3_UnrealTournament_System_{All,English}/${SYSTEM} System 2> /dev/null eval mv -f 3_UnrealTournament_System_English/${LOCALIZED_SYSTEM}.int System 2> /dev/null eval mv -f 3_UnrealTournament_System_*/${LOCALIZED_SYSTEM}.{est,frt,itt} System 2> /dev/null eval mv -f 3_UnrealTournament_Textures/${TEXTURES_LOW} Textures || die "mv Textures (low)" if ! use S3TC ; then eval mv -f 3_UnrealTournament_Textures/${TEXTURES_BOTH} Textures || die "mv Textures (both)" fi rm -rf 3_UnrealTournament_* unpack_patches else eval cp -f "${CDROM_ROOT}/${HELP_DIR}"/${HELP} Help || die "cp Help" eval cp -f "${CDROM_ROOT}/${MUSIC_DIR}"/${MUSIC} Music || die "cp Music" eval cp -f "${CDROM_ROOT}/${SYSTEM_DIR}"/${SYSTEM} System || die "cp System" if ! use S3TC && [[ `md5sum "${CDROM_ROOT}/Textures/UT.utx" | head -c32` == "0717a53dfb125585659207c8021359a2" ]] ; then ewarn "You have requested to install the low resolution textures but the texture" ewarn "files found in CDROM_ROOT appear to be the high resolution ones. These" ewarn "will be installed instead." fi # Copy low resolution textures. eval cp -f "${CDROM_ROOT}/${TEXTURES_DIR}"/${TEXTURES_LOW} Textures || die "cp Textures (low)" if ! use S3TC ; then eval cp -f "${CDROM_ROOT}/${TEXTURES_DIR}"/${TEXTURES_BOTH} Textures || die "cp Textures (both)" fi # Copy generic sounds. eval cp -f "${CDROM_ROOT}/${SOUNDS_DIR}"/${SOUNDS} Sounds || die "cp Sounds (generic)" # Copy English sounds. eval cp -f "${CDROM_ROOT}/${SOUNDS_DIR}"/${LOCALIZED_SOUNDS} Sounds || die "cp Sounds (English)" # Copy localized sounds and system files. for lang in es fr it ; do if use linguas_${lang} ; then eval cp -f "${CDROM_ROOT}/${SOUNDS_DIR}"/${LOCALIZED_SOUNDS}_${lang}t Sounds || die "cp Sounds (${lang}t)" eval cp -f "${CDROM_ROOT}/${SYSTEM_DIR}"/${LOCALIZED_SYSTEM}.${lang}t System || die "cp System (${lang}t)" fi done # Need to unpack the patches early so we can get ucc-bin for decompressing maps. unpack_patches cd System # Copy or decompress maps as necessary. for f in `eval echo ${MAPS}` ; do if [[ -e "${CDROM_ROOT}/${MAPS_DIR}/${f}" ]] ; then cp -f "${CDROM_ROOT}/${MAPS_DIR}/${f}" ../Maps || die "cp Maps/${f}" elif [[ -e "${CDROM_ROOT}/${MAPS_DIR}/${f}.uz" ]] ; then ./ucc-bin decompress "${CDROM_ROOT}/${MAPS_DIR}/${f}.uz" -nohomedir || die "decompress Maps/${f}.uz" mv -f ${f} ../Maps || die "mv map ${f}" else die "Maps/${f} missing" fi done cd .. fi if use S3TC ; then unset CDROM_SET cdrom_load_next_cd set_dirs # Because of the check in pkg_setup, this will probably never happen but just in case... if [[ `md5sum "${CDROM_ROOT}/Textures/UT.utx" | head -c32` == "076aaca7fa6ec3b7f31781d3b8c150d8" ]] ; then ewarn "You have requested to install the high resolution textures but the texture" ewarn "files found in CDROM_ROOT appear to be the low resolution ones. These" ewarn "will be installed instead." fi # Copy high resolution textures. eval cp -f "${CDROM_ROOT}/${TEXTURES_DIR}"/${TEXTURES_BOTH} Textures || die "cp Textures (CD 2)" fi # Don't include ucc-bin, due to bug #44351. rm -f System/ucc-bin } src_install() { # Guard against executable flag potentially set. for f in `find . -type f` ; do chmod 640 "${f}" || die done # System files. chmod 750 System/ut-bin System/*.so System/*.so.* || die # Move instead of copy to reduce disk stress. (-: # Permissions are corrected with prepgamesdirs below. dodir "${dir}" mv Help Maps Music Sounds System Textures Web "${Ddir}" || die "mv directories" # Script. exeinto "${dir}" doexe ut || die "doexe ut" # Icon. insinto "${dir}" doins patch-ut/icon.xpm || die "doins icon" # Desktop. games_make_wrapper ut ./ut "${dir}" newicon patch-ut/icon.xpm ut.xpm || die "newicon" make_desktop_entry ut "Unreal Tournament 99" ut.xpm # Manual. insinto /usr/share/doc/${PF} if [[ -e "Manual.pdf" ]] ; then doins Manual.pdf || die fi prepgamesdirs } pkg_postinst() { games_pkg_postinst if ! use 3dfx ; then elog "The OpenGLDrv.OpenGLRenderDevice driver has been selected but the" elog "SDLGLDrv.SDLGLRenderDevice and SDLSoftDrv.SDLSoftwareRenderDevice" elog "drivers are also available if you need them. To use them, edit" elog "~/.loki/ut/UnrealTournament.ini after running the game once." echo elog "If you experience texture corruption, particularly if you have an older" elog "graphics card, try editing ~/.loki/ut/UnrealTournament.ini and change" elog "UseMultiTexture from 1 to 0 for your selected driver." echo fi if use linguas_es || use linguas_fr || use linguas_it ; then elog "You have installed support for one or more additional languages. The" elog "game defaults to English but you can change the language by running" elog "the game once and then editing ~/.loki/ut/UnrealTournament.ini. Change" elog "the Language entry under [Engine.Engine] to 'est', 'frt' or 'itt' and" elog "add a Path entry directly under [Core.System] with '..\Sounds\*.uax_est'," elog "'..\Sounds\*.uax_frt' or '..\Sounds\*.uax_itt' for Spanish, French or" elog "Italian respectively." echo fi if ! has_version "games-fps/unreal-tournament-bonuspacks" ; then elog "emerge 'games-fps/unreal-tournament-bonuspacks' to add many popular maps." elog "This is highly recommended if you wish to play online. Note that you need" elog "this package for Bonus Packs 1 to 3 even if you just installed the game" elog "using the GOTY edition." echo fi if ! use dedicated && ! has_version "games-server/unreal-tournament-ded" ; then elog "The 'ucc' dedicated server executable has been moved to" elog "games-server/unreal-tournament-ded for security reasons." elog "See bug #44351 for details." echo fi }