Subversion Repositories duke3d_hrp

Rev

Rev 331 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 331 Rev 333
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
2
3
# Duke Nukem 3D High Resolution Pack Extractor  v0.2  2012-03-17
3
# Duke Nukem 3D High Resolution Pack Extractor  v0.3  2012-03-24
4
#
4
#
5
# Author: LeoD
5
# Author: LeoD
6
# License: ISC license : http://opensource.org/licenses/isc-license.txt
6
# License: ISC license : http://opensource.org/licenses/isc-license.txt
7
#
7
#
8
# This script extracts a PolyMER or PolyMOST only HRP from your working copy of
8
# This script extracts a PolyMER or PolyMOST only HRP from your working copy
9
# the Duke Nukem 3D High Resolution Pack's Subversion repository.
9
# of the Duke Nukem 3D High Resolution Pack's Subversion repository.
10
# On Windows you need MSYS' zip to create package files.
10
# On Windows you might want MSYS' zip to create package files.
11
# ("mingw-get install msys-zip")
11
# ("mingw-get install msys-zip")
12
# MinGW/MSYS performance is horrible, better go Linux. Even my virtual Debian
12
# MinGW/MSYS performance is horrible, better go Linux. Even my virtual Debian
13
# machine accessing the Windows drive is 5 to 10 times faster.
13
# machine accessing the Windows drive is 5 to 10 times faster.
14
# But it still sucks. This needs to become a Perl script one day.
14
# But it still sucks. This needs to become a Perl script one day.
15
# Or maybe MSYS bash gets finally updated to 4.* and I'll use its regex engine.
15
# Or maybe MSYS' bash gets finally updated to 4.* and I'll use its regex engine.
16
16
17
DEF_TOP=UNDEFINED
17
DEF_TOP=UNDEFINED
18
SET_VERSION=YES            # [YES|NO]
18
SET_VERSION=YES            # [YES|NO]
19
EXTRACT_COMMENTED_FILES=NO # [YES|NO]
19
EXTRACT_COMMENTED_FILES=NO # [YES|NO]
20
DUKEPLUS_POLYMOST_COMPATIBILTY_APPROACH=none # [none|polymost|polymer|mixed]
20
DUKEPLUS_POLYMOST_COMPATIBILTY_APPROACH=none # [none|polymost|polymer|mixed]
Line 170... Line 170...
170
    cp -p  *.mhk                  "${EXTRACTDIR}"
170
    cp -p  *.mhk                  "${EXTRACTDIR}"
171
  fi
171
  fi
172
172
173
  if [ "${HRPTYPE}" = "sw_highres" ] ; then
173
  if [ "${HRPTYPE}" = "sw_highres" ] ; then
174
    cp -pv sw.def                   "${EXTRACTDIR}"
174
    cp -pv sw.def                   "${EXTRACTDIR}"
175
    cp -pv highres/sw.def           "${EXTRACTDIR}/highres"
175
    cp -pv highres/sw_hrp.def       "${EXTRACTDIR}/highres"
176
    cp -pv HRP.bat                  "${EXTRACTDIR}"
176
    cp -pv HRP.bat                  "${EXTRACTDIR}"
177
    cp -pv HRP_Readme.txt           "${EXTRACTDIR}"
177
    cp -pv HRP_Readme.txt           "${EXTRACTDIR}"
178
    cp -pv HRP_Changes.txt          "${EXTRACTDIR}"
178
    cp -pv HRP_Changes.txt          "${EXTRACTDIR}"
179
    echo "Copying skyboxes ..."
179
    echo "Copying skyboxes ..."
180
    tar_copy_dir "highres/skyboxes" "${EXTRACTDIR}/highres/skyboxes"
180
    tar_copy_dir "highres/skyboxes" "${EXTRACTDIR}/highres/skyboxes"
181
    cd "${WORKDIR}"
181
    cd "${WORKDIR}"
182
  fi
182
  fi
183
183
184
  if [ "${HRPTYPE}" = "sw_lowres" ] ; then
184
  if [ "${HRPTYPE}" = "sw_lowres" ] ; then
185
    cp -pv lowres/sw.def            "${EXTRACTDIR}/lowres"
185
    cp -pv lowres/sw_lrp.def        "${EXTRACTDIR}/lowres"
186
    cp -pv LRP.bat                  "${EXTRACTDIR}"
186
    cp -pv LRP.bat                  "${EXTRACTDIR}"
187
    cp -pv LRP_Readme.txt           "${EXTRACTDIR}"
187
    cp -pv LRP_Readme.txt           "${EXTRACTDIR}"
188
    cp -pv LRP_Changes.txt          "${EXTRACTDIR}"
188
    cp -pv LRP_Changes.txt          "${EXTRACTDIR}"
189
    echo "Copying skyboxes ..."
189
    echo "Copying skyboxes ..."
190
    tar_copy_dir "highres/skyboxes" "${EXTRACTDIR}/highres/skyboxes"
190
    tar_copy_dir "highres/skyboxes" "${EXTRACTDIR}/highres/skyboxes"
Line 387... Line 387...
387
    if [ "${DEF_FILE}" != "" ] ; then
387
    if [ "${DEF_FILE}" != "" ] ; then
388
      cp -p      "${DEF_FILE}" "${EXTRACTDIR}/${DEF_FILE}"
388
      cp -p      "${DEF_FILE}" "${EXTRACTDIR}/${DEF_FILE}"
389
      parse_defs "${DEF_FILE}"
389
      parse_defs "${DEF_FILE}"
390
    fi
390
    fi
391
391
392
    HRP_TERM=`echo "${DEF_LINE}" | grep -owE "file|model|voxel|front|right|back|left|top|down"`
392
    HRP_TERM=`echo "${DEF_LINE}" | grep -owE "file|model|voxel|front|right|back|left|top|bottom|down"`
-
 
393
    #More skybox tokens: tile, pal, ft|rt|bk|lf|up|dn|forward|lt|ceiling|floor|ceil
393
394
394
    if [ ! "$EXTRACT_COMMENTED_FILES" = "YES" ] ; then
395
    if [ ! "$EXTRACT_COMMENTED_FILES" = "YES" ] ; then
395
396
396
      COMMENT_TERM=`echo "${DEF_LINE}" | grep -oE "\\/\\*|\\*\\/"`
397
      COMMENT_TERM=`echo "${DEF_LINE}" | grep -oE "\\/\\*|\\*\\/"`
397
      if [ "$COMMENT_TERM"  = "/*" ] ; then BLOCK_COMMENT="ON" ; fi
398
      if [ "$COMMENT_TERM"  = "/*" ] ; then BLOCK_COMMENT="ON" ; fi
Line 418... Line 419...
418
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*file\\ *\\)\\(\\"\\(.*\\)\\"\\)\\(.*\\)/\\\3/`
419
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*file\\ *\\)\\(\\"\\(.*\\)\\"\\)\\(.*\\)/\\\3/`
419
        ;;
420
        ;;
420
      model|voxel)
421
      model|voxel)
421
        HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*${HRP_TERM}\\ *\"\\)\\([^\"]*\\)\\(.*\\)/\\\2/`
422
        HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*${HRP_TERM}\\ *\"\\)\\([^\"]*\\)\\(.*\\)/\\\2/`
422
        ;;
423
        ;;
423
      front|right|back|left|top|down)
424
      front|right|back|left|top|bottom|down)
424
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r s/^.*${HRP_TERM}\ *\"//g | sed s/\".*//`
425
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r s/^.*${HRP_TERM}\ *\"//g | sed s/\".*//`
425
        HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*${HRP_TERM}\\ *\"\\)\\([^\"]*\\)\\(.*\\)/\\\2/`
426
        HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*${HRP_TERM}\\ *\"\\)\\([^\"]*\\)\\(.*\\)/\\\2/`
426
        ;;
427
        ;;
427
      *)
428
      *)
428
        HRP_FILE=""
429
        HRP_FILE=""
Line 508... Line 509...
508
  fi
509
  fi
509
  if [ "${HRPTYPE}" = "voxel" ] ; then
510
  if [ "${HRPTYPE}" = "voxel" ] ; then
510
    parse_defs duke3d_voxel.def
511
    parse_defs duke3d_voxel.def
511
  fi
512
  fi
512
  if [ "${HRPTYPE}" = "sw_highres" ] ; then
513
  if [ "${HRPTYPE}" = "sw_highres" ] ; then
513
    parse_defs highres/sw.def
514
    parse_defs highres/sw_hrp.def
514
  fi
515
  fi
515
  if [ "${HRPTYPE}" = "sw_lowres" ] ; then
516
  if [ "${HRPTYPE}" = "sw_lowres" ] ; then
516
    parse_defs lowres/sw.def
517
    parse_defs lowres/sw_lrp.def
517
  fi
518
  fi
518
  if [ "${HRPTYPE}" = "default" ] ; then
519
  if [ "${HRPTYPE}" = "default" ] ; then
519
    parse_defs "${DEF_TOP}"
520
    parse_defs "${DEF_TOP}"
520
  fi
521
  fi
521
522
Line 542... Line 543...
542
543
543
cd               "${HRPROOT}"
544
cd               "${HRPROOT}"
544
echo  "PWD     :  ${WORKDIR}"
545
echo  "PWD     :  ${WORKDIR}"
545
echo  "HRPROOT :  ${HRPROOT}"
546
echo  "HRPROOT :  ${HRPROOT}"
546
547
547
if [ ! -f "./duke3d.def" ] ; then
-
 
548
  if [ ! -f "./${HRPTYPE}.def" ] ; then
548
#if [ ! -f "./duke3d.def" ] && [ ! "${HRPTYPE}" = "default" ] ; then
549
    echo "ERROR : ./duke3d.def or ./${HRPTYPE}.def not found. This is no HRP root directory. Exit."
549
#  echo "ERROR : ./duke3d.def not found. This is no HRP root directory. Exit."
550
    exit 1
550
#  exit 1
551
  fi
-
 
552
fi
551
#fi
553
552
554
case "$HRPTYPE" in
553
case "$HRPTYPE" in
555
  polymer|polymost_override|polymost)
554
  polymer|polymost_override|polymost)
556
    main $HRPTYPE
555
    main $HRPTYPE
557
    ;;
556
    ;;
Line 600... Line 599...
600
    ;;
599
    ;;
601
  debug)
600
  debug)
602
    echo "Nothing to debug."
601
    echo "Nothing to debug."
603
    ;;
602
    ;;
604
  *)
603
  *)
-
 
604
    #if [ ! -f "./${HRPTYPE}.def" ] ; then
-
 
605
    #  echo "ERROR : ./${HRPTYPE}.def not found. This is no HRP root directory. Exit."
-
 
606
    #  exit 1
-
 
607
    #fi
605
    if [ -f "${HRPTYPE}.def" ] ; then
608
    if [ -f "${HRPTYPE}.def" ] ; then
606
      DEF_TOP="${HRPTYPE}.def"
609
      DEF_TOP="${HRPTYPE}.def"
607
      HRPTYPE=default
610
      HRPTYPE=default
608
      SET_VERSION=NO
611
      SET_VERSION=NO
609
      EXTRACT_COMMENTED_FILES=NO
612
      EXTRACT_COMMENTED_FILES=NO