Black Windows

Post your scripting questions / solutions here

Moderator: Moderators

Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

OK, here's the little command line tool I wrote to do the trick:
http://inequation.unixpod.com/mohaa/
The .x86 file is for Linux, .exe is for Windows, .c is the source code.

This tool basically exploits the fact that q3map bakes shader surfaceparms into the BSP in a so-called shader lump. This tool removes the glass property from the given shaders; as a result, black windows behave as stone and cannot be shot through.

Extract your BSP from the PK3, patch it using the program and then put the patched BSP back into your game, preferably as a custom PK3. It's fully server-side. The only drawback is that black windows will give stone ricochets instead of glass shards when shot.

Run the program without any arguments for instructions, feel free to ask here if something isn't clear.

Here's an exemplary run of the program (well, 2 runs to be exact) that removes the most notorious black windows (i.e. on mohdm2):

Code: Select all

inequation@spearhead:~/projects/blackwinfix/build/debug$ ./blackwinfix mohdm2.bsp
MoHAA BSP black window fix v0.1 [Jun 13 2009]                                    
Written by Leszek "IneQuation" Godlewski                                         
112: textures/mohcommon/panedwindow1                                             
  content flags: solid                                                           
  surface flags: nomarks nodraw rock glass unknown2                              
113: textures/mohcommon/panedwindow1                                             
  content flags: solid                                                           
  surface flags: glass unknown2                                                  
121: textures/mohtest/fltwall1grim2                                              
  content flags: solid                                                           
  surface flags: nomarks nodraw rock glass                                       
122: textures/mohtest/window3a                                                   
  content flags: solid                                                           
  surface flags: glass                                                           
169: textures/common/caulk                                                       
  content flags: solid                                                           
  surface flags: nomarks nodraw rock glass unknown2                              
211: textures/common/caulk                                                       
  content flags: solid detail                                                    
  surface flags: nomarks nodraw rock glass                                       
212: textures/mohtest/window3a                                                   
  content flags: solid detail                                                    
  surface flags: glass                                                           
216: textures/common/caulk                                                       
  content flags: solid                                                           
  surface flags: nomarks nodraw rock glass                                       
236: textures/mohtest/window3a                                                   
  content flags: solid                                                           
  surface flags: rock glass                                                      
238: textures/mohtest/window3a                                                   
  content flags: solid                                                           
  surface flags: nomarks nodraw rock glass                                       
243: textures/mohtest/wood_joist_trim_masked                                     
  content flags: solid                                                           
  surface flags: wood glass unknown2                                             
inequation@spearhead:~/projects/blackwinfix/build/debug$ ./blackwinfix mohdm2.bsp 112 113 121 122 212 236 238 243
MoHAA BSP black window fix v0.1 [Jun 13 2009]                                                                    
Written by Leszek "IneQuation" Godlewski                                                                         
Patching shader 112 (textures/mohcommon/panedwindow1)...                                                         
Patching shader 113 (textures/mohcommon/panedwindow1)...                                                         
Patching shader 121 (textures/mohtest/fltwall1grim2)...                                                          
Patching shader 122 (textures/mohtest/window3a)...                                                               
Patching shader 212 (textures/mohtest/window3a)...                                                               
Patching shader 236 (textures/mohtest/window3a)...                                                               
Patching shader 238 (textures/mohtest/window3a)...                                                               
Patching shader 243 (textures/mohtest/wood_joist_trim_masked)...                                                 
inequation@spearhead:~/projects/blackwinfix/build/debug$
I run Linux, thus the commandline which may appear weird to some of you. :)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

Brilliant!! Tested on Local Lan and worked fixing to test on server.

Edited: K tested on server with just me and paintball mod. Here is what I found. Some windows do throw stone fragments out when you shoot at them but some are still throwing glass. The ones that are throwing glass seem to be stopping the paintballs from getting through though. Only fix on mohdm2 would probably be putting in a cratelid to cover the inside of the window in the building on tank row with the ladder since now that window can not be shot through. Guess my next test is to get someone into the server and make 100% positive they are not being shot through. BTW, thanks rookie
Last edited by sdlall on Sat Jun 13, 2009 9:00 pm, edited 1 time in total.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Yeah, it could definitely use some testing, what I did here is pure theory. :)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

thanks again rookie. i now have all my maps with this fix in a still testing but looks 100%. especially, when we tested it in my server on remegan and D. Village
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

No problem. :)

Just a little note - on maps where there actually are proper windows (i.e. ones which are transparent) you should pay extra attention to which shaders you're patching. Just look them up in pak0.pk3 and check their textures.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Rookie, did you forgot that the Breaktrough and Spearhead bsps have diffrent ident than AA ones? Your tool is actually useless for both expansions because it quit if ident does not compare with "2015"
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Oh, yeah, an oversight on my part, it didn't occur to me they could've changed the ident to EALA. :) I only have BT installed, is the ident for SH different?

BTW, wasn't EALA originally Westwood Studios? If so, has SH been made by the guys responsible for Command & Conquer then?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Ident remains the same for SH, BT and PA... idk why they changed it, I tought that the mohaa and both expansions were made by 2015 inc
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

OK, I'll update the source code in a few hours, after I'm done with cleaning the house. :)

Nope, 2015 only created the original AA. SH was made by EA Los Angeles and BT by TKO Software.

Weird thing is that EA claims not to have the rights to the game's source code, using it as a reason for not giving it away to modders. How would they develop the expansion packs, then? Bullshit, if you ask me.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Updated. Available for download at the same location.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

I recently had to reinstall vista and redownloaded the blackwinfix again but this time it seems not to be working. Any suggestions?

The following is what I did and the m1l2b.bsp is in the downloads folder.

Code: Select all

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\Love>downloads\blackwinfix
MoHAA BSP black window fix v0.2 [Jun 20 2009]
Written by Leszek "IneQuation" Godlewski
Usage: downloads\blackwinfix <bspfile> [<index1> <index2> ...]
Where:
  <bspfile> is the BSP file to patch
  <index1> <index2> ... are the indices of shaders to patch
Operation:
First run the program with only the BSP file name as the argument.
This will print out all the shaders with glass properties together
with their indices. Check which shaders you want to patch, write down
their indices and run the program again with the indices as arguments
after the BSP filename to patch the BSP file.

C:\Users\Love>downloads\blackwinfix m1l2b.bsp
MoHAA BSP black window fix v0.2 [Jun 20 2009]
Written by Leszek "IneQuation" Godlewski
ERROR: Cannot open m1l2b.bsp for reading!

C:\Users\Love>
The read only is not checked so that is not the problem.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Make sure you're specfiying the right path to the file. It's best to use the tab completion feature (type "m1" and press tab).

Oh wait, if the BSP is in the downloads folder then you need to prepend the folder to the filename. I.e. downloads/blackwinfix downloads/m1l2b.bsp.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

Ugh tried that and I am getting this.

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

C:\Users\Love>blackwin\blackwinfix.exe blackwin\m1l2b.bsp
MoHAA BSP black window fix v0.2 [Jun 20 2009]
Written by Leszek "IneQuation" Godlewski
ERROR: File doesn't appear to be a MoHAA BSP (wrong ident and/or version number)
!

C:\Users\Love>blackwin\blackwinfix.exe m1l2b.bsp
MoHAA BSP black window fix v0.2 [Jun 20 2009]
Written by Leszek "IneQuation" Godlewski
ERROR: Cannot open m1l2b.bsp for reading!

I already have .bsp associated with notepad does that matter?
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Ah, yes, I made a silly logical mistake. :oops: I'm not at home ATM, once I get home (about half an hour from now) a new, fixed version (0.3) should be up. Download again and all should be well.

<EDIT>There you go, fixed.</EDIT>
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

Well got little farther but stopping at the number now.

Code: Select all

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\Love>blackwin\blackwinfix.exe
MoHAA BSP black window fix v0.3 [Jul 13 2009]
Written by Leszek "IneQuation" Godlewski
Usage: blackwin\blackwinfix.exe <bspfile> [<index1> <index2> ...]
Where:
  <bspfile> is the BSP file to patch
  <index1> <index2> ... are the indices of shaders to patch
Operation:
First run the program with only the BSP file name as the argument.
This will print out all the shaders with glass properties together
with their indices. Check which shaders you want to patch, write down
their indices and run the program again with the indices as arguments
after the BSP filename to patch the BSP file.

C:\Users\Love>blackwin\blackwinfix.exe blackwin\m1l2b.bsp
MoHAA BSP black window fix v0.3 [Jul 13 2009]
Written by Leszek "IneQuation" Godlewski
12: textures/common/glassclip
  content flags: solid detail translucent
  surface flags: nomarks nodraw glass
44: textures/common/nodraw
  content flags: weaponclip detail translucent
  surface flags: noimpact nomarks nodraw nonsolid rock glass
45: textures/algiers/jh_warewindow1
  content flags: weaponclip detail
  surface flags: glass
48: textures/common/nodraw
  content flags: solid detail translucent
  surface flags: noimpact nomarks nodraw nonsolid rock glass
49: textures/algiers/jh_warewindow1
  content flags: solid detail
  surface flags: glass
135: textures/light/jh_rustwin1lit
  content flags: weaponclip detail
  surface flags: nomarks glass
193: textures/common/caulk
  content flags: solid weaponclip detail
  surface flags: nomarks nodraw rock glass
194: textures/light/warewindowlit3
  content flags: weaponclip detail
  surface flags: nomarks glass
197: textures/algiers/jh_warewindow3
  content flags: weaponclip detail
  surface flags: glass
237: textures/common/caulk
  content flags: solid
  surface flags: nomarks nodraw rock glass
238: textures/algiers/jh_warewindow3
  content flags: solid
  surface flags: glass
240: textures/light/warewindowlit3
  content flags: solid
  surface flags: nomarks glass
244: textures/common/caulk
  content flags: solid detail
  surface flags: nomarks nodraw rock glass
245: textures/light/jh_rustwin1lit
  content flags: solid detail
  surface flags: nomarks glass
263: textures/light/warewindowlit3
  content flags: solid detail translucent
  surface flags: noimpact nomarks nodraw nonsolid rock glass
266: textures/common/caulk
  content flags: solid detail translucent
  surface flags: noimpact nomarks nodraw nonsolid rock glass
268: textures/algiers/jh_warewindow3
  content flags: solid detail translucent
  surface flags: noimpact nomarks nodraw nonsolid rock glass
287: textures/light/jh_rustwin1lit
  content flags: solid
  surface flags: nomarks glass
292: textures/light/warewindowlit3
  content flags: solid detail
  surface flags: nomarks glass
344: textures/common/caulk
  content flags: weaponclip detail
  surface flags: nomarks nodraw rock glass

C:\Users\Love>blackwin\blackwinfix.exe blackwin\m1l2b.bsp 12 44 45 48 49 1
35 193 194 197 237 238 240 244 245 263 266 268 287 292 344
MoHAA BSP black window fix v0.3 [Jul 13 2009]
Written by Leszek "IneQuation" Godlewski
ERROR: File doesn't appear to be a MoHAA BSP (wrong ident and/or version number)
!

C:\Users\Love>
Post Reply