Subversion Repositories duke3d_hrp

Rev

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

Rev 320 Rev 324
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
 
2
 
3
# Duke Nukem 3D High Resolution Pack Extractor  v0.1  2012-03-14
3
# Duke Nukem 3D High Resolution Pack Extractor  v0.2  2012-03-17
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 of
9
# the Duke Nukem 3D High Resolution Pack's Subversion repository.
9
# the Duke Nukem 3D High Resolution Pack's Subversion repository.
10
# Note : "//" and "/* */"-like comments in DEF files are currently ingnored and
-
 
11
# may lead to false warning messages or copying of actually unused files.
-
 
12
# On Windows you need MSYS' zip to create package files.
10
# On Windows you need MSYS' zip to create package files.
13
# ("mingw-get install msys-zip")
11
# ("mingw-get install msys-zip")
14
# 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
15
# machine accessing the Windows drive is 5 to 10 times faster.
13
# machine accessing the Windows drive is 5 to 10 times faster.
16
# 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.
-
 
16
 
-
 
17
SET_VERSION=YES # [YES|NO]
-
 
18
EXTRACT_COMMENTED_FILES=NO # [YES|NO]
-
 
19
DUKEPLUS_POLYMOST_COMPATIBILTY_APPROACH=none # [none|polymost|polymer|mixed]
17
 
20
 
18
ask()
21
ask()
19
{
22
{
20
  echo -n "$@" '[y/N] ' ; read ans
23
  echo -n "$@" '[y/N] ' ; read ans
21
  case "$ans" in
24
  case "$ans" in
Line 43... Line 46...
43
    fi
46
    fi
44
  done
47
  done
45
} # copy_folders()
48
} # copy_folders()
46
 
49
 
47
 
50
 
-
 
51
copy_set_version()
-
 
52
{
-
 
53
  VER_FILE="$1"
-
 
54
  TARGET_FILE="$2"
-
 
55
  V_DATE=`date +%F`
-
 
56
  if [ "${VERSION}" = "" ] ; then
-
 
57
    if [ -f VERSION ] ; then
-
 
58
      VERSION=`grep -owE "[0-9\\.]*" VERSION`
-
 
59
    fi
-
 
60
  fi
-
 
61
 
-
 
62
  echo "copy_set_version ${VER_FILE} -> ${TARGET_FILE}"
-
 
63
 
-
 
64
  case "${VER_FILE}" in
-
 
65
    hrp_readme.txt)
-
 
66
      cat "${VER_FILE}" | sed -r --posix \
-
 
67
        s/\(Version\ *\)\([0-9\.]*\)\(.*\)\(\\\)\)\(.*\)/\\1${VERSION}\ \(${V_DATE}\)\ \ \\5/ \
-
 
68
        >> "${TARGET_FILE}"
-
 
69
      ;;
-
 
70
    duke3d_hrp.def)
-
 
71
      cat "${VER_FILE}" | sed -r --posix \
-
 
72
        s/\(Version\ *\)\([0-9\.]*\)\(.*\)/\\1${VERSION}\\3/ \
-
 
73
        >> "${TARGET_FILE}"
-
 
74
      ;;
-
 
75
    duke3d_hrp_polymost.def)
-
 
76
      if [ "${HRPTYPE}" = "polymost_override" ] ; then
-
 
77
        cat "${VER_FILE}" | sed -r --posix \
-
 
78
          s/\(Version\ *\)\([0-9\.]*\)\(\ Polymost\)/\\1${VERSION}\ Polymost\ Override/ \
-
 
79
          >> "${TARGET_FILE}"
-
 
80
      else
-
 
81
        cat "${VER_FILE}" | sed -r --posix \
-
 
82
          s/\(Version\ *\)\([0-9\.]*\)\(.*\)/\\1${VERSION}\\3/ \
-
 
83
          >> "${TARGET_FILE}"
-
 
84
      fi
-
 
85
      ;;
-
 
86
    *)
-
 
87
      echo "###ERROR: copy_set_version() - BAD FILE: ${VER_FILE}"
-
 
88
      exit 1
-
 
89
      ;;
-
 
90
  esac
-
 
91
}
-
 
92
 
48
copy_known_files()
93
copy_known_files()
49
{
94
{
-
 
95
  if [ "${SET_VERSION}" = "YES" ] ; then
-
 
96
    copy_set_version hrp_readme.txt "${EXTRACTDIR}/hrp_readme.txt"
-
 
97
  else
50
  cp -pv *.txt      "${EXTRACTDIR}"
98
    cp -pv hrp_readme.txt           "${EXTRACTDIR}"
-
 
99
  fi
-
 
100
  cp -pv hrp_art_license.txt        "${EXTRACTDIR}"
51
 
101
 
52
  if [ "${HRPTYPE}" = "polymost" ] || [ "${HRPTYPE}" = "polymost_override" ] ; then
102
  if [ "${HRPTYPE}" = "polymost" ] || [ "${HRPTYPE}" = "polymost_override" ] ; then
-
 
103
    if [ "${SET_VERSION}" = "YES" ] ; then
-
 
104
      copy_set_version duke3d_hrp_polymost.def "${EXTRACTDIR}/duke3d_hrp.def"
-
 
105
    else
53
    cp -pv duke3d_hrp_polymost.def "${EXTRACTDIR}/duke3d_hrp.def"
106
      cp -pv           duke3d_hrp_polymost.def "${EXTRACTDIR}/duke3d_hrp.def"
-
 
107
    fi
54
  fi
108
  fi
55
 
109
 
56
  if [ "${HRPTYPE}" = "polymost" ] ; then
110
  if [ "${HRPTYPE}" = "polymost" ] ; then
57
    cp -pv duke3d.def "${EXTRACTDIR}"
111
    cp -pv duke3d.def "${EXTRACTDIR}"
58
    #cp -pv duke3d_hrp_polymost.def               "${EXTRACTDIR}"
112
    #cp -pv duke3d_hrp_polymost.def               "${EXTRACTDIR}"
59
    #cp -pv highres/screen/menu/2492_polymost.png "${EXTRACTDIR}/highres/screen/menu"
113
    #cp -pv highres/screen/menu/2492_polymost.png "${EXTRACTDIR}/highres/screen/menu"
60
  fi
114
  fi
61
 
115
 
62
  if [ "${HRPTYPE}" = "full" ] ; then
116
  if [ "${HRPTYPE}" = "full" ] ; then
-
 
117
    if [ "${SET_VERSION}" = "YES" ] ; then
-
 
118
      copy_set_version duke3d_hrp_polymost.def "${EXTRACTDIR}/duke3d_hrp_polymost.def"
-
 
119
    else
63
    cp -pv duke3d_hrp_polymost.def "${EXTRACTDIR}"
120
      cp -pv           duke3d_hrp_polymost.def "${EXTRACTDIR}"
-
 
121
    fi
64
  fi
122
  fi
65
 
123
 
66
  if [ "${HRPTYPE}" = "polymost_override" ] || [ "${HRPTYPE}" = "full" ] ; then
124
  if [ "${HRPTYPE}" = "polymost_override" ] || [ "${HRPTYPE}" = "full" ] ; then
67
    cp -pv highres/screen/menu/2492_ver_polymost.png "${EXTRACTDIR}/highres/screen/menu"
125
    cp -pv highres/screen/menu/2492_ver_polymost.png "${EXTRACTDIR}/highres/screen/menu"
68
  fi
126
  fi
69
 
127
 
70
  if [ "${HRPTYPE}" = "polymer" ] || [ "${HRPTYPE}" = "full" ] ; then
128
  if [ "${HRPTYPE}" = "polymer" ] || [ "${HRPTYPE}" = "full" ] ; then
71
    cp -pv duke3d.def                   "${EXTRACTDIR}"
129
    cp -pv duke3d.def                   "${EXTRACTDIR}"
-
 
130
    if [ "${SET_VERSION}" = "YES" ] ; then
-
 
131
      copy_set_version duke3d_hrp.def "${EXTRACTDIR}/duke3d_hrp.def"
-
 
132
    else
72
    cp -pv duke3d_hrp.def               "${EXTRACTDIR}"
133
      cp -pv           duke3d_hrp.def "${EXTRACTDIR}"
-
 
134
    fi
73
    echo                  "\`*.mhk' -> \`${EXTRACTDIR}/*.mhk'"
135
    echo                  "\`*.mhk' -> \`${EXTRACTDIR}/*.mhk'"
74
    cp -p  *.mhk                        "${EXTRACTDIR}"
136
    cp -p  *.mhk                        "${EXTRACTDIR}"
75
    #cp -pv highres/screen/menu/2492.png "${EXTRACTDIR}/highres/screen/menu"
137
    #cp -pv highres/screen/menu/2492.png "${EXTRACTDIR}/highres/screen/menu"
76
 
138
 
77
    #cp -pv highres/common/black.png                       "${EXTRACTDIR}/highres/common"
139
    #cp -pv highres/common/black.png                          "${EXTRACTDIR}/highres/common"
78
    #cp -pv highres/screen/fonts/digital/digital_minus.png "${EXTRACTDIR}/highres/screen/fonts/digital"
140
    #cp -pv highres/screen/fonts/digital/digital_minus.png    "${EXTRACTDIR}/highres/screen/fonts/digital"
79
    #cp -pv highres/screen/menu/2493_old.png               "${EXTRACTDIR}/highres/screen/menu"
141
    #cp -pv highres/screen/menu/2493_old.png                  "${EXTRACTDIR}/highres/screen/menu"
80
    #cp -pv highres/sprites/monsters/1960_reconcar_s.png   "${EXTRACTDIR}/highres/sprites/monsters"
142
    #cp -pv highres/screen/menu/widescreen/*_wide.png         "${EXTRACTDIR}/highres/screen/menu"
81
    #cp -pv highres/sprites/props/4387.png                 "${EXTRACTDIR}/highres/sprites/props"
143
    #cp -pv highres/sprites/characters/1357_terminarm.md3     "${EXTRACTDIR}/highres/sprites/characters"
82
    #cp -pv highres/sprites/signs/4378.png                 "${EXTRACTDIR}/highres/sprites/signs"
-
 
83
    #cp -pv highres/sprites/signs/4379.png                 "${EXTRACTDIR}/highres/sprites/signs"
144
    #cp -pv highres/sprites/firstperson/2510_devastator_n.png "${EXTRACTDIR}/highres/sprites/firstperson"
84
    #cp -pv highres/sprites/signs/4381.png                 "${EXTRACTDIR}/highres/sprites/signs"
145
    #cp -pv highres/sprites/monsters/1960_reconcar_s.png      "${EXTRACTDIR}/highres/sprites/monsters"
85
    #cp -pv highres/sprites/signs/4382.png                 "${EXTRACTDIR}/highres/sprites/signs"
146
    #cp -pv highres/sprites/props/4387.png                    "${EXTRACTDIR}/highres/sprites/props"
86
    #cp -pv highres/sprites/signs/4383.png                 "${EXTRACTDIR}/highres/sprites/signs"
147
    #cp -pv highres/sprites/signs/4378.png                    "${EXTRACTDIR}/highres/sprites/signs"
87
    #cp -pv highres/sprites/signs/4384.png                 "${EXTRACTDIR}/highres/sprites/signs"
148
    #cp -pv highres/sprites/signs/4379.png                    "${EXTRACTDIR}/highres/sprites/signs"
88
    #cp -pv highres/sprites/signs/4385.png                 "${EXTRACTDIR}/highres/sprites/signs"
149
    #cp -pv highres/sprites/signs/4381-85.png                 "${EXTRACTDIR}/highres/sprites/signs"
89
  fi
150
  fi
90
 
151
 
91
} # copy_known_files()
152
} # copy_known_files()
92
 
153
 
93
 
154
 
Line 119... Line 180...
119
      else
180
      else
120
        echo "${MHK_LINE}" >> "${EXTRACTDIR}/${MHKFILE}"
181
        echo "${MHK_LINE}" >> "${EXTRACTDIR}/${MHKFILE}"
121
        MHK_INSERT=`echo "${MHK_LINE}" | grep -oE "sprite\ 96\ pitch\ 1"`
182
        MHK_INSERT=`echo "${MHK_LINE}" | grep -oE "sprite\ 96\ pitch\ 1"`
122
        if [ ! "${MHK_INSERT}" = "" ] ; then
183
        if [ ! "${MHK_INSERT}" = "" ] ; then
123
          echo "sprite 105 mdxoff 450000 // underwater slime babe (Polymost HRP)\r" \
184
          echo "sprite 105 mdxoff 450000 // underwater slime babe (Polymost HRP)\r" \
124
               >> "${EXTRACTDIR}/${MHKFILE}"
185
                                      >> "${EXTRACTDIR}/${MHKFILE}"
125
          echo "sprite 105 pitch 1\r" >> "${EXTRACTDIR}/${MHKFILE}"
186
          echo "sprite 105 pitch 1\r" >> "${EXTRACTDIR}/${MHKFILE}"
126
          echo "sprite 447 mdxoff 462000 // underwater slime babe (Polymost HRP)\r" \
187
          echo "sprite 447 mdxoff 462000 // underwater slime babe (Polymost HRP)\r" \
127
               >> "${EXTRACTDIR}/${MHKFILE}"
188
                                      >> "${EXTRACTDIR}/${MHKFILE}"
128
          echo "sprite 447 pitch 1\r" >> "${EXTRACTDIR}/${MHKFILE}"
189
          echo "sprite 447 pitch 1\r" >> "${EXTRACTDIR}/${MHKFILE}"
129
        fi
190
        fi
130
      fi
191
      fi
131
      ;;
192
      ;;
132
    "E3L6.mhk")
193
    "E3L6.mhk")
133
      MHK_REPLACE1=`echo "${MHK_LINE}" | grep -oE "sprite\ 307\ angoff -210"`
194
      MHK_REPLACE1=`echo "${MHK_LINE}" | grep -oE "sprite\ 307\ angoff -210"`
134
      MHK_REPLACE2=`echo "${MHK_LINE}" | grep -oE "sprite\ 307\ mdxoff -125000 \\/\\/\ flipped hanging babe"`
195
      MHK_REPLACE2=`echo "${MHK_LINE}" | grep -oE "sprite\ 307\ mdxoff -125000 \\/\\/\ flipped hanging babe"`
135
      MHK_REPLACE3=`echo "${MHK_LINE}" | grep -oE "sprite\ 307\ mdzoff -11000"`
196
      MHK_REPLACE3=`echo "${MHK_LINE}" | grep -oE "sprite\ 307\ mdzoff -11000"`
136
      if [ ! "${MHK_REPLACE1}" = "" ] ; then
197
      if   [ ! "${MHK_REPLACE1}" = "" ] ; then
137
        echo "sprite 307 angoff 200 // (Polymost HRP)\r" >> "${EXTRACTDIR}/${MHKFILE}"
198
        echo "sprite 307 angoff 200 // (Polymost HRP)\r" >> "${EXTRACTDIR}/${MHKFILE}"
138
      elif [ ! "${MHK_REPLACE2}" = "" ] ; then
199
      elif [ ! "${MHK_REPLACE2}" = "" ] ; then
139
        echo "sprite 307 mdxoff 750000 // flipped hanging babe (Polymost HRP)\r" \
200
        echo "sprite 307 mdxoff 750000 // flipped hanging babe (Polymost HRP)\r" \
140
        >> "${EXTRACTDIR}/${MHKFILE}"
201
             >> "${EXTRACTDIR}/${MHKFILE}"
141
      elif [ ! "${MHK_REPLACE3}" = "" ] ; then
202
      elif [ ! "${MHK_REPLACE3}" = "" ] ; then
142
        echo "sprite 307 mdzoff 625000 // flipped hanging babe (Polymost HRP)\r" \
203
        echo "sprite 307 mdzoff 625000 // flipped hanging babe (Polymost HRP)\r" \
143
        >> "${EXTRACTDIR}/${MHKFILE}"
204
             >> "${EXTRACTDIR}/${MHKFILE}"
144
      else
205
      else
145
        echo "${MHK_LINE}" >> "${EXTRACTDIR}/${MHKFILE}"
206
        echo "${MHK_LINE}" >> "${EXTRACTDIR}/${MHKFILE}"
146
      fi
207
      fi
147
      ;;
208
      ;;
148
    *)
209
    *)
Line 176... Line 237...
176
  # Some people prefer unusual setups ...
237
  # Some people prefer unusual setups ...
177
  zip -rq9 ${EXTRACTDIR}/polymost_hrp_update_polymer_maphacks.zip *.mhk
238
  zip -rq9 ${EXTRACTDIR}/polymost_hrp_update_polymer_maphacks.zip *.mhk
178
} # create_polymost_mhk()
239
} # create_polymost_mhk()
179
 
240
 
180
 
241
 
-
 
242
# I really don't know yet if this will become necessary, or if it doesn't make
-
 
243
# sense at all, but at least the files involved are listed.
181
duke_plus_compatibility()
244
dukeplus_polymost_compatibility()
182
{
245
{
-
 
246
  # dukeplus.def expects some files to be present in the HRP
-
 
247
  #
-
 
248
  # model "highres/sprites/characters/1405_duke.md3" { // all OK, no action required
-
 
249
  #    skin { pal 0 surface 0 file "highres/sprites/pickups/0057_jetpack.png" }
-
 
250
  #    skin { pal 0 surface 1 file "highres/sprites/characters/1405_duke.png" }
-
 
251
  #    skin { pal 10 surface 1 file "highres/sprites/characters/1405_duke_10.png" }
-
 
252
  #    skin { pal 11 surface 1 file "highres/sprites/characters/1405_duke_11.png" }
-
 
253
  #    skin { pal 12 surface 1 file "highres/sprites/characters/1405_duke_12.png" }
-
 
254
  #    skin { pal 13 surface 1 file "highres/sprites/characters/1405_duke_13.png" }
-
 
255
  #    skin { pal 14 surface 1 file "highres/sprites/characters/1405_duke_14.png" }
-
 
256
  #    skin { pal 15 surface 1 file "highres/sprites/characters/1405_duke_15.png" }
-
 
257
  #    skin { pal 16 surface 1 file "highres/sprites/characters/1405_duke_16.png" }
-
 
258
  #    skin { pal 21 surface 1 file "highres/sprites/characters/1405_duke_21.png" }
-
 
259
  #    skin { pal 23 surface 1 file "highres/sprites/characters/1405_duke_23.png" }
-
 
260
  #    skin { pal 0 surface 2 file "highres/sprites/pickups/0023_rpg.png" }
-
 
261
  #
-
 
262
  # model "highres/sprites/firstperson/2510_devastator.md3" { // since Imperium, not Eternity
-
 
263
  #    skin { pal 0 file "highres/sprites/firstperson/2510_devastator.png" specfactor 0.5 specpower 35 }
-
 
264
  #    specular { file "highres/sprites/firstperson/2510_devastator_s.png" }
-
 
265
  #    glow { file "highres/sprites/firstperson/2510_devastator_g.png" }
-
 
266
  #
-
 
267
  # model "highres/sprites/firstperson/2524_pistol.md3" {    // most/mer : same MD3 + same skin til r295     
-
 
268
  #    skin { pal 0 file "highres/sprites/firstperson/2524_pistol.png" } // up to DP2.30 DNE/IMP only
-
 
269
  #    glow { file "highres/sprites/firstperson/2524_pistol_g.png" }     // up to DP2.30 DNE/IMP only
-
 
270
  # model "highres/sprites/firstperson/2530_clip.md3" {                  // most/mer : diff MD3, same skin
-
 
271
  #    skin { pal 0 file "highres/sprites/pickups/0040_pistolammo.jpg" }
-
 
272
  # model "highres/sprites/firstperson/2532_cliphand.md3" {  // most/mer : same MD3 + same skin til r295
-
 
273
  #    skin { pal 0 file "highres/sprites/firstperson/2532_cliphand.png" } // til r295, then duke_hand_*
-
 
274
  #
-
 
275
 
-
 
276
  SPR="highres/sprites"
-
 
277
  SPRE="${EXTRACTDIR}/highres/sprites"
-
 
278
  PATCHTYPE=$1
-
 
279
 
-
 
280
  case "$PATCHTYPE" in
-
 
281
    polymer)
-
 
282
      echo "  # Using \"Polymer approach\")"
-
 
283
      cp -pi $SPR/firstperson/2510_devastator.md3            "$SPRE/firstperson"
-
 
284
      cp -pi $SPR/firstperson/2510_devastator.png            "$SPRE/firstperson"
-
 
285
      cp -pi $SPR/firstperson/2510_devastator_s.png          "$SPRE/firstperson"
-
 
286
      cp -pi $SPR/firstperson/2510_devastator_g.png          "$SPRE/firstperson"
-
 
287
      cp -pi $SPR/firstperson/2524_pistol.md3                "$SPRE/firstperson"
-
 
288
      cp -pi $SPR/firstperson_polymost/2524_pistol.png       "$SPRE/firstperson"
-
 
289
      cp -pi $SPR/firstperson_polymost/2524_pistol_g.png     "$SPRE/firstperson"
-
 
290
      cp -pi $SPR/firstperson/2530_clip.md3                  "$SPRE/firstperson"
-
 
291
      cp -pi $SPR/pickups/0040_pistolammo.jpg                "$SPRE/pickups"
-
 
292
      cp -pi $SPR/firstperson/2532_cliphand.md3              "$SPRE/firstperson"
-
 
293
      cp -pi $SPR/firstperson/2532_cliphand.png              "$SPRE/firstperson"
-
 
294
      cp -pi $SPR/firstperson/duke_hand_d.png                "$SPRE/firstperson"
-
 
295
      cp -pi $SPR/firstperson/duke_hand_n.png                "$SPRE/firstperson"
-
 
296
      cp -pi $SPR/firstperson/duke_hand_s.png                "$SPRE/firstperson"
-
 
297
      ;;
-
 
298
    polymost)
-
 
299
      echo "  # Using (\"Polymost approach\")"
-
 
300
      cp -pi $SPR/firstperson_polymost/2510_devastator.md3   "$SPRE/firstperson"
-
 
301
      cp -pi $SPR/firstperson_polymost/2510_devastator.png   "$SPRE/firstperson"
-
 
302
      #cp -pi $SPR/firstperson/2510_devastator_s.png          "$SPRE/firstperson"
-
 
303
      cp -pi $SPR/firstperson_polymost/2510_devastator_g.png "$SPRE/firstperson"
-
 
304
      cp -pi $SPR/firstperson_polymost/2524_pistol.md3       "$SPRE/firstperson"
-
 
305
      cp -pi $SPR/firstperson_polymost/2524_pistol.png       "$SPRE/firstperson"
-
 
306
      cp -pi $SPR/firstperson_polymost/2524_pistol_g.png     "$SPRE/firstperson"
-
 
307
      cp -pi $SPR/firstperson_polymost/2530_clip.md3         "$SPRE/firstperson"
-
 
308
      cp -pi $SPR/pickups/0040_pistolammo.jpg                "$SPRE/pickups"
-
 
309
      cp -pi $SPR/firstperson_polymost/2532_cliphand.md3     "$SPRE/firstperson"
-
 
310
      cp -pi $SPR/firstperson/2532_cliphand.png              "$SPRE/firstperson"
-
 
311
      cp -pi $SPR/firstperson/duke_hand_d.png                "$SPRE/firstperson"
-
 
312
      cp -pi $SPR/firstperson/duke_hand_n.png                "$SPRE/firstperson"
-
 
313
      cp -pi $SPR/firstperson/duke_hand_s.png                "$SPRE/firstperson"
-
 
314
      ;;
-
 
315
    mixed)
-
 
316
      echo "  # Using (\"Mixed approach\")"
183
  echo "DukePlus compatibility patch for Polymost HRP export is not yet implemented."
317
      echo "    # Not applied / Not yet implemented"
-
 
318
      ;;
-
 
319
    none)
-
 
320
      #echo "  Not applied"
-
 
321
      echo "  # Not yet implemented"
-
 
322
      ;;
-
 
323
    *)
-
 
324
      echo "  # Bad parameter"
-
 
325
      ;;
-
 
326
  esac
-
 
327
 
184
} # duke_plus_compatibility()
328
} # dukeplus_polymost_compatibility()
185
 
329
 
186
 
330
 
187
parse_defs()
331
parse_defs()
188
{
332
{
189
  echo "$1"
333
  echo "$1"
-
 
334
  BLOCK_COMMENT="OFF"
190
  cat $1 | while read DEF_LINE; do
335
  cat $1 | while read DEF_LINE; do
191
 
336
 
192
    #DOS only: DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ //`
337
    #DOS only: DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ //`
193
    DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ // | sed s/\\\r//`
338
    DEF_FILE=`echo "${DEF_LINE}" | grep -wE "^include" | sed s/include\ // | sed s/\\\r//`
194
    if [ "${DEF_FILE}" != "" ] ; then
339
    if [ "${DEF_FILE}" != "" ] ; then
Line 196... Line 341...
196
      parse_defs "${DEF_FILE}"
341
      parse_defs "${DEF_FILE}"
197
    fi
342
    fi
198
 
343
 
199
    HRP_TERM=`echo "${DEF_LINE}" | grep -owE "file|model|front|right|back|left|top|down"`
344
    HRP_TERM=`echo "${DEF_LINE}" | grep -owE "file|model|front|right|back|left|top|down"`
200
 
345
 
-
 
346
    if [ ! "$EXTRACT_COMMENTED_FILES" = "YES" ] ; then
-
 
347
 
-
 
348
      COMMENT_TERM=`echo "${DEF_LINE}" | grep -oE "\\/\\*|\\*\\/"`
-
 
349
      if [ "$COMMENT_TERM"  = "/*" ] ; then BLOCK_COMMENT="ON" ; fi
-
 
350
 
-
 
351
      if [ "$BLOCK_COMMENT" = "ON" ] ; then HRP_TERM="" ; fi
-
 
352
 
-
 
353
      if [ "$COMMENT_TERM"  = "*/" ] ; then BLOCK_COMMENT="OFF" ; fi
-
 
354
 
-
 
355
      if [ ! "$HRP_TERM" = "" ] ; then
-
 
356
        HRP_COMMENT=`echo "${DEF_LINE}" | grep -E "//.*$HRP_TERM"`
-
 
357
        if [ ! "$HRP_COMMENT" = "" ] ; then
-
 
358
          HRP_TERM=""
-
 
359
        fi
-
 
360
      fi
-
 
361
 
-
 
362
    fi
-
 
363
 
201
    case "$HRP_TERM" in
364
    case "$HRP_TERM" in
202
      file)
365
      file)
203
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r s/^.*file\ *\"//g | sed s/\".*//`
366
        #HRP_FILE=`echo "${DEF_LINE}" | sed -r s/^.*file\ *\"//g | sed s/\".*//`
204
        # Mastering the backslash :-) ... hm, no big performance gain ... :
367
        # Mastering the backslash :-) ... hm, no big performance gain ... :
205
        HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*file\\ *\"\\)\\([^\"]*\\)\\(.*\\)/\\\2/`
368
        HRP_FILE=`echo "${DEF_LINE}" | sed -r --posix s/\\(^.*file\\ *\"\\)\\([^\"]*\\)\\(.*\\)/\\\2/`
Line 277... Line 440...
277
 
440
 
278
  if [ "${HRPTYPE}" = "polymost" ] || [ "${HRPTYPE}" = "polymost_override" ] ; then
441
  if [ "${HRPTYPE}" = "polymost" ] || [ "${HRPTYPE}" = "polymost_override" ] ; then
279
    echo "### Creating Polymost maphacks ... ###"
442
    echo "### Creating Polymost maphacks ... ###"
280
    create_polymost_mhk
443
    create_polymost_mhk
281
 
444
 
282
    #echo "### Duke Plus compatibility patch ... ###"
445
    #echo "### DukePlus<>Polymost HRP compatibility patch ... ###"
283
    #duke_plus_compatibility
446
    #dukeplus_polymost_compatibility $DUKEPLUS_POLYMOST_COMPATIBILTY_APPROACH
284
  fi
447
  fi
285
 
448
 
286
  echo "### Parsing DEF file hierarchy ... ###"
449
  echo "### Parsing DEF file hierarchy ... ###"
-
 
450
  if [ "$EXTRACT_COMMENTED_FILES" = "YES" ] ; then
-
 
451
    echo "  # Extract commented textures and models: $EXTRACT_COMMENTED_FILES"
-
 
452
  else
-
 
453
    echo "  # Extract commented textures and models: NO"
-
 
454
  fi
287
  if [ "${HRPTYPE}" = "polymost" ] || [ "${HRPTYPE}" = "full" ] ; then
455
  if [ "${HRPTYPE}" = "polymost" ] || [ "${HRPTYPE}" = "full" ] ; then
288
    parse_defs duke3d_hrp_polymost.def
456
    parse_defs duke3d_hrp_polymost.def
289
  fi
457
  fi
290
  if [ "${HRPTYPE}" = "polymer" ] || [ "${HRPTYPE}" = "full" ] ; then
458
  if [ "${HRPTYPE}" = "polymer" ] || [ "${HRPTYPE}" = "full" ] ; then
291
    parse_defs duke3d_hrp.def
459
    parse_defs duke3d_hrp.def
Line 303... Line 471...
303
 
471
 
304
 
472
 
305
PRGPATH=$0
473
PRGPATH=$0
306
HRPTYPE=$1
474
HRPTYPE=$1
307
if [ "$2" = "y" ] ; then FORCE=1 ; else FORCE=0 ; fi
475
if [ "$2" = "y" ] ; then FORCE=1 ; else FORCE=0 ; fi
-
 
476
if [ "$2" = "v" ] && [ ! "$3" = "" ] ; then VERSION="$3" ; fi
308
HRPROOT=.
477
HRPROOT=.
309
 
478
 
310
cd               "${HRPROOT}"
479
cd               "${HRPROOT}"
311
echo  "PWD     :" `pwd`
480
echo  "PWD     :" `pwd`
312
echo  "HRPROOT :" ${HRPROOT}
481
echo  "HRPROOT :" ${HRPROOT}
Line 350... Line 519...
350
    ;;
519
    ;;
351
  debug)
520
  debug)
352
    echo "Nothing to debug."
521
    echo "Nothing to debug."
353
    ;;
522
    ;;
354
  *)
523
  *)
355
    echo "Usage: ${0} {full|polymer|polymost_override|polymost|both|all}"
524
    echo "Usage: ${0} {full|polymer|polymost_override|polymost|both|all} [v VERSION]"
356
    exit 1
525
    exit 1
357
    ;;
526
    ;;
358
esac
527
esac
359
 
528
 
360
exit 0
529
exit 0