Skip to content

Commit

Permalink
Merge pull request #64 from noodlecollie/add-all-multiplayer-models
Browse files Browse the repository at this point in the history
Add all multiplayer models
  • Loading branch information
noodlecollie authored Mar 31, 2024
2 parents a35daa2 + 204a999 commit 88afa41
Show file tree
Hide file tree
Showing 170 changed files with 34,017 additions and 32,709 deletions.
25 changes: 13 additions & 12 deletions game/assets/models/player/compilePlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
STUDIOMDL_EXE = "studiomdl.exe" if sys.platform == "win32" else "studiomdl"
STUDIOMDL_PATH = os.path.abspath(os.path.join(SCRIPT_DIR, "..", "..", "..", "..", "build", "install", "nightfire-open", "tools", STUDIOMDL_EXE))
MODEL_OUTPUT_ROOT_PATH = os.path.abspath(os.path.join(SCRIPT_DIR, "..", "..", "..", "content", "nfopen", "models"))
MODEL_OUTPUT_ROOT_PATH = os.path.abspath(os.path.join(SCRIPT_DIR, "..", "..", "..", "content", "nfopen", "models", "player"))

QC_COMMAND_MODELNAME = "$modelname"

Expand All @@ -16,7 +16,7 @@ def parseArguments():

parser.add_argument("dirs",
nargs="+",
help="Subdirectories within which to look for model QC files.")
help="Subdirectories within which to look for model QC files. Use * to compile all subdirectories.")

return parser.parse_args()

Expand All @@ -39,9 +39,6 @@ def fetchModelNameFromQC(qcFilePath : str):

raise ValueError(f"{qcFilePath}: Could not find a {QC_COMMAND_MODELNAME} line within this file.")

def outputDirForModel(modelName : str):
return os.path.join(MODEL_OUTPUT_ROOT_PATH, "player", os.path.splitext(modelName)[0])

def runStudioMDL(qcFilePath : str):
print("Running StudioMDL for", qcFilePath)

Expand All @@ -59,10 +56,9 @@ def compileAndCopyToOutput(qcFilePath : list):

localDir = os.path.dirname(qcFilePath)
modelName = fetchModelNameFromQC(qcFilePath)
outputDir = outputDirForModel(modelName)

print(" Player model name:", modelName)
print(" Output directory:", outputDir)
print(" Output directory:", MODEL_OUTPUT_ROOT_PATH)

runStudioMDL(qcFilePath)

Expand All @@ -72,12 +68,12 @@ def compileAndCopyToOutput(qcFilePath : list):
if not os.path.isfile(localModelPath):
raise OSError(f"Could not find compiled model {localModelPath}")

targetModelPath = os.path.join(outputDir, modelName)
targetModelPath = os.path.join(MODEL_OUTPUT_ROOT_PATH, modelName)

print("Copying compiled player model to", targetModelPath)

if not os.path.isdir(outputDir):
os.makedirs(outputDir)
if not os.path.isdir(MODEL_OUTPUT_ROOT_PATH):
os.makedirs(MODEL_OUTPUT_ROOT_PATH)

shutil.copyfile(localModelPath, targetModelPath)

Expand Down Expand Up @@ -105,10 +101,15 @@ def main():
print("Could not find", STUDIOMDL_PATH, "- make sure you have installed the game to build/install")
sys.exit(1)

totalDirs = len(args.dirs)
dirsToCompile = list(args.dirs)

if "*" in dirsToCompile:
dirsToCompile = os.listdir(SCRIPT_DIR)

totalDirs = len(dirsToCompile)
successfulDirs = 0

for subdir in args.dirs:
for subdir in dirsToCompile:
try:
print("Compiling player models in subdirectory:", subdir)
compileRecursive(os.path.join(SCRIPT_DIR, subdir))
Expand Down
3,034 changes: 1,517 additions & 1,517 deletions game/assets/models/player/default/mp_mi6_Stealth_ref.smd

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions game/assets/models/player/default/player.qc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
$cd "."
$cdtexture "../../../../content/nfopen/textures/mdl"
$cdtexture "../../../../content/nfopen/textures"
$modelname "_fallback.mdl"

$root "Bip01"
$noembeddedtextures

$flags 0
$origin 0.000000 0.000000 0.000000
$eyeposition 0.000000 0.000000 0.000000
$eyeposition 0.0 -4.968 33.46
$bbox 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
$cbox 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000

Expand Down
14 changes: 13 additions & 1 deletion game/assets/models/player/mp_alura_combat/mp_alura_combat.qc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ $cdtexture "../../../../content/nfopen/textures"
$modelname "mp_alura_combat.mdl"

$root "Bip01"
$noembeddedtextures

$flags 10240
$origin 0.000000 0.000000 0.000000
$eyeposition 0.000000 0.000000 0.000000
$eyeposition 0.0 -3.882 31.52
$bbox 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
$cbox 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000

Expand Down Expand Up @@ -46,6 +47,17 @@ $hbox 6 "Bip01 R UpperArm" -2.000000 -3.000000 -2.000000 11.000000 2.000000 2.00
$hbox 7 "Bip01 R Forearm" 0.000000 -3.000000 -2.000000 11.000000 2.000000 2.000000
$hbox 8 "Bip01 R Hand" 0.000000 -1.000000 -2.000000 6.000000 2.000000 2.000000

$bonetag "Bip01" applygait
$bonetag "Bip01 Pelvis" applygait
$bonetag "Bip01 L Thigh" applygait
$bonetag "Bip01 L Calf" applygait
$bonetag "Bip01 L Foot" applygait
$bonetag "Bip01 R Thigh" applygait
$bonetag "Bip01 R Calf" applygait
$bonetag "Bip01 R Foot" applygait

$tag female_character

$sequence "look_idle" "look_idle_ani" ACT_IDLE 2 fps 15 loop
$sequence "idle" "idle_ani" ACT_IDLE 5 fps 15 loop
$sequence "deep_idle" "deep_idle_ani" ACT_IDLE 1 fps 15 loop
Expand Down
Loading

0 comments on commit 88afa41

Please sign in to comment.