#!/bin/bash

# Create user directory if it doesn't exist
if [ ! -d "$HOME/.nwn/"  ]; then
    mkdir $HOME/.nwn/
fi

cd "/opt/nwn"

# Uncomment to make SDL sound work on software mixers
#export SDL_AUDIODRIVER=esd
export SDL_MOUSE_RELATIVE=0
export SDL_VIDEO_X11_DGAMOUSE=0

# Hardware mouse cursor
export XCURSOR_PATH=/opt/nwn
export XCURSOR_THEME=nwmouse

# Enable AA on NVidia cards
# 3 = 1.5 x 1.5 super sampling
# 4 = 2x2 super sampling
export __GL_FSAA_MODE=4

export LD_PRELOAD=./nwuser.so:./nwuser64.so:./nwmouse.so:./nwmovies.so:./nwlogger.so

export LD_LIBRARY_PATH=./miles:$LD_LIBRARY_PATH
#run the game, allowing for executable flags
./nwmain $@