Fix XScript syntax errors in COD definitions

- Convert match() function calls to if-else chains (match keyword conflict)
- Remove unsupported bracket attributes [table=..., columns=...]
- Expand inline statement with bracket attributes to explicit if block

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
njohnson 2026-01-11 12:50:59 -05:00
parent 272216a7d5
commit 8430428a91
4 changed files with 46 additions and 46 deletions

View File

@ -12,41 +12,39 @@ type assetheader
if (game == "COD4" && platform == "PC") {
// COD4 PC zone file asset type mapping
// Note: No pixelshader or vertexshader on PC
asset_type = match(raw_type,
0x00, "xmodelpieces",
0x01, "physpreset",
0x02, "xanim",
0x03, "xmodel",
0x04, "material",
0x05, "techset",
0x06, "image",
0x07, "sound",
0x08, "sndcurve",
0x09, "loaded_sound",
0x0A, "col_map_sp",
0x0B, "col_map_mp",
0x0C, "com_map",
0x0D, "game_map_sp",
0x0E, "game_map_mp",
0x0F, "map_ents",
0x10, "gfx_map",
0x11, "lightdef",
0x12, "ui_map",
0x13, "font",
0x14, "menufile",
0x15, "menu",
0x16, "localize",
0x17, "weapon",
0x18, "snddriverglobals",
0x19, "fx",
0x1A, "impactfx",
0x1B, "aitype",
0x1C, "mptype",
0x1D, "character",
0x1E, "xmodelalias",
0x1F, "rawfile",
0x20, "stringtable",
"UNKNOWN");
if (raw_type == 0x00) { asset_type = "xmodelpieces"; }
if (raw_type == 0x01) { asset_type = "physpreset"; }
if (raw_type == 0x02) { asset_type = "xanim"; }
if (raw_type == 0x03) { asset_type = "xmodel"; }
if (raw_type == 0x04) { asset_type = "material"; }
if (raw_type == 0x05) { asset_type = "techset"; }
if (raw_type == 0x06) { asset_type = "image"; }
if (raw_type == 0x07) { asset_type = "sound"; }
if (raw_type == 0x08) { asset_type = "sndcurve"; }
if (raw_type == 0x09) { asset_type = "loaded_sound"; }
if (raw_type == 0x0A) { asset_type = "col_map_sp"; }
if (raw_type == 0x0B) { asset_type = "col_map_mp"; }
if (raw_type == 0x0C) { asset_type = "com_map"; }
if (raw_type == 0x0D) { asset_type = "game_map_sp"; }
if (raw_type == 0x0E) { asset_type = "game_map_mp"; }
if (raw_type == 0x0F) { asset_type = "map_ents"; }
if (raw_type == 0x10) { asset_type = "gfx_map"; }
if (raw_type == 0x11) { asset_type = "lightdef"; }
if (raw_type == 0x12) { asset_type = "ui_map"; }
if (raw_type == 0x13) { asset_type = "font"; }
if (raw_type == 0x14) { asset_type = "menufile"; }
if (raw_type == 0x15) { asset_type = "menu"; }
if (raw_type == 0x16) { asset_type = "localize"; }
if (raw_type == 0x17) { asset_type = "weapon"; }
if (raw_type == 0x18) { asset_type = "snddriverglobals"; }
if (raw_type == 0x19) { asset_type = "fx"; }
if (raw_type == 0x1A) { asset_type = "impactfx"; }
if (raw_type == 0x1B) { asset_type = "aitype"; }
if (raw_type == 0x1C) { asset_type = "mptype"; }
if (raw_type == 0x1D) { asset_type = "character"; }
if (raw_type == 0x1E) { asset_type = "xmodelalias"; }
if (raw_type == 0x1F) { asset_type = "rawfile"; }
if (raw_type == 0x20) { asset_type = "stringtable"; }
}
ui("asset_type", "Asset Type");

View File

@ -31,7 +31,7 @@ type assetlist [display="Asset List"]
strings = push("strings", _str);
}
strings = strings [table="Strings", columns="ptr,value"];
// Table: strings (columns: ptr,value)
skip_tree("strings");
stringlist = strings;
}
@ -47,7 +47,7 @@ type assetlist [display="Asset List"]
assets = push("assets", _a);
}
assets = assets [table="Assets", columns="asset_ptr,raw_type,asset_type", format_asset_ptr="hex", format_raw_type="hex"];
// Table: assets (columns: asset_ptr,raw_type,asset_type)
skip_tree("assets");
// Second pass: Parse actual asset data based on headers

View File

@ -30,12 +30,11 @@ type fastfile [root, display="Fast File"] byteorder LE
detected_platform = "UNKNOWN";
// Early version-based platform detection
detected_platform = match(version_i,
5, "PC",
6, "XBOX360",
12, "PS3",
14, "WII",
"UNKNOWN");
if (version_i == 5) { detected_platform = "PC"; }
if (version_i == 6) { detected_platform = "XBOX360"; }
if (version_i == 12) { detected_platform = "PS3"; }
if (version_i == 14) { detected_platform = "WII"; }
// version match replaced
if (version_i > 276 && version_i < 1000) {
detected_platform = match(platform_u32,
0, "PC",
@ -43,7 +42,6 @@ type fastfile [root, display="Fast File"] byteorder LE
2, "PS3",
3, "WII",
4, "WIIU",
"UNKNOWN");
}
// Set globals early so they're available for all parsing

View File

@ -12,7 +12,11 @@ type menulist [display="Menu List"]
ui("menus_ptr", "Menus Ptr");
// Inline data
inline cstring name when name_ptr [ui="Name", set_name];
if (name_ptr == PTR_INLINE) {
name = cstring();
ui("name", "Name");
set_name(name);
}
// Menu definitions (complex - need two passes)
if (menus_ptr == PTR_INLINE && menu_count > 0) {
@ -33,6 +37,6 @@ type menulist [display="Menu List"]
menus = push("menus", _menu);
}
}
menus = menus [table="Menus", columns="name"];
// Table: menus (columns: name)
}
}