Forums

[Script] Aliens versus Predator 2

Auteur Réponses
Xenos5 Dimanche 19 Octobre 2014 à 20:05
Xenos5

The second instalment in the Aliens versus Predator game franchise, developed by Monolith. This game precedes the 2010 Aliens vs Predator game.

In terms of the script, you'll notice I'm using an ancient wine version. All the ones since 1.3.37 have ridiculously bad performance, as well as a menu glitch where certain lists of options become invisible if you mouse over them. 1.3.37 is buttery smooth and glitch-free. The disadvantages are a mouse bug and a lack of multi-monitor capability, fixed by maxing the in-game mouse smoothness setting, and turning on virtual desktop, respectively.

I've hand-rolled a resolution detection routine; I'm aware of POL_LoadVar_ScreenResolution, but it gives the wrong result on my multi-monitor setup (the total size of my virtual screen, not even considering the fact that some of the non-primary monitors are less tall than the primary). My script uses xrandr to get the primary monitor resolution, and if that doesn't work for whatever reason, asks the user. Let me know if that's too hacky.
 

#!/bin/bash
# Date : (2014-10-19T13:56Z)
# Last revision : (2014-10-19T13:56Z)
# Wine version used : 1.3.37
# Distribution used to test : Arch Linux
# Author : Alexander Borysov
# Script licence : GPLv3
# Program licence: Proprietary

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TITLE="Aliens versus Predator 2"
PREFIX="AVP2"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "Fox Interactive" "" "Alexander Borysov" "$PREFIX"
POL_Wine_SelectPrefix "$PREFIX"
POL_SetupWindow_wait "$(eval_gettext "Please wait while the wine prefix is created.")" "$TITLE"
POL_Wine_PrefixCreate "1.3.37"

POL_SetupWindow_InstallMethod "LOCAL,DVD"

if [ "$INSTALL_METHOD" = "DVD" ]; then
    POL_SetupWindow_cdrom
    POL_SetupWindow_check_cdrom "ALIEN.REZ"
    POL_SetupWindow_message "$(eval_gettext "If prompted to install DirectX 8, click No")" "$TITLE"
    POL_Wine_WaitBefore "$TITLE"
    POL_Wine "$CDROM/Setup.exe"
elif [ "$INSTALL_METHOD" = "LOCAL" ]; then
    POL_SetupWindow_browse "$(eval_gettext "Please select the setup file to run.")" "$TITLE"
    POL_Wine_WaitBefore "$TITLE"
    POL_Wine "$APP_ANSWER"
fi

# determine the user's resolution
RES_STR="$(xrandr -q | grep primary | grep -oE "[0-9]+x[^+]+")"
if [ "$RES_STR" = "" ]; then
    # xrandr does not exist on the system
    POL_SetupWindow_textbox "$(eval_gettext "What is the resolution of your primary monitor?")" "$TITLE" "1920x1080"
    RES_STR="$APP_ANSWER"
fi
WIDTH=`echo "$RES_STR" | cut -d x -f 1`
HEIGHT=`echo "$RES_STR" | cut -d x -f 2`

Set_Desktop "On" "$WIDTH" "$HEIGHT"
Set_OS "win98"
POL_Wine_X11Drv "GrabFullscreen" "Y"

POL_Shortcut "AVP2.exe" "$TITLE" ""

# configure resolution
INSTALL_DIR="$(dirname "$(find_binary AVP2.exe)")"
AEX="$WINEPREFIX/drive_c/$INSTALL_DIR/autoexec.cfg"

sed -i "s/.*SCREENWIDTH.*/\"SCREENWIDTH\" \"$WIDTH\"/" "$AEX"
sed -i "s/.*SCREENHEIGHT.*/\"SCREENHEIGHT\" \"$HEIGHT\"/" "$AEX"
sed -i "s/.*GameScreenWidth.*/\"GameScreenWidth\" \"$WIDTH\"/" "$AEX"
sed -i "s/.*GameScreenHeight.*/\"GameScreenHeight\" \"$HEIGHT\"/" "$AEX"

# alas, the following step cannot be automated with sed
# the game rewrites the INPUTRATE variable on first start
POL_SetupWindow_message "$(eval_gettext "To get rid of the mouse issues, turn the mouse smoothing setting in the in-game controls up to full.")" "$TITLE"
POL_SetupWindow_Close
exit

Screenshots:



 



Aliens versus Predator-22x22.png


Aliens versus Predator-48x48.png



Unfortunately, there don't seem to be any passable top or left images around; even the official installer uses generic installation images.

Edité par Xenos5

Xenos5 Dimanche 19 Octobre 2014 à 20:13
Xenos5

Here's the script for the latest patch.

#!/bin/bash
# Date : (2014-10-16T07:55Z)
# Last revision : (2014-10-16T07:55Z)
# Distribution used to test : Arch Linux
# Author : Alexander Borysov
# Script licence : GPLv3
# Program licence: Proprietary

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

EN_ID=845631
ES_ID=845633
DE_ID=845630
FR_ID=845634
IT_ID=845635

TITLE_REQUIRED="Aliens Versus Predator 2"
TITLE="$TITLE_REQUIRED Patch 1.0.9.6"
PREFIX="AVP2"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "Fox Interactive" "" "Alexander Borysov" "$PREFIX"

if [ "$(POL_Wine_PrefixExists $PREFIX)" != "True" ]; then
    POL_SetupWindow_message "$(eval_gettext 'Please install $TITLE_REQUIRED first')" "$TITLE"
    POL_SetupWindow_Close
    exit
fi
 
POL_Wine_SelectPrefix "$PREFIX"

POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"

if [ "$INSTALL_METHOD" = "DOWNLOAD" ]; then
    POL_SetupWindow_menu_num "$(eval_gettext 'Please select the game language')" "$TITLE" "$(eval_gettext 'English')~$(eval_gettext 'Spanish')~$(eval_gettext 'German')~$(eval_gettext 'French')~$(eval_gettext 'Italian')" "~"
    if [ "$APP_ANSWER" = "0" ]; then
        ID=$EN_ID
    elif [ "$APP_ANSWER" = "1" ]; then
        ID=$ES_ID
    elif [ "$APP_ANSWER" = "2" ]; then
        ID=$DE_ID
    elif [ "$APP_ANSWER" = "3" ]; then
        ID=$FR_ID
    elif [ "$APP_ANSWER" = "4" ]; then
        ID=$IT_ID
    else
        POL_Debug_Fatal "$(eval_gettext 'Could not parse game language response')"
        POL_SetupWindow_Close
        exit
    fi

    POL_System_TmpCreate "$PREFIX"
    URI="${POL_System_TmpDir}/avp2_096.exe"
    POL_Call POL_Gamefront_Download "$ID" "$POL_System_TmpDir" "$URI" "$TITLE"
    PATCHNAME="$URI"
elif [ "$INSTALL_METHOD" = "LOCAL" ]; then
    POL_SetupWindow_browse "$(eval_gettext "Please select the setup file to run.")" "$TITLE"
    PATCHNAME="$APP_ANSWER"
fi

POL_Wine_WaitBefore "$TITLE"
POL_Wine "$PATCHNAME"

POL_SetupWindow_Close
exit
Retro Gamer Vendredi 24 Octobre 2014 à 11:26
Retro Gamer

That's great. Good reason to dig that one out and play again.



"..So long and thanks for all the fish."
Xenos5 Dimanche 29 Mars 2015 à 7:17
Xenos5

I've found a patch that properly fixes the mouse issues I mentioned above. I've submitted a build request at https://www.playonlinux.com/en/issue-5029.html

Once that's done, I'll update the script to change the wine version, and remove the prompt to do the input rate workaround. On that note, I would like somebody official to then review this script for submission to the script db. :D

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmcayonlinux.com