### General Information

This source code contains the full source for the following programs:

> NWN Explorer
> NWN Treasure Editor
> NWN Model Compiler
> NWN Script Compiler

### Download

NWN Tools Source Code (ZIP file format - All sources)

NWN Tools Source Code (TAR file format - Without Explorer and Treasure Editor)

### Copyright and License Information

>     Copyright (c) 2002, 2003 - Edward T. Smith

>     All rights reserved.

>     Redistribution and use in source and binary forms, with or without
>     modification, are permitted provided that the following conditions are
>     met:

>     1. Redistributions of source code must retain the above copyright notice,
>        this list of conditions and the following disclaimer.

>     2. Neither the name of Edward T. Smith nor the names of its contributors
>        may be used to endorse or promote products derived from this software
>        without specific prior written permission.

>     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
>     OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
>     TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
>     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
>     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
>     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
>     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

As you can see, this is a standard BSD style license without the advertise clause.

### This Software and Bioware's Intellectual Property Rights

If you are looking for information about how Bioware renders their graphics or information about deep NWN internals, you are looking in the wrong place.

Bioware (or their lawyers) might not agree, but IMHO, none of the software contained here exposes any intellectual property Bioware might hold. Game companies might not mind much about how they store basic model information, but when it comes to their rendering engine, they can be very protective. Contracts can be won or lost based on the performance or looks of a rendering engine. So exposing or even discovering intellectual property information is something that I avoid at all costs.

### Non-Windows Ports

With the assistance of people lick Erydan and Sumpfork, we now have available the tools to build the NWScript compiler for non-windows operating systems such as Linux, MacOS, and FreeBSD. This work is still in progress but we have made a significant step forward. If you run into any problems building the compiler on other platforms, please send any code corrections to torlack@torlack.com. However, please remember that I don't do non-Windows operating systems. If you can't get the compiler to compile, I can't provide any support.

Older versions of GCC seem to have problems with inline functions. To just avoid this problem all together, "AM_CXXFLAGS = -fno-default-inline" has been added to the makefiles. This will hurt performance to a degree.

### Credits

Initial Linux port of the compiler by Francois Guimond a.k.a. Erydan.
Assistance with automake/autoconf and MacOS/X port by Sumpfork

### About the Source

The source is a VC7 (VS.NET) solution file. However, all source code for the model compiler should be usable on a more standard compiler platform. There are no "stdafx.h" or "windows.h" includes excluding the main executable. Even there, those includes are "#ifdef" protected and only used for registry access. However, that doesn't mean the software will build on a GCC system without modification.

NWN Explorer and NWN Treasure Editor both use ATL and WTL. NWN Explorer also uses FMOD from http://www.fmod.org/. NWN Script compiler uses the MSTA compiler compiler from the COCOM tool set. The package can be downloaded from http://cocom.sourceforge.net/.

May C++ purists will have an aneurysm when they see some of the code. To those I say, "deal with it." (OMG, HE USED A GOTO!!!!!)

### Revisions

#### March 12th, 2003:

- Blank statements after an if or else statement will now generate a warning.
- The compiler will automatically ignore requests to include the same include file multiple times in a script compilation.
- With the non-Windows versions, if the path specified for the NWN directory doesn't end in a "/", one will be automatically added.
- All the libraries and the model converter have been converted to build with GCC.
- Corrected a problem with the script decompiler regarding the TALENT type.

#### April 23rd, 2003:

- On GCC systems, the script compiler optimizer might throw an assert. The code has been modified to prevent the assert which was non-fatal in nature.
- On some GCC systems, the basename routine is declared as having a "char *" argument. The only place where this caused a problem has been modified to force the type to "char *". A future version will have a better fix for this problem.
- If a function declaration has more arguments than the prototype, the compiler would fail to generate an error. This would result in a compiled script that runs the risk of generating "STACK UNDERFLOW" errors.
- Corrected a bug in the script compiler that would fail to generate an error when a function was called without enough parameters.

#### July 1st, 2003:

- Added the new -v command line argument to the script compiler. This allows for the compiler to compile files using older compiler rules.
- The script compiler now generates the new script debug file (NDB).
- A '.' (dot) in the input path which is not part of the extension will no longer confuse the model and script compiler.
- The default directory for including script includes will be the same directory as the input script.
- The script decompiler now supports the new NOP opcode.
- Corrected a script compiler crash caused by some types of syntax errors.
- Increased the maximum size of a compiled script to 512k to match BioWare maximum script size.
- Added support for SoU key files.