diff options
Diffstat (limited to 'make_map_model.rb')
-rwxr-xr-x | make_map_model.rb | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/make_map_model.rb b/make_map_model.rb index bae1cd0..55560ff 100755 --- a/make_map_model.rb +++ b/make_map_model.rb @@ -27,11 +27,34 @@ brres.get_texture_group.add 'alphaBlender', alpha_tex # yay #model.shapes["World2_PathsPlumbing__World2_PathsPlumbing"].clr_data[0].raw_data = System::Array[Byte].new([255, 255, 255, 128]) +# move paths into DrawXlu +opa = model.bytecode["DrawOpa"] +if model.bytecode.contains_key("DrawXlu") + xlu = model.bytecode["DrawXlu"] +else + xlu = ByteCode.new + xlu.instructions = System::Collections::Generic::List[ByteCode::Instruction].new + xlu.instructions << ByteCode::DoneInstruction.new + model.bytecode["DrawXlu"] = xlu +end + +shape_array = model.shapes.to_a + +to_be_moved = opa.instructions.select do |insn| + insn.is_a?(ByteCode::DrawShapeInstruction) and + shape_array[insn.shape_i_d].key =~ /path/i +end + +to_be_moved.each do |insn| + opa.instructions.remove insn + xlu.instructions.insert 0, insn +end + # how's this for hackiness? model.materials.each do |kvp| next unless kvp.key =~ /path/i - if true + if false mat = kvp.value # update the material @@ -135,9 +158,9 @@ model.materials.each do |kvp| sh.pad_to_size 0x1E0 sh.end shad.display_list = sh.get_buffer - end - next + next + end if false mat = kvp.value @@ -203,6 +226,8 @@ model.materials.each do |kvp| dl.pad_to_size 0x1E0 dl.end shad.display_list = dl.get_buffer + + next end |