#!/bin/bash unset WEAPONS unset ITFLAGS ITFLAGS[1]="IT_AXE" ITFLAGS[2]="IT_SHOTGUN" ITFLAGS[3]="IT_SUPER_SHOTGUN" ITFLAGS[4]="IT_NAILGUN" ITFLAGS[5]="IT_SUPER_NAILGUN" ITFLAGS[6]="IT_GRENADE_LAUNCHER" ITFLAGS[7]="IT_ROCKET_LAUNCHER" ITFLAGS[8]="IT_LIGHTNING" IFS=' ' OFS=' ' cat << EOF /* This file was automatically generated by $0 */ #include "common.qh" #include "weapon.qh" EOF ################################################# for i in "$@"; do for i in `grep '^/\* WEAPON ' "$i"`; do unset IMPULSE NAME IMPULSE=`echo "$i" | sed -e 's/^\/\* WEAPON \([0-9]\+\) \(.*\) \*\/$/\1/'` NAME=`echo "$i" | sed -e 's/^\/\* WEAPON \([0-9]\+\) \(.*\) \*\/$/\2/'` WEAPONS[$IMPULSE]="${WEAPONS[$IMPULSE]} $NAME" cat << EOF @extern float(float action) w_${NAME}; EOF done done unset IFS ############################################## cat < 0) { wweight = w_$j(WEAPON_WEIGHT); if (wweight > best_weight) { best_weight = wweight; best_imp = $i; best_idx = $COUNT; best_func = w_$j; } } EOF COUNT=$((COUNT+1)); done done cat <