Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quake 2 support improvements. #216

Merged
merged 6 commits into from Jul 24, 2018
Merged

Quake 2 support improvements. #216

merged 6 commits into from Jul 24, 2018

Conversation

m-x-d
Copy link
Contributor

@m-x-d m-x-d commented May 8, 2018

This adds support for several Quake 2 features, including area lights, palette and texture loading and transparent/sky/fence textures. Here's the list of notable changes:

Palette handling and loading:
The palette iteslf and palette handling functions were moved to the new imglib.cc file. LoadPalette function was added. For Quake 2, it will try to load the palette from pics/colormap.pcx and replace the palette with hardcoded Quake 2 palette if that fails. For Hexen 2, it will replace the palette with hardcoded Hexen 2 palette.

External texture loading:
Most of Quake 2 source ports can use true-color textures stored in conventional image formats. Several changes were made to support that in a generic manner:

  • the new drgbatexdata property was added to mbsp_t. It's structured the same way as dtexdata and consists of dmiptexlump_t followed by new rgba_miptex_t structs, followed by image data stored as RGBA bytes. A new color_rgba struct was added to simplify image data handling.
  • after loading the BSP, external textures are loaded into drgbatexdata (Quake 2, currently WAL and TGA images only), or converted from dtexdata (Quake / Hexen 2) (see LoadOrConvertTextures in imglib.cc).
  • all image handling functions were changed to use rgba_miptex_t instead of miptex_t.

Surface lights:
This is not a direct port of qrad3 surface lights logic. Instead, it's a tweaked version of bouce light logic tuned to look similar to qrad3/arghrad3 surface lights (that's why there are some strange scalers here and there...). Lights setup is done in surflight.cc.

Other notable changes:

  • SetQdirFromPath() was rewritten from scratch. Instead of searching for "quake" (or "quake2" in qrad3) folder in a given path, it searches for base game folder ("ID1" / "BASEQ2" / "DATA1"), which is more likely to be named exactly that. Also, basedir property was added. It stores the path to the base game folder (like "c:/Quake/id1/") (used in Q2 texture and palette loading logic to search for images in both base game and mod folders when those differ).
  • "-arghradcompat" command line option was added. It converts some arghrad light properties to their ericw-tools equivalents (added for debugging reasons, so I don't have to keep and synchronize 2 versions of the same Q2 map to compare the results with argrad3/qrad3).
  • Fixed, _project_texture: an extra row and column of pixels were drawn (most noticeable when using lores project_textures).
  • Added, _project_texture: texture colors are now modulated by light color.
  • Added, _project_texture: when "_project_texture" property is set and "mangle" / "_project_mangle" are not, projangle is set from "angles" property.
  • .lit output is now enabled when _project_textures are used in the bsp.
  • For Quake 2, cfg.rangescale now defaults to 1.0 to better match with argrad3/qrad3.
  • Warning about delay/_falloff mismatch was moved to CheckEntityFields to avoid message spam.
  • Bounce/surface lights counts are now displayed.
  • All compilation warnings in "light" project were fixed.
  • A couple of clang-suggested optimizations were implemented.
  • Some consts were added here and there.
  • Some variable names in function declarations were renamed to match with corresponding implementations.

@ericwa
Copy link
Owner

ericwa commented May 9, 2018

Wow, thanks, this looks great! Only had a quick look but will try to test it soon.

… bit more now...

Added "surflightscale", "surflightbouncescale" and "surflightsubdivision" cmdline/worldspawn settings.
Fixed: a face should not be skipped when it has both sky and nodraw texinfo flags.
Fixed some non-windows compilation errors.
@ericwa ericwa merged commit 07447a6 into ericwa:master Jul 24, 2018
@ericwa
Copy link
Owner

ericwa commented Jul 24, 2018

Thanks again and sorry it took me so long to merge!

I made a couple of small edits, the main thing is the errors in SetQdirFromPath need to be non-fatal because I want to keep the ability to light Q1 bsp's outside of a Quake installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants