Subversion Repositories duke3d_hrp

Rev

Rev 412 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 412 Rev 415
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
 
2
 
3
# Duke Nukem 3D High Resolution Pack Extractor  v0.4.3  2012-11-06
3
# Duke Nukem 3D High Resolution Pack Extractor  v0.5  2012-12-23
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 working copy of your local Duke Nukem 3D High
8
# This script extracts a working copy of your local Duke Nukem 3D High
Line 447... Line 447...
447
  echo "$1"
447
  echo "$1"
448
  BLOCK_COMMENT="OFF"
448
  BLOCK_COMMENT="OFF"
449
  cat $1 | while read DEF_LINE; do
449
  cat $1 | while read DEF_LINE; do
450
 
450
 
451
    #DOS only: DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ //`
451
    #DOS only: DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ //`
452
    DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ // | sed s/\\\r//`
452
    #DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ // | sed s/\\\r//`
-
 
453
    DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ // | sed s/\\\/\\\/.*// | sed s/\\\r//`
453
    if [ "${DEF_FILE}" != "" ] ; then
454
    if [ "${DEF_FILE}" != "" ] ; then
454
      cp -p      "${DEF_FILE}" "${EXTRACTDIR}/${DEF_FILE}"
455
      cp -p      "${DEF_FILE}" "${EXTRACTDIR}/${DEF_FILE}"
455
      parse_defs "${DEF_FILE}"
456
      parse_defs "${DEF_FILE}"
456
    fi
457
    fi
457
 
458
 
458
    #HRP_TERM=`echo "${DEF_LINE}" | grep -owE "file|model|voxel|front|right|back|left|top|bottom|down"`
459
    #HRP_TERM=`echo "${DEF_LINE}" | grep -owE "file|model|voxel|front|right|back|left|top|bottom|down"`
459
    ## Old style added (except "defineskybox"):
460
    ## Old style added (except "defineskybox"):
460
    HRP_TERM=`echo "${DEF_LINE}" | grep -owE "definetexture|definemodel|definemodelskin|file|model|voxel|front|right|back|left|top|bottom|down"`
461
    HRP_TERM=`echo "${DEF_LINE}" | grep -owE "definetexture|definemodel|definemodelskin|file|mhkfile|model|voxel|front|right|back|left|top|bottom|down"`
461
    #More skybox tokens: tile, pal, ft|rt|bk|lf|up|dn|forward|lt|ceiling|floor|ceil
462
    #More skybox tokens: tile, pal, ft|rt|bk|lf|up|dn|forward|lt|ceiling|floor|ceil
462
 
463
 
463
    if [ ! "$EXTRACT_COMMENTED_FILES" = "YES" ] ; then
464
    if [ ! "$EXTRACT_COMMENTED_FILES" = "YES" ] ; then
464
 
465
 
465
      COMMENT_TERM=`echo "${DEF_LINE}" | grep -oE "\\/\\*|\\*\\/"`
466
      COMMENT_TERM=`echo "${DEF_LINE}" | grep -oE "\\/\\*|\\*\\/"`
Line 477... Line 478...
477
      fi
478
      fi
478
 
479
 
479
    fi
480
    fi
480
 
481
 
481
    case "$HRP_TERM" in
482
    case "$HRP_TERM" in
482
      file)
483
      file|mhkfile)
483
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r s/^.*file\ *\"//g | sed s/\".*//`
484
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r s/^.*file\ *\"//g | sed s/\".*//`
484
        # Mastering the backslash :-) ... hm, no big performance gain ... :
485
        # Mastering the backslash :-) ... hm, no big performance gain ... :
485
        HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*file\\ *\"\\)\\([^\"]*\\)\\(.*\\)/\\\2/`
486
        HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*file\\ *\"\\)\\([^\"]*\\)\\(.*\\)/\\\2/`
486
        # Ignore comments WIP:
487
        # Ignore comments WIP:
487
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*file\\ *\\)\\(\\"\\(.*\\)\\"\\)\\(.*\\)/\\\3/`
488
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*file\\ *\\)\\(\\"\\(.*\\)\\"\\)\\(.*\\)/\\\3/`