# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils games DESCRIPTION="Unreal: Return To Na Pali - futuristic shooter (requires Unreal Tournament)" HOMEPAGE="http://www.unreal.com/" SRC_URI="mirror://gentoo/distfiles/u1-on-ut-${PVR}.tar.bz2" LICENSE="as-is" SLOT="0" KEYWORDS="-* ~amd64 ~x86" IUSE="doc linguas_de linguas_es linguas_fr linguas_it" RESTRICT="strip" DEPEND=">=app-arch/unshield-0.5-r1 dev-util/xdelta ~games-fps/unreal-tournament-${PV}" S=${WORKDIR} dir=${GAMES_PREFIX_OPT}/${PN} Ddir=${D}/${dir} QA_TEXTRELS="${dir:1}/System/Engine.so" UT_DIR=${GAMES_PREFIX_OPT}/unreal-tournament set_dirs() { # The top-level directory names can change per CD. if [[ "${U_SOURCE}" == "anthology" ]] || [[ -e "${CDROM_ROOT}/System" ]] ; then MANUAL_DIR="Manual" MUSIC_DIR="Music" SOUNDS_DIR="Sounds" SYSTEM_DIR="System" TEXTURES_DIR="Textures" else MANUAL_DIR="MANUAL" MUSIC_DIR="MUSIC" SOUNDS_DIR="SOUNDS" SYSTEM_DIR="SYSTEM" TEXTURES_DIR="TEXTURES" fi if [[ "${U_SOURCE}" == "anthology" ]] || [[ -e "${CDROM_ROOT}/Maps" ]] ; then MAPS_DIR="Maps" elif [[ -e "${CDROM_ROOT}/MAPS" ]] ; then MAPS_DIR="MAPS" else MAPS_DIR="maps" fi } src_unpack() { local lang lower x y unpack ${A} mkdir Maps Music Sounds System Textures SOUNDS={Activates,Amb{Ancient,Modern,Outside},DMatch,Doors{Anc,Mod},Extro,VRikers,{Boss,{M,Fem}ale{1,2}}Voice,Announcer,LadderSounds}.uax SYSTEM={{Bot[Pp]ack,Editor,Ip{Drv,Server},UBrowser,UTServerAdmin,UWeb}.{int,u},{Core,Engine,Fire,Unreal{I,Share},UWindow}.u,{Glide,Ip,OpenGl,SDLGL,SDLSoft}Drv.int,{ALAudio,Audio,Core,Editor,Fire,libopenal-0.0,NullNetDriver,NullRender,Render,UWeb,{Glide,Ip,Null,OpenGL,SDL,SDLGL,SDLSoft}Drv}.so,OpenGlDrv.ini,libmikmod.so.2} TEXTURES={AlfaFX,Ancient,BluffFX,ChizraEFX,Crypt,DecayedS,Detail,DMeffects,Female{1,2}Skins,FireEng,Gen{Earth,Fluid,FX,In,Terra,Warp},GreatFire{,2},HubEffects,ISVFX,JWSky,LavaFX,Liquids,Male{1,2,3}Skins,MenuGr,Mine,Nali{Cast,FX},Palettes,PlayrShp,Queen,Render,Shane{Day,Sky},Skaarj,SkTrooperSkins,Sky{Box,City},SpaceFX,Starship,TCrystal,Terranius,UWindowFonts,XFX,LadderFonts}.utx LOCALIZED_SYSTEM={Botpack,Editor,GlideDrv,IpDrv,IpServer,OpenGlDrv,UBrowser,UTBrowser,UWindow} # Link Web directory. ln -sfn "${UT_DIR}/Web" . || die "ln Web" # Link some files. eval ln -sfn "${UT_DIR}/Sounds"/${SOUNDS} Sounds || die "ln Sounds" eval ln -sfn "${UT_DIR}/System"/${SYSTEM} System || die "ln System" eval ln -sfn "${UT_DIR}/Textures"/${TEXTURES} Textures || die "ln Textures" # Copy generic UMenu file. cp -f u1-on-ut-${PVR}/UMenu.int System || die "cp UMenu.int" for lang in es fr it ; do if use linguas_${lang} ; then # Link localized system files. eval ln -sfn "${UT_DIR}/System"/${LOCALIZED_SYSTEM}.${lang}t System || die "ln System (${lang}t)" # Copy localized UMenu file. cp -f u1-on-ut-${PVR}/UMenu.${lang}t System || die "cp UMenu.${lang}t" fi done # Copy and modify UnrealTournament.ini to fit RTNP. sed -r \ -e "/^ServerPackages=/d" \ -e "s/^Class=.*$/Class=UPak.UPakFemaleOne/" \ -e "s/^LocalMap=.*$/LocalMap=Intro1.unr/" \ -e "s/^AudioDevice=.*$/AudioDevice=ALAudio.ALAudioSubsystem/" \ -e "s/^Console=.*$/Console=UPak.UPakConsole/" \ -e "s/^DefaultGame=.*$/DefaultGame=UPak.UPakSinglePlayer/" \ -e "s/^DefaultServerGame=.*$/DefaultServerGame=UPak.UPakGame/" \ -e "s/^LookAndFeelClass=.*$/LookAndFeelClass=UMenu.UMenuUGLookAndFeel/" \ "${ROOT}${UT_DIR}/System/UnrealTournament.ini" > System/ReturnToNaPali.ini || die "sed UnrealTournament.ini > ReturnToNaPali.ini" # Copy and modify the startup script to fit RTNP. sed -r \ -e "s/ut/napali/g" \ -e "s/unreal-tournament/${PN}/g" \ -e "s/Unreal Tournament/Unreal: Return To Na Pali/g" \ "${ROOT}${UT_DIR}/ut" > napali || die "sed ut > napali" # Patch ut-bin to use "ReturnToNaPali" instead of "UnrealTournament" and ~/.loki/napali instead # of ~/.loki/ut. Because "napali" is a longer string than "ut", an unimportant warning message # about the preferences directory is broken. Nevermind! xdelta patch u1-on-ut-${PVR}/napali-bin-${PV}.xdp "${ROOT}${UT_DIR}/System/ut-bin" System/napali-bin || die "xdelta patch ut-bin > napali-bin" # Patch Engine.so so that loading a saved game doesn't crash the game. The Linux version of UT # doesn't normally handle this properly but it can be worked around by loading the saved game as # if it were a map, since that is essentially what it is anyway. xdelta patch u1-on-ut-${PVR}/Engine.so-${PV}.xdp "${ROOT}${UT_DIR}/System/Engine.so" System/Engine.so || die "xdelta patch Engine.so" # Patch UMenu.u to provide the "Unreal Gold" look and feel and allow the new game menu to be # configured using the UMenu localization files. xdelta patch u1-on-ut-${PVR}/UMenu.u-${PV}.xdp "${ROOT}${UT_DIR}/System/UMenu.u" System/UMenu.u || die "xdelta patch UMenu.u" # Set the starting map to Intro1 in all UMenu localization files. sed -r -i "s/^StartMap=.*$/StartMap=Intro1.unr/" System/UMenu.??? || die "sed UMenu.???" CDROM_NAME="Unreal: Return To Na Pali CD, Unreal Gold CD or Unreal Anthology DVD" cdrom_get_cds TEXTURES/UGoldCredits.utx:Maps/UPak/Abyss.unr:AutoRunData/Unreal.ico case ${CDROM_SET} in 0) U_SOURCE="gold" einfo 'Found Unreal Gold CD' ;; 1) U_SOURCE="rtnp" einfo 'Found Unreal: Return To Na Pali CD or previous installation' ;; 2) U_SOURCE="anthology" einfo 'Found Unreal Anthology DVD' ;; esac set_dirs MAPS={Entry,UPak/{Abyss,Crashsite{,1,2},Dm{Athena,Daybreak,Hazard,Stomp,SunSpeak,Terra},DuskFalls,Eldora,End,Foundry,Glacena,Glathriel{1,2},Inter{1,2,3,4,5,6,7,8,9,10,11,12,13,14,Crashsite,Intro},Intro{1,2},Nagomi{,Sun},Nalic2,Nevec,SpireLand,Toxic,Upack,Velora}}.unr MUSIC={Chizra1,Crater,DigSh,Dusk,EndEx,EverSmoke,Fifth,Fly[Bb]y,Fourth,Guardian,Hub2,Isotoxin,Kran2,Kran32,K_vision,Nali,Newmca{13,16,7,9},Opal,QueenSong,Seti,SkyTwn,Spire,Surface,Unreal4,UTemple,utend,Vortex,WarGate,Warlord,Boundary,Ending,Found99,Gala,Inter,Journey,Moroset,Mountain,Neve,Return,Sacred,SpaceMarines,Starseek,Title,Twilight,Watcher}.umx SOUNDS={Marine,Scout}.uax SYSTEM={{Core,Engine,Unreal{,I,Share},Window,{Female{1,2},Male{1,2,3},SkTrooper}Skins}.int,UDSDemo.u,UPak.{int,u},User.ini} TEXTURES={Castle1,Langs,UPakFonts}.utx LOCALIZED_SOUNDS={EndSnd,Interm{1,2,3,4,5,6,7,8,9,10,11,12,13,14},IntroSnd2}.uax LOCALIZED_SYSTEM={Abyss,Core,CrashSite{,1,2},Dm{Athena,Daybreak,Hazard,Stomp,Sunspeak,Terra},DuskFalls,Eldora,Foundry,Glathriel{1,2},Inter{1,2,3,4,5,6,7,8,9,10,11,12,13,14,Crashsite,Intro},Nagomi,NaliC2,Nevec,SpireLand,Toxic,UDSDemo,UPack,Unreal{,I,Share},Upak,Velora,Window} if [[ "${U_SOURCE}" == "anthology" ]] ; then # Symlinks for unshield. ln -sfn "${CDROM_ROOT}"/Disk1/data1.hdr "${T}" ln -sfn "${CDROM_ROOT}"/Disk*/data*.cab "${T}" CAB_GROUPS="Maps Music Sounds_English Sounds_All System_All System_English Textures" # The manual is pretty heavy at 10MB! use doc && CAB_GROUPS="${CAB_GROUPS} Manual_English" # Add requested language components. The manuals are all in English!? use linguas_de && CAB_GROUPS="${CAB_GROUPS} Sounds_German System_German" 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" # Unpack! for x in ${CAB_GROUPS} ; do unshield -g 1_UnrealGold_${x} x "${T}"/data1.cab || die "unshield x" done # Retrieve the manual. if use doc ; then mv 1_UnrealGold_Manual_English/Manual.pdf manual_en.pdf || die "mv manual_en.pdf" fi eval mv -f 1_UnrealGold_Maps/${MAPS} Maps || die "mv Maps" eval mv -f 1_UnrealGold_Music/${MUSIC} Music || die "mv Music" eval mv -f 1_UnrealGold_Textures/${TEXTURES} Textures || die "mv Textures" # Move generic sounds. eval mv -f 1_UnrealGold_Sounds_All/${SOUNDS} Sounds || die "mv Sounds (generic)" # Move English sounds. eval mv -f 1_UnrealGold_Sounds_English/${LOCALIZED_SOUNDS} Sounds || die "mv Sounds (English)" # Move German sounds. if use linguas_de ; then mkdir -p Sounds/det || die "mkdir Sounds/det" eval mv -f 1_UnrealGold_Sounds_German/${LOCALIZED_SOUNDS} Sounds/det || die "mv Sounds (det)" fi # Move Spanish sounds. if use linguas_es ; then mkdir -p Sounds/est || die "mkdir Sounds/est" eval mv -f 1_UnrealGold_Sounds_Spanish/${LOCALIZED_SOUNDS} Sounds/est || die "mv Sounds (est)" fi # Move French sounds. if use linguas_fr ; then mkdir -p Sounds/frt || die "mkdir Sounds/frt" eval mv -f 1_UnrealGold_Sounds_French/${LOCALIZED_SOUNDS} Sounds/frt || die "mv Sounds (frt)" fi # Move Italian sounds. if use linguas_it ; then mkdir -p Sounds/itt || die "mkdir Sounds/itt" eval mv -f 1_UnrealGold_Sounds_Italian/${LOCALIZED_SOUNDS} Sounds/itt || die "mv Sounds (itt)" fi # Move system files. eval mv -f 1_UnrealGold_System_{All,English}/${SYSTEM} System 2> /dev/null eval mv -f 1_UnrealGold_System_*/${LOCALIZED_SYSTEM}.{det,est,frt,itt} System 2> /dev/null rm -rf 1_UnrealGold_* else eval cp -f "${CDROM_ROOT}/${MAPS_DIR}"/${MAPS} Maps || die "cp Maps" eval cp -f "${CDROM_ROOT}/${MUSIC_DIR}"/${MUSIC} Music || die "cp Music" eval cp -f "${CDROM_ROOT}/${SYSTEM_DIR}"/${SYSTEM} System || die "cp System" eval cp -f "${CDROM_ROOT}/${TEXTURES_DIR}"/${TEXTURES} Textures || die "cp Textures" # 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}/int"/${LOCALIZED_SOUNDS} Sounds || die "cp Sounds (English)" # Copy localized sounds and system files. for lang in de es fr it ; do if use linguas_${lang} ; then mkdir -p Sounds/${lang}t || die "mkdir Sounds/${lang}t" eval cp -f "${CDROM_ROOT}/${SOUNDS_DIR}/${lang}t"/${LOCALIZED_SOUNDS} Sounds/${lang}t || die "cp Sounds (${lang}t)" eval cp -f "${CDROM_ROOT}/${SYSTEM_DIR}"/${LOCALIZED_SYSTEM}.${lang}t System || die "cp System (${lang}t)" fi done fi # Copy Unreal Gold credit files. cp -f u1-on-ut-${PVR}/UGoldCredits.utx Textures || die "cp UGoldCredits.utx" cp -f u1-on-ut-${PVR}/UGCredits.unr Maps || die "cp UGCredits.unr" # Copy UDSDemo.int. The RTNP version is no good. cp -f u1-on-ut-${PVR}/UDSDemo.int System || die "cp UDSDemo.int" for lang in de es fr it ; do if use linguas_${lang} ; then # Symlink localized system files to all necessary case combinations. *groan!* for x in `echo {Abyss,CrashSite{,1,2},DuskFalls,Eldora,Foundry,Glathriel{1,2},Inter{1,2,3,4,5,6,7,8,9,10,11,12,13,14,Crashsite},Nagomi,NaliC2,Nevec,SpireLand,Toxic,UPack,Upak,Velora}` ; do lower=`echo ${x} | tr A-Z a-z` || die "tr ${x}" ln -sfn ${x}.${lang}t System/${lower}.${lang}t || die "ln ${x}.${lang}t ${lower}.${lang}t" done ln -sfn Upak.${lang}t System/UPak.${lang}t || die "ln Upak.${lang}t UPak.${lang}t" # D[Mm] => DM- cd System for x in D[Mm]*.${lang}t ; do ln -sfn ${x} ${x/D[Mm]/DM-} || die "ln ${x} ${x/D[Mm]/DM-}" done cd .. fi done # D[Mm] => DM- cd Maps for x in D[Mm]*.unr ; do ln -sfn ${x} ${x/D[Mm]/DM-} || die "ln ${x} ${x/D[Mm]/DM-}" done cd .. # Fix server vulnerability - part of bug #44351. for lang in in de es fr it ; do if [[ -e "System/Core.${lang}t" ]] ; then sed -i "/^LoadClassMismatch=/s:%s.%s:%s:" "System/Core.${lang}t" || die "sed Core.${lang}t" fi done # Official UPak.u versions are no good for Linux or UT. case `md5sum System/UPak.u | head -c32` in "62dfe992125df92836eafe8627901d15") UPAK_PATCH="rtnp" einfo "Original RTNP UPak.u detected (patching required)" ;; "a38a4f05f72aed0928f55b7821b06bac") UPAK_PATCH="gold" einfo "Unreal Gold UPak.u detected (patching required)" ;; "bbd78b30bd661550d360f95ecd194925") UPAK_PATCH="" einfo "UsAaR33 and eagleAR's UPak.u detected (patching not required)" ;; *) UPAK_PATCH="" ewarn "Unsupported UPak.u detected" ewarn "Continuing anyway but the game is unlikely to work!" ;; esac # Patch UPak.u if necessary. if [[ -n "${UPAK_PATCH}" ]] ; then xdelta patch "u1-on-ut-${PVR}/UPak.u-${UPAK_PATCH}.xdp" System/UPak.u patched || die "xdelta patch UPak.u" mv -f patched System/UPak.u || die "mv patched" fi # Unreal Gold's UDSDemo.u is much more reliable than RTNP's when running under UT. if [[ `md5sum System/UDSDemo.u | head -c32` != "fbb1162ade9daae6e22ee1c82c8f8042" ]] ; then xdelta patch u1-on-ut-${PVR}/UDSDemo.u.xdp System/UDSDemo.u patched || die "xdelta patch UDSDemo.u" mv -f patched System/UDSDemo.u || die "mv patched" fi # On RTNP, Intro1.unr loads first and Upack.unr follows, whereas Unreal Gold follows with # Intro2.unr instead. We need the latter behaviour so patch when necessary. if [[ `md5sum Maps/Intro1.unr | head -c32` != "22edddc9d53f8b0ab7b8fc41d646efd2" ]] ; then xdelta patch u1-on-ut-${PVR}/Intro1.unr.xdp Maps/Intro1.unr patched || die "xdelta patch Intro1.unr" mv -f patched Maps/Intro1.unr || die "mv patched" fi # RTNP maps usually go in Maps/UPak. Symlink just in case. ln -sfn . Maps/UPak || die "ln UPak" # English sounds usually go in Sounds/int. Symlink just in case. ln -sfn . Sounds/int || die "ln int" # We have changed the game name to ReturnToNaPali. ln -sfn Unreal.int System/ReturnToNaPali.int || die "ln Unreal.int ReturnToNaPali.int" } src_install() { local x # Guard against executable flag potentially set. for x in `find -type f` ; do chmod 640 "${x}" || die done # System files. chmod 750 System/napali-bin System/*.so System/*.so.* || die # Move instead of copy to reduce disk stress. (-: # Permissions are corrected with prepgamesdirs below. dodir "${dir}" mv Maps Music Sounds System Textures Web "${Ddir}" || die "mv directories" # Script. exeinto "${dir}" doexe napali || die "doexe napali" # Icon. insinto "${dir}" doins "u1-on-ut-${PVR}/icon.xpm" || die "doins icon" # Desktop. games_make_wrapper napali ./napali "${dir}" newicon "u1-on-ut-${PVR}/icon.xpm" napali.xpm || die "newicon" make_desktop_entry unreal "Unreal: Return To Na Pali" napali.xpm # Manual. insinto /usr/share/doc/${PF} if [[ -f "manual_en.pdf" ]] ; then doins manual_en.pdf || die "doins manual_en.pdf" fi prepgamesdirs } pkg_postinst() { games_pkg_postinst elog "Unreal: Return To Na Pali was never released for Linux. This is an" elog "unsupported hack that runs on top of Unreal Tournament. These are the" elog "known issues." elog "" elog " - Audio driver: The OpenAL driver (ALAudio.ALAudioSubsystem) has been" elog " chosen regardless of which driver you use for UT. This is because the" elog " music sometimes fails to change and some maps fail to load at all when" elog " using the generic audio driver (Audio.GenericAudioSubsystem)." elog "" elog " - Bots: The bots do not work at all. Play UT instead." elog "" elog " - Multiplayer: This hack is not at all compatible with the official" elog " versions of RTNP. However, it should be compatible with itself." echo if use linguas_de || use linguas_es || use linguas_fr || use linguas_it ; then elog "You have installed support for one or more additional languages. The game" elog "defaults to English but you can change the language by running the game" elog "once and then editing ~/.loki/napali/System/ReturnToNaPali.ini. Change the" elog "Language entry under [Engine.Engine] to 'det', 'est', 'frt' or 'itt' and" elog "add a Path entry directly under [Core.System] with '..\\\\Sounds\\\\det\\\\*.uax'," elog "'..\\\\Sounds\\\\est\\\\*.uax', '..\\\\Sounds\\\\frt\\\\*.uax' or '..\\\\Sounds\\\\frt\\\\*.uax' for" elog "for German, Spanish, French or Italian respectively." echo fi if use linguas_de ; then elog "Unreal: Return To Na Pali was translated to German but Unreal Tournament" elog "wasn't so some text may appear in English even if you configure the game" elog "for German." echo fi }