* Revive EditWorld from the dead

* Give it a nicely oriented directory structure
 * Rename all files in src/ (I hope I didn't miss any) to lowercase (except for MSVC project files)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2005 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-07-03 11:06:42 +00:00
parent 3a77772598
commit 345b1d6106
164 changed files with 53534 additions and 0 deletions

340
tools/editworld/COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -0,0 +1,30 @@
Warzone 2100 Source & Data
1) These source and data files are provided as is with no guarantees.
2) No assistance or support will be offered or given.
3) Everything you will require to make a build of the game should be here. If it isn't, you'll have to improvise(*).
4) None of us here at Pivotal Games are in a position to be able to offer any help with making this work.
5) This source code is released under the terms of the GNU Public License.
Please be sure to read the entirety of this license but the summary is that you're free to do what you want
with the source subject to making the full source code freely available in the event of the distribution
of new binaries.
Finally, the primary motivation for this release is for entertainment and educational purposes. On the subject of the
latter, don't be surprised to see some pretty gnarly old-school C code in here; the game was a classic but
large areas of the code aren't pretty; OO design and C++ evangelists beware! We haven't spent any time
cleaning the code or making if pretty - what you see is what you're getting, warts n' all.
Thankyou to Jonathan Kemp of Eidos Europe for permitting the release. Thanks also to Frank Lamboy for
assistance with the release and for campaigning along with many many others over the years for the source to be made
available. The correspondence, online petitions and persistence made this possible. We were constantly amazed at the
community support for Warzone even after all this time; it's nice to be able to give something back,
assuming you can get it to compile...;-)
6th December 2004
Alex M - ex Pumpkin Studios (Eidos)
(*) Except FMV and music...

440
tools/editworld/README Normal file
View File

@ -0,0 +1,440 @@
World Editor Changes.
#############################
## CHANGES AS OF 05/04/99. ##
#############################
Now handles TEXANIM style polygons, so displays correct clan colour for objects
in the 3d view.
You can now set triangle direction flags in edge brushes, should speed up cliff drawing.
Added edge brush properties dialog. Allows you to set attributes to use for individual
brushes.
Added flood fill with edge brush, should speed up edging large areas, just select the edge brush
to use, click on the edge fill tool, click on the area in the map to fill and away you go.
#############################
## CHANGES AS OF 29/04/99. ##
#############################
Now saves tile transformation preferences.
Fixed problem where pasting with no textures was changing the tile transformation flags.
Fixed map dump.
Fixed area x,y flip so it now flips triangle direction as well.
#############################
## CHANGES AS OF 26/04/99. ##
#############################
When creating a new map, automaticly adds scroll limits for "Entire Map".
Sea level now defaults to 0.
Height scale now defaults to 2.
Changed "Zero Camera Angle" to "Look North", dose what it says.
When pasting objects, now pastes using the current player id rather than the source objects
player id.
Copy/Paste interface has changed, you can now mark an area of tiles in the 2d or 3d views,
x or y flip the area and or copy it into the clipboard for pasting elsewhere on the map. Also
added paste preferences dialog so you can specify which elements of the clipboard get applied
to the map when pasting.
Added tool buttons to enable/disable rendering for each player number, so you can filter out
certain players from the 2d and 3d views.
Now loads names.txt and displays in game names for all objects, can be disabled from options menu.
Can now change light direction in 3d view, "L" varies Yaw, "K" varies pitch.
Can now rotate tile both ways using "E" and "R" keys. X and Y flip remain on the "X" and "Y" keys.
Object buttons in selection window now colour coded.
Maximises application window on execution.
Window layout changed.
3d view size increased to 800x600.
Data set files changed, now called "whatever.eds" instead of "whatever.txt", new files
specify tile texture page to load, default edge brushes and tile types for the tile set.
Also says where to load names.txt for the in game object names.
This should speed up creating new maps.
Can now import and export tile id maps in the same way as you could import,export height maps,
each pixel in the tile id map specifies the texture id to use for that tile in the world.
.LND file format has changed slightly to specifiy the data set to load as the first thing
in the file, old projects will still load but you will be prompted for the data set ".EDB"
file to load.
Removed some redundant menu options.
Maximum map size now limited to 250x250, as this is the largest the game, specificly the gateway
system can safely handle.
#############################
## CHANGES AS OF 10/11/98. ##
#############################
Now shows object footprints in the 2d view, colour coded as in the radar map.
Can now place gateways on water.
Updated droids templates to match current game stats.
Objects now drawn colour coded in radar map.
Can now export scenario expansion with same limits for inclusion and exclusion.
#############################
## CHANGES AS OF 15/10/98. ##
#############################
Fixed bug in gateway/zone creation.
#############################
## CHANGES AS OF 06/10/98. ##
#############################
Now creates zone map from gateways.
Zones are displayed in the 2d locator when in gateway mode.
Saves zones in .map file when exporting a deliverance map.
Vertex markers for height tools are now drawn with a shadow so they show up on white
textures.
#############################
## CHANGES AS OF 05/10/98. ##
#############################
Can now export map as a single big BMP.
Walls now morph to fit landscape just like in the game.
#############################
## CHANGES AS OF 30/09/98. ##
#############################
Can now create gateways in the 2d view for routeing using the "Gt" tool in the tool
bar.
Greatly speeded up because of optimizations to the radar map code.
Now have two shortcuts in the EditWorld folder, one for software rendering which
works on any machine with DirectX 6 installed and one for hardware rendering which
works on machines with DirectX 6 installed and a 3D accelerated video card thats up
to the job ie 8MB of video memory and can do textured 3d in a window, cards I know
work are Permedia 2,Matrox G200,ATI Rage Pro and Riva TNT.
#############################
## CHANGES AS OF 02/07/98. ##
#############################
Now have option to apply random rotations and flips to textures when
painting, Can also setup default rotaions and flips for painting textures.
Do this by clicking on the texture in the selection window to bring up the dialog
box.
#############################
## CHANGES AS OF 10/06/98. ##
#############################
Now displays scroll limits graphicaly in 2d view and in locator maps.
#############################
## CHANGES AS OF 02/06/98. ##
#############################
Game export version updated.
#############################
## CHANGES AS OF 13/05/98. ##
#############################
Can now import Warzone maps into the editor.
Map options now always default to "-nosizecheck" which means you can create a map
any size (within reason) without using the command line option.
#############################
## CHANGES AS OF 19/03/98. ##
#############################
When saving, now renames the previous encarnation of the project file to
whatever.bak before writing the newer version.
Now allows creation of scroll limits
New Warzone export types :
Campaign start.
Campaign expansion.
Mission.
Fixed clipboard object height bug.
Can now specify a name for each object in the world for use in scripts.
Fixed draw radius check on objects.
#############################
## CHANGES AS OF 07/01/98. ##
#############################
Updated handling of structure stats.
#############################
## CHANGES AS OF 18/12/97. ##
#############################
Can now right click on objects to bring up context menu.
Context menu gives access to object properties dialog.
#############################
## CHANGES AS OF 11/12/97. ##
#############################
Added droid section to data set file (see WarzoneData.txt in the samples directory for
details) for specifieing a template stats file to load.
Can now place droids in the editor.
You no longer have to have bounding spheres enabled to see the name of an object in
the 3d view. Just click on it using the selection tool.
#############################
## CHANGES AS OF 08/12/97. ##
#############################
Added recent project list in file menu.
Can now export and import the current clipboard allowing you to save sections
of map which you want to use again and then load them back in ready to paste.
Fixed bug which was causing editor to fall over after loading a few projects.
Can now copy and paste objects as well as tiles.
Added check for duplicate object IDs when loading and saving projects
Fixed bug where by you can get duplicate object IDs.
#############################
## CHANGES AS OF 05/12/97. ##
#############################
Can now save out a section of the map as a new project.
Fixed bug where by incorect player ID was being displayed in 2D view.
Terrain types have changed and there are more of them.
Now saves TTYPE.TTP file when exporting Warzone scenario which contains the lookup table
for terrain type verses tile texture ID.
#############################
## CHANGES AS OF 24/11/97. ##
#############################
Now copes with IMD's with seperate base plates.
For Warzone the data set file's FEATURE section now contains the file name of the feature
stat file used in the game. The editor uses this file to determine which IMD's to load for
features.
The data set file now contains entries to define the paths for IMD textures for each class of
object. See WarzoneData.txt and NecromancyData.txt in the samples directory.
Fixed problems with object positioning for Warzone.
Can now rotate and flip tiles in 3d and 2d view by positioning cursor over the tile and pressing
one of the following:
R - Rotate 90 Degrees.
X - Flip X
Y - Flip Y
Fixed crash bug when exporting 192 x 128 height bitmap.
Each object now has a unique ID which is displayed with the object.
#############################
## CHANGES AS OF 29/10/97. ##
#############################
Structures are now referenced by name in project files and the warzone export files.
#############################
## CHANGES AS OF 20/10/97. ##
#############################
Fixed bug where left most and bottom most rows of tiles were not displayed in 3d view.
Now handles lost surfaces. ie The problem where by running another Direct Draw application
while the editor was running and then returning to the editor caused a SURFACE LOST error.
#############################
## CHANGES AS OF 10/10/97. ##
#############################
Added command line option to disable map size checking. Right click on the EditWorld shortcut
to get the properties up and add -nosizecheck to the target. Currently Warzone only supports
maps that are 2 to the power n in size ie 64x64, 128x128 so the editor checks the size
to see if it's valid. This option was added so that you can dissable this check if in the
future Warzone allows any size maps.
If you've got a 3d card then you can add -hardware as a command line option to enable hardware
acceleration in the editor. ( Hope you've got bucket loads of video ram ! )
#############################
## CHANGES AS OF 09/10/97. ##
#############################
You can now place structures and they work in the game.
Now automaticly levels the landscape under flanged objects and structures.
The data set file now contains entries to define the paths for IMD's and Stats for each class of
object. See WarzoneData.txt and NecromancyData.txt in the samples directory.
For Warzone the data set file's STRUCTURE section now contains the file name of the structure
stat file used in the game. The editor uses this file to determine which IMD's to load for
structures.
Warzone export option now exports struct.bjo, droid.bjo and templ.bjo so that you can now load exported
games directly into Warzone. Note that the droid.bjo and templ.bjo files are empty so if you wan't the
game to work properly you still have to copy these from an existing saved game ie the Final directory
in Deliverance\Data.
Directory structure changed. The directory structure is now much more rational. An example tree
for Warzone would be:
Deliverance\Data\ // The Warzone data directory.
MyScenario.lnd // The project file saved by the editor.
Textures.pcx // Terrain textures , referenced by MyScenario.lnd.
DataSet.txt // File defining the data set, referenced by MyScenerio.lnd.
Stats\ // Directory containing the stats
Structures.txt // Stats text file defining the structures used in the game.
Structs\ // Directory containing all the IMD's and PCX's needed for the structures.
....
Features\ // Directory containing all the IMD's and PCX's needed for the features.
....
MyScenario.gam // Save game file created when you export the scenario from the editor.
MyScenario\ // Save game directory created when you export the scenario from the editor.
Game.map // Save game data...
Struct.bjo
Feat.bjo
Droid.bjo
Templ.bjo
An example tree for Necromancy would be:
Necromancy\Data\ // The Necromancy data directory.
MyScenario.lnd // The project file saved by the editor.
Textures.pcx // Terrain textures , referenced by MyScenario.lnd.
DataSet.txt // File defining the data set, referenced by MyScenerio.lnd.
Objects\ // Directory containing all the IMD's and PCX's needed for the structures.
.... // Directory containing the stats
MyScenario.map // Game map file created when you export the scenario from the editor.
MyScenario.nob // Object map file created when you export the scenario from the editor.
Now checks for transparancy flags in IMD's and does colour keying accordingly.
Added option to lock camera to a Warzone'ish view in the options menu.
#############################
## CHANGES AS OF 07/10/97. ##
#############################
Added option to disable smooth shading of objects. This is specified in the object set definition
file (ie Warzone.txt) by adding one of the following flags to each IMD definition:
NOSHADE use default shading.
FLATSHADE perform flat shading of each polygon.
SMOOTHSHADE Perform smooth gouraud shading of each polygon.
eg...
mislick.imd OVERLAYED TILESNAP KEY0 NOSHADE
mibould1.imd FLANGED TILESNAP NOKEY SMOOTHSHADE
You can now flip and rotate textures in the texture selection window before laying them down
in the world. To reset all rotations and flips in the texture selection window select
"Reset Texture Flags" in the "Map" menu.
Now checks for and deals with the double sided polygon flag in IMD's
#############################
## CHANGES AS OF 03/10/97. ##
#############################
Now works under release build of DX5
Option added to export Warzone scenarios.
Option added to export Necromancy scenarios.
Save Project now only saves the project file (.LND) use the seperate Export functions to export
scenarios for Warzone or Necromancer.
When exporting Warzone scenarios now creates the following files.
MyScenario.GAM
MyScenario/Game.MAP
MyScenario/Feat.BJO
These can be copied to the Deliverance/Data directory although for now you will have to
copy the droid.bjo , struct.bjo and templ.bjo files from an existing game directory to
the MyScenario directory as the editor dos'nt export these files.
Fixed edge brush window.
Can orbit camera around a point roughly 1/3 distance to the horizon using the < > keys.
Undo/Redo on all texture operations.
Auto scroll when painting / dragging etc in 2d view.
Default height set to 50%
Much more robust.
Colour keying of object textures. You need to specify an extra flag in the object set text
file ( ie features1.txt ) for each IMD. NOKEY for no colour keying or KEYn where n is the palette
index of the transparent colour ie KEY0.
eg...
mislick.imd OVERLAYED TILESNAP KEY0
mibould1.imd FLANGED TILESNAP NOKEY
Objects are now smooth shaded. ( I'll be adding a flag to the object set text file to disable this
for individual objects )
Arbitraty rotation of objects ( as long as they are not flanged )
Option added in map preferences to set tile texture size.
Fixed bug when loading multiple texture pages.
Option to export current height map as .PCX greyscale image.
Can now place , drag and rotate objects in 3d view as well as 2d view.
W and Q keys increase and decrease the 3d draw distance.
Option added to toggle smooth shading of landscape.

28
tools/editworld/TODO Normal file
View File

@ -0,0 +1,28 @@
(done) Set default scroll limits when creating new map.
(done) Set default edge brushes for all tile sets.
For multiplayer editor, replace "export start","expand" and "mission"
with "export game".
(done) Allow objects for individual players to be disabled in views.
(done) Display game coords in both views, tile and world.
(done) Rotate and flip clipboard.
(done) Save texture selector rotate states.
(done) Default height scale to 2.
(done) Default see level to 0.
Allow gateway editing in 3d view.
Fix crash if you paint with an empty edge brush.
Load data from game WDG.
Save data to WDG.

Binary file not shown.

View File

@ -0,0 +1,23 @@
Brushes {
Version 2
NumEdgeBrushes 16
NumUserBrushes 0
EdgeBrushes {
0 128 0 -1 0 29 0 29 16 28 16 29 48 28 0 -1 0 30 0 29 32 -1 0 28 32 30 16 28 48 30 48 30 32 54 0
0 128 0 -1 0 30 32 30 48 28 48 30 16 28 32 -1 0 29 32 30 0 -1 0 28 0 29 48 28 16 29 16 29 0 10 0
0 128 0 -1 0 42 0 42 16 44 16 42 48 44 0 -1 0 43 0 42 32 -1 0 44 32 43 16 44 48 43 48 43 32 13 128
0 128 0 -1 0 43 32 43 48 44 48 43 16 44 32 -1 0 42 32 43 0 -1 0 44 0 42 48 44 16 42 16 42 0 77 0
0 128 0 -1 0 76 32 46 32 72 8 46 0 47 16 -1 0 76 0 76 0 -1 0 47 48 46 0 72 0 46 32 76 32 75 0
0 128 0 -1 0 5 32 5 48 3 16 5 16 3 0 -1 0 4 32 5 0 -1 0 3 32 4 48 3 48 4 16 4 0 7 0
0 128 0 -1 0 4 0 4 16 3 48 4 48 3 32 -1 0 5 0 4 32 -1 0 3 0 5 16 3 16 5 48 5 32 13 0
0 128 0 -1 0 26 0 26 16 25 16 26 48 25 0 -1 0 27 0 26 32 -1 0 25 32 27 16 25 48 27 48 27 32 7 0
0 128 0 -1 0 27 32 27 48 25 48 27 16 25 32 -1 0 26 32 27 0 -1 0 25 0 26 48 25 16 26 16 26 0 24 0
0 128 0 -1 0 21 32 21 48 22 48 21 16 22 32 -1 0 20 32 21 0 -1 0 22 0 20 48 22 16 20 16 20 0 23 0
0 128 0 -1 0 20 0 20 16 22 16 20 48 22 0 -1 0 21 0 20 32 -1 0 22 32 21 16 22 48 21 48 21 32 45 0
0 128 0 -1 0 16 16 16 32 15 32 16 0 15 16 -1 0 17 16 16 48 -1 0 15 48 17 32 15 0 17 0 17 48 18 0
0 128 0 -1 0 17 48 17 0 15 0 17 32 15 48 -1 0 16 48 17 16 -1 0 15 16 16 0 15 32 16 32 16 16 13 0
0 128 0 -1 0 33 0 33 16 32 0 33 48 32 48 -1 0 34 0 33 32 -1 0 32 16 34 16 32 32 34 48 34 32 18 0
0 128 0 -1 0 34 32 34 48 32 32 34 16 32 16 -1 0 33 32 34 0 -1 0 32 48 33 48 32 0 33 16 33 0 24 0
0 128 0 -1 0 78 0 78 0 78 0 78 0 78 0 -1 0 78 0 78 0 -1 0 78 0 78 0 78 0 78 0 78 0 78 0
}
}

View File

@ -0,0 +1,11 @@
TileTypes {
NumTiles 91
Tiles {
2 1 0 2 2 0 2 2 2 2 1 1 1 0 7 7
7 7 7 8 6 4 4 6 3 3 3 2 4 1 4 7
7 7 7 4 4 2 2 2 2 1 4 0 4 4 8 8
2 4 4 4 4 4 4 4 9 9 6 9 6 4 4 9
9 9 9 9 9 9 9 9 8 4 4 4 8 5 6 2
2 2 2 2 2 2 2 2 2 2 0
}
}

View File

@ -0,0 +1,23 @@
Brushes {
Version 2
NumEdgeBrushes 16
NumUserBrushes 0
EdgeBrushes {
0 128 0 -1 0 73 0 73 16 61 48 73 48 61 32 -1 0 74 0 73 32 -1 0 61 0 74 16 61 16 74 48 74 32 39 128
0 128 0 -1 0 74 32 74 48 61 16 74 16 61 0 -1 0 73 32 74 0 -1 0 61 32 73 48 61 48 73 16 73 0 79 0
0 128 0 -1 0 5 0 5 16 7 48 5 48 7 32 -1 0 4 0 5 32 -1 0 7 0 4 16 7 16 4 48 4 32 1 128
0 128 0 -1 0 4 32 4 48 7 16 4 16 7 0 -1 0 5 32 4 0 -1 0 7 32 5 48 7 48 5 16 5 0 79 0
0 128 0 -1 0 27 0 27 16 24 16 27 48 24 0 -1 0 26 0 27 32 -1 0 24 32 26 16 24 48 26 48 26 32 18 0
0 128 0 -1 0 26 32 26 48 24 48 26 16 24 32 -1 0 27 32 26 0 -1 0 24 0 27 48 24 16 27 16 27 0 8 0
0 128 0 -1 0 16 16 16 32 14 16 16 0 14 0 -1 0 17 16 16 48 -1 0 14 32 17 32 14 48 17 0 17 48 18 0
0 128 0 -1 0 17 48 17 0 14 48 17 32 14 32 -1 0 16 48 17 16 -1 0 14 0 16 0 14 16 16 32 16 16 52 0
0 128 0 -1 0 77 0 77 16 72 16 77 48 72 0 -1 0 76 0 77 32 -1 0 72 32 76 16 72 48 76 48 76 32 52 0
0 128 0 -1 0 76 32 76 48 72 48 76 16 72 32 -1 0 77 32 76 0 -1 0 72 0 77 48 72 16 77 16 77 0 23 0
0 128 0 -1 0 35 0 35 16 34 16 35 48 34 0 -1 0 36 0 35 32 -1 0 34 32 36 16 34 48 36 48 36 32 1 0
0 128 0 -1 0 36 32 36 48 34 48 36 16 34 32 -1 0 35 32 36 0 -1 0 34 0 35 48 34 16 35 16 35 0 23 0
0 128 0 -1 0 38 0 38 16 40 48 38 48 40 32 -1 0 39 0 38 32 -1 0 40 0 39 16 40 16 39 48 39 32 23 0
0 128 0 -1 0 39 32 39 48 40 16 39 16 40 0 -1 0 38 32 39 0 -1 0 40 32 38 48 40 48 38 16 38 0 51 0
0 128 0 -1 0 12 48 12 0 13 48 12 32 13 32 -1 0 19 0 12 16 -1 0 13 0 19 0 13 16 19 0 19 0 19 0
0 128 0 -1 0 19 0 19 0 13 16 19 0 13 0 -1 0 12 16 19 0 -1 0 13 32 12 32 13 48 12 0 12 48 52 0
}
}

View File

@ -0,0 +1,11 @@
TileTypes {
NumTiles 91
Tiles {
2 2 2 2 2 1 2 2 1 1 1 1 1 1 7 7
7 7 7 1 8 4 4 0 7 7 7 7 4 4 2 4
0 2 0 0 2 4 4 0 4 6 2 6 6 6 6 6
6 4 6 3 4 4 2 2 9 9 9 2 4 2 4 9
9 9 9 9 8 8 8 8 4 2 0 4 4 2 2 2
3 2 2 2 2 2 2 2 2 2 0
}
}

View File

@ -0,0 +1,23 @@
Brushes {
Version 2
NumEdgeBrushes 16
NumUserBrushes 0
EdgeBrushes {
0 128 0 -1 0 46 16 46 32 30 32 46 0 30 16 47 0 64 0 46 48 47 0 30 48 64 16 30 0 64 48 64 32 65 16
0 128 0 -1 0 43 16 43 32 30 32 43 0 30 16 47 0 10 0 43 48 47 0 30 48 10 16 30 0 10 48 10 32 42 0
0 128 0 -1 0 10 32 10 48 45 32 10 16 45 16 47 0 64 0 10 0 47 0 45 48 64 16 45 0 64 48 64 32 65 128
0 128 0 -1 0 34 0 34 16 32 0 34 48 32 48 -1 0 33 0 34 32 -1 0 32 16 33 16 32 32 33 48 33 32 18 0
0 128 0 -1 0 4 32 4 48 3 48 4 16 3 32 -1 0 5 32 4 0 -1 0 3 0 5 48 3 16 5 16 5 0 6 0
0 128 0 -1 0 46 16 46 32 47 0 46 0 47 16 -1 0 19 0 46 48 -1 0 47 48 19 16 47 32 19 48 19 32 6 128
0 128 0 -1 0 5 0 5 16 3 16 5 48 3 0 -1 0 4 0 5 32 -1 0 3 32 4 16 3 48 4 48 4 32 1 128
0 128 0 -1 0 11 0 11 16 13 0 11 48 13 48 6 128 12 0 11 32 6 128 13 16 12 16 13 32 12 48 12 32 6 128
0 128 0 -1 0 41 32 41 48 39 48 41 16 39 32 -1 0 40 32 41 0 -1 0 39 0 40 48 39 16 40 16 40 0 54 128
0 128 0 -1 0 36 0 36 16 35 16 36 48 35 0 -1 0 37 0 36 32 -1 0 35 32 37 16 35 48 37 48 37 32 54 0
0 128 0 -1 0 66 0 66 16 68 0 66 48 68 48 -1 0 67 0 66 32 -1 0 68 16 67 16 68 32 67 48 67 32 42 128
0 128 0 -1 0 78 32 78 48 77 32 78 16 77 16 -1 0 55 32 78 0 -1 0 77 48 55 48 77 0 55 16 55 0 65 128
0 128 0 -1 0 21 32 21 48 22 48 21 16 22 32 -1 0 20 32 21 0 -1 0 22 0 20 48 22 16 20 16 20 0 23 128
0 128 0 -1 0 67 32 67 48 68 32 67 16 68 16 -1 0 66 32 67 0 -1 0 68 48 66 48 68 0 66 16 66 0 65 128
0 128 0 -1 0 12 32 12 48 49 32 12 16 49 16 -1 0 11 32 12 0 -1 0 49 48 11 48 49 0 11 16 11 0 42 0
0 128 0 -1 0 16 16 16 32 15 32 16 0 15 16 15 16 17 16 16 48 15 16 15 48 17 32 15 0 17 0 17 48 18 0
}
}

View File

@ -0,0 +1,11 @@
TileTypes {
NumTiles 91
Tiles {
2 0 0 2 2 2 2 2 2 1 8 11 2 11 6 7
7 7 7 8 6 1 2 6 11 11 0 11 1 1 8 8
7 7 7 0 0 1 8 0 4 5 11 8 5 8 8 8
11 11 1 1 1 1 1 8 9 9 5 2 6 6 8 9
8 10 10 11 11 8 8 10 8 2 10 0 10 8 8 8
3 2 2 2 2 2 2 2 2 2 0
}
}

View File

@ -0,0 +1,119 @@
PIE 2
TYPE 200
TEXTURE 0 Icons.pcx 256 256
LEVELS 1
LEVEL 1
POINTS 52
0 28 0
-8 28 -14
8 28 -14
16 28 0
-8 28 13
-16 28 0
8 28 13
0 0 0
0 28 0
-4 28 6
4 28 6
8 28 0
-4 28 -7
-8 28 0
4 28 -7
4 68 6
8 68 0
-4 68 6
-8 68 0
-4 68 -7
4 68 -7
0 68 0
4 68 -19
-4 68 -19
0 61 -19
8 61 -19
-8 61 -19
-4 54 -19
4 54 -19
4 68 0
8 61 0
-4 68 0
-8 61 0
-4 54 0
4 54 0
0 61 0
0 28 0
-8 28 -14
8 28 -14
16 28 0
-8 28 13
-16 28 0
8 28 13
0 0 0
4 54 -19
-3 54 -19
0 61 -19
8 61 -19
-8 61 -19
-3 69 -19
4 69 -19
0 61 -47
POLYGONS 60
4200 4 3 2 1 0 8 1 64 64 64 32 48 64 16 64 32 32
4200 4 1 5 4 0 8 1 64 64 16 64 0 32 16 0 32 32
4200 4 4 6 3 0 8 1 64 64 16 0 48 0 64 32 32 32
4200 4 7 7 2 3 8 1 64 64 32 64 32 64 0 0 32 0
4200 4 7 7 1 2 8 1 64 64 32 64 32 64 16 0 0 0
4200 4 7 7 5 1 8 1 64 64 32 64 32 64 32 0 0 0
4200 4 7 7 4 5 8 1 64 64 32 64 32 64 0 0 32 0
4200 4 7 7 6 4 8 1 64 64 32 64 32 64 16 0 64 0
4200 4 7 7 3 6 8 1 64 64 32 64 32 64 32 0 64 0
4200 4 7 7 7 7 8 1 64 64 32 64 32 64 32 64 32 64
4200 4 7 7 7 7 8 1 64 64 32 64 32 64 32 64 32 64
4200 4 7 7 7 7 8 1 64 64 32 64 32 64 32 64 32 64
4200 4 11 10 9 8 8 1 64 64 48 64 59 64 5 64 32 64
4200 4 9 13 12 8 8 1 64 64 5 64 16 64 27 64 32 64
4200 4 12 14 11 8 8 1 64 64 27 64 37 64 48 64 32 64
4200 4 16 15 10 11 8 1 64 64 48 0 59 0 59 64 48 64
4200 4 15 17 9 10 8 1 64 64 0 0 5 0 5 64 0 64
4200 4 17 18 13 9 8 1 64 64 5 0 16 0 16 64 5 64
4200 4 18 19 12 13 8 1 64 64 16 0 27 0 27 64 16 64
4200 4 19 20 14 12 8 1 64 64 27 0 37 0 37 64 27 64
4200 4 20 16 11 14 8 1 64 64 37 0 48 0 48 64 37 64
4200 4 15 16 20 21 8 1 64 64 59 0 48 0 37 0 32 0
4200 4 18 17 15 21 8 1 64 64 16 0 5 0 0 0 32 0
4200 4 20 19 18 21 8 1 64 64 37 0 27 0 16 0 32 0
4200 4 25 24 23 22 8 1 64 64 48 64 32 64 5 64 59 64
4200 4 23 24 27 26 8 1 64 64 5 64 32 64 27 64 16 64
4200 4 27 24 25 28 8 1 64 64 27 64 32 64 48 64 37 64
4200 4 30 25 22 29 8 1 64 64 48 0 48 64 59 64 59 0
4200 4 29 22 23 31 8 1 64 64 0 0 0 64 5 64 5 0
4200 4 31 23 26 32 8 1 64 64 5 0 5 64 16 64 16 0
4200 4 32 26 27 33 8 1 64 64 16 0 16 64 27 64 27 0
4200 4 33 27 28 34 8 1 64 64 27 0 27 64 37 64 37 0
4200 4 34 28 25 30 8 1 64 64 37 0 37 64 48 64 48 0
4200 4 29 35 34 30 8 1 64 64 59 0 32 0 37 0 48 0
4200 4 31 32 35 29 8 1 64 64 5 0 16 0 32 0 0 0
4200 4 33 34 35 32 8 1 64 64 27 0 37 0 32 0 16 0
4200 4 39 38 37 36 8 1 64 64 64 32 48 64 16 64 32 32
4200 4 37 41 40 36 8 1 64 64 16 64 0 32 16 0 32 32
4200 4 40 42 39 36 8 1 64 64 16 0 48 0 64 32 32 32
4200 4 43 43 38 39 8 1 64 64 32 64 32 64 0 0 32 0
4200 4 43 43 37 38 8 1 64 64 32 64 32 64 16 0 0 0
4200 4 43 43 41 37 8 1 64 64 32 64 32 64 32 0 0 0
4200 4 43 43 40 41 8 1 64 64 32 64 32 64 0 0 32 0
4200 4 43 43 42 40 8 1 64 64 32 64 32 64 16 0 64 0
4200 4 43 43 39 42 8 1 64 64 32 64 32 64 32 0 64 0
4200 4 43 43 43 43 8 1 64 64 32 64 32 64 32 64 32 64
4200 4 43 43 43 43 8 1 64 64 32 64 32 64 32 64 32 64
4200 4 43 43 43 43 8 1 64 64 32 64 32 64 32 64 32 64
4200 4 47 46 45 44 8 1 64 64 64 32 32 32 16 64 48 64
4200 4 45 46 49 48 8 1 64 64 16 64 32 32 16 0 0 32
4200 4 49 46 47 50 8 1 64 64 16 0 32 32 64 32 48 0
4200 4 51 47 44 51 8 1 64 64 32 64 32 0 0 0 32 64
4200 4 51 44 45 51 8 1 64 64 32 64 0 0 16 0 32 64
4200 4 51 45 48 51 8 1 64 64 32 64 0 0 32 0 32 64
4200 4 51 48 49 51 8 1 64 64 32 64 32 0 0 0 32 64
4200 4 51 49 50 51 8 1 64 64 32 64 64 0 16 0 32 64
4200 4 51 50 47 51 8 1 64 64 32 64 64 0 32 0 32 64
4200 4 51 51 51 51 8 1 64 64 32 64 32 64 32 64 32 64
4200 4 51 51 51 51 8 1 64 64 32 64 32 64 32 64 32 64
4200 4 51 51 51 51 8 1 64 64 32 64 32 64 32 64 32 64

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

View File

@ -0,0 +1,93 @@
MISCBEGIN
// Terrain tile texture page.
TILETEXTURES "TexPages\TertilesC1.pcx"
// ObjectNames
OBJECTNAMES "Stats\Names.txt"
// Default edge brush definitions, 512 entries.
BRUSHBEGIN
0 128 0 -1 0 29 0 29 16 28 16 29 48 28 0 -1 0 30 0 29 32 -1 0 28 32 30 16 28 48 30 48 30 32 54 0
0 128 0 -1 0 30 32 30 48 28 48 30 16 28 32 -1 0 29 32 30 0 -1 0 28 0 29 48 28 16 29 16 29 0 10 0
0 128 0 -1 0 42 0 42 16 44 16 42 48 44 0 -1 0 43 0 42 32 -1 0 44 32 43 16 44 48 43 48 43 32 13 128
0 128 0 -1 0 43 32 43 48 44 48 43 16 44 32 -1 0 42 32 43 0 -1 0 44 0 42 48 44 16 42 16 42 0 77 0
0 128 0 -1 0 76 32 46 32 72 8 46 0 47 16 -1 0 76 0 76 0 -1 0 47 48 46 0 72 0 46 32 76 32 75 0
0 128 0 -1 0 5 32 5 48 3 16 5 16 3 0 -1 0 4 32 5 0 -1 0 3 32 4 48 3 48 4 16 4 0 7 0
0 128 0 -1 0 4 0 4 16 3 48 4 48 3 32 -1 0 5 0 4 32 -1 0 3 0 5 16 3 16 5 48 5 32 13 0
0 128 0 -1 0 26 0 26 16 25 16 26 48 25 0 -1 0 27 0 26 32 -1 0 25 32 27 16 25 48 27 48 27 32 7 0
0 128 0 -1 0 27 32 27 48 25 48 27 16 25 32 -1 0 26 32 27 0 -1 0 25 0 26 48 25 16 26 16 26 0 24 0
0 128 0 -1 0 21 32 21 48 22 48 21 16 22 32 -1 0 20 32 21 0 -1 0 22 0 20 48 22 16 20 16 20 0 23 0
0 128 0 -1 0 20 0 20 16 22 16 20 48 22 0 -1 0 21 0 20 32 -1 0 22 32 21 16 22 48 21 48 21 32 45 0
0 128 0 -1 0 16 16 16 32 15 32 16 0 15 16 -1 0 17 16 16 48 -1 0 15 48 17 32 15 0 17 0 17 48 18 0
0 128 0 -1 0 17 48 17 0 15 0 17 32 15 48 -1 0 16 48 17 16 -1 0 15 16 16 0 15 32 16 32 16 16 13 0
0 128 0 -1 0 33 0 33 16 32 0 33 48 32 48 -1 0 34 0 33 32 -1 0 32 16 34 16 32 32 34 48 34 32 18 0
0 128 0 -1 0 34 32 34 48 32 32 34 16 32 16 -1 0 33 32 34 0 -1 0 32 48 33 48 32 0 33 16 33 0 24 0
0 128 0 -1 0 78 0 78 0 78 0 78 0 78 0 -1 0 78 0 78 0 -1 0 78 0 78 0 78 0 78 0 78 0 78 0
BRUSHEND
// Default tile types, 128 entries.
TYPEBEGIN
2 1 0 2 2 0 2 2 2 2 1 1 1 0 7 7
7 7 7 8 6 4 4 6 3 3 3 2 4 1 4 7
7 7 7 4 4 2 2 2 2 1 4 0 4 4 8 8
2 4 4 4 4 4 4 4 9 9 6 9 6 4 4 9
9 9 9 9 9 9 9 9 8 4 4 4 8 5 6 2
2 2 2 2 2 2 2 2 2 2 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
TYPEEND
MISCEND
// The features section. Used for Warzone scenarios to specify the feature stats file.
//
FEATURESBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Features\" // Specifies the directory relative to the current working directory.
// where the IMD's can be found.
TEXTDIR "TexPages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
features.txt // Specifies the stats file which defines the features, this is the same
// file ( or a copy of it ) that gets loaded into the game.
FEATURESEND
// The structure section. Used for Warzone scenarios to specify the structure stats file.
//
STRUCTURESBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Structs\" // Specifies the directory relative to the current working directory
// where the IMD's can be found.
TEXTDIR "TexPages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
structures.txt // Specifies the stats file which defines the structures, this is the same
// file ( or a copy of it ) that gets loaded into the game.
STRUCTURESEND
// The droid section. Used for Warzone scenarios to specify the droid stats file.
//
DROIDSBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Droids\" // Specifies the directory relative to the current working directory
// where the IMD's can be found.
TEXTDIR "Texpages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
templates.txt // Specifies the stats file which defines droid templates, this is the same
// file ( or a copy of it ) that gets loaded into the game.
DROIDSEND
// The objects section. All the objects for a Necromancy scenario go in here.
//
OBJECTSBEGIN
STATSDIR "" // Specifies the directory relative to the current working directory
// where the stats file can be found ( Currently not used in this section ).
IMDDIR "Objects\" // Specifies the directory relative to the current working directory
// where the IMD's and textures for the IMD's can be found.
TEXTDIR "" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
OBJECTSEND

View File

@ -0,0 +1,94 @@
MISCBEGIN
// Terrain tile texture page.
TILETEXTURES "TexPages\TertilesC2.pcx"
// ObjectNames
OBJECTNAMES "Stats\Names.txt"
// Default edge brush definitions.
BRUSHBEGIN
0 128 0 -1 0 73 0 73 16 61 48 73 48 61 32 -1 0 74 0 73 32 -1 0 61 0 74 16 61 16 74 48 74 32 39 128
0 128 0 -1 0 74 32 74 48 61 16 74 16 61 0 -1 0 73 32 74 0 -1 0 61 32 73 48 61 48 73 16 73 0 79 0
0 128 0 -1 0 5 0 5 16 7 48 5 48 7 32 -1 0 4 0 5 32 -1 0 7 0 4 16 7 16 4 48 4 32 1 128
0 128 0 -1 0 4 32 4 48 7 16 4 16 7 0 -1 0 5 32 4 0 -1 0 7 32 5 48 7 48 5 16 5 0 79 0
0 128 0 -1 0 27 0 27 16 24 16 27 48 24 0 -1 0 26 0 27 32 -1 0 24 32 26 16 24 48 26 48 26 32 18 0
0 128 0 -1 0 26 32 26 48 24 48 26 16 24 32 -1 0 27 32 26 0 -1 0 24 0 27 48 24 16 27 16 27 0 8 0
0 128 0 -1 0 16 16 16 32 14 16 16 0 14 0 -1 0 17 16 16 48 -1 0 14 32 17 32 14 48 17 0 17 48 18 0
0 128 0 -1 0 17 48 17 0 14 48 17 32 14 32 -1 0 16 48 17 16 -1 0 14 0 16 0 14 16 16 32 16 16 52 0
0 128 0 -1 0 77 0 77 16 72 16 77 48 72 0 -1 0 76 0 77 32 -1 0 72 32 76 16 72 48 76 48 76 32 52 0
0 128 0 -1 0 76 32 76 48 72 48 76 16 72 32 -1 0 77 32 76 0 -1 0 72 0 77 48 72 16 77 16 77 0 23 0
0 128 0 -1 0 35 0 35 16 34 16 35 48 34 0 -1 0 36 0 35 32 -1 0 34 32 36 16 34 48 36 48 36 32 1 0
0 128 0 -1 0 36 32 36 48 34 48 36 16 34 32 -1 0 35 32 36 0 -1 0 34 0 35 48 34 16 35 16 35 0 23 0
0 128 0 -1 0 38 0 38 16 40 48 38 48 40 32 -1 0 39 0 38 32 -1 0 40 0 39 16 40 16 39 48 39 32 23 0
0 128 0 -1 0 39 32 39 48 40 16 39 16 40 0 -1 0 38 32 39 0 -1 0 40 32 38 48 40 48 38 16 38 0 51 0
0 128 0 -1 0 12 48 12 0 13 48 12 32 13 32 -1 0 19 0 12 16 -1 0 13 0 19 0 13 16 19 0 19 0 19 0
0 128 0 -1 0 19 0 19 0 13 16 19 0 13 0 -1 0 12 16 19 0 -1 0 13 32 12 32 13 48 12 0 12 48 52 0
BRUSHEND
// Default tile types, 128 entries.
TYPEBEGIN
2 2 2 2 2 1 2 2 1 1 1 1 1 1 7 7
7 7 7 1 8 4 4 0 7 7 7 7 4 4 2 4
0 2 0 0 2 4 4 0 4 6 2 6 6 6 6 6
6 4 6 3 4 4 2 2 9 9 9 2 4 2 4 9
9 9 9 9 8 8 8 8 4 2 0 4 4 2 2 2
3 2 2 2 2 2 2 2 2 2 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
TYPEEND
MISCEND
// The features section. Used for Warzone scenarios to specify the feature stats file.
//
FEATURESBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Features\" // Specifies the directory relative to the current working directory.
// where the IMD's can be found.
TEXTDIR "TexPages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
features.txt // Specifies the stats file which defines the features, this is the same
// file ( or a copy of it ) that gets loaded into the game.
FEATURESEND
// The structure section. Used for Warzone scenarios to specify the structure stats file.
//
STRUCTURESBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Structs\" // Specifies the directory relative to the current working directory
// where the IMD's can be found.
TEXTDIR "TexPages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
structures.txt // Specifies the stats file which defines the structures, this is the same
// file ( or a copy of it ) that gets loaded into the game.
STRUCTURESEND
// The droid section. Used for Warzone scenarios to specify the droid stats file.
//
DROIDSBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Droids\" // Specifies the directory relative to the current working directory
// where the IMD's can be found.
TEXTDIR "Texpages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
templates.txt // Specifies the stats file which defines droid templates, this is the same
// file ( or a copy of it ) that gets loaded into the game.
DROIDSEND
// The objects section. All the objects for a Necromancy scenario go in here.
//
OBJECTSBEGIN
STATSDIR "" // Specifies the directory relative to the current working directory
// where the stats file can be found ( Currently not used in this section ).
IMDDIR "Objects\" // Specifies the directory relative to the current working directory
// where the IMD's and textures for the IMD's can be found.
TEXTDIR "" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
OBJECTSEND

View File

@ -0,0 +1,94 @@
MISCBEGIN
// Terrain tile texture page.
TILETEXTURES "TexPages\TertilesC3.pcx"
// ObjectNames
OBJECTNAMES "Stats\Names.txt"
// Default edge brush definitions.
BRUSHBEGIN
0 128 0 -1 0 46 16 46 32 30 32 46 0 30 16 47 0 64 0 46 48 47 0 30 48 64 16 30 0 64 48 64 32 65 16
0 128 0 -1 0 43 16 43 32 30 32 43 0 30 16 47 0 10 0 43 48 47 0 30 48 10 16 30 0 10 48 10 32 42 0
0 128 0 -1 0 10 32 10 48 45 32 10 16 45 16 47 0 64 0 10 0 47 0 45 48 64 16 45 0 64 48 64 32 65 128
0 128 0 -1 0 34 0 34 16 32 0 34 48 32 48 -1 0 33 0 34 32 -1 0 32 16 33 16 32 32 33 48 33 32 18 0
0 128 0 -1 0 4 32 4 48 3 48 4 16 3 32 -1 0 5 32 4 0 -1 0 3 0 5 48 3 16 5 16 5 0 6 0
0 128 0 -1 0 46 16 46 32 47 0 46 0 47 16 -1 0 19 0 46 48 -1 0 47 48 19 16 47 32 19 48 19 32 6 128
0 128 0 -1 0 5 0 5 16 3 16 5 48 3 0 -1 0 4 0 5 32 -1 0 3 32 4 16 3 48 4 48 4 32 1 128
0 128 0 -1 0 11 0 11 16 13 0 11 48 13 48 6 128 12 0 11 32 6 128 13 16 12 16 13 32 12 48 12 32 6 128
0 128 0 -1 0 41 32 41 48 39 48 41 16 39 32 -1 0 40 32 41 0 -1 0 39 0 40 48 39 16 40 16 40 0 54 128
0 128 0 -1 0 36 0 36 16 35 16 36 48 35 0 -1 0 37 0 36 32 -1 0 35 32 37 16 35 48 37 48 37 32 54 0
0 128 0 -1 0 66 0 66 16 68 0 66 48 68 48 -1 0 67 0 66 32 -1 0 68 16 67 16 68 32 67 48 67 32 42 128
0 128 0 -1 0 78 32 78 48 77 32 78 16 77 16 -1 0 55 32 78 0 -1 0 77 48 55 48 77 0 55 16 55 0 65 128
0 128 0 -1 0 21 32 21 48 22 48 21 16 22 32 -1 0 20 32 21 0 -1 0 22 0 20 48 22 16 20 16 20 0 23 128
0 128 0 -1 0 67 32 67 48 68 32 67 16 68 16 -1 0 66 32 67 0 -1 0 68 48 66 48 68 0 66 16 66 0 65 128
0 128 0 -1 0 12 32 12 48 49 32 12 16 49 16 -1 0 11 32 12 0 -1 0 49 48 11 48 49 0 11 16 11 0 42 0
0 128 0 -1 0 16 16 16 32 15 32 16 0 15 16 15 16 17 16 16 48 15 16 15 48 17 32 15 0 17 0 17 48 18 0
BRUSHEND
// Default tile types, 128 entries.
TYPEBEGIN
2 0 0 2 2 2 2 2 2 1 8 11 2 11 6 7
7 7 7 8 6 1 2 6 11 11 0 11 1 1 8 8
7 7 7 0 0 1 8 0 4 5 11 8 5 8 8 8
11 11 1 1 1 1 1 8 9 9 5 2 6 6 8 9
8 10 10 11 11 8 8 10 8 2 10 0 10 8 8 8
3 2 2 2 2 2 2 2 2 2 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
TYPEEND
MISCEND
// The features section. Used for Warzone scenarios to specify the feature stats file.
//
FEATURESBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Features\" // Specifies the directory relative to the current working directory.
// where the IMD's can be found.
TEXTDIR "TexPages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
features.txt // Specifies the stats file which defines the features, this is the same
// file ( or a copy of it ) that gets loaded into the game.
FEATURESEND
// The structure section. Used for Warzone scenarios to specify the structure stats file.
//
STRUCTURESBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Structs\" // Specifies the directory relative to the current working directory
// where the IMD's can be found.
TEXTDIR "TexPages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
structures.txt // Specifies the stats file which defines the structures, this is the same
// file ( or a copy of it ) that gets loaded into the game.
STRUCTURESEND
// The droid section. Used for Warzone scenarios to specify the droid stats file.
//
DROIDSBEGIN
STATSDIR "Stats\" // Specifies the directory relative to the current working directory
// where the stats file can be found.
IMDDIR "Droids\" // Specifies the directory relative to the current working directory
// where the IMD's can be found.
TEXTDIR "Texpages\" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
templates.txt // Specifies the stats file which defines droid templates, this is the same
// file ( or a copy of it ) that gets loaded into the game.
DROIDSEND
// The objects section. All the objects for a Necromancy scenario go in here.
//
OBJECTSBEGIN
STATSDIR "" // Specifies the directory relative to the current working directory
// where the stats file can be found ( Currently not used in this section ).
IMDDIR "Objects\" // Specifies the directory relative to the current working directory
// where the IMD's and textures for the IMD's can be found.
TEXTDIR "" // Specifies the directory relative to the current working directory
// where the textures for all IMD's can be found.
OBJECTSEND

View File

@ -0,0 +1,259 @@
JASC-PAL
0100
256
0 0 0
255 255 0
43 43 43
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255
255 255 255

View File

@ -0,0 +1,259 @@
JASC-PAL
0100
256
0 255 0
0 0 0
151 0 255
91 39 47
155 15 23
219 11 43
199 39 39
231 51 51
175 111 111
255 123 135
195 179 179
155 135 147
111 55 67
167 59 83
247 15 63
207 59 87
243 43 79
243 71 95
219 87 107
219 115 127
251 91 123
255 191 199
151 35 67
207 11 91
183 79 107
191 119 147
187 147 163
219 131 159
255 155 199
63 23 55
67 55 63
91 23 75
131 7 83
107 27 107
167 0 91
131 43 91
111 63 111
155 19 119
119 99 119
35 35 51
15 23 83
15 55 95
47 51 87
23 55 135
63 63 111
39 87 131
83 83 135
71 107 147
103 103 163
115 123 139
119 115 187
127 147 159
155 151 175
167 167 203
0 35 43
15 59 63
15 87 103
11 99 135
31 115 111
75 99 103
23 127 143
19 147 171
63 135 163
19 151 203
35 171 183
71 159 191
27 87 71
71 83 79
67 151 107
83 127 123
43 155 147
67 171 163
63 195 187
95 199 179
111 219 199
163 191 183
163 223 191
15 71 31
51 107 67
39 179 75
43 207 91
55 239 111
131 179 155
119 207 143
115 243 155
0 39 0
31 59 7
31 103 11
67 127 47
87 111 63
111 159 71
75 183 91
107 139 103
147 195 123
195 247 195
23 23 19
63 75 11
83 99 19
79 83 47
103 135 51
151 151 31
131 135 79
135 135 119
131 163 99
155 179 83
151 163 131
187 187 79
171 179 155
183 195 127
203 219 179
255 255 159
111 107 35
135 127 43
191 179 19
183 167 51
215 199 31
231 215 7
255 235 19
207 195 103
235 211 91
255 239 131
111 83 7
135 115 11
179 135 43
223 159 7
159 143 95
215 171 63
235 179 91
207 191 151
255 207 115
243 219 155
255 231 183
51 31 0
83 43 0
59 47 27
95 63 27
107 87 59
147 95 35
135 103 71
183 107 27
171 107 55
207 135 27
227 147 83
255 159 67
195 163 135
239 187 147
139 39 7
123 71 35
175 47 7
151 67 19
203 55 11
179 75 23
143 111 99
203 103 51
239 99 43
223 111 79
199 127 103
255 119 63
179 139 123
219 159 115
255 175 115
235 195 175
107 35 19
167 55 47
147 75 59
255 35 0
243 63 11
211 71 39
187 79 63
163 91 83
255 71 39
219 79 67
195 99 87
255 87 67
251 111 95
239 139 111
239 155 139
219 163 163
67 0 0
99 0 0
171 0 0
187 11 31
231 0 0
0 0 115
20 25 150
39 49 185
59 74 220
78 98 255
0 40 0
0 71 0
0 102 0
0 133 0
0 164 0
0 121 121
0 155 155
0 188 188
0 222 222
0 255 255
53 81 98
104 125 113
154 168 128
205 212 142
226 238 157
100 0 100
139 0 116
178 0 133
216 0 149
255 0 165
96 42 0
136 68 0
176 94 0
215 119 0
255 145 0
53 53 54
91 97 130
129 142 184
166 186 220
204 230 255
10 10 10
26 26 26
43 43 43
59 59 59
75 75 75
92 92 92
108 108 108
124 124 124
141 141 141
157 157 157
173 173 173
190 190 190
206 206 206
222 222 222
239 239 239
255 255 255
167 110 47
179 126 61
196 157 77
227 203 115
244 226 127
123 34 19
166 59 28
198 86 37
229 128 52
240 170 56
250 210 72
255 241 96
133 124 81
167 156 110
82 158 154
137 222 219
164 250 247
255 0 255
255 0 255
0 145 0
195 195 195
255 255 255

View File

@ -0,0 +1,12 @@
1 Is it possible to use two keys to rotate the map in the 3d view around the center of the
view ?
2 Can an UNDO command be put in ?
3 When a tile is rotated and then flipped , the 3d map view doesn't update until the camera
moves off and comes back.
4 Pressing X in the top right hand corner of the window should prompt the user with a
" Save Untitled.Ind ?" type message.
5 When painting a texture , the screen should scroll as the mose moves towards the edge of the
window.
6 We need to be able to select an area and auto fill it with the selected texture.
7 Also , if rotate texture is selected and the mouse is left clicked within a selected area
ALL the tiles in that area should be rotated.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,67 @@
Battle Tech Tools.
History:
----------------------------------------------------------------------------
World Editor - Version 1.0. Release Date 10/03/97.
Fixed recently introduced problem with uncontrollable camera.
Can now scroll around views with cursor keys.
2D and 3D view positions are now bound together, the only exception to
this is when moving or rotating in the 3d view useing the shift/mouse action.
Keyboard shortcuts implemented for tool bar.
Fixed problem with scroll bars when switching between world and brush view.
3D Objects can now use multiple texture pages on a per node basis, that is to say
each sub object in the 3d object can reference a different material. NOTE , while
the tools can support this feature you need to cunsult the programmers to ensure
that there system also implements this before generating data that depends upon
multiple texture pages.
Work in progress on stats view, can now switch between textures and stats in
bottom right view , currently hardwired to use a dummy template file called
"Mech.txt".
Work in progress on multiple textures for terrain, can currently add multiple
texture pages to texture view but can't yet use them in terrain.
Scene Viewer - Version 1.0. Release Date 10/01/97.
3D Objects can now use multiple texture pages on a per node basis, that is to say
each sub object in the 3d object can reference a different material.
3DSMAX export plugin - Version 1.0. Release Date 10/03/97.
Now defaults to Neg Y = FALSE as this was causing texture reversal.
3D Objects can now use multiple texture pages on a per node basis, that is to say
each sub object in the 3d object can reference a different material.
----------------------------------------------------------------------------
World Editor - Version 1.0. Release Date 12/02/97.
Editor now supports smooth gouraud shading of landscape.
Some minor bugs fixed.
Work in progress on lighting effects.
----------------------------------------------------------------------------
World Editor - Version 1.0. Release Date 06/02/97.
Now includes user defined edge brushes to speed up texturing of edge
transitions.
Can now select between small and large sizes for edge brushes.
Stats may be edited for each object.
Fixed various minor bugs.
Manual brought up to date.
----------------------------------------------------------------------------
3DSMAX export plugin - Version 1.0. Release Date 15/01/97.
Now exports files with extension .MOF instead of .SCN which was already in
use by another file type. NOTE: Delete the old plugin RSDEXP.DLE from Max's
plugin directory and replace with MOFEXP.DLE found on the BattleTechTools
installation disk.
Scene Viewer - Version 1.0. Release Date 15/01/97.
Now loads files with extension .MOF instead of .SCN
World Editor - Version 1.0. Release Date 15/01/97.
Now allows objects to be placed in landscape.
----------------------------------------------------------------------------

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,520 @@
# Microsoft Developer Studio Project File - Name="EditWorld" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=EditWorld - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "EditWorld.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "EditWorld.mak" CFG="EditWorld - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "EditWorld - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "EditWorld - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/Tools/EditWorld", KNBAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "EditWorld - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "EDITORWORLD" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 winmm.lib dxguid.lib ddraw.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "EditWorld - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "EDITORWORLD" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 winmm.lib dxguid.lib ddraw.lib /nologo /subsystem:windows /debug /machine:I386
!ENDIF
# Begin Target
# Name "EditWorld - Win32 Release"
# Name "EditWorld - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\AutoFlagDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\bmpHandler.cpp
# End Source File
# Begin Source File
SOURCE=.\Brush.cpp
# End Source File
# Begin Source File
SOURCE=.\BTEdit.cpp
# End Source File
# Begin Source File
SOURCE=.\BTEditDoc.cpp
# End Source File
# Begin Source File
SOURCE=.\BTEditView.cpp
# End Source File
# Begin Source File
SOURCE=.\ChnkIO.cpp
# End Source File
# Begin Source File
SOURCE=.\DDImage.cpp
# End Source File
# Begin Source File
SOURCE=.\DebugPrint.c
# End Source File
# Begin Source File
SOURCE=.\DIBDraw.cpp
# End Source File
# Begin Source File
SOURCE=.\DirectX.cpp
# End Source File
# Begin Source File
SOURCE=.\EditWorld.rc
# End Source File
# Begin Source File
SOURCE=.\ExpandLimitsDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\ExportInfo.cpp
# End Source File
# Begin Source File
SOURCE=.\FileParse.cpp
# End Source File
# Begin Source File
SOURCE=.\GateInterface.cpp
# End Source File
# Begin Source File
SOURCE=.\Gateway.c
# End Source File
# Begin Source File
SOURCE=.\GatewaySup.c
# End Source File
# Begin Source File
SOURCE=.\Geometry.cpp
# End Source File
# Begin Source File
SOURCE=.\GrdLand.cpp
# End Source File
# Begin Source File
SOURCE=.\HeightMap.cpp
# End Source File
# Begin Source File
SOURCE=.\InitialLimitsDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\KeyHandler.cpp
# End Source File
# Begin Source File
SOURCE=.\LimitsDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\MainFrm.cpp
# End Source File
# Begin Source File
SOURCE=.\MapPrefs.cpp
# End Source File
# Begin Source File
SOURCE=.\ObjectProperties.cpp
# End Source File
# Begin Source File
SOURCE=.\PCXHandler.cpp
# End Source File
# Begin Source File
SOURCE=.\PlayerMap.cpp
# End Source File
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# Begin Source File
SOURCE=.\SaveSegmentDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# End Source File
# Begin Source File
SOURCE=.\TDView.cpp
# End Source File
# Begin Source File
SOURCE=.\TextSel.cpp
# End Source File
# Begin Source File
SOURCE=.\TexturePrefs.cpp
# End Source File
# Begin Source File
SOURCE=.\TextureView.cpp
# End Source File
# Begin Source File
SOURCE=.\TileTypes.cpp
# End Source File
# Begin Source File
SOURCE=.\WFView.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\AutoFlagDialog.h
# End Source File
# Begin Source File
SOURCE=.\bmpHandler.h
# End Source File
# Begin Source File
SOURCE=.\Brush.h
# End Source File
# Begin Source File
SOURCE=.\BTEdit.h
# End Source File
# Begin Source File
SOURCE=.\BTEditDoc.h
# End Source File
# Begin Source File
SOURCE=.\BTEditView.h
# End Source File
# Begin Source File
SOURCE=.\ChnkIO.h
# End Source File
# Begin Source File
SOURCE=.\D3DWrap.h
# End Source File
# Begin Source File
SOURCE=.\DDImage.h
# End Source File
# Begin Source File
SOURCE=.\DebugPrint.h
# End Source File
# Begin Source File
SOURCE=.\DevMap.h
# End Source File
# Begin Source File
SOURCE=.\DIBDraw.h
# End Source File
# Begin Source File
SOURCE=.\DirectX.h
# End Source File
# Begin Source File
SOURCE=.\ExpandLimitsDlg.h
# End Source File
# Begin Source File
SOURCE=.\ExportInfo.h
# End Source File
# Begin Source File
SOURCE=.\FileParse.h
# End Source File
# Begin Source File
SOURCE=.\GateInterface.h
# End Source File
# Begin Source File
SOURCE=.\Gateway.h
# End Source File
# Begin Source File
SOURCE=.\GatewayDef.h
# End Source File
# Begin Source File
SOURCE=.\Geometry.h
# End Source File
# Begin Source File
SOURCE=.\GrdLand.h
# End Source File
# Begin Source File
SOURCE=.\HeightMap.h
# End Source File
# Begin Source File
SOURCE=.\InitialLimitsDlg.h
# End Source File
# Begin Source File
SOURCE=.\KeyHandler.h
# End Source File
# Begin Source File
SOURCE=.\LimitsDialog.h
# End Source File
# Begin Source File
SOURCE=.\listtemp.h
# End Source File
# Begin Source File
SOURCE=.\macros.h
# End Source File
# Begin Source File
SOURCE=.\MainFrm.h
# End Source File
# Begin Source File
SOURCE=.\MapPrefs.h
# End Source File
# Begin Source File
SOURCE=.\ObjectProperties.h
# End Source File
# Begin Source File
SOURCE=.\PCXHandler.h
# End Source File
# Begin Source File
SOURCE=.\PlayerMap.h
# End Source File
# Begin Source File
SOURCE=.\SaveSegmentDialog.h
# End Source File
# Begin Source File
SOURCE=.\SnapPrefs.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\TDView.h
# End Source File
# Begin Source File
SOURCE=.\TextSel.h
# End Source File
# Begin Source File
SOURCE=.\TexturePrefs.h
# End Source File
# Begin Source File
SOURCE=.\TextureView.h
# End Source File
# Begin Source File
SOURCE=.\TileTypes.h
# End Source File
# Begin Source File
SOURCE=.\typedefs.h
# End Source File
# Begin Source File
SOURCE=.\UndoRedo.h
# End Source File
# Begin Source File
SOURCE=.\WFView.h
# End Source File
# Begin Source File
SOURCE=.\WinStuff.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\arrow.cur
# End Source File
# Begin Source File
SOURCE=.\res\arrowcop.cur
# End Source File
# Begin Source File
SOURCE=.\res\bitmap1.bmp
# End Source File
# Begin Source File
SOURCE=.\res\bitmap2.bmp
# End Source File
# Begin Source File
SOURCE=.\res\bmp00001.bmp
# End Source File
# Begin Source File
SOURCE=.\res\bmp00002.bmp
# End Source File
# Begin Source File
SOURCE=.\res\BTEdit.ico
# End Source File
# Begin Source File
SOURCE=.\res\BTEdit.rc2
# End Source File
# Begin Source File
SOURCE=.\res\BTEditDoc.ico
# End Source File
# Begin Source File
SOURCE=.\res\cur00001.cur
# End Source File
# Begin Source File
SOURCE=.\res\cursor1.cur
# End Source File
# Begin Source File
SOURCE=.\res\height_d.cur
# End Source File
# Begin Source File
SOURCE=.\res\ico00001.ico
# End Source File
# Begin Source File
SOURCE=.\res\ico00002.ico
# End Source File
# Begin Source File
SOURCE=.\res\ico00003.ico
# End Source File
# Begin Source File
SOURCE=.\res\ico00004.ico
# End Source File
# Begin Source File
SOURCE=.\res\icon1.ico
# End Source File
# Begin Source File
SOURCE=.\res\nodrop.cur
# End Source File
# Begin Source File
SOURCE=.\res\pointer_.cur
# End Source File
# Begin Source File
SOURCE=.\res\selectre.cur
# End Source File
# Begin Source File
SOURCE=.\res\smallbru.ico
# End Source File
# Begin Source File
SOURCE=.\res\Toolbar.bmp
# End Source File
# Begin Source File
SOURCE=.\res\toolbar1.bmp
# End Source File
# End Group
# End Target
# End Project

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,722 @@
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CMainFrame
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "editworld.h"
LastPage=0
ClassCount=22
Class1=CBTEditApp
Class2=CAboutDlg
Class3=CBTEditDoc
Class4=CBTEditView
Class5=CMainFrame
Class6=CMapPrefs
Class7=CSaveSegmentDialog
Class8=CSnapPrefs
Class9=CTDView
Class10=CTexturePrefs
Class11=CTextureView
Class12=CWFView
ResourceCount=26
Resource1=IDD_SETSTATSCOMBO
Resource2=IDD_HEIGHTSCALE
Resource3=IDD_MAPPREFS
Resource4=IDR_3DPOPUP
Resource5=IDD_PLAYERMAP
Resource6=IDD_SETSTATSVALUE
Resource7=IDD_OBJECTPROPERTIES
Resource8=IDD_EXPANSIONLIMITS
Resource9=IDD_SAVEMAPSEGMENT
Resource10=IDD_INFO
Resource11=IDD_INITIALLIMITS
Resource12=IDD_DEBUGINFO
Resource13=IDD_ABOUTBOX
Resource14=IDD_TEXTUREPREFS
Resource15=IDR_OBJECTSTATS (English (U.S.))
Resource16=IDR_2DPOPUP
Class13=CObjectProperties
Resource17=IDD_AUTOFLAGDIALOG
Class14=CLimitsDialog
Resource18=IDD_OBJECTPREFS
Resource19=IDR_TILEFLAGS (English (U.S.))
Class15=CInitialLimitsDlg
Class16=CExpandLimitsDlg
Resource20=IDD_OBJECTTYPES
Class17=CPlayerMap
Resource21=IDD_EDITSTATS
Class18=CAutoFlagDialog
Resource22=IDD_PASTEPREFS
Class19=CExportInfo
Resource23=IDR_MAINFRAME (English (U.S.))
Class20=CInfoDialog
Resource24=IDD_SETSTATSCHOICE
Class21=CPastePrefs
Resource25=IDD_SCROLLLIMITS
Class22=CBrushProp
Resource26=IDD_EDGEBRUSH
[CLS:CBTEditApp]
Type=0
BaseClass=CWinApp
HeaderFile=BTEdit.h
ImplementationFile=BTEdit.cpp
[CLS:CAboutDlg]
Type=0
BaseClass=CDialog
HeaderFile=BTEdit.cpp
ImplementationFile=BTEdit.cpp
LastObject=CAboutDlg
[CLS:CBTEditDoc]
Type=0
BaseClass=CDocument
HeaderFile=BTEditDoc.h
ImplementationFile=BTEditDoc.cpp
LastObject=ID_DRAWBRUSHFILL
Filter=N
VirtualFilter=DC
[CLS:CBTEditView]
Type=0
BaseClass=CScrollView
HeaderFile=BTEditView.h
ImplementationFile=BTEditView.cpp
LastObject=ID_TILE_SHOW
Filter=C
VirtualFilter=VWC
[CLS:CMainFrame]
Type=0
BaseClass=CFrameWnd
HeaderFile=MainFrm.h
ImplementationFile=MainFrm.cpp
LastObject=CMainFrame
Filter=T
VirtualFilter=fWC
[CLS:CMapPrefs]
Type=0
BaseClass=CDialog
HeaderFile=MapPrefs.h
ImplementationFile=MapPrefs.cpp
LastObject=CMapPrefs
[CLS:CSaveSegmentDialog]
Type=0
BaseClass=CDialog
HeaderFile=SaveSegmentDialog.h
ImplementationFile=SaveSegmentDialog.cpp
[CLS:CSnapPrefs]
Type=0
BaseClass=CDialog
HeaderFile=SnapPrefs.h
ImplementationFile=SnapPrefs.cpp
[CLS:CTDView]
Type=0
BaseClass=CView
HeaderFile=TDView.h
ImplementationFile=TDView.cpp
[CLS:CTexturePrefs]
Type=0
BaseClass=CDialog
HeaderFile=TexturePrefs.h
ImplementationFile=TexturePrefs.cpp
[CLS:CTextureView]
Type=0
BaseClass=CScrollView
HeaderFile=TextureView.h
ImplementationFile=TextureView.cpp
Filter=C
VirtualFilter=VWC
LastObject=CTextureView
[CLS:CWFView]
Type=0
BaseClass=CScrollView
HeaderFile=WFView.h
ImplementationFile=WFView.cpp
LastObject=CWFView
Filter=C
VirtualFilter=VWC
[DLG:IDD_ABOUTBOX]
Type=1
Class=CAboutDlg
ControlCount=4
Control1=IDC_STATIC,static,1342308480
Control2=IDOK,button,1342373889
Control3=IDC_STATIC,static,1342177294
Control4=IDC_STATIC,static,1342308352
[DLG:IDD_MAPPREFS]
Type=1
Class=CMapPrefs
ControlCount=17
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_MAPWIDTH,edit,1350639744
Control4=IDC_MAPHEIGHT,edit,1350639744
Control5=IDC_MAPSPACEING,edit,1350639744
Control6=IDC_STATIC,static,1342308352
Control7=IDC_STATIC,static,1342308352
Control8=IDC_STATIC,static,1342308352
Control9=IDC_SEALEVEL,edit,1350639744
Control10=IDC_STATIC,static,1342308352
Control11=IDC_TEXTURESIZE,edit,1350639744
Control12=IDC_STATIC,static,1342308352
Control13=IDC_STATIC,button,1342177287
Control14=IDC_STATIC,button,1342177287
Control15=IDC_STATIC,button,1342177287
Control16=IDC_HIGHTSCALE,edit,1350639744
Control17=IDC_STATIC,static,1342308352
[DLG:IDD_SAVEMAPSEGMENT]
Type=1
Class=CSaveSegmentDialog
ControlCount=10
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_SSEG_X,edit,1350631552
Control4=IDC_STATIC,static,1342308352
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
Control7=IDC_STATIC,static,1342308352
Control8=IDC_SSEG_Y,edit,1350631552
Control9=IDC_SSEG_WIDTH,edit,1350631552
Control10=IDC_SSEG_HEIGHT,edit,1350631552
[DLG:IDD_OBJECTPREFS]
Type=1
Class=CSnapPrefs
ControlCount=22
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_SNAPCUSTOM,button,1342308361
Control4=IDC_SNAPNONE,button,1342177289
Control5=IDC_SNAPTCEN,button,1342177289
Control6=IDC_SNAPTL,button,1342177289
Control7=IDC_SNAPTR,button,1342177289
Control8=IDC_SNAPBL,button,1342177289
Control9=IDC_SNAPBR,button,1342177289
Control10=IDC_SNAPQUAD,button,1342177289
Control11=IDC_SNAPCUSTOMX,edit,1350639744
Control12=IDC_SNAPCUSTOMZ,edit,1350639744
Control13=IDC_STATIC,static,1342308352
Control14=IDC_STATIC,static,1342308352
Control15=IDC_STATIC,button,1342177287
Control16=IDC_STATIC,button,1342177287
Control17=IDC_STATIC,button,1342177287
Control18=IDC_ENABLEDGRAVITY,button,1342242819
Control19=IDC_STATIC,button,1342177287
Control20=IDC_STATIC,button,1342177287
Control21=IDC_ROTSNAP,edit,1350639744
Control22=IDC_STATIC,static,1342308352
[DLG:IDD_TEXTUREPREFS]
Type=1
Class=CTexturePrefs
ControlCount=6
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_TEXTUREWIDTH,edit,1350639744
Control4=IDC_TEXTUREHEIGHT,edit,1350639744
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
[TB:IDR_MAINFRAME (English (U.S.))]
Type=1
Class=?
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE
Command4=ID_UNDO
Command5=ID_REDO
Command6=ID_POINT
Command7=ID_MOVE
Command8=ID_OBJECTROTATE
Command9=ID_DRAW_GET
Command10=ID_DRAW_PAINT
Command11=ID_DRAW_FILL
Command12=ID_DRAW_EDGEPAINT
Command13=ID_DRAWBRUSHFILL
Command14=ID_GATEWAY
Command15=ID_HEIGHT_TILEMODE
Command16=ID_HEIGHT_VERTEXMODE
Command17=ID_HEIGHT_PICK
Command18=ID_HEIGHT_PAINT
Command19=ID_PAINTATSEALEVEL
Command20=ID_HEIGHT_DRAG
Command21=ID_MARKRECT
Command22=ID_XFLIPMARKED
Command23=ID_YFLIPMARKED
Command24=ID_COPYMARKED
Command25=ID_PASTE
Command26=ID_PASTEPREFS
Command27=ID_FILE_EXPORTCLIPBOARD
Command28=ID_FILE_IMPORTCLIPBOARD
CommandCount=28
[TB:IDR_TILEFLAGS (English (U.S.))]
Type=1
Class=?
Command1=ID_TRIDIR1
Command2=ID_FLIPX
Command3=ID_FLIPY
Command4=ID_ROTATE90
Command5=ID_TYPESAND
Command6=ID_TYPEGREENMUD
Command7=ID_TYPEWATER
Command8=ID_TYPEROAD
Command9=ID_TYPEBACKEDEARTH
Command10=ID_TYPESANDYBRUSH
Command11=ID_TYPEREDBRUSH
Command12=ID_TYPEPINKROCK
Command13=ID_TYPESHEETICE
Command14=ID_TYPESLUSH
Command15=ID_TYPECLIFFFACE
Command16=ID_TYPERUBBLE
CommandCount=16
[TB:IDR_OBJECTSTATS (English (U.S.))]
Type=1
Class=?
Command1=ID_PLAYER0
Command2=ID_PLAYER0EN
Command3=ID_PLAYER1
Command4=ID_PLAYER1EN
Command5=ID_PLAYER2
Command6=ID_PLAYER2EN
Command7=ID_PLAYER3
Command8=ID_PLAYER3EN
Command9=ID_PLAYER4
Command10=ID_PLAYER4EN
Command11=ID_PLAYER5
Command12=ID_PLAYER5EN
Command13=ID_PLAYER6
Command14=ID_PLAYER6EN
Command15=ID_PLAYER7
Command16=ID_PLAYER7EN
CommandCount=16
[MNU:IDR_MAINFRAME (English (U.S.))]
Type=1
Class=?
Command1=ID_FILE_NEW
Command2=ID_FILE_LOADFEATURESET
Command3=ID_FILE_OPEN
Command4=ID_FILE_SAVE
Command5=ID_FILE_SAVE_AS
Command6=ID_FILE_SAVEMAPSEGMENT
Command7=ID_FILE_EXPORTCLIPBOARD
Command8=ID_FILE_IMPORTCLIPBOARD
Command9=ID_FILE_EXPORTWARZONESCENARIO
Command10=ID_FILE_EXPORTWARZONESCENARIOEXPAND
Command11=ID_FILE_EXPORTWARZONEMISSION
Command12=ID_FILE_SAVEEDGEBRUSHES
Command13=ID_FILE_LOADEDGEBRUSHES
Command14=ID_FILE_SAVETILETYPES
Command15=ID_FILE_LOADTILETYPES
Command16=ID_FILE_MRU_FILE1
Command17=ID_APP_EXIT
Command18=ID_MAP_SETMAPSIZE
Command19=ID_MAP_LOADHEIGHTMAP
Command20=ID_MAP_SAVEHEIGHTMAP
Command21=ID_MAP_EXPORTMAPASBITMAP
Command22=ID_MAP_LOADTILEMAP
Command23=ID_MAP_SAVETILEMAP
Command24=ID_OPTIONS_RESETTEXTUREFLAGS
Command25=ID_MAP_EDITSCROLLLIMITS
Command26=ID_MAP_REFRESHZONES
Command27=ID_VIEW_ZEROCAMERA
Command28=ID_VIEW_ZEROCAMERAPOSITION
Command29=ID_VIEW_ISOMETRIC
Command30=ID_VIEW_FREECAMERA
Command31=ID_VIEW_WORLD
Command32=ID_VIEW_EDGEBRUSHES
Command33=ID_VIEW_TEXTURED
Command34=ID_VIEW_WIREFRAME
Command35=ID_VIEW_GOURAUDSHADING
Command36=ID_VIEW_AUTOHEIGHTSET
Command37=ID_VIEW_SEALEVEL
Command38=ID_VIEW_TERRAINTYPES
Command39=ID_VIEW_FEATURES
Command40=ID_VIEW_BOUNDINGSPHERES
Command41=ID_ENABLEAUTOSNAP
Command42=ID_OPTIONS_USENAMES
Command43=ID_VIEW_LOCATORMAPS
Command44=ID_VIEW_SHOWHEIGHTS
Command45=ID_VIEW_SHOWTEXTURES
Command46=ID_OPTIONS_ZOOMEDIN
Command47=ID_APP_ABOUT
CommandCount=47
[MNU:IDR_3DPOPUP]
Type=1
Class=?
Command1=ID_3DPOPUP_PROPERTIES
CommandCount=1
[MNU:IDR_2DPOPUP]
Type=1
Class=?
Command1=ID_2DPOPUP_PROPERTIES
CommandCount=1
[ACL:IDR_MAINFRAME (English (U.S.))]
Type=1
Class=?
Command1=ID_MARKRECT
Command2=ID_OBJECT_SELECT
Command3=ID_DRAW_PAINT
Command4=ID_DRAW_EDGEPAINT
Command5=ID_COPYMARKED
Command6=ID_HEIGHT_DRAG
Command7=ID_OBJECT_PLACE
Command8=ID_OBJECT_DESELECT
Command9=ID_DRAW_FILL
Command10=ID_DRAW_GET
Command11=ID_HEIGHT_PICK
Command12=ID_HEIGHT_PAINT
Command13=ID_PAINTATSEALEVEL
Command14=ID_OBJECT_DRAG
Command15=ID_FILE_OPEN
Command16=ID_PASTEOBJECTS
Command17=ID_PASTEHEIGHT
Command18=ID_PASTEALL
Command19=ID_PASTETID
Command20=ID_ROTATE90
Command21=ID_FILE_SAVE
Command22=ID_TRIDIR1
Command23=ID_TRIDIR2
Command24=ID_UNDO
Command25=ID_REDO
Command26=ID_PASTE
Command27=ID_OBJECT_GETHEIGHT
Command28=ID_POINT
Command29=ID_VIEW_ZEROCAMERA
Command30=ID_HEIGHT_TILEMODE
Command31=ID_VIEW_WORLD
Command32=ID_HEIGHT_VERTEXMODE
Command33=ID_VIEW_EDGEBRUSHES
Command34=ID_NEXT_PANE
Command35=ID_PREV_PANE
Command36=ID_FLIPX
Command37=ID_FLIPY
CommandCount=37
[DLG:IDD_HEIGHTSCALE]
Type=1
Class=?
ControlCount=4
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_HEIGHTSCALE,edit,1350639744
Control4=IDC_STATIC,static,1342308352
[DLG:IDD_EDITSTATS]
Type=1
Class=?
ControlCount=9
Control1=IDC_OK,button,1342242816
Control2=IDCANCEL,button,1342242816
Control3=IDC_EDIT1,edit,1353781252
Control4=IDC_STATIC,static,1342308352
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATSNAME,static,1342308352
Control7=IDC_STATSINSTANCE,static,1342308352
Control8=IDC_EDITSTATS_IMPORT,button,1342242816
Control9=IDC_EDITSTATS_EXPORT,button,1342242816
[DLG:IDD_SETSTATSCHOICE]
Type=1
Class=?
ControlCount=4
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_STATNAME,static,1342308352
Control4=IDC_STATSCHOICE,listbox,1352728835
[DLG:IDD_SETSTATSCOMBO]
Type=1
Class=?
ControlCount=4
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_STATNAME,static,1342308352
Control4=IDC_STATSCOMBO,combobox,1344339970
[DLG:IDD_SETSTATSVALUE]
Type=1
Class=?
ControlCount=4
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_STATNAME,static,1342308352
Control4=IDC_STATVALUE,edit,1350631552
[DLG:IDD_OBJECTTYPES]
Type=1
Class=?
ControlCount=4
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_TYPELIST,listbox,1352728835
Control4=IDC_STATIC,static,1342308352
[DLG:IDD_OBJECTPROPERTIES]
Type=1
Class=CObjectProperties
ControlCount=31
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_STATIC,static,1342308352
Control4=IDC_STATIC,static,1342308352
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
Control7=IDC_STATIC,static,1342308352
Control8=IDC_STATIC,static,1342308352
Control9=IDC_OP_NAME,edit,1484849280
Control10=IDC_OP_CLASS,edit,1484849280
Control11=IDC_OP_UID,edit,1484849280
Control12=IDC_OP_PLAYERID,edit,1350631552
Control13=IDC_OP_POSX,edit,1350631552
Control14=IDC_OP_POSY,edit,1350631552
Control15=IDC_OP_POSZ,edit,1350631552
Control16=IDC_OP_ROTX,edit,1350631552
Control17=IDC_OP_ROTY,edit,1350631552
Control18=IDC_OP_ROTZ,edit,1350631552
Control19=IDC_STATIC,static,1342308352
Control20=IDC_STATIC,static,1342308352
Control21=IDC_STATIC,static,1342308352
Control22=IDC_STATIC,static,1342308352
Control23=IDC_STATIC,static,1342308352
Control24=IDC_STATIC,static,1342308352
Control25=IDC_STATIC,static,1342308352
Control26=IDC_WOP_POSX,edit,1484849280
Control27=IDC_WOP_POSY,edit,1484849280
Control28=IDC_WOP_POSZ,edit,1484849280
Control29=IDC_STATIC,static,1342308352
Control30=IDC_STATIC,static,1342308352
Control31=IDC_STATIC,static,1342308352
[CLS:CObjectProperties]
Type=0
HeaderFile=ObjectProperties.h
ImplementationFile=ObjectProperties.cpp
BaseClass=CDialog
Filter=D
LastObject=CObjectProperties
VirtualFilter=dWC
[DLG:IDD_SCROLLLIMITS]
Type=1
Class=CLimitsDialog
ControlCount=15
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_LISTLIMITS,SysListView32,1350631425
Control4=IDC_ADDLIMITS,button,1342242816
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
Control7=IDC_STATIC,static,1342308352
Control8=IDC_STATIC,static,1342308352
Control9=IDC_STATIC,static,1342308352
Control10=IDC_SL_SCRIPTNAME,edit,1350631552
Control11=IDC_SL_MINX,edit,1350631552
Control12=IDC_SL_MINZ,edit,1350631552
Control13=IDC_SL_MAXX,edit,1350631552
Control14=IDC_SL_MAXZ,edit,1350631552
Control15=IDC_MODIFY,button,1342242816
[CLS:CLimitsDialog]
Type=0
HeaderFile=LimitsDialog.h
ImplementationFile=LimitsDialog.cpp
BaseClass=CDialog
Filter=D
LastObject=ID_FILE_LOADTILETYPES
VirtualFilter=dWC
[DLG:IDD_EXPANSIONLIMITS]
Type=1
Class=CExpandLimitsDlg
ControlCount=6
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_EXCLUDELIST,combobox,1344339971
Control4=IDC_INCLUDELIST,combobox,1344339971
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
[DLG:IDD_INITIALLIMITS]
Type=1
Class=CInitialLimitsDlg
ControlCount=4
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_INITIALLIMITS,combobox,1344339971
Control4=IDC_STATIC,static,1342308352
[CLS:CInitialLimitsDlg]
Type=0
HeaderFile=InitialLimitsDlg.h
ImplementationFile=InitialLimitsDlg.cpp
BaseClass=CDialog
Filter=D
LastObject=CInitialLimitsDlg
VirtualFilter=dWC
[CLS:CExpandLimitsDlg]
Type=0
HeaderFile=ExpandLimitsDlg.h
ImplementationFile=ExpandLimitsDlg.cpp
BaseClass=CDialog
Filter=D
LastObject=CExpandLimitsDlg
VirtualFilter=dWC
[DLG:IDD_PLAYERMAP]
Type=1
Class=CPlayerMap
ControlCount=10
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_STATIC,static,1342308352
Control4=IDC_STATIC,static,1342308352
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
Control7=IDC_PLAYER1CLAN,combobox,1344340227
Control8=IDC_PLAYER2CLAN,combobox,1344340227
Control9=IDC_PLAYER3CLAN,combobox,1344340227
Control10=IDC_PLAYER4CLAN,combobox,1344340227
[CLS:CPlayerMap]
Type=0
HeaderFile=PlayerMap.h
ImplementationFile=PlayerMap.cpp
BaseClass=CDialog
Filter=D
LastObject=ID_MAP_SETPLAYERCLANMAPPINGS
VirtualFilter=dWC
[DLG:IDD_AUTOFLAGDIALOG]
Type=1
Class=CAutoFlagDialog
ControlCount=13
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_CHKRANDROTATE,button,1342242819
Control4=IDC_CHKRANDXFLIP,button,1342242819
Control5=IDC_CHKRANDYFLIP,button,1342242819
Control6=IDC_ROT0,button,1342177289
Control7=IDC_ROT90,button,1342177289
Control8=IDC_ROT180,button,1342177289
Control9=IDC_ROT270,button,1342177289
Control10=IDC_XFLIP,button,1342242819
Control11=IDC_YFLIP,button,1342242819
Control12=IDC_STATIC,button,1342177287
Control13=IDC_STATIC,button,1342177287
[CLS:CAutoFlagDialog]
Type=0
HeaderFile=AutoFlagDialog.h
ImplementationFile=AutoFlagDialog.cpp
BaseClass=CDialog
Filter=D
LastObject=CAutoFlagDialog
VirtualFilter=dWC
[DLG:IDD_INFO]
Type=1
Class=CExportInfo
ControlCount=2
Control1=IDOK,button,1342242817
Control2=IDC_INFOTEXT,edit,1353779204
[CLS:CExportInfo]
Type=0
HeaderFile=ExportInfo.h
ImplementationFile=ExportInfo.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=ID_OPTIONS_ZOOMEDIN
[DLG:IDD_DEBUGINFO]
Type=1
Class=CInfoDialog
ControlCount=3
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_DEBUGINFO,edit,1350633540
[CLS:CInfoDialog]
Type=0
HeaderFile=InfoDialog.h
ImplementationFile=InfoDialog.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=CInfoDialog
[DLG:IDD_PASTEPREFS]
Type=1
Class=CPastePrefs
ControlCount=6
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_PASTEHEIGHTS,button,1342242819
Control4=IDC_PASTETEXTURES,button,1342242819
Control5=IDC_PASTEOBJECTS,button,1342242819
Control6=IDC_STATIC,static,1342308352
[CLS:CPastePrefs]
Type=0
HeaderFile=PastePrefs.h
ImplementationFile=PastePrefs.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=IDC_PASTEHEIGHTS
[DLG:IDD_EDGEBRUSH]
Type=1
Class=CBrushProp
ControlCount=17
Control1=IDC_HEIGHTSLIDER,msctls_trackbar32,1342242823
Control2=IDC_HEIGHTEDIT,edit,1350631552
Control3=IDC_BRUSHIDNEXT,button,1342242816
Control4=IDC_BRUSHIDPREV,button,1342242816
Control5=IDC_RANDOMRANGE,msctls_trackbar32,1342242821
Control6=IDC_BRUSHID,edit,1350631552
Control7=IDC_STATIC,button,1342177287
Control8=IDC_STATIC,button,1342177287
Control9=IDC_STATIC,button,1342177287
Control10=IDC_RANDEDIT,edit,1350631552
Control11=IDC_STATIC,button,1342177287
Control12=IDC_SETHEIGHT,button,1342308361
Control13=IDC_ABHEIGHT,button,1342177289
Control14=IDC_WATERHEIGHT,button,1342177289
Control15=IDC_BRUSHSIZE,button,1342308361
Control16=IDC_BRUSHLARGE,button,1342177289
Control17=IDC_TILEBUT1,button,1342177419
[CLS:CBrushProp]
Type=0
HeaderFile=BrushProp.h
ImplementationFile=BrushProp.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=CBrushProp

View File

@ -0,0 +1,553 @@
# Microsoft Developer Studio Project File - Name="EditWorld" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=EditWorld - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "EditWorld.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "EditWorld.mak" CFG="EditWorld - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "EditWorld - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "EditWorld - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/Tools/EditWorld", KNBAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "EditWorld - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "EDITORWORLD" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 winmm.lib dxguid.lib ddraw.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "EditWorld - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "EDITORWORLD" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 winmm.lib dxguid.lib ddraw.lib /nologo /subsystem:windows /debug /machine:I386
!ENDIF
# Begin Target
# Name "EditWorld - Win32 Release"
# Name "EditWorld - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\autoflagdialog.cpp
# End Source File
# Begin Source File
SOURCE=.\bmphandler.cpp
# End Source File
# Begin Source File
SOURCE=.\brush.cpp
# End Source File
# Begin Source File
SOURCE=.\brushprop.cpp
# End Source File
# Begin Source File
SOURCE=.\btedit.cpp
# End Source File
# Begin Source File
SOURCE=.\bteditdoc.cpp
# End Source File
# Begin Source File
SOURCE=.\bteditview.cpp
# End Source File
# Begin Source File
SOURCE=.\chnkio.cpp
# End Source File
# Begin Source File
SOURCE=.\ddimage.cpp
# End Source File
# Begin Source File
SOURCE=.\debugprint.c
# End Source File
# Begin Source File
SOURCE=.\dibdraw.cpp
# End Source File
# Begin Source File
SOURCE=.\directx.cpp
# End Source File
# Begin Source File
SOURCE=.\editworld.rc
# End Source File
# Begin Source File
SOURCE=.\expandlimitsdlg.cpp
# End Source File
# Begin Source File
SOURCE=.\exportinfo.cpp
# End Source File
# Begin Source File
SOURCE=.\fileparse.cpp
# End Source File
# Begin Source File
SOURCE=.\gateinterface.cpp
# End Source File
# Begin Source File
SOURCE=.\gateway.c
# End Source File
# Begin Source File
SOURCE=.\gatewaysup.c
# End Source File
# Begin Source File
SOURCE=.\geometry.cpp
# End Source File
# Begin Source File
SOURCE=.\grdland.cpp
# End Source File
# Begin Source File
SOURCE=.\heightmap.cpp
# End Source File
# Begin Source File
SOURCE=.\initiallimitsdlg.cpp
# End Source File
# Begin Source File
SOURCE=.\keyhandler.cpp
# End Source File
# Begin Source File
SOURCE=.\limitsdialog.cpp
# End Source File
# Begin Source File
SOURCE=.\mainfrm.cpp
# End Source File
# Begin Source File
SOURCE=.\mapprefs.cpp
# End Source File
# Begin Source File
SOURCE=.\objectproperties.cpp
# End Source File
# Begin Source File
SOURCE=.\pasteprefs.cpp
# End Source File
# Begin Source File
SOURCE=.\pcxhandler.cpp
# End Source File
# Begin Source File
SOURCE=.\playermap.cpp
# End Source File
# Begin Source File
SOURCE=..\README
# End Source File
# Begin Source File
SOURCE=.\savesegmentdialog.cpp
# End Source File
# Begin Source File
SOURCE=.\stdafx.cpp
# End Source File
# Begin Source File
SOURCE=.\tdview.cpp
# End Source File
# Begin Source File
SOURCE=.\textsel.cpp
# End Source File
# Begin Source File
SOURCE=.\textureprefs.cpp
# End Source File
# Begin Source File
SOURCE=.\textureview.cpp
# End Source File
# Begin Source File
SOURCE=.\tiletypes.cpp
# End Source File
# Begin Source File
SOURCE=.\wfview.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\autoflagdialog.h
# End Source File
# Begin Source File
SOURCE=.\bmphandler.h
# End Source File
# Begin Source File
SOURCE=.\brush.h
# End Source File
# Begin Source File
SOURCE=.\brushprop.h
# End Source File
# Begin Source File
SOURCE=.\btedit.h
# End Source File
# Begin Source File
SOURCE=.\bteditdoc.h
# End Source File
# Begin Source File
SOURCE=.\bteditview.h
# End Source File
# Begin Source File
SOURCE=.\chnkio.h
# End Source File
# Begin Source File
SOURCE=.\d3dwrap.h
# End Source File
# Begin Source File
SOURCE=.\ddimage.h
# End Source File
# Begin Source File
SOURCE=.\debug.h
# End Source File
# Begin Source File
SOURCE=.\debugprint.h
# End Source File
# Begin Source File
SOURCE=.\devmap.h
# End Source File
# Begin Source File
SOURCE=.\dibdraw.h
# End Source File
# Begin Source File
SOURCE=.\directx.h
# End Source File
# Begin Source File
SOURCE=.\expandlimitsdlg.h
# End Source File
# Begin Source File
SOURCE=.\exportinfo.h
# End Source File
# Begin Source File
SOURCE=.\fileparse.h
# End Source File
# Begin Source File
SOURCE=.\gateinterface.h
# End Source File
# Begin Source File
SOURCE=.\gateway.h
# End Source File
# Begin Source File
SOURCE=.\gatewaydef.h
# End Source File
# Begin Source File
SOURCE=.\gatewaymapdefs.h
# End Source File
# Begin Source File
SOURCE=.\geometry.h
# End Source File
# Begin Source File
SOURCE=.\grdland.h
# End Source File
# Begin Source File
SOURCE=.\heightmap.h
# End Source File
# Begin Source File
SOURCE=.\infodialog.h
# End Source File
# Begin Source File
SOURCE=.\initiallimitsdlg.h
# End Source File
# Begin Source File
SOURCE=.\keyhandler.h
# End Source File
# Begin Source File
SOURCE=.\limitsdialog.h
# End Source File
# Begin Source File
SOURCE=.\listtemp.h
# End Source File
# Begin Source File
SOURCE=.\macros.h
# End Source File
# Begin Source File
SOURCE=.\nainfrm.h
# End Source File
# Begin Source File
SOURCE=.\mapprefs.h
# End Source File
# Begin Source File
SOURCE=.\objectproperties.h
# End Source File
# Begin Source File
SOURCE=.\pasteprefs.h
# End Source File
# Begin Source File
SOURCE=.\pcxhandler.h
# End Source File
# Begin Source File
SOURCE=.\playermap.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\savesegmentdialog.h
# End Source File
# Begin Source File
SOURCE=.\snapprefs.h
# End Source File
# Begin Source File
SOURCE=.\stdafx.h
# End Source File
# Begin Source File
SOURCE=.\tdview.h
# End Source File
# Begin Source File
SOURCE=.\textsel.h
# End Source File
# Begin Source File
SOURCE=.\textureprefs.h
# End Source File
# Begin Source File
SOURCE=.\textureview.h
# End Source File
# Begin Source File
SOURCE=.\tiletypes.h
# End Source File
# Begin Source File
SOURCE=.\typedefs.h
# End Source File
# Begin Source File
SOURCE=.\undoredo.h
# End Source File
# Begin Source File
SOURCE=.\wfview.h
# End Source File
# Begin Source File
SOURCE=.\winstuff.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\arrow.cur
# End Source File
# Begin Source File
SOURCE=.\res\arrowcop.cur
# End Source File
# Begin Source File
SOURCE=.\res\bitmap1.bmp
# End Source File
# Begin Source File
SOURCE=.\res\bitmap2.bmp
# End Source File
# Begin Source File
SOURCE=.\res\bmp00001.bmp
# End Source File
# Begin Source File
SOURCE=.\res\bmp00002.bmp
# End Source File
# Begin Source File
SOURCE=.\res\btedit.ico
# End Source File
# Begin Source File
SOURCE=.\res\btedit.rc2
# End Source File
# Begin Source File
SOURCE=.\res\bteditdoc.ico
# End Source File
# Begin Source File
SOURCE=.\res\cur00001.cur
# End Source File
# Begin Source File
SOURCE=.\res\cursor1.cur
# End Source File
# Begin Source File
SOURCE=.\res\height_d.cur
# End Source File
# Begin Source File
SOURCE=.\res\ico00001.ico
# End Source File
# Begin Source File
SOURCE=.\res\ico00002.ico
# End Source File
# Begin Source File
SOURCE=.\res\ico00003.ico
# End Source File
# Begin Source File
SOURCE=.\res\ico00004.ico
# End Source File
# Begin Source File
SOURCE=.\res\icon1.ico
# End Source File
# Begin Source File
SOURCE=.\res\nodrop.cur
# End Source File
# Begin Source File
SOURCE=.\res\pointer_.cur
# End Source File
# Begin Source File
SOURCE=.\res\selectre.cur
# End Source File
# Begin Source File
SOURCE=.\res\smallbru.ico
# End Source File
# Begin Source File
SOURCE=.\res\toolbar.bmp
# End Source File
# Begin Source File
SOURCE=.\res\toolbar1.bmp
# End Source File
# End Group
# End Target
# End Project

View File

@ -0,0 +1,33 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "EditWorld"=.\EditWorld.dsp - Package Owner=<4>
Package=<5>
{{{
begin source code control
"$/Tools/EditWorld", KNBAAAAA
.
end source code control
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -0,0 +1,473 @@
[InstallShield Wizard]
iDate=0
iTime=0
Flag=0
ISX.EXE Size=495104
ISX.EXE Date=3:35:30PM 4/22/1996
ISX.EXE Ver=1.0.0.1
SETUP.EXE Size=44064
SETUP.EXE Date=2:21:44AM 4/29/1996
SETUP.EXE Ver=3.0.98.0
SETUP.INS Size=176530
SETUP.INS Date=7:10:24PM 4/16/1996
SETUP.INS Ver=Not available
_INST16.EX_ Size=176530
_INST16.EX_ Date=7:10:24PM 4/16/1996
_INST16.EX_ Ver=Not available
_INST32I.EX_ Size=312328
_INST32I.EX_ Date=3:57:56AM 4/29/1996
_INST32I.EX_ Ver=Not available
ISDEPEND.INI Size=1650
ISDEPEND.INI Date=2:34:46PM 1/29/1996
ISDEPEND.INI Ver=Not available
SWDEPEND.INI Size=1154
SWDEPEND.INI Date=4:56:50PM 1/12/1996
SWDEPEND.INI Ver=Not available
ICOMP.EXE Size=119808
ICOMP.EXE Date=4:05:10PM 1/15/1996
ICOMP.EXE Ver=3.00.062
SPLIT.EXE Size=90624
SPLIT.EXE Date=4:09:36PM 1/15/1996
SPLIT.EXE Ver=3.00.060
PACKLIST.EXE Size=87552
PACKLIST.EXE Date=4:10:30PM 1/15/1996
PACKLIST.EXE Ver=3.00.060
Version=1.0
DevTool=for Visual C++ 4.1
Platform=Win32
PtrBase=30450
PtrPosY=2439
PtrPage=0
DisksBuilt=1
DisksDir=EDITWO~1\650MB\
TabsVisit=11111111100001111111
[VisualDesign]
AppName=EditWorld
Version=1.0
Company=Pumpkin Studios
Title=EditWorld
TitleType=1
BackgrndBmp=C:\source\EditWorld\Pumpkin16.bmp
BackgrndAlign=4
Backgrnd=1
BackgrndColor=0
Uninstall=1
Silent=1
[SysRequire]
Colors=0
CPU=0
Resolution=0
OperateSys=0
MathChip=0
WarnOnly=0
[Autoexec]
CommandLoc=0
[RegEntries]
Reg1Path=HKEY_CLASSES_ROOT
Reg1Val1Type=0
Reg1Val1Name=(Default)
Reg1Val1Data=(value not set)
Reg1Vals=1
Reg2Path=HKEY_CURRENT_USER
Reg2Val1Type=0
Reg2Val1Name=(Default)
Reg2Val1Data=(value not set)
Reg2Vals=1
Reg3Path=HKEY_LOCAL_MACHINE
Reg3Val1Type=0
Reg3Val1Name=(Default)
Reg3Val1Data=(value not set)
Reg3Vals=1
Reg4Path=HKEY_USERS
Reg4Val1Type=0
Reg4Val1Name=(Default)
Reg4Val1Data=(value not set)
Reg4Vals=1
Reg5Path=HKEY_CURRENT_CONFIG
Reg5Val1Type=0
Reg5Val1Name=(Default)
Reg5Val1Data=(value not set)
Reg5Vals=1
Reg6Path=HKEY_DYN_DATA
Reg6Val1Type=0
Reg6Val1Name=(Default)
Reg6Val1Data=(value not set)
Reg6Vals=1
Regs=6
[Groups]
Groups=8
Group1Size=401364
Group1Files=2
Group1Name=Program Files
Group1Dir=<INSTALLDIR>
Group1File1=C:\source\EditWorld\Release\EditWorld.exe
Group1File2=C:\source\EditWorld\ReadMe.txt
Group2Size=1251088
Group2Files=2
Group2Auto=10
Group2ID=38060
Group2Name=Support Files-WinSysDir
Group2Dir=<WINSYSDIR>
Group2File1=C:\WINDOWS\SYSTEM\MFC40.DLL
Group2File1Auto=10
Group2File1Reg=1
Group2File2=C:\WINDOWS\SYSTEM\MSVCRT40.DLL
Group2File2Auto=10
Group2Reg=1
Group3Size=866091
Group3Files=12
Group3Name=Warzone Sample Files
Group3Dir=<INSTALLDIR>\SAMPLES
Group3File1=C:\source\EditWorld\Samples\WarzoneDataC2.eds
Group3File2=C:\source\EditWorld\Samples\C2Edge.ebr
Group3File3=C:\source\EditWorld\Samples\C3Edge.ebr
Group3File4=C:\source\EditWorld\Samples\WarzoneDataC1.eds
Group3File5=C:\source\EditWorld\Samples\C1Edge.ebr
Group3File6=C:\source\EditWorld\Samples\WarzoneDataC3.eds
Group3File7=C:\source\EditWorld\Samples\C1Types.ett
Group3File8=C:\source\EditWorld\Samples\C2Types.ett
Group3File9=C:\source\EditWorld\Samples\C3Types.ett
Group3File10=C:\source\EditWorld\Samples\CAMPAIGN MAP 2-7.lnd
Group3File11=C:\source\EditWorld\Samples\CAMPAIGN MAP 3-3.lnd
Group3File12=C:\source\EditWorld\Samples\CM-Rush2.lnd
Group4Size=124986
Group4Files=85
Group4Name=Warzone Sample Features
Group4Dir=<INSTALLDIR>\SAMPLES\FEATURES
Group4File1=C:\source\EditWorld\Samples\features\Miruin6.pie
Group4File2=C:\source\EditWorld\Samples\features\BLFACTRD.PIE
Group4File3=C:\source\EditWorld\Samples\features\BLWARE1.PIE
Group4File4=C:\source\EditWorld\Samples\features\BLWARE2.PIE
Group4File5=C:\source\EditWorld\Samples\features\BLWARE3.PIE
Group4File6=C:\source\EditWorld\Samples\features\DrWreck.PIE
Group4File7=C:\source\EditWorld\Samples\features\miairtrf.PIE
Group4File8=C:\source\EditWorld\Samples\features\MiArtECM.PIE
Group4File9=C:\source\EditWorld\Samples\features\miarthov.PIE
Group4File10=C:\source\EditWorld\Samples\features\MIBAR.PIE
Group4File11=C:\source\EditWorld\Samples\features\mibcool.PIE
Group4File12=C:\source\EditWorld\Samples\features\MIBEACON.PIE
Group4File13=C:\source\EditWorld\Samples\features\Mibldwa2.PIE
Group4File14=C:\source\EditWorld\Samples\features\Mibldwa3.PIE
Group4File15=C:\source\EditWorld\Samples\features\Mibldwat.PIE
Group4File16=C:\source\EditWorld\Samples\features\Miblucar.PIE
Group4File17=C:\source\EditWorld\Samples\features\MiBould1.PIE
Group4File18=C:\source\EditWorld\Samples\features\MiBould2.PIE
Group4File19=C:\source\EditWorld\Samples\features\MiBould3.PIE
Group4File20=C:\source\EditWorld\Samples\features\mibrdfuk.PIE
Group4File21=C:\source\EditWorld\Samples\features\MiBridg1.PIE
Group4File22=C:\source\EditWorld\Samples\features\MiBridge.PIE
Group4File23=C:\source\EditWorld\Samples\features\MiBridgx.PIE
Group4File24=C:\source\EditWorld\Samples\features\MiBuil10.pie
Group4File25=C:\source\EditWorld\Samples\features\MiBuil11.pie
Group4File26=C:\source\EditWorld\Samples\features\MiBuil12.PIE
Group4File27=C:\source\EditWorld\Samples\features\MIBUIL16.PIE
Group4File28=C:\source\EditWorld\Samples\features\Mibuil17.pie
Group4File29=C:\source\EditWorld\Samples\features\Mibuild1.pie
Group4File30=C:\source\EditWorld\Samples\features\Mibuild2.pie
Group4File31=C:\source\EditWorld\Samples\features\MiBuild3.PIE
Group4File32=C:\source\EditWorld\Samples\features\MiBuild7.PIE
Group4File33=C:\source\EditWorld\Samples\features\mibuild8.pie
Group4File34=C:\source\EditWorld\Samples\features\MIBUILD9.PIE
Group4File35=C:\source\EditWorld\Samples\features\Micabin1.pie
Group4File36=C:\source\EditWorld\Samples\features\MICABIN2.PIE
Group4File37=C:\source\EditWorld\Samples\features\MICABIN3.PIE
Group4File38=C:\source\EditWorld\Samples\features\MICABIN4.PIE
Group4File39=C:\source\EditWorld\Samples\features\MICABIN5.PIE
Group4File40=C:\source\EditWorld\Samples\features\MiCamper.PIE
Group4File41=C:\source\EditWorld\Samples\features\Micapsul.pie
Group4File42=C:\source\EditWorld\Samples\features\Michevy.PIE
Group4File43=C:\source\EditWorld\Samples\features\micool.PIE
Group4File44=C:\source\EditWorld\Samples\features\micrane.PIE
Group4File45=C:\source\EditWorld\Samples\features\mifactry.PIE
Group4File46=C:\source\EditWorld\Samples\features\MiJeep.PIE
Group4File47=C:\source\EditWorld\Samples\features\minuke.PIE
Group4File48=C:\source\EditWorld\Samples\features\MIOIL.PIE
Group4File49=C:\source\EditWorld\Samples\features\MIOILTOW.PIE
Group4File50=C:\source\EditWorld\Samples\features\Mipickup.PIE
Group4File51=C:\source\EditWorld\Samples\features\mipipe.PIE
Group4File52=C:\source\EditWorld\Samples\features\Mipipe1.pie
Group4File53=C:\source\EditWorld\Samples\features\Mipipe1A.pie
Group4File54=C:\source\EditWorld\Samples\features\Mipipe2A.pie
Group4File55=C:\source\EditWorld\Samples\features\Mipipe3A.pie
Group4File56=C:\source\EditWorld\Samples\features\mipylncb.PIE
Group4File57=C:\source\EditWorld\Samples\features\mipylon.PIE
Group4File58=C:\source\EditWorld\Samples\features\Miruin1.pie
Group4File59=C:\source\EditWorld\Samples\features\Miruin10.pie
Group4File60=C:\source\EditWorld\Samples\features\Miruin2.pie
Group4File61=C:\source\EditWorld\Samples\features\Miruin3.pie
Group4File62=C:\source\EditWorld\Samples\features\Miruin4.pie
Group4File63=C:\source\EditWorld\Samples\features\Miruin5.pie
Group4File64=C:\source\EditWorld\Samples\features\BLBRHUT1.PIE
Group4File65=C:\source\EditWorld\Samples\features\Miruin7.pie
Group4File66=C:\source\EditWorld\Samples\features\Miruin8.pie
Group4File67=C:\source\EditWorld\Samples\features\Miruin9.pie
Group4File68=C:\source\EditWorld\Samples\features\Mislick.pie
Group4File69=C:\source\EditWorld\Samples\features\MISTREE1.PIE
Group4File70=C:\source\EditWorld\Samples\features\MISTREE2.PIE
Group4File71=C:\source\EditWorld\Samples\features\MISTREE3.PIE
Group4File72=C:\source\EditWorld\Samples\features\Mitanker.PIE
Group4File73=C:\source\EditWorld\Samples\features\MitankerH.PIE
Group4File74=C:\source\EditWorld\Samples\features\MITRAPCR.PIE
Group4File75=C:\source\EditWorld\Samples\features\Mitrapst.pie
Group4File76=C:\source\EditWorld\Samples\features\MiTrees.PIE
Group4File77=C:\source\EditWorld\Samples\features\MiTrees2.PIE
Group4File78=C:\source\EditWorld\Samples\features\MiTrees3.PIE
Group4File79=C:\source\EditWorld\Samples\features\MIWATOW.PIE
Group4File80=C:\source\EditWorld\Samples\features\MiWreck.PIE
Group4File81=C:\source\EditWorld\Samples\features\MiWrek1.PIE
Group4File82=C:\source\EditWorld\Samples\features\MiWrek2.PIE
Group4File83=C:\source\EditWorld\Samples\features\MiWrek3.PIE
Group4File84=C:\source\EditWorld\Samples\features\MiWrek4.PIE
Group4File85=C:\source\EditWorld\Samples\features\MiWrek5.PIE
Group5Size=95169
Group5Files=4
Group5Name=Warzone Sample Stats
Group5Dir=<INSTALLDIR>\SAMPLES\STATS
Group5File1=C:\source\EditWorld\Samples\stats\Names.txt
Group5File2=C:\source\EditWorld\Samples\stats\Features.txt
Group5File3=C:\source\EditWorld\Samples\stats\structures.txt
Group5File4=C:\source\EditWorld\Samples\stats\Templates.txt
Group6Size=217945
Group6Files=102
Group6Name=Warzone Sample Structures
Group6Dir=<INSTALLDIR>\SAMPLES\STRUCTS
Group6File1=C:\source\EditWorld\Samples\structs\Blwallh.pie
Group6File2=C:\source\EditWorld\Samples\structs\Blaamnt2.PIE
Group6File3=C:\source\EditWorld\Samples\structs\BlAdvlab.PIE
Group6File4=C:\source\EditWorld\Samples\structs\BlAerolb.PIE
Group6File5=C:\source\EditWorld\Samples\structs\BLBCFACT.PIE
Group6File6=C:\source\EditWorld\Samples\structs\BLBDRDCM.PIE
Group6File7=C:\source\EditWorld\Samples\structs\BLBFact.PIE
Group6File8=C:\source\EditWorld\Samples\structs\Blbgen.PIE
Group6File9=C:\source\EditWorld\Samples\structs\Blbhq.PIE
Group6File10=C:\source\EditWorld\Samples\structs\BlbPower.PIE
Group6File11=C:\source\EditWorld\Samples\structs\blbrbbnk.PIE
Group6File12=C:\source\EditWorld\Samples\structs\BlBrbcr1.PIE
Group6File13=C:\source\EditWorld\Samples\structs\BlBrbfac.PIE
Group6File14=C:\source\EditWorld\Samples\structs\BlBrbgen.PIE
Group6File15=C:\source\EditWorld\Samples\structs\BlBrbtw1.PIE
Group6File16=C:\source\EditWorld\Samples\structs\BLBRBTW2.PIE
Group6File17=C:\source\EditWorld\Samples\structs\BlBrbwlh.PIE
Group6File18=C:\source\EditWorld\Samples\structs\blbrepr2.PIE
Group6File19=C:\source\EditWorld\Samples\structs\BlBResch.PIE
Group6File20=C:\source\EditWorld\Samples\structs\BLBRHUT1.PIE
Group6File21=C:\source\EditWorld\Samples\structs\BLBRLOOK.PIE
Group6File22=C:\source\EditWorld\Samples\structs\blbrmrtp.PIE
Group6File23=C:\source\EditWorld\Samples\structs\BLBRTOWF.PIE
Group6File24=C:\source\EditWorld\Samples\structs\BlBrTOWR.PIE
Group6File25=C:\source\EditWorld\Samples\structs\BLBUNKMS.PIE
Group6File26=C:\source\EditWorld\Samples\structs\BLCANPIL.PIE
Group6File27=C:\source\EditWorld\Samples\structs\BLCFACT1.PIE
Group6File28=C:\source\EditWorld\Samples\structs\BLDerik.PIE
Group6File29=C:\source\EditWorld\Samples\structs\Bldrdcm0.PIE
Group6File30=C:\source\EditWorld\Samples\structs\Bldrdcm1.PIE
Group6File31=C:\source\EditWorld\Samples\structs\Bldrdcm2.PIE
Group6File32=C:\source\EditWorld\Samples\structs\Bldrdcm3.PIE
Group6File33=C:\source\EditWorld\Samples\structs\Bldrdcm4.PIE
Group6File34=C:\source\EditWorld\Samples\structs\BLFact0.PIE
Group6File35=C:\source\EditWorld\Samples\structs\BLFact1.PIE
Group6File36=C:\source\EditWorld\Samples\structs\BLFact2.PIE
Group6File37=C:\source\EditWorld\Samples\structs\blgaurdn.PIE
Group6File38=C:\source\EditWorld\Samples\structs\Blgrdnex.PIE
Group6File39=C:\source\EditWorld\Samples\structs\Blguard1.pie
Group6File40=C:\source\EditWorld\Samples\structs\Blguard2.PIE
Group6File41=C:\source\EditWorld\Samples\structs\Blguard3.PIE
Group6File42=C:\source\EditWorld\Samples\structs\BLGUARDM.PIE
Group6File43=C:\source\EditWorld\Samples\structs\BLGUARDR.PIE
Group6File44=C:\source\EditWorld\Samples\structs\Blgyrlab.PIE
Group6File45=C:\source\EditWorld\Samples\structs\BLhardpt.PIE
Group6File46=C:\source\EditWorld\Samples\structs\BlHevlab.PIE
Group6File47=C:\source\EditWorld\Samples\structs\BLHOWMNT.PIE
Group6File48=C:\source\EditWorld\Samples\structs\Blhq.PIE
Group6File49=C:\source\EditWorld\Samples\structs\BLHQ2.PIE
Group6File50=C:\source\EditWorld\Samples\structs\Blhq3.pie
Group6File51=C:\source\EditWorld\Samples\structs\Blhq4.pie
Group6File52=C:\source\EditWorld\Samples\structs\blidcoll.PIE
Group6File53=C:\source\EditWorld\Samples\structs\blidnexs.PIE
Group6File54=C:\source\EditWorld\Samples\structs\blidnupr.PIE
Group6File55=C:\source\EditWorld\Samples\structs\blidplyr.PIE
Group6File56=C:\source\EditWorld\Samples\structs\BlIndlab.PIE
Group6File57=C:\source\EditWorld\Samples\structs\Bllaslab.PIE
Group6File58=C:\source\EditWorld\Samples\structs\BLMRTPIT.PIE
Group6File59=C:\source\EditWorld\Samples\structs\Blmssilo.PIE
Group6File60=C:\source\EditWorld\Samples\structs\BlNanlab.PIE
Group6File61=C:\source\EditWorld\Samples\structs\blnavbak.PIE
Group6File62=C:\source\EditWorld\Samples\structs\blnavbnk.PIE
Group6File63=C:\source\EditWorld\Samples\structs\BLPILBOX.PIE
Group6File64=C:\source\EditWorld\Samples\structs\BlPower0.PIE
Group6File65=C:\source\EditWorld\Samples\structs\BlPower1.PIE
Group6File66=C:\source\EditWorld\Samples\structs\BlPower2.PIE
Group6File67=C:\source\EditWorld\Samples\structs\BlPower3.PIE
Group6File68=C:\source\EditWorld\Samples\structs\BlPower4.PIE
Group6File69=C:\source\EditWorld\Samples\structs\BlPowlab.PIE
Group6File70=C:\source\EditWorld\Samples\structs\Blrbpair.pie
Group6File71=C:\source\EditWorld\Samples\structs\BlResch0.PIE
Group6File72=C:\source\EditWorld\Samples\structs\BlResch1.PIE
Group6File73=C:\source\EditWorld\Samples\structs\BlResch2.PIE
Group6File74=C:\source\EditWorld\Samples\structs\BlResch3.PIE
Group6File75=C:\source\EditWorld\Samples\structs\BlResch4.PIE
Group6File76=C:\source\EditWorld\Samples\structs\Blrotlab.PIE
Group6File77=C:\source\EditWorld\Samples\structs\BLRPAIR1.PIE
Group6File78=C:\source\EditWorld\Samples\structs\Blrpair2.pie
Group6File79=C:\source\EditWorld\Samples\structs\BlRpair3.PIE
Group6File80=C:\source\EditWorld\Samples\structs\Blvfact0.pie
Group6File81=C:\source\EditWorld\Samples\structs\BLVFACT1.PIE
Group6File82=C:\source\EditWorld\Samples\structs\Blvfact2.pie
Group6File83=C:\source\EditWorld\Samples\structs\BLVTOLPD.PIE
Group6File84=C:\source\EditWorld\Samples\structs\Blwall2.PIE
Group6File85=C:\source\EditWorld\Samples\structs\Blwall3.PIE
Group6File86=C:\source\EditWorld\Samples\structs\BlWallc1.PIE
Group6File87=C:\source\EditWorld\Samples\structs\BlWallc2.PIE
Group6File88=C:\source\EditWorld\Samples\structs\BlWallc3.PIE
Group6File89=C:\source\EditWorld\Samples\structs\Blaamnt1.PIE
Group6File90=C:\source\EditWorld\Samples\structs\cybd_std.pie
Group6File91=C:\source\EditWorld\Samples\structs\Drtrans.PIE
Group6File92=C:\source\EditWorld\Samples\structs\ExRocket.PIE
Group6File93=C:\source\EditWorld\Samples\structs\icdozer.PIE
Group6File94=C:\source\EditWorld\Samples\structs\MIBAR.PIE
Group6File95=C:\source\EditWorld\Samples\structs\mibcool.PIE
Group6File96=C:\source\EditWorld\Samples\structs\micool.PIE
Group6File97=C:\source\EditWorld\Samples\structs\minuke.PIE
Group6File98=C:\source\EditWorld\Samples\structs\MITRAP2.PIE
Group6File99=C:\source\EditWorld\Samples\structs\MITRAPST.PIE
Group6File100=C:\source\EditWorld\Samples\structs\miupbase.PIE
Group6File101=C:\source\EditWorld\Samples\structs\miupdish.PIE
Group6File102=C:\source\EditWorld\Samples\structs\miuptrim.PIE
Group7Size=27822
Group7Files=6
Group7Name=Data Files
Group7Dir=<INSTALLDIR>\DATA
Group7File1=C:\source\EditWorld\Data\Buttons.pcx
Group7File2=C:\source\EditWorld\Data\Icons.pcx
Group7File3=C:\source\EditWorld\Data\Icon.pie
Group7File4=C:\source\EditWorld\Data\WarzoneDataC2.eds
Group7File5=C:\source\EditWorld\Data\WarzoneDataC1.eds
Group7File6=C:\source\EditWorld\Data\WarzoneDataC3.eds
Group8Size=4674239
Group8Files=57
Group8Name=Warzone Sample Texture Pages
Group8Dir=<INSTALLDIR>\SAMPLES\TEXPAGES
Group8File1=C:\source\EditWorld\Samples\texpages\Page-7-Barbarians-Urban.pcx
Group8File2=C:\source\EditWorld\Samples\texpages\Page-10-Laboratories-hard.pcx
Group8File3=C:\source\EditWorld\Samples\texpages\Page-10-Laboratories-Soft.pcx
Group8File4=C:\source\EditWorld\Samples\texpages\Page-11-Player Buildings.pcx
Group8File5=C:\source\EditWorld\Samples\texpages\Page-11-Player Buildings-Hard.pcx
Group8File6=C:\source\EditWorld\Samples\texpages\Page-11-Player Buildings-soft.pcx
Group8File7=C:\source\EditWorld\Samples\texpages\Page-12-Player Buildings.pcx
Group8File8=C:\source\EditWorld\Samples\texpages\Page-13-Player Buildings.pcx
Group8File9=C:\source\EditWorld\Samples\texpages\Page-14-Droid Hubs.pcx
Group8File10=C:\source\EditWorld\Samples\texpages\Page-15-Droid Hubs.pcx
Group8File11=C:\source\EditWorld\Samples\texpages\Page-16-Droid Drives.pcx
Group8File12=C:\source\EditWorld\Samples\texpages\Page-17-Droid Weapons.pcx
Group8File13=C:\source\EditWorld\Samples\texpages\Page-18-FX`s.pcx
Group8File14=C:\source\EditWorld\Samples\texpages\Page-18-FX`s-hard.pcx
Group8File15=C:\source\EditWorld\Samples\texpages\Page-18-FX`s-soft.pcx
Group8File16=C:\source\EditWorld\Samples\texpages\Page-19-FX`s.pcx
Group8File17=C:\source\EditWorld\Samples\texpages\Page-19-FX`s-hard.pcx
Group8File18=C:\source\EditWorld\Samples\texpages\Page-19-FX`s-soft.pcx
Group8File19=C:\source\EditWorld\Samples\texpages\Page-20-FX`s.pcx
Group8File20=C:\source\EditWorld\Samples\texpages\Page-20-FX`s-hard.pcx
Group8File21=C:\source\EditWorld\Samples\texpages\Page-20-FX`s-soft.pcx
Group8File22=C:\source\EditWorld\Samples\texpages\Page-21-FX`s.pcx
Group8File23=C:\source\EditWorld\Samples\texpages\Page-21-FX`s-hard.pcx
Group8File24=C:\source\EditWorld\Samples\texpages\Page-21-FX`s-soft.pcx
Group8File25=C:\source\EditWorld\Samples\texpages\Page-22-FX`s.pcx
Group8File26=C:\source\EditWorld\Samples\texpages\Page-23-FX`s.pcx
Group8File27=C:\source\EditWorld\Samples\texpages\Page-23-FX`s-hard.pcx
Group8File28=C:\source\EditWorld\Samples\texpages\Page-23-FX`s-soft.pcx
Group8File29=C:\source\EditWorld\Samples\texpages\Page-24-FX`s.pcx
Group8File30=C:\source\EditWorld\Samples\texpages\Page-25-Sky.pcx
Group8File31=C:\source\EditWorld\Samples\texpages\Page-26-Sky.pcx
Group8File32=C:\source\EditWorld\Samples\texpages\Page-27-FX.pcx
Group8File33=C:\source\EditWorld\Samples\texpages\Page-30-Command Droids.pcx
Group8File34=C:\source\EditWorld\Samples\texpages\Page-6-Features-Arizona.pcx
Group8File35=C:\source\EditWorld\Samples\texpages\Page-6-Features-Rockies.pcx
Group8File36=C:\source\EditWorld\Samples\texpages\Page-6-Features-Urban Area.pcx
Group8File37=C:\source\EditWorld\Samples\texpages\Page-7-Barbarians-Arizona.pcx
Group8File38=C:\source\EditWorld\Samples\texpages\Page-7-Barbarians-Kevlar.pcx
Group8File39=C:\source\EditWorld\Samples\texpages\Page-10-Laboratories.pcx
Group8File40=C:\source\EditWorld\Samples\texpages\Page-8-Player Buildings-Bases Urban.pcx
Group8File41=C:\source\EditWorld\Samples\texpages\Page-8-Player Buildings-Bases.pcx
Group8File42=C:\source\EditWorld\Samples\texpages\Page-8-Player Buildings-Bases-Rockies.pcx
Group8File43=C:\source\EditWorld\Samples\texpages\Page-9-Player Buildings-Bases.pcx
Group8File44=C:\source\EditWorld\Samples\texpages\Page-9-Player Buildings-Bases-Rockies.pcx
Group8File45=C:\source\EditWorld\Samples\texpages\Page-9-Player Buildings-Bases-Urban.pcx
Group8File46=C:\source\EditWorld\Samples\texpages\Page-9-Player-hard Buildings-Bases.pcx
Group8File47=C:\source\EditWorld\Samples\texpages\Page-9-Player-hard Buildings-Bases-Rockies.pcx
Group8File48=C:\source\EditWorld\Samples\texpages\Page-9-Player-hard Buildings-Bases-Urban.pcx
Group8File49=C:\source\EditWorld\Samples\texpages\Page-9-Player-soft Buildings-Bases.pcx
Group8File50=C:\source\EditWorld\Samples\texpages\Page-9-Player-soft Buildings-Bases-Rockies.pcx
Group8File51=C:\source\EditWorld\Samples\texpages\Page-9-Player-soft Buildings-Bases-Urban.pcx
Group8File52=C:\source\EditWorld\Samples\texpages\tertilesC1.pcx
Group8File53=C:\source\EditWorld\Samples\texpages\tertilesC1HW.pcx
Group8File54=C:\source\EditWorld\Samples\texpages\tertilesC2.pcx
Group8File55=C:\source\EditWorld\Samples\texpages\tertilesC2HW.PCX
Group8File56=C:\source\EditWorld\Samples\texpages\tertilesC3.pcx
Group8File57=C:\source\EditWorld\Samples\texpages\tertilesC3HW.pcx
[Components]
Components=1
Component1Groups=8
Component1Name=Application Files
Component1Description=Application files needed to run the application
Component1GroupList=1 2 3 4 5 6 7 8
[Types]
Types=1
Type1Components=1
Type1Name=Complete
Type1ComponentList=1
[Sequence]
DestinationLocationDir=<ProgramFilesDir>\Pumpkin Studios\EditWorld
WelcomeMessage=1
LicenseAgreement=1
LicenseAgreementFile=C:\source\EditWorld\License.txt
UserInformation=1
DestinationLocation=1
SelectProgramFolder=1
SelectProgramFolderName=EditWorld
BeginFileTransfer=1
ProgressBar=1
SetupComplete=1
SetupCompleteExec=[Program Files]\EditWorld.exe
SetupCompleteExecReadme=[Program Files]\ReadMe.txt
[Icons]
Icons=3
Icon1Param=
Icon1Cmd=[Program Files]\EditWorld.exe
Icon1Description=EditWorld - Software Render
Icon1WorkingDir=[Program Files]
Icon1IconFile=
Icon1RealFile=C:\source\EditWorld\Release\EditWorld.exe
Icon1WhichIcon=0
Icon1KeyVirtual=0
Icon1KeyFlags=0
Icon2Param=
Icon2Cmd=[Program Files]\ReadMe.txt
Icon2Description=ReadMe
Icon2WorkingDir=[Program Files]
Icon2IconFile=
Icon2RealFile=C:\source\EditWorld\ReadMe.txt
Icon2WhichIcon=0
Icon2KeyVirtual=0
Icon2KeyFlags=0
Icon3Param=-hardware
Icon3Cmd=[Program Files]\EditWorld.exe
Icon3Description=EditWorld - Hardware Render
Icon3WorkingDir=[Program Files]
Icon3IconFile=
Icon3RealFile=C:\source\EditWorld\Release\EditWorld.exe
Icon3WhichIcon=0
Icon3KeyVirtual=0
Icon3KeyFlags=0
[IDAPI Alias]
BDE Radio=0
BDE Checks=00000

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,64 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: EditWorld - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating command line "rc.exe /l 0x809 /fo".\Debug/EditWorld.res" /d "_DEBUG" /d "_AFXDLL" "C:\Warzone\EditWorld\EditWorld.rc""
Creating temporary file "C:\WINDOWS\TEMP\RSPB094.TMP" with contents
[
winmm.lib dxguid.lib ddraw.lib /nologo /subsystem:windows /incremental:yes /pdb:".\Debug/EditWorld.pdb" /debug /machine:I386 /out:".\Debug/EditWorld.exe"
.\Debug\AutoFlagDialog.obj
.\Debug\bmpHandler.obj
.\Debug\Brush.obj
.\Debug\BrushProp.obj
.\Debug\BTEdit.obj
.\Debug\BTEditDoc.obj
.\Debug\BTEditView.obj
.\Debug\ChnkIO.obj
.\Debug\DDImage.obj
.\Debug\DebugPrint.obj
.\Debug\DIBDraw.obj
.\Debug\DirectX.obj
.\Debug\ExpandLimitsDlg.obj
.\Debug\ExportInfo.obj
.\Debug\FileParse.obj
.\Debug\GateInterface.obj
.\Debug\Gateway.obj
.\Debug\GatewaySup.obj
.\Debug\Geometry.obj
.\Debug\GrdLand.obj
.\Debug\HeightMap.obj
.\Debug\InitialLimitsDlg.obj
.\Debug\KeyHandler.obj
.\Debug\LimitsDialog.obj
.\Debug\MainFrm.obj
.\Debug\MapPrefs.obj
.\Debug\ObjectProperties.obj
.\Debug\PastePrefs.obj
.\Debug\PCXHandler.obj
.\Debug\PlayerMap.obj
.\Debug\SaveSegmentDialog.obj
.\Debug\StdAfx.obj
.\Debug\TDView.obj
.\Debug\TextSel.obj
.\Debug\TexturePrefs.obj
.\Debug\TextureView.obj
.\Debug\TileTypes.obj
.\Debug\WFView.obj
.\Debug\EditWorld.res
]
Creating command line "link.exe @C:\WINDOWS\TEMP\RSPB094.TMP"
<h3>Output Window</h3>
Compiling resources...
Linking...
<h3>Results</h3>
EditWorld.exe - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -0,0 +1,167 @@
// AutoFlagDialog.cpp : implementation file
//
#include "stdafx.h"
#include "btedit.h"
#include "autoflagdialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAutoFlagDialog dialog
CAutoFlagDialog::CAutoFlagDialog(CWnd* pParent /*=NULL*/)
: CDialog(CAutoFlagDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CAutoFlagDialog)
//}}AFX_DATA_INIT
}
void CAutoFlagDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAutoFlagDialog)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAutoFlagDialog, CDialog)
//{{AFX_MSG_MAP(CAutoFlagDialog)
ON_BN_CLICKED(IDC_CHKRANDROTATE, OnChkrandrotate)
ON_BN_CLICKED(IDC_CHKRANDXFLIP, OnChkrandxflip)
ON_BN_CLICKED(IDC_CHKRANDYFLIP, OnChkrandyflip)
ON_BN_CLICKED(IDC_ROT0, OnRot0)
ON_BN_CLICKED(IDC_ROT180, OnRot180)
ON_BN_CLICKED(IDC_ROT270, OnRot270)
ON_BN_CLICKED(IDC_ROT90, OnRot90)
ON_BN_CLICKED(IDC_XFLIP, OnXflip)
ON_BN_CLICKED(IDC_YFLIP, OnYflip)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAutoFlagDialog message handlers
//int GetCheck( ) const;
BOOL CAutoFlagDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// ((CButton*)GetDlgItem(IDC_CHKINCROTATE))->SetCheck(m_IncRotate);
// ((CButton*)GetDlgItem(IDC_CHKTOGXFLIP))->SetCheck(m_TogXFlip);
// ((CButton*)GetDlgItem(IDC_CHKTOGYFLIP))->SetCheck(m_TogYFlip);
((CButton*)GetDlgItem(IDC_XFLIP))->SetCheck(m_XFlip);
((CButton*)GetDlgItem(IDC_YFLIP))->SetCheck(m_YFlip);
((CButton*)GetDlgItem(IDC_CHKRANDROTATE))->SetCheck(m_RandRotate);
((CButton*)GetDlgItem(IDC_CHKRANDXFLIP))->SetCheck(m_RandXFlip);
((CButton*)GetDlgItem(IDC_CHKRANDYFLIP))->SetCheck(m_RandYFlip);
if(m_RandRotate == FALSE) {
switch(m_Rotate) {
case 0:
((CButton*)GetDlgItem(IDC_ROT0))->SetCheck(1);
break;
case 1:
((CButton*)GetDlgItem(IDC_ROT90))->SetCheck(1);
break;
case 2:
((CButton*)GetDlgItem(IDC_ROT180))->SetCheck(1);
break;
case 3:
((CButton*)GetDlgItem(IDC_ROT270))->SetCheck(1);
break;
}
} else {
((CButton*)GetDlgItem(IDC_ROT0))->SetCheck(0);
((CButton*)GetDlgItem(IDC_ROT90))->SetCheck(0);
((CButton*)GetDlgItem(IDC_ROT180))->SetCheck(0);
((CButton*)GetDlgItem(IDC_ROT270))->SetCheck(0);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CAutoFlagDialog::OnOK()
{
m_IncRotate = 0; //((CButton*)GetDlgItem(IDC_CHKINCROTATE))->GetCheck();
m_TogXFlip = 0; //((CButton*)GetDlgItem(IDC_CHKTOGXFLIP))->GetCheck();
m_TogYFlip = 0; //((CButton*)GetDlgItem(IDC_CHKTOGYFLIP))->GetCheck();
m_XFlip = ((CButton*)GetDlgItem(IDC_XFLIP))->GetCheck();
m_YFlip = ((CButton*)GetDlgItem(IDC_YFLIP))->GetCheck();
m_RandRotate = ((CButton*)GetDlgItem(IDC_CHKRANDROTATE))->GetCheck();
m_RandXFlip = ((CButton*)GetDlgItem(IDC_CHKRANDXFLIP))->GetCheck();
m_RandYFlip = ((CButton*)GetDlgItem(IDC_CHKRANDYFLIP))->GetCheck();
if(((CButton*)GetDlgItem(IDC_ROT0))->GetCheck()) {
m_Rotate = 0;
} else if(((CButton*)GetDlgItem(IDC_ROT90))->GetCheck()) {
m_Rotate = 1;
} else if(((CButton*)GetDlgItem(IDC_ROT180))->GetCheck()) {
m_Rotate = 2;
} else if(((CButton*)GetDlgItem(IDC_ROT270))->GetCheck()) {
m_Rotate = 3;
}
CDialog::OnOK();
}
void CAutoFlagDialog::OnChkrandrotate()
{
((CButton*)GetDlgItem(IDC_ROT0))->SetCheck( 0 );
((CButton*)GetDlgItem(IDC_ROT90))->SetCheck( 0 );
((CButton*)GetDlgItem(IDC_ROT180))->SetCheck( 0 );
((CButton*)GetDlgItem(IDC_ROT270))->SetCheck( 0 );
}
void CAutoFlagDialog::OnChkrandxflip()
{
((CButton*)GetDlgItem(IDC_XFLIP))->SetCheck( 0 );
}
void CAutoFlagDialog::OnChkrandyflip()
{
((CButton*)GetDlgItem(IDC_YFLIP))->SetCheck( 0 );
}
void CAutoFlagDialog::OnRot0()
{
((CButton*)GetDlgItem(IDC_CHKRANDROTATE))->SetCheck( 0 );
}
void CAutoFlagDialog::OnRot180()
{
((CButton*)GetDlgItem(IDC_CHKRANDROTATE))->SetCheck( 0 );
}
void CAutoFlagDialog::OnRot270()
{
((CButton*)GetDlgItem(IDC_CHKRANDROTATE))->SetCheck( 0 );
}
void CAutoFlagDialog::OnRot90()
{
((CButton*)GetDlgItem(IDC_CHKRANDROTATE))->SetCheck( 0 );
}
void CAutoFlagDialog::OnXflip()
{
((CButton*)GetDlgItem(IDC_CHKRANDXFLIP))->SetCheck( 0 );
}
void CAutoFlagDialog::OnYflip()
{
((CButton*)GetDlgItem(IDC_CHKRANDYFLIP))->SetCheck( 0 );
}

View File

@ -0,0 +1,53 @@
// AutoFlagDialog.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CAutoFlagDialog dialog
class CAutoFlagDialog : public CDialog
{
// Construction
public:
CAutoFlagDialog(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CAutoFlagDialog)
enum { IDD = IDD_AUTOFLAGDIALOG };
//}}AFX_DATA
BOOL m_IncRotate;
BOOL m_TogXFlip;
BOOL m_TogYFlip;
BOOL m_RandRotate;
BOOL m_RandXFlip;
BOOL m_RandYFlip;
BOOL m_XFlip;
BOOL m_YFlip;
int m_Rotate;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAutoFlagDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CAutoFlagDialog)
virtual BOOL OnInitDialog();
virtual void OnOK();
afx_msg void OnChkrandrotate();
afx_msg void OnChkrandxflip();
afx_msg void OnChkrandyflip();
afx_msg void OnRot0();
afx_msg void OnRot180();
afx_msg void OnRot270();
afx_msg void OnRot90();
afx_msg void OnXflip();
afx_msg void OnYflip();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -0,0 +1,424 @@
//#include "stdafx.h"
#include "winstuff.h"
#include "stdio.h"
#include "assert.h"
#include "debugprint.h"
#include "bmphandler.h"
BMPHandler::BMPHandler(void)
{
m_Palette = NULL;
m_DIBBitmap = NULL;
m_BitmapInfo = NULL;
}
BMPHandler::~BMPHandler(void)
{
DebugPrint("Deleted BMPHandler\n");
if(m_Palette!=NULL) {
delete m_Palette;
}
if(m_DIBBitmap!=NULL) {
DeleteObject(m_DIBBitmap);
}
if(m_BitmapInfo!=NULL) {
delete m_BitmapInfo;
}
}
BOOL BMPHandler::ReadBMP(char *FilePath,BOOL Flip)
{
FILE *fid;
fid=fopen(FilePath,"rb");
if(fid==NULL) {
return (FALSE);
}
DWORD i;
BITMAPFILEHEADER bmfh;
BITMAPINFOHEADER bmih;
if(m_Palette!=NULL) {
delete m_Palette;
m_Palette = NULL;
}
if(m_DIBBitmap!=NULL) {
DeleteObject(m_DIBBitmap);
m_DIBBitmap = NULL;
}
if(m_BitmapInfo!=NULL) {
delete m_BitmapInfo;
m_BitmapInfo = NULL;
}
// Get the BITMAPFILEHEADER structure.
fread(&bmfh,sizeof(BITMAPFILEHEADER),1,fid);
if( (((char*)&bmfh.bfType)[0] != 'B') ||
(((char*)&bmfh.bfType)[1] != 'M') ) {
fclose(fid);
MessageBox( NULL, FilePath, "File is not a valid BMP.", MB_OK );
return FALSE;
}
// Get the BITMAPINFOHEADER structure.
fread(&bmih,sizeof(BITMAPINFOHEADER),1,fid);
WORD PaletteSize=0;
switch(bmih.biBitCount) {
case 1:
PaletteSize=2;
break;
case 4:
PaletteSize=16;
break;
case 8:
PaletteSize=256;
break;
default:
PaletteSize=0;
}
m_BitmapInfo=(BITMAPINFO*)new BYTE[sizeof(BITMAPINFO)+sizeof(RGBQUAD)*PaletteSize];
m_BitmapInfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
m_BitmapInfo->bmiHeader.biWidth=bmih.biWidth;
m_BitmapInfo->bmiHeader.biHeight=bmih.biHeight;
m_BitmapInfo->bmiHeader.biPlanes=bmih.biPlanes;
m_BitmapInfo->bmiHeader.biBitCount=bmih.biBitCount;
m_BitmapInfo->bmiHeader.biCompression=bmih.biCompression;
m_BitmapInfo->bmiHeader.biSizeImage=bmih.biSizeImage;
m_BitmapInfo->bmiHeader.biXPelsPerMeter=bmih.biXPelsPerMeter;
m_BitmapInfo->bmiHeader.biYPelsPerMeter=bmih.biYPelsPerMeter;
m_BitmapInfo->bmiHeader.biClrUsed=bmih.biClrUsed;
m_BitmapInfo->bmiHeader.biClrImportant=bmih.biClrImportant;
// If there's a palette then get it.
if(PaletteSize) {
m_Palette=new PALETTEENTRY[PaletteSize];
for (i=0; i<PaletteSize; i++)
{
m_Palette[i].peBlue = (BYTE)getc(fid);
m_Palette[i].peGreen = (BYTE)getc(fid);
m_Palette[i].peRed = (BYTE)getc(fid);
getc(fid);
m_Palette[i].peFlags = 0;
}
memcpy(m_BitmapInfo->bmiColors,m_Palette,PaletteSize*sizeof(PALETTEENTRY));
}
m_DIBBitmap=CreateDIBSection(NULL,m_BitmapInfo,DIB_RGB_COLORS,&m_DIBBits,NULL,0);
if(m_DIBBitmap==NULL) {
MessageBox( NULL, FilePath, "Failed to create DIB.", MB_OK );
return(FALSE);
}
// Get the bitmap data.
fread(m_DIBBits, (bmfh.bfSize - bmfh.bfOffBits),1,fid);
fclose(fid);
if( Flip && (bmih.biHeight > 0) ) {
char *Top = (char*)m_DIBBits;
char *Bottom = Top + bmih.biWidth*(bmih.biHeight-1);
char Tmp;
int x;
while( ((DWORD)Top) < ((DWORD)Bottom) ) {
for(x=0; x<bmih.biWidth; x++) {
Tmp = Top[x];
Top[x] = Bottom[x];
Bottom[x] = Tmp;
}
Top+=bmih.biWidth;
Bottom-=bmih.biWidth;
}
}
return(TRUE);
}
BOOL BMPHandler::Create(int Width,int Height,void *Bits,PALETTEENTRY *Palette,int BPP,BOOL Is555)
{
int Planes = 1;
// int BPP = 8;
int PaletteSize;
int i;
if(Palette) {
PaletteSize=1<<BPP;
m_Palette = new PALETTEENTRY[PaletteSize];
for (i=0; i<PaletteSize; i++) {
m_Palette[i] = Palette[i];
}
} else {
PaletteSize = 3;
}
m_BitmapInfo=(BITMAPINFO*)new BYTE[sizeof(BITMAPINFO)+sizeof(RGBQUAD)*PaletteSize];
m_BitmapInfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
m_BitmapInfo->bmiHeader.biWidth=Width;
m_BitmapInfo->bmiHeader.biHeight=Height;
m_BitmapInfo->bmiHeader.biPlanes=Planes;
m_BitmapInfo->bmiHeader.biBitCount=BPP;
switch(BPP) {
case 4:
m_BitmapInfo->bmiHeader.biCompression=BI_RGB;
m_BitmapInfo->bmiHeader.biSizeImage=(Width/2)*Height;
break;
case 8:
m_BitmapInfo->bmiHeader.biCompression=BI_RGB;
m_BitmapInfo->bmiHeader.biSizeImage=Width*Height;
break;
case 16:
m_BitmapInfo->bmiHeader.biCompression= BI_BITFIELDS;
m_BitmapInfo->bmiHeader.biSizeImage=Width*2*Height;
break;
}
m_BitmapInfo->bmiHeader.biXPelsPerMeter=0;
m_BitmapInfo->bmiHeader.biYPelsPerMeter=0;
m_BitmapInfo->bmiHeader.biClrUsed=0;
m_BitmapInfo->bmiHeader.biClrImportant=0;
if(Palette) {
for(i=0; i<PaletteSize; i++) {
m_BitmapInfo->bmiColors[i].rgbRed = m_Palette[i].peRed;
m_BitmapInfo->bmiColors[i].rgbGreen = m_Palette[i].peGreen;
m_BitmapInfo->bmiColors[i].rgbBlue = m_Palette[i].peBlue;
m_BitmapInfo->bmiColors[i].rgbReserved = 0;
}
} else {
DWORD *PFormat = (DWORD*)m_BitmapInfo->bmiColors;
if(Is555) {
PFormat[0] = 0x7c00;
PFormat[1] = 0x03e0;
PFormat[2] = 0x001f;
} else {
PFormat[0] = 0xf800;
PFormat[1] = 0x07e0;
PFormat[2] = 0x001f;
}
}
m_DIBBitmap=CreateDIBSection(NULL,m_BitmapInfo,DIB_RGB_COLORS,&m_DIBBits,NULL,0);
if(m_DIBBitmap==NULL) {
MessageBox( NULL, "Error", "Failed to create DIB.", MB_OK );
return FALSE;
}
BYTE *Dst=(BYTE*)m_DIBBits;
BYTE *Src;
WORD j,p;
switch(BPP) {
case 4:
Width /= 2;
break;
case 8:
break;
case 16:
Width *= 2;
break;
}
if(Bits) {
for(j=0; j < Height; j++) {
Src=((BYTE*)Bits)+j*Width*Planes;
for(i=0; i < Width; i++) {
for(p=0; p < Planes; p++) {
*Dst=*(Src+Width*p);
Dst++;
}
Src++;
}
}
} else {
// for(j=0; j < Height; j++) {
// for(i=0; i < Width; i++) {
// for(p=0; p < Planes; p++) {
// *Dst=0;
// Dst++;
// }
// }
// }
}
return TRUE;
}
void BMPHandler::Clear(void)
{
int i,j,p;
int Width,Height,Planes;
BYTE *Dst=(BYTE*)m_DIBBits;
Height = m_BitmapInfo->bmiHeader.biHeight;
Planes = m_BitmapInfo->bmiHeader.biPlanes;
switch(m_BitmapInfo->bmiHeader.biBitCount) {
case 4:
Width = m_BitmapInfo->bmiHeader.biWidth / 2;
break;
case 8:
Width = m_BitmapInfo->bmiHeader.biWidth;
break;
case 16:
Width = m_BitmapInfo->bmiHeader.biWidth * 2;
break;
}
for(j=0; j < Height; j++) {
for(i=0; i < Width; i++) {
for(p=0; p < Planes; p++) {
*Dst=0;
Dst++;
}
}
}
}
void *BMPHandler::CreateDC(void *hWnd)
{
HDC BmpHdc;
HDC hdc=GetDC((HWND)hWnd);
assert(hdc!=NULL);
BmpHdc = CreateCompatibleDC(hdc);
HGDIOBJ Res = SelectObject(BmpHdc, m_DIBBitmap);
assert(Res!=NULL);
assert((DWORD)Res!=GDI_ERROR);
ReleaseDC((HWND)hWnd,hdc);
return BmpHdc;
}
void BMPHandler::DeleteDC(void *hdc)
{
::DeleteDC((HDC)hdc);
}
BOOL BMPHandler::WriteBMP(char *FilePath,BOOL Flip)
{
FILE *fid;
BOOL Flipped=FALSE;
int j;
fid=fopen(FilePath,"wb");
if(fid==NULL) {
MessageBox( NULL, FilePath, "Unable to create file\nFile may be write protected.", MB_OK );
return FALSE;
}
BITMAPFILEHEADER bmfh;
BITMAPINFOHEADER bmih;
bmih = m_BitmapInfo->bmiHeader;
WORD PaletteSize;
switch(bmih.biBitCount) {
case 1:
PaletteSize=2;
break;
case 4:
PaletteSize=16;
break;
case 8:
PaletteSize=256;
break;
default:
PaletteSize=0;
}
((char*)&bmfh.bfType)[0] = 'B';
((char*)&bmfh.bfType)[1] = 'M';
bmfh.bfOffBits = PaletteSize * sizeof(RGBQUAD) +
sizeof(BITMAPFILEHEADER) +
sizeof(BITMAPINFOHEADER);
switch(m_BitmapInfo->bmiHeader.biBitCount) {
case 4:
bmfh.bfSize = bmfh.bfOffBits + bmih.biWidth/2 * abs(bmih.biHeight);
break;
case 8:
bmfh.bfSize = bmfh.bfOffBits + bmih.biWidth * abs(bmih.biHeight);
break;
case 16:
bmfh.bfSize = bmfh.bfOffBits + bmih.biWidth*2 * abs(bmih.biHeight);
break;
}
// if(m_BitmapInfo->bmiHeader.biBitCount == 4) {
// bmfh.bfSize = bmfh.bfOffBits + (bmih.biWidth/2) * abs(bmih.biHeight);
// } else {
// bmfh.bfSize = bmfh.bfOffBits + bmih.biWidth * abs(bmih.biHeight);
// }
fwrite(&bmfh,sizeof(BITMAPFILEHEADER),1,fid);
fwrite(&bmih,sizeof(BITMAPINFOHEADER),1,fid);
// If there's a palette then put it.
if(PaletteSize) {
for (int i=0; i<PaletteSize; i++)
{
putc(m_Palette[i].peBlue,fid);
putc(m_Palette[i].peGreen,fid);
putc(m_Palette[i].peRed,fid);
putc(0,fid);
}
}
if(Flip) {
switch(bmih.biBitCount) {
case 4:
for(j=abs(bmih.biHeight)-1; j >= 0; j--) {
BYTE *Src=((BYTE*)m_DIBBits)+j*bmih.biWidth/2*bmih.biPlanes;
fwrite(Src, bmih.biWidth/2*bmih.biPlanes,1,fid);
}
break;
case 8:
for(j=abs(bmih.biHeight)-1; j >= 0; j--) {
BYTE *Src=((BYTE*)m_DIBBits)+j*bmih.biWidth*bmih.biPlanes;
fwrite(Src, bmih.biWidth*bmih.biPlanes,1,fid);
}
break;
case 16:
for(j=abs(bmih.biHeight)-1; j >= 0; j--) {
BYTE *Src=((BYTE*)m_DIBBits)+j*bmih.biWidth*2*bmih.biPlanes;
fwrite(Src, bmih.biWidth*2*bmih.biPlanes,1,fid);
}
default:
PaletteSize=0;
}
} else {
fwrite(m_DIBBits, (bmfh.bfSize - bmfh.bfOffBits),1,fid);
}
fclose(fid);
return TRUE;
}

View File

@ -0,0 +1,27 @@
#ifndef __BMPHANDLER_INCLUDED__
#define __BMPHANDLER_INCLUDED__
class BMPHandler {
public:
BMPHandler(void);
~BMPHandler(void);
BOOL ReadBMP(char *FilePath,BOOL Flip=FALSE);
BOOL Create(int Width,int Height,void *Bits,PALETTEENTRY *Palette,int BPP=8,BOOL Is555 = FALSE);
void Clear(void);
void DeleteDC(void *hdc);
void *CreateDC(void *hWnd);
BOOL WriteBMP(char *FilePath,BOOL Flip=FALSE);
LONG GetBitmapWidth(void) { return(m_BitmapInfo->bmiHeader.biWidth); }
LONG GetBitmapHeight(void) { return(abs(m_BitmapInfo->bmiHeader.biHeight)); }
WORD GetBitmapBitCount(void) { return(m_BitmapInfo->bmiHeader.biBitCount); }
void *GetBitmapBits(void) { return(m_DIBBits); }
HBITMAP GetBitmap(void) { return(m_DIBBitmap); }
PALETTEENTRY *GetBitmapPaletteEntries(void) { return(m_Palette); }
protected:
BITMAPINFO* m_BitmapInfo;
HBITMAP m_DIBBitmap;
void *m_DIBBits;
PALETTEENTRY *m_Palette;
};
#endif

View File

@ -0,0 +1,919 @@
#include "stdafx.h"
#include "btedit.h"
#include "bteditdoc.h"
#include "brush.h"
#include "tiletypes.h"
#include "debugprint.h"
#include "assert.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern DWORD g_Flags[MAXTILES];
extern CUndoRedo *g_UndoRedo;
#define MAX 10000 /* max depth of stack */
#define PUSH(Y, XL, XR, DY) /* push new segment on stack */ \
if (sp<stack+MAX && Y+(DY)>=win->y0 && Y+(DY)<=win->y1) \
{sp->y = Y; sp->xl = XL; sp->xr = XR; sp->dy = DY; sp++;}
#define POP(Y, XL, XR, DY) /* pop segment off stack */ \
{sp--; Y = sp->y+(DY = sp->dy); XL = sp->xl; XR = sp->xr;}
DWORD CEdgeBrush::m_NumImages = 0;
DWORD CEdgeBrush::m_NumInstances = 0;
BOOL CEdgeBrush::m_BrushSize = TRUE;
//int CEdgeBrush::m_SmallBrush[5]={0,2,6,8,-1};
//int CEdgeBrush::m_LargeBrush[10]={0,1,2,3,4,5,6,7,8,-1};
CEdgeBrush::CEdgeBrush(CHeightMap* HeightMap,DWORD TextureWidth,DWORD TextureHeight,DWORD NumImages)
{
Brush DefaultEdgeBrush[13] = {
{-1,-1,52}, { 0,-1,53}, { 1,-1,54},
{-1, 0,55}, { 0, 0,64}, { 1, 0,56},
{-1, 1,57}, { 0, 1,58}, { 1, 1,59},
{0,0,52}, {1,0,54},
{0,1,57}, {1,1,59}
};
BrushMapEntry DefaultBrushMap[]={
{ 0,0, 0,0, -1, -1}, // 0 0000
{ 0,0, 1,1, -1, 52}, // 1 0001
{ 0,0, 3,1, -1, 54}, // 2 0010
{ 0,0, 2,1, -1, 53}, // 3 0011
{ 0,0, 1,3, -1, 57}, // 4 0100
{ 0,0, 1,2, -1, 55}, // 5 0101
{ 0,0, 3,6, -1, -1}, // 6 0110
{ 0,0, 8,4, -1, 63}, // 7 0111
{ 0,0, 3,3, -1, 59}, // 8 1000
{ 0,0, 1,6, -1, -1}, // 9 1001
{ 0,0, 3,2, -1, 56}, // 10 1010
{ 0,0, 5,4, -1, 62}, // 11 1011
{ 0,0, 2,3, -1, 58}, // 12 1100
{ 0,0, 8,1, -1, 61}, // 13 1101
{ 0,0, 5,1, -1, 60}, // 14 1110
{ 0,0, 2,2, -1, 64}, // 15 1111
{ 0,0, 6,1, 12, -1}, // 16
{ 0,0, 7,1, 12, -1}, // 17
{ 0,0, 5,2, 10, -1}, // 18
{ 0,0, 5,3, 10, -1}, // 19
{ 0,0, 8,2, 5, -1}, // 20
{ 0,0, 8,3, 5, -1}, // 21
{ 0,0, 6,4, 3, -1}, // 22
{ 0,0, 7,4, 3, -1}, // 23
{ 0,0, 1,5, 10, -1}, // 24
{ 0,0, 1,7, 5, -1}, // 25
{ 0,0, 3,5, 5, -1}, // 26
{ 0,0, 3,7, 10, -1}, // 27
{-1,0, 0,0, 0, 0} // 28
};
m_HeightMap = HeightMap;
m_TextureWidth = TextureWidth;
m_TextureHeight = TextureHeight;
m_NumImages = NumImages;
// Setup the default brush map.
for(int i=0; i<29; i++) {
m_BrushMap[i] = DefaultBrushMap[i];
if(m_NumInstances != 0) {
m_BrushMap[i].Tid = -1;
}
}
for(i=0; i<13; i++) {
m_EdgeBrush[i] = DefaultEdgeBrush[i];
m_EdgeBrush[i].Tid = 0;
}
for(i=0; i<15; i++) {
m_EdgeTable[i].Tid = 0;
m_EdgeTable[i].TFlags = 0;
}
SetBrushTextureFromMap();
// m_SetHeight = TRUE;
m_HeightMode = EB_HM_NOSET;
m_Height = 128;
m_RandomRange = 0;
m_ID = m_NumInstances;
m_NumInstances++;
}
CEdgeBrush::~CEdgeBrush()
{
m_NumInstances--;
}
DWORD CEdgeBrush::ConvertTileIDToCode(DWORD Tid,DWORD TFlags)
{
for(int i=0; i<16; i++) {
if(( ((DWORD)m_EdgeTable[i].Tid) == Tid ) && (m_EdgeTable[i].TFlags == TFlags) ) {
return (DWORD)i;
}
}
return 0;
}
void CEdgeBrush::ConvertTileCodeToID(DWORD Code,DWORD &Tid,DWORD &TFlags)
{
if(m_EdgeTable[Code].Tid < 0) {
Tid = 65536;
return;
}
Tid = (DWORD)m_EdgeTable[Code].Tid;
TFlags = m_EdgeTable[Code].TFlags;
}
//void CEdgeBrush::SetBrushTexture(DWORD TableIndex,int Tid)
//{
// ASSERT(TableIndex < 16);
//
// m_EdgeTable[TableIndex] = Tid;
//
// m_EdgeBrush[0].Tid = m_EdgeTable[1];
// m_EdgeBrush[1].Tid = m_EdgeTable[3];
// m_EdgeBrush[2].Tid = m_EdgeTable[2];
// m_EdgeBrush[3].Tid = m_EdgeTable[5];
// m_EdgeBrush[4].Tid = m_EdgeTable[15];
// m_EdgeBrush[5].Tid = m_EdgeTable[10];
// m_EdgeBrush[6].Tid = m_EdgeTable[4];
// m_EdgeBrush[7].Tid = m_EdgeTable[12];
// m_EdgeBrush[8].Tid = m_EdgeTable[8];
//
// m_EdgeBrush[9].Tid = m_EdgeTable[1];
// m_EdgeBrush[10].Tid = m_EdgeTable[2];
// m_EdgeBrush[11].Tid = m_EdgeTable[4];
// m_EdgeBrush[12].Tid = m_EdgeTable[8];
//}
void CEdgeBrush::SetBrushTextureFromMap(void)
{
m_IsWater = FALSE;
for(int i=0; i<16; i++) {
m_EdgeTable[i].Tid = m_BrushMap[i].Tid;
m_EdgeTable[i].TFlags = m_BrushMap[i].TFlags;
if(g_Flags[m_EdgeTable[i].Tid] == TF_TYPEWATER) {
m_IsWater = TRUE;
}
}
m_EdgeBrush[0].Tid = m_EdgeTable[1].Tid;
m_EdgeBrush[0].TFlags = m_EdgeTable[1].TFlags;
m_EdgeBrush[1].Tid = m_EdgeTable[3].Tid;
m_EdgeBrush[1].TFlags = m_EdgeTable[3].TFlags;
m_EdgeBrush[2].Tid = m_EdgeTable[2].Tid;
m_EdgeBrush[2].TFlags = m_EdgeTable[2].TFlags;
m_EdgeBrush[3].Tid = m_EdgeTable[5].Tid;
m_EdgeBrush[3].TFlags = m_EdgeTable[5].TFlags;
m_EdgeBrush[4].Tid = m_EdgeTable[15].Tid;
m_EdgeBrush[4].TFlags = m_EdgeTable[15].TFlags;
m_EdgeBrush[5].Tid = m_EdgeTable[10].Tid;
m_EdgeBrush[5].TFlags = m_EdgeTable[10].TFlags;
m_EdgeBrush[6].Tid = m_EdgeTable[4].Tid;
m_EdgeBrush[6].TFlags = m_EdgeTable[4].TFlags;
m_EdgeBrush[7].Tid = m_EdgeTable[12].Tid;
m_EdgeBrush[7].TFlags = m_EdgeTable[12].TFlags;
m_EdgeBrush[8].Tid = m_EdgeTable[8].Tid;
m_EdgeBrush[8].TFlags = m_EdgeTable[8].TFlags;
m_EdgeBrush[9].Tid = m_EdgeTable[1].Tid;
m_EdgeBrush[9].TFlags = m_EdgeTable[1].TFlags;
m_EdgeBrush[10].Tid = m_EdgeTable[2].Tid;
m_EdgeBrush[10].TFlags = m_EdgeTable[2].TFlags;
m_EdgeBrush[11].Tid = m_EdgeTable[4].Tid;
m_EdgeBrush[11].TFlags = m_EdgeTable[4].TFlags;
m_EdgeBrush[12].Tid = m_EdgeTable[8].Tid;
m_EdgeBrush[12].TFlags = m_EdgeTable[8].TFlags;
}
//int CEdgeBrush::GetBrushTexture(DWORD TableIndex)
//{
// return m_EdgeTable[TableIndex];
//}
// Paint with edge brush, returns TRUE if heights have been altered.
//
BOOL CEdgeBrush::Paint(DWORD XCoord,DWORD YCoord,BOOL SetHeight)
{
DWORD DstCode;
int Edge;
DWORD mw;
DWORD mh;
BOOL ChangedHeights = FALSE;
m_HeightMap->GetMapSize(&mw,&mh);
int Count,Offset;
if(m_BrushSize) {
Count = 9;
Offset = 0;
} else {
Count = 4;
Offset = 9;
}
g_UndoRedo->BeginGroup();
int BaseHeight; // = (int)m_HeightMap->GetVertexHeight(XCoord + (YCoord * (int)mw),0);
if(m_RandomRange != 0) {
BaseHeight = rand()%m_RandomRange;
}
for(int i=Offset; i<Offset+Count; i++) {
int ox = m_EdgeBrush[i].ox;
int oy = m_EdgeBrush[i].oy;
if((XCoord + ox >= 0) && (XCoord + ox < (int)mw) &&
(YCoord + oy >= 0) && (YCoord + oy < (int)mh) ) {
Edge = XCoord + (YCoord * (int)mw) + ox + (oy * (int)mw);
DWORD DstTid = m_HeightMap->GetTextureID(Edge);
DWORD DstFlags = m_HeightMap->GetTileFlags(Edge);
DWORD DstType; // = DstFlags & TF_TYPEMASK;
DstFlags &= 0xfe; // Only want bits 7-1 which control rotation and flipping.
DWORD SrcTid = m_EdgeBrush[i].Tid;
DWORD SrcFlags = m_EdgeBrush[i].TFlags;
DstCode = ConvertTileIDToCode(SrcTid,SrcFlags) |
ConvertTileIDToCode(DstTid,DstFlags);
ConvertTileCodeToID(DstCode,DstTid,DstFlags);
if(DstTid == 65536) {
DstTid = SrcTid;
}
g_UndoRedo->AddUndo(&(m_HeightMap->GetMapTiles()[Edge]));
// DebugPrint("%d : %d %d\n",i,ox,oy);
m_HeightMap->SetTextureID(Edge,DstTid);
DstType = g_Flags[DstTid];
int Height;
int Height0;
int Height1;
int Height2;
int Height3;
switch(m_HeightMode) {
case EB_HM_SEALEVEL:
// Use sea level
Height = m_HeightMap->GetSeaLevel();
break;
case EB_HM_SETABB:
// Set absolute height
Height = m_Height;
break;
//
// case EB_HM_SETADD:
// // Set addative height
// Height0 = BaseHeight0 + m_Height;
// Height1 = BaseHeight1 + m_Height;
// Height2 = BaseHeight2 + m_Height;
// Height3 = BaseHeight3 + m_Height;
// if(Height0 > 255) Height0 = 255;
// if(Height1 > 255) Height1 = 255;
// if(Height2 > 255) Height2 = 255;
// if(Height3 > 255) Height3 = 255;
//
// break;
}
if(m_RandomRange != 0) {
Height = Height + BaseHeight; //rand()%m_RandomRange;
}
if(Height > 255) {
Height = 255;
}
if(m_BrushSize) {
if( (ox == 0) && (oy == 0) && (m_HeightMode != EB_HM_NOSET) ) {
// if(m_HeightMode == EB_HM_SETADD) {
// m_HeightMap->SetVertexHeight(Edge,0,(float)Height0);
// m_HeightMap->SetVertexHeight(Edge,1,(float)Height1);
// m_HeightMap->SetVertexHeight(Edge,2,(float)Height2);
// m_HeightMap->SetVertexHeight(Edge,3,(float)Height3);
// } else {
m_HeightMap->SetTileHeightUndo(Edge,(float)Height);
// }
ChangedHeights = TRUE;
}
} else {
if(m_HeightMode != EB_HM_NOSET) {
switch(i) {
case 9:
m_HeightMap->SetVertexHeight(Edge,2,(float)Height);
break;
case 10:
m_HeightMap->SetVertexHeight(Edge,3,(float)Height);
break;
case 11:
m_HeightMap->SetVertexHeight(Edge,1,(float)Height);
break;
case 12:
m_HeightMap->SetVertexHeight(Edge,0,(float)Height);
break;
}
ChangedHeights = TRUE;
}
}
// if(m_IsWater && SetHeight) {
// m_HeightMap->SetTileHeightUndo(Edge,(float)m_HeightMap->GetSeaLevel());
// ChangedHeights = TRUE;
// }
m_HeightMap->SetTileFlags(Edge,DstFlags | DstType);
}
}
g_UndoRedo->EndGroup();
return ChangedHeights;
}
extern HICON g_IconIncrement;
extern HICON g_IconDecrement;
extern HICON g_IconSmallBrush;
extern HICON g_IconSmallBrush2;
extern HICON g_IconLargeBrush;
extern HICON g_IconLargeBrush2;
void CEdgeBrush::DrawEdgeBrushIcon(CDIBDraw *DIBDraw,DDImage **Images,int x, int y)
{
BrushMapEntry *Current = &m_BrushMap[0];
Images[m_BrushMap[5].Tid-1]->DDBlitImageDIB(DIBDraw,x,y,m_BrushMap[5].TFlags);
Current++;
x+= m_TextureWidth;
Images[m_BrushMap[15].Tid-1]->DDBlitImageDIB(DIBDraw,x,y,m_BrushMap[15].TFlags);
Current++;
x+= m_TextureWidth;
Images[m_BrushMap[10].Tid-1]->DDBlitImageDIB(DIBDraw,x,y,m_BrushMap[10].TFlags);
}
void CEdgeBrush::DrawEdgeBrush(CDIBDraw *DIBDraw,DDImage **Images,int ScrollX, int ScrollY)
{
BrushMapEntry *Current = &m_BrushMap[1];
SLONG StartX = ScrollX; ///m_TextureWidth;
SLONG StartY = ScrollY; ///m_TextureHeight;
// DebugPrint("%d,%d\n",StartX,StartY);
while(Current->Flags != -1) {
SLONG XCoord = (Current->XCoord * m_TextureWidth) - StartX;
SLONG YCoord = (Current->YCoord * m_TextureHeight) - StartY;
if(Current->Tid-1 >= 0) {
if(Current->Tid <= (int)m_NumImages) {
Images[Current->Tid-1]->DDBlitImageDIB(DIBDraw,XCoord,YCoord,Current->TFlags);
}
} else {
if(Current->Link >= 0) {
if(m_BrushMap[Current->Link].Tid-1 >= 0) {
if(m_BrushMap[Current->Link].Tid <= (int)m_NumImages) {
Images[m_BrushMap[Current->Link].Tid-1]->DDBlitImageDIB(DIBDraw,
XCoord,YCoord,m_BrushMap[Current->Link].TFlags);
}
}
}
}
Current++;
}
SLONG x0,y0,x1,y1;
CDC *dc=dc->FromHandle((HDC)DIBDraw->GetDIBDC());
CPen Pen;
Pen.CreatePen( PS_SOLID, 2, RGB(255,255,255) );
CPen* pOldPen = dc->SelectObject( &Pen );
Current = &m_BrushMap[1];
while(Current->Flags != -1) {
SLONG XCoord = (Current->XCoord * m_TextureWidth) - StartX;
SLONG YCoord = (Current->YCoord * m_TextureHeight) - StartY;
x0 = XCoord;
y0 = YCoord;
x1 = XCoord + m_TextureWidth;
y1 = YCoord + m_TextureHeight;
dc->MoveTo(x0,y0);
dc->LineTo(x1,y0);
dc->LineTo(x1,y1);
dc->LineTo(x0,y1);
dc->LineTo(x0,y0);
if(Current->TFlags & TF_VERTEXFLIP) {
dc->MoveTo(x1,y0);
dc->LineTo(x0,y1);
} else {
dc->MoveTo(x0,y0);
dc->LineTo(x1,y1);
}
Current++;
}
dc->SelectObject( pOldPen );
char String[16];
sprintf(String,"Edge Brush %d",m_ID);
dc->SetTextColor(RGB(255,255,255));
dc->SetBkColor(RGB(0,0,0));
dc->TextOut(16,48,String,strlen(String));
DrawButtons(dc);
}
void CEdgeBrush::RotateTile(int XCoord,int YCoord,int ScrollX,int ScrollY)
{
BrushMapEntry *Current = &m_BrushMap[1];
SLONG StartX = ScrollX; ///m_TextureWidth;
SLONG StartY = ScrollY; ///m_TextureHeight;
SLONG x0,y0,x1,y1;
while(Current->Flags != -1) {
SLONG x = (Current->XCoord * m_TextureWidth) - StartX;
SLONG y = (Current->YCoord * m_TextureHeight) - StartY;
x0 = x;
y0 = y;
x1 = x + m_TextureWidth;
y1 = y + m_TextureHeight;
if( (XCoord > x0) && (XCoord < x1) && (YCoord > y0) && (YCoord < y1) ) {
if(Current->Link < 0) {
DWORD Rotate = (Current->TFlags & TF_TEXTUREROTMASK) >> TF_TEXTUREROTSHIFT;
Rotate += 1;
Rotate &= 3;
Current->TFlags &= !TF_TEXTUREROTMASK;
Current->TFlags |= Rotate << TF_TEXTUREROTSHIFT;
SetBrushTextureFromMap();
return;
}
}
Current++;
}
}
void CEdgeBrush::XFlipTile(int XCoord,int YCoord,int ScrollX,int ScrollY)
{
BrushMapEntry *Current = &m_BrushMap[1];
SLONG StartX = ScrollX; ///m_TextureWidth;
SLONG StartY = ScrollY; ///m_TextureHeight;
SLONG x0,y0,x1,y1;
while(Current->Flags != -1) {
SLONG x = (Current->XCoord * m_TextureWidth) - StartX;
SLONG y = (Current->YCoord * m_TextureHeight) - StartY;
x0 = x;
y0 = y;
x1 = x + m_TextureWidth;
y1 = y + m_TextureHeight;
if( (XCoord > x0) && (XCoord < x1) && (YCoord > y0) && (YCoord < y1) ) {
if(Current->Link < 0) {
DWORD Rotate = (Current->TFlags & TF_TEXTUREROTMASK) >> TF_TEXTUREROTSHIFT;
if(Rotate & 1) {
if(Current->TFlags & TF_TEXTUREFLIPY) {
Current->TFlags &= ~TF_TEXTUREFLIPY;
} else {
Current->TFlags |= TF_TEXTUREFLIPY;
}
} else {
if(Current->TFlags & TF_TEXTUREFLIPX) {
Current->TFlags &= ~TF_TEXTUREFLIPX;
} else {
Current->TFlags |= TF_TEXTUREFLIPX;
}
}
SetBrushTextureFromMap();
return;
}
}
Current++;
}
}
void CEdgeBrush::YFlipTile(int XCoord,int YCoord,int ScrollX,int ScrollY)
{
BrushMapEntry *Current = &m_BrushMap[1];
SLONG StartX = ScrollX; ///m_TextureWidth;
SLONG StartY = ScrollY; ///m_TextureHeight;
SLONG x0,y0,x1,y1;
while(Current->Flags != -1) {
SLONG x = (Current->XCoord * m_TextureWidth) - StartX;
SLONG y = (Current->YCoord * m_TextureHeight) - StartY;
x0 = x;
y0 = y;
x1 = x + m_TextureWidth;
y1 = y + m_TextureHeight;
if( (XCoord > x0) && (XCoord < x1) && (YCoord > y0) && (YCoord < y1) ) {
if(Current->Link < 0) {
DWORD Rotate = (Current->TFlags & TF_TEXTUREROTMASK) >> TF_TEXTUREROTSHIFT;
if(Rotate & 1) {
if(Current->TFlags & TF_TEXTUREFLIPX) {
Current->TFlags &= ~TF_TEXTUREFLIPX;
} else {
Current->TFlags |= TF_TEXTUREFLIPX;
}
} else {
if(Current->TFlags & TF_TEXTUREFLIPY) {
Current->TFlags &= ~TF_TEXTUREFLIPY;
} else {
Current->TFlags |= TF_TEXTUREFLIPY;
}
}
SetBrushTextureFromMap();
return;
}
}
Current++;
}
}
void CEdgeBrush::TriFlipTile(int XCoord,int YCoord,int ScrollX,int ScrollY)
{
BrushMapEntry *Current = &m_BrushMap[1];
SLONG StartX = ScrollX; ///m_TextureWidth;
SLONG StartY = ScrollY; ///m_TextureHeight;
SLONG x0,y0,x1,y1;
while(Current->Flags != -1) {
SLONG x = (Current->XCoord * m_TextureWidth) - StartX;
SLONG y = (Current->YCoord * m_TextureHeight) - StartY;
x0 = x;
y0 = y;
x1 = x + m_TextureWidth;
y1 = y + m_TextureHeight;
if( (XCoord > x0) && (XCoord < x1) && (YCoord > y0) && (YCoord < y1) ) {
if(Current->Link < 0) {
if(Current->TFlags & TF_VERTEXFLIP) {
Current->TFlags &= ~TF_VERTEXFLIP;
} else {
Current->TFlags |= TF_VERTEXFLIP;
}
SetBrushTextureFromMap();
return;
}
}
Current++;
}
}
void CEdgeBrush::SetBrushMap(int Tid,DWORD TFlags,int XCoord,int YCoord,int ScrollX,int ScrollY)
{
BrushMapEntry *Current = &m_BrushMap[1];
SLONG StartX = ScrollX; ///m_TextureWidth;
SLONG StartY = ScrollY; ///m_TextureHeight;
SLONG x0,y0,x1,y1;
while(Current->Flags != -1) {
SLONG x = (Current->XCoord * m_TextureWidth) - StartX;
SLONG y = (Current->YCoord * m_TextureHeight) - StartY;
x0 = x;
y0 = y;
x1 = x + m_TextureWidth;
y1 = y + m_TextureHeight;
if( (XCoord > x0) && (XCoord < x1) && (YCoord > y0) && (YCoord < y1) ) {
if(Current->Link < 0) {
Current->Tid = Tid;
Current->TFlags = TFlags;
SetBrushTextureFromMap();
return;
}
}
Current++;
}
}
struct ButtonEntry {
int Command;
int x,y;
int Width,Height;
int State;
HICON *Icon;
HICON *Icon2;
};
ButtonEntry EBButtons[]={
{EB_DECREMENT, 16,16, 32,32, 0,&g_IconDecrement,&g_IconDecrement},
{EB_INCREMENT, 16+32,16, 32,32, 0,&g_IconIncrement,&g_IconIncrement},
{EB_SMALLBRUSH, 16+32*2,16, 32,32, 0,&g_IconSmallBrush,&g_IconSmallBrush2},
{EB_LARGEBRUSH, 16+32*3,16, 32,32, 1,&g_IconLargeBrush,&g_IconLargeBrush2},
{-1, 0,0, 0,0, 0,NULL,NULL}
};
void CEdgeBrush::DrawButtons(CDC *dc)
{
ButtonEntry *Button = &EBButtons[0];
while(Button->Command != -1) {
if(Button->State) {
dc->DrawIcon(Button->x,Button->y,*Button->Icon2);
} else {
dc->DrawIcon(Button->x,Button->y,*Button->Icon);
}
Button++;
}
}
int CEdgeBrush::DoButtons(int XCoord,int YCoord)
{
ButtonEntry *Button = &EBButtons[0];
while(Button->Command != -1) {
if( (XCoord > Button->x) && (XCoord < Button->x + Button->Width) &&
(YCoord > Button->y) && (YCoord < Button->y + Button->Height) ) {
// Button->State = (Button->State+1)&1;
return Button->Command;
}
Button++;
}
return -1;
}
int CEdgeBrush::GetButtonState(int Index)
{
return EBButtons[Index].State;
}
void CEdgeBrush::SetButtonState(int Index,int State)
{
EBButtons[Index].State = State;
}
void CEdgeBrush::SetBrushDirect(int Index,int HeightMode,int Height,int RandomRange,int Tid,int Flags)
{
m_HeightMode = HeightMode;
m_Height = Height;
m_RandomRange = RandomRange;
m_BrushMap[Index].Tid = Tid;
m_BrushMap[Index].TFlags = Flags&255;
}
BOOL CEdgeBrush::Write(FILE* Stream)
{
fprintf(Stream," ");
fprintf(Stream,"%d ",m_HeightMode);
fprintf(Stream,"%d ",m_Height);
fprintf(Stream,"%d ",m_RandomRange);
for(int i=0; i<16; i++) {
fprintf(Stream,"%d ",m_EdgeTable[i].Tid);
fprintf(Stream,"%d ",m_EdgeTable[i].TFlags);
}
fprintf(Stream,"\n");
return TRUE;
}
BOOL CEdgeBrush::ReadV1(FILE* Stream)
{
for(int i=0; i<16; i++) {
LONG Tid;
LONG TFlags;
CHECKTRUE(ReadLong(Stream,NULL,&Tid));
m_BrushMap[i].Tid = (int)Tid;
CHECKTRUE(ReadLong(Stream,NULL,&TFlags));
m_BrushMap[i].TFlags = (DWORD)TFlags&255;
}
SetBrushTextureFromMap();
return TRUE;
}
BOOL CEdgeBrush::ReadV2(FILE* Stream)
{
LONG Tmp;
CHECKTRUE(ReadLong(Stream,NULL,(long*)&Tmp));
m_HeightMode = (int)Tmp;
CHECKTRUE(ReadLong(Stream,NULL,(long*)&Tmp));
m_Height = (int)Tmp;
CHECKTRUE(ReadLong(Stream,NULL,(long*)&Tmp));
m_RandomRange = (int)Tmp;
for(int i=0; i<16; i++) {
LONG Tid;
LONG TFlags;
CHECKTRUE(ReadLong(Stream,NULL,&Tid));
m_BrushMap[i].Tid = (int)Tid;
CHECKTRUE(ReadLong(Stream,NULL,&TFlags));
m_BrushMap[i].TFlags = (DWORD)TFlags&255;
}
SetBrushTextureFromMap();
return TRUE;
}
void CEdgeBrush::FillMap(DWORD Selected,DWORD TextureID,DWORD Type,DWORD Flags)
{
SWORD y = (SWORD)(Selected / m_HeightMap->m_MapWidth);
SWORD x = (SWORD)(Selected - (y*m_HeightMap->m_MapWidth));
FRect Rect;
Rect.x0 = 0;
Rect.y0 = 0;
Rect.x1 = m_HeightMap->m_MapWidth-1;
Rect.y1 = m_HeightMap->m_MapHeight-1;
// SeedFill(x,y,&Rect,0,Type,Flags);
SeedFill(x,y,&Rect,TextureID,Type,Flags);
}
Pixel CEdgeBrush::PixelRead(int x,int y)
{
return m_HeightMap->m_MapTiles[(y*m_HeightMap->m_MapWidth)+x].TMapID;
}
BOOL CEdgeBrush::IsBrushEdge(Pixel ct)
{
for(int i=0; i<13; i++) {
if(ct == m_EdgeBrush[13].Tid) {
return TRUE;
}
}
return FALSE;
}
BOOL CEdgeBrush::PixelCompare(int x,int y,Pixel ov)
{
Pixel ct = m_HeightMap->m_MapTiles[(y*m_HeightMap->m_MapWidth)+x].TMapID;
if( (ct == ov) || IsBrushEdge(ct) ) {
return TRUE;
}
return FALSE;
}
void CEdgeBrush::PixelWrite(int x,int y,Pixel nv,DWORD Type,DWORD Flags)
{
assert(x >=0);
assert(y >=0);
assert(x < m_HeightMap->m_MapWidth);
assert(y < m_HeightMap->m_MapHeight);
Paint(x,y,FALSE);
}
struct FillPoint {
int x;
int y;
};
#define MAX_FILL_LIST_SIZE 16384
FillPoint FillList[MAX_FILL_LIST_SIZE];
int FillListSize = 0;
/*
* fill: set the pixel at (x,y) and all of its 4-connected neighbors
* with the same pixel value to the new pixel value nv.
* A 4-connected neighbor is a pixel above, below, left, or right of a pixel.
*/
void CEdgeBrush::SeedFill(int x, int y, FRect *win, Pixel nv,DWORD Type,DWORD Flags)
{
int l, x1, x2, dy;
Pixel ov; /* old pixel value */
Segment stack[MAX], *sp = stack; /* stack of filled segments */
ov = PixelRead(x, y); /* read pv at seed point */
nv = 255;
FillListSize = 0;
if (ov==nv || x<win->x0 || x>win->x1 || y<win->y0 || y>win->y1) {
return;
}
PUSH(y, x, x, 1); /* needed in some cases */
PUSH(y+1, x, x, -1); /* seed segment (popped 1st) */
while (sp>stack) {
/* pop segment off stack and fill a neighboring scan line */
POP(y, x1, x2, dy);
/*
* segment of scan line y-dy for x1<=x<=x2 was previously filled,
* now explore adjacent pixels in scan line y
*/
for (x=x1; x>=win->x0 && PixelRead(x, y)==ov; x--) {
if(FillListSize+1 < MAX_FILL_LIST_SIZE) {
m_HeightMap->m_MapTiles[(y*m_HeightMap->m_MapWidth)+x].TMapID = 255;
FillList[FillListSize].x = x;
FillList[FillListSize].y = y;
FillListSize++;
} else {
break;
}
}
if (x>=x1) {
goto skip;
}
l = x+1;
if (l<x1) {
PUSH(y, l, x1-1, -dy); /* leak on left? */
}
x = x1+1;
do {
for (; x<=win->x1 && PixelRead(x, y)==ov; x++) {
if(FillListSize+1 < MAX_FILL_LIST_SIZE) {
m_HeightMap->m_MapTiles[(y*m_HeightMap->m_MapWidth)+x].TMapID = 255;
FillList[FillListSize].x = x;
FillList[FillListSize].y = y;
FillListSize++;
} else {
break;
}
}
PUSH(y, l, x-1, dy);
if (x>x2+1) {
PUSH(y, x2+1, x-1, -dy); /* leak on right? */
}
skip:
for (x++; x<=x2 && PixelRead(x, y)!=ov; x++);
l = x;
} while (x<=x2);
}
DebugPrint("FillListSize %d\n",FillListSize);
for(int i=0; i<FillListSize; i++) {
m_HeightMap->m_MapTiles[(FillList[i].y*m_HeightMap->m_MapWidth)+FillList[i].x].TMapID = ov;
}
for(i=0; i<FillListSize; i++) {
Paint(FillList[i].x,FillList[i].y,FALSE);
}
}

104
tools/editworld/src/brush.h Normal file
View File

@ -0,0 +1,104 @@
#ifndef __EDGEBRUSH_INCLUDED__
#define __EDGEBRUSH_INCLUDED__
#include "dibdraw.h"
#include "chnkio.h"
enum {
EB_DECREMENT,
EB_INCREMENT,
EB_SMALLBRUSH,
EB_LARGEBRUSH,
};
// Valid values for m_HeightMode.
enum {
EB_HM_NOSET, // Don't set heights
EB_HM_SETABB, // Set absolute height
EB_HM_SEALEVEL, // Use sea level
};
struct Brush {
int ox,oy;
DWORD Tid; // Texture ID.
DWORD TFlags; // Texture transformation flags.
};
struct BrushMapEntry {
int Flags;
DWORD TFlags; // Texture transformation flags.
DWORD XCoord,YCoord;
int Link;
int Tid; // Texture ID.
};
struct EdgeTableEntry {
SLONG Tid;
DWORD TFlags;
};
class CEdgeBrush : public CChnkIO {
protected:
CHeightMap* m_HeightMap;
EdgeTableEntry m_EdgeTable[16];
int m_EdgeFlags[16];
Brush m_EdgeBrush[13];
BrushMapEntry m_BrushMap[29];
DWORD m_TextureWidth;
DWORD m_TextureHeight;
BOOL m_IsWater;
static DWORD m_NumImages;
static DWORD m_NumInstances;
static BOOL m_BrushSize;
DWORD m_ID;
DWORD ConvertTileIDToCode(DWORD Tid,DWORD TFlags);
void ConvertTileCodeToID(DWORD Code,DWORD &Tid,DWORD &TFlags);
public:
int m_HeightMode;
int m_Height;
int m_RandomRange;
CEdgeBrush(CHeightMap* HeightMap,DWORD TextureWidth,DWORD TextureHeight,DWORD NumImages);
~CEdgeBrush();
void SetTextureSize(DWORD TextureWidth,DWORD TextureHeight) { m_TextureWidth = TextureWidth;
m_TextureHeight = TextureHeight; }
void SetBrushTexture(DWORD TableIndex,int Tid);
void SetBrushTextureFromMap(void);
int GetBrushTexture(DWORD TableIndex);
BOOL Paint(DWORD XCoord,DWORD YCoord,BOOL SetHeight);
void DrawEdgeBrushIcon(CDIBDraw *DIBDraw,DDImage **Images,int x, int y);
void DrawEdgeBrush(CDIBDraw *DIBDraw,DDImage **Images,int ScrollX, int ScrollY);
void RotateTile(int XCoord,int YCoord,int ScrollX,int ScrollY);
void XFlipTile(int XCoord,int YCoord,int ScrollX,int ScrollY);
void YFlipTile(int XCoord,int YCoord,int ScrollX,int ScrollY);
void TriFlipTile(int XCoord,int YCoord,int ScrollX,int ScrollY);
void SetBrushMap(int Tid,DWORD TFlags,int XCoord,int YCoord,int ScrollX,int ScrollY);
DWORD GetNumImages(void) { return m_NumImages; }
void SetNumImages(DWORD NumImages) { m_NumImages = NumImages; }
void DrawButtons(CDC *dc);
int DoButtons(int XCoord,int YCoord);
int GetButtonState(int Index);
void SetButtonState(int Index,int State);
void SetBrushDirect(int Index,int HeightMode,int Height,int RandomRange,int Tid,int Flags);
void SetLargeBrush(BOOL LargeBrush) { m_BrushSize = LargeBrush; }
BOOL GetLargeBrush(void) { return m_BrushSize; }
BOOL Write(FILE* Stream);
BOOL ReadV1(FILE* Stream);
BOOL ReadV2(FILE* Stream);
void FillMap(DWORD Selected,DWORD TextureID,DWORD Type,DWORD Flags);
Pixel PixelRead(int x,int y);
BOOL IsBrushEdge(Pixel ct);
BOOL PixelCompare(int x,int y,Pixel ov);
void PixelWrite(int x,int y,Pixel nv,DWORD Type,DWORD Flags);
void SeedFill(int x, int y, FRect *win, Pixel nv,DWORD Type,DWORD Flags);
};
#endif

View File

@ -0,0 +1,343 @@
// BrushProp.cpp : implementation file
//
#include "stdafx.h"
#include "btedit.h"
#include "bteditdoc.h"
#include "wfview.h"
#include "debugprint.h"
#include "brushprop.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBrushProp dialog
static CBTEditDoc *m_pDoc;
CBrushProp::CBrushProp(CWnd* pParent /*=NULL*/)
: CDialog(CBrushProp::IDD, pParent)
{
//{{AFX_DATA_INIT(CBrushProp)
m_Height = 0;
m_RandomRange = 0;
m_BrushID = 0;
m_BrushSize = -1;
m_HeightSetting = -1;
//}}AFX_DATA_INIT
m_pView = NULL;
}
CBrushProp::CBrushProp(CView *pView)
{
m_Height = 0;
m_RandomRange = 0;
m_BrushID = 0;
m_BrushSize = 1;
m_HeightSetting = 0;
m_OldHeight = (255-m_Height);
m_pView = pView;
m_pDoc = ((CWFView*)m_pView)->GetDocument();
ASSERT_VALID(m_pDoc);
}
BOOL CBrushProp::Create(void)
{
BOOL Ok = CDialog::Create(CBrushProp::IDD);
if(Ok) {
m_HeightSlider.SetRange( 0, 255, TRUE );
m_HeightSlider.SetTicFreq( 16 );
m_RandomSlider.SetRange( 0, 64, TRUE );
m_RandomSlider.SetTicFreq( 8 );
GetBrushData();
}
return Ok;
}
void CBrushProp::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBrushProp)
DDX_Control(pDX, IDC_RANDOMRANGE, m_RandomSlider);
DDX_Control(pDX, IDC_HEIGHTSLIDER, m_HeightSlider);
DDX_Text(pDX, IDC_HEIGHTEDIT, m_Height);
DDV_MinMaxInt(pDX, m_Height, 0, 255);
DDX_Text(pDX, IDC_RANDEDIT, m_RandomRange);
DDV_MinMaxInt(pDX, m_RandomRange, 0, 64);
DDX_Text(pDX, IDC_BRUSHID, m_BrushID);
DDV_MinMaxInt(pDX, m_BrushID, 0, 15);
DDX_Radio(pDX, IDC_BRUSHSIZE, m_BrushSize);
DDX_Radio(pDX, IDC_SETHEIGHT, m_HeightSetting);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBrushProp, CDialog)
//{{AFX_MSG_MAP(CBrushProp)
ON_EN_CHANGE(IDC_HEIGHTEDIT, OnChangeHeightedit)
ON_EN_CHANGE(IDC_RANDEDIT, OnChangeRandedit)
ON_EN_CHANGE(IDC_BRUSHID, OnChangeBrushid)
ON_BN_CLICKED(IDC_BRUSHIDNEXT, OnBrushidnext)
ON_BN_CLICKED(IDC_BRUSHIDPREV, OnBrushidprev)
ON_BN_CLICKED(IDC_BRUSHLARGE, OnBrushlarge)
ON_BN_CLICKED(IDC_BRUSHSIZE, OnBrushsize)
ON_BN_CLICKED(IDC_ABHEIGHT, OnAbheight)
ON_BN_CLICKED(IDC_SETHEIGHT, OnSetheight)
ON_BN_CLICKED(IDC_WATERHEIGHT, OnWaterheight)
ON_WM_KILLFOCUS()
ON_WM_KEYUP()
ON_WM_DRAWITEM()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBrushProp message handlers
void CBrushProp::OnCancel()
{
DestroyWindow();
// CDialog::OnCancel();
}
void CBrushProp::GetBrushData(void)
{
CEdgeBrush *EdgeBrush = m_pDoc->GetEdgeBrush();
m_BrushID = m_pDoc->GetEdgeBrushID();
m_Height = EdgeBrush->m_Height;
m_OldHeight = (255-m_Height);
m_HeightSlider.SetPos(m_OldHeight);
m_RandomRange = EdgeBrush->m_RandomRange;
m_RandomSlider.SetPos(m_RandomRange);
if(EdgeBrush->GetLargeBrush()) {
m_BrushSize = EBP_BS_LARGE;
} else {
m_BrushSize = EBP_BS_SMALL;
}
m_HeightSetting = EdgeBrush->m_HeightMode;
// Set dialog's controls from brush data.
UpdateData(FALSE);
GetDlgItem(IDC_TILEBUT1)->InvalidateRect(NULL,FALSE);
}
void CBrushProp::SetBrushData(void)
{
// Get data from the dialog's controls.
UpdateData(TRUE);
CEdgeBrush *EdgeBrush = m_pDoc->GetEdgeBrush();
EdgeBrush->m_Height = m_Height;
EdgeBrush->m_RandomRange = m_RandomRange;
if(m_BrushSize == EBP_BS_SMALL) {
EdgeBrush->SetLargeBrush(FALSE);
} else {
EdgeBrush->SetLargeBrush(TRUE);
}
EdgeBrush->m_HeightMode = m_HeightSetting;
}
BOOL CBrushProp::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR *Message = (NMHDR*)lParam;
if(wParam == IDC_HEIGHTSLIDER) {
// DebugPrint("%d %d\n",Message->idFrom,Message->code);
if(m_OldHeight != m_HeightSlider.GetPos()) {
m_OldHeight = m_HeightSlider.GetPos();
m_Height = 255-m_HeightSlider.GetPos();
UpdateData(FALSE);
}
if(Message->code != NM_CUSTOMDRAW) {
SetBrushData();
}
}
if(wParam == IDC_RANDOMRANGE) {
// DebugPrint("%d %d\n",Message->idFrom,Message->code);
if(m_RandomRange != m_RandomSlider.GetPos()) {
m_RandomRange = m_RandomSlider.GetPos();
UpdateData(FALSE);
}
if(Message->code != NM_CUSTOMDRAW) {
SetBrushData();
}
}
return CDialog::OnNotify(wParam, lParam, pResult);
}
void CBrushProp::OnChangeHeightedit()
{
UpdateData();
m_OldHeight = (255-m_Height);
m_HeightSlider.SetPos(255-m_Height);
SetBrushData();
}
void CBrushProp::OnChangeRandedit()
{
UpdateData();
m_RandomSlider.SetPos(m_RandomRange);
SetBrushData();
}
void CBrushProp::OnChangeBrushid()
{
GetBrushData();
}
void CBrushProp::OnBrushidnext()
{
SetBrushData();
m_BrushID ++;
if(m_BrushID > 15) {
m_BrushID = 0;
}
m_pDoc->SetEdgeBrush(m_BrushID);
GetBrushData();
}
void CBrushProp::OnBrushidprev()
{
SetBrushData();
m_BrushID --;
if(m_BrushID < 0) {
m_BrushID = 15;
}
m_pDoc->SetEdgeBrush(m_BrushID);
GetBrushData();
}
void CBrushProp::OnBrushlarge()
{
SetBrushData();
}
void CBrushProp::OnBrushsize()
{
SetBrushData();
}
void CBrushProp::OnAbheight()
{
SetBrushData();
}
void CBrushProp::OnSetheight()
{
SetBrushData();
}
void CBrushProp::OnWaterheight()
{
SetBrushData();
}
void CBrushProp::OnKillFocus(CWnd* pNewWnd)
{
CDialog::OnKillFocus(pNewWnd);
}
void CBrushProp::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CDialog::OnKeyUp(nChar, nRepCnt, nFlags);
}
/*
typedef struct tagDRAWITEMSTRUCT {
UINT CtlType;
UINT CtlID;
UINT itemID;
UINT itemAction;
UINT itemState;
HWND hwndItem;
HDC hDC;
RECT rcItem;
DWORD itemData;
} DRAWITEMSTRUCT, NEAR *PDRAWITEMSTRUCT, FAR *LPDRAWITEMSTRUCT;
*/
void CBrushProp::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
int ButWidth = lpDrawItemStruct->rcItem.right&0xfffc;
int ButHeight = lpDrawItemStruct->rcItem.bottom;
CDIBDraw *Dib = new CDIBDraw(lpDrawItemStruct->hwndItem,
ButWidth,ButHeight,
g_WindowsIs555);
Dib->ClearDIB();
CEdgeBrush *EdgeBrush = m_pDoc->GetEdgeBrush();
CTextureSelector *Textures = m_pDoc->GetTextureSelector();
int x = (ButWidth-m_pDoc->GetTextureWidth()*3)/2;
int y = (ButHeight-m_pDoc->GetTextureHeight())/2;
EdgeBrush->DrawEdgeBrushIcon(Dib,Textures->GetImages(),x,y);
Dib->SwitchBuffers();
// CDC *dc=dc->FromHandle(lpDrawItemStruct->hDC);
// CPen Pen;
// Pen.CreatePen( PS_SOLID, 2, RGB(255,0,255) );
// dc->SelectObject( &Pen );
//
// int x0 = lpDrawItemStruct->rcItem.left;
// int y0 = lpDrawItemStruct->rcItem.top;
// int x1 = lpDrawItemStruct->rcItem.right;
// int y1 = lpDrawItemStruct->rcItem.bottom;
//
// dc->MoveTo(x0,y0);
// dc->LineTo(x1,y0);
// dc->LineTo(x1,y1);
// dc->LineTo(x0,y1);
// dc->LineTo(x0,y0);
//
delete Dib;
CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}

View File

@ -0,0 +1,84 @@
// BrushProp.h : header file
//
#ifndef __INCLUDED_BRUSHPROP__
#define __INCLUDED_BRUSHPROP__
/////////////////////////////////////////////////////////////////////////////
// CBrushProp dialog
// Valid values for m_BrushSize.
enum {
EBP_BS_SMALL, // Small brush
EBP_BS_LARGE, // Large brush
};
// Valid values for m_HeightSetting.
enum {
EBP_HS_NOSET, // Don't set heights
EBP_HS_SETABB, // Set absolute height
EBP_HS_SEALEVEL,// Use sea level
};
#define WM_CLOSE_BRUSHPROP (WM_USER+10)
class CBrushProp : public CDialog
{
// Construction
public:
CBrushProp(CWnd* pParent = NULL); // standard constructor
CBrushProp(CView *pView);
BOOL Create(void);
void GetBrushData(void);
void SetBrushData(void);
CView *m_pView;
int m_OldHeight;
// Dialog Data
//{{AFX_DATA(CBrushProp)
enum { IDD = IDD_EDGEBRUSH };
CSliderCtrl m_RandomSlider;
CSliderCtrl m_HeightSlider;
int m_Height;
int m_RandomRange;
int m_BrushID;
int m_BrushSize;
int m_HeightSetting;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBrushProp)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CBrushProp)
virtual void OnCancel();
afx_msg void OnChangeHeightedit();
afx_msg void OnChangeRandedit();
afx_msg void OnChangeBrushid();
afx_msg void OnBrushidnext();
afx_msg void OnBrushidprev();
afx_msg void OnBrushlarge();
afx_msg void OnBrushsize();
afx_msg void OnAbheight();
afx_msg void OnSetheight();
afx_msg void OnWaterheight();
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif

View File

@ -0,0 +1,230 @@
// BTEdit.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "btedit.h"
#include "mainfrm.h"
#include "bteditdoc.h"
#include "bteditview.h"
//#include "debugwin.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBTEditApp
BEGIN_MESSAGE_MAP(CBTEditApp, CWinApp)
//{{AFX_MSG_MAP(CBTEditApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
CBTEditCommandLineInfo g_cmdInfo;
void CBTEditCommandLineInfo::ParseParam(const char* pszParam,BOOL bFlag,BOOL bLast)
{
if (bFlag)
{
if (lstrcmpA(pszParam, "emulation") == 0)
{
m_bForceEmulation = TRUE;
return;
}
if (lstrcmpA(pszParam, "hardware") == 0)
{
m_bForceHardware = TRUE;
return;
}
if (lstrcmpA(pszParam, "primary") == 0)
{
m_bForcePrimary = TRUE;
return;
}
if (lstrcmpA(pszParam, "secondary") == 0)
{
m_bForceSecondary = TRUE;
return;
}
if (lstrcmpA(pszParam, "ramp") == 0)
{
m_bForceRamp = TRUE;
return;
}
if (lstrcmpA(pszParam, "rgb") == 0)
{
m_bForceRGB = TRUE;
return;
}
// if (lstrcmpA(pszParam, "nosizecheck") == 0)
// {
// m_bMapSizePower2 = FALSE;
// return;
// }
m_bMapSizePower2 = FALSE;
}
CCommandLineInfo::ParseParam(pszParam, bFlag, bLast);
}
/////////////////////////////////////////////////////////////////////////////
// CBTEditApp construction
CBTEditApp::CBTEditApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CBTEditApp object
CBTEditApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CBTEditApp initialization
char g_HomeDirectory[1024];
char g_WorkDirectory[1024];
HCURSOR g_Wait;
HCURSOR g_Pointer;
HCURSOR g_PointerPaint;
HCURSOR g_PointerFill;
HCURSOR g_PointerDrag;
HCURSOR g_PointerSelRect;
HCURSOR g_PointerSelPoint;
HCURSOR g_PointerPipet;
HCURSOR g_PointerPliers;
HICON g_IconIncrement;
HICON g_IconDecrement;
HICON g_IconSmallBrush;
HICON g_IconSmallBrush2;
HICON g_IconLargeBrush;
HICON g_IconLargeBrush2;
BOOL CBTEditApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
// pDebugThread = AfxBeginThread(RUNTIME_CLASS(DebugThread));
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
SetRegistryKey("Pumpkin Studios");
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CBTEditDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CBTEditView));
AddDocTemplate(pDocTemplate);
GetCurrentDirectory(sizeof(g_HomeDirectory),g_HomeDirectory);
g_Wait = ::LoadCursor(NULL,IDC_WAIT);
g_Pointer = LoadCursor(IDC_POINTER);
g_PointerPaint = LoadCursor(IDC_POINTER_PAINT);
g_PointerFill = LoadCursor(IDC_POINTER_FILL);
g_PointerDrag = LoadCursor(IDC_POINTER_HGTDRAG);
g_PointerSelRect = LoadCursor(IDC_POINTER_SELRECT);
g_PointerSelPoint = LoadCursor(IDC_POINTER);
g_PointerPipet = LoadCursor(IDC_PIPET);
g_PointerPliers = LoadCursor(IDC_PLIERS);
g_IconIncrement = LoadIcon(IDI_INCREMENT);
g_IconDecrement = LoadIcon(IDI_DECREMENT);
g_IconSmallBrush = LoadIcon(IDI_SMALLBRUSH);
g_IconSmallBrush2 = LoadIcon(IDI_SMALLBRUSH2);
g_IconLargeBrush = LoadIcon(IDI_LARGEBRUSH);
g_IconLargeBrush2 = LoadIcon(IDI_LARGEBRUSH2);
// Parse command line for standard shell commands, DDE, file open
// CCommandLineInfo cmdInfo;
ParseCommandLine(g_cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(g_cmdInfo))
return FALSE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CBTEditApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CBTEditApp commands

View File

@ -0,0 +1,62 @@
// BTEdit.h : main header file for the BTEDIT application
//
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CBTEditApp:
// See BTEdit.cpp for the implementation of this class
//
class CBTEditCommandLineInfo : public CCommandLineInfo
{
public:
CBTEditCommandLineInfo() {
m_bForceEmulation = FALSE;
m_bForceHardware = FALSE;
m_bForcePrimary = FALSE;
m_bForceSecondary = FALSE;
m_bForceRamp = FALSE;
m_bForceRGB = FALSE;
m_bMapSizePower2 = TRUE;
}
BOOL m_bForceEmulation;
BOOL m_bForceHardware;
BOOL m_bForcePrimary;
BOOL m_bForceSecondary;
BOOL m_bForceRamp;
BOOL m_bForceRGB;
BOOL m_bMapSizePower2;
virtual void ParseParam(const char* pszParam,BOOL bFlag,BOOL bLast);
};
extern CBTEditCommandLineInfo g_cmdInfo;
class CBTEditApp : public CWinApp
{
public:
CBTEditApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBTEditApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CBTEditApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,691 @@
// BTEditDoc.h : interface of the CBTEditDoc class
//
/////////////////////////////////////////////////////////////////////////////
//#include "DDView.h"
#include "directx.h"
#include "geometry.h"
#include "ddimage.h"
#include "heightmap.h"
//#include "Object3D.h"
#include "pcxhandler.h"
#include "textsel.h"
#include "listtemp.h"
#include "brush.h"
#include "chnkio.h"
#include "tiletypes.h"
#include "undoredo.h"
#include "brushprop.h"
#define EBVIEW_YOFFSET 32
//#include "DataTypes.h"
//#define RSTEP (2)
//#define OVERSCAN (4)
#define DEFAULT_TEXTURESIZE (64) //(128)
#define DEFAULT_TILESIZE (128)
#define DEFAULT_TILESIZE (128)
#define DEFAULT_MAPSIZE (64)
#define DEFAULT_MAPSIZE (64)
#define DEFAULT_RADARSCALE (2)
#define DEFAULT_HEIGHTSCALE (2)
#define CAM_HEIGHT (820)
//#define CAM_HEIGHT (500) //(1000) //(2200)
#define ISOMETRIC (44) //(60)
//#define MAXTEXTURELIST 16
#define MAXEDGEBRUSHES 16
enum {
FM_SOLID,
FM_WIREFRAME,
FM_POINTS,
};
enum {
DM_WIREFRAME,
DM_TEXTURED
};
enum {
SM_FLAT,
SM_GOURAUD
};
// Possible values for currently selected 2D mode.
enum {
M2D_WORLD,
M2D_EDGEBRUSHES,
M2D_BRUSHES
};
enum {
MTV_TEXTURES,
MTV_STATS,
MTV_DEPLOYMENTS
};
enum {
MCAM_FREE,
MCAM_ISOMETRIC
};
enum {
RADAR_TEXTURES,
RADAR_HEIGHTS
};
// Possible values for currently selected tool.
enum {
ET_GET,
ET_PAINT,
ET_EDGEPAINT,
ET_EDGEFILL,
ET_BRUSHPAINT,
ET_FILL,
ET_GATEWAY,
ET_GETVERTEX,
ET_PAINTVERTEX,
ET_PAINTVERTEXSEALEVEL,
ET_DRAGVERTEX,
ET_SELECTRECT,
ET_SELECTPOINT,
ET_MARKRECT,
ET_COPYRECT,
ET_PASTERECT,
ET_TRIDIR1,
ET_TRIDIR2,
ET_PLACEOBJECT,
ET_SELECTOBJECT,
ET_DESELECTOBJECT,
ET_DRAGOBJECT,
ET_GETOBJECTHEIGHT,
ET_ROTATEOBJECT,
ET_HIDETILE,
ET_SHOWTILE,
ET_TYPESFIRST,
ET_TYPESAND = ET_TYPESFIRST,
ET_TYPESANDYBRUSH,
ET_TYPEBAKEDEARTH,
ET_TYPEGREENMUD,
ET_TYPEREDBRUSH,
ET_TYPEPINKROCK,
ET_TYPEROAD,
ET_TYPEWATER,
ET_TYPECLIFFFACE,
ET_TYPERUBBLE,
ET_TYPESHEETICE,
ET_TYPESLUSH,
ET_TYPESLAST = ET_TYPESLUSH,
ET_ROTATETILE,
ET_XFLIPTILE,
ET_YFLIPTILE,
ET_POINT,
ET_MOVE,
};
// Flags for defining type of paste operation.
#define PF_PASTETEXTURES 1
#define PF_PASTEFLAGS 2
#define PF_PASTEHEIGHTS 4
#define PF_PASTEOBJECTS 8
#define PF_MATCHEDGES 16
#define PF_PASTEALL 0xffff
// Possible values for snap type.
//enum {
// SNAP_NONE,
// SNAP_CENTER,
// SNAP_TOPLEFT,
// SNAP_TOPRIGHT,
// SNAP_BOTTOMLEFT,
// SNAP_BOTTOMRIGHT,
// SNAP_QUAD,
// SNAP_CUSTOM,
//};
//#define MAXOBJECTINSTANCES 16
struct ClipboardHeader {
char Type[4]; // Validation string.
int Width; // Width in tiles.
int Height; // Height in tiles.
int NumObjects; // Number of 3d objects.
};
extern int g_CursorTileX;
extern int g_CursorTileZ;
class CBTEditDoc : public CDocument,CChnkIO
{
protected:
DWORD m_CurrentPlayer;
int m_RadarScale;
int m_RadarMode;
UWORD m_RadarColours[8192]; // Should be allocated.
BOOL m_ViewFeatures;
BOOL m_ShowVerticies;
char** m_UnitIDs;
int m_CameraMode;
void DisplayTextures(BOOL Redraw);
void DisplayStats(BOOL Redraw);
void DisplayDeployments(BOOL Redraw);
BOOL LoadDataTypes(void);
CSize m_TexVScrollSize;
int m_TexVScrollX;
int m_TexVScrollY;
int m_BrushScrollY;
int m_BrushScrollX;
int m_WorldScrollY;
int m_WorldScrollX;
BOOL m_EnableRefresh;
DWORD m_EditTool;
DWORD m_PasteFlags;
BOOL m_2DGotFocus;
BOOL m_3DGotFocus;
BOOL m_AutoSync;
BOOL m_AutoHeight;
CBrushProp *m_BrushProp;
CBTEditDoc();
DECLARE_DYNCREATE(CBTEditDoc)
// Attributes
public:
BOOL m_Captureing;
BOOL m_EnableAutoSnap;
BOOL m_ShowBoxes;
int m_SelObject;
BOOL m_SelIsTexture;
int m_LightID;
BOOL m_TileMode;
D3DVECTOR m_LightRotation;
int m_TileBufferWidth;
int m_TileBufferHeight;
CTile *m_TileBuffer;
BOOL m_PasteWithPlayerID;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBTEditDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
virtual void OnCloseDocument();
virtual BOOL CanCloseFrame(CFrameWnd* pFrame);
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CBTEditDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// CForceList *GetDeploymentList(void) { return m_Deployments; }
BOOL GetAutoHeight(void) { return m_AutoHeight; }
int GetRadarScale(void) { return m_RadarScale; }
char** GetTextureList(void);
DWORD GetTextureWidth(void) { return m_TextureWidth; }
DWORD GetTextureHeight(void) { return m_TextureHeight; }
DWORD GetMapWidth(void) { return m_MapWidth; }
DWORD GetMapHeight(void) { return m_MapHeight; }
DWORD GetTileWidth(void) { return m_TileWidth; }
DWORD GetTileHeight(void) { return m_TileHeight; }
CHeightMap *GetHeightMap(void) { return m_HeightMap; }
CTextureSelector *GetTextureSelector(void) { return m_Textures; }
DWORD m_SelTexture; // The currently selected texture.
DWORD m_SelType; // The currently selected texture's type.
DWORD m_SelFlags; // The currently selected texture's flags.
DWORD m_CurrentType; // The last texture type specified in the tool bar.
DWORD GetSelectedType(void) { return m_CurrentType; }
void InitialiseData(void);
void DeleteData(void);
void UpdateStatusBar(void);
void Update3DView(HWND hWnd,HWND OwnerhWnd,
D3DVECTOR &CameraRotation,D3DVECTOR &CameraPosition);
void Update3DView(void);
int SelectFace(D3DVECTOR &CameraRotation,D3DVECTOR &CameraPosition,DWORD XPos,DWORD YPos);
int Select2DFace(DWORD XPos,DWORD YPos,int ScrollX,int ScrollY);
void ConvertCoord2d3d(SLONG &XPos,SLONG &YPos,SLONG ScrollX,SLONG ScrollY);
float GetHeightAt(D3DVECTOR &Position);
void DoGridSnap(D3DVECTOR &Position,int SnapMode = -1);
void SetTextureID(DWORD Selected,DWORD TextureID);
void FillMap(DWORD Selected,DWORD TextureID,DWORD Type,DWORD Flags);
void RedrawFace(HWND hWnd,DWORD Selected,D3DVECTOR &CameraRotation,D3DVECTOR &CameraPosition);
void RedrawFace(DWORD Selected);
void SetEditToolCursor(void);
DWORD GetEditTool(void) { return m_EditTool; }
void UpdateTextureView(HWND hWnd,HWND OwnerhWnd,SLONG ScrollX,SLONG ScrollY);
void UpdateTextureView(void);
DWORD GetTextureViewWidth(HWND hWnd);
DWORD GetTextureViewHeight(HWND hWnd);
BOOL SelectTexture(SLONG XPos,SLONG YPos);
void Update2DView(void);
void Update2DView(int Dest);
void Update2DView(int Dest,int Corner0,int Corner1);
void Update2DView(HWND hWnd,HWND OwnerhWnd,
SLONG ScrollX,SLONG ScrollY);
DWORD Get2DViewWidth(void);
DWORD Get2DViewHeight(void);
BOOL WriteProject(char *FileName,UWORD StartX,UWORD StartY,UWORD Width,UWORD Height);
BOOL WriteProject(char *FileName);
BOOL WriteProjectBinary(char *FileName);
BOOL ReadProject(char *FileName);
BOOL WriteObjectDB(FILE *Stream);
BOOL WriteDeployments(FILE *Stream);
BOOL ReadDeployments(FILE *Stream);
// BOOL ReadObjectDB(FILE* Stream);
BOOL GetFilePath(char *FilterList,char *ExtType,char *Filter,BOOL Open,
char *PathName,char *FileName,char *FullPath);
void Register3DWindow(HWND hWnd);
void RegisterCamera(D3DVECTOR &CameraRotation,D3DVECTOR &CameraPosition);
void GetCamera(D3DVECTOR &CameraRotation,D3DVECTOR &CameraPosition);
void Register2DWindow(HWND hWnd);
void RegisterScrollPosition(SLONG ScrollX,SLONG ScrollY);
void GetScrollPosition(SLONG *ScrollX,SLONG *ScrollY);
void BuildRadarMap(void);
void DrawRadarMap2D(CDIBDraw *DIBDraw,DWORD XPos,DWORD YPos);
void DrawRadarMap3D(CDIBDraw *DIBDraw,D3DVECTOR &CamPos);
void GetRadarColours(void);
SLONG DrawRadarHeightMap(CDIBDraw *DIBDraw);
SLONG DrawRadarBlocking(CDIBDraw *DIBDraw);
SLONG DrawRadarTextureMap(CDIBDraw *DIBDraw);
DWORD GetRadarMapWidth(void) { return m_MapWidth*m_RadarScale+8+OVERSCAN*m_RadarScale*2; }
DWORD GetRadarMapHeight(void) { return m_MapHeight*m_RadarScale+8+OVERSCAN*m_RadarScale*2; }
BOOL InLocator(DWORD XCoord,DWORD YCoord);
BOOL InLocatorBorder(DWORD XCoord,DWORD YCoord);
// void DrawObjects3D(void);
// void DrawObjects2D(CDIBDraw *DIBDraw,int ScrollX,int ScrollY);
void EnableWireFrame(void);
void EnableTextures(void);
void EnableGouraud(BOOL Enable);
BOOL WriteClipboard(char *FileName);
BOOL ReadClipboard(char *FileName);
void CopyObjectRect(int Tile0,int Tile1);
void PasteObjectRect(int Dest);
void CopyTileRect(int Tile0,int Tile1);
void PasteTileRect(int Dest);
BOOL ClipboardIsValid(void);
void RotateClipboard(void);
void XFlipClipboard(void);
void YFlipClipboard(void);
void ClipCoordToMap(int &x,int &y);
void CenterCamera(void);
BOOL GetAutoSync(void) { return m_AutoSync; }
BOOL GetViewFeatures(void) { return m_ViewFeatures; }
// ListNode<CObjectDB>* GetObjectDatabase(void) { return m_ObjectDatabase; }
// void SetObjectDatabase(ListNode<CObjectDB>* ObjectDatabase);
// CObjectDB* GetSelectedObject(void);
// BOOL ObjectAlreadyLoaded(char *Name);
CGeometry* GetDirectMaths(void) { return m_DirectMaths; }
CDirectDraw* GetDirect3D(void) { return m_DirectDrawView; }
void SelectAllObjects(void);
void DeSelectAllObjects(void);
void RemoveSelectedObjects(void);
BOOL GetGravity(void) { return m_EnableGravity; }
SLONG GetRotationSnap(void) { return m_RotSnap; }
DWORD Get2DMode(void) { return m_2DMode; }
void Set2DMode(DWORD Mode) { m_2DMode = Mode; }
DWORD GetTVMode(void) { return m_TVMode; }
void SetTVMode(DWORD Mode) { m_TVMode = Mode; }
int GetCameraMode(void) { return m_CameraMode; }
int GetEdgeBrushID(void) { return m_CurrentEdgeBrush; }
CEdgeBrush* GetEdgeBrush(void) { return m_EdgeBrush[m_CurrentEdgeBrush]; }
CBrushProp* GetBrushProp(void) { return m_BrushProp; }
CEdgeBrush* SetEdgeBrush(int ID);
CEdgeBrush* NextEdgeBrush(void);
CEdgeBrush* PrevEdgeBrush(void);
BOOL WriteTileFlags(FILE *Stream);
BOOL ReadTileFlags(FILE* Stream);
BOOL WriteTileTypes(FILE* Stream);
BOOL ReadTileTypes(FILE* Stream);
BOOL WriteBrushes(FILE* Stream);
BOOL ReadBrushes(FILE* Stream);
void SyncBrushDialog(void);
void Set2DViewPos(void);
void Set3DViewPos(void);
void Invalidate2D(void);
void Invalidate3D(void);
// void SetStatsView(CObjectDB *ObjectDB,int Instance=-1);
void Set2DFocus(BOOL Focus) { m_2DGotFocus = Focus; }
void Set3DFocus(BOOL Focus) { m_3DGotFocus = Focus; }
// void BuildIDList(void);
// char **GetIDList(void) { return m_UnitIDs; }
// void FixForceListIndecies(void);
void DisplayExportSummary(void);
BOOL WriteDeliveranceStart(char *FileName);
BOOL WriteDeliveranceExpand(char *FileName);
BOOL WriteDeliveranceMission(char *FileName);
BOOL WriteProjectNecromancer(char *FileName);
void InitVertexTool(void);
void InitTextureTool(void);
void ReInitEdgeBrushes(void);
void GetLightRotation(D3DVECTOR &Rotation);
void SetLightRotation(D3DVECTOR &Rotation);
DWORD GetCurrentPlayer(void) { return m_CurrentPlayer; }
void SetCurrentPlayer(DWORD Player) { m_CurrentPlayer = Player; }
void SetButtonLapse(void);
BOOL ProcessButtonLapse(void);
BOOL CaptureScreen(int ImageX,int ImageY);
BOOL SelectAndLoadDataSet(void);
BOOL LoadDataSet(char *FullPath);
void GetLightDirection(D3DVECTOR *LightDir);
void SetLightDirection(D3DVECTOR *LightDir);
void StichTiles(int x0,int y0,int x1,int y1,BOOL AddUndo);
void XFlipTileRect(int Tile0,int Tile1);
void YFlipTileRect(int Tile0,int Tile1);
protected:
void LoadTextures(char *FileName);
void DeleteProjectName(void);
void CreateDefaultTextureList(void);
void DeleteTextureList(void);
char m_DataSetName[256];
int m_ButtonLapse;
DWORD m_FillMode;
BOOL m_ViewIsInitialised;
CDirectDraw *m_DirectDrawView;
CGeometry *m_DirectMaths;
CMatManager *m_MatManager;
PCXHandler *m_PCXBitmap;
PCXHandler *m_PCXTexBitmap;
LPDIRECTDRAWSURFACE m_TextureSurface;
LPDIRECTDRAWSURFACE m_SpriteSurface;
LPDIRECTDRAWSURFACE m_TextSurface;
DDImage* m_SpriteImage;
DDImage* m_TextImage;
HWND m_3DWnd;
D3DVECTOR m_CameraPosition;
D3DVECTOR m_CameraRotation;
HWND m_2DWnd;
SLONG m_ScrollX;
SLONG m_ScrollY;
char *m_FileName;
char *m_PathName;
char *m_FullPath;
CHeightMap* m_HeightMap;
CTextureSelector *m_Textures;
DWORD m_MapWidth;
DWORD m_MapHeight;
DWORD m_TileWidth;
DWORD m_TileHeight;
DWORD m_TextureWidth;
DWORD m_TextureHeight;
DWORD m_HeightScale;
HCURSOR m_PointerDraw;
HCURSOR m_PointerFill;
HWND m_TVhWnd;
SLONG m_TVScrollX;
SLONG m_TVScrollY;
// UBYTE *m_RadarMap;
UWORD *m_RadarMap;
int m_ObjectBufferSize;
ListNode<C3DObjectInstance> *m_ObjectBuffer;
// ListNode<CObjectDB> *m_ObjectDatabase;
// CDatabaseTypes *m_DatabaseTypes;
BOOL m_EnableGravity;
DWORD m_SnapX;
DWORD m_SnapZ;
DWORD m_SnapMode;
SLONG m_RotSnap;
DWORD m_2DMode;
BOOL m_ShowLocators;
// BOOL m_ShowObjects;
BOOL m_ShowSeaLevel;
CEdgeBrush* m_EdgeBrush[16];
DWORD m_CurrentEdgeBrush;
DWORD m_TVMode;
DWORD m_DrawMode;
DWORD m_ShadeMode;
// Generated message map functions
protected:
BOOL m_ScaleLocators;
//{{AFX_MSG(CBTEditDoc)
afx_msg void OnMapSetmapsize();
afx_msg void OnFileOpen();
afx_msg void OnFileSave();
afx_msg void OnFileSaveAs();
afx_msg void OnFileNew();
afx_msg void OnMapLoadheightmap();
afx_msg void OnDrawFill();
afx_msg void OnDrawPaint();
afx_msg void OnSelectArea();
afx_msg void OnSelectPoint();
afx_msg void OnHeightDrag();
afx_msg void OnUpdateDrawPaint(CCmdUI* pCmdUI);
afx_msg void OnUpdateHeightDrag(CCmdUI* pCmdUI);
afx_msg void OnUpdateSelectArea(CCmdUI* pCmdUI);
afx_msg void OnUpdateSelectPoint(CCmdUI* pCmdUI);
afx_msg void OnUpdateDrawFill(CCmdUI* pCmdUI);
afx_msg void OnDrawGet();
afx_msg void OnUpdateDrawGet(CCmdUI* pCmdUI);
afx_msg void OnHeightPaint();
afx_msg void OnUpdateHeightPaint(CCmdUI* pCmdUI);
afx_msg void OnHeightPick();
afx_msg void OnUpdateHeightPick(CCmdUI* pCmdUI);
afx_msg void OnTridir1();
afx_msg void OnUpdateTridir1(CCmdUI* pCmdUI);
afx_msg void OnDrawEdgepaint();
afx_msg void OnUpdateDrawEdgepaint(CCmdUI* pCmdUI);
afx_msg void OnViewEdgebrushes();
afx_msg void OnUpdateViewEdgebrushes(CCmdUI* pCmdUI);
afx_msg void OnViewWorld();
afx_msg void OnUpdateViewWorld(CCmdUI* pCmdUI);
afx_msg void OnViewLocatormaps();
afx_msg void OnUpdateViewLocatormaps(CCmdUI* pCmdUI);
afx_msg void OnViewSealevel();
afx_msg void OnUpdateViewSealevel(CCmdUI* pCmdUI);
afx_msg void OnPaintatsealevel();
afx_msg void OnUpdatePaintatsealevel(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewTextures(CCmdUI* pCmdUI);
afx_msg void OnViewZerocamera();
afx_msg void OnViewZerocameraposition();
afx_msg void OnViewFreecamera();
afx_msg void OnUpdateViewFreecamera(CCmdUI* pCmdUI);
afx_msg void OnViewIsometric();
afx_msg void OnUpdateViewIsometric(CCmdUI* pCmdUI);
afx_msg void OnViewWireframe();
afx_msg void OnUpdateViewWireframe(CCmdUI* pCmdUI);
afx_msg void OnViewTextured();
afx_msg void OnUpdateViewTextured(CCmdUI* pCmdUI);
afx_msg void OnFlipx();
afx_msg void OnUpdateFlipx(CCmdUI* pCmdUI);
afx_msg void OnFlipy();
afx_msg void OnUpdateFlipy(CCmdUI* pCmdUI);
afx_msg void OnRotate90();
afx_msg void OnUpdateRotate90(CCmdUI* pCmdUI);
afx_msg void OnViewTerraintypes();
afx_msg void OnUpdateViewTerraintypes(CCmdUI* pCmdUI);
afx_msg void OnHeightTilemode();
afx_msg void OnUpdateHeightTilemode(CCmdUI* pCmdUI);
afx_msg void OnHeightVertexmode();
afx_msg void OnUpdateHeightVertexmode(CCmdUI* pCmdUI);
afx_msg void OnPoint();
afx_msg void OnUpdatePoint(CCmdUI* pCmdUI);
afx_msg void OnMove();
afx_msg void OnUpdateMove(CCmdUI* pCmdUI);
afx_msg void OnObjectrotate();
afx_msg void OnUpdateObjectrotate(CCmdUI* pCmdUI);
afx_msg void OnViewFeatures();
afx_msg void OnUpdateViewFeatures(CCmdUI* pCmdUI);
afx_msg void OnViewShowheights();
afx_msg void OnUpdateViewShowheights(CCmdUI* pCmdUI);
afx_msg void OnViewShowtextures();
afx_msg void OnUpdateViewShowtextures(CCmdUI* pCmdUI);
afx_msg void OnFileLoadfeatureset();
afx_msg void OnFileSaveedgebrushes();
afx_msg void OnFileLoadedgebrushes();
afx_msg void OnFileSavetiletypes();
afx_msg void OnFileLoadtiletypes();
afx_msg void OnUndo();
afx_msg void OnRedo();
afx_msg void OnViewGouraudshading();
afx_msg void OnUpdateViewGouraudshading(CCmdUI* pCmdUI);
afx_msg void OnViewBoundingspheres();
afx_msg void OnUpdateViewBoundingspheres(CCmdUI* pCmdUI);
afx_msg void OnFileExportwarzonescenario();
afx_msg void OnFileImportwarzonescenario();
afx_msg void OnMapSaveheightmap();
afx_msg void OnViewAutoheightset();
afx_msg void OnUpdateViewAutoheightset(CCmdUI* pCmdUI);
afx_msg void OnOptionsResettextureflags();
afx_msg void OnPlayer1();
afx_msg void OnUpdatePlayer1(CCmdUI* pCmdUI);
afx_msg void OnPlayer2();
afx_msg void OnUpdatePlayer2(CCmdUI* pCmdUI);
afx_msg void OnPlayer3();
afx_msg void OnUpdatePlayer3(CCmdUI* pCmdUI);
afx_msg void OnPlayer4();
afx_msg void OnUpdatePlayer4(CCmdUI* pCmdUI);
afx_msg void OnPlayer5();
afx_msg void OnUpdatePlayer5(CCmdUI* pCmdUI);
afx_msg void OnPlayer6();
afx_msg void OnUpdatePlayer6(CCmdUI* pCmdUI);
afx_msg void OnPlayer7();
afx_msg void OnUpdatePlayer7(CCmdUI* pCmdUI);
afx_msg void OnPlayer0();
afx_msg void OnUpdatePlayer0(CCmdUI* pCmdUI);
afx_msg void OnEnableautosnap();
afx_msg void OnUpdateEnableautosnap(CCmdUI* pCmdUI);
afx_msg void OnFileSavemapsegment();
afx_msg void OnTypebackedearth();
afx_msg void OnUpdateTypebackedearth(CCmdUI* pCmdUI);
afx_msg void OnTypecliffface();
afx_msg void OnUpdateTypecliffface(CCmdUI* pCmdUI);
afx_msg void OnTypegreenmud();
afx_msg void OnUpdateTypegreenmud(CCmdUI* pCmdUI);
afx_msg void OnTypepinkrock();
afx_msg void OnUpdateTypepinkrock(CCmdUI* pCmdUI);
afx_msg void OnTyperedbrush();
afx_msg void OnUpdateTyperedbrush(CCmdUI* pCmdUI);
afx_msg void OnTyperoad();
afx_msg void OnUpdateTyperoad(CCmdUI* pCmdUI);
afx_msg void OnTyperubble();
afx_msg void OnUpdateTyperubble(CCmdUI* pCmdUI);
afx_msg void OnTypesand();
afx_msg void OnUpdateTypesand(CCmdUI* pCmdUI);
afx_msg void OnTypesandybrush();
afx_msg void OnUpdateTypesandybrush(CCmdUI* pCmdUI);
afx_msg void OnTypesheetice();
afx_msg void OnUpdateTypesheetice(CCmdUI* pCmdUI);
afx_msg void OnTypeslush();
afx_msg void OnUpdateTypeslush(CCmdUI* pCmdUI);
afx_msg void OnTypewater();
afx_msg void OnUpdateTypewater(CCmdUI* pCmdUI);
afx_msg void OnFileImportclipboard();
afx_msg void OnFileExportclipboard();
afx_msg void OnMapEditscrolllimits();
afx_msg void OnFileExportwarzonescenarioexpand();
afx_msg void OnFileExportwarzonemission();
afx_msg void OnMapSetplayerclanmappings();
afx_msg void OnGateway();
afx_msg void OnUpdateGateway(CCmdUI* pCmdUI);
afx_msg void OnMapExportmapasbitmap();
afx_msg void OnMapRefreshzones();
afx_msg void OnOptionsZoomedin();
afx_msg void OnUpdateOptionsZoomedin(CCmdUI* pCmdUI);
afx_msg void OnMapSavetilemap();
afx_msg void OnMapLoadtilemap();
afx_msg void OnPlayer0en();
afx_msg void OnUpdatePlayer0en(CCmdUI* pCmdUI);
afx_msg void OnPlayer1en();
afx_msg void OnUpdatePlayer1en(CCmdUI* pCmdUI);
afx_msg void OnPlayer2en();
afx_msg void OnUpdatePlayer2en(CCmdUI* pCmdUI);
afx_msg void OnPlayer3en();
afx_msg void OnUpdatePlayer3en(CCmdUI* pCmdUI);
afx_msg void OnPlayer4en();
afx_msg void OnUpdatePlayer4en(CCmdUI* pCmdUI);
afx_msg void OnPlayer5en();
afx_msg void OnUpdatePlayer5en(CCmdUI* pCmdUI);
afx_msg void OnPlayer6en();
afx_msg void OnUpdatePlayer6en(CCmdUI* pCmdUI);
afx_msg void OnPlayer7en();
afx_msg void OnUpdatePlayer7en(CCmdUI* pCmdUI);
afx_msg void OnOptionsUsenames();
afx_msg void OnUpdateOptionsUsenames(CCmdUI* pCmdUI);
afx_msg void OnMarkrect();
afx_msg void OnUpdateMarkrect(CCmdUI* pCmdUI);
afx_msg void OnPaste();
afx_msg void OnUpdatePaste(CCmdUI* pCmdUI);
afx_msg void OnXflipmarked();
afx_msg void OnUpdateXflipmarked(CCmdUI* pCmdUI);
afx_msg void OnYflipmarked();
afx_msg void OnUpdateYflipmarked(CCmdUI* pCmdUI);
afx_msg void OnCopymarked();
afx_msg void OnUpdateCopymarked(CCmdUI* pCmdUI);
afx_msg void OnPasteprefs();
afx_msg void OnUpdatePasteprefs(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileExportclipboard(CCmdUI* pCmdUI);
afx_msg void OnDrawbrushfill();
afx_msg void OnUpdateDrawbrushfill(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
extern CBTEditDoc *BTEditDoc;
/////////////////////////////////////////////////////////////////////////////

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,129 @@
// BTEditView.h : interface of the CBTEditView class
//
/////////////////////////////////////////////////////////////////////////////
#include "directx.h"
#include "geometry.h"
//#include "DDView.h"
#include "ddimage.h"
#include "heightmap.h"
#include "pcxhandler.h"
#include "keyhandler.h"
//#include "InfoDialog.h"
#define SCREEN_XRES 640
#define SCREEN_YRES 480
#define SCREEN_BPP 16
enum {
DM3D_NODRAG,
DM3D_DRAGOBJECT,
};
class CBTEditView : public CScrollView
{
protected: // create from serialization only
int m_CurrentObjectID;
SLONG m_Selected;
BOOL m_HeightsChanged;
float m_CurrentHeight;
DWORD m_SelVerticies;
// CInfoDialog *m_InfoDialog;
CBTEditView();
DECLARE_DYNCREATE(CBTEditView)
// Attributes
public:
CBTEditDoc* GetDocument();
void SyncPosition(void);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBTEditView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CBTEditView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
void InitialiseData(void);
void DeleteData(void);
void UpdateView(CBTEditDoc* pDoc);
BOOL ApplyToolOnce(CPoint point);
void ApplyRandomness(int Selected);
void ApplyTool(CPoint point,int XVel,int YVel,BOOL JustPressed = FALSE);
void PositionSelectedObjects(CPoint point,int XVel,int YVel);
void RotateSelectedObjects(CPoint point,int XVel,int YVel);
void SelectObject(CPoint &point);
void DeSelectObject(CPoint &point);
void GetObjectHeight(CPoint &point);
// CObjectDB* GetObjectVertex(CPoint &point,DWORD *Instance,D3DVECTOR *Vector);
void EditStats(void);
BOOL m_HasChanged;
BOOL m_Active;
BOOL m_Redraw;
BOOL m_ViewIsInitialised;
// CDirectDraw* m_DirectDrawView;
// CGeometry* m_DirectMaths;
// CHeightMap* m_HeightMap;
// D3DVECTOR m_CameraPosition;
// D3DVECTOR m_CameraRotation;
PCXHandler *m_PCXBitmap;
PCXHandler *m_PCXTexBitmap;
// LPDIRECTDRAWSURFACE m_TextureSurface;
// LPDIRECTDRAWSURFACE m_SpriteSurface;
// LPDIRECTDRAWSURFACE m_TextSurface;
// DDImage* m_SpriteImage;
// DDImage* m_TextImage;
DWORD m_MouseX;
DWORD m_MouseY;
DWORD m_DragMode;
CKeyHandler *m_KeyHandler;
// Generated message map functions
protected:
//{{AFX_MSG(CBTEditView)
afx_msg void OnDestroy();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void On3dpopupProperties();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
extern CBTEditView *BTEditView;
#ifndef _DEBUG // debug version in BTEditView.cpp
inline CBTEditDoc* CBTEditView::GetDocument()
{ return (CBTEditDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,210 @@
#include "windows.h"
#include "windowsx.h"
#include "stdio.h"
#include "typedefs.h"
#include "debugprint.h"
#include "chnkio.h"
BOOL CChnkIO::StartChunk(FILE *Stream,char *Name)
{
char Tmp[256];
if(Name) {
// DebugPrint("%s\n",Name);
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,Name));
}
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,"{"));
return TRUE;
}
BOOL CChnkIO::EndChunk(FILE *Stream)
{
char Tmp[256];
// DebugPrint("EndChunk\n");
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,"}"));
return TRUE;
}
BOOL CChnkIO::ReadLong(FILE *Stream,char *Name,LONG *Long)
{
char Tmp[256];
if(Name) {
// DebugPrint("%s\n",Name);
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,Name));
}
CHECKONE(fscanf(Stream,"%ld",Long));
return TRUE;
}
BOOL CChnkIO::ReadFloat(FILE *Stream,char *Name,float *Float)
{
char Tmp[256];
if(Name) {
// DebugPrint("%s\n",Name);
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,Name));
}
CHECKONE(fscanf(Stream,"%f",Float));
return TRUE;
}
BOOL CChnkIO::ReadString(FILE *Stream,char *Name,char *String)
{
char Tmp[256];
if(Name) {
// DebugPrint("%s\n",Name);
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,Name));
}
CHECKONE(fscanf(Stream,"%s",String));
return TRUE;
}
BOOL CChnkIO::ReadQuotedString(FILE *Stream,char *Name,char *String)
{
char Tmp[256];
if(Name) {
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,Name));
}
char c;
BOOL IsQuoted = TRUE;
do {
c = fgetc(Stream);
if( (c!=' ') && (c!='\t') && (c!='"') && (c!=10) && (c!=13) ) {
IsQuoted = FALSE;
break;
}
} while(c!='"');
int i=0;
if(IsQuoted) {
do {
c = fgetc(Stream);
if(c!='"') {
String[i] = c;
// Need to max length check here
i++;
}
} while(c!='"');
String[i] = 0;
} else {
String[i] = c;
i++;
do {
c = fgetc(Stream);
if((c!=' ') && (c!='\t') && (c!=10) && (c!=13)) {
String[i] = c;
// Need to max length check here
i++;
}
} while((c!=' ') && (c!='\t') && (c!=10) && (c!=13));
String[i] = 0;
}
// char c;
//
// do {
// c = fgetc(Stream);
// } while(c!='"');
//
// int i=0;
// do {
// c = fgetc(Stream);
// if(c!='"') {
// String[i] = c;
//// Need to max length check here
// i++;
// }
// } while(c!='"');
// String[i] = 0;
return TRUE;
}
BOOL CChnkIO::ReadStringAlloc(FILE *Stream,char *Name,char **String)
{
char Tmp[256];
if(Name) {
// DebugPrint("%s\n",Name);
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,Name));
}
CHECKONE(fscanf(Stream,"%s",Tmp));
*String = new char[strlen(Tmp)+1];
strcpy(*String,Tmp);
return TRUE;
}
BOOL CChnkIO::ReadQuotedStringAlloc(FILE *Stream,char *Name,char **String)
{
char Tmp[256];
if(Name) {
CHECKONE(fscanf(Stream,"%s",Tmp));
CHECKZERO(strcmp(Tmp,Name));
}
char c;
BOOL IsQuoted = TRUE;
do {
c = fgetc(Stream);
if( (c!=' ') && (c!='\t') && (c!='"') ) {
IsQuoted = FALSE;
break;
}
} while(c!='"');
int i=0;
if(IsQuoted) {
do {
c = fgetc(Stream);
if(c!='"') {
Tmp[i] = c;
// Need to max length check here
i++;
}
} while(c!='"');
Tmp[i] = 0;
} else {
Tmp[i] = c;
i++;
do {
c = fgetc(Stream);
if((c!=' ') && (c!='\t') && (c!=10) && (c!=13)) {
Tmp[i] = c;
// Need to max length check here
i++;
}
} while((c!=' ') && (c!='\t') && (c!=10) && (c!=13));
Tmp[i] = 0;
}
*String = new char[strlen(Tmp)+1];
strcpy(*String,Tmp);
return TRUE;
}

View File

@ -0,0 +1,23 @@
#ifndef __CHNKIO_INCLUDED__
#define __CHNKIO_INCLUDED__
#define CHECKTRUE(func) if((func)==FALSE) { DebugPrint("Check Failed %s %d\n",__FILE__,__LINE__); return FALSE; }
#define CHECKZERO(func) if((func)!=0) { DebugPrint("Check Failed %s %d\n",__FILE__,__LINE__); return FALSE; }
#define CHECKONE(func) if((func)!=1) { DebugPrint("Check Failed %s %d\n",__FILE__,__LINE__); return FALSE; }
#define CHECKNOTZERO(func) if((func)==0) { DebugPrint("Check Failed %s %d\n",__FILE__,__LINE__); return FALSE; }
class CChnkIO {
public:
void SceneDebugPrint(const TCHAR *format, ...);
BOOL StartChunk(FILE *Stream,char *Name);
BOOL EndChunk(FILE *Stream);
BOOL ReadLong(FILE *Stream,char *Name,LONG *Long);
BOOL ReadFloat(FILE *Stream,char *Name,float *Float);
BOOL ReadString(FILE *Stream,char *Name,char *String);
BOOL ReadQuotedString(FILE *Stream,char *Name,char *String);
BOOL ReadStringAlloc(FILE *Stream,char *Name,char **String);
BOOL ReadQuotedStringAlloc(FILE *Stream,char *Name,char **String);
};
#endif

View File

@ -0,0 +1,3 @@
#include "directx.h"
#include "geometry.h"
#include "debugprint.h"

View File

@ -0,0 +1,721 @@
//#include "stdafx.h"
#include "windows.h"
#include "windowsx.h"
#include "stdio.h"
#include "typedefs.h"
#include "debugprint.h"
#include "directx.h"
#include "macros.h"
#include "ddimage.h"
DDImage::DDImage(DWORD SourceX,DWORD SourceY,DWORD Width,DWORD Height,
CDirectDraw *DirectDrawView,IDDSURFACE *Surface)
{
m_DirectDrawView=DirectDrawView;
m_Surface=Surface;
m_SourceX=SourceX;
m_SourceY=SourceY;
m_Width=Width;
m_Height=Height;
}
// Blit image from DirectDraw surface to DirectDraw display surface.
//
BOOL DDImage::DDBlitImage(IDDSURFACE *DestSurface,SLONG x,SLONG y,DWORD Flags)
{
HRESULT ddrval;
DDBLTFX ddbltfx;
RECT src;
RECT dst;
SLONG XRes,YRes;
memset( &ddbltfx, 0, sizeof( ddbltfx ) );
ddbltfx.dwSize = sizeof( ddbltfx );
m_Surface->GetColorKey(DDCKEY_SRCBLT,&ddbltfx.ddckSrcColorkey);
setRectWH(&src,m_SourceX,m_SourceY,m_Width,m_Height);
setRectWH(&dst,x,y,m_Width,m_Height);
m_DirectDrawView->GetRes((DWORD*)&XRes,(DWORD*)&YRes);
if(x < 0) {
src.left-=x;
dst.left=0;
}
if(x+m_Width > XRes) {
src.right-=dst.right-XRes;
dst.right=XRes;
}
if(src.right<=src.left) {
return TRUE;
}
if(y < 0) {
src.top-=y;
dst.top=0;
}
if(y+m_Height > YRes) {
src.bottom-=dst.bottom-YRes;
dst.bottom=YRes;
}
if(src.bottom<=src.top) {
return TRUE;
}
do {
ddrval = DestSurface->Blt(&dst, m_Surface, &src, Flags | DDBLT_ASYNC, &ddbltfx);
if(ddrval==DDERR_WASSTILLDRAWING) {
ddrval = DestSurface->Blt(&dst, m_Surface, &src, Flags | DDBLT_WAIT, &ddbltfx);
}
if( ddrval == DDERR_SURFACELOST ) {
m_DirectDrawView->RestoreSurfaces();
DXCALL(ddrval=m_Surface->Restore());
} else {
DisplayError(ddrval,__FILE__,__LINE__,0);
return FALSE;
}
} while(ddrval==DDERR_SURFACELOST);
return TRUE;
}
// Blit image from DirectDraw surface to Windows DIB section.
//
void DDImage::DDBlitImageDIB(CDIBDraw *DIBDraw,SLONG XPos,SLONG YPos,DWORD Flags)
{
// Flags = 0;
// Flags |= SF_TEXTUREFLIPX;
// Flags |= SF_TEXTUREFLIPY;
// Flags |= SF_ROT90;
#if(1)
DDBlitFRImageDIB(DIBDraw,XPos,YPos,Flags);
#else
if((Flags&SF_TEXTUREFLIPX) && (Flags&SF_TEXTUREFLIPY)) {
DDBlitImageDIBFlipXY(DIBDraw,XPos,YPos);
return;
}
if(Flags&SF_TEXTUREFLIPX) {
DDBlitImageDIBFlipX(DIBDraw,XPos,YPos);
return;
}
if(Flags&SF_TEXTUREFLIPY) {
DDBlitImageDIBFlipY(DIBDraw,XPos,YPos);
return;
}
if(Flags&SF_TEXTUREROTMASK) {
switch(Flags&SF_TEXTUREROTMASK) {
case SF_ROT90:
DDBlitImageDIBRot90(DIBDraw,XPos,YPos);
break;
case SF_ROT180:
break;
case SF_ROT270:
break;
}
return;
}
RECT src;
RECT dst;
setRectWH(&src,m_SourceX,m_SourceY,m_Width,m_Height);
setRectWH(&dst,x,y,m_Width,m_Height);
if(ClipRect(DIBDraw,XPos,YPos,src,dst) & CLIP_GONE) {
return;
}
HDC hdc=m_DirectDrawView->DDGetSurfaceDC(m_Surface);
BitBlt(DIBDraw->GetDIBDC(), dst.left,
dst.top,
dst.right-dst.left,
dst.bottom-dst.top,
hdc , src.left, src.top, SRCCOPY);
m_DirectDrawView->DDReleaseSurfaceDC(m_Surface,hdc);
#endif
}
UWORD DDImage::GetRepColour(void)
{
UWORD Data;
// Lock the source surface.
SURFACEDESC ddsd;
HRESULT ddrval;
ddsd.dwSize = sizeof(ddsd);
while ((ddrval = m_Surface->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING);
if(ddrval != DD_OK) {
DisplayError(ddrval,__FILE__,__LINE__,0);
}
Data = *( ((UWORD*)((UBYTE*)ddsd.lpSurface+ddsd.lPitch * m_SourceY)) + m_SourceX);
m_Surface->Unlock(NULL);
return Data;
}
// Blit an image from a direct draw surface to a windows DIB section.
// Allows cumulative xy flipping and 90 degree rotations.
// Base on John's code for drawing 2d tiles.
// Dos'nt do clipping, if an image overlaps the DIB's edge then it is thrown out.
//
void DDImage::DDBlitFRImageDIB(CDIBDraw *DIBDraw,int XPos,int YPos,DWORD Flags)
{
int XRes = DIBDraw->GetDIBWidth();
int YRes = DIBDraw->GetDIBHeight();
if(XPos < 0) {
return;
}
if(XPos + m_Width > XRes) {
return;
}
if(YPos < 0) {
return;
}
if(YPos + m_Height > YRes) {
return;
}
RECT psDestRect;
RECT psSrcRect;
psDestRect.left = XPos;
psDestRect.top = YPos;
psDestRect.right = XPos + m_Width;
psDestRect.bottom = YPos + m_Height;
psSrcRect.left = m_SourceX;
psSrcRect.top = m_SourceY;
psSrcRect.right = m_SourceX + m_Width;
psSrcRect.bottom = m_SourceY + m_Height;
POINT sP1,sP2,sP3,sP4;
POINT *psP1,*psP2,*psP3,*psP4,*psPTemp;
UWORD *p16Src, *p16Dest;
int x,y, xDir,yDir, srcInc,destInc;
int SourcePitch,DestPitch;
/* Store the source rect as four points */
sP1.x = psSrcRect.left;
sP1.y = psSrcRect.top;
sP2.x = psSrcRect.right;
sP2.y = psSrcRect.top;
sP3.x = psSrcRect.right;
sP3.y = psSrcRect.bottom;
sP4.x = psSrcRect.left;
sP4.y = psSrcRect.bottom;
/* Store pointers to the points */
psP1 = &sP1;
psP2 = &sP2;
psP3 = &sP3;
psP4 = &sP4;
/* Now flip and rotate the source rectangle using the point pointers */
if (Flags & SF_TEXTUREFLIPX)
{
psPTemp = psP1;
psP1 = psP2;
psP2 = psPTemp;
psPTemp = psP3;
psP3 = psP4;
psP4 = psPTemp;
}
if (Flags & SF_TEXTUREFLIPY)
{
psPTemp = psP1;
psP1 = psP4;
psP4 = psPTemp;
psPTemp = psP2;
psP2 = psP3;
psP3 = psPTemp;
}
switch (Flags & SF_TEXTUREROTMASK) {
case SF_TEXTUREROT90:
psPTemp = psP1;
psP1 = psP4;
psP4 = psP3;
psP3 = psP2;
psP2 = psPTemp;
break;
case SF_TEXTUREROT180:
psPTemp = psP1;
psP1 = psP3;
psP3 = psPTemp;
psPTemp = psP4;
psP4 = psP2;
psP2 = psPTemp;
break;
case SF_TEXTUREROT270:
psPTemp = psP1;
psP1 = psP2;
psP2 = psP3;
psP3 = psP4;
psP4 = psPTemp;
break;
}
// Lock the source surface.
SURFACEDESC ddsd;
HRESULT ddrval;
ddsd.dwSize = sizeof(ddsd);
while ((ddrval = m_Surface->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING);
if(ddrval != DD_OK) {
DisplayError(ddrval,__FILE__,__LINE__,0);
}
SourcePitch = ddsd.lPitch/2;
DestPitch = DIBDraw->GetDIBWidth();
/* See if P1 -> P2 is horizontal or vertical */
if (psP1->y == psP2->y)
{
/* P1 -> P2 is horizontal */
xDir = (psP1->x > psP2->x) ? -1 : 1;
yDir = (psP1->y > psP4->y) ? -1 : 1;
p16Dest = (UWORD*)DIBDraw->GetDIBBits();
p16Dest += psDestRect.left + (psDestRect.top*DestPitch);
destInc = DestPitch - (psDestRect.right - psDestRect.left);
p16Src = (UWORD*)ddsd.lpSurface;
p16Src += SourcePitch*psP1->y + psP1->x;
if (psP1->y < psP4->y)
{
srcInc = SourcePitch - (psP2->x - psP1->x);
}
else
{
srcInc = -SourcePitch - (psP2->x - psP1->x);
}
/* Have to adjust start point if xDir or yDir are negative */
if (xDir < 0)
{
p16Src--;
}
if (yDir < 0)
{
p16Src = p16Src - SourcePitch;
}
for(y = psP1->y; y != psP4->y; y += yDir)
{
for(x = psP1->x; x != psP2->x; x += xDir)
{
*p16Dest++ = *p16Src;
p16Src += xDir;
}
p16Dest = p16Dest + destInc;
p16Src = p16Src + srcInc;
}
}
else
{
/* P1 -> P2 is vertical */
xDir = (psP1->x > psP4->x) ? -1 : 1;
yDir = (psP1->y > psP2->y) ? -1 : 1;
p16Dest = (UWORD*)DIBDraw->GetDIBBits();
p16Dest += psDestRect.left + (psDestRect.top*DestPitch);
destInc = DestPitch - (psDestRect.right - psDestRect.left);
for(x = psP1->x; x != psP4->x; x += xDir)
{
p16Src = (UWORD*)ddsd.lpSurface;
p16Src += SourcePitch*psP1->y + x;
if (xDir < 0)
{
p16Src --;
}
if (yDir < 0)
{
p16Src = p16Src - SourcePitch;
}
for(y = psP1->y; y != psP2->y; y += yDir)
{
*p16Dest++ = *p16Src;
p16Src = p16Src + SourcePitch*yDir;
}
p16Dest = p16Dest + destInc;
}
}
m_Surface->Unlock(NULL);
}
/*
void DDImage::DDBlitFRImageDIB(CDIBDraw *DIBDraw,int x,int y,DWORD Flags)
{
POINT p0,p1,p2,p3; // Source rectangle.
POINT Tmp;
p0.x = m_SourceX; p0.y = m_SourceY;
p1.x = m_SourceX+m_Width; p1.y = m_SourceY;
p2.x = m_SourceX+m_Width; p2.y = m_SourceY+m_Height;
p3.x = m_SourceX; p3.y = m_SourceY+m_Height;
// If x flipped then swap p0,p1 and p2,p3
float Tmp;
if(Tile->Flags & SF_TEXTUREFLIPX) {
Tmp = p0;
p0 = p1;
p1 = Tmp;
Tmp = p2;
p2 = p3;
p3 = Tmp;
}
// If x flipped then swap p0,p3 and p1,p2
if(Tile->Flags & SF_TEXTUREFLIPY) {
Tmp = p0;
p0 = p3;
p3 = Tmp;
Tmp = p1;
p1 = p2;
p2 = Tmp;
}
// Now handle any rotation.
switch(Tile->Flags & SF_TEXTUREROTMASK) {
case SF_TEXTUREROT90:
Tmp = p0;
p0 = p3;
p3 = p2;
p2 = p1;
p1 = Tmp;
break;
case SF_TEXTUREROT180:
Tmp = p0;
p0 = p2;
p2 = Tmp;
Tmp = p1;
p1 = p3;
p3 = Tmp;
break;
case SF_TEXTUREROT270:
Tmp = p0;
p0 = p1;
p1 = p2;
p2 = p3;
p3 = Tmp;
break;
}
}
*/
void DDImage::DDBlitImageDIBFlipX(CDIBDraw *DIBDraw,SLONG x,SLONG y)
{
RECT src;
RECT dst;
DWORD ClipFlags;
setRectWH(&src,m_SourceX,m_SourceY,m_Width,m_Height);
setRectWH(&dst,x,y,m_Width,m_Height);
RECT pcSrc = src; // Pre-clipped source rectangle.
if( (ClipFlags = ClipRect(DIBDraw,x,y,src,dst)) & CLIP_GONE) {
return;
}
// Since were X flipped we need to adjust the clipped source rect.
if(ClipFlags & CLIP_LEFT) {
src.left = pcSrc.left;
}
if(ClipFlags & CLIP_RIGHT) {
src.left += m_Width-(src.right-pcSrc.left);
}
int Width = dst.right-dst.left;
int Height = dst.bottom-dst.top;
SURFACEDESC ddsd;
HRESULT ddrval;
ddsd.dwSize = sizeof(ddsd);
while ((ddrval = m_Surface->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING);
if(ddrval != DD_OK) {
DisplayError(ddrval,__FILE__,__LINE__,0);
}
m_Surface->Unlock(NULL);
ULONG SourcePitch = ddsd.lPitch/2;
ULONG DestPitch = DIBDraw->GetDIBWidth();
UWORD *Dest = (UWORD*)DIBDraw->GetDIBBits();
Dest += dst.left + (dst.top*DestPitch) + (Width-1);
UWORD *Source = (UWORD*)ddsd.lpSurface;
Source += src.left + (src.top*SourcePitch);
for(int iy=0; iy<Height; iy++) {
for(int ix=0; ix<Width; ix++){
*(Dest-ix) = *(Source+ix);
}
Source += SourcePitch;
Dest += DestPitch;
}
}
void DDImage::DDBlitImageDIBFlipY(CDIBDraw *DIBDraw,SLONG x,SLONG y)
{
RECT src;
RECT dst;
DWORD ClipFlags;
setRectWH(&src,m_SourceX,m_SourceY,m_Width,m_Height);
setRectWH(&dst,x,y,m_Width,m_Height);
RECT pcSrc = src; // Pre-clipped source rectangle.
if( (ClipFlags = ClipRect(DIBDraw,x,y,src,dst)) & CLIP_GONE) {
return;
}
// Since were Y flipped we need to adjust the clipped source rect.
if(ClipFlags & CLIP_TOP) {
src.top = pcSrc.top;
}
if(ClipFlags & CLIP_BOTTOM) {
src.top += m_Height-(src.bottom-pcSrc.top);
}
int Width = dst.right-dst.left;
int Height = dst.bottom-dst.top;
SURFACEDESC ddsd;
HRESULT ddrval;
ddsd.dwSize = sizeof(ddsd);
while ((ddrval = m_Surface->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING);
if(ddrval != DD_OK) {
DisplayError(ddrval,__FILE__,__LINE__,0);
}
m_Surface->Unlock(NULL);
ULONG SourcePitch = ddsd.lPitch/2;
ULONG DestPitch = DIBDraw->GetDIBWidth();
UWORD *Dest = (UWORD*)DIBDraw->GetDIBBits();
Dest += dst.left + ((dst.top + (Height-1))*DestPitch);
UWORD *Source = (UWORD*)ddsd.lpSurface;
Source += src.left + (src.top*SourcePitch);
for(int iy=0; iy<Height; iy++) {
for(int ix=0; ix<Width; ix++){
*(Dest+ix) = *(Source+ix);
}
Source += SourcePitch;
Dest -= DestPitch;
}
}
void DDImage::DDBlitImageDIBFlipXY(CDIBDraw *DIBDraw,SLONG x,SLONG y)
{
RECT src;
RECT dst;
DWORD ClipFlags;
setRectWH(&src,m_SourceX,m_SourceY,m_Width,m_Height);
setRectWH(&dst,x,y,m_Width,m_Height);
RECT pcSrc = src; // Pre-clipped source rectangle.
if( (ClipFlags = ClipRect(DIBDraw,x,y,src,dst)) & CLIP_GONE) {
return;
}
// Since were X flipped we need to adjust the clipped source rect.
if(ClipFlags & CLIP_LEFT) {
src.left = pcSrc.left;
}
if(ClipFlags & CLIP_RIGHT) {
src.left += m_Width-(src.right-pcSrc.left);
}
// Since were Y flipped we need to adjust the clipped source rect.
if(ClipFlags & CLIP_TOP) {
src.top = pcSrc.top;
}
if(ClipFlags & CLIP_BOTTOM) {
src.top += m_Height-(src.bottom-pcSrc.top);
}
int Width = dst.right-dst.left;
int Height = dst.bottom-dst.top;
SURFACEDESC ddsd;
HRESULT ddrval;
ddsd.dwSize = sizeof(ddsd);
while ((ddrval = m_Surface->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING);
if(ddrval != DD_OK) {
DisplayError(ddrval,__FILE__,__LINE__,0);
}
m_Surface->Unlock(NULL);
ULONG SourcePitch = ddsd.lPitch/2;
ULONG DestPitch = DIBDraw->GetDIBWidth();
UWORD *Dest = (UWORD*)DIBDraw->GetDIBBits();
Dest += dst.left + ((dst.top + (Height-1))*DestPitch) + (Width-1);
UWORD *Source = (UWORD*)ddsd.lpSurface;
Source += src.left + (src.top*SourcePitch);
for(int iy=0; iy<Height; iy++) {
for(int ix=0; ix<Width; ix++){
*(Dest-ix) = *(Source+ix);
}
Source += SourcePitch;
Dest -= DestPitch;
}
}
void DDImage::DDBlitImageDIBRot90(CDIBDraw *DIBDraw,SLONG x,SLONG y)
{
RECT src;
RECT dst;
DWORD ClipFlags;
// Can only rotate square images.
ASSERT(m_Width == m_Height);
setRectWH(&src,m_SourceX,m_SourceY,m_Width,m_Height);
setRectWH(&dst,x,y,m_Width,m_Height);
RECT pcSrc = src; // Pre-clipped source rectangle.
if( (ClipFlags = ClipRect(DIBDraw,x,y,src,dst)) & CLIP_GONE) {
return;
}
int Width = dst.right-dst.left;
int Height = dst.bottom-dst.top;
// if(Width!=Height) return;
if(Width > Height) return;
SURFACEDESC ddsd;
HRESULT ddrval;
ddsd.dwSize = sizeof(ddsd);
while ((ddrval = m_Surface->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING);
if(ddrval != DD_OK) {
DisplayError(ddrval,__FILE__,__LINE__,0);
}
m_Surface->Unlock(NULL);
ULONG SourcePitch = ddsd.lPitch/2;
ULONG DestPitch = DIBDraw->GetDIBWidth();
UWORD *Dest = (UWORD*)DIBDraw->GetDIBBits();
Dest += dst.left + (dst.top*DestPitch) + (Width-1);
UWORD *Source = (UWORD*)ddsd.lpSurface;
Source += src.left + (src.top*SourcePitch);
for(int iy=0; iy<Height; iy++) {
for(int ix=0; ix<Width; ix++) {
*(Dest+ix*DestPitch) = *(Source+ix);
}
Source += SourcePitch;
Dest--;
}
}
DWORD DDImage::ClipRect(CDIBDraw *DIBDraw,SLONG x,SLONG y,RECT &src,RECT &dst)
{
SLONG XRes = DIBDraw->GetDIBWidth();
SLONG YRes = DIBDraw->GetDIBHeight();
DWORD ClipFlags = 0;
if(x < 0) {
src.left-=x;
dst.left=0;
ClipFlags |= CLIP_LEFT;
}
if(x+m_Width > XRes) {
src.right-=dst.right-XRes;
dst.right=XRes;
ClipFlags |= CLIP_RIGHT;
}
if(src.right<=src.left) {
ClipFlags |= CLIP_GONE;
return ClipFlags;
}
if(y < 0) {
src.top-=y;
dst.top=0;
ClipFlags |= CLIP_TOP;
}
if(y+m_Height > YRes) {
src.bottom-=dst.bottom-YRes;
dst.bottom=YRes;
ClipFlags |= CLIP_BOTTOM;
}
if(src.bottom<=src.top) {
ClipFlags |= CLIP_GONE;
return ClipFlags;
}
return ClipFlags;
}
DDSprite::DDSprite(SWORD CenterX,SWORD CenterY,
DWORD SourceX,DWORD SourceY,
DWORD Width,DWORD Height,
CDirectDraw *DirectDrawView,IDDSURFACE *Surface):DDImage(SourceX,SourceY,
Width,Height,
DirectDrawView,Surface)
{
m_CenterX=CenterX;
m_CenterY=CenterY;
}
void DDSprite::DDBlitSprite(IDDSURFACE *DestSurface,SLONG x,SLONG y,DWORD Flags)
{
DDBlitImage(DestSurface,x-m_CenterX,y-m_CenterY,Flags);
}

View File

@ -0,0 +1,89 @@
#ifndef __DDIMAGE_INCLUDED__
#define __DDIMAGE_INCLUDED__
#include "dibdraw.h"
#define BLT_NORMAL 0
#define BLT_USEKEY DDBLT_KEYSRCOVERRIDE
/*
Sprite transformation flags.
bbbbbbbb
76543210
..rryxfh
rr Texture rotation 0=0, 1=90, 2=180, 3=270.
y Y texture flip.
x X texture flip.
f Diagonal flip.
h Hide.
*/
#define SF_HIDE 1
#define SF_VERTEXFLIP 2
#define SF_TEXTUREFLIPX 4
#define SF_TEXTUREFLIPY 8
#define SF_TEXTUREROTMASK 0x30
#define SF_TEXTUREROTSHIFT 4
#define SF_TEXTUREROT90 (1<<SF_TEXTUREROTSHIFT)
#define SF_TEXTUREROT180 (2<<SF_TEXTUREROTSHIFT)
#define SF_TEXTUREROT270 (3<<SF_TEXTUREROTSHIFT)
#define SF_ROT90 (1<<SF_TEXTUREROTSHIFT)
#define SF_ROT180 (2<<SF_TEXTUREROTSHIFT)
#define SF_ROT270 (3<<SF_TEXTUREROTSHIFT)
#define SF_RANDTEXTUREFLIPX 128
#define SF_RANDTEXTUREFLIPY 256
#define SF_RANDTEXTUREROTATE 512
#define SF_INCTEXTUREROTATE 1024
#define SF_TOGTEXTUREFLIPX 2048
#define SF_TOGTEXTUREFLIPY 4096
// Clipping result flags.
#define CLIP_LEFT 1
#define CLIP_RIGHT 2
#define CLIP_TOP 4
#define CLIP_BOTTOM 8
#define CLIP_GONE 16
class DDImage {
public:
DDImage(DWORD SourceX,DWORD SourceY,DWORD Width,DWORD Height,
CDirectDraw *DirectDrawView,IDDSURFACE *Surface);
BOOL DDBlitImage(IDDSURFACE *DestSurface,SLONG x,SLONG y,DWORD Flags=BLT_NORMAL);
void DDBlitFRImageDIB(CDIBDraw *DIBDraw,int x,int y,DWORD Flags);
void DDBlitImageDIB(CDIBDraw *DIBDraw,SLONG x,SLONG y,DWORD Flags=0);
void DDBlitImageDIBFlipX(CDIBDraw *DIBDraw,SLONG x,SLONG y);
void DDBlitImageDIBFlipY(CDIBDraw *DIBDraw,SLONG x,SLONG y);
void DDBlitImageDIBFlipXY(CDIBDraw *DIBDraw,SLONG x,SLONG y);
void DDBlitImageDIBRot90(CDIBDraw *DIBDraw,SLONG x,SLONG y);
DWORD ClipRect(CDIBDraw *DIBDraw,SLONG x,SLONG y,RECT &src,RECT &dst);
IDDSURFACE *DDGetImageSurface(void) { return(m_Surface); }
UWORD GetRepColour(void);
protected:
CDirectDraw* m_DirectDrawView;
IDDSURFACE *m_Surface;
DWORD m_SourceX;
DWORD m_SourceY;
int m_Width;
int m_Height;
};
class DDSprite : public DDImage {
public:
DDSprite(SWORD CenterX,SWORD CenterY,
DWORD SourceX,DWORD SourceY,
DWORD Width,DWORD Height,
CDirectDraw *DirectDrawView,IDDSURFACE *Surface);
void DDBlitSprite(IDDSURFACE *DestSurface,SLONG x,SLONG y,DWORD Flags=BLT_NORMAL);
protected:
SWORD m_CenterX;
SWORD m_CenterY;
};
#endif

374
tools/editworld/src/debug.c Normal file
View File

@ -0,0 +1,374 @@
/*
* Debug.c
*
* Various debugging output functions.
*
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#ifdef PSX
#include <libsn.h>
#endif
#pragma warning (disable : 4201 4214 4115 4514)
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include <windows.h>
#pragma warning (default : 4201 4214 4115)
//#include "frame.h"
//#include "frameint.h"
#ifdef PSX
char DBGstring[256];
#endif
#define DEBUG_STR_MAX 1000 // Maximum length of a debugging output string
static FILE *pDebugFile = NULL;
static BOOL StringOut = TRUE;
// message and assert callbacks
static DB_MBCALLBACK mbCallback = NULL;
static DB_MBCALLBACK errorCallback = NULL;
static DB_MBCALLBACK assertCallback = NULL;
// Set the message box callback
void dbg_SetMessageBoxCallback(DB_MBCALLBACK callback)
{
mbCallback = callback;
}
// set the error box callback
void dbg_SetErrorBoxCallback(DB_MBCALLBACK callback)
{
errorCallback = callback;
}
// Set the assert box callback
void dbg_SetAssertCallback(DB_MBCALLBACK callback)
{
assertCallback = callback;
}
/*
* dbg_printf
*
* Replacement for printf for debugging output.
* Sends strings to OutputDebugString and/or a file.
* Output is controlled by the functions :
*
* dbg_SetOutputFile, dbg_NoOutputFile
* dbg_SetOutputString, dbg_NoOutputString
*/
void dbg_printf(SBYTE *pFormat, ...)
{
SBYTE aBuffer[DEBUG_STR_MAX]; // Output string buffer
va_list pArgs; // Format arguments
/* Initialise the argument list */
va_start(pArgs, pFormat);
/* Print out the string */
(void)vsprintf(aBuffer, pFormat, pArgs);
/* Output it */
if (StringOut)
{
OutputDebugString(aBuffer);
}
/* If there is a debugging file open, send text to that too */
if (pDebugFile)
{
fprintf(pDebugFile, "%s", aBuffer);
fflush(pDebugFile);
}
}
/*
* dbg_SetOutputFile
*
* Send debugging output to a file
*/
void dbg_SetOutputFile(SBYTE *pFilename)
{
ASSERT((pFilename != NULL, "dbg_SetOutputFile passed NULL filename"));
if (pDebugFile)
{
fclose(pDebugFile);
}
pDebugFile = fopen(pFilename, "w");
if (!pDebugFile)
{
dbg_MessageBox("Couldn't open debugging output file: %s", pFilename);
}
}
/*
* dbg_NoOutputFile
*
* Turn off debugging to a file
*/
void dbg_NoOutputFile(void)
{
if (pDebugFile)
{
fclose(pDebugFile);
}
}
/*
* dbg_SetOutputString
*
* Send debugging to OutputDebugString
*/
void dbg_SetOutputString(void)
{
StringOut = TRUE;
}
/*
* dbg_NoOutputString
*
* Turn off debugging to OutputDebugString
*/
void dbg_NoOutputString(void)
{
StringOut = FALSE;
}
/*
* dbg_MessageBox
*
* Display a message box, arguments as printf
*/
void dbg_MessageBox(SBYTE *pFormat, ...)
{
SBYTE aBuffer[DEBUG_STR_MAX]; // Output string buffer
va_list pArgs; // Format arguments
DB_MBRETVAL retVal;
/* Initialise the argument list */
va_start(pArgs, pFormat);
/* Print out the string */
(void)vsprintf(aBuffer, pFormat, pArgs);
/* Ensure the box can be seen */
screenFlipToGDI();
/* Output it */
dbg_printf("MB: %s\n", aBuffer);
retVal = DBR_USE_WINDOWS_MB;
if (mbCallback)
{
retVal = mbCallback(aBuffer);
}
if (retVal == DBR_USE_WINDOWS_MB)
{
(void)MessageBox(frameGetWinHandle(), aBuffer, "Debugging Message", MB_OK);
}
}
/*
*
* dbg_ErrorPosition
*
* Set the position for an error message.
*/
#define ERROR_DEFAULT_FILE "No valid Error file name"
static SBYTE aErrorFile[DEBUG_STR_MAX]=ERROR_DEFAULT_FILE;
static UDWORD ErrorLine;
void dbg_ErrorPosition(SBYTE *pFile, UDWORD Line)
{
if (pFile == NULL)
{
/* Ensure the box can be seen */
screenFlipToGDI();
(void)MessageBox(frameGetWinHandle(), "Invalid error arguments\n", "Error",
MB_OK | MB_ICONWARNING);
strcpy(aErrorFile, ERROR_DEFAULT_FILE);
ErrorLine = 0;
return;
}
if (strlen(pFile) >= DEBUG_STR_MAX)
{
memcpy(aErrorFile, pFile, DEBUG_STR_MAX);
aErrorFile[DEBUG_STR_MAX-1] = '\0';
ErrorLine = Line;
}
else
{
strcpy(aErrorFile, pFile);
ErrorLine = Line;
}
}
/*
* dbg_ErrorBox
*
* Display an error message in a dialog box, arguments as printf
*/
void dbg_ErrorBox(SBYTE *pFormat, ...)
{
SBYTE aBuffer[DEBUG_STR_MAX] = ""; // Output string buffer
va_list pArgs; // Format arguments
DB_MBRETVAL retVal;
/* Initialise the argument list */
va_start(pArgs, pFormat);
/* See if there is a Filename to display */
if (strcmp(aErrorFile, ERROR_DEFAULT_FILE) != 0)
{
sprintf(aBuffer, "File: %s\nLine: %d\n\n", aErrorFile, ErrorLine);
}
/* Print out the string */
(void)vsprintf(aBuffer + strlen(aBuffer), pFormat, pArgs);
/* Ensure the box can be seen */
screenFlipToGDI();
/* Output it */
dbg_printf("ErrorBox: %s\n", aBuffer);
retVal = DBR_USE_WINDOWS_MB;
if (errorCallback)
{
retVal = errorCallback(aBuffer);
}
if (retVal == DBR_USE_WINDOWS_MB)
{
(void)MessageBox(frameGetWinHandle(), aBuffer, "Error", MB_OK | MB_ICONWARNING);
}
}
/*
* dbg_AssertPosition
*
* Set the file and position for an assertion.
* This should only be used directly before a call to dbg_Assert.
* (In fact there is no reason for this to be used outside the ASSERT macro)
*/
#define ASSERT_DEFAULT_FILE "No Valid Assert File Name"
//static SBYTE aAssertFile[DEBUG_STR_MAX];
static SBYTE *pAssertFile;
static UDWORD AssertLine;
void dbg_AssertPosition(SBYTE *pFile, UDWORD Line)
{
if (pFile == NULL)
{
#ifdef WIN32
/* Ensure the box can be seen */
screenFlipToGDI();
(void)MessageBox(frameGetWinHandle(), "Invalid assertion arguments\n", "Error",
MB_OK | MB_ICONWARNING);
#else
printf("Error : Invalid assertion arguments\n");
#endif
// strcpy(aAssertFile, ASSERT_DEFAULT_FILE);
pAssertFile = ASSERT_DEFAULT_FILE;
AssertLine = 0;
return;
}
/* if (strlen(pFile) >= DEBUG_STR_MAX)
{
memcpy(aAssertFile, pFile, DEBUG_STR_MAX);
aAssertFile[DEBUG_STR_MAX-1] = '\0';
AssertLine = Line;
}
else
{
strcpy(aAssertFile, pFile);
AssertLine = Line;
}*/
pAssertFile = pFile;
AssertLine = Line;
}
/*
* dbg_Assert
*
* Rewritten assert macro.
* If Expression is false it uses the Format string and va_list to
* generate a string which it displays in a message box.
*
* DebugBreak is used to jump into the debugger.
*
*/
#ifdef WIN32
void dbg_Assert(BOOL Expression, SBYTE *pFormat, ...)
{
va_list pArgs;
SBYTE aBuffer[DEBUG_STR_MAX];
int Result=0;
DB_MBRETVAL retVal;
if (!Expression)
{
va_start(pArgs, pFormat);
sprintf(aBuffer, "File: %s\nLine: %d\n\n", pAssertFile, AssertLine);
(void)vsprintf(aBuffer + strlen(aBuffer), pFormat, pArgs);
(void)strcat(aBuffer, "\n\nTERMINATE PROGRAM ?");
/* Ensure the box can be seen */
screenFlipToGDI();
dbg_printf("ASSERT: %s\n", aBuffer);
retVal = DBR_USE_WINDOWS_MB;
if (assertCallback)
{
retVal = assertCallback(aBuffer);
}
if (retVal == DBR_USE_WINDOWS_MB)
{
Result = MessageBox(frameGetWinHandle(), aBuffer, "Assertion Failure",
MB_YESNOCANCEL | MB_ICONWARNING);
}
if (retVal == DBR_YES ||
Result == IDYES)
{
// abort();
// frameShutDown();
ExitProcess(3);
}
else if (retVal == DBR_NO || Result == IDNO)
{
/* Can only do a DebugBreak in window mode -
* Do it in full screen and GDI can't get in so the machine hangs.
*/
screenSetMode(SCREEN_WINDOWED);
DebugBreak();
}
// Result could == IDCANCEL - do nothing in this case.
}
}
#else
void dbg_Assert(BOOL Expression, SBYTE *pFormat, ...)
{
if (!Expression)
{
printf("\n\nAssertion failed , File: %s\nLine: %d\n\n", pAssertFile, AssertLine);
PSYQpause();
}
}
#endif

524
tools/editworld/src/debug.h Normal file
View File

@ -0,0 +1,524 @@
/***************************************************************************************
*
* File : Debug.h
*
* John Elliot 11/96
*
* Function: Provides a large number of macros for debugging output.
*
* Comments: The basic macros : DBPRINTF, DBMB, DBMONOPRINTF, etc are turned on if
* either DEBUG is defined or a MSVC Debug build is specified. They are
* turned off by default and if NODEBUG is defined or a MSVC Release build
* is specified. Debugging can be forced to be included on a Release build
* by defining FORCEDEBUG.
*
* The conditional versions of these macros : DBP0 - DBP9, DBMB0 - DBMB9,
* DBMONOP0 - DBMONOP9, etc. are turned on by defining the appropriate
* macro from DEBUG_GROUP0 - DEBUG_GROUP9.
*
* Global Macros:
* DBPRINTF(x)
* DBOUTPUTFILE(x)
* DBNOOUTPUTFILE()
* DBSETOUTPUTSTRING()
* DBNOOUTPUTSTRING()
* DBMB(x)
* ASSERT(x)
*
* DBMONOPRINTF(x)
* DBMONOCLEAR()
* DBMONOCLEARRECT(x,y,width,height)
*
* DBP0 - DBP9
* DBMB0 - DBMB9
* DBMONOP0 - DBMONOP9
* DBMONOC0 - DBMONOC9
* DBMONOCR0 - DBMONOCR9
*
***************************************************************************************
*/
#ifndef _debug_h
#define _debug_h
//#define ALWAYS_ASSERT // Define this to always process ASSERT even on release builds.
/* Check the header files have been included from frame.h if they
* are used outside of the framework library.
*/
#include <stdio.h>
#if !defined(_frame_h) && !defined(FRAME_LIB_INCLUDE)
#error Framework header files MUST be included from Frame.h ONLY.
#endif
/* Turn on basic debugging if a MSVC debug build and NODEBUG has not been defined */
#ifdef _DEBUG
#ifndef NODEBUG
#ifndef DEBUG
#define DEBUG
#endif
#endif
#endif
/* Turn off debugging if a MSVC release build and FORCEDEBUG has not been defined.
Turn on debugging if FORCEDEBUG has been defined. */
#ifdef _NDEBUG
#ifndef FORCEDEBUG
#undef DEBUG
#else
#ifndef DEBUG
#define DEBUG
#endif
#endif
#endif
/* Allow mono debugging to be turned on and off seperately */
#undef MONODEBUG
#ifdef FORCEMONODEBUG
#define MONODEBUG
#elif !defined(NOMONODEBUG)
/* turn on mono debugging by default */
#define MONODEBUG
#endif
#include <stdarg.h>
#include "types.h"
#ifdef WIN32
/* Include the mono printing stuff */
#include "mono.h"
#endif
/****************************************************************************************
*
* Function prototypes from debug.c
*
*/
extern void dbg_printf(SBYTE *pFormat, ...);
extern void dbg_SetOutputFile(SBYTE *pFilename);
extern void dbg_NoOutputFile(void);
extern void dbg_SetOutputString(void);
extern void dbg_NoOutputString(void);
extern void dbg_MessageBox(SBYTE *pFormat, ...);
extern void dbg_ErrorPosition(SBYTE *pFile, UDWORD Line);
extern void dbg_ErrorBox(SBYTE *pFormat, ...);
extern void dbg_AssertPosition(SBYTE *pFile, UDWORD Line);
extern void dbg_Assert(BOOL Expression, SBYTE *pFormat, ...);
/*****************************************************************************************
*
* Definitions for message box callback functions
*
*/
typedef enum _db_mbretval
{
DBR_USE_WINDOWS_MB, // display the windows MB after the callback
DBR_YES, // yes button pressed
DBR_NO, // no button pressed
DBR_OK, // ok button pressed
DBR_CANCEL, // cancel button pressed
} DB_MBRETVAL;
// message box callback function
typedef DB_MBRETVAL (*DB_MBCALLBACK)(SBYTE *pBuffer);
// Set the message box callback
extern void dbg_SetMessageBoxCallback(DB_MBCALLBACK callback);
// set the error box callback
extern void dbg_SetErrorBoxCallback(DB_MBCALLBACK callback);
// Set the assert box callback
extern void dbg_SetAssertCallback(DB_MBCALLBACK callback);
/* Get PCLint to check the printf args of these functions */
/*lint -printf(1,dbg_printf,dbg_MessageBox,dbg_ErrorBox) */
/*lint -printf(2,dbg_Assert) */
#ifdef PSX
extern char DBGstring[256];
#endif
#ifdef DEBUG
/* Debugging output required */
/****************************************************************************************
*
* Basic debugging macro's
*
*/
/*
*
* DBPRINTF
*
* Output debugging strings - arguments as printf except two sets of brackets have
* to be used :
* DBPRINTF(("Example output string with a variable: %d\n", Variable));
*/
#ifdef WIN32
#define DBPRINTF(x) dbg_printf x
#else
/*#define DBPRINTF(x) \
printf("DBPRINTF @ %s,%d:\n",__FILE__,__LINE__);\
printf x;\
printf("\n") */
#define DBPRINTF(x) printf x;
#endif
/*
*
* DBSETOUTPUTFILE
*
* Sets the name of a text file to send all debugging output to
*/
#define DBOUTPUTFILE(x) dbg_SetOutputFile(x)
/*
*
* DBNOOUTPUTFILE
*
* Stops sending debugging output to a text file
*/
#define DBNOOUTPUTFILE dbg_NoOutputFile
/*
*
* DBSETOUTPUTSTRING
*
* Turns on sending debugging output to OutputDebugString
*/
#define DBSETOUTPUTSTRING dbg_SetOutputString
/*
*
* DBSETOUTPUTSTRING
*
* Turns off sending debugging output to OutputDebugString
*/
#define DBNOOUTPUTSTRING dbg_NoOutputString
/*
*
* DBMB
*
* Displays a message box containing a string and waits until OK is clicked on the
* message box.
* Arguments are as for DBPRINTF.
*/
#define DBMB(x) dbg_MessageBox x
/*
*
* ASSERT
*
* Rewritten version of assert that allows a printf format text string to be passed
* to ASSERT along with the condition.
*
* Arguments: ASSERT((condition, "Format string with variables: %d, %d", var1, var2));
*/
#define ASSERT(x) \
dbg_AssertPosition(__FILE__, __LINE__), \
dbg_Assert x
/*
*
* DBERROR
*
* Error message macro - use this if the error should be reported even in
* production code (i.e. out of memory errors, file not found etc.)
*
* Arguments as for printf
*/
#ifdef PSX
#define DBERROR(x) printf x; printf("\n...DBERROR in line %d of %s\n",__LINE__,__FILE__);
#else
#define DBERROR(x) \
dbg_ErrorPosition(__FILE__, __LINE__), \
dbg_ErrorBox x
#endif
/****************************************************************************************
*
* Mono monitor output macros
*
*/
#if defined(WIN32) && defined(MONODEBUG)
/*
*
* DBMONOPRINTF
*
* Version of printf that outputs the string to a specified location on the mono screen
*
* Arguments : DBMONOPRINTF((x,y, "String : %d, %d", var1, var2));
*/
#define DBMONOPRINTF(x) dbg_MONO_PrintString x
/*
*
* DBMONOCLEAR
*
* Clear the mono monitor
*/
#define DBMONOCLEAR dbg_MONO_ClearScreen
/*
*
* DBMONOCLEARRECT
*
* Clear a rectangle on the mono screen
* Arguments : DBMONOCLEARRECT(x,y, width, height)
*/
#define DBMONOCLEARRECT(x,y,width,height) \
dbg_MONO_ClearRectangle(x,y,width,height);
#else
/* No mono monitor on a playstation so undefine all the macros */
#define DBMONOPRINTF(x)
#define DBMONOCLEAR()
#define DBMONOCLEARRECT(x,y,width,height)
#endif
/****************************************************************************************
*
* Conditional debugging macro's that can be selectively turned on or off on a file
* by file basis.
*
*/
#ifdef DEBUG_GROUP0
#define DBP0(x) DBPRINTF(x)
#define DBMB0(x) DBMB(x)
#define DBMONOP0(x) DBMONOPRINTF(x)
#define DBMONOC0() DBMONOCLEAR()
#define DBMONOCR0(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP0(x)
#define DBMB0(x)
#define DBMONOP0(x)
#define DBMONOC0()
#define DBMONOCR0(x,y,width,height)
#endif
#ifdef DEBUG_GROUP1
#define DBP1(x) DBPRINTF(x)
#define DBMB1(x) DBMB(x)
#define DBMONOP1(x) DBMONOPRINTF(x)
#define DBMONOC1() DBMONOCLEAR()
#define DBMONOCR1(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP1(x)
#define DBMB1(x)
#define DBMONOP1(x)
#define DBMONOC1()
#define DBMONOCR1(x,y,width,height)
#endif
#ifdef DEBUG_GROUP2
#define DBP2(x) DBPRINTF(x)
#define DBMB2(x) DBMB(x)
#define DBMONOP2(x) DBMONOPRINTF(x)
#define DBMONOC2() DBMONOCLEAR()
#define DBMONOCR2(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP2(x)
#define DBMB2(x)
#define DBMONOP2(x)
#define DBMONOC2()
#define DBMONOCR2(x,y,width,height)
#endif
#ifdef DEBUG_GROUP3
#define DBP3(x) DBPRINTF(x)
#define DBMB3(x) DBMB(x)
#define DBMONOP3(x) DBMONOPRINTF(x)
#define DBMONOC3() DBMONOCLEAR()
#define DBMONOCR3(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP3(x)
#define DBMB3(x)
#define DBMONOP3(x)
#define DBMONOC3()
#define DBMONOCR3(x,y,width,height)
#endif
#ifdef DEBUG_GROUP4
#define DBP4(x) DBPRINTF(x)
#define DBMB4(x) DBMB(x)
#define DBMONOP4(x) DBMONOPRINTF(x)
#define DBMONOC4() DBMONOCLEAR()
#define DBMONOCR4(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP4(x)
#define DBMB4(x)
#define DBMONOP4(x)
#define DBMONOC4()
#define DBMONOCR4(x,y,width,height)
#endif
#ifdef DEBUG_GROUP5
#define DBP5(x) DBPRINTF(x)
#define DBMB5(x) DBMB(x)
#define DBMONOP5(x) DBMONOPRINTF(x)
#define DBMONOC5() DBMONOCLEAR()
#define DBMONOCR5(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP5(x)
#define DBMB5(x)
#define DBMONOP5(x)
#define DBMONOC5()
#define DBMONOCR5(x,y,width,height)
#endif
#ifdef DEBUG_GROUP6
#define DBP6(x) DBPRINTF(x)
#define DBMB6(x) DBMB(x)
#define DBMONOP6(x) DBMONOPRINTF(x)
#define DBMONOC6() DBMONOCLEAR()
#define DBMONOCR6(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP6(x)
#define DBMB6(x)
#define DBMONOP6(x)
#define DBMONOC6()
#define DBMONOCR6(x,y,width,height)
#endif
#ifdef DEBUG_GROUP7
#define DBP7(x) DBPRINTF(x)
#define DBMB7(x) DBMB(x)
#define DBMONOP7(x) DBMONOPRINTF(x)
#define DBMONOC7() DBMONOCLEAR()
#define DBMONOCR7(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP7(x)
#define DBMB7(x)
#define DBMONOP7(x)
#define DBMONOC7()
#define DBMONOCR7(x,y,width,height)
#endif
#ifdef DEBUG_GROUP8
#define DBP8(x) DBPRINTF(x)
#define DBMB8(x) DBMB(x)
#define DBMONOP8(x) DBMONOPRINTF(x)
#define DBMONOC8() DBMONOCLEAR()
#define DBMONOCR8(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP8(x)
#define DBMB8(x)
#define DBMONOP8(x)
#define DBMONOC8()
#define DBMONOCR8(x,y,width,height)
#endif
#ifdef DEBUG_GROUP9
#define DBP9(x) DBPRINTF(x)
#define DBMB9(x) DBMB(x)
#define DBMONOP9(x) DBMONOPRINTF(x)
#define DBMONOC9() DBMONOCLEAR()
#define DBMONOCR9(x,y,width,height) DBMONOCLEARRECT(x,y,width,height)
#else
#define DBP9(x)
#define DBMB9(x)
#define DBMONOP9(x)
#define DBMONOC9()
#define DBMONOCR9(x,y,width,height)
#endif
#else
/* No Debugging output required */
#ifdef WIN32
#define DBPRINTF(x)
#else // currently we want DBPRINTF to work on the PSX even on release build
#define DBPRINTF(x) printf x;
#endif
#define DBOUTPUTFILE(x)
#define DBNOOUTPUTFILE()
#define DBSETOUTPUTSTRING()
#define DBNOOUTPUTSTRING()
#define DBMB(x)
#ifdef ALWAYS_ASSERT
#define ASSERT(x) \
dbg_AssertPosition(__FILE__, __LINE__), \
dbg_Assert x
#else
#define ASSERT(x)
#endif
#ifdef PSX
#define DBERROR(x) printf x; printf("\n...DBERROR in line %d of %s\n",__LINE__,__FILE__);
#else
#define DBERROR(x) dbg_ErrorBox x
#endif
#define DBMONOPRINTF(x)
#define DBMONOCLEAR()
#define DBMONOCLEARRECT(x,y,width,height)
#define DBP0(x)
#define DBP1(x)
#define DBP2(x)
#define DBP3(x)
#define DBP4(x)
#define DBP5(x)
#define DBP6(x)
#define DBP7(x)
#define DBP8(x)
#define DBP9(x)
#define DBMB0(x)
#define DBMB1(x)
#define DBMB2(x)
#define DBMB3(x)
#define DBMB4(x)
#define DBMB5(x)
#define DBMB6(x)
#define DBMB7(x)
#define DBMB8(x)
#define DBMB9(x)
#define DBMONOP0(x)
#define DBMONOP1(x)
#define DBMONOP2(x)
#define DBMONOP3(x)
#define DBMONOP4(x)
#define DBMONOP5(x)
#define DBMONOP6(x)
#define DBMONOP7(x)
#define DBMONOP8(x)
#define DBMONOP9(x)
#define DBMONOC0()
#define DBMONOC1()
#define DBMONOC2()
#define DBMONOC3()
#define DBMONOC4()
#define DBMONOC5()
#define DBMONOC6()
#define DBMONOC7()
#define DBMONOC8()
#define DBMONOC9()
#define DBMONOCR0(x,y,w,h)
#define DBMONOCR1(x,y,w,h)
#define DBMONOCR2(x,y,w,h)
#define DBMONOCR3(x,y,w,h)
#define DBMONOCR4(x,y,w,h)
#define DBMONOCR5(x,y,w,h)
#define DBMONOCR6(x,y,w,h)
#define DBMONOCR7(x,y,w,h)
#define DBMONOCR8(x,y,w,h)
#define DBMONOCR9(x,y,w,h)
#endif
#endif

View File

@ -0,0 +1,59 @@
#include "windows.h"
#include "windowsx.h"
#include "stdio.h"
#include "tchar.h"
#ifdef _DEBUG
extern void DebugWinPrint(char *String);
FILE* DebugStream=NULL;
void DebugOpen(char* LogName)
{
if(DebugStream) {
fclose(DebugStream);
DebugStream = NULL;
}
DebugStream = fopen(LogName,"wb");
fprintf(DebugStream,"This build : %s %s\n\n",__DATE__,__TIME__);
}
void DebugClose(void)
{
if(DebugStream) {
fclose(DebugStream);
}
DebugStream=NULL;
}
void DebugPrint(const TCHAR *format, ...)
{
TCHAR buf[4096];
va_list args;
va_start(args,format);
_vsntprintf(buf,4096,format,args);
va_end(args);
OutputDebugString(buf);
if(DebugStream!=NULL) {
fprintf(DebugStream,"%s",buf);
}
// DebugWinPrint(buf);
}
#else
void DebugOpen(char* LogName)
{
}
void DebugClose(void)
{
}
#endif

View File

@ -0,0 +1,89 @@
#ifdef __cplusplus
extern "C" {
#endif
//#define DEBUG0
//#define DEBUG1
//#define DEBUG2
//#define DEBUG3
//#define DEBUG4
#define DEBUG5
void DebugOpen(char* LogName);
void DebugClose(void);
#ifndef _TCHAR_DEFINED
typedef char TCHAR, *PTCHAR;
typedef unsigned char TBYTE , *PTBYTE ;
#define _TCHAR_DEFINED
#endif /* !_TCHAR_DEFINED */
#ifdef _DEBUG
void DebugPrint(const TCHAR *format, ...);
#else
#define DebugPrint
#endif
#ifdef __cplusplus
#ifndef ASSERT
#define ASSERT
#endif
#else
#ifndef ASSERT
#define DBG_ASSERT(a,b) if(!(a)) { DebugPrint("Assertion Failure in %s, line : %d\n",__FILE__, __LINE__); \
DebugPrint(b); \
DebugPrint("\n"); }
#define ASSERT(a) DBG_ASSERT a
#endif
#endif
#define DBERROR(a) DebugPrint a;
#define DBPRINTF(a) DebugPrint a;
#ifdef DEBUG0
#define DBP0(a) DebugPrint a;
#else
#define DBP0
#endif
#ifdef DEBUG1
#define DBP1(a) DebugPrint a;
#else
#define DBP1
#endif
#ifdef DEBUG2
#define DBP2(a) DebugPrint a;
#else
#define DBP2
#endif
#ifdef DEBUG3
#define DBP3(a) DebugPrint a;
#else
#define DBP3
#endif
#ifdef DEBUG4
#define DBP4(a) DebugPrint a;
#else
#define DBP4
#endif
#ifdef DEBUG5
#define DBP5(a) DebugPrint a;
#else
#define DBP5
#endif
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,162 @@
#ifndef __DEVMAP_INCLUDED__
#define __DEVMAP_INCLUDED__
//
// Map file structures and definitions extracted from Deliverance Map.h and Map.c
//
// A few Deliverance specific typedefs.
typedef unsigned char UBYTE;
typedef signed char SBYTE;
typedef signed char STRING;
typedef unsigned short UWORD;
typedef signed short SWORD;
typedef unsigned int UDWORD;
typedef signed int SDWORD;
typedef unsigned short BASE_OBJECT;
// BASE_OBJECT is defined differently in the game but for the sake of the editor it can just
// be a long word.
/* Structure definitions for loading and saving map data */
typedef struct {
STRING aFileType[4];
UDWORD version;
UDWORD quantity;
} TILETYPE_SAVEHEADER;
typedef struct {
STRING aFileType[4];
UDWORD version;
UDWORD quantity;
} TAGLIST_SAVEHEADER;
typedef struct {
STRING TagName[32];
UDWORD TagID;
} TAGLIST;
typedef struct {
STRING aFileType[4];
UDWORD version;
UDWORD quantity;
} LIMITS_SAVEHEADER;
typedef struct {
UDWORD LimitID;
UWORD MinX;
UWORD MinZ;
UWORD MaxX;
UWORD MaxZ;
} LIMITS;
typedef struct _map_save_header
{
STRING aFileType[4];
UDWORD version;
UDWORD width;
UDWORD height;
} MAP_SAVEHEADER;
typedef struct _map_save_tile
{
UWORD texture;
UBYTE height;
} MAP_SAVETILE;
typedef struct _gateway_save_header
{
UDWORD version;
UDWORD numGateways;
} GATEWAY_SAVEHEADER;
typedef struct _gateway_save
{
UBYTE x0,y0,x1,y1;
} GATEWAY_SAVE;
//typedef struct _map_save_tilev1
//{
// UDWORD texture;
// UBYTE type;
// UBYTE height;
//} MAP_SAVETILEV1;
/* Structure definitions for loading and saving map data */
/*(typedef struct _map_save_header
{
STRING aFileType[4];
UDWORD version;
UDWORD width;
UDWORD height;
} MAP_SAVEHEADER;
typedef struct _map_save_tile
{
UDWORD texture;
UBYTE type;
UBYTE height;
} MAP_SAVETILE;
*/
/* Sanity check definitions for the save struct file sizes */
#define TILETYPE_SAVEHEADER_SIZE 12
#define TAGLIST_SAVEHEADER_SIZE 12
#define LIMITS_SAVEHEADER_SIZE 12
#define SAVE_HEADER_SIZE 16
#define SAVE_TILE_SIZE 3
#define SAVE_TILE_SIZEV1 6
//#define SAVE_HEADER_SIZE 16
//#define SAVE_TILE_SIZE 6
/* The different types of terrain as far as the game is concerned */
typedef enum _terrain_type
{
TER_GRASS = 0x1,
TER_STONE = 0x2,
TER_SAND = 0x4,
TER_WATER = 0x8,
TER_OBJECT = 0x80,
TER_ALL = 0xff,
} TERRAIN_TYPE;
/* change these if you change above - maybe wrap up in enumerate? */
#define TERRAIN_TYPES 4
#define MAX_PLAYERS 8 /*Utterly arbitrary at the moment!! */
/* Flags for whether texture tiles are flipped in X and Y or rotated */
//#define TILE_XFLIP 0x80000000
//#define TILE_YFLIP 0x40000000
//#define TILE_NUMMASK 0x0fffffff
//#define TILE_ROTMASK 0x30000000
//#define TILE_ROTSHIFT 28
#define TILE_XFLIP 0x8000
#define TILE_YFLIP 0x4000
#define TILE_ROTMASK 0x3000
#define TILE_ROTSHIFT 12
#define TILE_TRIFLIP 0x0800 // This bit describes the direction the tile is split into 2 triangles.
#define TILE_NUMMASK 0x07ff
#define TILE_BITMASK 0xF800
///* Information stored with each tile */
//typedef struct _tile
//{
// TERRAIN_TYPE type; // The terrain type for the tile
// UBYTE height; // The height at the top left of the tile
// BASE_OBJECT *psObject; // Any object sitting on the location (e.g. building)
// BOOL tileVisible[MAX_PLAYERS]; // Which players can see the tile?
// UDWORD texture; // Which graphics texture is on this tile
// // This is also used to store the tile flip flags
// UDWORD onFire; // Is tile on fire?
// UDWORD rippleIndex; // Current value in ripple table?
//} TILE;
/* The maximum map size */
#define MAP_MAXWIDTH 256
#define MAP_MAXHEIGHT 256
#endif

View File

@ -0,0 +1,272 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <assert.h>
#include "dibdraw.h"
#include "debugprint.h"
// Create a DIBDraw class with user specified dimensions and colour depth.
//
CDIBDraw::CDIBDraw(void *hWnd,DWORD Width,DWORD Height,DWORD Planes,DWORD BitsPerPixel,BOOL Is555)
{
// Create the DIB.
CreateDIB(hWnd,Width,Height,Planes,BitsPerPixel,Is555);
}
// Create a DIBDraw class with user specified dimensions and colour depth of the
// specified window.
//
CDIBDraw::CDIBDraw(void *hWnd,DWORD Width,DWORD Height,BOOL Is555)
{
DWORD Planes;
DWORD BitsPerPixel;
HDC hdc;
assert(hWnd!=NULL);
// Find out about the client windows pixel mode.
hdc=GetDC((HWND)hWnd);
assert(hdc!=NULL);
Planes = GetDeviceCaps(hdc,PLANES) ;
BitsPerPixel = GetDeviceCaps(hdc,BITSPIXEL);
ReleaseDC((HWND)hWnd,hdc);
// Create the DIB.
CreateDIB(hWnd,Width,Height+4,Planes,BitsPerPixel,Is555);
}
// Create a CDIBDraw instances with the dimensions and colour depth of the
// specified window.
//
CDIBDraw::CDIBDraw(void *hWnd,BOOL Is555)
{
DWORD Planes;
DWORD BitsPerPixel;
RECT ClientRect;
HDC hdc;
// Find out about the client windows pixel mode.
hdc=GetDC((HWND)hWnd);
Planes = GetDeviceCaps(hdc,PLANES);
BitsPerPixel = GetDeviceCaps(hdc,BITSPIXEL);
ReleaseDC((HWND)hWnd,hdc);
// Get the size of the client window.
GetClientRect((HWND)hWnd,&ClientRect);
// Create the DIB.
CreateDIB(hWnd,(ClientRect.right+1)&0xfffe,
ClientRect.bottom+4, // Add 4 for some strange reason.
Planes,BitsPerPixel);
}
void CDIBDraw::CreateDIB(void *hWnd,DWORD Width,DWORD Height,DWORD Planes,DWORD BitsPerPixel,BOOL Is555)
{
DWORD PaletteSize;
HDC hdc;
assert(hWnd!=NULL);
m_hWnd = (HWND)hWnd;
m_Width = Width;
m_Height = Height;
// Set the palette size.
switch(Planes * BitsPerPixel) {
case 1:
PaletteSize=2;
break;
case 4:
PaletteSize=16;
break;
case 8:
PaletteSize=256;
break;
default:
PaletteSize=3;
}
assert(PaletteSize == 3);
// Create the bitmap info structure.
m_BitmapInfo=(BITMAPINFO*)new BYTE[sizeof(BITMAPINFO)+sizeof(RGBQUAD)*PaletteSize];
m_BitmapInfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
m_BitmapInfo->bmiHeader.biWidth=m_Width;
m_BitmapInfo->bmiHeader.biHeight=-(int)m_Height; // Top down please.
m_BitmapInfo->bmiHeader.biPlanes=(WORD)Planes;
m_BitmapInfo->bmiHeader.biBitCount=(WORD)BitsPerPixel;
m_BitmapInfo->bmiHeader.biCompression= BI_BITFIELDS; //BI_RGB;
m_BitmapInfo->bmiHeader.biSizeImage=0;
m_BitmapInfo->bmiHeader.biXPelsPerMeter=0;
m_BitmapInfo->bmiHeader.biYPelsPerMeter=0;
m_BitmapInfo->bmiHeader.biClrUsed=0;
m_BitmapInfo->bmiHeader.biClrImportant=0;
// Specify rgb bit masks.
DWORD *PFormat = (DWORD*)m_BitmapInfo->bmiColors;
m_Is555 = Is555;
if(Is555) {
PFormat[0] = 0x7c00;
PFormat[1] = 0x03e0;
PFormat[2] = 0x001f;
} else {
PFormat[0] = 0xf800;
PFormat[1] = 0x07e0;
PFormat[2] = 0x001f;
}
hdc=GetDC((HWND)hWnd);
assert(hdc!=NULL);
m_hDIB = CreateDIBSection(hdc, m_BitmapInfo, DIB_RGB_COLORS, &m_DIBBits, NULL, 0);
assert(m_hDIB!=NULL);
assert(m_DIBBits!=NULL);
m_hdcDIB = CreateCompatibleDC(hdc);
HGDIOBJ Res = SelectObject(m_hdcDIB, m_hDIB);
assert(Res!=NULL);
assert((DWORD)Res!=GDI_ERROR);
ReleaseDC((HWND)hWnd,hdc);
m_Valid = MAGIC;
}
CDIBDraw::~CDIBDraw(void)
{
assert(m_Valid == MAGIC);
m_Valid = 0;
DeleteDC(m_hdcDIB);
DeleteObject(m_hDIB);
delete m_BitmapInfo;
}
// Clear the DIB Section to black.
//
void CDIBDraw::ClearDIB(void)
{
assert(m_Valid == MAGIC);
BitBlt(m_hdcDIB, 0, 0, m_Width, m_Height,
NULL, 0, 0, BLACKNESS);
}
// Copy the DIB section to it's client window.
//
void CDIBDraw::SwitchBuffers(void)
{
// RECT DestRect;
// GetClientRect(m_hWnd,&DestRect);
assert(m_Valid == MAGIC);
HDC hdc;
hdc=GetDC(m_hWnd);
// BitBlt(hdc, 0, 0, DestRect.right, DestRect.bottom,
// m_hdcDIB, 0, 0, SRCCOPY);
BitBlt(hdc, 0, 0, m_Width, m_Height,
m_hdcDIB, 0, 0, SRCCOPY);
ReleaseDC(m_hWnd,hdc);
ValidateRect(m_hWnd, NULL);
}
void CDIBDraw::SwitchBuffers(int SrcOffX,int SrcOffY)
{
assert(m_Valid == MAGIC);
HDC hdc;
hdc=GetDC(m_hWnd);
BitBlt(hdc, 0, 0, m_Width, m_Height,
m_hdcDIB, SrcOffX, SrcOffY, SRCCOPY);
ReleaseDC(m_hWnd,hdc);
ValidateRect(m_hWnd, NULL);
}
// Copy the DIB Section to the specified DC
//
void CDIBDraw::SwitchBuffers(void *hdc)
{
assert(m_Valid == MAGIC);
BitBlt((HDC)hdc, 0, 0, m_Width, m_Height,
m_hdcDIB, 0, 0, SRCCOPY);
ValidateRect(m_hWnd, NULL);
}
void *CDIBDraw::GetDIBBits(void)
{
assert(m_Valid == MAGIC);
return m_DIBBits;
}
DWORD CDIBDraw::GetDIBWidth(void)
{
assert(m_Valid == MAGIC);
return m_Width;
}
DWORD CDIBDraw::GetDIBHeight(void)
{
assert(m_Valid == MAGIC);
return m_Height;
}
void *CDIBDraw::GetDIBDC(void)
{
assert(m_Valid == MAGIC);
return m_hdcDIB;
}
void *CDIBDraw::GetDIBWindow(void)
{
assert(m_Valid == MAGIC);
return m_hWnd;
}
// Given and RGB colour, return a pixel value which can be
// written directly into the DIB section.
//
DWORD CDIBDraw::GetDIBValue(DWORD r,DWORD g,DWORD b)
{
if(m_Is555) {
return (((r>>3)&0x1f) << 10) | (((g>>3)&0x1f) << 5) | ((b>>3)&0x1f);
} else {
return (((r>>3)&0x1f) << 11) | (((g>>2)&0x3f) << 5) | ((b>>3)&0x1f);
}
}
void CDIBDraw::PutDIBPixel(DWORD Value,DWORD x,DWORD y)
{
if((x >= 0) && (y >= 0) && (x < m_Width) && (y < m_Height)) {
short *Dst = ((short*)m_DIBBits) + y*m_Width+x;
*Dst = Value;
}
}
void CDIBDraw::PutDIBFatPixel(DWORD Value,DWORD x,DWORD y)
{
if((x >= 0) && (y >= 0) && (x < m_Width-1) && (y < m_Height-1)) {
short *Dst = ((short*)m_DIBBits) + y*m_Width+x;
*Dst = Value;
*(Dst+1) = Value;
*(Dst+m_Width) = Value;
*(Dst+1+m_Width) = Value;
}
}

View File

@ -0,0 +1,38 @@
#ifndef __DIBDRAW_INCLUDED__
#define __DIBDRAW_INCLUDED__
#define MAGIC 29121967 // For debuging.
class CDIBDraw {
public:
CDIBDraw(void *hWnd,DWORD Width,DWORD Height,DWORD Planes,DWORD BitsPerPixel,BOOL Is555=FALSE);
CDIBDraw(void *hWnd,DWORD Width,DWORD Height,BOOL Is555=FALSE);
CDIBDraw(void *hWnd,BOOL Is555=FALSE);
~CDIBDraw(void);
void CreateDIB(void *hWnd,DWORD Width,DWORD Height,DWORD Planes,DWORD BitsPerPixel,BOOL Is555=FALSE);
void ClearDIB(void);
void SwitchBuffers(void);
void SwitchBuffers(void *hdc);
void SwitchBuffers(int SrcOffX,int SrcOffY);
void *GetDIBBits(void);
DWORD GetDIBWidth(void);
DWORD GetDIBHeight(void);
void *GetDIBDC(void);
void *GetDIBWindow(void);
DWORD GetDIBValue(DWORD r,DWORD g,DWORD b);
void PutDIBPixel(DWORD Value,DWORD x,DWORD y);
void PutDIBFatPixel(DWORD Value,DWORD x,DWORD y);
protected:
BOOL m_Is555;
DWORD m_Valid;
HWND m_hWnd;
BITMAPINFO *m_BitmapInfo;
void *m_DIBBits;
HBITMAP m_hDIB;
HDC m_hdcDIB;
DWORD m_Width;
DWORD m_Height;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,711 @@
#ifndef _INCLUDED_DIRECTX_
#define _INCLUDED_DIRECTX_
// Define DX6 in the project properties to use new interfaces in DirectX 6,
// otherwise defaults to using old Direct X 5 interfaces.
#include <ddraw.h>
#include <d3d.h>
#include "typedefs.h"
#include "macros.h"
#define MAX_DD_DEVICES 8
#define MAX_DD_FORMATS 32
#define MAX_DD_MODES 64
#define MAX_DD_NAMESIZE 128
#define MAX_D3D_DEVICES 8
#define MAX_MATERIALS 128
//#define FOGGY // Test fog.
//#define FILTER // Test bilinear filtering.
//#define DITHER // Test dither.
//#define SPECULAR // Test specular.
//#define ANTIALIAS // Test anti alias.
//#define DUMPCAPS // Print entire device caps on startup.
#ifdef FOGGY
#define SKYRED 96 // The default colour values for the background.
#define SKYGREEN 96
#define SKYBLUE 96
#else
#define SKYRED 0 // The default colour values for the background.
#define SKYGREEN 64
#define SKYBLUE 128
#endif
#ifdef DX6
typedef IDirectDrawSurface4 IDDSURFACE;
typedef IDirectDrawPalette IDDPALETTE;
typedef IDirectDraw4 IDDRAW;
typedef IDirectDrawClipper IDDCLIPPER;
typedef IDirect3D3 ID3D;
typedef IDirect3DDevice3 ID3DDEVICE;
typedef IDirect3DViewport3 ID3DVIEPORT;
typedef IDirect3DMaterial3 ID3DMATERIAL;
typedef IDirect3DTexture2 ID3DTEXTURE;
typedef DDSURFACEDESC2 SURFACEDESC;
typedef DDSCAPS2 SURFACECAPS;
#else
typedef IDirectDrawSurface IDDSURFACE;
typedef IDirectDrawPalette IDDPALETTE;
typedef IDirectDraw IDDRAW;
typedef IDirectDrawClipper IDDCLIPPER;
typedef IDirect3D2 ID3D;
typedef IDirect3DDevice2 ID3DDEVICE;
typedef IDirect3DViewport2 ID3DVIEPORT;
typedef IDirect3DMaterial2 ID3DMATERIAL;
typedef IDirect3DTexture2 ID3DTEXTURE;
typedef DDSURFACEDESC SURFACEDESC;
typedef DDSCAPS SURFACECAPS;
#endif
#ifdef DLLEXPORT
#define EXPORT __declspec (dllexport)
#else
#define EXPORT
#endif
// Colour models.
//
typedef enum {
DONTCARE,
RAMPCOLOR,
RGBCOLOR,
} CMODEL;
typedef enum {
SURFACE_SYSTEMMEMORY,
SURFACE_VIDEOMEMORY,
} SURFACEMEMTYPE;
// Structure to define a requested system profile.
//
struct Profile {
BOOL FullScreen;
DWORD XRes; // Resolution.
DWORD YRes;
DWORD BPP; // Bits per pixel. ( Ignored in windowed mode. )
BOOL TripleBuffer;
BOOL UseHardware; // 3D characteristics.
BOOL UseZBuffer;
CMODEL ColourModel;
BOOL Hardware;
BOOL DoesTexture;
BOOL DoesZBuffer;
BOOL DoesWindow;
};
// Structure to define the current state of the renderer.
//
struct D3DState {
UWORD SourceBlend;
UWORD DestBlend;
UWORD BlendMode;
BOOL BlendEnable;
UWORD MagFilterMode;
UWORD MinFilterMode;
UWORD ShadeMode;
UWORD FillMode;
BOOL TextureCorrect;
BOOL ZBuffer;
BOOL AntiAlias;
BOOL Dither;
BOOL Specular;
BOOL FogEnabled;
UWORD FogMode;
DWORD FogColour;
D3DVALUE FogDensity;
D3DVALUE FogTableDensity;
D3DVALUE FogStart;
D3DVALUE FogStop;
DWORD AmbientLight;
};
// Structure to define a direct 3d device.
//
struct D3DDevice {
GUID Guid; // The devices unique id.
char Name[MAX_DD_NAMESIZE]; // Name of the device.
char Description[MAX_DD_NAMESIZE]; // Textual description of the device.
D3DDEVICEDESC DeviceDesc; // Full description of the device.
BOOL IsHardware; // Is it a hardware device.
BOOL DoesTextures; // Can it do texturing.
BOOL DoesZBuffer; // Can it do z buffering.
BOOL CanDoWindow; // Can it run in a window.
DWORD MaxBufferSize; // Max execute buffer size.
DWORD MaxBufferVerts; // Max number of verticies in an execute buffer.
};
// Structure to hold a list of direct 3d devices.
//
//
struct D3DDeviceList {
int MaxDevices;
int NumDevices;
BOOL IsPrimary; // Do these 3d devices live on the primary display device.
DWORD WindowsBPP;
D3DDevice List[MAX_D3D_DEVICES];
};
struct DisplayMode {
int Width;
int Height;
int BPP;
};
struct ModeList {
int MaxModes;
int NumModes;
DisplayMode Modes[MAX_DD_MODES];
};
// Structure to hold a list of direct draw device names and there associated
// direct 3D devices.
//
struct DeviceList {
int MaxDevices;
int NumDevices;
char List[MAX_DD_DEVICES][MAX_DD_NAMESIZE];
GUID *Guid[MAX_DD_DEVICES];
BOOL IsPrimary[MAX_DD_DEVICES];
ModeList DisplayModes[MAX_DD_DEVICES];
D3DDeviceList D3DDevices[MAX_D3D_DEVICES];
};
// Structure to define a device hook name when
// calling direct draw enum device callback.
//
struct DeviceHook {
char *Name;
BOOL Accelerate3D;
BOOL Windowed3D;
IDDRAW *Device;
};
// Texture formats.
//
typedef enum {
TF_NOTEXTURE,
TF_PAL4BIT, // Palettized 4 bit.
TF_PAL8BIT, // Palettized 8 bit.
TF_RGB16BIT, // RGB.
TF_RGB32BIT, // RGB.
TF_RGB1ALPHA16BIT, // RGB and 1 bit of alpha.
TF_RGB1ALPHA32BIT, // RGB and 1 bit of alpha.
TF_RGBALPHA16BIT, // RGB and 2 or more bits of alpha.
TF_RGBALPHA32BIT, // RGB and 2 or more bits of alpha.
TF_ANY, // Not fussy, anything will do.
} TFORMAT;
#define AT_COLOURKEY 0x00000001
#define AT_ALPHABLEND 0x00000002
// Valid material types.
typedef enum {
MT_FLAT, // Un-textured.
MT_TEXTURED, // Textured.
MT_MIPMAPED, // Mip maped.
} MATERIALTYPE;
// Material creation descriptor.
struct MatDesc {
DWORD Type; // One of the MATERIALTYPE enumerated values.
DWORD AlphaTypes; // Specify the types of alpha we want.
SDWORD ColourKey; // RGB of key if AlphaTypes includes AT_COLOURKEY.
char *Name; // Unique name for the material.
void *Bits; // Source texture map if type is MT_TEXTURED.
DWORD Count; // Mip map count if Type is MT_MIPMAPED.
void **MipMapBits; // Source mip map if Type is MT_MIPMAPED.
DWORD Width; // Width of the texture if Type is MT_TEXTURED or MT_MIPMAPED
DWORD Height; // Height of the texture if Type is MT_TEXTURED or MT_MIPMAPED
PALETTEENTRY *PaletteEntries; // Source textures palette, also destination palette if
// TexFormat is TF_PAL8BIT or TF_PAL4BIT.
UBYTE Alpha; // Global alpha value to use if AlphaTypes includes AT_ALPHABLEND.
void *AlphaMap; // Optional alpha map, replaces Alpha for per pixel alpha blending.
TFORMAT TexFormat; // One of the TFORMAT enumerated values.
D3DCOLORVALUE Ambient; // Material colours.
D3DCOLORVALUE Diffuse;
D3DCOLORVALUE Specular;
DWORD Scale; // Texture scale factor ( not implemented )
};
struct PixFormatExt {
char Name[MAX_DD_NAMESIZE];
BOOL Palettized; // TRUE if texture is palettized and pixels are pallete indecei..
UWORD IndexBPP; // If Palettized==TRUE then indicates bits per pixel.
UWORD RGBBPP; // If Palattized==FALSE then bits per pixel,
UWORD AlphaBPP; // Bits per pixel for alpha,
UWORD RedBPP; // red,
UWORD GreenBPP; // Green,
UWORD BlueBPP; // and Blue.
DWORD ABitMask; // Bit masks for alpha,red,green and blue.
DWORD RBitMask;
DWORD GBitMask;
DWORD BBitMask;
UWORD AlphaShift; // Shift values for alpha,red,green and blue.
UWORD RedShift;
UWORD GreenShift;
UWORD BlueShift;
};
// Structure to describe a texture format.
//
struct TextureDesc {
DDPIXELFORMAT PixelFormat;
PixFormatExt PixelFormatExt;
};
// Structure to hold a list of texture formats.
//
struct TextureList {
int MaxFormats;
int NumFormats;
TextureDesc List[MAX_DD_FORMATS];
};
class CTexture {
protected:
IDDSURFACE *m_MemorySurface; // system memory surface
IDDSURFACE *m_DeviceSurface; // video memory texture
IDDPALETTE *m_Palette;
#ifdef DX6
ID3DTEXTURE *m_Texture;
#else
D3DTEXTUREHANDLE m_Handle;
#endif
int m_Width,m_Height;
public:
EXPORT CTexture(void);
EXPORT ~CTexture(void);
//EXPORT BOOL Create(IDDRAW *DirectDraw,ID3D *Direct3D,ID3DDEVICE *Device,
// void *Bits,DWORD Width,DWORD Height,
// PALETTEENTRY *PaletteEntries,
// TFORMAT TexFormat,
// UBYTE Alpha=255,void *AlphaMap=NULL,
// DWORD Scale=1);
EXPORT BOOL Create(IDDRAW *DirectDraw,ID3D *Direct3D,ID3DDEVICE *Device3D,
MatDesc *Desc);
//EXPORT BOOL CreateMipMap(IDDRAW *DirectDraw,ID3D *Direct3D,ID3DDEVICE *Device3D,
// DWORD Count,void **Bits,DWORD Width,DWORD Height,
// PALETTEENTRY *PaletteEntries,
// TFORMAT TexFormat,
// UBYTE Alpha,void *AlphaMap,
// DWORD Scale);
EXPORT BOOL CreateMipMap(IDDRAW *DirectDraw,ID3D *Direct3D,ID3DDEVICE *Device3D,
MatDesc *Desc);
#ifdef DX6
EXPORT ID3DTEXTURE *GetTexture(void) { return m_Texture; }
#else
EXPORT D3DTEXTUREHANDLE GetHandle(void) { return m_Handle; }
#endif
EXPORT HRESULT Restore(void);
EXPORT BOOL SetColourKey(SWORD ColourKeyIndex);
EXPORT int GetWidth(void) { return m_Width; }
EXPORT int GetHeight(void) { return m_Height; }
protected:
};
class CSurface {
protected:
IDDSURFACE *m_Surface;
SURFACEDESC m_ddsd;
PALETTEENTRY *m_PaletteEntries;
ULONG *m_RGBLookup;
UWORD *m_RedLookup;
UWORD *m_GreenLookup;
UWORD *m_BlueLookup;
DWORD m_BitCount;
DWORD m_RBitMask,m_GBitMask,m_BBitMask;
UWORD m_RedShift,m_GreenShift,m_BlueShift;
UWORD m_RedBits,m_GreenBits,m_BlueBits;
HDC m_hdc;
BOOL m_IsLocked;
public:
EXPORT CSurface(IDDSURFACE *Surface,PALETTEENTRY *PaletteEntries);
EXPORT ~CSurface();
//EXPORT void PutPixel(SLONG XCoord,SLONG YCoord,UWORD Index);
EXPORT UWORD GetValue(UBYTE Red,UBYTE Green,UBYTE Blue);
EXPORT void PutPixel(SLONG XCoord,SLONG YCoord,UWORD Value);
EXPORT void PutPixel(SLONG XCoord,SLONG YCoord,UBYTE Red,UBYTE Green,UBYTE Blue);
EXPORT void Line(SLONG X0,SLONG Y0,SLONG X1,SLONG Y1,UWORD Index);
EXPORT void Line(SLONG X0,SLONG Y0,SLONG X1,SLONG Y1,UBYTE Red,UBYTE Green,UBYTE Blue);
EXPORT void Clear(UWORD Index);
EXPORT void Clear(UBYTE Red,UBYTE Green,UBYTE Blue);
EXPORT void *Lock(void);
EXPORT void Unlock(void);
EXPORT HDC GetDC(void);
EXPORT void ReleaseDC(void);
};
class CMaterial {
protected:
D3DMATERIALHANDLE m_Handle;
ID3DMATERIAL *m_Material;
public:
EXPORT CMaterial(void);
EXPORT ~CMaterial(void);
EXPORT BOOL Create(ID3D *Direct3D,ID3DDEVICE *Device,
D3DCOLORVALUE *Ambient=NULL,
D3DCOLORVALUE *Diffuse=NULL,
D3DCOLORVALUE *Specular=NULL,D3DVALUE Power=1.0F,
D3DCOLORVALUE *Emissive=NULL,
D3DTEXTUREHANDLE TexHandle = 0);
EXPORT D3DMATERIALHANDLE GetHandle(void) { return m_Handle; }
EXPORT BOOL GetMaterialColour(D3DCOLORVALUE *Ambient,D3DCOLORVALUE *Diffuse,D3DCOLORVALUE *Specular);
EXPORT BOOL SetMaterialColour(D3DCOLORVALUE *Ambient,D3DCOLORVALUE *Diffuse,D3DCOLORVALUE *Specular);
protected:
};
// The direct draw encapsulation class.
//
// Manages creation of the direct draw device, display buffers
// and the display palette. Also handles the direct 3d interface
// creation.
//
class CDirectDraw {
protected:
HWND m_hWnd;
DWORD m_WindowsBPP;
DWORD m_WindowsXRes;
DWORD m_WindowsYRes;
UWORD m_NumDevices;
DeviceList m_DeviceList;
char m_DeviceName[MAX_DD_NAMESIZE];
D3DDeviceList m_3DDeviceList;
int m_3DDeviceIndex;
IDDRAW *m_Device;
IDDSURFACE *m_FrontBuffer;
IDDSURFACE *m_BackBuffer;
IDDSURFACE *m_ZBuffer;
IDDCLIPPER *m_Clipper;
IDDPALETTE *m_Palette;
ID3D *m_Direct3D;
ID3DDEVICE *m_3DDevice;
ID3DVIEPORT *m_Viewport;
RECT m_rcWindow;
DWORD m_ZBufferDepth;
#ifdef DX6
DDPIXELFORMAT m_ddpfZBuffer;
DDCAPS m_HalCaps;
DDCAPS m_HelCaps;
#endif
SIZE m_ScreenSize;
Profile m_Profile;
D3DDEVICEDESC m_HALDevDesc;
D3DDEVICEDESC m_HELDevDesc;
D3DDEVICEDESC m_DevDesc;
PixFormatExt m_PixFormat;
PixFormatExt m_WindowsPixelFormat;
D3DState m_CurrentState;
CMaterial *m_BackMaterial;
SWORD m_InScene;
D3DMATERIALHANDLE m_LastMatHandle;
#ifdef DX6
ID3DTEXTURE *m_LastTexInterface;
#else
D3DTEXTUREHANDLE m_LastTexHandle;
#endif
CSurface *m_BackBufferSurface;
CSurface *m_FrontBufferSurface;
BOOL m_ClipState;
public:
// Core methods.
EXPORT CDirectDraw(void);
EXPORT ~CDirectDraw(void);
EXPORT BOOL Create(void *hWnd,char *szDevice,char *sz3DDevice,Profile *UserProfile = NULL);
EXPORT BOOL SetDefaultRenderState(void);
EXPORT BOOL SetRenderState(D3DState *State);
EXPORT BOOL SetMode(void);
EXPORT BOOL SetDisplayPalette(void);
EXPORT BOOL ClearBackBuffer(void);
EXPORT BOOL SwitchBuffers(void);
EXPORT BOOL RestoreBuffers(void);
EXPORT BOOL SetBackgroundMaterial(D3DMATERIALHANDLE Handle);
EXPORT BOOL SetFog(BOOL Enable,UBYTE Red,UBYTE Green,UBYTE Blue,ULONG Start,ULONG Stop);
EXPORT BOOL SetFilter(BOOL Filter);
EXPORT BOOL SetAmbient(UBYTE Red,UBYTE Green,UBYTE Blue);
EXPORT void *GetBackBufferDC(void);
EXPORT BOOL ReleaseBackBufferDC(void *hdc);
EXPORT BOOL BeginScene(void);
EXPORT BOOL EndScene(void);
EXPORT BOOL RestoreSurfaces(void);
EXPORT BOOL SetClipper(void *hWnd);
EXPORT void OnResize(void *hWnd);
EXPORT HRESULT SetRenderState(_D3DRENDERSTATETYPE StateReg,UWORD State) { return m_3DDevice->SetRenderState(StateReg,State); }
EXPORT HRESULT SetLightState(_D3DLIGHTSTATETYPE StateReg,UWORD State) { return m_3DDevice->SetLightState(StateReg,State); }
//#ifdef DX6
//EXPORT void EnableColourKey(BOOL Enable) { m_3DDevice->SetRenderState(D3DRENDERSTATE_BLENDENABLE, Enable); }
//#else
EXPORT void EnableBlend(BOOL Enable) { m_3DDevice->SetRenderState(D3DRENDERSTATE_BLENDENABLE, Enable); }
EXPORT void EnableColourKey(BOOL Enable) { m_3DDevice->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE ,Enable); }
//#endif
EXPORT void EnableClip(BOOL Enable) { m_ClipState = Enable ? 0 : D3DDP_DONOTCLIP; }
#ifdef DX6
EXPORT BOOL DrawPoint(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPoint(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPoint(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(D3DMATERIALHANDLE MatHandle,ID3DTEXTURE *TexInterface,
D3DTLVERTEX *Vertex,DWORD Count);
#else
EXPORT BOOL DrawPoint(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPoint(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPoint(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(D3DMATERIALHANDLE MatHandle,D3DTEXTUREHANDLE TexHandle,
D3DTLVERTEX *Vertex,DWORD Count);
#endif
EXPORT IDDSURFACE *CreateImageSurface(DWORD Width,DWORD Height,SURFACEMEMTYPE MemType=SURFACE_VIDEOMEMORY);
EXPORT IDDSURFACE *CreateImageSurfaceFromBitmap(void *Bits,DWORD Width,DWORD Height,
PALETTEENTRY *PaletteEntries,SURFACEMEMTYPE MemType=SURFACE_VIDEOMEMORY);
// Member access.
EXPORT HWND GetHWnd(void) { return m_hWnd; }
EXPORT UWORD GetNumDevices(void) { return m_NumDevices; }
EXPORT DeviceList *GetDeviceList(void) { return &m_DeviceList; }
EXPORT char *GetDeviceName(void) { return m_DeviceName; }
EXPORT IDDRAW *GetDevice(void) { return m_Device; }
EXPORT IDDSURFACE *GetFrontBuffer(void) { return m_FrontBuffer; }
EXPORT IDDSURFACE *GetBackBuffer(void) { return m_BackBuffer; }
EXPORT IDDPALETTE *GetDisplayPalette(void) { return m_Palette; }
EXPORT CSurface *GetBackBufferSurface(void) { return m_BackBufferSurface; }
EXPORT CSurface *GetFrontBufferSurface(void) { return m_FrontBufferSurface; }
EXPORT SIZE &GetScreenSize(void) { return m_ScreenSize; }
EXPORT BOOL GetDisplayPaletteEntries(PALETTEENTRY *PaletteEntries);
EXPORT BOOL SetDisplayPaletteEntries(PALETTEENTRY *PaletteEntries);
EXPORT DWORD GetBPP(void) { return m_Profile.BPP; }
EXPORT Profile &GetProfile(void) { return m_Profile; }
EXPORT ID3D *GetDirect3D(void) { return m_Direct3D; }
EXPORT ID3DDEVICE *Get3DDevice(void) { return m_3DDevice; }
EXPORT ID3DVIEPORT *GetViewport(void) { return m_Viewport; }
EXPORT void GetRes(DWORD *XRes,DWORD *YRes) { *XRes = m_ScreenSize.cx; *YRes = m_ScreenSize.cy; }
EXPORT void GetDisplayPixelFormat(PixFormatExt &PixFormat) { PixFormat = m_PixFormat; }
protected:
BOOL GetWindowsMode(void);
BOOL GetDisplayFormat(void);
BOOL RestoreWindowsMode(void);
BOOL Create3D(char *sz3DDevice);
int MatchDevice(char *sz3DDevice);
BOOL CleanUp(BOOL FreeAll = FALSE);
BOOL CreateBuffers(void);
BOOL CreateZBuffer(void);
BOOL CreatePalette(void);
BOOL CreateBackground(void);
void Dump3DDeviceDesc(D3DDevice *Device);
void DumpPrimCaps(D3DPRIMCAPS *Caps);
BOOL Build3DDeviceList(void);
};
struct MaterialData {
char *Name;
int InUse;
CTexture *Texture;
CMaterial *Material;
#ifdef DX6
ID3DTEXTURE *TexInterface;
#else
D3DTEXTUREHANDLE TexHandle;
#endif
D3DMATERIALHANDLE MatHandle;
};
class CMatManager {
protected:
CDirectDraw *m_DirectDraw;
DWORD m_NumMats;
MaterialData m_Materials[MAX_MATERIALS];
public:
EXPORT CMatManager(CDirectDraw *DirectDraw);
EXPORT ~CMatManager(void);
EXPORT BOOL FindMaterial(char *Name,DWORD *MatID);
EXPORT DWORD CreateMaterial(MatDesc *Desc);
EXPORT int GetMaterialWidth(DWORD MatID) { return m_Materials[MatID].Texture->GetWidth(); }
EXPORT int GetMaterialHeight(DWORD MatID) { return m_Materials[MatID].Texture->GetWidth(); }
//EXPORT DWORD CreateMaterial(DWORD Type,char* Name,void *Bits,
// DWORD Count,void **MipMapBits,
// DWORD Width,DWORD Height,
// PALETTEENTRY *PaletteEntries,
// UBYTE Alpha,void *AlphaMap,
// TFORMAT TexFormat,
// D3DCOLORVALUE *Ambient,
// D3DCOLORVALUE *Diffuse,
// D3DCOLORVALUE *Specular,
// DWORD Scale=1);
EXPORT int GetMaterialID(char* Name);
EXPORT D3DMATERIALHANDLE GetMaterialHandle(DWORD MaterialID);
#ifdef DX6
EXPORT ID3DTEXTURE *GetTextureInterface(DWORD MaterialID);
#else
EXPORT D3DTEXTUREHANDLE GetTextureHandle(DWORD MaterialID);
#endif
EXPORT BOOL DeleteMaterial(DWORD MaterialID);
EXPORT BOOL SetColourKey(DWORD MaterialID,SWORD ColourKeyIndex);
EXPORT BOOL SetMaterialColour(DWORD MaterialID,
D3DCOLORVALUE *Ambient,
D3DCOLORVALUE *Diffuse,
D3DCOLORVALUE *Specular);
EXPORT BOOL GetMaterialColour(DWORD MaterialID,
D3DCOLORVALUE *Ambient,
D3DCOLORVALUE *Diffuse,
D3DCOLORVALUE *Specular);
EXPORT BOOL ReleaseMaterials(void);
EXPORT BOOL RestoreMaterials(void);
EXPORT BOOL BeginScene(void);
EXPORT BOOL EndScene(void);
EXPORT BOOL DrawPoint(int MaterialID,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(int MaterialID,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(int MaterialID,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(int MaterialID,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(int MaterialID,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(int MaterialID,
D3DVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPoint(int MaterialID,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(int MaterialID,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(int MaterialID,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(int MaterialID,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(int MaterialID,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(int MaterialID,
D3DLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPoint(int MaterialID,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawLine(int MaterialID,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawPolyLine(int MaterialID,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangle(int MaterialID,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleFan(int MaterialID,
D3DTLVERTEX *Vertex,DWORD Count);
EXPORT BOOL DrawTriangleStrip(int MaterialID,
D3DTLVERTEX *Vertex,DWORD Count);
protected:
};
EXPORT void DisplayError(HRESULT Code,LPCTSTR File,DWORD Line,...);
extern BOOL g_WindowsIs555;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
// ExpandLimitsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "btedit.h"
#include "debugprint.h"
#include "expandlimitsdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExpandLimitsDlg dialog
CExpandLimitsDlg::CExpandLimitsDlg(CHeightMap *World,CWnd* pParent /*=NULL*/)
: CDialog(CExpandLimitsDlg::IDD, pParent)
{
m_World = World;
m_ExcludeSelected = -1;
m_IncludeSelected = -1;
//{{AFX_DATA_INIT(CExpandLimitsDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CExpandLimitsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExpandLimitsDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExpandLimitsDlg, CDialog)
//{{AFX_MSG_MAP(CExpandLimitsDlg)
ON_CBN_SELCHANGE(IDC_EXCLUDELIST, OnSelchangeExcludelist)
ON_CBN_SELCHANGE(IDC_INCLUDELIST, OnSelchangeIncludelist)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExpandLimitsDlg message handlers
BOOL CExpandLimitsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox *List = (CComboBox*)GetDlgItem(IDC_EXCLUDELIST);
ListNode<CScrollLimits> *TmpNode = m_World->GetScrollLimits();
int ListSize = 0;
char *FirstString;
// Add the strings to the list box.
while(TmpNode!=NULL) {
List->AddString(TmpNode->GetData()->ScriptName);
if(ListSize == 0) {
FirstString = TmpNode->GetData()->ScriptName;
}
ListSize++;
TmpNode = TmpNode->GetNextNode();
}
// Set the default selection.
if(ListSize) {
List->SelectString(-1, FirstString);
m_ExcludeSelected = 0;
}
List = (CComboBox*)GetDlgItem(IDC_INCLUDELIST);
TmpNode = m_World->GetScrollLimits();
ListSize = 0;
// Add the strings to the list box.
while(TmpNode!=NULL) {
List->AddString(TmpNode->GetData()->ScriptName);
if(ListSize == 0) {
FirstString = TmpNode->GetData()->ScriptName;
}
ListSize++;
TmpNode = TmpNode->GetNextNode();
}
// Set the default selection.
if(ListSize) {
List->SelectString(-1, FirstString);
m_IncludeSelected = 0;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CExpandLimitsDlg::OnSelchangeExcludelist()
{
CComboBox *List = (CComboBox*)GetDlgItem(IDC_EXCLUDELIST);
m_ExcludeSelected = List->GetCurSel();
}
void CExpandLimitsDlg::OnSelchangeIncludelist()
{
CComboBox *List = (CComboBox*)GetDlgItem(IDC_INCLUDELIST);
m_IncludeSelected = List->GetCurSel();
}

View File

@ -0,0 +1,47 @@
// ExpandLimitsDlg.h : header file
//
#include "directx.h"
#include "geometry.h"
#include "ddimage.h"
#include "heightmap.h"
/////////////////////////////////////////////////////////////////////////////
// CExpandLimitsDlg dialog
class CExpandLimitsDlg : public CDialog
{
// Construction
public:
CExpandLimitsDlg(CHeightMap *World,CWnd* pParent = NULL); // standard constructor
int GetExcludeSelected(void) { return m_ExcludeSelected; }
int GetIncludeSelected(void) { return m_IncludeSelected; }
// Dialog Data
//{{AFX_DATA(CExpandLimitsDlg)
enum { IDD = IDD_EXPANSIONLIMITS };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExpandLimitsDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
CHeightMap *m_World;
int m_ExcludeSelected;
int m_IncludeSelected;
// Generated message map functions
//{{AFX_MSG(CExpandLimitsDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeExcludelist();
afx_msg void OnSelchangeIncludelist();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -0,0 +1,44 @@
// ExportInfo.cpp : implementation file
//
#include "stdafx.h"
#include "btedit.h"
#include "exportinfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExportInfo dialog
CExportInfo::CExportInfo(CWnd* pParent /*=NULL*/)
: CDialog(CExportInfo::IDD, pParent)
{
//{{AFX_DATA_INIT(CExportInfo)
m_Text = _T("");
//}}AFX_DATA_INIT
}
void CExportInfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExportInfo)
DDX_Text(pDX, IDC_INFOTEXT, m_Text);
DDV_MaxChars(pDX, m_Text, 65536);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExportInfo, CDialog)
//{{AFX_MSG_MAP(CExportInfo)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExportInfo message handlers

View File

@ -0,0 +1,35 @@
// ExportInfo.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CExportInfo dialog
class CExportInfo : public CDialog
{
// Construction
public:
CExportInfo(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CExportInfo)
enum { IDD = IDD_INFO };
CString m_Text;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExportInfo)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CExportInfo)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -0,0 +1,417 @@
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <assert.h>
#include "fileparse.h"
#include "debugprint.h"
CFileParser::CFileParser(void)
{
m_File = NULL;
strcpy(m_Brk,"= \n\r\t");
}
BOOL CFileParser::Create(char *FileName,short Flags)
{
fpos_t Size;
m_Flags = Flags;
m_File = NULL;
if(FileName==NULL) return FALSE;
FILE *Stream = fopen(FileName,"rb");
if(Stream==NULL) return FALSE;
fseek( Stream, 0, SEEK_END);
fgetpos( Stream, &Size);
fseek( Stream, 0, SEEK_SET);
m_File = new char[(int)Size+1];
if(m_File) {
fread(m_File,(unsigned int)Size,1,Stream);
m_File[Size]=0;
}
m_Pos = m_File;
fclose(Stream);
m_BufferSize = (long)Size+1;
m_WasAllocated = TRUE;
strcpy(m_Brk,"= \n\r\t");
return TRUE;
}
CFileParser::CFileParser(FILE *Stream,short Flags)
{
fpos_t Size;
m_Flags = Flags;
m_File = NULL;
fseek( Stream, 0, SEEK_END);
fgetpos( Stream, &Size);
fseek( Stream, 0, SEEK_SET);
m_File = new char[(int)Size+1];
if(m_File) {
fread(m_File,(unsigned int)Size,1,Stream);
m_File[Size]=0;
}
m_Pos = m_File;
m_BufferSize = (long)Size+1;
m_WasAllocated = TRUE;
strcpy(m_Brk,"= \n\r\t");
}
CFileParser::CFileParser(char *Buffer,long BufferSize,short Flags)
{
m_Flags = Flags;
m_File = Buffer;
m_Pos = m_File;
m_BufferSize = BufferSize+1;
m_WasAllocated = FALSE;
strcpy(m_Brk,"= \n\r\t");
}
CFileParser::~CFileParser(void)
{
if(m_WasAllocated) {
if(m_File) {
delete m_File;
}
}
}
void CFileParser::Rewind(void)
{
m_Pos = m_File;
}
BOOL CFileParser::ParseString(char *Ident,char *Word,short Size)
{
char Tmp[256];
if(Ident) {
Parse(Tmp,sizeof(Tmp));
if( (strcmp(Ident,Tmp)!=0) || (Tmp[0]==0) ) {
return FALSE;
}
}
Parse(Word,Size);
return TRUE;
}
BOOL CFileParser::ParseInt(char *Ident,int *Int)
{
char Tmp[256];
if(Ident) {
Parse(Tmp,sizeof(Tmp));
if( (strcmp(Ident,Tmp)!=0) || (Tmp[0]==0) ) {
return FALSE;
}
}
Parse(Tmp,sizeof(Tmp));
*Int = TokenToInt(Tmp);
return TRUE;
}
BOOL CFileParser::ParseFloat(char *Ident,float *Float)
{
char Tmp[256];
if(Ident) {
Parse(Tmp,sizeof(Tmp));
if( (strcmp(Ident,Tmp)!=0) || (Tmp[0]==0) ) {
return FALSE;
}
}
Parse(Tmp,sizeof(Tmp));
*Float = TokenToFloat(Tmp);
return TRUE;
}
BOOL CFileParser::ParseDouble(char *Ident,double *Double)
{
char Tmp[256];
if(Ident) {
Parse(Tmp,sizeof(Tmp));
if( (strcmp(Ident,Tmp)!=0) || (Tmp[0]==0) ) {
return FALSE;
}
}
Parse(Tmp,sizeof(Tmp));
*Double = TokenToDouble(Tmp);
return TRUE;
}
void CFileParser::SetBreakCharacters(char *brk)
{
strcpy(m_Brk,brk);
}
int CFileParser::CountTokens(void)
{
char String[MAXTOKENSIZE];
int NumTokens = 0;
do {
Parse(String,sizeof(String));
if(String[0]) {
NumTokens++;
}
} while(String[0]);
Rewind();
return NumTokens;
}
void CFileParser::Parse(char *Word,short Size)
{
m_LastPos = m_Pos;
if(m_Flags & FP_SKIPCOMMENTS) {
while(1) {
m_Pos = StringSkipBlanks(m_Pos);
if(m_Flags & FP_ASMCOMMENTS) {
if(m_Pos[0]==';') {
// Skip ASM comment.
m_Pos = StringSkipLine(m_Pos);
} else {
break;
}
} else {
if((m_Pos[0]=='/') && (m_Pos[1]=='*')) {
// Skip C comment.
while(!((m_Pos[0]=='*') && (m_Pos[1]=='/'))) {
m_Pos++;
}
m_Pos += 2;
} else if((m_Pos[0]=='/') && (m_Pos[1]=='/')) {
// Skip C++ comment.
m_Pos = StringSkipLine(m_Pos);
} else {
break;
}
}
}
m_Pos = StringNextToken(m_Pos,Word,Size,m_Brk);
} else {
m_Pos = StringSkipBlanks(m_Pos);
m_Pos = StringNextToken(m_Pos,Word,Size,m_Brk);
}
}
void CFileParser::UnParse(void)
{
m_Pos = m_LastPos;
}
TokenID *CFileParser::FindTokenID(char *Token,TokenID *IDLookup)
{
TokenID *TokID = IDLookup;
while(TokID->Token) {
if(strcmp(TokID->Token,Token)==0) {
return TokID;
}
TokID++;
}
return NULL;
}
BOOL CFileParser::FindToken(char *Token)
{
char Tmp[256];
do {
Parse(Tmp,sizeof(Tmp));
if(strcmp(Token,Tmp)==0) {
return TRUE;
}
}
while(*Tmp);
return FALSE;
}
BOOL CFileParser::FindTokenList(char *Token, ...)
{
BOOL FoundFirst;
char *Tok;
char Tmp[256];
va_list args;
FoundFirst = FALSE;
do {
if( (FoundFirst = FindToken(Token)) ) {
// DebugPrint("%s,",Token);
BOOL IsMatch = TRUE;
va_start(args,Token);
do {
Tok = va_arg(args,char*);
if(Tok!=NULL) {
Parse(Tmp,sizeof(Tmp));
// DebugPrint("Tok %s, Tmp %s\n",Tok,Tmp);
if(strcmp(Tmp,Tok)!=0) {
IsMatch=FALSE;
break;
}
}
} while(Tok!=NULL);
va_end(args);
if(IsMatch) {
// DebugPrint("IsMatch\n");
return TRUE;
}
}
} while(FoundFirst);
return FALSE;
}
int CFileParser::TokenToInt(char *Word)
{
return atoi(Word);
}
float CFileParser::TokenToFloat(char *Word)
{
return (float)atof(Word);
}
double CFileParser::TokenToDouble(char *Word)
{
return atof(Word);
}
char *CFileParser::StringNextToken(char *s,char *tok,short toklen,char *brk)
{
short i = 0;
char Break[256];
char *QuoteBreak="\n\r";
BOOL InQuoutes = FALSE;
strcpy(Break,brk);
while(!StringBreakChar(*s,Break) && *s!=0) {
if(m_Flags & FP_QUOTES) {
if(*s == '"') {
if(InQuoutes) {
strcpy(Break,brk);
InQuoutes = FALSE;
} else {
strcpy(Break,QuoteBreak);
InQuoutes = TRUE;
}
} else {
if(i<toklen) {
tok[i++]=StringFixCase(*s);
}
}
} else {
if(i<toklen) {
tok[i++]=StringFixCase(*s);
}
}
s++;
}
tok[i] = 0;
while(StringBreakChar(*s,brk) && *s!=0) s++;
return(s);
}
char CFileParser::StringFixCase(char chr)
{
if(m_Flags & FP_UPPERCASE) {
if( (chr >= 'a') && (chr <='z') ) {
chr -='a'-'A';
}
}
if(m_Flags & FP_LOWERCASE) {
if( (chr >= 'A') && (chr <='Z') ) {
chr +='a'-'A';
}
}
return chr;
}
BOOL CFileParser::StringBreakChar(char chr,char *brk)
{
short i;
for(i = 0; i < (short)strlen(brk); i++) {
if(chr == brk[i]) return(1);
}
return(0);
}
char *CFileParser::StringSkipBlanks(char *p)
{
while( (*p == ' ') || (*p == 9) || (*p == 10) || (*p == 13) ) {
if(*p == 0) return(p);
p++;
}
return(p);
}
char *CFileParser::StringSkipLine(char *p)
{
while( (*p != 10) && (*p != 13) && (*p != 0) ) {
p++;
}
if(*p) {
p = StringSkipBlanks(p);
}
return(p);
}

View File

@ -0,0 +1,68 @@
#ifndef __INCLUDED_FILEPARSER__
#define __INCLUDED_FILEPARSER__
// Valid values for Flags.
#define FP_SKIPCOMMENTS 1 // Comments are skipped.
#define FP_QUOTES 2 // Strings in quotes are parsed as one word.
#define FP_UPPERCASE 4 // Strings are converted to upper case.
#define FP_LOWERCASE 8 // Strings are converted to lower case.
#define FP_ASMCOMMENTS 16 // Comments use assembler form ie ; ( defaults to cpp form ie // )
#define MAXBREAKCHARACTERS 16 // Maximum number of break characters.
#define MAXTOKENSIZE 512
struct TokenID {
char *Token;
int ID;
};
class CFileParser {
public:
CFileParser(void);
BOOL Create(char *FileName,short Flags);
CFileParser(FILE *Stream,short Flags);
CFileParser(char *Buffer,long BufferSize,short Flags);
~CFileParser(void);
void SetFlags(short Flags) { m_Flags = Flags; }
short GetFlags(void) { return m_Flags; }
void SetBreakCharacters(char *brk);
int CountTokens(void);
void Rewind(void);
void Parse(char *Word,short Size);
void UnParse(void);
BOOL ParseInt(char *Ident,int *Int);
BOOL ParseFloat(char *Ident,float *Float);
BOOL ParseDouble(char *Ident,double *Double);
BOOL ParseString(char *Ident,char *Word,short Size);
BOOL FindToken(char *Token);
BOOL FindTokenList(char *Token, ...);
char *GetBase(void) { return m_File; }
char *GetPos(void) { return m_Pos; }
void SetPos(char *Pos) { m_Pos = Pos; }
TokenID *FindTokenID(char *Token,TokenID *IDLookup);
int TokenToInt(char *Word);
float TokenToFloat(char *Word);
double TokenToDouble(char *Word);
protected:
char *StringNextToken(char *s,char *tok,short toklen,char *brk);
char StringFixCase(char chr);
BOOL StringBreakChar(char chr,char *brk);
char *StringSkipBlanks(char *p);
char *StringSkipLine(char *p);
char m_Brk[MAXBREAKCHARACTERS];
short m_Flags;
char *m_File;
char *m_Pos;
char *m_LastPos;
long m_BufferSize;
BOOL m_WasAllocated;
};
#endif

View File

@ -0,0 +1,182 @@
#include "stdafx.h"
#include "btedit.h"
#include "grdland.h"
#include "mainfrm.h"
#include "bteditdoc.h"
#include "mapprefs.h"
#include "textureprefs.h"
#include "dibdraw.h"
#include "debugprint.h"
#include "wfview.h"
#include "textureview.h"
#include "bteditview.h"
#include "snapprefs.h"
#include "savesegmentdialog.h"
#include "limitsdialog.h"
#include "initiallimitsdlg.h"
#include "expandlimitsdlg.h"
#include "playermap.h"
#include "gateinterface.h"
extern "C" BOOL gwInitialise(void);
extern "C" void gwShutDown(void);
extern "C" SDWORD gwGetZone(SDWORD x, SDWORD y);
extern "C" UBYTE **apRLEZones;
// The zone equivalence tables - shows which land zones
// border on a water zone
extern "C" SDWORD gwNumZones;
extern "C" UBYTE *aNumEquiv;
extern "C" UBYTE **apEquivZones;
CHeightMap *g_MapData;
BOOL giWriteZones(FILE *Stream)
{
ZoneMapHeader Header;
Header.version = 2;
Header.numStrips = g_MapData->GetMapHeight();
Header.numZones = gwNumZones;
fwrite(&Header,sizeof(Header),1,Stream);
if(apRLEZones) {
UWORD Size = 0;
for(DWORD y=0; y < g_MapData->GetMapHeight(); y++) {
UBYTE *pCode = apRLEZones[y];
UWORD pos = 0;
UWORD x = 0;
while (x < g_MapData->GetMapWidth()) {
x += pCode[pos];
pos += 2;
}
Size += pos;
// DebugPrint("Zone %d\n",pos);
fwrite(&pos,sizeof(pos),1,Stream); // Size of this strip.
fwrite(apRLEZones[y],pos,1,Stream); // The strip.
}
DebugPrint("Total zone map size %d\n",Size);
Size = 0;
for(int i=0; i < gwNumZones; i++) {
Size += aNumEquiv[i] + sizeof(UBYTE);
fwrite(&aNumEquiv[i],sizeof(UBYTE),1,Stream);
fwrite(apEquivZones[i],aNumEquiv[i],1,Stream);
// DebugPrint("%d : %d\n",i,aNumEquiv[i]);
}
DebugPrint("Total equivalence tables size %d\n",Size);
return TRUE;
}
return FALSE;
}
void giSetMapData(CHeightMap *MapData)
{
g_MapData = MapData;
}
BOOL giCreateZones(void)
{
giClearGatewayFlags();
// Check for and act on returning FALSE;
return gwInitialise();
}
void giDeleteZones(void)
{
gwShutDown();
}
void giUpdateMapZoneIDs(void)
{
for(int z = 0; z< g_MapData->GetMapHeight(); z++) {
for(int x = 0; x< g_MapData->GetMapWidth(); x++) {
g_MapData->SetMapZoneID(x,z,gwGetZone(x,z));
}
}
}
void giClearGatewayFlags(void)
{
for(int z = 0; z< g_MapData->GetMapHeight(); z++) {
for(int x = 0; x< g_MapData->GetMapWidth(); x++) {
g_MapData->SetTileGateway(x,z,FALSE);
}
}
}
// CPP to C interface functions, can be called from standard c modules.
extern "C"
{
int giGetMapWidth(void)
{
return g_MapData->GetMapWidth();
}
int giGetMapHeight(void)
{
return g_MapData->GetMapHeight();
}
void giSetGatewayFlag(int x,int y,BOOL IsGateway)
{
g_MapData->SetTileGateway(x,y,IsGateway);
}
BOOL giIsClifface(int x,int y)
{
return g_MapData->GetTileType(x,y) == TF_TYPECLIFFFACE;
}
BOOL giIsWater(int x,int y)
{
return g_MapData->GetTileType(x,y) == TF_TYPEWATER;
}
BOOL giIsGateway(int x,int y)
{
return g_MapData->GetTileGateway(x,y);
}
int giGetNumGateways(void)
{
return g_MapData->GetNumGateways();
}
BOOL giGetGateway(int Index,int *x0,int *y0,int *x1,int *y1)
{
if(!g_MapData->GetGateway(Index,x0,y0,x1,y1)) {
return FALSE;
}
return TRUE;
}
}

View File

@ -0,0 +1,30 @@
#ifdef __cplusplus
struct ZoneMapHeader {
UWORD version;
UWORD numStrips;
UWORD numZones;
UWORD pad;
};
void giSetMapData(CHeightMap *MapData);
BOOL giCreateZones(void);
void giDeleteZones(void);
void giUpdateMapZoneIDs(void);
void giClearGatewayFlags(void);
BOOL giWriteZones(FILE *Stream);
#else
int giGetMapWidth(void);
int giGetMapHeight(void);
void giSetGatewayFlag(int x,int y,BOOL IsGateway);
BOOL giIsClifface(int x,int y);
BOOL giIsWater(int x,int y);
BOOL giIsGateway(int x,int y);
int giGetNumGateways(void);
BOOL giGetGateway(int Index,int *x0,int *y0,int *x1,int *y1);
#endif

View File

@ -0,0 +1,964 @@
/*
* Gateway.c
*
* Routing gateway code.
*
*/
#ifdef EDITORWORLD
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <math.h>
#define MALLOC(a) malloc(a)
#define FREE(a) free(a); a = NULL;
// ASSERT((psCurr!=NULL, "LIST_REMOVE: " __FILE__ "(%d): entry not found", __LINE__));
#define LIST_REMOVE(psHead, psEntry, TYPE) \
{ \
TYPE *psPrev, *psCurr; \
\
psPrev = NULL; \
for(psCurr = (psHead); psCurr; psCurr = psCurr->psNext) \
{ \
if (psCurr == (psEntry)) \
{ \
break; \
} \
psPrev = psCurr; \
} \
ASSERT((psCurr!=NULL, "LIST_REMOVE: entry not found")); \
if (psPrev == NULL) \
{ \
(psHead) = (psHead)->psNext; \
} \
else if (psCurr != NULL) \
{ \
psPrev->psNext = psCurr->psNext; \
} \
}
#include "typedefs.h"
#define MAP_MAXWIDTH 256
#define MAP_MAXHEIGHT 256
#include "gateinterface.h"
#include "debugprint.h"
#else
// gateway linking printf's
//#define DEBUG_GROUP0
// water gate printf's
//#define DEBUG_GROUP1
#include "frame.h"
#include "map.h"
#endif
#include "gateway.h"
// the list of gateways on the current map
GATEWAY *psGateways;
// the RLE map zones for each tile
UBYTE **apRLEZones;
// the number of map zones
SDWORD gwNumZones;
// The zone equivalence tables - shows which land zones
// border on a water zone
UBYTE *aNumEquiv;
UBYTE **apEquivZones;
// link all the gateways together
BOOL gwLinkGateways(void);
// Initialise the gateway system
BOOL gwInitialise(void)
{
#ifdef EDITORWORLD
int i;
#endif
ASSERT((psGateways == NULL,
"gwInitialise: gatway list has not been reset"));
psGateways = NULL;
#ifdef EDITORWORLD
for(i=0; i<giGetNumGateways(); i++) {
SDWORD x0,y0,x1,y1;
if(!giGetGateway(i,&x0,&y0,&x1,&y1)) {
return FALSE;
}
if(!gwNewGateway(x0,y0,x1,y1)) {
return FALSE;
}
}
// need to handle FALSE.
if(!gwProcessMap()) {
return FALSE;
}
#endif
// if (!gwLinkGateways()) return FALSE;
return TRUE;
}
// Shutdown the gateway system
void gwShutDown(void)
{
GATEWAY *psNext;
while (psGateways != NULL)
{
psNext = psGateways->psNext;
gwFreeGateway(psGateways);
psGateways = psNext;
}
gwFreeZoneMap();
gwFreeEquivTable();
}
// Add a gateway to the system
BOOL gwNewGateway(SDWORD x1, SDWORD y1, SDWORD x2, SDWORD y2)
{
GATEWAY *psNew;
SDWORD pos, temp;
if ((x1 < 0) || (x1 >= gwMapWidth()) ||
(y1 < 0) || (y1 >= gwMapHeight()) ||
(x2 < 0) || (x2 >= gwMapWidth()) ||
(y2 < 0) || (y2 >= gwMapHeight()) ||
((x1 != x2) && (y1 != y2)))
{
ASSERT((FALSE,"gwNewGateway: invalid coordinates"));
return FALSE;
}
psNew = MALLOC(sizeof(GATEWAY));
if (!psNew)
{
DBERROR(("gwNewGateway: out of memory"));
return FALSE;
}
// make sure the first coordinate is always the smallest
if (x2 < x1)
{
// y is the same, swap x
temp = x2;
x2 = x1;
x1 = temp;
}
else if (y2 < y1)
{
// x is the same, swap y
temp = y2;
y2 = y1;
y1 = temp;
}
// initialise the gateway
psNew->x1 = (UBYTE)x1;
psNew->y1 = (UBYTE)y1;
psNew->x2 = (UBYTE)x2;
psNew->y2 = (UBYTE)y2;
psNew->zone1 = 0;
psNew->zone2 = 0;
psNew->psLinks = NULL;
psNew->flags = 0;
// add the gateway to the list
psNew->psNext = psGateways;
psGateways = psNew;
// set the map flags
if (x1 == x2)
{
// vertical gateway
for(pos = y1; pos <= y2; pos++)
{
gwSetGatewayFlag(x1, pos);
}
}
else
{
// horizontal gateway
for(pos = x1; pos <= x2; pos++)
{
gwSetGatewayFlag(pos, y1);
}
}
return TRUE;
}
// Add a land/water link gateway to the system
BOOL gwNewLinkGateway(SDWORD x, SDWORD y)
{
GATEWAY *psNew;
if ((x < 0) || (x >= gwMapWidth()) ||
(y < 0) || (y >= gwMapHeight()))
{
ASSERT((FALSE,"gwNewLinkGateway: invalid coordinates"));
return FALSE;
}
psNew = MALLOC(sizeof(GATEWAY));
if (!psNew)
{
DBERROR(("gwNewGateway: out of memory"));
return FALSE;
}
// initialise the gateway
psNew->x1 = (UBYTE)x;
psNew->y1 = (UBYTE)y;
psNew->x2 = (UBYTE)x;
psNew->y2 = (UBYTE)y;
psNew->zone1 = 0;
psNew->zone2 = 0;
psNew->psLinks = NULL;
psNew->flags = GWR_WATERLINK;
// add the gateway to the list
psNew->psNext = psGateways;
psGateways = psNew;
return TRUE;
}
// scan for a particular zone on the map
// given a start point
static BOOL gwFindZone(SDWORD zone, SDWORD cx, SDWORD cy,
SDWORD *px, SDWORD *py)
{
SDWORD x,y, dist, maxDist;
maxDist = gwMapWidth() > gwMapHeight() ? gwMapWidth() : gwMapHeight();
for(dist = 0; dist < maxDist; dist += 1)
{
// scan accross the top
y = cy - dist;
for(x = cx - dist; x <= cx + dist; x += 1)
{
if (x >= 0 && x < gwMapWidth() &&
y >= 0 && y < gwMapHeight() &&
gwGetZone(x,y) == zone)
{
*px = x;
*py = y;
return TRUE;
}
}
// scan down the left
x = cx - dist;
for(y = cy - dist; y <= cy + dist; y += 1)
{
if (x >= 0 && x < gwMapWidth() &&
y >= 0 && y < gwMapHeight() &&
gwGetZone(x,y) == zone)
{
*px = x;
*py = y;
return TRUE;
}
}
// scan down the right
x = cx + dist;
for(y = cy - dist; y <= cy + dist; y += 1)
{
if (x >= 0 && x < gwMapWidth() &&
y >= 0 && y < gwMapHeight() &&
gwGetZone(x,y) == zone)
{
*px = x;
*py = y;
return TRUE;
}
}
// scan accross the bottom
y = cy + dist;
for(x = cx - dist; x <= cx + dist; x += 1)
{
if (x >= 0 && x < gwMapWidth() &&
y >= 0 && y < gwMapHeight() &&
gwGetZone(x,y) == zone)
{
*px = x;
*py = y;
return TRUE;
}
}
}
return FALSE;
}
// find a rough center position for a zone
static void gwCalcZoneCenter(SDWORD zone, SDWORD *px, SDWORD *py)
{
SDWORD xsum,ysum, numtiles;
SDWORD x,y;
xsum = ysum = numtiles = 0;
for(y=0; y<gwMapHeight(); y+= 1)
{
for(x=0; x<gwMapWidth(); x+= 1)
{
if (gwGetZone(x,y) == zone)
{
xsum += x;
ysum += y;
numtiles += 1;
}
}
}
ASSERT((numtiles != 0,
"gwCalcZoneCenter: zone not found on map"));
x = xsum / numtiles;
y = ysum / numtiles;
if (!gwFindZone(zone, x,y, px,py))
{
*px = x;
*py = y;
}
}
// add the land/water link gateways
BOOL gwGenerateLinkGates(void)
{
SDWORD zone, cx,cy;
ASSERT((apEquivZones != NULL,
"gwGenerateLinkGates: no zone equivalence table"));
DBPRINTF(("Generating water link Gateways...."));
for(zone=0; zone<gwNumZones; zone += 1)
{
if (aNumEquiv[zone] > 0)
{
// got a water zone that borders on land
// find it's center
gwCalcZoneCenter(zone, &cx,&cy);
if (!gwNewLinkGateway(cx,cy))
{
return FALSE;
}
DBP1(("new water link gateway at (%d,%d) for zone %d\n", cx,cy, zone));
}
}
DBPRINTF(("Done\n"));
return TRUE;
}
// Return the number of gateways.
UDWORD gwNumGateways(void)
{
GATEWAY *psCurr;
UDWORD NumGateways = 0;
for(psCurr = psGateways; psCurr; psCurr = psCurr->psNext)
{
NumGateways++;
}
return NumGateways;
}
GATEWAY *gwGetGateways(void)
{
return psGateways;
}
// Release a gateway
void gwFreeGateway(GATEWAY *psDel)
{
SDWORD pos;
LIST_REMOVE(psGateways, psDel, GATEWAY);
// clear the map flags
if (psDel->x1 == psDel->x2)
{
// vertical gateway
for(pos = psDel->y1; pos <= psDel->y2; pos++)
{
gwClearGatewayFlag(psDel->x1, pos);
}
}
else
{
// horizontal gateway
for(pos = psDel->x1; pos <= psDel->x2; pos++)
{
gwClearGatewayFlag(pos, psDel->y1);
}
}
if(psDel->psLinks != NULL) {
FREE(psDel->psLinks);
}
FREE(psDel);
}
// load a gateway list
BOOL gwLoadGateways(UBYTE *pFileBuffer, UDWORD fileSize)
{
SDWORD numGW, x1,y1, x2,y2;
UBYTE *pPos;
// get the number of gateways
pPos = pFileBuffer;
sscanf((STRING *)pPos, "%d", &numGW);
for (; *pPos != '\n' && pPos < (pFileBuffer + fileSize); pPos += 1)
;
pPos += 1;
while ((pPos < (pFileBuffer + fileSize)) && (numGW > 0))
{
sscanf((STRING *)pPos, "%d %d %d %d", &x1,&y1, &x2, &y2);
if (!gwNewGateway(x1,y1, x2,y2))
{
return FALSE;
}
for (; *pPos != '\n' && pPos < (pFileBuffer + fileSize); pPos += 1)
;
pPos += 1;
numGW -= 1;
}
return TRUE;
}
// check if a zone is in the equivalence table for a water zone
BOOL gwZoneInEquiv(SDWORD mainZone, SDWORD checkZone)
{
SDWORD i;
if (apEquivZones == NULL)
{
return FALSE;
}
// ASSERT((apEquivZones != NULL,
// "gwZoneInEquiv: no zone equivalence table"));
for(i=0; i<aNumEquiv[mainZone]; i+= 1)
{
if (apEquivZones[mainZone][i] == checkZone)
{
return TRUE;
}
}
return FALSE;
}
// link all the gateways together
BOOL gwLinkGateways(void)
{
GATEWAY *psCurr, *psLink;
SDWORD x,y, gwX,gwY, zone1Links,zone2Links, link, zone, otherZone;
SDWORD xdiff,ydiff, zoneLinks;
BOOL bZone1, bAddLink;
// initialise the zones for the gateways
for(psCurr = psGateways; psCurr; psCurr = psCurr->psNext)
{
// a gateway is always in it's own zone1
psCurr->zone1 = (UBYTE)gwGetZone(psCurr->x1,psCurr->y1);
if (psCurr->flags & GWR_WATERLINK)
{
// a water link gateway is only in one zone
x = psCurr->x1;
y = psCurr->y1;
}
else if (psCurr->x1 == psCurr->x2)
{
// vertical - go right
x = psCurr->x1 + 1;
y = (psCurr->y2 - psCurr->y1)/2 + psCurr->y1;
}
else
{
// horizontal - go below
x = (psCurr->x2 - psCurr->x1)/2 + psCurr->x1;
y = psCurr->y1 + 1;
}
psCurr->zone2 = (UBYTE)gwGetZone(x,y);
}
// now link all the gateways together
for(psCurr = psGateways; psCurr; psCurr = psCurr->psNext)
{
gwX = (psCurr->x1 + psCurr->x2)/2;
gwY = (psCurr->y1 + psCurr->y2)/2;
// count the number of links
zone1Links = 0;
zone2Links = 0;
for(psLink=psGateways; psLink; psLink=psLink->psNext)
{
if (psLink == psCurr)
{
// don't link a gateway to itself
continue;
}
if ((psLink->zone1 == psCurr->zone1) || (psLink->zone2 == psCurr->zone1) ||
((psLink->flags & GWR_WATERLINK) &&
gwZoneInEquiv(psLink->zone1, psCurr->zone1) &&
!gwZoneInEquiv(psLink->zone1, psCurr->zone2) ))
{
zone1Links += 1;
}
if (psCurr->flags & GWR_WATERLINK)
{
// calculating links for a water link gateway
if (gwZoneInEquiv(psCurr->zone1, psLink->zone1) ||
gwZoneInEquiv(psCurr->zone1, psLink->zone2))
{
zone2Links += 1;
}
}
else if ((psLink->zone1 == psCurr->zone2) || (psLink->zone2 == psCurr->zone2) ||
((psLink->flags & GWR_WATERLINK) &&
gwZoneInEquiv(psLink->zone1, psCurr->zone2) &&
!gwZoneInEquiv(psLink->zone1, psCurr->zone1) ))
{
zone2Links += 1;
}
}
if (zone1Links+zone2Links > 0)
{
psCurr->psLinks = MALLOC(sizeof(GATEWAY_LINK) * (zone1Links+zone2Links));
if (psCurr->psLinks == NULL)
{
DBERROR(("gwLinkGateways: out of memory"));
return FALSE;
}
}
else
{
psCurr->psLinks = NULL;
}
psCurr->zone1Links = (UBYTE)zone1Links;
psCurr->zone2Links = (UBYTE)zone2Links;
// generate the links starting with all those through zone1
link = 0;
zone = psCurr->zone1;
otherZone = psCurr->zone2;
zoneLinks = zone1Links;
bZone1 = TRUE;
while (link < (zone1Links + zone2Links))
{
for(psLink=psGateways; psLink && (link < zoneLinks); psLink=psLink->psNext)
{
if (psLink == psCurr)
{
// don't link a gateway to itself
continue;
}
bAddLink = FALSE;
if (!bZone1 && (psCurr->flags & GWR_WATERLINK))
{
// calculating links for a water link gateway
if (gwZoneInEquiv(psCurr->zone1, psLink->zone1) ||
gwZoneInEquiv(psCurr->zone1, psLink->zone2))
{
bAddLink = TRUE;
}
}
else if ((psLink->zone1 == zone) || (psLink->zone2 == zone) ||
((psLink->flags & GWR_WATERLINK) &&
gwZoneInEquiv(psLink->zone1, zone) &&
!gwZoneInEquiv(psLink->zone1, otherZone) ))
{
bAddLink = TRUE;
}
if (bAddLink)
{
DBP0(("Linking %sgateway (%d,%d)->(%d,%d) through %s to gateway (%d,%d)->(%d,%d)\n",
(psCurr->flags & GWR_WATERLINK) ? "water " : "",
psCurr->x1,psCurr->y1, psCurr->x2,psCurr->y2,
bZone1 ? "zone1" : "zone2",
psLink->x1,psLink->y1, psLink->x2,psLink->y2));
psCurr->psLinks[link].psGateway = psLink;
x = (psLink->x1 + psLink->x2)/2;
y = (psLink->y1 + psLink->y2)/2;
xdiff = x - gwX;
ydiff = y - gwY;
#ifdef WIN32
psCurr->psLinks[link].dist = (SDWORD)sqrt(xdiff*xdiff + ydiff*ydiff);
#else
psCurr->psLinks[link].dist = iSQRT(xdiff*xdiff + ydiff*ydiff);
#endif
link += 1;
}
}
// found all the links to zone1, now do it for zone2
zone = psCurr->zone2;
otherZone = psCurr->zone1;
zoneLinks = zone1Links + zone2Links;
bZone1 = FALSE;
}
}
return TRUE;
}
/******************************************************************************************************/
/* RLE Zone data access functions */
// Get number of zone lines.
UDWORD gwNumZoneLines(void)
{
return gwMapHeight();
}
// Get the size of a zone line.
UDWORD gwZoneLineSize(UDWORD Line)
{
UBYTE *pCode;
UDWORD pos = 0;
UDWORD x = 0;
ASSERT((Line < (UDWORD)gwMapHeight(),"gwNewZoneLine : Invalid line requested"));
ASSERT((apRLEZones != NULL,"gwNewZoneLine : NULL Zone map"));
pCode = apRLEZones[Line];
while (x < (UDWORD)gwMapWidth()) {
x += pCode[pos];
pos += 2;
}
return pos;
}
// Create a new empty zone map but don't allocate the actual zones yet.
//
BOOL gwNewZoneMap(void)
{
UWORD i;
if (apRLEZones != NULL)
{
gwFreeZoneMap();
}
apRLEZones = MALLOC(sizeof(UBYTE *) * gwMapHeight());
if (apRLEZones == NULL)
{
DBERROR(("gwNewZoneMap: Out of memory"));
return FALSE;
}
for(i=0; i< gwMapHeight(); i++)
{
apRLEZones[i] = NULL;
}
return TRUE;
}
// Create a new empty zone map line in the zone map.
//
UBYTE * gwNewZoneLine(UDWORD Line,UDWORD Size)
{
ASSERT((Line < (UDWORD)gwMapHeight(),"gwNewZoneLine : Invalid line requested"));
ASSERT((apRLEZones != NULL,"gwNewZoneLine : NULL Zone map"));
if(apRLEZones[Line] != NULL) {
FREE(apRLEZones[Line]);
}
apRLEZones[Line] = MALLOC(Size);
if (apRLEZones[Line] == NULL)
{
DBERROR(("gwNewZoneLine: Out of memory"));
return NULL;
}
return apRLEZones[Line];
}
// Create a NULL zone map for when there is no zone info loaded
BOOL gwCreateNULLZoneMap(void)
{
SDWORD y;
UBYTE *pBuf;
if (!gwNewZoneMap())
{
return FALSE;
}
for(y=0; y<gwMapHeight(); y++)
{
pBuf = gwNewZoneLine(y, 2);
if (!pBuf)
{
return FALSE;
}
pBuf[0] = (UBYTE)gwMapWidth();
pBuf[1] = 0;
}
return TRUE;
}
// release the RLE Zone map
void gwFreeZoneMap(void)
{
SDWORD i;
if (apRLEZones)
{
for(i=0; i<gwMapHeight(); i++)
{
FREE(apRLEZones[i]);
}
FREE(apRLEZones);
}
}
// Look up the zone for a coordinate
SDWORD gwGetZone(SDWORD x, SDWORD y)
{
SDWORD xPos, zone, rlePos;
ASSERT(((x >= 0) && (x < gwMapWidth()) && (y >= 0) && (y < gwMapHeight()),
"gwGetZone: invalid coordinates"));
rlePos = 0;
xPos = 0;
do
{
xPos += *(apRLEZones[y] + rlePos);
zone = *(apRLEZones[y] + rlePos + 1);
rlePos += 2;
} while (xPos <= x); // xPos is where the next zone starts
return zone;
}
/******************************************************************************************************/
/* Zone equivalence data access functions */
// create an empty equivalence table
BOOL gwNewEquivTable(SDWORD numZones)
{
SDWORD i;
ASSERT((numZones < UBYTE_MAX,
"gwNewEquivTable: invalid number of zones"));
gwNumZones = numZones;
aNumEquiv = MALLOC(sizeof(UBYTE) * numZones);
if (aNumEquiv == NULL)
{
DBERROR(("gwNewEquivTable: out of memory"));
return FALSE;
}
for(i=0; i<numZones; i+=1)
{
aNumEquiv[i] = 0;
}
apEquivZones = MALLOC(sizeof(UBYTE *) * numZones);
if (apEquivZones == NULL)
{
DBERROR(("gwNewEquivTable: out of memory"));
return FALSE;
}
for(i=0; i<numZones; i+=1)
{
apEquivZones[i] = NULL;
}
return TRUE;
}
// release the equivalence table
void gwFreeEquivTable(void)
{
SDWORD i;
if (aNumEquiv)
{
FREE(aNumEquiv);
}
if (apEquivZones)
{
for(i=0; i<gwNumZones; i+=1)
{
if (apEquivZones[i])
{
FREE(apEquivZones[i]);
}
}
FREE(apEquivZones);
}
}
// set the zone equivalence for a zone
BOOL gwSetZoneEquiv(SDWORD zone, SDWORD numEquiv, UBYTE *pEquiv)
{
SDWORD i;
ASSERT((aNumEquiv != NULL && apEquivZones != NULL,
"gwSetZoneEquiv: equivalence arrays not initialised"));
ASSERT((zone < gwNumZones,
"gwSetZoneEquiv: invalid zone"));
ASSERT((numEquiv <= gwNumZones,
"gwSetZoneEquiv: invalid number of zone equivalents"));
apEquivZones[zone] = MALLOC(sizeof(UBYTE) * numEquiv);
if (apEquivZones[zone] == NULL)
{
DBERROR(("gwSetZoneEquiv: out of memory"));
return FALSE;
}
aNumEquiv[zone] = (UBYTE)numEquiv;
for(i=0; i<numEquiv; i+=1)
{
apEquivZones[zone][i] = pEquiv[i];
}
return TRUE;
}
/******************************************************************************************************/
/* Gateway data access functions */
#ifdef EDITORWORLD
// get the size of the map
SDWORD gwMapWidth(void)
{
return giGetMapWidth();
}
SDWORD gwMapHeight(void)
{
return giGetMapHeight();
}
// set the gateway flag on a tile
void gwSetGatewayFlag(SDWORD x, SDWORD y)
{
giSetGatewayFlag(x,y,TRUE);
}
// clear the gateway flag on a tile
void gwClearGatewayFlag(SDWORD x, SDWORD y)
{
giSetGatewayFlag(x,y,FALSE);
}
// check whether a gateway is on water
BOOL gwTileIsWater(UDWORD x, UDWORD y)
{
return giIsWater(x, y);
}
#else
// get the size of the map
SDWORD gwMapWidth(void)
{
return (SDWORD)mapWidth;
}
SDWORD gwMapHeight(void)
{
return (SDWORD)mapHeight;
}
// set the gateway flag on a tile
void gwSetGatewayFlag(SDWORD x, SDWORD y)
{
mapTile((UDWORD)x,(UDWORD)y)->tileInfoBits |= BITS_GATEWAY;
}
// clear the gateway flag on a tile
void gwClearGatewayFlag(SDWORD x, SDWORD y)
{
mapTile((UDWORD)x,(UDWORD)y)->tileInfoBits &= ~BITS_GATEWAY;
}
// check whether a tile is water
BOOL gwTileIsWater(UDWORD x, UDWORD y)
{
return TERRAIN_TYPE(mapTile(x ,y)) == TER_WATER;
}
// check if the gateway flag is set on a tile
/*BOOL gwTileIsGateway(SDWORD x, SDWORD y)
{
return (mapTile((UDWORD)x,(UDWORD)y)->tileInfoBits & BITS_GATEWAY) != 0;
}*/
// get the terrain type of a map tile
/*SDWORD gwTileTerrainType(SDWORD x, SDWORD y)
{
return TERRAIN_TYPE(mapTile((UDWORD)x,(UDWORD)y));
}*/
#endif

View File

@ -0,0 +1,109 @@
/*
* Gateway.h
*
* Interface to routing gateway code.
*
*/
#ifndef _gateway_h
#define _gateway_h
#include "gatewaydef.h"
// the list of gateways on the current map
extern GATEWAY *psGateways;
// the RLE map zones for each tile
extern UBYTE **apRLEZones;
// the number of map zones
extern SDWORD gwNumZones;
// The zone equivalence tables
extern UBYTE *aNumEquiv;
extern UBYTE **apEquivZones;
// Initialise the gateway system
BOOL gwInitialise(void);
// Shutdown the gateway system
void gwShutDown(void);
// Add a gateway to the system
BOOL gwNewGateway(SDWORD x1, SDWORD y1, SDWORD x2, SDWORD y2);
// Add a land/water link gateway to the system
BOOL gwNewLinkGateway(SDWORD x, SDWORD y);
// add the land/water link gateways
BOOL gwGenerateLinkGates(void);
// Release a gateway
void gwFreeGateway(GATEWAY *psDel);
// load a gateway list
BOOL gwLoadGateways(UBYTE *pFileBuffer, UDWORD fileSize);
// Process the map to create all the map zones
BOOL gwProcessMap(void);
// Create a new blank RLE Zone map suitable for creating zones in
BOOL gwCreateBlankZoneMap(void);
// link all the gateways together
BOOL gwLinkGateways(void);
// check if a zone is in the equivalence table for a water zone
BOOL gwZoneInEquiv(SDWORD mainZone, SDWORD checkZone);
// Set the zone for a coordinate
void gwSetZone(SDWORD x, SDWORD y, SDWORD zone);
// Look up the zone for a coordinate
SDWORD gwGetZone(SDWORD x, SDWORD y);
// Create a new empty zone map but don't allocate the actual zones yet.
BOOL gwNewZoneMap(void);
// Create a new empty zone map line in the zone map.
UBYTE * gwNewZoneLine(UDWORD Line,UDWORD Size);
// Create a NULL zone map for when there is no zone info loaded
BOOL gwCreateNULLZoneMap(void);
// release the RLE Zone map
void gwFreeZoneMap(void);
// get the size of the map
SDWORD gwMapWidth(void);
SDWORD gwMapHeight(void);
// set the gateway flag on a tile
void gwSetGatewayFlag(SDWORD x, SDWORD y);
// clear the gateway flag on a tile
void gwClearGatewayFlag(SDWORD x, SDWORD y);
// check whether a tile is water
BOOL gwTileIsWater(UDWORD x, UDWORD y);
// Get number of gateways.
UDWORD gwNumGateways(void);
// Get the gateway list.
GATEWAY *gwGetGateways(void);
// Get number of zone lines.
UDWORD gwNumZoneLines(void);
// Get size of a zone line in bytes.
UDWORD gwZoneLineSize(UDWORD Line);
// create an empty equivalence table
BOOL gwNewEquivTable(SDWORD numZones);
// release the equivalence table
void gwFreeEquivTable(void);
// set the zone equivalence for a zone
BOOL gwSetZoneEquiv(SDWORD zone, SDWORD numEquiv, UBYTE *pEquiv);
#endif

View File

@ -0,0 +1,61 @@
/*
* GatewayDef.h
*
* Structure definitions for routing gateways.
*
*/
#ifndef _gatewaydef_h
#define _gatewaydef_h
typedef struct _gateway_link
{
struct _gateway *psGateway;
SDWORD dist;
} GATEWAY_LINK;
typedef struct _gateway
{
UBYTE x1,y1, x2,y2;
UBYTE zone1; // zone to the left/above the gateway
UBYTE zone2; // zone to the right/below the gateway
struct _gateway *psNext;
GATEWAY_LINK *psLinks; // array of links to other zones
UBYTE zone1Links; // number of links
UBYTE zone2Links;
// Data for the gateway router
UBYTE flags; // open or closed node
SWORD dist, est; // distance so far and estimate to end
struct _gateway *psOpen;
struct _gateway *psRoute; // Previous point in the route
} GATEWAY;
// types of node for the gateway router
enum _gw_node_flags
{
GWR_OPEN = 0x01,
GWR_CLOSED = 0x02,
GWR_ZONE1 = 0x04, // the route goes from zone1 to zone2
GWR_ZONE2 = 0x08, // the route goes from zone2 to zone1
GWR_INROUTE = 0x10, // the gateway is part of the final route
GWR_BLOCKED = 0x20, // the gateway is totally blocked
GWR_WATERLINK = 0x80, // the gateway is a land/water link
};
// the flags reset by the router
#define GWR_RESET_MASK 0x7f
// the maximum width and height of the map
#define GW_MAP_MAXWIDTH (MAP_MAXWIDTH - 1)
#define GW_MAP_MAXHEIGHT (MAP_MAXHEIGHT - 1)
#endif

View File

View File

@ -0,0 +1,660 @@
/*
* Additional functions for the Gateway system.
* Only needed for map preprocessing.
*
*/
#ifdef WIN32
// segment printf's
//#define DEBUG_GROUP1
// stack printf's
//#define DEBUG_GROUP2
// gwProcessMap printf's
//#define DEBUG_GROUP3
// RLE zone map size
//#define DEBUG_GROUP4
// equivalence printf's
//#define DEBUG_GROUP5
#ifdef EDITORWORLD
#include <malloc.h>
#define MALLOC(a) malloc(a)
#define FREE(a) free(a); a = NULL;
#include "typedefs.h"
#define MAP_MAXWIDTH 256
#define MAP_MAXHEIGHT 256
#include "gateinterface.h"
#include "debugprint.h"
#else
#include "frame.h"
#include "map.h"
#endif
#include "assert.h"
#include "gateway.h"
// Structures and defines for SeedFill().
typedef int Pixel; /* 1-channel frame buffer assumed */
struct FRect { /* window: a discrete 2-D rectangle */
int x0, y0; /* xmin and ymin */
int x1, y1; /* xmax and ymax (inclusive) */
};
struct Segment {
int y; //
int xl; // Filled horizontal segment of scanline y for xl<=x<=xr.
int xr; // Parent segment was on line y-dy. dy=1 or -1
int dy; //
};
#define MAX 10000 /* max depth of stack */
#define PUSH(Y, XL, XR, DY) /* push new segment on stack */ \
DBP2(("PUSH y %d x %d->%d dy %d\n", Y, XL, XR, DY)); \
if (sp<stack+MAX) \
{sp->y = Y; sp->xl = XL; sp->xr = XR; sp->dy = DY; sp++;}
#define POP(Y, XL, XR, DY) /* pop segment off stack */ \
{sp--; Y = sp->y+(DY = sp->dy); XL = sp->xl; XR = sp->xr;} \
DBP2(("POP y %d x %d->%d dy %d\n", Y, XL, XR, DY));
// whether the flood fill is running over water
BOOL bGwWaterFlood = FALSE;;
// check for a blocking tile for the flood fill
BOOL gwFloodBlock(SDWORD x, SDWORD y);
// generate the zone equivalence tables
BOOL gwGenerateZoneEquiv(SDWORD numZones);
#ifdef WIN32
#define ENABLEFILL // disable this on the psx
#endif
#ifdef ENABLEFILL
struct Segment stack[MAX], *sp = stack; /* stack of filled segments */
#endif
// Flood fill a map zone from a given point
// stopping at blocking tiles
/*
* fill: set the pixel at (x,y) and all of its 4-connected neighbors
* with the same pixel value to the new pixel value nv.
* A 4-connected neighbor is a pixel above, below, left, or right of a pixel.
*/
void gwSeedFill(SDWORD x, SDWORD y, SDWORD nv)
{
#ifdef ENABLEFILL
int l, x1, x2, dy;
Pixel ov; /* old pixel value */
#ifdef WIN32
struct Segment stack[MAX], *sp = stack; /* stack of filled segments */
#endif
ov = gwGetZone(x, y); /* read pv at seed point */
if (ov==nv) {
return;
}
PUSH(y, x, x, 1); /* needed in some cases */
PUSH(y+1, x, x, -1); /* seed segment (popped 1st) */
while (sp>stack) {
/* pop segment off stack and fill a neighboring scan line */
POP(y, x1, x2, dy);
/*
* segment of scan line y-dy for x1<=x<=x2 was previously filled,
* now explore adjacent pixels in scan line y
*/
DBP1(("-ve (%d,%d)->", x1,y));
for (x=x1; !gwFloodBlock(x,y) && (gwGetZone(x, y)==ov); x--) {
gwSetZone(x, y, nv);
}
DBP1(("(%d,%d) %s\n", x+1,y, x<x1?"OK":""));
if (x>=x1) {
goto skip;
}
l = x+1;
if (l<x1) {
PUSH(y, l, x1-1, -dy); /* leak on left? */
}
x = x1+1;
do {
DBP1(("+ve (%d,%d)->", x,y));
for (;!gwFloodBlock(x,y) && (gwGetZone(x, y)==ov); x++) {
gwSetZone(x, y, nv);
}
DBP1(("(%d,%d) %s\n", x-1,y, (x>l)&&(x>x1+1)?"OK":""));
PUSH(y, l, x-1, dy);
if (x>x2+1) {
PUSH(y, x2+1, x-1, -dy); /* leak on right? */
}
skip:
for (x++; x<=x2 && (gwFloodBlock(x,y) || gwGetZone(x, y)!=ov); x++);
l = x;
} while (x<=x2);
}
#else
// GODDAM *#!! LOWERCASE assert IS ABSOLUTELY NO %^$## USE ON THE PC
// assert(2+2==5);
ASSERT((FALSE, "gwSeedFill disabled"));
#endif
}
// set the tiles a gateway covers to a zone
void gwSetGatewayZone(GATEWAY *psGate, SDWORD zone)
{
SDWORD pos;
if (psGate->x1 == psGate->x2)
{
for(pos = psGate->y1; pos <= psGate->y2; pos++)
{
gwSetZone(psGate->x1, pos, zone);
}
}
else
{
for(pos = psGate->x1; pos <= psGate->x2; pos++)
{
gwSetZone(pos, psGate->y1, zone);
}
}
}
// find the first zone on a line
SDWORD gwFindFirstZone(SDWORD y)
{
SDWORD x, zone;
zone = 0;
while (zone == 0 && y < gwMapHeight())
{
for(x=0; x<gwMapWidth() && zone == 0; x+= 1)
{
zone = gwGetZone(x,y);
}
y++;
}
return zone;
}
// Process the map to create all the map zones
BOOL gwProcessMap(void)
{
GATEWAY *psCurr;
SDWORD currZone, zoneTest;
SDWORD floodX,floodY;
SDWORD gatewayZone;
SDWORD prevZone, nextZone, x,y;
// create the blank zone map
if (!gwCreateBlankZoneMap())
{
return FALSE;
}
// nothing more to do if there are no gateways
if (psGateways == NULL)
{
return TRUE;
}
// reset the gateway zone entries
for(psCurr = psGateways; psCurr; psCurr = psCurr->psNext)
{
psCurr->zone1 = 0;
psCurr->zone2 = 0;
}
// flood fill from all the gateways
psCurr = psGateways;
currZone = 1;
do
{
DBP3(("Processing gateway (%d,%d)->(%d,%d)\n",
psCurr->x1,psCurr->y1, psCurr->x2,psCurr->y2));
// do a flood fill from the current gateway
if (psCurr->zone1 == 0)
{
// first zone is left/above
if (psCurr->x1 == psCurr->x2)
{
// vertical - go left
floodX = psCurr->x1 - 1;
floodY = (psCurr->y2 - psCurr->y1)/2 + psCurr->y1;
}
else
{
// horizontal - go above
floodX = (psCurr->x2 - psCurr->x1)/2 + psCurr->x1;
floodY = psCurr->y1 - 1;
}
}
else // psCurr->zone2 == 0
{
// second zone is right/below
if (psCurr->x1 == psCurr->x2)
{
// vertical - go right
floodX = psCurr->x1 + 1;
floodY = (psCurr->y2 - psCurr->y1)/2 + psCurr->y1;
}
else
{
// horizontal - go below
floodX = (psCurr->x2 - psCurr->x1)/2 + psCurr->x1;
floodY = psCurr->y1 + 1;
}
}
// see if a previous flood fill reached this gateway
zoneTest = gwGetZone(floodX,floodY);
if (zoneTest != 0)
{
// simple case just have to link the gateway to the zone
gatewayZone = zoneTest;
}
else
{
// check the zones havn't overflowed
if (currZone > UBYTE_MAX)
{
DBERROR(("gwProcessMap: too many zones\n"));
return FALSE;
}
// floodFill
if (gwTileIsWater(floodX,floodY))
{
bGwWaterFlood = TRUE;
}
gwSeedFill(floodX,floodY, currZone);
bGwWaterFlood = FALSE;
gatewayZone = currZone;
currZone += 1;
}
// set the gateway zone
if (psCurr->zone1 == 0)
{
psCurr->zone1 = (UBYTE)gatewayZone;
// the gateway is always in it's own zone1
gwSetGatewayZone(psCurr, gatewayZone);
}
else
{
psCurr->zone2 = (UBYTE)gatewayZone;
}
// see if there are any gateways left to process
for(psCurr=psGateways; psCurr; psCurr = psCurr->psNext)
{
if ((psCurr->zone1 == 0) || (psCurr->zone2 == 0))
{
break;
}
}
} while (psCurr != NULL);
// fill in any areas that are left
for(y=0; y<gwMapHeight(); y+= 1)
{
for(x=0; x<gwMapWidth(); x+= 1)
{
if (gwTileIsWater(x,y) &&
gwGetZone(x,y) == 0)
{
// check the zones havn't overflowed
if (currZone > UBYTE_MAX)
{
DBERROR(("gwProcessMap: too many zones\n"));
return FALSE;
}
bGwWaterFlood = TRUE;
gwSeedFill(x,y, currZone);
bGwWaterFlood = FALSE;
currZone += 1;
}
else if (!gwFloodBlock(x,y) &&
gwGetZone(x,y) == 0)
{
// check the zones havn't overflowed
if (currZone > UBYTE_MAX)
{
DBERROR(("gwProcessMap: too many zones\n"));
return FALSE;
}
gwSeedFill(x,y, currZone);
currZone += 1;
}
}
}
// now average out the zones so that blocking tiles are in the same zone as their neighbour
for(y=0; y<gwMapHeight(); y+= 1)
{
prevZone = gwFindFirstZone(y);
for(x=0; x<gwMapWidth(); x+= 1)
{
nextZone = gwGetZone(x,y);
if (gwFloodBlock(x,y) && nextZone == 0)
{
gwSetZone(x,y, prevZone);
}
else if (nextZone != 0)
{
prevZone = nextZone;
}
}
}
#ifdef DEBUG_GROUP4
{
SDWORD x,y, size, pos;
UBYTE *pCode;
size = gwMapHeight() * sizeof(UBYTE *);
for(y=0; y<gwMapHeight(); y+=1)
{
pCode = apRLEZones[y];
pos = 0;
x = 0;
while (x < gwMapWidth())
{
x += pCode[pos];
pos += 2;
size += 2;
}
}
DBP4(("Gateway Zones : %d\n", currZone));
DBP4(("RLE Zone map size: %d\n", size));
}
#endif
if (!gwGenerateZoneEquiv(currZone))
{
return FALSE;
}
return TRUE;
}
// see if a zone is already in the equivalence array
static BOOL gwEquivZonePresent(UBYTE *aEquiv, SDWORD numEquiv, SDWORD zone)
{
SDWORD i;
for(i=0; i<numEquiv; i++)
{
if (aEquiv[i] == zone)
{
return TRUE;
}
}
return FALSE;
}
// check a neighbour tile for equivalence
static void gwCheckNeighbourEquiv(SDWORD zone, SDWORD x, SDWORD y)
{
SDWORD nZone;
nZone = gwGetZone(x,y);
if (nZone != zone &&
!gwFloodBlock(x,y) &&
!gwEquivZonePresent(apEquivZones[zone], aNumEquiv[zone], nZone))
{
DBP5(("zone %d equivalent to zone %d\n", zone, nZone));
apEquivZones[zone][aNumEquiv[zone]] = (UBYTE)nZone;
aNumEquiv[zone] += 1;
}
}
// generate the zone equivalence tables
BOOL gwGenerateZoneEquiv(SDWORD numZones)
{
SDWORD x,y, i;
UBYTE aEquiv[UBYTE_MAX];
SDWORD numEquiv, localZone;
if (apEquivZones == NULL)
{
if (!gwNewEquivTable(numZones))
{
return FALSE;
}
}
// just allocate the maximum space when generating the table
memset(aEquiv, 0, sizeof(aEquiv));
for(i=0; i<gwNumZones; i+= 1)
{
if (!gwSetZoneEquiv(i, gwNumZones, aEquiv))
{
return FALSE;
}
aNumEquiv[i] = 0;
}
// go over the map - skipping edge tiles to avoid going over the
// edge of the map
numEquiv = 0;
for(y=1; y<gwMapHeight()-1; y+= 1)
{
for(x=1; x<gwMapWidth()-1; x+= 1)
{
if (gwTileIsWater(x,y))
{
// found a water tile - see if it is next to a different zone
localZone = gwGetZone(x,y);
gwCheckNeighbourEquiv(localZone, x-1,y);
gwCheckNeighbourEquiv(localZone, x,y-1);
gwCheckNeighbourEquiv(localZone, x+1,y);
gwCheckNeighbourEquiv(localZone, x,y+1);
}
}
}
return TRUE;
}
/******************************************************************************************************/
/* RLE Zone data access functions */
// Create a new blank RLE Zone map suitable for creating zones in
BOOL gwCreateBlankZoneMap(void)
{
SDWORD i;
if (apRLEZones != NULL)
{
gwFreeZoneMap();
}
apRLEZones = MALLOC(sizeof(UBYTE *) * gwMapHeight());
if (apRLEZones == NULL)
{
DBERROR(("gwCreateBlankZoneMap: Out of memory"));
return FALSE;
}
for(i=0; i< gwMapHeight(); i++)
{
#ifdef WIN32
apRLEZones[i] = MALLOC(gwMapWidth() * 2);
#else
apRLEZones[i] = MALLOC(1 * 2); // we need to get some memory back
#endif
if (apRLEZones[i] == NULL)
{
DBERROR(("gwCreateBlankZoneMap: Out of memory"));
return FALSE;
}
}
// set all the zones to zero
for(i=0; i<gwMapHeight(); i++)
{
*apRLEZones[i] = (UBYTE)gwMapWidth();
*(apRLEZones[i] + 1) = 0;
}
return TRUE;
}
// Decompress a line of the zone map
// pBuffer should point to a buffer of gwMapWidth() bytes
void gwDecompressLine(SDWORD line, UBYTE *pBuffer)
{
SDWORD rlePos, bufPos, count,zone, store;
rlePos = 0;
bufPos = 0;
while (bufPos < gwMapWidth())
{
count = *(apRLEZones[line] + rlePos);
zone = *(apRLEZones[line] + rlePos + 1);
rlePos += 2;
for(store=0; store < count; store ++)
{
ASSERT((bufPos < gwMapWidth(),
"gwDecompressLine: Invalid RLE code"));
pBuffer[bufPos] = (UBYTE)zone;
bufPos += 1;
}
}
}
// Compress a line of the zone map
// pBuffer should point to a buffer of gwMapWidth() bytes
void gwCompressLine(SDWORD line, UBYTE *pBuffer)
{
SDWORD rlePos, bufPos, count,zone;
rlePos = 0;
bufPos = 0;
while (bufPos < gwMapWidth())
{
zone = pBuffer[bufPos];
count = 0;
while ((pBuffer[bufPos] == zone) && (bufPos < gwMapWidth()))
{
count += 1;
bufPos += 1;
}
*(apRLEZones[line] + rlePos) = (UBYTE)count;
*(apRLEZones[line] + rlePos + 1) = (UBYTE)zone;
rlePos += 2;
}
}
// Set the zone for a coordinate
void gwSetZone(SDWORD x, SDWORD y, SDWORD zone)
{
UBYTE aBuffer[GW_MAP_MAXWIDTH];
ASSERT(((x >= 0) && (x < gwMapWidth()) && (y >= 0) && (y < gwMapHeight()),
"gwSetZone: invalid coordinates"));
gwDecompressLine(y, aBuffer);
aBuffer[x] = (UBYTE)zone;
gwCompressLine(y, aBuffer);
}
/******************************************************************************************************/
/* Gateway data access functions */
#ifdef EDITORWORLD
BOOL gwFloodBlock(SDWORD x, SDWORD y)
{
// MAPTILE *psTile;
// SDWORD type;
// BOOL gateway;
if ((x < 0) || (x >= gwMapWidth()) ||
(y < 0) || (y >= gwMapHeight()))
{
return TRUE;
}
// psTile = mapTile(x,y);
// type = TERRAIN_TYPE(psTile);
// gateway = (psTile->tileInfoBits & BITS_GATEWAY) != 0;
// return (type == TER_CLIFFFACE) || (type == TER_WATER) || gateway;
return giIsGateway(x,y) ||
( !bGwWaterFlood && (giIsClifface(x,y) || giIsWater(x,y))) ||
( bGwWaterFlood && !giIsWater(x,y) );
// return giIsClifface(x,y) || giIsWater(x,y) || giIsGateway(x,y);
}
#else
// check for a blocking tile for the flood fill
BOOL gwFloodBlock(SDWORD x, SDWORD y)
{
MAPTILE *psTile;
SDWORD type;
BOOL gateway;
if ((x < 0) || (x >= gwMapWidth()) ||
(y < 0) || (y >= gwMapHeight()))
{
return TRUE;
}
psTile = mapTile(x,y);
type = TERRAIN_TYPE(psTile);
gateway = (psTile->tileInfoBits & BITS_GATEWAY) != 0;
return gateway ||
( !bGwWaterFlood && ((type == TER_CLIFFFACE) || (type == TER_WATER))) ||
( bGwWaterFlood && (type != TER_WATER) );
}
#endif
#endif

View File

@ -0,0 +1,891 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <math.h>
#include "d3dwrap.h"
//#include "debugprint.h"
//#include "geometry.h"
//#include "directx.h"
float Distance2D(float x,float y)
{
float Dist = sqrt(x*x + y*y);
return Dist;
}
float Distance3D(float x,float y,float z)
{
return sqrt(x*x + y*y + z*z);
}
CGeometry::CGeometry(ID3D *Direct3D,ID3DDEVICE *Device,ID3DVIEPORT *Viewport)
{
// Matrix for projecting 3d view onto a 2d screen surface
D3DMATRIX InitProj = {
D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0),
D3DVAL(0.0), D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0),
D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(1.0),
D3DVAL(0.0), D3DVAL(0.0), D3DVAL(-512.0), D3DVAL(0.0)
// D3DVAL(0.0), D3DVAL(0.0), D3DVAL(-8.0), D3DVAL(0.0)
};
D3DMATRIX InitView = {
D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0),
D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0),
D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0),
D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0), D3DVAL(1.0)
};
D3DMATRIX InitIdentity = {
D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0),
D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0),
D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0),
D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0)
};
m_Direct3D = Direct3D;
m_3DDevice = Device;
m_Viewport = Viewport;
m_proj=InitProj;
m_view=InitView;
m_identity=InitIdentity;
// Set the view, world and projection matrices
// Create a buffer for matrix set commands etc.
m_3DDevice->BeginScene();
m_3DDevice->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &m_proj);
m_3DDevice->SetTransform(D3DTRANSFORMSTATE_VIEW, &m_view);
m_3DDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &m_world);
m_3DDevice->EndScene();
for(int i=0; i<MAXLIGHTS; i++) {
m_Lights[i].InUse = 0;
}
m_MatrixStackPos = 0;
}
CGeometry::~CGeometry()
{
for(int i=0; i<MAXLIGHTS; i++) {
RemoveLight(i);
}
}
void CGeometry::ConcatenateXRotation(LPD3DMATRIX lpM, float Degrees )
{
float Temp01, Temp11, Temp21, Temp31;
float Temp02, Temp12, Temp22, Temp32;
float aElements[4][4];
float Radians = (float)((Degrees/360) * M_PI * 2.0);
float Sin = (float)sin(Radians), Cos = (float)cos(Radians);
memcpy(aElements, lpM, sizeof(D3DMATRIX));
Temp01 = aElements[0][1] * Cos + aElements[0][2] * Sin;
Temp11 = aElements[1][1] * Cos + aElements[1][2] * Sin;
Temp21 = aElements[2][1] * Cos + aElements[2][2] * Sin;
Temp31 = aElements[3][1] * Cos + aElements[3][2] * Sin;
Temp02 = aElements[0][1] * -Sin + aElements[0][2] * Cos;
Temp12 = aElements[1][1] * -Sin + aElements[1][2] * Cos;
Temp22 = aElements[2][1] * -Sin + aElements[2][2] * Cos;
Temp32 = aElements[3][1] * -Sin + aElements[3][2] * Cos;
lpM->_12 = Temp01;
lpM->_22 = Temp11;
lpM->_32 = Temp21;
lpM->_42 = Temp31;
lpM->_13 = Temp02;
lpM->_23 = Temp12;
lpM->_33 = Temp22;
lpM->_43 = Temp32;
}
void CGeometry::ConcatenateYRotation(LPD3DMATRIX lpM, float Degrees )
{
float Temp00, Temp10, Temp20, Temp30;
float Temp02, Temp12, Temp22, Temp32;
float aElements[4][4];
float Radians = (float)((Degrees/360) * M_PI * 2);
float Sin = (float)sin(Radians), Cos = (float)cos(Radians);
memcpy(aElements, lpM, sizeof(D3DMATRIX));
Temp00 = aElements[0][0] * Cos + aElements[0][2] * -Sin;
Temp10 = aElements[1][0] * Cos + aElements[1][2] * -Sin;
Temp20 = aElements[2][0] * Cos + aElements[2][2] * -Sin;
Temp30 = aElements[3][0] * Cos + aElements[3][2] * -Sin;
Temp02 = aElements[0][0] * Sin + aElements[0][2] * Cos;
Temp12 = aElements[1][0] * Sin + aElements[1][2] * Cos;
Temp22 = aElements[2][0] * Sin + aElements[2][2] * Cos;
Temp32 = aElements[3][0] * Sin + aElements[3][2] * Cos;
lpM->_11 = Temp00;
lpM->_21 = Temp10;
lpM->_31 = Temp20;
lpM->_41 = Temp30;
lpM->_13 = Temp02;
lpM->_23 = Temp12;
lpM->_33 = Temp22;
lpM->_43 = Temp32;
}
void CGeometry::ConcatenateZRotation(LPD3DMATRIX lpM, float Degrees )
{
float Temp00, Temp10, Temp20, Temp30;
float Temp01, Temp11, Temp21, Temp31;
float aElements[4][4];
float Radians = (float)((Degrees/360) * M_PI * 2);
float Sin = (float)sin(Radians), Cos = (float)cos(Radians);
memcpy(aElements, lpM, sizeof(D3DMATRIX));
Temp00 = aElements[0][0] * Cos + aElements[0][1] * Sin;
Temp10 = aElements[1][0] * Cos + aElements[1][1] * Sin;
Temp20 = aElements[2][0] * Cos + aElements[2][1] * Sin;
Temp30 = aElements[3][0] * Cos + aElements[3][1] * Sin;
Temp01 = aElements[0][0] * -Sin + aElements[0][1] * Cos;
Temp11 = aElements[1][0] * -Sin + aElements[1][1] * Cos;
Temp21 = aElements[2][0] * -Sin + aElements[2][1] * Cos;
Temp31 = aElements[3][0] * -Sin + aElements[3][1] * Cos;
lpM->_11 = Temp00;
lpM->_21 = Temp10;
lpM->_31 = Temp20;
lpM->_41 = Temp30;
lpM->_12 = Temp01;
lpM->_22 = Temp11;
lpM->_32 = Temp21;
lpM->_42 = Temp31;
}
/*
* Normalises the vector v
*/
LPD3DVECTOR CGeometry::D3DVECTORNormalise(LPD3DVECTOR v)
{
float vx, vy, vz, inv_mod;
vx = v->x;
vy = v->y;
vz = v->z;
if ((vx == 0) && (vy == 0) && (vz == 0)) {
return v;
}
inv_mod = (float)(1.0 / sqrt(vx*vx + vy*vy + vz*vz));
v->x = vx * inv_mod;
v->y = vy * inv_mod;
v->z = vz * inv_mod;
return v;
}
/*
* Calculates cross product of a and b.
*/
LPD3DVECTOR CGeometry::D3DVECTORCrossProduct(LPD3DVECTOR lpd, LPD3DVECTOR lpa, LPD3DVECTOR lpb)
{
lpd->x = lpa->y * lpb->z - lpa->z * lpb->y;
lpd->y = lpa->z * lpb->x - lpa->x * lpb->z;
lpd->z = lpa->x * lpb->y - lpa->y * lpb->x;
return lpd;
}
/*
* lpDst = lpSrc1 * lpSrc2
* lpDst can be equal to lpSrc1 or lpSrc2
*/
LPD3DMATRIX CGeometry::MultiplyD3DMATRIX(LPD3DMATRIX lpDst, LPD3DMATRIX lpSrc1,
LPD3DMATRIX lpSrc2)
{
D3DVALUE M1[4][4], M2[4][4], D[4][4];
int i, r, c;
memcpy(&M1[0][0], lpSrc1, sizeof(D3DMATRIX));
memcpy(&M2[0][0], lpSrc2, sizeof(D3DMATRIX));
for (r = 0; r < 4; r++) {
for (c = 0; c < 4; c++) {
D[r][c] = (float)0.0;
for (i = 0; i < 4; i++)
D[r][c] += M1[r][i] * M2[i][c];
}
}
memcpy(lpDst, &D[0][0], sizeof(D3DMATRIX));
return lpDst;
}
/*
* -1 d = a
*/
LPD3DMATRIX CGeometry::D3DMATRIXInvert(LPD3DMATRIX d, LPD3DMATRIX a)
{
d->_11 = a->_11;
d->_12 = a->_21;
d->_13 = a->_31;
d->_14 = a->_14;
d->_21 = a->_12;
d->_22 = a->_22;
d->_23 = a->_32;
d->_24 = a->_24;
d->_31 = a->_13;
d->_32 = a->_23;
d->_33 = a->_33;
d->_34 = a->_34;
d->_41 = a->_14;
d->_42 = a->_24;
d->_43 = a->_34;
d->_44 = a->_44;
return d;
}
/*
* Set the rotation part of a matrix such that the vector lpD is the new
* z-axis and lpU is the new y-axis.
*/
LPD3DMATRIX CGeometry::D3DMATRIXSetRotation(LPD3DMATRIX lpM, LPD3DVECTOR lpD, LPD3DVECTOR lpU)
{
float t;
D3DVECTOR d, u, r;
/*
* Normalise the direction vector.
*/
d.x = lpD->x;
d.y = lpD->y;
d.z = lpD->z;
D3DVECTORNormalise(&d);
u.x = lpU->x;
u.y = lpU->y;
u.z = lpU->z;
/*
* Project u into the plane defined by d and normalise.
*/
t = u.x * d.x + u.y * d.y + u.z * d.z;
u.x -= d.x * t;
u.y -= d.y * t;
u.z -= d.z * t;
D3DVECTORNormalise(&u);
/*
* Calculate the vector pointing along the matrix x axis (in a right
* handed coordinate system) using cross product.
*/
D3DVECTORCrossProduct(&r, &u, &d);
lpM->_11 = r.x;
lpM->_12 = r.y, lpM->_13 = r.z;
lpM->_21 = u.x;
lpM->_22 = u.y, lpM->_23 = u.z;
lpM->_31 = d.x;
lpM->_32 = d.y;
lpM->_33 = d.z;
return lpM;
}
void CGeometry::CalcNormal(D3DVECTOR *v0,D3DVECTOR *v1,D3DVECTOR *v2,D3DVECTOR *Normal)
{
D3DVECTOR nvec;
nvec.x = (v0->y - v1->y) * (v0->z + v1->z);
nvec.y = (v0->z - v1->z) * (v0->x + v1->x);
nvec.z = (v0->x - v1->x) * (v0->y + v1->y);
nvec.x += (v1->y - v2->y) * (v1->z + v2->z);
nvec.y += (v1->z - v2->z) * (v1->x + v2->x);
nvec.z += (v1->x - v2->x) * (v1->y + v2->y);
nvec.x += (v2->y - v0->y) * (v2->z + v0->z);
nvec.y += (v2->z - v0->z) * (v2->x + v0->x);
nvec.z += (v2->x - v0->x) * (v2->y + v0->y);
D3DVECTORNormalise(&nvec);
*Normal=nvec;
}
// Calculate plane equation given three vertecies on the plane.
//
void CGeometry::CalcPlaneEquation(D3DVECTOR *v0,D3DVECTOR *v1,D3DVECTOR *v2,D3DVECTOR *Normal,float *Offset)
{
D3DVECTOR refpt;
D3DVECTOR nvec;
D3DVECTOR tnorm;
float len;
// Compute the polygon's normal and a reference point on
// the plane. Note that the actual reference point is
// refpt / 3.
nvec.x = (v0->y - v1->y) * (v0->z + v1->z);
nvec.y = (v0->z - v1->z) * (v0->x + v1->x);
nvec.z = (v0->x - v1->x) * (v0->y + v1->y);
VecCopy(&refpt,v0);
nvec.x += (v1->y - v2->y) * (v1->z + v2->z);
nvec.y += (v1->z - v2->z) * (v1->x + v2->x);
nvec.z += (v1->x - v2->x) * (v1->y + v2->y);
VecInc(&refpt,v1);
nvec.x += (v2->y - v0->y) * (v2->z + v0->z);
nvec.y += (v2->z - v0->z) * (v2->x + v0->x);
nvec.z += (v2->x - v0->x) * (v2->y + v0->y);
VecInc(&refpt,v2);
// Normalize the polygon nvec to obtain the first
// three coefficients of the plane equation.
len = (float)VecLength(&nvec);
tnorm.x = nvec.x / len;
tnorm.y = nvec.y / len;
tnorm.z = nvec.z / len;
// Compute the last coefficient of the plane equation.
len *= 3;
*Offset = (float)(-VecDot(&refpt,&nvec) / len);
Normal->x = tnorm.x;
Normal->y = tnorm.y;
Normal->z = tnorm.z;
}
void CGeometry::SetWorldMatrix(D3DVECTOR *CameraRotation)
{
m_world = m_identity;
ConcatenateYRotation(&m_world, CameraRotation->y);
ConcatenateXRotation(&m_world, CameraRotation->x);
ConcatenateZRotation(&m_world, CameraRotation->z);
}
void CGeometry::PushWorldMatrix(void)
{
ASSERT(m_MatrixStackPos < MAXMATRIXSTACKSIZE);
m_MatrixStack[m_MatrixStackPos] = m_world;
m_MatrixStackPos++;
}
void CGeometry::PopWorldMatrix(void)
{
ASSERT(m_MatrixStackPos > 0);
m_MatrixStackPos--;
m_world = m_MatrixStack[m_MatrixStackPos];
}
void CGeometry::PushMatrix(D3DMATRIX &Matrix)
{
ASSERT(m_MatrixStackPos < MAXMATRIXSTACKSIZE);
m_MatrixStack[m_MatrixStackPos] = Matrix;
m_MatrixStackPos++;
}
void CGeometry::PopMatrix(D3DMATRIX &Matrix)
{
ASSERT(m_MatrixStackPos > 0);
m_MatrixStackPos--;
Matrix = m_MatrixStack[m_MatrixStackPos];
}
// Rotate an array of 2d vectors about a given angle, also translates them after rotating.
//
void CGeometry::RotateVector2D(VECTOR2D *Vector,VECTOR2D *TVector,VECTOR2D *Pos,float Angle,int Count)
{
float Rot = (float)((Angle/360) * M_PI * 2.0);
float Cos = cos(Rot);
float Sin = sin(Rot);
float ox = 0.0F;
float oy = 0.0F;
if(Pos) {
ox = Pos->x;
oy = Pos->y;
}
VECTOR2D *Vec = Vector;
VECTOR2D *TVec = TVector;
for(int i=0; i<Count; i++) {
TVec->x = ( Vec->x*Cos + Vec->y*Sin ) + ox;
TVec->y = ( Vec->y*Cos - Vec->x*Sin ) + oy;
Vec++;
TVec++;
}
}
// Calculates a normalized direction vector pointing in the specified direction.
//
void CGeometry::DirectionVector(D3DVECTOR &Rotation,D3DVECTOR &Direction)
{
Direction.x = 0.0F;
Direction.y = 0.0F;
Direction.z = 0.0F;
Motion(Direction,Rotation,1.0F);
}
//typedef struct _D3DMATRIX {
// D3DVALUE _11, _12, _13, _14;
// D3DVALUE _21, _22, _23, _24;
// D3DVALUE _31, _32, _33, _34;
// D3DVALUE _41, _42, _43, _44;
//} D3DMATRIX, *LPD3DMATRIX;
// Multiply a vector by the world matrix.
//
void CGeometry::RotateVector(D3DVECTOR *Vector,D3DVECTOR *Result)
{
float x,y,z;
x = Vector->x*m_world._11 + Vector->y*m_world._21 + Vector->z*m_world._31;
y = Vector->x*m_world._12 + Vector->y*m_world._22 + Vector->z*m_world._32;
z = Vector->x*m_world._13 + Vector->y*m_world._23 + Vector->z*m_world._33;
Result->x = x;
Result->y = y;
Result->z = z;
}
void CGeometry::SetObjectMatrix(D3DVECTOR *ObjectRotation,D3DVECTOR *ObjectPosition,D3DVECTOR *CameraPosition)
{
D3DVECTOR RelVec;
m_spin = m_identity;
ConcatenateXRotation(&m_spin, ObjectRotation->x);
ConcatenateZRotation(&m_spin, ObjectRotation->z);
ConcatenateYRotation(&m_spin, ObjectRotation->y);
// Calculate position of the object relative to the camera.
RelVec.x= ObjectPosition->x-CameraPosition->x;
RelVec.y= ObjectPosition->y-CameraPosition->y;
RelVec.z= ObjectPosition->z-CameraPosition->z;
// Set the translation in the object matrix.
SetTranslation(&m_spin,&RelVec);
}
void CGeometry::SetObjectScale(D3DVECTOR *Vector)
{
SetScale(&m_spin,Vector);
}
void CGeometry::MulObjectMatrix(D3DMATRIX *Matrix)
{
MultiplyD3DMATRIX(&m_spin, Matrix, &m_spin);
}
BOOL CGeometry::SetTransformation(void)
{
HRESULT ddrval;
MultiplyD3DMATRIX(&m_world, &m_spin, &m_world);
DXCALL(m_3DDevice->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &m_proj));
DXCALL(m_3DDevice->SetTransform(D3DTRANSFORMSTATE_VIEW, &m_view));
DXCALL(m_3DDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &m_world));
return TRUE;
}
void CGeometry::SetTranslation(LPD3DMATRIX Matrix,D3DVECTOR *Vector)
{
Matrix->_41=Vector->x;
Matrix->_42=Vector->y;
Matrix->_43=Vector->z;
}
void CGeometry::SetScale(LPD3DMATRIX Matrix,D3DVECTOR *Vector)
{
Matrix->_11*=Vector->x;
Matrix->_22*=Vector->y;
Matrix->_33*=Vector->z;
}
#define FARCLIP (PATCHSIZE*3)
BOOL CGeometry::TransformVertex(D3DVERTEX *Dest,D3DVERTEX *Source,DWORD NumVertices,D3DHVERTEX *HVertex,BOOL Clipped)
{
D3DTRANSFORMDATA TransformData;
DWORD OffScreen;
HRESULT ddrval;
BOOL FreeHV=FALSE;
if(HVertex==NULL) {
HVertex = new D3DHVERTEX[NumVertices];
FreeHV=TRUE;
}
ASSERT(NumVertices <= 8);
memset(&TransformData,0,sizeof(TransformData));
TransformData.dwSize=sizeof(TransformData);
TransformData.lpIn=Source;
TransformData.dwInSize=sizeof(D3DVERTEX);
TransformData.lpOut=Dest;
TransformData.dwOutSize=sizeof(D3DVERTEX);
TransformData.lpHOut=HVertex;
TransformData.dwClip=0;
TransformData.dwClipIntersection = 0;
if(Clipped) {
DXCALL(m_Viewport->TransformVertices(NumVertices,&TransformData,D3DTRANSFORM_CLIPPED,&OffScreen));
} else {
DXCALL(m_Viewport->TransformVertices(NumVertices,&TransformData,D3DTRANSFORM_UNCLIPPED,&OffScreen));
}
if(FreeHV) {
delete HVertex;
}
return(OffScreen ? FALSE : TRUE);
}
void CGeometry::Motion(D3DVECTOR &Position,D3DVECTOR &Angle,float Speed)
{
D3DVECTOR RadAngle;
RadAngle.x=RADIANS(Angle.x);
RadAngle.y=RADIANS(Angle.y);
RadAngle.z=RADIANS(Angle.z);
Position.z+=( ((float)cos(RadAngle.y)) * ((float)cos(RadAngle.x)) ) * Speed;
Position.x+=( ((float)sin(RadAngle.y)) * ((float)cos(RadAngle.x)) ) * Speed;
Position.y+=-((float)sin(RadAngle.x)) * Speed;
}
void CGeometry::LookAt(D3DVECTOR &Target,D3DVECTOR &Position,D3DVECTOR &Rotation)
{
Rotation.y = DEGREES(atan2(Position.x-Target.x ,Position.z-Target.z)+M_PI);
Rotation.x = DEGREES(atan2(Position.y-Target.y ,Distance2D(Position.x-Target.x,Position.z-Target.z))+M_PI) - 180.0F;
}
float CGeometry::Orbit(D3DVECTOR &Position,D3DVECTOR &Rotation,D3DVECTOR &Center,float Angle,float Radius,float Step)
{
float Rads = RADIANS(Angle);
Position.x = -sin(Rads) * Radius;
Position.z = -cos(Rads) * Radius;
Position.x += Center.x;
Position.z += Center.z;
LookAt(Center,Position,Rotation);
Angle += Step;
return Angle;
}
/*
* Calculates a point along a B-Spline curve defined by four points. p
* n output, contain the point. t Position
* along the curve between p2 and p3. This position is a float between 0
* and 1. p1, p2, p3, p4 Points defining spline curve. p, at parameter
* t along the spline curve
*/
void CGeometry::spline(LPD3DVECTOR p, float t, LPD3DVECTOR p1, LPD3DVECTOR p2,
LPD3DVECTOR p3, LPD3DVECTOR p4)
{
double t2, t3;
float m1, m2, m3, m4;
t2 = (double)(t * t);
t3 = t2 * (double)t;
m1 = (float)((-1.0 * t3) + (2.0 * t2) + (-1.0 * (double)t));
m2 = (float)((3.0 * t3) + (-5.0 * t2) + (0.0 * (double)t) + 2.0);
m3 = (float)((-3.0 * t3) + (4.0 * t2) + (1.0 * (double)t));
m4 = (float)((1.0 * t3) + (-1.0 * t2) + (0.0 * (double)t));
m1 /= (float)2.0;
m2 /= (float)2.0;
m3 /= (float)2.0;
m4 /= (float)2.0;
p->x = p1->x * m1 + p2->x * m2 + p3->x * m3 + p4->x * m4;
p->y = p1->y * m1 + p2->y * m2 + p3->y * m3 + p4->y * m4;
p->z = p1->z * m1 + p2->z * m2 + p3->z * m3 + p4->z * m4;
}
void CGeometry::FindAverageVec(D3DVECTOR *v0,D3DVECTOR *v1,D3DVECTOR *v2,D3DVECTOR *Average)
{
float ax=v0->x;
float ay=v0->y;
float az=v0->z;
ax+=v1->x; ay+=v1->y; az+=v1->z;
ax+=v2->x; ay+=v2->y; az+=v2->z;
ax/=3; ay/=3; az/=3;
Average->x=ax;
Average->y=ay;
Average->z=az;
}
BOOL CGeometry::PointInFace(float XPos,float YPos,D3DVECTOR *v0,D3DVECTOR *v1,D3DVECTOR *v2)
{
DWORD l=0;
l=CheckEdge(v0,v1,XPos,YPos,l);
l=CheckEdge(v1,v2,XPos,YPos,l);
l=CheckEdge(v2,v0,XPos,YPos,l);
if(l&1) {
return TRUE;
}
return FALSE;
}
/*
UWORD CheckEdge(SVEC2D *v0,SVEC2D *v1,SLONG x,SLONG z,UWORD l)
AUTHOR: Paul Dunning
DESCRIPTION: Check polygon edge against point. Compares the vector of the specified point
and the specified edge, if the point vector crosses the edge then returns l+1
else returns l.
PARAMETERS: SVEC2D *v0; Pointer to edge vertex 0.
SVEC2D *v1; Pointer to edge vertex 1.
SLONG x; X coord of point to test.
SLONG z; Z coord of point to test.
UWORD l; Edge count.
RETURNS: UWORD l; Updated edge count.
*/
DWORD CGeometry::CheckEdge(D3DVECTOR *v0,D3DVECTOR *v1,float x,float y,DWORD l)
{
float md,m,b;
DWORD fa,fb;
if(v0->y == v1->y) return(l);
fa=fb=0;
if(v0->y < y) fa=1;
if(v1->y < y) fb=1;
if(fa==fb) return(l);
fa=fb=0;
if(v0->x < x) fa=1;
if(v1->x < x) fb=1;
if(fa & fb) {
l++;
return(l);
}
if((fa|fb)==0) return(l);
md = v1->x - v0->x;
if(md!=0) {
m = (v1->y - v0->y) / md;
b = (v1->y - y) - m*(v1->x - x);
if((b/m) > 0) {
l++;
}
}
return(l);
}
int CGeometry::AddLight(DWORD Type)
{
for(int i=0; i<MAXLIGHTS; i++) {
if(m_Lights[i].InUse == 0) {
memset(&m_Lights[i].LightDesc, 0, sizeof(D3DLIGHT));
m_Lights[i].LightDesc.dwSize = sizeof(D3DLIGHT);
m_Lights[i].LightDesc.dltType = (D3DLIGHTTYPE)Type;
m_Lights[i].LightDesc.dcvColor.r = D3DVAL(1.0);
m_Lights[i].LightDesc.dcvColor.g = D3DVAL(1.0);
m_Lights[i].LightDesc.dcvColor.b = D3DVAL(1.0);
m_Lights[i].LightDesc.dcvColor.a = D3DVAL(1.0);
m_Lights[i].LightDesc.dvPosition.x = D3DVAL(0);
m_Lights[i].LightDesc.dvPosition.y = D3DVAL(5000);
m_Lights[i].LightDesc.dvPosition.z = D3DVAL(0);
m_Lights[i].LightDesc.dvDirection.x = D3DVAL(0);
m_Lights[i].LightDesc.dvDirection.y = D3DVAL(-1);
m_Lights[i].LightDesc.dvDirection.z = D3DVAL(0);
m_Lights[i].LightDesc.dvRange = D3DVAL(4000);
m_Lights[i].LightDesc.dvFalloff = D3DVAL(0);
m_Lights[i].LightDesc.dvTheta = D3DVAL(1);
m_Lights[i].LightDesc.dvPhi = D3DVAL(10);
m_Lights[i].LightDesc.dvAttenuation0 = D3DVAL(0.5);
m_Lights[i].LightDesc.dvAttenuation1 = D3DVAL(0.0);
m_Lights[i].LightDesc.dvAttenuation2 = D3DVAL(0.0);
m_Lights[i].Position.x = D3DVAL(0);
m_Lights[i].Position.y = D3DVAL(5000);
m_Lights[i].Position.z = D3DVAL(0);
m_Lights[i].Direction.x = D3DVAL(0);
m_Lights[i].Direction.y = D3DVAL(-1);
m_Lights[i].Direction.z = D3DVAL(0);
m_Lights[i].Transform = TRUE;
m_Lights[i].InUse++;
HRESULT ddrval;
DXCALL_INT(m_Direct3D->CreateLight(&m_Lights[i].Light, NULL));
DXCALL_INT(m_Lights[i].Light->SetLight(&m_Lights[i].LightDesc));
DXCALL_INT(m_Viewport->AddLight(m_Lights[i].Light));
return i;
}
}
return -1;
}
BOOL CGeometry::RemoveLight(int LightID)
{
ASSERT((LightID < MAXLIGHTS) && (LightID >= 0));
if(m_Lights[LightID].InUse) {
HRESULT ddrval;
DXCALL(m_Viewport->DeleteLight(m_Lights[LightID].Light));
DXCALL(m_Lights[LightID].Light->Release());
m_Lights[LightID].InUse=0;
}
return TRUE;
}
void CGeometry::SetTransform(int LightID,BOOL Transform)
{
m_Lights[LightID].Transform = Transform;
}
void CGeometry::SetLightPosition(int LightID,D3DVECTOR *Position)
{
ASSERT((LightID < MAXLIGHTS) && (LightID >= 0));
if(m_Lights[LightID].InUse) {
m_Lights[LightID].Position = *Position;
}
}
void CGeometry::SetLightDirection(int LightID,D3DVECTOR *Direction)
{
ASSERT((LightID < MAXLIGHTS) && (LightID >= 0));
if(m_Lights[LightID].InUse) {
m_Lights[LightID].Direction = *Direction;
}
}
void CGeometry::SetLightColour(int LightID,D3DCOLORVALUE *Colour)
{
ASSERT((LightID < MAXLIGHTS) && (LightID >= 0));
if(m_Lights[LightID].InUse) {
m_Lights[LightID].LightDesc.dcvColor = *Colour;
}
}
void CGeometry::SetLightRange(int LightID,float Range)
{
ASSERT((LightID < MAXLIGHTS) && (LightID >= 0));
if(m_Lights[LightID].InUse) {
m_Lights[LightID].LightDesc.dvRange = D3DVAL(Range);
}
}
void CGeometry::SetLightFalloff(int LightID,float Falloff)
{
ASSERT((LightID < MAXLIGHTS) && (LightID >= 0));
if(m_Lights[LightID].InUse) {
m_Lights[LightID].LightDesc.dvFalloff = D3DVAL(Falloff);
}
}
void CGeometry::SetLightCone(int LightID,float Umbra,float Penumbra)
{
ASSERT((LightID < MAXLIGHTS) && (LightID >= 0));
if(m_Lights[LightID].InUse) {
m_Lights[LightID].LightDesc.dvTheta = D3DVAL(Umbra);
m_Lights[LightID].LightDesc.dvPhi = D3DVAL(Penumbra);
}
}
void CGeometry::SetLightAttenuation(int LightID,float Att0,float Att1,float Att2)
{
ASSERT((LightID < MAXLIGHTS) && (LightID >= 0));
if(m_Lights[LightID].InUse) {
m_Lights[LightID].LightDesc.dvAttenuation0 = D3DVAL(Att0);
m_Lights[LightID].LightDesc.dvAttenuation1 = D3DVAL(Att1);
m_Lights[LightID].LightDesc.dvAttenuation2 = D3DVAL(Att2);
}
}
BOOL CGeometry::TransformLights(D3DVECTOR *CameraRotation,D3DVECTOR *CameraPosition)
{
HRESULT ddrval;
for(int i=0; i<MAXLIGHTS; i++) {
if(m_Lights[i].InUse) {
D3DVECTOR RelVec = m_Lights[i].Position;
RelVec.x -= CameraPosition->x;
RelVec.y -= CameraPosition->y;
RelVec.z -= CameraPosition->z;
SetWorldMatrix(CameraRotation);
RotateVector(&RelVec,&m_Lights[i].LightDesc.dvPosition);
if(m_Lights[i].Transform) {
RelVec = m_Lights[i].Direction;
RotateVector(&RelVec,&m_Lights[i].LightDesc.dvDirection);
}
DXCALL(m_Lights[i].Light->SetLight(&m_Lights[i].LightDesc));
}
}
return TRUE;
}

View File

@ -0,0 +1,116 @@
#ifndef _INCLUDED_GEOMETRY_
#define _INCLUDED_GEOMETRY_
#include <ddraw.h>
#include <d3d.h>
#include "typedefs.h"
#include "macros.h"
#ifdef DLLEXPORT
#define EXPORT __declspec (dllexport)
#else
#define EXPORT
#endif
#define VecZero(v) ( (v)->x = (v)->y = (v)->z = 0.0 )
#define VecLength(v) ( sqrt((v)->x * (v)->x + (v)->y * (v)->y + (v)->z * (v)->z) )
#define VecDot(u,v) ( (u)->x * (v)->x + (u)->y * (v)->y + (u)->z * (v)->z )
#define VecInc(u,v) ( (u)->x += (v)->x, (u)->y += (v)->y, (u)->z += (v)->z )
#define VecSub(a,b,c) ( (c)->x = (a)->x - (b)->x, (c)->y = (a)->y - (b)->y, (c)->z = (a)->z - (b)->z )
#define VecAdd(a,b,c) ( (c)->x = (a)->x + (b)->x, (c)->y = (a)->y + (b)->y, (c)->z = (a)->z + (b)->z )
#define VecCopy(a,b) ( (a)->x = (b)->x, (a)->y = (b)->y, (a)->z = (b)->z )
#define VecDiv(u,d) ( (u)->x /= (d), (u)->y /= (d), (u)->z /= (d) )
#define MAXLIGHTS 64
struct LightSource {
int InUse;
BOOL Transform;
D3DVECTOR Position;
D3DVECTOR Direction;
D3DLIGHT LightDesc;
LPDIRECT3DLIGHT Light;
};
struct VECTOR2D {
float x;
float y;
};
#define MAXMATRIXSTACKSIZE 8
#define M_PI (3.14159265358979323846)
#define RADIANS(Degs) (float)(((Degs)/360) * (M_PI * 2.0))
#define DEGREES(Rads) (float)(((Rads)*360) / (M_PI * 2.0))
class CGeometry {
public:
EXPORT CGeometry(ID3D *Direct3D,ID3DDEVICE *Device,ID3DVIEPORT *Viewport);
EXPORT ~CGeometry(void);
EXPORT void SetTransState(void);
EXPORT void GetIdentity(D3DMATRIX *Matrix) { *Matrix = m_identity; }
EXPORT void ConcatenateXRotation(LPD3DMATRIX lpM, float Degrees );
EXPORT void ConcatenateYRotation(LPD3DMATRIX lpM, float Degrees );
EXPORT void ConcatenateZRotation(LPD3DMATRIX lpM, float Degrees );
EXPORT LPD3DVECTOR D3DVECTORNormalise(LPD3DVECTOR v);
EXPORT LPD3DVECTOR D3DVECTORCrossProduct(LPD3DVECTOR lpd, LPD3DVECTOR lpa, LPD3DVECTOR lpb);
EXPORT LPD3DMATRIX MultiplyD3DMATRIX(LPD3DMATRIX lpDst, LPD3DMATRIX lpSrc1, LPD3DMATRIX lpSrc2);
EXPORT LPD3DMATRIX D3DMATRIXInvert(LPD3DMATRIX d, LPD3DMATRIX a);
EXPORT LPD3DMATRIX D3DMATRIXSetRotation(LPD3DMATRIX lpM, LPD3DVECTOR lpD, LPD3DVECTOR lpU);
EXPORT void DirectionVector(D3DVECTOR &Rotation,D3DVECTOR &Direction);
EXPORT void RotateVector2D(VECTOR2D *Vector,VECTOR2D *TVector,VECTOR2D *Pos,float Angle,int Count);
EXPORT BOOL RotateTranslateProject(D3DVECTOR *Vector,D3DVECTOR *Result);
EXPORT void RotateVector(D3DVECTOR *Vector,D3DVECTOR *Result);
EXPORT void spline(LPD3DVECTOR p, float t, LPD3DVECTOR p1, LPD3DVECTOR p2, LPD3DVECTOR p3, LPD3DVECTOR p4);
EXPORT void CalcNormal(D3DVECTOR *v0,D3DVECTOR *v1,D3DVECTOR *v2,D3DVECTOR *Normal);
EXPORT void CalcPlaneEquation(D3DVECTOR *v0,D3DVECTOR *v1,D3DVECTOR *v2,D3DVECTOR *Normal,float *Offset);
EXPORT void SetWorldMatrix(D3DVECTOR *CameraRotation);
EXPORT void PushWorldMatrix(void);
EXPORT void PopWorldMatrix(void);
EXPORT void PushMatrix(D3DMATRIX &Matrix);
EXPORT void PopMatrix(D3DMATRIX &Matrix);
EXPORT void SetObjectMatrix(D3DVECTOR *ObjectRotation,D3DVECTOR *ObjectPosition,D3DVECTOR *CameraPosition);
EXPORT void SetObjectScale(D3DVECTOR *Vector);
EXPORT void MulObjectMatrix(D3DMATRIX *Matrix);
EXPORT BOOL SetTransformation(void);
EXPORT void SetTranslation(LPD3DMATRIX Matrix,D3DVECTOR *Vector);
EXPORT void SetScale(LPD3DMATRIX Matrix,D3DVECTOR *Vector);
EXPORT BOOL TransformVertex(D3DVERTEX *Dest,D3DVERTEX *Source,DWORD NumVertices,D3DHVERTEX *HVertex=NULL,BOOL Clipped=TRUE);
EXPORT void InverseTransformVertex(D3DVECTOR *Dest,D3DVECTOR *Source);
EXPORT void Motion(D3DVECTOR &Position,D3DVECTOR &Angle,float Speed);
EXPORT void LookAt(D3DVECTOR &Target,D3DVECTOR &Position,D3DVECTOR &Rotation);
EXPORT float Orbit(D3DVECTOR &Position,D3DVECTOR &Rotation,D3DVECTOR &Center,float Angle,float Radius,float Step);
EXPORT void FindAverageVec(D3DVECTOR *v0,D3DVECTOR *v1,D3DVECTOR *v2,D3DVECTOR *Average);
EXPORT BOOL PointInFace(float Xpos,float YPos,D3DVECTOR *v0,D3DVECTOR *v1,D3DVECTOR *v2);
EXPORT DWORD CheckEdge(D3DVECTOR *v0,D3DVECTOR *v1,float x,float y,DWORD l);
EXPORT int AddLight(DWORD Type);
EXPORT void SetTransform(int LightID,BOOL Transform);
EXPORT void SetLightPosition(int LightID,D3DVECTOR *Position);
EXPORT void SetLightDirection(int LightID,D3DVECTOR *Rotation);
EXPORT void SetLightColour(int LightID,D3DCOLORVALUE *Colour);
EXPORT void SetLightRange(int LightID,float Range);
EXPORT void SetLightFalloff(int LightID,float Falloff);
EXPORT void SetLightCone(int LightID,float Umbra,float Penumbra);
EXPORT void SetLightAttenuation(int LightID,float Att0,float Att1,float Att2);
EXPORT BOOL RemoveLight(int LightID);
EXPORT BOOL TransformLights(D3DVECTOR *CameraRotation,D3DVECTOR *CameraPosition);
protected:
LightSource m_Lights[MAXLIGHTS];
D3DMATRIXHANDLE m_hProj, m_hView, m_hWorld;
D3DMATRIX m_proj;
D3DMATRIX m_view;
D3DMATRIX m_identity;
D3DMATRIX m_world;
D3DMATRIX m_spin;
ID3D *m_Direct3D;
ID3DDEVICE *m_3DDevice;
ID3DVIEPORT *m_Viewport;
int m_MatrixStackPos;
D3DMATRIX m_MatrixStack[MAXMATRIXSTACKSIZE];
};
#endif

View File

@ -0,0 +1,370 @@
//#include "stdafx.h"
#include "windows.h"
#include "windowsx.h"
#include "stdio.h"
#include "typedefs.h"
#include "debugprint.h"
#include "grdland.h"
#define GRDLANDVERSION 4
DWORD Version;
CGrdTileIO::CGrdTileIO(void)
{
}
CGrdTileIO::~CGrdTileIO(void)
{
}
void CGrdTileIO::SetTextureID(DWORD TMapID)
{
m_TMapID = TMapID;
}
void CGrdTileIO::SetVertexFlip(DWORD VertexFlip)
{
m_VertexFlip = VertexFlip;
}
void CGrdTileIO::SetTextureFlip(DWORD TextureFlip)
{
m_TextureFlip = TextureFlip;
}
void CGrdTileIO::SetVertexHeight(DWORD Index,float y)
{
ASSERT(Index<4);
m_Height[Index] = y;
}
BOOL CGrdTileIO::Write(FILE *Stream)
{
fprintf(Stream," TID %d VF %d TF %d ",m_TMapID,m_VertexFlip,m_TextureFlip);
fprintf(Stream,"F %d ",m_Flags);
fprintf(Stream,"VH %d %d %d %d\n",(DWORD)m_Height[0],(DWORD)m_Height[1],
(DWORD)m_Height[2],(DWORD)m_Height[3]);
return TRUE;
}
DWORD CGrdTileIO::GetTextureID(void)
{
return m_TMapID;
}
DWORD CGrdTileIO::GetVertexFlip(void)
{
return m_VertexFlip;
}
DWORD CGrdTileIO::GetTextureFlip(void)
{
return m_TextureFlip;
}
float CGrdTileIO::GetVertexHeight(DWORD Index)
{
ASSERT(Index < 4);
return m_Height[Index];
}
BOOL CGrdTileIO::Read(FILE *Stream)
{
SLONG tmp;
CHECKTRUE(ReadLong(Stream,"TID",(LONG*)&m_TMapID));
CHECKTRUE(ReadLong(Stream,"VF",(LONG*)&m_VertexFlip));
CHECKTRUE(ReadLong(Stream,"TF",(LONG*)&m_TextureFlip));
if(Version >= 1) {
CHECKTRUE(ReadLong(Stream,"F",(LONG*)&m_Flags));
} else {
m_Flags = 0;
}
CHECKTRUE(ReadLong(Stream,"VH",&tmp));
m_Height[0]=(float)tmp;
CHECKTRUE(ReadLong(Stream,NULL,&tmp));
m_Height[1]=(float)tmp;
CHECKTRUE(ReadLong(Stream,NULL,&tmp));
m_Height[2]=(float)tmp;
CHECKTRUE(ReadLong(Stream,NULL,&tmp));
m_Height[3]=(float)tmp;
return TRUE;
}
CGrdLandIO::CGrdLandIO(void)
{
m_TextureNames = NULL;
m_Tiles = NULL;
Version = GRDLANDVERSION;
m_Version = Version;
}
CGrdLandIO::~CGrdLandIO(void)
{
DWORD i;
if(m_TextureNames) {
for(i=0; i<m_NumTextures; i++) {
if(m_TextureNames[i]) delete m_TextureNames[i];
}
delete m_TextureNames;
}
if(m_Tiles) {
for(i=0; i<m_NumTiles; i++) {
if(m_Tiles[i]) delete m_Tiles[i];
}
delete m_Tiles;
}
}
void CGrdLandIO::SetTextureSize(DWORD TextureWidth,DWORD TextureHeight)
{
m_TextureWidth = TextureWidth;
m_TextureHeight = TextureHeight;
}
void CGrdLandIO::SetCameraPosition(float x,float y,float z)
{
m_CameraXPos = x;
m_CameraYPos = y;
m_CameraZPos = z;
}
void CGrdLandIO::SetCameraRotation(float x,float y,float z)
{
m_CameraXRot = x;
m_CameraYRot = y;
m_CameraZRot = z;
}
void CGrdLandIO::Set2DPosition(SLONG ScrollX,SLONG ScrollY)
{
m_ScrollX = ScrollX;
m_ScrollY = ScrollY;
}
void CGrdLandIO::SetHeightScale(DWORD HeightScale)
{
m_HeightScale = HeightScale;
}
void CGrdLandIO::SetMapSize(DWORD MapWidth,DWORD MapHeight)
{
DWORD i;
m_MapWidth = MapWidth;
m_MapHeight = MapHeight;
m_NumTiles = m_MapWidth*m_MapHeight;
m_Tiles = new CGrdTileIO*[m_NumTiles];
for(i=0; i<m_NumTiles; i++) {
m_Tiles[i] = new CGrdTileIO;
}
}
void CGrdLandIO::SetTileSize(DWORD TileWidth,DWORD TileHeight)
{
m_TileWidth = TileWidth;
m_TileHeight = TileHeight;
}
CGrdTileIO *CGrdLandIO::GetTile(DWORD Index)
{
ASSERT(Index < m_NumTiles);
return m_Tiles[Index];
}
void CGrdLandIO::SetNumTextures(DWORD NumTextures)
{
DWORD i;
m_NumTextures = NumTextures;
m_TextureNames = new char*[m_NumTextures];
for(i=0; i<m_NumTextures; i++) {
m_TextureNames[i] = NULL;
}
}
void CGrdLandIO::SetTextureName(DWORD NameIndex,char *TextureName)
{
ASSERT(NameIndex < m_NumTextures);
m_TextureNames[NameIndex] = new char[strlen(TextureName)+1];
strcpy(m_TextureNames[NameIndex],TextureName);
}
BOOL CGrdLandIO::Write(FILE *Stream)
{
DWORD i;
Version = GRDLANDVERSION;
m_Version = Version;
fprintf(Stream,"GrdLand {\n");
fprintf(Stream," Version %d\n",Version);
fprintf(Stream," 3DPosition %f %f %f\n",m_CameraXPos,m_CameraYPos,m_CameraZPos);
fprintf(Stream," 3DRotation %f %f %f\n",m_CameraXRot,m_CameraYRot,m_CameraZRot);
fprintf(Stream," 2DPosition %d %d\n",m_ScrollX,m_ScrollY);
fprintf(Stream," CustomSnap %d %d\n",m_SnapX,m_SnapZ);
fprintf(Stream," SnapMode %d\n",m_SnapMode);
fprintf(Stream," Gravity %d\n",m_EnableGravity);
fprintf(Stream," HeightScale %d\n",m_HeightScale);
fprintf(Stream," MapWidth %d\n",m_MapWidth);
fprintf(Stream," MapHeight %d\n",m_MapHeight);
fprintf(Stream," TileWidth %d\n",m_TileWidth);
fprintf(Stream," TileHeight %d\n",m_TileHeight);
fprintf(Stream," SeaLevel %d\n",m_SeaLevel);
fprintf(Stream," TextureWidth %d\n",m_TextureWidth);
fprintf(Stream," TextureHeight %d\n",m_TextureHeight);
fprintf(Stream," NumTextures %d\n",m_NumTextures);
fprintf(Stream," Textures {\n");
for(i=0; i<m_NumTextures; i++) {
fprintf(Stream," %s\n",m_TextureNames[i]);
}
fprintf(Stream," }\n");
fprintf(Stream," NumTiles %d\n",m_NumTiles);
fprintf(Stream," Tiles {\n");
for(i=0; i<m_NumTiles; i++) {
m_Tiles[i]->Write(Stream);
}
fprintf(Stream," }\n");
fprintf(Stream,"}\n");
return TRUE;
}
void CGrdLandIO::GetCameraPosition(float *x,float *y,float *z)
{
*x = m_CameraXPos;
*y = m_CameraYPos;
*z = m_CameraZPos;
}
void CGrdLandIO::GetCameraRotation(float *x,float *y,float *z)
{
*x = m_CameraXRot;
*y = m_CameraYRot;
*z = m_CameraZRot;
}
void CGrdLandIO::Get2DPosition(SLONG *ScrollX,SLONG *ScrollY)
{
*ScrollX = m_ScrollX;
*ScrollY = m_ScrollY;
}
DWORD CGrdLandIO::GetHeightScale(void)
{
return m_HeightScale;
}
void CGrdLandIO::GetTextureSize(DWORD *TextureWidth,DWORD *TextureHeight)
{
*TextureWidth = m_TextureWidth;
*TextureHeight = m_TextureHeight;
}
void CGrdLandIO::GetMapSize(DWORD *MapWidth,DWORD *MapHeight)
{
*MapWidth = m_MapWidth;
*MapHeight = m_MapHeight;
}
void CGrdLandIO::GetTileSize(DWORD *TileWidth,DWORD *TileHeight)
{
*TileWidth = m_TileWidth;
*TileHeight = m_TileHeight;
}
DWORD CGrdLandIO::GetNumTextures(void)
{
return m_NumTextures;
}
char *CGrdLandIO::GetTextureName(DWORD NameIndex)
{
ASSERT(NameIndex < m_NumTextures);
return m_TextureNames[NameIndex];
}
BOOL CGrdLandIO::Read(FILE *Stream)
{
CHECKTRUE(StartChunk(Stream,"GrdLand"));
fpos_t Pos;
int PosOk;
PosOk = fgetpos(Stream, &Pos );
if(!ReadLong(Stream,"Version",(LONG*)&Version)) {
PosOk = fsetpos(Stream, &Pos );
DebugPrint("No Version Number\n");
Version = 0;
}
m_Version = Version;
CHECKTRUE(ReadFloat(Stream,"3DPosition",&m_CameraXPos));
CHECKTRUE(ReadFloat(Stream,NULL,&m_CameraYPos));
CHECKTRUE(ReadFloat(Stream,NULL,&m_CameraZPos));
CHECKTRUE(ReadFloat(Stream,"3DRotation",&m_CameraXRot));
CHECKTRUE(ReadFloat(Stream,NULL,&m_CameraYRot));
CHECKTRUE(ReadFloat(Stream,NULL,&m_CameraZRot));
CHECKTRUE(ReadLong(Stream,"2DPosition",(LONG*)&m_ScrollX));
CHECKTRUE(ReadLong(Stream,NULL,(LONG*)&m_ScrollY));
if(Version >= 1) {
CHECKTRUE(ReadLong(Stream,"CustomSnap",(LONG*)&m_SnapX));
CHECKTRUE(ReadLong(Stream,NULL,(LONG*)&m_SnapZ));
CHECKTRUE(ReadLong(Stream,"SnapMode",(LONG*)&m_SnapMode));
CHECKTRUE(ReadLong(Stream,"Gravity",(LONG*)&m_EnableGravity));
} else {
m_SnapMode = 0;
m_SnapX = 256;
m_SnapZ = 256;
m_EnableGravity = 1;
}
CHECKTRUE(ReadLong(Stream,"HeightScale",(LONG*)&m_HeightScale));
CHECKTRUE(ReadLong(Stream,"MapWidth",(LONG*)&m_MapWidth));
CHECKTRUE(ReadLong(Stream,"MapHeight",(LONG*)&m_MapHeight));
CHECKTRUE(ReadLong(Stream,"TileWidth",(LONG*)&m_TileWidth));
CHECKTRUE(ReadLong(Stream,"TileHeight",(LONG*)&m_TileHeight));
if(Version >= 3) {
CHECKTRUE(ReadLong(Stream,"SeaLevel",(LONG*)&m_SeaLevel));
} else {
m_SeaLevel = 100;
}
CHECKTRUE(ReadLong(Stream,"TextureWidth",(LONG*)&m_TextureWidth));
CHECKTRUE(ReadLong(Stream,"TextureHeight",(LONG*)&m_TextureHeight));
DWORD NumTextures;
DWORD i;
CHECKTRUE(ReadLong(Stream,"NumTextures",(LONG*)&NumTextures));
SetNumTextures(NumTextures);
CHECKTRUE(StartChunk(Stream,"Textures"));
for(i=0; i<NumTextures; i++) {
CHECKTRUE(ReadStringAlloc(Stream,NULL,&m_TextureNames[i]));
}
CHECKTRUE(EndChunk(Stream));
CHECKTRUE(ReadLong(Stream,"NumTiles",(LONG*)&m_NumTiles));
m_Tiles = new CGrdTileIO*[m_NumTiles];
CHECKTRUE(StartChunk(Stream,"Tiles"));
for(i=0; i<m_NumTiles; i++) {
m_Tiles[i] = new CGrdTileIO;
m_Tiles[i]->Read(Stream);
}
CHECKTRUE(EndChunk(Stream));
CHECKTRUE(EndChunk(Stream));
return TRUE;
}

View File

@ -0,0 +1,94 @@
#ifndef __GRDLAND_INCLUDED__
#define __GRDLAND_INCLUDED__
#include "chnkio.h"
class CGrdTileIO : public CChnkIO {
public:
CGrdTileIO(void);
~CGrdTileIO(void);
void SetTextureID(DWORD TMapID);
void SetVertexFlip(DWORD VertexFlip);
void SetTextureFlip(DWORD TextureFlip);
void SetFlags(DWORD Flags) { m_Flags = Flags; }
void SetVertexHeight(DWORD Index,float y);
BOOL Write(FILE *Stream);
DWORD GetTextureID(void);
DWORD GetVertexFlip(void);
DWORD GetTextureFlip(void);
DWORD GetFlags(void) { return m_Flags; }
float GetVertexHeight(DWORD Index);
BOOL Read(FILE *Stream);
protected:
DWORD m_TMapID;
DWORD m_VertexFlip;
DWORD m_TextureFlip;
DWORD m_Flags;
float m_Height[4];
};
class CGrdLandIO : public CChnkIO {
public:
CGrdLandIO(void);
~CGrdLandIO(void);
void SetCameraPosition(float x,float y,float z);
void SetCameraRotation(float x,float y,float z);
void SetSeaLevel(DWORD SeaLevel) { m_SeaLevel = SeaLevel; }
void Set2DPosition(SLONG ScrollX,SLONG ScrollY);
void SetHeightScale(DWORD HeightScale);
void SetTextureSize(DWORD TextureWidth,DWORD TextureHeight);
void SetMapSize(DWORD MapWidth,DWORD MapHeight);
void SetTileSize(DWORD TileWidth,DWORD TileHeight);
void SetNumTextures(DWORD NumTextures);
void SetTextureName(DWORD NameIndex,char *TextureName);
void SetSnapMode(DWORD SnapMode) { m_SnapMode = SnapMode; }
void SetSnapX(DWORD SnapX) { m_SnapX = SnapX; }
void SetSnapZ(DWORD SnapZ) { m_SnapZ = SnapZ; }
void SetGravity(BOOL EnableGravity) { m_EnableGravity = EnableGravity; }
CGrdTileIO *GetTile(DWORD Index);
BOOL Write(FILE *Stream);
void GetCameraPosition(float *x,float *y,float *z);
void GetCameraRotation(float *x,float *y,float *z);
DWORD GetSeaLevel(void) { return m_SeaLevel; }
void Get2DPosition(SLONG *ScrollX,SLONG *ScrollY);
DWORD GetHeightScale(void);
void GetTextureSize(DWORD *TextureWidth,DWORD *TextureHeight);
void GetMapSize(DWORD *MapWidth,DWORD *MapHeight);
void GetTileSize(DWORD *TileWidth,DWORD *TileHeight);
DWORD GetNumTextures(void);
char *GetTextureName(DWORD NameIndex);
DWORD GetSnapMode(void) { return m_SnapMode; }
DWORD GetSnapX(void) { return m_SnapX; }
DWORD GetSnapZ(void) { return m_SnapZ; }
BOOL GetGravity(void) { return (BOOL)m_EnableGravity; }
DWORD GetVersion(void) { return m_Version; }
BOOL Read(FILE *Stream);
protected:
DWORD m_Version;
float m_CameraXPos;
float m_CameraYPos;
float m_CameraZPos;
float m_CameraXRot;
float m_CameraYRot;
float m_CameraZRot;
DWORD m_SeaLevel;
DWORD m_SnapX;
DWORD m_SnapZ;
DWORD m_SnapMode;
DWORD m_EnableGravity;
SLONG m_ScrollX;
SLONG m_ScrollY;
DWORD m_HeightScale;
DWORD m_MapWidth;
DWORD m_MapHeight;
DWORD m_TileWidth;
DWORD m_TileHeight;
DWORD m_NumTiles;
DWORD m_TextureWidth;
DWORD m_TextureHeight;
DWORD m_NumTextures;
char **m_TextureNames;
CGrdTileIO **m_Tiles;
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,71 @@
// InfoDialog.cpp : implementation file
//
#include "stdafx.h"
#include "btedit.h"
#include "infodialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInfoDialog dialog
CInfoDialog::CInfoDialog(CWnd* pParent /*=NULL*/)
: CDialog(CInfoDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CInfoDialog)
m_Info = _T("");
//}}AFX_DATA_INIT
m_pView = NULL;
}
CInfoDialog::CInfoDialog(CView *pView)
{
m_pView = pView;
}
BOOL CInfoDialog::Create(void)
{
return CDialog::Create(CInfoDialog::IDD); //_DEBUGINFO);
}
void CInfoDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInfoDialog)
DDX_Text(pDX, IDC_DEBUGINFO, m_Info);
DDV_MaxChars(pDX, m_Info, 65535);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInfoDialog, CDialog)
//{{AFX_MSG_MAP(CInfoDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInfoDialog message handlers
void CInfoDialog::OnCancel()
{
if(m_pView != NULL) {
m_pView->PostMessage(WM_GOODBYE, IDCANCEL);
}
}
void CInfoDialog::OnOK()
{
UpdateData(TRUE);
if(m_pView != NULL) {
m_pView->PostMessage(WM_GOODBYE, IDOK);
}
}

View File

@ -0,0 +1,43 @@
// InfoDialog.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CInfoDialog dialog
#define WM_GOODBYE (WM_USER+5)
class CInfoDialog : public CDialog
{
private:
CView *m_pView;
// Construction
public:
CInfoDialog(CWnd* pParent = NULL); // standard constructor
CInfoDialog(CView *pView);
BOOL Create(void);
// Dialog Data
//{{AFX_DATA(CInfoDialog)
enum { IDD = IDD_DEBUGINFO };
CString m_Info;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CInfoDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CInfoDialog)
virtual void OnCancel();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -0,0 +1,83 @@
// InitialLimitsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "btedit.h"
#include "debugprint.h"
#include "initiallimitsdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInitialLimitsDlg dialog
CInitialLimitsDlg::CInitialLimitsDlg(CHeightMap *World,CWnd* pParent /*=NULL*/)
: CDialog(CInitialLimitsDlg::IDD, pParent)
{
m_World = World;
m_Selected = -1;
//{{AFX_DATA_INIT(CInitialLimitsDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CInitialLimitsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInitialLimitsDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInitialLimitsDlg, CDialog)
//{{AFX_MSG_MAP(CInitialLimitsDlg)
ON_CBN_SELCHANGE(IDC_INITIALLIMITS, OnSelchangeInitiallimits)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInitialLimitsDlg message handlers
BOOL CInitialLimitsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox *List = (CComboBox*)GetDlgItem(IDC_INITIALLIMITS);
ListNode<CScrollLimits> *TmpNode = m_World->GetScrollLimits();
int ListSize = 0;
char *FirstString;
// Add the strings to the list box.
while(TmpNode!=NULL) {
List->AddString(TmpNode->GetData()->ScriptName);
if(ListSize == 0) {
FirstString = TmpNode->GetData()->ScriptName;
}
ListSize++;
TmpNode = TmpNode->GetNextNode();
}
// Set the default selection.
if(ListSize) {
List->SelectString(-1, FirstString);
m_Selected = 0;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CInitialLimitsDlg::OnSelchangeInitiallimits()
{
CComboBox *List = (CComboBox*)GetDlgItem(IDC_INITIALLIMITS);
m_Selected = List->GetCurSel();
}

View File

@ -0,0 +1,44 @@
// InitialLimitsDlg.h : header file
//
#include "directx.h"
#include "geometry.h"
#include "ddimage.h"
#include "heightmap.h"
/////////////////////////////////////////////////////////////////////////////
// CInitialLimitsDlg dialog
class CInitialLimitsDlg : public CDialog
{
// Construction
public:
CInitialLimitsDlg(CHeightMap *World,CWnd* pParent = NULL); // standard constructor
int GetSelected(void) { return m_Selected; }
// Dialog Data
//{{AFX_DATA(CInitialLimitsDlg)
enum { IDD = IDD_INITIALLIMITS };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CInitialLimitsDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
CHeightMap *m_World;
int m_Selected;
// Generated message map functions
//{{AFX_MSG(CInitialLimitsDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeInitiallimits();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -0,0 +1,36 @@
#include "windows.h"
#include "windowsx.h"
#include "stdio.h"
#include "typedefs.h"
#include "debugprint.h"
#include "keyhandler.h"
CKeyHandler::CKeyHandler(void)
{
InitKeyTable();
}
void CKeyHandler::InitKeyTable(void)
{
for(int i = 0; i<KEYTABSIZE; i++) {
m_KeyTable[i] = 0;
}
}
void CKeyHandler::HandleKeyDown(UINT VKey)
{
if(VKey < KEYTABSIZE) {
// DebugPrint("KeyDown %d\n",VKey);
m_KeyTable[VKey] = 1;
}
}
void CKeyHandler::HandleKeyUp(UINT VKey)
{
if(VKey < KEYTABSIZE) {
m_KeyTable[VKey] = 0;
// DebugPrint("KeyUp %d\n",VKey);
}
}

View File

@ -0,0 +1,18 @@
#ifndef __INCLUDED_KEYHANDLER__
#define __INCLUDED_KEYHANDLER__
#define KEYTABSIZE 256
class CKeyHandler {
public:
CKeyHandler(void);
void InitKeyTable(void);
void HandleKeyDown(UINT VKey);
void HandleKeyUp(UINT VKey);
BOOL GetKeyState(UINT VKey) { return m_KeyTable[VKey]; }
protected:
BOOL m_KeyTable[KEYTABSIZE];
};
#endif

View File

@ -0,0 +1,310 @@
// LimitsDialog.cpp : implementation file
//
#include "stdafx.h"
#include "btedit.h"
#include "debugprint.h"
#include "limitsdialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLimitsDialog dialog
CLimitsDialog::CLimitsDialog(CHeightMap *World,CWnd* pParent /*=NULL*/)
: CDialog(CLimitsDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CLimitsDialog)
m_MaxX = 0;
m_MaxZ = 0;
m_MinX = 0;
m_MinZ = 0;
m_ScriptName = _T("");
//}}AFX_DATA_INIT
m_World = World;
m_SelectedItemIndex = -1;
}
// CListCtrl *List = (CListCtrl*)GetDlgItem(IDC_LISTLIMITS);
// List->InsertColumn (0, "Script Name", LVCFMT_LEFT, 128);
void CLimitsDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLimitsDialog)
DDX_Text(pDX, IDC_SL_MAXX, m_MaxX);
DDX_Text(pDX, IDC_SL_MAXZ, m_MaxZ);
DDX_Text(pDX, IDC_SL_MINX, m_MinX);
DDX_Text(pDX, IDC_SL_MINZ, m_MinZ);
DDX_Text(pDX, IDC_SL_SCRIPTNAME, m_ScriptName);
DDV_MaxChars(pDX, m_ScriptName, 32);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLimitsDialog, CDialog)
//{{AFX_MSG_MAP(CLimitsDialog)
ON_NOTIFY(LVN_GETDISPINFO, IDC_LISTLIMITS, OnGetdispinfoListlimits)
ON_NOTIFY(LVN_KEYDOWN, IDC_LISTLIMITS, OnKeydownListlimits)
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LISTLIMITS, OnItemchangedListlimits)
ON_BN_CLICKED(IDC_ADDLIMITS, OnAddlimits)
ON_BN_CLICKED(IDC_MODIFY, OnModify)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLimitsDialog message handlers
BOOL CLimitsDialog::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
return CDialog::Create(IDD, pParentWnd);
}
BOOL CLimitsDialog::OnInitDialog()
{
CDialog::OnInitDialog();
CListCtrl *List = (CListCtrl*)GetDlgItem(IDC_LISTLIMITS);
List->InsertColumn (0, "Name", LVCFMT_LEFT, 128);
List->InsertColumn (1, "Unique ID", LVCFMT_LEFT, 64);
List->InsertColumn (2, "Min X", LVCFMT_LEFT, 48);
List->InsertColumn (3, "Min Z", LVCFMT_LEFT, 48);
List->InsertColumn (4, "Max X", LVCFMT_LEFT, 48);
List->InsertColumn (5, "Max Z", LVCFMT_LEFT, 48);
RebuildList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CLimitsDialog::OnGetdispinfoListlimits(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LVITEMA item = pDispInfo->item;
char String[256];
ListNode<CScrollLimits> *ScrollLimits = m_World->GetScrollLimits();
CScrollLimits *Data = ScrollLimits->GetNthNode(item.iItem)->GetData();
switch (pDispInfo->item.iSubItem) {
case 0:
strcpy (pDispInfo->item.pszText, Data->ScriptName);
break;
case 1:
sprintf(String,"%d",Data->UniqueID);
strcpy (pDispInfo->item.pszText, String);
break;
case 2:
sprintf(String,"%d",Data->MinX);
strcpy (pDispInfo->item.pszText, String);
break;
case 3:
sprintf(String,"%d",Data->MinZ);
strcpy (pDispInfo->item.pszText, String);
break;
case 4:
sprintf(String,"%d",Data->MaxX);
strcpy (pDispInfo->item.pszText, String);
break;
case 5:
sprintf(String,"%d",Data->MaxZ);
strcpy (pDispInfo->item.pszText, String);
break;
}
*pResult = 0;
}
void CLimitsDialog::OnKeydownListlimits(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_KEYDOWN* pLVKeyDown = (LV_KEYDOWN*)pNMHDR;
CListCtrl *List = (CListCtrl*)GetDlgItem(IDC_LISTLIMITS);
switch(pLVKeyDown->wVKey) {
case VK_DELETE:
if(m_SelectedItemIndex != -1) {
m_World->DeleteScrollLimit(m_SelectedItemIndex);
List->DeleteItem(m_SelectedItemIndex);
}
break;
}
*pResult = 0;
}
void CLimitsDialog::OnItemchangedListlimits(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
char String[256];
if(pNMListView->iItem != m_SelectedItemIndex) {
m_SelectedItemIndex = pNMListView->iItem;
ListNode<CScrollLimits> *ScrollLimits = m_World->GetScrollLimits();
ScrollLimits = ScrollLimits->GetNthNode(m_SelectedItemIndex);
if(ScrollLimits) {
CScrollLimits *Data = ScrollLimits->GetData();
GetDlgItem(IDC_SL_SCRIPTNAME)->SetWindowText(Data->ScriptName);
sprintf(String,"%d",Data->MinX);
GetDlgItem(IDC_SL_MINX)->SetWindowText(String);
sprintf(String,"%d",Data->MinZ);
GetDlgItem(IDC_SL_MINZ)->SetWindowText(String);
sprintf(String,"%d",Data->MaxX);
GetDlgItem(IDC_SL_MAXX)->SetWindowText(String);
sprintf(String,"%d",Data->MaxZ);
GetDlgItem(IDC_SL_MAXZ)->SetWindowText(String);
} else {
m_SelectedItemIndex = -1;
GetDlgItem(IDC_SL_SCRIPTNAME)->SetWindowText("");
GetDlgItem(IDC_SL_MINX)->SetWindowText("");
GetDlgItem(IDC_SL_MINZ)->SetWindowText("");
GetDlgItem(IDC_SL_MAXX)->SetWindowText("");
GetDlgItem(IDC_SL_MAXZ)->SetWindowText("");
}
}
*pResult = 0;
}
void CLimitsDialog::OnAddlimits()
{
int MinX,MinZ,MaxX,MaxZ;
char ScriptName[MAX_SCRIPTNAME];
if(! GetEditFields(TRUE,MinX,MinZ,MaxX,MaxZ,ScriptName) ) {
return;
}
CListCtrl *List = (CListCtrl*)GetDlgItem(IDC_LISTLIMITS);
List->InsertItem(m_World->GetNumScrollLimits(),ScriptName);
m_World->AddScrollLimit(MinX,MinZ,MaxX,MaxZ,ScriptName);
GetDlgItem(IDC_LISTLIMITS)->SetFocus();
}
void CLimitsDialog::OnModify()
{
int MinX,MinZ,MaxX,MaxZ;
char ScriptName[MAX_SCRIPTNAME];
char String[256];
if(! GetEditFields(TRUE,MinX,MinZ,MaxX,MaxZ,ScriptName) ) {
return;
}
if(m_SelectedItemIndex >= 0) {
m_World->SetScrollLimit(m_SelectedItemIndex,MinX,MinZ,MaxX,MaxZ,ScriptName);
CListCtrl *List = (CListCtrl*)GetDlgItem(IDC_LISTLIMITS);
List->SetItem( m_SelectedItemIndex, 0, LVIF_TEXT, ScriptName, 0, 0, 0, NULL);
sprintf(String,"%d",MinX);
List->SetItem( m_SelectedItemIndex, 2, LVIF_TEXT, String, 0, 0, 0, NULL);
sprintf(String,"%d",MinZ);
List->SetItem( m_SelectedItemIndex, 3, LVIF_TEXT, String, 0, 0, 0, NULL);
sprintf(String,"%d",MaxX);
List->SetItem( m_SelectedItemIndex, 4, LVIF_TEXT, String, 0, 0, 0, NULL);
sprintf(String,"%d",MaxZ);
List->SetItem( m_SelectedItemIndex, 5, LVIF_TEXT, String, 0, 0, 0, NULL);
}
GetDlgItem(IDC_LISTLIMITS)->SetFocus();
}
void CLimitsDialog::RebuildList(void)
{
CListCtrl *List = (CListCtrl*)GetDlgItem(IDC_LISTLIMITS);
List->DeleteAllItems();
ListNode<CScrollLimits> *ScrollLimits = m_World->GetScrollLimits();
ListNode<CScrollLimits> *TmpNode;
CScrollLimits *Data;
int Index = 0;
TmpNode = ScrollLimits;
while(TmpNode!=NULL) {
Data = TmpNode->GetData();
TmpNode = TmpNode->GetNextNode();
List->InsertItem(Index,Data->ScriptName);
Index++;
}
GetDlgItem(IDC_LISTLIMITS)->UpdateWindow();
GetDlgItem(IDC_LISTLIMITS)->SetFocus();
}
BOOL CLimitsDialog::GetEditFields(BOOL CheckDup,int &MinX,int &MinZ,int &MaxX,int &MaxZ,char *ScriptName)
{
char String[MAX_SCRIPTNAME];
GetDlgItem(IDC_SL_MINX)->GetWindowText(String,MAX_SCRIPTNAME);
if( sscanf(String,"%d",&MinX) != 1) {
return FALSE;
}
GetDlgItem(IDC_SL_MINZ)->GetWindowText(String,MAX_SCRIPTNAME);
if( sscanf(String,"%d",&MinZ) != 1) {
return FALSE;
}
GetDlgItem(IDC_SL_MAXX)->GetWindowText(String,MAX_SCRIPTNAME);
if( sscanf(String,"%d",&MaxX) != 1) {
return FALSE;
}
GetDlgItem(IDC_SL_MAXZ)->GetWindowText(String,MAX_SCRIPTNAME);
if( sscanf(String,"%d",&MaxZ) != 1) {
return FALSE;
}
GetDlgItem(IDC_SL_SCRIPTNAME)->GetWindowText(String,MAX_SCRIPTNAME);
strcpy(ScriptName,String);
if( (MaxX <= MinX) || ( MaxZ <= MinZ) ) {
return FALSE;
}
if( (MinX < 0) || (MinZ < 0) ||
(MaxX < 0) || (MaxZ < 0) ) {
return FALSE;
}
DWORD MapWidth,MapHeight;
m_World->GetMapSize(&MapWidth,&MapHeight);
if( (MinX > MapWidth) || (MinZ > MapHeight) ||
(MaxX > MapWidth) || (MaxZ > MapHeight) ) {
return FALSE;
}
// Check for duplicate script name.
if(CheckDup) {
}
return TRUE;
}

View File

@ -0,0 +1,56 @@
// LimitsDialog.h : header file
//
#include "directx.h"
#include "geometry.h"
#include "ddimage.h"
#include "heightmap.h"
/////////////////////////////////////////////////////////////////////////////
// CLimitsDialog dialog
class CLimitsDialog : public CDialog
{
// Construction
public:
CLimitsDialog(CHeightMap *World,CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CLimitsDialog)
enum { IDD = IDD_SCROLLLIMITS };
int m_MaxX;
int m_MaxZ;
int m_MinX;
int m_MinZ;
CString m_ScriptName;
//}}AFX_DATA
CHeightMap *m_World;
int m_SelectedItemIndex;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLimitsDialog)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
void RebuildList(void);
BOOL GetEditFields(BOOL CheckDup,int &MinX,int &MinZ,int &MaxX,int &MaxZ,char *ScriptName);
// Generated message map functions
//{{AFX_MSG(CLimitsDialog)
virtual BOOL OnInitDialog();
afx_msg void OnGetdispinfoListlimits(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnKeydownListlimits(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnItemchangedListlimits(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnAddlimits();
afx_msg void OnModify();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -0,0 +1,210 @@
#ifndef __INCLUDED_LISTTEMP__
#define __INCLUDED_LISTTEMP__
template<class T>
class ListNode {
protected:
ListNode<T> *PrevNode;
ListNode<T> *NextNode;
T *Data;
public:
ListNode();
~ListNode();
T* GetData(void) { return Data; }
void AppendNode(ListNode<T>* RootNode);
void InsertAfterNode(ListNode<T>* Node);
void InsertBeforeNode(ListNode<T>* Node);
ListNode<T>* GetNextNode(void);
ListNode<T>* GetPrevNode(void);
ListNode<T>* GetFirstNode(void);
ListNode<T>* GetLastNode(void);
ListNode<T>* GetNthNode(int NodeNum);
ListNode<T>* RemoveNode(ListNode<T>* RootNode);
void DeleteList(void);
int CountNodes(void);
};
template<class T>
ListNode<T>::ListNode()
{
PrevNode=NULL;
NextNode=NULL;
Data=new T;
}
template<class T>
ListNode<T>::~ListNode()
{
// DebugPrint("DeleteNode\n");
delete Data;
}
template<class T>
void ListNode<T>::DeleteList(void)
{
ListNode<T>* TmpNode;
TmpNode=this; // Get address of this node.
while(TmpNode->PrevNode!=NULL) { // Find the start of the list.
TmpNode=TmpNode->PrevNode;
}
ListNode<T>* TmpNode2;
while(TmpNode!=NULL) { // Delete all items in the list.
TmpNode2=TmpNode;
TmpNode=TmpNode->NextNode;
delete TmpNode2;
}
}
template<class T>
ListNode<T>* ListNode<T>::RemoveNode(ListNode<T>* RootNode)
{
// DebugPrint("* Removing node @ %p\n",this);
if(this==RootNode) {
RootNode=RootNode->GetNextNode();
// DebugPrint("* Root changed %p\n",RootNode);
}
if(PrevNode!=NULL) {
PrevNode->NextNode=NextNode;
}
if(NextNode!=NULL) {
NextNode->PrevNode=PrevNode;
}
return RootNode;
}
template<class T>
void ListNode<T>::AppendNode(ListNode<T>* RootNode)
{
ListNode<T>* TmpNode;
TmpNode=RootNode;
while(TmpNode->NextNode!=NULL) { // Find the end of the list.
TmpNode=TmpNode->NextNode;
}
TmpNode->NextNode=this; // Append the new node to the list.
PrevNode=TmpNode;
NextNode=NULL;
}
template<class T>
void ListNode<T>::InsertAfterNode(ListNode<T>* Node)
{
PrevNode=Node;
NextNode=Node->NextNode;
Node->NextNode=this;
if(NextNode!=NULL) {
NextNode->PrevNode=this;
}
}
template<class T>
void ListNode<T>::InsertBeforeNode(ListNode<T>* Node)
{
PrevNode=Node->PrevNode;
Node->PrevNode=this;
NextNode=Node;
if(PrevNode!=NULL) {
PrevNode->NextNode=this;
}
}
template<class T>
ListNode<T>* ListNode<T>::GetNextNode(void)
{
return(NextNode);
}
template<class T>
ListNode<T>* ListNode<T>::GetPrevNode(void)
{
return(PrevNode);
}
template<class T>
ListNode<T>* ListNode<T>::GetFirstNode(void)
{
ListNode *TmpNode;
TmpNode=this; // Get address of this node.
while(TmpNode->PrevNode!=NULL) { // Find the start of the list.
TmpNode=TmpNode->PrevNode;
}
return(TmpNode);
}
template<class T>
ListNode<T>* ListNode<T>::GetLastNode(void)
{
ListNode<T>* TmpNode;
TmpNode=this; // Get address of this node.
while(TmpNode->NextNode!=NULL) { // Find the end of the list.
TmpNode=TmpNode->NextNode;
}
return(TmpNode);
}
template<class T>
ListNode<T>* ListNode<T>::GetNthNode(int NodeNum)
{
ListNode<T>* TmpNode;
TmpNode=this; // Get address of this node.
while(TmpNode->PrevNode!=NULL) { // Find the start of the list.
TmpNode=TmpNode->PrevNode;
}
while(TmpNode!=NULL) {
if(NodeNum==0) {
return(TmpNode);
}
TmpNode=TmpNode->NextNode;
NodeNum--;
}
return(NULL);
}
template<class T>
int ListNode<T>::CountNodes(void)
{
int count;
ListNode<T>* TmpNode;
TmpNode=this; // Get address of this node.
while(TmpNode->PrevNode!=NULL) { // Find the start of the list.
TmpNode=TmpNode->PrevNode;
}
count=0;
while(TmpNode!=NULL) { // Find the end of the list.
TmpNode=TmpNode->NextNode;
count++;
}
return(count);
}
#endif

View File

@ -0,0 +1,23 @@
#ifndef _INCLUDED_MACROS_
#define _INCLUDED_MACROS_
#define DXCALL(func) if( (ddrval = func) != DD_OK) { DisplayError(ddrval,__FILE__,__LINE__,0); DebugClose(); return FALSE; }
#define DXCALL_INT(func) if( (ddrval = func) != DD_OK) { DisplayError(ddrval,__FILE__,__LINE__,0); DebugClose(); return -1; }
#define DXCALL_HRESULT(func) if( (ddrval = func) != DD_OK) { DisplayError(ddrval,__FILE__,__LINE__,0); DebugClose(); return ddrval; }
#define DXCALL_RESTORE(func) if( (ddrval = func) != DD_OK) \
{ \
if(ddrval == DDERR_SURFACELOST) { \
RestoreSurfaces(); \
} else { \
DisplayError(ddrval,__FILE__,__LINE__,0); \
DebugClose(); \
return FALSE; \
} \
}
#define RELEASE(x) if (x) { x->Release(); x = NULL; }
#define DELOBJ(x) if (x) { delete x; x = NULL; }
#endif

View File

@ -0,0 +1,375 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "btedit.h"
#include "mainfrm.h"
#include "bteditdoc.h"
#include "bteditview.h"
//#include "dbview.h"
#include "tdview.h"
#include "textureview.h"
#include "wfview.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern int g_MaxXRes; // 3d view size.
extern int g_MaxYRes;
int g_DispXRes;
int g_DispYRes;
// Splitter layout, 0,1 or 2.
#define LAYOUT 1
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_INITMENU()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_SEPARATOR, // status line indicator
ID_SEPARATOR, // status line indicator
// ID_INDICATOR_CAPS,
// ID_INDICATOR_NUM,
// ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndToolBar2.Create(this) ||
!m_wndToolBar2.LoadToolBar(IDR_TILEFLAGS))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndToolBar3.Create(this) ||
!m_wndToolBar3.LoadToolBar(IDR_OBJECTSTATS))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
m_wndToolBar2.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar2); //,AFX_IDW_DOCKBAR_LEFT);
m_wndToolBar3.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndToolBar3.EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar3,AFX_IDW_DOCKBAR_LEFT);
return 0;
}
#if LAYOUT == 0
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
// Split the window in two vertically.
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
m_wndSplitter.SetColumnInfo(0,640, 0);
m_wndSplitter.SetRowInfo(0,480, 0);
// Now split the first pane in two horizontaly for the 3d and 2d views.
if (!m_wndSplitter3.CreateStatic(
&m_wndSplitter, // our parent window is the first splitter
2, 1, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitter.IdFromRowCol(0, 0)
// new splitter is in the first row, 2nd column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
// Attach the 3d edit view class to the top pane.
if (!m_wndSplitter3.CreateView(0, 0,
RUNTIME_CLASS(CBTEditView), CSize(640, 480), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
// And attach the 2d edit view to the bottom pane.
if (!m_wndSplitter3.CreateView(1, 0,
RUNTIME_CLASS(CWFView), CSize(640, 64), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CTextureView), CSize(20, 20), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
//// The second horizontal split.
// if (!m_wndSplitter2.CreateStatic(
// &m_wndSplitter, // our parent window is the first splitter
// 2, 1, // the new splitter is 2 rows, 1 column
// WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
// m_wndSplitter.IdFromRowCol(0, 1)
// // new splitter is in the first row, 2nd column of first splitter
// ))
// {
// TRACE0("Failed to create nested splitter\n");
// return FALSE;
// }
//
// if (!m_wndSplitter2.CreateView(0, 0,
// RUNTIME_CLASS(CDBView), CSize(20, 128), pContext))
// {
// TRACE0("Failed to create second pane\n");
// return FALSE;
// }
//// The second horizontal split.
// if (!m_wndSplitter2.CreateStatic(
// &m_wndSplitter, // our parent window is the first splitter
// 2, 1, // the new splitter is 2 rows, 1 column
// WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
// m_wndSplitter.IdFromRowCol(0, 1)
// // new splitter is in the first row, 2nd column of first splitter
// ))
// {
// TRACE0("Failed to create nested splitter\n");
// return FALSE;
// }
//
// if (!m_wndSplitter2.CreateView(0, 0,
// RUNTIME_CLASS(CDBView), CSize(20, 128), pContext))
// {
// TRACE0("Failed to create second pane\n");
// return FALSE;
// }
//
// if (!m_wndSplitter2.CreateView(1, 0,
// RUNTIME_CLASS(CTextureView), CSize(20, 20), pContext))
// {
// TRACE0("Failed to create second pane\n");
// return FALSE;
// }
return TRUE;
}
#elif LAYOUT == 1
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
// Split the window in two vertically.
if (!m_wndSplitter.CreateStatic(this, 1, 2)) // One row, 2 columns.
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
m_wndSplitter.SetColumnInfo(0,640, 0);
m_wndSplitter.SetRowInfo(0,480, 0);
// Now split the first pane in two horizontaly for the 3d and 2d views.
if (!m_wndSplitter3.CreateStatic(
&m_wndSplitter, // our parent window is the first splitter
2, 1, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitter.IdFromRowCol(0, 1)
// new splitter is in the first row, 2nd column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
// Attach the 3d edit view class to the top pane.
if (!m_wndSplitter3.CreateView(0, 0,
RUNTIME_CLASS(CBTEditView), CSize(g_MaxXRes,g_MaxYRes), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
// And attach the 2d edit view to the bottom pane.
if (!m_wndSplitter3.CreateView(1, 0,
RUNTIME_CLASS(CWFView), CSize(g_MaxXRes, 64), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CTextureView), CSize(g_DispXRes-g_MaxXRes, 20), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
return TRUE;
}
#elif LAYOUT == 2
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
// Split the window in two vertically.
if (!m_wndSplitter.CreateStatic(this, 1, 2)) // One row, 2 columns.
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
m_wndSplitter.SetColumnInfo(0,640, 0);
m_wndSplitter.SetRowInfo(0,480, 0);
// Now split the first pane in two horizontaly for the 3d and 2d views.
if (!m_wndSplitter3.CreateStatic(
&m_wndSplitter, // our parent window is the first splitter
1, 2, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitter.IdFromRowCol(0, 1)
// new splitter is in the first row, 2nd column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
// Attach the 3d edit view class to the top pane.
if (!m_wndSplitter3.CreateView(0, 0,
RUNTIME_CLASS(CBTEditView), CSize(800, 800), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
// And attach the 2d edit view to the bottom pane.
if (!m_wndSplitter3.CreateView(0, 1,
RUNTIME_CLASS(CWFView), CSize(640, 64), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CTextureView), CSize(128, 20), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
return TRUE;
}
#endif
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= WS_MAXIMIZE;
// Set the window screen size and center it
cs.cy = ::GetSystemMetrics(SM_CYMAXIMIZED);
cs.cx = ::GetSystemMetrics(SM_CXMAXIMIZED);
cs.y = ((cs.cy) - cs.cy) / 2;
cs.x = ((cs.cx) - cs.cx) / 2;
g_DispXRes = cs.cx;
g_DispYRes = cs.cy;
return CFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnInitMenu(CMenu* pMenu)
{
CFrameWnd::OnInitMenu(pMenu);
int Ret = pMenu->EnableMenuItem(ID_FILE_EXPORTWARZONESCENARIOEXPAND,MF_GRAYED);
}

Some files were not shown because too many files have changed in this diff Show More