├── .gitignore ├── Makefile ├── README.md ├── icon.jpg ├── license-gpl.txt ├── license-id.txt ├── license-mame.txt ├── readme-wolf.txt ├── screenshots ├── ingame.png └── screenshot.png └── src ├── audiosod.h ├── audiowl6.h ├── dosbox ├── dbopl.cpp └── dbopl.h ├── f_spear.h ├── foreign.h ├── gfxv_apo.h ├── gfxv_jap.h ├── gfxv_sod.h ├── gfxv_wl6.h ├── id_ca.cpp ├── id_ca.h ├── id_in.cpp ├── id_in.h ├── id_pm.cpp ├── id_pm.h ├── id_sd.cpp ├── id_sd.h ├── id_us.h ├── id_us_1.cpp ├── id_vh.cpp ├── id_vh.h ├── id_vl.cpp ├── id_vl.h ├── mame ├── fmopl.cpp └── fmopl.h ├── signon.cpp ├── sodpal.inc ├── version.h ├── wl_act1.cpp ├── wl_act2.cpp ├── wl_agent.cpp ├── wl_atmos.cpp ├── wl_atmos.h ├── wl_cloudsky.cpp ├── wl_cloudsky.h ├── wl_debug.cpp ├── wl_def.h ├── wl_dir3dspr.cpp ├── wl_draw.cpp ├── wl_floorceiling.cpp ├── wl_game.cpp ├── wl_inter.cpp ├── wl_main.cpp ├── wl_menu.cpp ├── wl_menu.h ├── wl_parallax.cpp ├── wl_play.cpp ├── wl_shade.cpp ├── wl_shade.h ├── wl_state.cpp ├── wl_text.cpp └── wolfpal.inc /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | ehthumbs.db 37 | Thumbs.db 38 | 39 | # Unnecessary project clutter # 40 | ############################### 41 | *.layout 42 | *.depend 43 | settings.json -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | 5 | ifeq ($(strip $(DEVKITARM)),) 6 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 7 | endif 8 | 9 | TOPDIR ?= $(CURDIR) 10 | include $(DEVKITARM)/3ds_rules 11 | 12 | PORTLIBS := $(DEVKITPRO)/portlibs/3ds 13 | #--------------------------------------------------------------------------------- 14 | # TARGET is the name of the output 15 | # BUILD is the directory where object files & intermediate files will be placed 16 | # SOURCES is a list of directories containing source code 17 | # DATA is a list of directories containing data files 18 | # INCLUDES is a list of directories containing header files 19 | # 20 | # NO_SMDH: if set to anything, no SMDH file is generated. 21 | # ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional) 22 | # APP_TITLE is the name of the app stored in the SMDH file (Optional) 23 | # APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional) 24 | # APP_AUTHOR is the author of the app stored in the SMDH file (Optional) 25 | # ICON is the filename of the icon (.png), relative to the project folder. 26 | # If not set, it attempts to use one of the following (in this order): 27 | # - .png 28 | # - icon.png 29 | # - /default_icon.png 30 | #--------------------------------------------------------------------------------- 31 | TARGET := wolf4sdl 32 | BUILD := build 33 | SOURCES := src src/mame 34 | DATA := data 35 | INCLUDES := include 36 | ROMFS := romfs 37 | 38 | #--------------------------------------------------------------------------------- 39 | # options for code generation 40 | #--------------------------------------------------------------------------------- 41 | ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft 42 | 43 | CFLAGS := -Wno-narrowing -Ofast -mword-relocations \ 44 | -fomit-frame-pointer -ffunction-sections \ 45 | $(ARCH) 46 | 47 | CFLAGS += $(INCLUDE) -D__3DS__ 48 | 49 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 50 | 51 | ASFLAGS := -g $(ARCH) 52 | LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) 53 | 54 | LIBS := -lSDL_mixer -lvorbisidec -lmikmod -lmad -logg -lSDL_ttf -lSDL_image -lSDL_gfx -lSDL -lfreetype -lpng -ljpeg -lz -lcitro3d -lctru -lm 55 | 56 | #--------------------------------------------------------------------------------- 57 | # list of directories containing libraries, this must be the top level containing 58 | # include and lib 59 | #--------------------------------------------------------------------------------- 60 | LIBDIRS := $(CTRULIB) $(PORTLIBS) 61 | 62 | 63 | #--------------------------------------------------------------------------------- 64 | # no real need to edit anything past this point unless you need to add additional 65 | # rules for different file extensions 66 | #--------------------------------------------------------------------------------- 67 | ifneq ($(BUILD),$(notdir $(CURDIR))) 68 | #--------------------------------------------------------------------------------- 69 | 70 | export OUTPUT := $(CURDIR)/$(TARGET) 71 | export TOPDIR := $(CURDIR) 72 | 73 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 74 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 75 | 76 | export DEPSDIR := $(CURDIR)/$(BUILD) 77 | 78 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 79 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 80 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 81 | PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica))) 82 | SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist))) 83 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 84 | 85 | #--------------------------------------------------------------------------------- 86 | # use CXX for linking C++ projects, CC for standard C 87 | #--------------------------------------------------------------------------------- 88 | ifeq ($(strip $(CPPFILES)),) 89 | #--------------------------------------------------------------------------------- 90 | export LD := $(CC) 91 | #--------------------------------------------------------------------------------- 92 | else 93 | #--------------------------------------------------------------------------------- 94 | export LD := $(CXX) 95 | #--------------------------------------------------------------------------------- 96 | endif 97 | #--------------------------------------------------------------------------------- 98 | 99 | export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 100 | 101 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \ 102 | $(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) 103 | 104 | export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) 105 | 106 | export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(SHLISTFILES:.shlist=_shbin.h) $(addsuffix .h,$(subst .,_,$(BINFILES))) 107 | 108 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 109 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 110 | -I$(CURDIR)/$(BUILD) 111 | 112 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) 113 | 114 | ifeq ($(strip $(ICON)),) 115 | icons := $(wildcard *.png) 116 | ifneq (,$(findstring $(TARGET).png,$(icons))) 117 | export APP_ICON := $(TOPDIR)/$(TARGET).png 118 | else 119 | ifneq (,$(findstring icon.png,$(icons))) 120 | export APP_ICON := $(TOPDIR)/icon.png 121 | endif 122 | endif 123 | else 124 | export APP_ICON := $(TOPDIR)/$(ICON) 125 | endif 126 | 127 | ifeq ($(strip $(NO_SMDH)),) 128 | export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh 129 | endif 130 | 131 | ifneq ($(ROMFS),) 132 | export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) 133 | endif 134 | 135 | .PHONY: $(BUILD) clean all 136 | 137 | #--------------------------------------------------------------------------------- 138 | all: $(BUILD) 139 | 140 | $(BUILD): 141 | @[ -d $@ ] || mkdir -p $@ 142 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 143 | 144 | #--------------------------------------------------------------------------------- 145 | clean: 146 | @echo clean ... 147 | @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf 148 | 149 | 150 | #--------------------------------------------------------------------------------- 151 | else 152 | 153 | DEPENDS := $(OFILES:.o=.d) 154 | 155 | #--------------------------------------------------------------------------------- 156 | # main targets 157 | #--------------------------------------------------------------------------------- 158 | ifeq ($(strip $(NO_SMDH)),) 159 | $(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh 160 | else 161 | $(OUTPUT).3dsx : $(OUTPUT).elf 162 | endif 163 | 164 | $(OFILES_SOURCES) : $(HFILES) 165 | 166 | $(OUTPUT).elf : $(OFILES) 167 | 168 | #--------------------------------------------------------------------------------- 169 | # you need a rule like this for each extension you use as binary data 170 | #--------------------------------------------------------------------------------- 171 | %.bin.o %_bin.h : %.bin 172 | #--------------------------------------------------------------------------------- 173 | @echo $(notdir $<) 174 | @$(bin2o) 175 | 176 | #--------------------------------------------------------------------------------- 177 | # rules for assembling GPU shaders 178 | #--------------------------------------------------------------------------------- 179 | define shader-as 180 | $(eval CURBIN := $*.shbin) 181 | $(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d) 182 | echo "$(CURBIN).o: $< $1" > $(DEPSFILE) 183 | echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h 184 | echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h 185 | echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h 186 | picasso -o $(CURBIN) $1 187 | bin2s $(CURBIN) | $(AS) -o $*.shbin.o 188 | endef 189 | 190 | %.shbin.o %_shbin.h : %.v.pica %.g.pica 191 | @echo $(notdir $^) 192 | @$(call shader-as,$^) 193 | 194 | %.shbin.o %_shbin.h : %.v.pica 195 | @echo $(notdir $<) 196 | @$(call shader-as,$<) 197 | 198 | %.shbin.o %_shbin.h : %.shlist 199 | @echo $(notdir $<) 200 | @$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file))) 201 | 202 | 203 | -include $(DEPENDS) 204 | 205 | #--------------------------------------------------------------------------------------- 206 | endif 207 | #--------------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Wolf4SDL-3DS 3 | 4 | Port of Wolfenstein 3D to Nintendo 3DS using Wolf4SDL as a base. 5 | 6 | Runs at about 50-60 fps on both o3ds and n3ds. 7 | 8 | Requires a copy of `Wolf3d Full v1.4 GT/ID/Activision` or `Wolf3d shareware version v1.4` 9 | 10 | Download and copy `wolf4sdl.3dsx` or `wolf4sdl-shareware.3dsx` from the [releases](https://github.com/hax0kartik/wolf4sdl-3ds/releases/latest) page to `sdmc:/3ds/wolf4sdl` and the `*.wl6`/`*.wl1` files to `sdmc:/3ds/wolf4sdl/wolf3d/` 11 | 12 | ## Controls 13 | | Keys | Controls | 14 | | :-: |:-:| 15 | | A / ZR | Fire | 16 | | B | Use | 17 | | X | Strafe | 18 | | Y / ZL | Run | 19 | | L | Cycle through weapons (Strong > Weak) | 20 | | R | Cycle through weapons (Weak > Strong) | 21 | | CPAD AND DPAD | Move Around | 22 | | START | Enter(Select in main menu) 23 | 24 | ## Building 25 | 26 | Building requires latest `ctrulib` and `sdl1.2` 3ds port. 27 | You can install them using dkp-pacman 28 | 29 | ## Screenshots 30 | 31 | ![Screenshot1](screenshots/screenshot.png) 32 | ![Screenshot2](screenshots/ingame.png) 33 | 34 | ## Credits 35 | * All wolf4sdl contributors 36 | * Devkitpro 37 | * Keeganatorr for wold4sdl switch port 38 | * Druivensap, DreadKnight for helping me test -------------------------------------------------------------------------------- /icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hax0kartik/wolf4sdl-3ds/328d945c7f1d1998134019bb9d6f4b0f13722ca7/icon.jpg -------------------------------------------------------------------------------- /license-gpl.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | 60 | GNU GENERAL PUBLIC LICENSE 61 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 62 | 63 | 0. This License applies to any program or other work which contains 64 | a notice placed by the copyright holder saying it may be distributed 65 | under the terms of this General Public License. The "Program", below, 66 | refers to any such program or work, and a "work based on the Program" 67 | means either the Program or any derivative work under copyright law: 68 | that is to say, a work containing the Program or a portion of it, 69 | either verbatim or with modifications and/or translated into another 70 | language. (Hereinafter, translation is included without limitation in 71 | the term "modification".) Each licensee is addressed as "you". 72 | 73 | Activities other than copying, distribution and modification are not 74 | covered by this License; they are outside its scope. The act of 75 | running the Program is not restricted, and the output from the Program 76 | is covered only if its contents constitute a work based on the 77 | Program (independent of having been made by running the Program). 78 | Whether that is true depends on what the Program does. 79 | 80 | 1. You may copy and distribute verbatim copies of the Program's 81 | source code as you receive it, in any medium, provided that you 82 | conspicuously and appropriately publish on each copy an appropriate 83 | copyright notice and disclaimer of warranty; keep intact all the 84 | notices that refer to this License and to the absence of any warranty; 85 | and give any other recipients of the Program a copy of this License 86 | along with the Program. 87 | 88 | You may charge a fee for the physical act of transferring a copy, and 89 | you may at your option offer warranty protection in exchange for a fee. 90 | 91 | 2. You may modify your copy or copies of the Program or any portion 92 | of it, thus forming a work based on the Program, and copy and 93 | distribute such modifications or work under the terms of Section 1 94 | above, provided that you also meet all of these conditions: 95 | 96 | a) You must cause the modified files to carry prominent notices 97 | stating that you changed the files and the date of any change. 98 | 99 | b) You must cause any work that you distribute or publish, that in 100 | whole or in part contains or is derived from the Program or any 101 | part thereof, to be licensed as a whole at no charge to all third 102 | parties under the terms of this License. 103 | 104 | c) If the modified program normally reads commands interactively 105 | when run, you must cause it, when started running for such 106 | interactive use in the most ordinary way, to print or display an 107 | announcement including an appropriate copyright notice and a 108 | notice that there is no warranty (or else, saying that you provide 109 | a warranty) and that users may redistribute the program under 110 | these conditions, and telling the user how to view a copy of this 111 | License. (Exception: if the Program itself is interactive but 112 | does not normally print such an announcement, your work based on 113 | the Program is not required to print an announcement.) 114 | 115 | 116 | These requirements apply to the modified work as a whole. If 117 | identifiable sections of that work are not derived from the Program, 118 | and can be reasonably considered independent and separate works in 119 | themselves, then this License, and its terms, do not apply to those 120 | sections when you distribute them as separate works. But when you 121 | distribute the same sections as part of a whole which is a work based 122 | on the Program, the distribution of the whole must be on the terms of 123 | this License, whose permissions for other licensees extend to the 124 | entire whole, and thus to each and every part regardless of who wrote it. 125 | 126 | Thus, it is not the intent of this section to claim rights or contest 127 | your rights to work written entirely by you; rather, the intent is to 128 | exercise the right to control the distribution of derivative or 129 | collective works based on the Program. 130 | 131 | In addition, mere aggregation of another work not based on the Program 132 | with the Program (or with a work based on the Program) on a volume of 133 | a storage or distribution medium does not bring the other work under 134 | the scope of this License. 135 | 136 | 3. You may copy and distribute the Program (or a work based on it, 137 | under Section 2) in object code or executable form under the terms of 138 | Sections 1 and 2 above provided that you also do one of the following: 139 | 140 | a) Accompany it with the complete corresponding machine-readable 141 | source code, which must be distributed under the terms of Sections 142 | 1 and 2 above on a medium customarily used for software interchange; or, 143 | 144 | b) Accompany it with a written offer, valid for at least three 145 | years, to give any third party, for a charge no more than your 146 | cost of physically performing source distribution, a complete 147 | machine-readable copy of the corresponding source code, to be 148 | distributed under the terms of Sections 1 and 2 above on a medium 149 | customarily used for software interchange; or, 150 | 151 | c) Accompany it with the information you received as to the offer 152 | to distribute corresponding source code. (This alternative is 153 | allowed only for noncommercial distribution and only if you 154 | received the program in object code or executable form with such 155 | an offer, in accord with Subsection b above.) 156 | 157 | The source code for a work means the preferred form of the work for 158 | making modifications to it. For an executable work, complete source 159 | code means all the source code for all modules it contains, plus any 160 | associated interface definition files, plus the scripts used to 161 | control compilation and installation of the executable. However, as a 162 | special exception, the source code distributed need not include 163 | anything that is normally distributed (in either source or binary 164 | form) with the major components (compiler, kernel, and so on) of the 165 | operating system on which the executable runs, unless that component 166 | itself accompanies the executable. 167 | 168 | If distribution of executable or object code is made by offering 169 | access to copy from a designated place, then offering equivalent 170 | access to copy the source code from the same place counts as 171 | distribution of the source code, even though third parties are not 172 | compelled to copy the source along with the object code. 173 | 174 | 175 | 4. You may not copy, modify, sublicense, or distribute the Program 176 | except as expressly provided under this License. Any attempt 177 | otherwise to copy, modify, sublicense or distribute the Program is 178 | void, and will automatically terminate your rights under this License. 179 | However, parties who have received copies, or rights, from you under 180 | this License will not have their licenses terminated so long as such 181 | parties remain in full compliance. 182 | 183 | 5. You are not required to accept this License, since you have not 184 | signed it. However, nothing else grants you permission to modify or 185 | distribute the Program or its derivative works. These actions are 186 | prohibited by law if you do not accept this License. Therefore, by 187 | modifying or distributing the Program (or any work based on the 188 | Program), you indicate your acceptance of this License to do so, and 189 | all its terms and conditions for copying, distributing or modifying 190 | the Program or works based on it. 191 | 192 | 6. Each time you redistribute the Program (or any work based on the 193 | Program), the recipient automatically receives a license from the 194 | original licensor to copy, distribute or modify the Program subject to 195 | these terms and conditions. You may not impose any further 196 | restrictions on the recipients' exercise of the rights granted herein. 197 | You are not responsible for enforcing compliance by third parties to 198 | this License. 199 | 200 | 7. If, as a consequence of a court judgment or allegation of patent 201 | infringement or for any other reason (not limited to patent issues), 202 | conditions are imposed on you (whether by court order, agreement or 203 | otherwise) that contradict the conditions of this License, they do not 204 | excuse you from the conditions of this License. If you cannot 205 | distribute so as to satisfy simultaneously your obligations under this 206 | License and any other pertinent obligations, then as a consequence you 207 | may not distribute the Program at all. For example, if a patent 208 | license would not permit royalty-free redistribution of the Program by 209 | all those who receive copies directly or indirectly through you, then 210 | the only way you could satisfy both it and this License would be to 211 | refrain entirely from distribution of the Program. 212 | 213 | If any portion of this section is held invalid or unenforceable under 214 | any particular circumstance, the balance of the section is intended to 215 | apply and the section as a whole is intended to apply in other 216 | circumstances. 217 | 218 | It is not the purpose of this section to induce you to infringe any 219 | patents or other property right claims or to contest validity of any 220 | such claims; this section has the sole purpose of protecting the 221 | integrity of the free software distribution system, which is 222 | implemented by public license practices. Many people have made 223 | generous contributions to the wide range of software distributed 224 | through that system in reliance on consistent application of that 225 | system; it is up to the author/donor to decide if he or she is willing 226 | to distribute software through any other system and a licensee cannot 227 | impose that choice. 228 | 229 | This section is intended to make thoroughly clear what is believed to 230 | be a consequence of the rest of this License. 231 | 232 | 233 | 8. If the distribution and/or use of the Program is restricted in 234 | certain countries either by patents or by copyrighted interfaces, the 235 | original copyright holder who places the Program under this License 236 | may add an explicit geographical distribution limitation excluding 237 | those countries, so that distribution is permitted only in or among 238 | countries not thus excluded. In such case, this License incorporates 239 | the limitation as if written in the body of this License. 240 | 241 | 9. The Free Software Foundation may publish revised and/or new versions 242 | of the General Public License from time to time. Such new versions will 243 | be similar in spirit to the present version, but may differ in detail to 244 | address new problems or concerns. 245 | 246 | Each version is given a distinguishing version number. If the Program 247 | specifies a version number of this License which applies to it and "any 248 | later version", you have the option of following the terms and conditions 249 | either of that version or of any later version published by the Free 250 | Software Foundation. If the Program does not specify a version number of 251 | this License, you may choose any version ever published by the Free Software 252 | Foundation. 253 | 254 | 10. If you wish to incorporate parts of the Program into other free 255 | programs whose distribution conditions are different, write to the author 256 | to ask for permission. For software which is copyrighted by the Free 257 | Software Foundation, write to the Free Software Foundation; we sometimes 258 | make exceptions for this. Our decision will be guided by the two goals 259 | of preserving the free status of all derivatives of our free software and 260 | of promoting the sharing and reuse of software generally. 261 | 262 | NO WARRANTY 263 | 264 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 265 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 266 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 267 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 268 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 269 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 270 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 271 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 272 | REPAIR OR CORRECTION. 273 | 274 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 275 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 276 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 277 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 278 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 279 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 280 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 281 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 282 | POSSIBILITY OF SUCH DAMAGES. 283 | 284 | END OF TERMS AND CONDITIONS 285 | 286 | 287 | How to Apply These Terms to Your New Programs 288 | 289 | If you develop a new program, and you want it to be of the greatest 290 | possible use to the public, the best way to achieve this is to make it 291 | free software which everyone can redistribute and change under these terms. 292 | 293 | To do so, attach the following notices to the program. It is safest 294 | to attach them to the start of each source file to most effectively 295 | convey the exclusion of warranty; and each file should have at least 296 | the "copyright" line and a pointer to where the full notice is found. 297 | 298 | 299 | Copyright (C) 300 | 301 | This program is free software; you can redistribute it and/or modify 302 | it under the terms of the GNU General Public License as published by 303 | the Free Software Foundation; either version 2 of the License, or 304 | (at your option) any later version. 305 | 306 | This program is distributed in the hope that it will be useful, 307 | but WITHOUT ANY WARRANTY; without even the implied warranty of 308 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 309 | GNU General Public License for more details. 310 | 311 | You should have received a copy of the GNU General Public License 312 | along with this program; if not, write to the Free Software 313 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 314 | 315 | 316 | Also add information on how to contact you by electronic and paper mail. 317 | 318 | If the program is interactive, make it output a short notice like this 319 | when it starts in an interactive mode: 320 | 321 | Gnomovision version 69, Copyright (C) year name of author 322 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 323 | This is free software, and you are welcome to redistribute it 324 | under certain conditions; type `show c' for details. 325 | 326 | The hypothetical commands `show w' and `show c' should show the appropriate 327 | parts of the General Public License. Of course, the commands you use may 328 | be called something other than `show w' and `show c'; they could even be 329 | mouse-clicks or menu items--whatever suits your program. 330 | 331 | You should also get your employer (if you work as a programmer) or your 332 | school, if any, to sign a "copyright disclaimer" for the program, if 333 | necessary. Here is a sample; alter the names: 334 | 335 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 336 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 337 | 338 | , 1 April 1989 339 | Ty Coon, President of Vice 340 | 341 | This General Public License does not permit incorporating your program into 342 | proprietary programs. If your program is a subroutine library, you may 343 | consider it more useful to permit linking proprietary applications with the 344 | library. If this is what you want to do, use the GNU Library General 345 | Public License instead of this License. 346 | -------------------------------------------------------------------------------- /license-id.txt: -------------------------------------------------------------------------------- 1 | LIMITED USE SOFTWARE LICENSE AGREEMENT 2 | 3 | This Limited Use Software License Agreement (the "Agreement") 4 | is a legal agreement between you, the end-user, and Id Software, Inc. 5 | ("ID"). By continuing the downloading of this Wolfenstein 3D 6 | (the "Trademark") software material, which includes source code 7 | (the "Source Code"), artwork data, music and software tools 8 | (collectively, the "Software"), you are agreeing to be bound by the 9 | terms of this Agreement. If you do not agree to the terms of this 10 | Agreement, promptly destroy the Software you may have downloaded. 11 | 12 | ID SOFTWARE LICENSE 13 | 14 | Grant of License. ID grants to you the right to use one (1) 15 | copy of the Software on a single computer. You have no ownership or 16 | proprietary rights in or to the Software, or the Trademark. For purposes 17 | of this section, "use" means loading the Software into RAM, as well as 18 | installation on a hard disk or other storage device. The Software, 19 | together with any archive copy thereof, shall be destroyed when no longer 20 | used in accordance with this Agreement, or when the right to use the 21 | Software is terminated. You agree that the Software will not be shipped, 22 | transferred or exported into any country in violation of the U.S. 23 | Export Administration Act (or any other law governing such matters) and 24 | that you will not utilize, in any other manner, the Software in violation 25 | of any applicable law. 26 | 27 | Permitted Uses. For educational purposes only, you, the end-user, 28 | may use portions of the Source Code, such as particular routines, to 29 | develop your own software, but may not duplicate the Source Code, except 30 | as noted in paragraph 4. The limited right referenced in the preceding 31 | sentence is hereinafter referred to as "Educational Use." By so exercising 32 | the Educational Use right you shall not obtain any ownership, copyright, 33 | proprietary or other interest in or to the Source Code, or any portion of 34 | the Source Code. You may dispose of your own software in your sole 35 | discretion. With the exception of the Educational Use right, you may not 36 | otherwise use the Software, or an portion of the Software, which includes 37 | the Source Code, for commercial gain. 38 | 39 | Prohibited Uses: Under no circumstances shall you, the end-user, 40 | be permitted, allowed or authorized to commercially exploit the Software. 41 | Neither you nor anyone at your direction shall do any of the following acts 42 | with regard to the Software, or any portion thereof: 43 | 44 | Rent; 45 | 46 | Sell; 47 | 48 | Lease; 49 | 50 | Offer on a pay-per-play basis; 51 | 52 | Distribute for money or any other consideration; or 53 | 54 | In any other manner and through any medium whatsoever commercially 55 | exploit or use for any commercial purpose. 56 | 57 | Notwithstanding the foregoing prohibitions, you may commercially exploit the 58 | software you develop by exercising the Educational Use right, referenced in 59 | paragraph 2. hereinabove. 60 | 61 | Copyright. The Software and all copyrights related thereto 62 | (including all characters and other images generated by the Software 63 | or depicted in the Software) are owned by ID and is protected by 64 | United States copyright laws and international treaty provisions. 65 | Id shall retain exclusive ownership and copyright in and to the Software 66 | and all portions of the Software and you shall have no ownership or other 67 | proprietary interest in such materials. You must treat the Software like 68 | any other copyrighted material, except that you may either (a) make one 69 | copy of the Software solely for back-up or archival purposes, or (b) 70 | transfer the Software to a single hard disk provided you keep the original 71 | solely for back-up or archival purposes. You may not otherwise reproduce, 72 | copy or disclose to others, in whole or in any part, the Software. You 73 | may not copy the written materials accompanying the Software. You agree 74 | to use your best efforts to see that any user of the Software licensed 75 | hereunder complies with this Agreement. 76 | 77 | NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS IMPLIED, 78 | INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND 79 | FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE SOFTWARE. THIS LIMITED 80 | WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH 81 | VARY FROM JURISDICTION TO JURISDICTION. ID DOES NOT WARRANT THAT THE 82 | OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR 83 | SPECIFIC REQUIREMENTS. THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER 84 | EXPRESS WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES, 85 | DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE MODIFICATIONS TO 86 | THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF OF ID. 87 | 88 | Exclusive Remedies. The Software is being offered to you free of any 89 | charge. You agree that you have no remedy against ID, its affiliates, 90 | contractors, suppliers, and agents for loss or damage caused by any defect 91 | or failure in the Software regardless of the form of action, whether in 92 | contract, tort, includinegligence, strict liability or otherwise, with 93 | regard to the Software. This Agreement shall be construed in accordance 94 | with and governed by the laws of the State of Texas. Copyright and other 95 | proprietary matters will be governed by United States laws and international 96 | treaties. IN ANY CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF 97 | PROFITS, LOST SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER 98 | SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT, 99 | NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN ADVISED 100 | OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. 101 | Some jurisdictions do not allow the exclusion or limitation of incidental or 102 | consequential damages, so the above limitation or exclusion may not apply to 103 | you. 104 | 105 | General Provisions. Neither this Agreement nor any part or portion 106 | hereof shall be assigned, sublicensed or otherwise transferred by you. 107 | Should any provision of this Agreement be held to be void, invalid, 108 | unenforceable or illegal by a court, the validity and enforceability of the 109 | other provisions shall not be affected thereby. If any provision is 110 | determined to be unenforceable, you agree to a modification of such 111 | provision to provide for enforcement of the provision's intent, to the 112 | extent permitted by applicable law. Failure of a party to enforce any 113 | provision of this Agreement shall not constitute or be construed as a 114 | waiver of such provision or of the right to enforce such provision. If 115 | you fail to comply with any terms of this Agreement, YOUR LICENSE IS 116 | AUTOMATICALLY TERMINATED and you agree to the issuance of an injunction 117 | against you in favor of Id. You agree that Id shall not have to post 118 | bond or other security to obtain an injunction against you to prohibit 119 | you from violating Id's rights. 120 | 121 | YOU ACKNOWLEDGE THAT YOU HAVE READ THIS AGREEMENT, THAT YOU 122 | UNDERSTAND THIS AGREEMENT, AND UNDERSTAND THAT BY CONTINUING THE 123 | DOWNLOADING OF THE SOFTWARE, YOU AGREE TO BE BOUND BY THIS AGREEMENT'S 124 | TERMS AND CONDITIONS. YOU FURTHER AGREE THAT, EXCEPT FOR WRITTEN SEPARATE 125 | AGREEMENTS BETWEEN ID AND YOU, THIS AGREEMENT IS A COMPLETE AND EXCLUSIVE 126 | STATEMENT OF THE RIGHTS AND LIABILITIES OF THE PARTIES. THIS AGREEMENT 127 | SUPERSEDES ALL PRIOR ORAL AGREEMENTS, PROPOSALS OR UNDERSTANDINGS, AND 128 | ANY OTHER COMMUNICATIONS BETWEEN ID AND YOU RELATING TO THE SUBJECT MATTER 129 | OF THIS AGREEMENT 130 | -------------------------------------------------------------------------------- /license-mame.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 1997-2005, Nicola Salmoria and the MAME team 2 | All rights reserved. 3 | 4 | Redistribution and use of this code or any derivative works are permitted 5 | provided that the following conditions are met: 6 | 7 | * Redistributions may not be sold, nor may they be used in a commercial 8 | product or activity. 9 | 10 | * Redistributions that are modified from the original source must include the 11 | complete source code, including the source code for all components used by a 12 | binary built from the modified sources. However, as a special exception, the 13 | source code distributed need not include anything that is normally distributed 14 | (in either source or binary form) with the major components (compiler, kernel, 15 | and so on) of the operating system on which the executable runs, unless that 16 | component itself accompanies the executable. 17 | 18 | * Redistributions must reproduce the above copyright notice, this list of 19 | conditions and the following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /readme-wolf.txt: -------------------------------------------------------------------------------- 1 | Wolf4SDL by Moritz "Ripper" Kroll (http://www.chaos-software.de.vu) 2 | Original Wolfenstein 3D by id Software (http://www.idsoftware.com) 3 | Modifications to r262 by Andy_Nonymous and others 4 | (http://diehardwolfers.areyep.com/viewtopic.php?t=6693) 5 | ============================================================================= 6 | 7 | Wolf4SDL is an open-source port of id Software's classic first-person shooter 8 | Wolfenstein 3D to the cross-platform multimedia library "Simple DirectMedia 9 | Layer (SDL)" (http://www.libsdl.org). It is meant to keep the original feel 10 | while taking advantage of some improvements mentioned in the list below. 11 | 12 | 13 | Main features: 14 | -------------- 15 | 16 | - Cross-platform: 17 | Supported operating systems are at least: 18 | - Windows 98, Windows ME, Windows 2000, Windows XP, Windows Vista 19 | (32 and 64 bit), Windows 7 (32 and 64 bit) 20 | - Linux 21 | - BSD variants 22 | - Mac OS X (x86) 23 | - KallistiOS (used for Dreamcast) 24 | Only little endian platforms like x86, ARM and SH-4 are supported, yet. 25 | 26 | - AdLib sounds and music: 27 | This port includes the OPL2 emulator from MAME, so you can not only 28 | hear the AdLib sounds but also music without any AdLib-compatible 29 | soundcard in near to perfect quality! 30 | 31 | - Multichannel digitized sounds: 32 | Digitized sounds play on 8 channels! So in a fire fight you will 33 | always hear, when a guard opens the door behind you ;) 34 | 35 | - Higher screen resolutions: 36 | Aside from the original 320x200 resolution, Wolf4SDL currently 37 | supports any resolutions being multiples of 320x200 or 320x240, 38 | the default being 640x400. 39 | Unlike some other ports, Wolf4SDL does NOT apply any bilinear 40 | or similar filtering, so the graphics are NOT blurred but 41 | pixelated just as we love it. 42 | 43 | - Fully playable with only a game controller: 44 | Wolf4SDL can be played completely without a keyboard. At least two 45 | buttons are required (shoot/YES and open door/NO), but five or more 46 | are recommended (run, strafe, ESC). 47 | 48 | Additional features: 49 | -------------------- 50 | 51 | - Two additional view sizes: 52 | Wolf4SDL supports one view size using the full width of the screen 53 | and showing the status bar, like in Mac-enstein, and one view size 54 | filling the whole screen (press TAB to see the status bar). 55 | 56 | - (Nearly) unlimited sound and song lengths: 57 | Mod developers are not restricted to 64kB for digitized sounds and 58 | IMF songs anymore, so longer songs and digitized sounds with better 59 | quality are possible. 60 | 61 | - Resuming ingame music: 62 | When you come back to the game from the menu or load a save game, the 63 | music will be resumed where it was suspended rather than started from 64 | the beginning. 65 | 66 | - Freely movable pushwalls: 67 | Moving pushwalls can be viewed from all sides, allowing mod developers 68 | to place them with fewer restrictions. The player can also follow the 69 | pushwall directly instead of having to wait until the pushwall has left 70 | a whole tile. 71 | 72 | - Optional integrated features for mod developers: 73 | Wolf4SDL already contains the shading, directional 3D sprites, 74 | floor and ceiling textures, high resolution textures/sprites, 75 | parallax sky, cloud sky and outside atmosphere features, which 76 | can be easily activated in version.h. 77 | 78 | 79 | The following versions of Wolfenstein 3D data files are currently supported 80 | by the source code (choose the version by commenting/uncommenting lines in 81 | version.h as described in that file): 82 | 83 | - Wolfenstein 3D v1.1 full Apogee 84 | - Wolfenstein 3D v1.4 full Apogee 85 | - Wolfenstein 3D v1.4 full GT/ID/Activision 86 | - Wolfenstein 3D v1.4 full Imagineer (Japanese) 87 | - Wolfenstein 3D v1.0 shareware Apogee 88 | - Wolfenstein 3D v1.1 shareware Apogee 89 | - Wolfenstein 3D v1.2 shareware Apogee 90 | - Wolfenstein 3D v1.4 shareware 91 | - Spear of Destiny full 92 | - Spear of Destiny demo 93 | - Spear of Destiny - Mission 2: Return to Danger (not tested) 94 | - Spear of Destiny - Mission 3: Ultimate Challenge (not tested) 95 | 96 | 97 | How to play: 98 | ------------ 99 | 100 | To play Wolfenstein 3D with Wolf4SDL, you just have to copy the original data 101 | files (e.g. *.WL6) into the same directory as the Wolf4SDL executable. 102 | Please make sure, that you use the correct version of the executable with the 103 | according data files version as the differences are hardcoded into the binary! 104 | 105 | On Windows SDL.dll and SDL_mixer.dll must also be copied into this directory. 106 | They are also available at http://www.chaos-software.de.vu 107 | 108 | If you play in windowed mode (--windowed parameter), press SCROLLLOCK or F12 109 | to grab the mouse. Press it again to release the mouse. 110 | 111 | 112 | Usage: 113 | ------ 114 | 115 | Wolf4SDL supports the following command line options: 116 | --help This help page 117 | --tedlevel Starts the game in the given level 118 | --baby Sets the difficulty to baby for tedlevel 119 | --easy Sets the difficulty to easy for tedlevel 120 | --normal Sets the difficulty to normal for tedlevel 121 | --hard Sets the difficulty to hard for tedlevel 122 | --nowait Skips intro screens 123 | --windowed[-mouse] Starts the game in a window [and grabs mouse] 124 | --res Sets the screen resolution 125 | (must be multiple of 320x200 or 320x240) 126 | --resf Sets any screen resolution >= 320x200 127 | (which may result in graphic errors) 128 | --bits Sets the screen color depth 129 | (Use this when you have palette/fading problem 130 | or perhaps to optimize speed on old systems. 131 | Allowed: 8, 16, 24, 32, default: "best" depth) 132 | --nodblbuf Don't use SDL's double buffering 133 | --extravbls Sets a delay after each frame, which may help to 134 | reduce flickering (SDL does not support vsync...) 135 | (unit is currently 8 ms, default: 0) 136 | --joystick Use the index-th joystick if available 137 | --joystickhat Enables movement with the given coolie hat 138 | --samplerate Sets the sound sample rate (given in Hz) 139 | --audiobuffer Sets the size of the audio buffer (-> sound latency) 140 | (given in bytes) 141 | --ignorenumchunks Ignores the number of chunks in VGAHEAD.* 142 | (may be useful for some broken mods) 143 | --configdir Directory where config file and save games are stored 144 | (Windows default: current directory, 145 | others: $HOME/.wolf4sdl) 146 | 147 | For Spear of Destiny the following additional options are available: 148 | --mission Mission number to play (1-3) 149 | --goodtimes Disable copy protection quiz 150 | 151 | 152 | Compiling from source code: 153 | --------------------------- 154 | 155 | The current version of the source code is available in the svn repository at: 156 | svn://tron.homeunix.org:3690/wolf3d/trunk 157 | 158 | The following ways of compiling the source code are supported: 159 | - Makefile (for Linux, BSD variants and MinGW/MSYS) 160 | - Visual C++ 2008 (Wolf4SDL.VC9.sln and Wolf4SDL.VC9.vcproj) 161 | - Visual C++ 2005 (Wolf4SDL.sln and Wolf4SDL.vcproj) 162 | - Visual C++ 6 (Wolf4SDL.dsw and Wolf4SDL.dsp) 163 | - Code::Blocks 8.02 (Wolf4SDL.cbp) 164 | - Dev-C++ 5.0 Beta 9.2 (4.9.9.2) (Wolf4SDL.dev) (see README-devcpp.txt) 165 | - Xcode (for Mac OS X, macosx/Wolf4SDL.xcodeproj/project.pbxproj) 166 | - Special compiling for Dreamcast (see README-dc.txt) 167 | - Special compiling for GP2X (see README-GP2X.txt) 168 | 169 | To compile the source code you need the development libraries of 170 | - SDL (http://www.libsdl.org/download-1.2.php) and 171 | - SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/) 172 | and have to adjust the include and library paths in the projects accordingly. 173 | 174 | Please note, that there is no official SDL_mixer development pack for MinGW, 175 | yet, but you can get the needed files from a Dev-C++ package here: 176 | http://sourceforge.net/project/showfiles.php?group_id=94270&package_id=151751 177 | Just rename the file extension from ".devpack" to ".tar.bz2" and unpack it 178 | with for example WinRAR. Then add the directories include/SDL and lib to the 179 | according search paths in your project. 180 | 181 | IMPORTANT: Do not forget to take care of version.h! 182 | By default it compiles for "Wolfenstein 3D v1.4 full GT/ID/Activision"! 183 | 184 | 185 | TODOs: 186 | ------ 187 | 188 | - Center non-ingame screens for resolutions being a multiple of 320x240 189 | - Add support for any graphic resolution >= 320x200 190 | 191 | 192 | Known bugs: 193 | ----------- 194 | 195 | - None! ;D 196 | 197 | 198 | Troubleshooting: 199 | ---------------- 200 | 201 | - If your frame rate is low, consider using the original screen resolution 202 | (--res 320 200) or lowering the sound quality (--samplerate 22050) 203 | 204 | 205 | Credits: 206 | -------- 207 | 208 | - Special thanks to id Software! Without the source code we would still have 209 | to pelt Wolfenstein 3D with hex editors and disassemblers ;D 210 | - Special thanks to the DOSBox team for providing a GPL'ed OPL2/3 emulator! 211 | - Special thanks to the MAME developer team for providing the source code 212 | of the OPL2 emulator! 213 | - Many thanks to "Der Tron" for hosting the svn repository, making Wolf4SDL 214 | FreeBSD compatible, testing, bugfixing and cleaning up the code! 215 | - Thanks to Chris Chokan for his improvements on Wolf4GW (base of Wolf4SDL) 216 | - Thanks to Pickle for the GP2X support and help on 320x240 support 217 | - Thanks to fackue for the Dreamcast support 218 | - Thanks to Chris Ballinger for the Mac OS X support 219 | - Thanks to Xilinx, Inc. for providing a list of maximum-length LFSR counters 220 | used for higher resolutions of fizzle fade 221 | 222 | 223 | Licenses: 224 | --------- 225 | 226 | - The original source code of Wolfenstein 3D: 227 | At your choice: 228 | - license-id.txt or 229 | - license-gpl.txt 230 | - The OPL2 emulator: 231 | At your choice: 232 | - license-mame.txt (fmopl.cpp) 233 | - license-gpl.txt (dbopl.cpp, USE_GPL define in version.h or set GPL=1 for Makefile) 234 | -------------------------------------------------------------------------------- /screenshots/ingame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hax0kartik/wolf4sdl-3ds/328d945c7f1d1998134019bb9d6f4b0f13722ca7/screenshots/ingame.png -------------------------------------------------------------------------------- /screenshots/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hax0kartik/wolf4sdl-3ds/328d945c7f1d1998134019bb9d6f4b0f13722ca7/screenshots/screenshot.png -------------------------------------------------------------------------------- /src/audiosod.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////// 2 | // 3 | // MUSE Header for .SOD 4 | // Created Thu Aug 13 09:25:58 1992 5 | // 6 | ///////////////////////////////////////////////// 7 | 8 | #define NUMSOUNDS 81 9 | #define NUMSNDCHUNKS 267 10 | 11 | // 12 | // Sound names & indexes 13 | // 14 | typedef enum { 15 | HITWALLSND, // 0 16 | MISSILEHITSND, // 1 17 | SELECTITEMSND, // 2 18 | GHOSTSIGHTSND, // 3 19 | MOVEGUN2SND, // 4 20 | MOVEGUN1SND, // 5 21 | NOWAYSND, // 6 22 | NAZIHITPLAYERSND, // 7 23 | MISSILEFIRESND, // 8 24 | PLAYERDEATHSND, // 9 25 | DOGDEATHSND, // 10 26 | ATKGATLINGSND, // 11 27 | GETKEYSND, // 12 28 | NOITEMSND, // 13 29 | WALK1SND, // 14 30 | WALK2SND, // 15 31 | TAKEDAMAGESND, // 16 32 | GAMEOVERSND, // 17 33 | OPENDOORSND, // 18 34 | CLOSEDOORSND, // 19 35 | DONOTHINGSND, // 20 36 | HALTSND, // 21 37 | DEATHSCREAM2SND, // 22 38 | ATKKNIFESND, // 23 39 | ATKPISTOLSND, // 24 40 | DEATHSCREAM3SND, // 25 41 | ATKMACHINEGUNSND, // 26 42 | HITENEMYSND, // 27 43 | SHOOTDOORSND, // 28 44 | DEATHSCREAM1SND, // 29 45 | GETMACHINESND, // 30 46 | GETAMMOSND, // 31 47 | SHOOTSND, // 32 48 | HEALTH1SND, // 33 49 | HEALTH2SND, // 34 50 | BONUS1SND, // 35 51 | BONUS2SND, // 36 52 | BONUS3SND, // 37 53 | GETGATLINGSND, // 38 54 | ESCPRESSEDSND, // 39 55 | LEVELDONESND, // 40 56 | DOGBARKSND, // 41 57 | ENDBONUS1SND, // 42 58 | ENDBONUS2SND, // 43 59 | BONUS1UPSND, // 44 60 | BONUS4SND, // 45 61 | PUSHWALLSND, // 46 62 | NOBONUSSND, // 47 63 | PERCENT100SND, // 48 64 | BOSSACTIVESND, // 49 65 | DEATHSCREAM4SND, // 50 66 | SCHUTZADSND, // 51 67 | AHHHGSND, // 52 68 | DEATHSCREAM5SND, // 53 69 | DEATHSCREAM7SND, // 54 70 | DEATHSCREAM8SND, // 55 71 | LEBENSND, // 56 72 | DEATHSCREAM6SND, // 57 73 | NAZIFIRESND, // 58 74 | BOSSFIRESND, // 59 75 | SSFIRESND, // 60 76 | SLURPIESND, // 61 77 | GHOSTFADESND, // 62 78 | DEATHSCREAM9SND, // 63 79 | GETAMMOBOXSND, // 64 80 | ANGELSIGHTSND, // 65 81 | SPIONSND, // 66 82 | NEINSOVASSND, // 67 83 | DOGATTACKSND, // 68 84 | ANGELFIRESND, // 69 85 | TRANSSIGHTSND, // 70 86 | TRANSDEATHSND, // 71 87 | WILHELMSIGHTSND, // 72 88 | WILHELMDEATHSND, // 73 89 | UBERDEATHSND, // 74 90 | KNIGHTSIGHTSND, // 75 91 | KNIGHTDEATHSND, // 76 92 | ANGELDEATHSND, // 77 93 | KNIGHTMISSILESND, // 78 94 | GETSPEARSND, // 79 95 | ANGELTIREDSND, // 80 96 | LASTSOUND 97 | } soundnames; 98 | 99 | // 100 | // Base offsets 101 | // 102 | #define STARTPCSOUNDS 0 103 | #define STARTADLIBSOUNDS 81 104 | #define STARTDIGISOUNDS 162 105 | #define STARTMUSIC 243 106 | 107 | // 108 | // Music names & indexes 109 | // 110 | typedef enum { 111 | XFUNKIE_MUS, // 0 112 | DUNGEON_MUS, // 1 113 | XDEATH_MUS, // 2 114 | GETTHEM_MUS, // 3 115 | XTIPTOE_MUS, // 4 116 | GOINGAFT_MUS, // 5 117 | URAHERO_MUS, // 6 118 | XTHEEND_MUS, // 7 119 | NAZI_OMI_MUS, // 8 120 | POW_MUS, // 9 121 | TWELFTH_MUS, // 10 122 | SEARCHN_MUS, // 11 123 | SUSPENSE_MUS, // 12 124 | ZEROHOUR_MUS, // 13 125 | WONDERIN_MUS, // 14 126 | ULTIMATE_MUS, // 15 127 | ENDLEVEL_MUS, // 16 128 | XEVIL_MUS, // 17 129 | XJAZNAZI_MUS, // 18 130 | COPYPRO_MUS, // 19 131 | XAWARD_MUS, // 20 132 | XPUTIT_MUS, // 21 133 | XGETYOU_MUS, // 22 134 | XTOWER2_MUS, // 23 135 | LASTMUSIC 136 | } musicnames; 137 | 138 | ///////////////////////////////////////////////// 139 | // 140 | // Thanks for playing with MUSE! 141 | // 142 | ///////////////////////////////////////////////// 143 | -------------------------------------------------------------------------------- /src/audiowl6.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////// 2 | // 3 | // MUSE Header for .WL6 4 | // Created Tue Jul 14 15:04:53 1992 5 | // 6 | ///////////////////////////////////////////////// 7 | 8 | // 9 | // Sound names & indexes 10 | // 11 | typedef enum { 12 | HITWALLSND, // 0 13 | SELECTWPNSND, // 1 14 | SELECTITEMSND, // 2 15 | HEARTBEATSND, // 3 16 | MOVEGUN2SND, // 4 17 | MOVEGUN1SND, // 5 18 | NOWAYSND, // 6 19 | NAZIHITPLAYERSND, // 7 20 | SCHABBSTHROWSND, // 8 21 | PLAYERDEATHSND, // 9 22 | DOGDEATHSND, // 10 23 | ATKGATLINGSND, // 11 24 | GETKEYSND, // 12 25 | NOITEMSND, // 13 26 | WALK1SND, // 14 27 | WALK2SND, // 15 28 | TAKEDAMAGESND, // 16 29 | GAMEOVERSND, // 17 30 | OPENDOORSND, // 18 31 | CLOSEDOORSND, // 19 32 | DONOTHINGSND, // 20 33 | HALTSND, // 21 34 | DEATHSCREAM2SND, // 22 35 | ATKKNIFESND, // 23 36 | ATKPISTOLSND, // 24 37 | DEATHSCREAM3SND, // 25 38 | ATKMACHINEGUNSND, // 26 39 | HITENEMYSND, // 27 40 | SHOOTDOORSND, // 28 41 | DEATHSCREAM1SND, // 29 42 | GETMACHINESND, // 30 43 | GETAMMOSND, // 31 44 | SHOOTSND, // 32 45 | HEALTH1SND, // 33 46 | HEALTH2SND, // 34 47 | BONUS1SND, // 35 48 | BONUS2SND, // 36 49 | BONUS3SND, // 37 50 | GETGATLINGSND, // 38 51 | ESCPRESSEDSND, // 39 52 | LEVELDONESND, // 40 53 | DOGBARKSND, // 41 54 | ENDBONUS1SND, // 42 55 | ENDBONUS2SND, // 43 56 | BONUS1UPSND, // 44 57 | BONUS4SND, // 45 58 | PUSHWALLSND, // 46 59 | NOBONUSSND, // 47 60 | PERCENT100SND, // 48 61 | BOSSACTIVESND, // 49 62 | MUTTISND, // 50 63 | SCHUTZADSND, // 51 64 | AHHHGSND, // 52 65 | DIESND, // 53 66 | EVASND, // 54 67 | GUTENTAGSND, // 55 68 | LEBENSND, // 56 69 | SCHEISTSND, // 57 70 | NAZIFIRESND, // 58 71 | BOSSFIRESND, // 59 72 | SSFIRESND, // 60 73 | SLURPIESND, // 61 74 | TOT_HUNDSND, // 62 75 | MEINGOTTSND, // 63 76 | SCHABBSHASND, // 64 77 | HITLERHASND, // 65 78 | SPIONSND, // 66 79 | NEINSOVASSND, // 67 80 | DOGATTACKSND, // 68 81 | FLAMETHROWERSND, // 69 82 | MECHSTEPSND, // 70 83 | GOOBSSND, // 71 84 | YEAHSND, // 72 85 | #ifndef APOGEE_1_0 86 | DEATHSCREAM4SND, // 73 87 | DEATHSCREAM5SND, // 74 88 | DEATHSCREAM6SND, // 75 89 | DEATHSCREAM7SND, // 76 90 | DEATHSCREAM8SND, // 77 91 | DEATHSCREAM9SND, // 78 92 | DONNERSND, // 79 93 | EINESND, // 80 94 | ERLAUBENSND, // 81 95 | KEINSND, // 82 96 | MEINSND, // 83 97 | ROSESND, // 84 98 | MISSILEFIRESND, // 85 99 | MISSILEHITSND, // 86 100 | #endif 101 | LASTSOUND 102 | } soundnames; 103 | 104 | // 105 | // Base offsets 106 | // 107 | #define STARTPCSOUNDS 0 108 | #define STARTADLIBSOUNDS LASTSOUND 109 | #define STARTDIGISOUNDS (2*LASTSOUND) 110 | #define STARTMUSIC (3*LASTSOUND) 111 | 112 | // 113 | // Music names & indexes 114 | // 115 | typedef enum { 116 | CORNER_MUS, // 0 117 | DUNGEON_MUS, // 1 118 | WARMARCH_MUS, // 2 119 | GETTHEM_MUS, // 3 120 | HEADACHE_MUS, // 4 121 | HITLWLTZ_MUS, // 5 122 | INTROCW3_MUS, // 6 123 | NAZI_NOR_MUS, // 7 124 | NAZI_OMI_MUS, // 8 125 | POW_MUS, // 9 126 | SALUTE_MUS, // 10 127 | SEARCHN_MUS, // 11 128 | SUSPENSE_MUS, // 12 129 | VICTORS_MUS, // 13 130 | WONDERIN_MUS, // 14 131 | FUNKYOU_MUS, // 15 132 | ENDLEVEL_MUS, // 16 133 | GOINGAFT_MUS, // 17 134 | PREGNANT_MUS, // 18 135 | ULTIMATE_MUS, // 19 136 | NAZI_RAP_MUS, // 20 137 | ZEROHOUR_MUS, // 21 138 | TWELFTH_MUS, // 22 139 | ROSTER_MUS, // 23 140 | URAHERO_MUS, // 24 141 | VICMARCH_MUS, // 25 142 | PACMAN_MUS, // 26 143 | LASTMUSIC 144 | } musicnames; 145 | 146 | #define NUMSOUNDS LASTSOUND 147 | #define NUMSNDCHUNKS (STARTMUSIC + LASTMUSIC) 148 | 149 | ///////////////////////////////////////////////// 150 | // 151 | // Thanks for playing with MUSE! 152 | // 153 | ///////////////////////////////////////////////// 154 | -------------------------------------------------------------------------------- /src/dosbox/dbopl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2010 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #if defined(_arch_dreamcast) 20 | # include "dc/dc_main.h" 21 | #elif !defined(_WIN32) 22 | # include 23 | #endif 24 | #include 25 | 26 | //typedef uintptr_t Bitu; 27 | //typedef intptr_t Bits; 28 | typedef uint32_t Bitu; 29 | typedef int32_t Bits; 30 | typedef uint32_t Bit32u; 31 | typedef int32_t Bit32s; 32 | typedef uint16_t Bit16u; 33 | typedef int16_t Bit16s; 34 | typedef uint8_t Bit8u; 35 | typedef int8_t Bit8s; 36 | 37 | //#include "adlib.h" 38 | //#include "dosbox.h" 39 | 40 | //Use 8 handlers based on a small logatirmic wavetabe and an exponential table for volume 41 | #define WAVE_HANDLER 10 42 | //Use a logarithmic wavetable with an exponential table for volume 43 | #define WAVE_TABLELOG 11 44 | //Use a linear wavetable with a multiply table for volume 45 | #define WAVE_TABLEMUL 12 46 | 47 | //Select the type of wave generator routine 48 | #define DBOPL_WAVE WAVE_TABLEMUL 49 | 50 | namespace DBOPL { 51 | 52 | struct Chip; 53 | struct Operator; 54 | struct Channel; 55 | 56 | #if (DBOPL_WAVE == WAVE_HANDLER) 57 | typedef Bits ( DB_FASTCALL *WaveHandler) ( Bitu i, Bitu volume ); 58 | #endif 59 | 60 | typedef Bits ( DBOPL::Operator::*VolumeHandler) ( ); 61 | typedef Channel* ( DBOPL::Channel::*SynthHandler) ( Chip* chip, Bit32u samples, Bit32s* output ); 62 | 63 | //Different synth modes that can generate blocks of data 64 | typedef enum { 65 | sm2AM, 66 | sm2FM, 67 | sm3AM, 68 | sm3FM, 69 | sm4Start, 70 | sm3FMFM, 71 | sm3AMFM, 72 | sm3FMAM, 73 | sm3AMAM, 74 | sm6Start, 75 | sm2Percussion, 76 | sm3Percussion, 77 | } SynthMode; 78 | 79 | //Shifts for the values contained in chandata variable 80 | enum { 81 | SHIFT_KSLBASE = 16, 82 | SHIFT_KEYCODE = 24, 83 | }; 84 | 85 | struct Operator { 86 | public: 87 | //Masks for operator 20 values 88 | enum { 89 | MASK_KSR = 0x10, 90 | MASK_SUSTAIN = 0x20, 91 | MASK_VIBRATO = 0x40, 92 | MASK_TREMOLO = 0x80, 93 | }; 94 | 95 | typedef enum { 96 | OFF, 97 | RELEASE, 98 | SUSTAIN, 99 | DECAY, 100 | ATTACK, 101 | } State; 102 | 103 | VolumeHandler volHandler; 104 | 105 | #if (DBOPL_WAVE == WAVE_HANDLER) 106 | WaveHandler waveHandler; //Routine that generate a wave 107 | #else 108 | Bit16s* waveBase; 109 | Bit32u waveMask; 110 | Bit32u waveStart; 111 | #endif 112 | Bit32u waveIndex; //WAVE_BITS shifted counter of the frequency index 113 | Bit32u waveAdd; //The base frequency without vibrato 114 | Bit32u waveCurrent; //waveAdd + vibratao 115 | 116 | Bit32u chanData; //Frequency/octave and derived data coming from whatever channel controls this 117 | Bit32u freqMul; //Scale channel frequency with this, TODO maybe remove? 118 | Bit32u vibrato; //Scaled up vibrato strength 119 | Bit32s sustainLevel; //When stopping at sustain level stop here 120 | Bit32s totalLevel; //totalLevel is added to every generated volume 121 | Bit32u currentLevel; //totalLevel + tremolo 122 | Bit32s volume; //The currently active volume 123 | 124 | Bit32u attackAdd; //Timers for the different states of the envelope 125 | Bit32u decayAdd; 126 | Bit32u releaseAdd; 127 | Bit32u rateIndex; //Current position of the evenlope 128 | 129 | Bit8u rateZero; //Bits for the different states of the envelope having no changes 130 | Bit8u keyOn; //Bitmask of different values that can generate keyon 131 | //Registers, also used to check for changes 132 | Bit8u reg20, reg40, reg60, reg80, regE0; 133 | //Active part of the envelope we're in 134 | Bit8u state; 135 | //0xff when tremolo is enabled 136 | Bit8u tremoloMask; 137 | //Strength of the vibrato 138 | Bit8u vibStrength; 139 | //Keep track of the calculated KSR so we can check for changes 140 | Bit8u ksr; 141 | private: 142 | void SetState( Bit8u s ); 143 | void UpdateAttack( const Chip* chip ); 144 | void UpdateRelease( const Chip* chip ); 145 | void UpdateDecay( const Chip* chip ); 146 | public: 147 | void UpdateAttenuation(); 148 | void UpdateRates( const Chip* chip ); 149 | void UpdateFrequency( ); 150 | 151 | void Write20( const Chip* chip, Bit8u val ); 152 | void Write40( const Chip* chip, Bit8u val ); 153 | void Write60( const Chip* chip, Bit8u val ); 154 | void Write80( const Chip* chip, Bit8u val ); 155 | void WriteE0( const Chip* chip, Bit8u val ); 156 | 157 | bool Silent() const; 158 | void Prepare( const Chip* chip ); 159 | 160 | void KeyOn( Bit8u mask); 161 | void KeyOff( Bit8u mask); 162 | 163 | template< State state> 164 | Bits TemplateVolume( ); 165 | 166 | Bit32s RateForward( Bit32u add ); 167 | Bitu ForwardWave(); 168 | Bitu ForwardVolume(); 169 | 170 | Bits GetSample( Bits modulation ); 171 | Bits GetWave( Bitu index, Bitu vol ); 172 | public: 173 | Operator(); 174 | }; 175 | 176 | struct Channel { 177 | Operator op[2]; 178 | inline Operator* Op( Bitu index ) { 179 | return &( ( this + (index >> 1) )->op[ index & 1 ]); 180 | } 181 | SynthHandler synthHandler; 182 | Bit32u chanData; //Frequency/octave and derived values 183 | Bit32s old[2]; //Old data for feedback 184 | 185 | Bit8u feedback; //Feedback shift 186 | Bit8u regB0; //Register values to check for changes 187 | Bit8u regC0; 188 | //This should correspond with reg104, bit 6 indicates a Percussion channel, bit 7 indicates a silent channel 189 | Bit8u fourMask; 190 | Bit8s maskLeft; //Sign extended values for both channel's panning 191 | Bit8s maskRight; 192 | 193 | //Forward the channel data to the operators of the channel 194 | void SetChanData( const Chip* chip, Bit32u data ); 195 | //Change in the chandata, check for new values and if we have to forward to operators 196 | void UpdateFrequency( const Chip* chip, Bit8u fourOp ); 197 | void WriteA0( const Chip* chip, Bit8u val ); 198 | void WriteB0( const Chip* chip, Bit8u val ); 199 | void WriteC0( const Chip* chip, Bit8u val ); 200 | void ResetC0( const Chip* chip ); 201 | 202 | //call this for the first channel 203 | template< bool opl3Mode > 204 | void GeneratePercussion( Chip* chip, Bit32s* output ); 205 | 206 | //Generate blocks of data in specific modes 207 | template 208 | Channel* BlockTemplate( Chip* chip, Bit32u samples, Bit32s* output ); 209 | Channel(); 210 | }; 211 | 212 | struct Chip { 213 | //This is used as the base counter for vibrato and tremolo 214 | Bit32u lfoCounter; 215 | Bit32u lfoAdd; 216 | 217 | 218 | Bit32u noiseCounter; 219 | Bit32u noiseAdd; 220 | Bit32u noiseValue; 221 | 222 | //Frequency scales for the different multiplications 223 | Bit32u freqMul[16]; 224 | //Rates for decay and release for rate of this chip 225 | Bit32u linearRates[76]; 226 | //Best match attack rates for the rate of this chip 227 | Bit32u attackRates[76]; 228 | 229 | //18 channels with 2 operators each 230 | Channel chan[18]; 231 | 232 | Bit8u reg104; 233 | Bit8u reg08; 234 | Bit8u reg04; 235 | Bit8u regBD; 236 | Bit8u vibratoIndex; 237 | Bit8u tremoloIndex; 238 | Bit8s vibratoSign; 239 | Bit8u vibratoShift; 240 | Bit8u tremoloValue; 241 | Bit8u vibratoStrength; 242 | Bit8u tremoloStrength; 243 | //Mask for allowed wave forms 244 | Bit8u waveFormMask; 245 | //0 or -1 when enabled 246 | Bit8s opl3Active; 247 | 248 | //Return the maximum amount of samples before and LFO change 249 | Bit32u ForwardLFO( Bit32u samples ); 250 | Bit32u ForwardNoise(); 251 | 252 | void WriteBD( Bit8u val ); 253 | void WriteReg(Bit32u reg, Bit8u val ); 254 | 255 | Bit32u WriteAddr( Bit32u port, Bit8u val ); 256 | 257 | void GenerateBlock2( Bitu samples, Bit32s* output ); 258 | void GenerateBlock3( Bitu samples, Bit32s* output ); 259 | 260 | void Generate( Bit32u samples ); 261 | void Setup( Bit32u r ); 262 | 263 | Chip(); 264 | }; 265 | 266 | /*struct Handler : public Adlib::Handler { 267 | DBOPL::Chip chip; 268 | virtual Bit32u WriteAddr( Bit32u port, Bit8u val ); 269 | virtual void WriteReg( Bit32u addr, Bit8u val ); 270 | virtual void Generate( MixerChannel* chan, Bitu samples ); 271 | virtual void Init( Bitu rate ); 272 | };*/ 273 | 274 | 275 | }; //Namespace 276 | -------------------------------------------------------------------------------- /src/f_spear.h: -------------------------------------------------------------------------------- 1 | #define STR_ENDGAME1 "We owe you a great debt, Mr. Blazkowicz." 2 | #define STR_ENDGAME2 "You have served your country well." 3 | #define STR_ENDGAME3 "With the spear gone, the Allies will finally" 4 | #define STR_ENDGAME4 "by able to destroy Hitler..." 5 | 6 | #define STR_COPY1 "That's close, but not close enough to get" 7 | #define STR_COPY2 "you into the game." 8 | 9 | #define STR_COPY3 "Wow, you must have the early version of the" 10 | #define STR_COPY4 "manual with the totally false information in it." 11 | 12 | #define STR_COPY5 "I would let you into the game, but seeing" 13 | #define STR_COPY6 "as that was not at all the right answer..." 14 | 15 | #define STR_COPY7 "It's just too bad we can't get together on" 16 | #define STR_COPY8 "this one. Sorry." 17 | 18 | #define STR_COPY9 "Hey, you're just SO off base!" 19 | 20 | #define STR_COPY10 "You know, I once typed that myself when" 21 | #define STR_COPY11 "I was your age." 22 | 23 | #define STR_COPY12 "Nops. Zero points. Zugga." 24 | 25 | #define STR_COPY13 "Yeah...right." 26 | 27 | #define STR_COPY14 "You must like these quizzes." 28 | 29 | #define STR_COPY15 "Could be called \"PixelMeister\"?" 30 | 31 | #define STR_COPY16 "Might engineer some software?" 32 | 33 | #define STR_COPY17 "Would be found" 34 | #define STR_COPY18 "directing creatively?" 35 | 36 | #define STR_COPY19 "Might be found" 37 | #define STR_COPY20 "handling operations?" 38 | 39 | #define STR_COPY21 "Has a name familiar" 40 | #define STR_COPY22 "to your weatherman?" 41 | 42 | #define STR_NOPE1 "Welcome to the DOS prompt, pirate!" 43 | #define STR_NOPE2 "Eat hot DOS prompt, goober!" 44 | #define STR_NOPE3 "Ya know, this program doesn't cost that much." 45 | #define STR_NOPE4 "Hey...weren't you just AT this DOS prompt?" 46 | #define STR_NOPE5 "What's a nice user like you doin' at a DOS prompt like this?" 47 | #define STR_NOPE6 "Well, I'm sure you just \"misplaced\" the manual..." 48 | #define STR_NOPE7 "Run me again when you've boned up on your manual a bit." 49 | #define STR_NOPE8 "Nice try, but no Spear." 50 | #define STR_NOPE9 "That information is in the Spear of Destiny manual, by the way." 51 | 52 | #define STR_MISC1 "Under \"Killing the Enemy\", what" 53 | #define STR_MISC2 "type of enemy is pictured?" 54 | 55 | #define STR_MISC3 "How many eyelets are on B.J.'s" 56 | #define STR_MISC4 "boots? (see page 2)" 57 | 58 | #define STR_MISC5 "The word \"minister\" appears in" 59 | #define STR_MISC6 "what gray shape on page 2?" 60 | 61 | #define STR_MISC7 "How many bullets does B.J. have" 62 | #define STR_MISC8 "on the screen-shot in the middle" 63 | #define STR_MISC9 "of page 9?" 64 | 65 | #define STR_STAR "star" 66 | #define STR_DEBRIEF " DEBRIEFING\n SESSION\n" 67 | #define STR_ENEMY1 "Name the member of the" 68 | #define STR_ENEMY2 "enemy forces shown above" 69 | 70 | #define STR_CHECKMAN "CHECK YER MANUAL!" 71 | #define STR_MAN1 "Which manual page" 72 | #define STR_MAN2 "is the Options Menu" 73 | #define STR_MAN3 "function" 74 | #define STR_MAN4 "on?" 75 | 76 | #define STR_ID1 "Which member of Id Software:" 77 | -------------------------------------------------------------------------------- /src/foreign.h: -------------------------------------------------------------------------------- 1 | #define QUITSUR "Are you sure you want\n"\ 2 | "to quit this great game?" 3 | 4 | #define CURGAME "You are currently in\n"\ 5 | "a game. Continuing will\n"\ 6 | "erase old game. Ok?" 7 | 8 | #define GAMESVD "There's already a game\n"\ 9 | "saved at this position.\n"\ 10 | " Overwrite?" 11 | 12 | #define ENDGAMESTR "Are you sure you want\n"\ 13 | "to end the game you\n"\ 14 | "are playing? (Y or N):" 15 | 16 | #define STR_NG "New Game" 17 | #define STR_SD "Sound" 18 | #define STR_CL "Control" 19 | #define STR_LG "Load Game" 20 | #define STR_SG "Save Game" 21 | #define STR_CV "Change View" 22 | #define STR_VS "View Scores" 23 | #define STR_EG "End Game" 24 | #define STR_BD "Back to Demo" 25 | #define STR_QT "Quit" 26 | 27 | #define STR_LOADING "Loading" 28 | #define STR_SAVING "Saving" 29 | 30 | #define STR_GAME "Game" 31 | #define STR_DEMO "Demo" 32 | #define STR_LGC "Load Game called\n\"" 33 | #define STR_EMPTY "empty" 34 | #define STR_CALIB "Calibrate" 35 | #define STR_JOYST "Joystick" 36 | #define STR_MOVEJOY "Move joystick to\nupper left and\npress button 0\n" 37 | #define STR_MOVEJOY2 "Move joystick to\nlower right and\npress button 1\n" 38 | #define STR_ESCEXIT "ESC to exit" 39 | 40 | #define STR_NONE "None" 41 | #define STR_PC "PC Speaker" 42 | #define STR_ALSB "AdLib/Sound Blaster" 43 | #define STR_DISNEY "Disney Sound Source" 44 | #define STR_SB "Sound Blaster" 45 | 46 | #define STR_MOUSEEN "Mouse Enabled" 47 | #define STR_JOYEN "Joystick Enabled" 48 | #define STR_PORT2 "Use joystick port 2" 49 | #define STR_GAMEPAD "Gravis GamePad Enabled" 50 | #define STR_SENS "Mouse Sensitivity" 51 | #define STR_CUSTOM "Customize controls" 52 | 53 | #define STR_DADDY "Can I play, Daddy?" 54 | #define STR_HURTME "Don't hurt me." 55 | #define STR_BRINGEM "Bring 'em on!" 56 | #define STR_DEATH "I am Death incarnate!" 57 | 58 | #define STR_MOUSEADJ "Adjust Mouse Sensitivity" 59 | #define STR_SLOW "Slow" 60 | #define STR_FAST "Fast" 61 | 62 | #define STR_CRUN "Run" 63 | #define STR_COPEN "Open" 64 | #define STR_CFIRE "Fire" 65 | #define STR_CSTRAFE "Strafe" 66 | 67 | #define STR_LEFT "Left" 68 | #define STR_RIGHT "Right" 69 | #define STR_FRWD "Frwd" 70 | #define STR_BKWD "Bkwrd" 71 | #define STR_THINK "Thinking" 72 | 73 | #define STR_SIZE1 "Use arrows to size" 74 | #define STR_SIZE2 "ENTER to accept" 75 | #define STR_SIZE3 "ESC to cancel" 76 | 77 | #define STR_YOUWIN "you win!" 78 | 79 | #define STR_TOTALTIME "total time" 80 | 81 | #define STR_RATKILL "kill %" 82 | #define STR_RATSECRET "secret %" 83 | #define STR_RATTREASURE "treasure %" 84 | 85 | #define STR_BONUS "bonus" 86 | #define STR_TIME "time" 87 | #define STR_PAR " par" 88 | 89 | #define STR_RAT2KILL "kill ratio %" 90 | #define STR_RAT2SECRET "secret ratio %" 91 | #define STR_RAT2TREASURE "treasure ratio %" 92 | 93 | #define STR_DEFEATED "defeated!" 94 | 95 | #define STR_CHEATER1 "You now have 100% Health," 96 | #define STR_CHEATER2 "99 Ammo and both Keys!" 97 | #define STR_CHEATER3 "Note that you have basically" 98 | #define STR_CHEATER4 "eliminated your chances of" 99 | #define STR_CHEATER5 "getting a high score!" 100 | 101 | #define STR_NOSPACE1 "There is not enough space" 102 | #define STR_NOSPACE2 "on your disk to Save Game!" 103 | 104 | #define STR_SAVECHT1 "Your Save Game file is," 105 | #define STR_SAVECHT2 "shall we say, \"corrupted\"." 106 | #define STR_SAVECHT3 "But I'll let you go on and" 107 | #define STR_SAVECHT4 "play anyway...." 108 | 109 | #define STR_SEEAGAIN "Let's see that again!" 110 | 111 | #ifdef SPEAR 112 | #define ENDSTR1 "Heroes don't quit, but\ngo ahead and press " YESBUTTONNAME "\nif you aren't one." 113 | #define ENDSTR2 "Press " YESBUTTONNAME " to quit,\nor press " NOBUTTONNAME " to enjoy\nmore violent diversion." 114 | #define ENDSTR3 "Depressing the " YESBUTTONNAME " key means\nyou must return to the\nhumdrum workday world." 115 | #define ENDSTR4 "Hey, quit or play,\n" YESBUTTONNAME " or " NOBUTTONNAME ":\nit's your choice." 116 | #define ENDSTR5 "Sure you don't want to\nwaste a few more\nproductive hours?" 117 | #define ENDSTR6 "I think you had better\nplay some more. Please\npress " NOBUTTONNAME "...please?" 118 | #define ENDSTR7 "If you are tough, press " NOBUTTONNAME ".\nIf not, press " YESBUTTONNAME " daintily." 119 | #define ENDSTR8 "I'm thinkin' that\nyou might wanna press " NOBUTTONNAME "\nto play more. You do it." 120 | #define ENDSTR9 "Sure. Fine. Quit.\nSee if we care.\nGet it over with.\nPress " YESBUTTONNAME "." 121 | #else 122 | #define ENDSTR1 "Dost thou wish to\nleave with such hasty\nabandon?" 123 | #define ENDSTR2 "Chickening out...\nalready?" 124 | #define ENDSTR3 "Press " NOBUTTONNAME " for more carnage.\nPress " YESBUTTONNAME " to be a weenie." 125 | #define ENDSTR4 "So, you think you can\nquit this easily, huh?" 126 | #define ENDSTR5 "Press " NOBUTTONNAME " to save the world.\nPress " YESBUTTONNAME " to abandon it in\nits hour of need." 127 | #define ENDSTR6 "Press " NOBUTTONNAME " if you are brave.\nPress " YESBUTTONNAME " to cower in shame." 128 | #define ENDSTR7 "Heroes, press " NOBUTTONNAME ".\nWimps, press " YESBUTTONNAME "." 129 | #define ENDSTR8 "You are at an intersection.\nA sign says, 'Press " YESBUTTONNAME " to quit.'\n>" 130 | #define ENDSTR9 "For guns and glory, press " NOBUTTONNAME ".\nFor work and worry, press " YESBUTTONNAME "." 131 | #endif 132 | -------------------------------------------------------------------------------- /src/gfxv_apo.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////// 2 | // 3 | // Graphics .H file for Apogee v1.4 4 | // IGRAB-ed on Sun May 03 01:19:32 1992 5 | // 6 | ////////////////////////////////////// 7 | 8 | typedef enum { 9 | // Lump Start 10 | H_BJPIC=3, 11 | H_CASTLEPIC, // 4 12 | H_KEYBOARDPIC, // 5 13 | H_JOYPIC, // 6 14 | H_HEALPIC, // 7 15 | H_TREASUREPIC, // 8 16 | H_GUNPIC, // 9 17 | H_KEYPIC, // 10 18 | H_BLAZEPIC, // 11 19 | H_WEAPON1234PIC, // 12 20 | H_WOLFLOGOPIC, // 13 21 | H_VISAPIC, // 14 22 | H_MCPIC, // 15 23 | H_IDLOGOPIC, // 16 24 | H_TOPWINDOWPIC, // 17 25 | H_LEFTWINDOWPIC, // 18 26 | H_RIGHTWINDOWPIC, // 19 27 | H_BOTTOMINFOPIC, // 20 28 | #if !defined(APOGEE_1_0) && !defined(APOGEE_1_1) && !defined(APOGEE_1_2) 29 | H_SPEARADPIC, // 21 30 | #endif 31 | // Lump Start 32 | C_OPTIONSPIC, // 22 33 | C_CURSOR1PIC, // 23 34 | C_CURSOR2PIC, // 24 35 | C_NOTSELECTEDPIC, // 25 36 | C_SELECTEDPIC, // 26 37 | C_FXTITLEPIC, // 27 38 | C_DIGITITLEPIC, // 28 39 | C_MUSICTITLEPIC, // 29 40 | C_MOUSELBACKPIC, // 30 41 | C_BABYMODEPIC, // 31 42 | C_EASYPIC, // 32 43 | C_NORMALPIC, // 33 44 | C_HARDPIC, // 34 45 | C_LOADSAVEDISKPIC, // 35 46 | C_DISKLOADING1PIC, // 36 47 | C_DISKLOADING2PIC, // 37 48 | C_CONTROLPIC, // 38 49 | C_CUSTOMIZEPIC, // 39 50 | C_LOADGAMEPIC, // 40 51 | C_SAVEGAMEPIC, // 41 52 | C_EPISODE1PIC, // 42 53 | C_EPISODE2PIC, // 43 54 | C_EPISODE3PIC, // 44 55 | C_EPISODE4PIC, // 45 56 | C_EPISODE5PIC, // 46 57 | C_EPISODE6PIC, // 47 58 | C_CODEPIC, // 48 59 | #ifndef APOGEE_1_0 60 | C_TIMECODEPIC, // 49 61 | C_LEVELPIC, // 50 62 | C_NAMEPIC, // 51 63 | C_SCOREPIC, // 52 64 | #if !defined(APOGEE_1_1) && !defined(APOGEE_1_2) 65 | C_JOY1PIC, // 53 66 | C_JOY2PIC, // 54 67 | #endif 68 | #else 69 | C_TIMECODEPIC=C_CODEPIC, // 47 70 | #endif 71 | // Lump Start 72 | L_GUYPIC, // 55 73 | L_COLONPIC, // 56 74 | L_NUM0PIC, // 57 75 | L_NUM1PIC, // 58 76 | L_NUM2PIC, // 59 77 | L_NUM3PIC, // 60 78 | L_NUM4PIC, // 61 79 | L_NUM5PIC, // 62 80 | L_NUM6PIC, // 63 81 | L_NUM7PIC, // 64 82 | L_NUM8PIC, // 65 83 | L_NUM9PIC, // 66 84 | L_PERCENTPIC, // 67 85 | L_APIC, // 68 86 | L_BPIC, // 69 87 | L_CPIC, // 70 88 | L_DPIC, // 71 89 | L_EPIC, // 72 90 | L_FPIC, // 73 91 | L_GPIC, // 74 92 | L_HPIC, // 75 93 | L_IPIC, // 76 94 | L_JPIC, // 77 95 | L_KPIC, // 78 96 | L_LPIC, // 79 97 | L_MPIC, // 80 98 | L_NPIC, // 81 99 | L_OPIC, // 82 100 | L_PPIC, // 83 101 | L_QPIC, // 84 102 | L_RPIC, // 85 103 | L_SPIC, // 86 104 | L_TPIC, // 87 105 | L_UPIC, // 88 106 | L_VPIC, // 89 107 | L_WPIC, // 90 108 | L_XPIC, // 91 109 | L_YPIC, // 92 110 | L_ZPIC, // 93 111 | L_EXPOINTPIC, // 94 112 | #ifndef APOGEE_1_0 113 | L_APOSTROPHEPIC, // 95 114 | #endif 115 | L_GUY2PIC, // 96 116 | L_BJWINSPIC, // 97 117 | STATUSBARPIC, // 98 118 | TITLEPIC, // 99 119 | PG13PIC, // 100 120 | CREDITSPIC, // 101 121 | HIGHSCORESPIC, // 102 122 | // Lump Start 123 | KNIFEPIC, // 103 124 | GUNPIC, // 104 125 | MACHINEGUNPIC, // 105 126 | GATLINGGUNPIC, // 106 127 | NOKEYPIC, // 107 128 | GOLDKEYPIC, // 108 129 | SILVERKEYPIC, // 109 130 | N_BLANKPIC, // 110 131 | N_0PIC, // 111 132 | N_1PIC, // 112 133 | N_2PIC, // 113 134 | N_3PIC, // 114 135 | N_4PIC, // 115 136 | N_5PIC, // 116 137 | N_6PIC, // 117 138 | N_7PIC, // 118 139 | N_8PIC, // 119 140 | N_9PIC, // 120 141 | FACE1APIC, // 121 142 | FACE1BPIC, // 122 143 | FACE1CPIC, // 123 144 | FACE2APIC, // 124 145 | FACE2BPIC, // 125 146 | FACE2CPIC, // 126 147 | FACE3APIC, // 127 148 | FACE3BPIC, // 128 149 | FACE3CPIC, // 129 150 | FACE4APIC, // 130 151 | FACE4BPIC, // 131 152 | FACE4CPIC, // 132 153 | FACE5APIC, // 133 154 | FACE5BPIC, // 134 155 | FACE5CPIC, // 135 156 | FACE6APIC, // 136 157 | FACE6BPIC, // 137 158 | FACE6CPIC, // 138 159 | FACE7APIC, // 139 160 | FACE7BPIC, // 140 161 | FACE7CPIC, // 141 162 | FACE8APIC, // 142 163 | GOTGATLINGPIC, // 143 164 | MUTANTBJPIC, // 144 165 | PAUSEDPIC, // 145 166 | GETPSYCHEDPIC, // 146 167 | 168 | TILE8, // 147 169 | 170 | ORDERSCREEN, // 148 171 | ERRORSCREEN, // 149 172 | T_HELPART, // 150 173 | #ifdef APOGEE_1_0 174 | T_ENDART1, // 143 175 | #endif 176 | T_DEMO0, // 151 177 | T_DEMO1, // 152 178 | T_DEMO2, // 153 179 | T_DEMO3, // 154 180 | #ifndef APOGEE_1_0 181 | T_ENDART1, // 155 182 | T_ENDART2, // 156 183 | T_ENDART3, // 157 184 | T_ENDART4, // 158 185 | T_ENDART5, // 159 186 | T_ENDART6, // 160 187 | #endif 188 | 189 | ENUMEND 190 | } graphicnums; 191 | 192 | // 193 | // Data LUMPs 194 | // 195 | #define README_LUMP_START H_BJPIC 196 | #define README_LUMP_END H_BOTTOMINFOPIC 197 | 198 | #define CONTROLS_LUMP_START C_OPTIONSPIC 199 | #define CONTROLS_LUMP_END (L_GUYPIC - 1) 200 | 201 | #define LEVELEND_LUMP_START L_GUYPIC 202 | #define LEVELEND_LUMP_END L_BJWINSPIC 203 | 204 | #define LATCHPICS_LUMP_START KNIFEPIC 205 | #define LATCHPICS_LUMP_END GETPSYCHEDPIC 206 | 207 | 208 | // 209 | // Amount of each data item 210 | // 211 | #define NUMCHUNKS ENUMEND 212 | #define NUMFONT 2 213 | #define NUMFONTM 0 214 | #define NUMPICS (GETPSYCHEDPIC - NUMFONT) 215 | #define NUMPICM 0 216 | #define NUMSPRITES 0 217 | #define NUMTILE8 72 218 | #define NUMTILE8M 0 219 | #define NUMTILE16 0 220 | #define NUMTILE16M 0 221 | #define NUMTILE32 0 222 | #define NUMTILE32M 0 223 | #define NUMEXTERNS 13 224 | // 225 | // File offsets for data items 226 | // 227 | #define STRUCTPIC 0 228 | 229 | #define STARTFONT 1 230 | #define STARTFONTM 3 231 | #define STARTPICS 3 232 | #define STARTPICM TILE8 233 | #define STARTSPRITES TILE8 234 | #define STARTTILE8 TILE8 235 | #define STARTTILE8M ORDERSCREEN 236 | #define STARTTILE16 ORDERSCREEN 237 | #define STARTTILE16M ORDERSCREEN 238 | #define STARTTILE32 ORDERSCREEN 239 | #define STARTTILE32M ORDERSCREEN 240 | #define STARTEXTERNS ORDERSCREEN 241 | 242 | // 243 | // Thank you for using IGRAB! 244 | // 245 | -------------------------------------------------------------------------------- /src/gfxv_jap.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////// 2 | // 3 | // Graphics .H file for Japanese version 4 | // Recreated from images and used defines 5 | // 6 | ////////////////////////////////////////// 7 | 8 | typedef enum { 9 | // Lump Start 10 | H_HELP1PIC = 3, // 3 11 | H_HELP2PIC, // 4 12 | H_HELP3PIC, // 5 13 | H_HELP4PIC, // 6 14 | H_HELP5PIC, // 7 15 | H_HELP6PIC, // 8 16 | H_HELP7PIC, // 9 17 | H_HELP8PIC, // 10 18 | H_HELP9PIC, // 11 19 | H_HELP10PIC, // 12 20 | 21 | // Lump Start 22 | C_OPTIONSPIC, // 13 23 | C_CURSOR1PIC, // 14 24 | C_CURSOR2PIC, // 15 25 | C_NOTSELECTEDPIC, // 16 26 | C_SELECTEDPIC, // 17 27 | C_MOUSELBACKPIC, // 18 28 | C_BABYMODEPIC, // 19 29 | C_EASYPIC, // 20 30 | C_NORMALPIC, // 21 31 | C_HARDPIC, // 22 32 | C_LOADSAVEDISKPIC, // 23 33 | C_DISKLOADING1PIC, // 24 34 | C_DISKLOADING2PIC, // 25 35 | C_CONTROLPIC, // 26 36 | C_LOADGAMEPIC, // 27 37 | C_SAVEGAMEPIC, // 28 38 | C_EPISODE1PIC, // 29 39 | C_EPISODE2PIC, // 30 40 | C_EPISODE3PIC, // 31 41 | C_EPISODE4PIC, // 32 42 | C_EPISODE5PIC, // 33 43 | C_EPISODE6PIC, // 34 44 | C_CODEPIC, // 35 45 | C_TIMECODEPIC, // 36 46 | C_LEVELPIC, // 37 47 | C_NAMEPIC, // 38 48 | C_SCOREPIC, // 39 49 | C_JOY1PIC, // 40 50 | C_JOY2PIC, // 41 51 | 52 | C_QUITMSGPIC, // 42 53 | C_JAPQUITPIC, // 43 54 | C_UNUSED_LOADING, // 44 55 | C_JAPNEWGAMEPIC, // 45 56 | C_JAPSAVEOVERPIC, // 46 57 | 58 | C_MSCORESPIC, // 47 59 | C_MENDGAMEPIC, // 48 60 | C_MRETDEMOPIC, // 49 61 | C_MRETGAMEPIC, // 50 62 | C_INTERMISSIONPIC, // 51 63 | C_LETSSEEPIC, // 52 64 | C_ENDRATIOSPIC, // 53 65 | 66 | C_ENDGAME1APIC, // 54 67 | C_ENDGAME1BPIC, // 55 68 | C_ENDGAME2APIC, // 56 69 | C_ENDGAME2BPIC, // 57 70 | C_ENDGAME3APIC, // 58 71 | C_ENDGAME3BPIC, // 59 72 | C_ENDGAME4APIC, // 60 73 | C_ENDGAME4BPIC, // 61 74 | C_ENDGAME5APIC, // 62 75 | C_ENDGAME5BPIC, // 63 76 | C_ENDGAME6APIC, // 64 77 | C_ENDGAME6BPIC, // 65 78 | 79 | // Lump Start 80 | L_GUYPIC, // 66 81 | L_COLONPIC, // 67 82 | L_NUM0PIC, // 68 83 | L_NUM1PIC, // 69 84 | L_NUM2PIC, // 70 85 | L_NUM3PIC, // 71 86 | L_NUM4PIC, // 72 87 | L_NUM5PIC, // 73 88 | L_NUM6PIC, // 74 89 | L_NUM7PIC, // 75 90 | L_NUM8PIC, // 76 91 | L_NUM9PIC, // 77 92 | L_PERCENTPIC, // 78 93 | L_APIC, // 79 94 | L_BPIC, // 80 95 | L_CPIC, // 81 96 | L_DPIC, // 82 97 | L_EPIC, // 83 98 | L_FPIC, // 84 99 | L_GPIC, // 85 100 | L_HPIC, // 86 101 | L_IPIC, // 87 102 | L_JPIC, // 88 103 | L_KPIC, // 89 104 | L_LPIC, // 90 105 | L_MPIC, // 91 106 | L_NPIC, // 92 107 | L_OPIC, // 93 108 | L_PPIC, // 94 109 | L_QPIC, // 95 110 | L_RPIC, // 96 111 | L_SPIC, // 97 112 | L_TPIC, // 98 113 | L_UPIC, // 99 114 | L_VPIC, // 100 115 | L_WPIC, // 101 116 | L_XPIC, // 102 117 | L_YPIC, // 103 118 | L_ZPIC, // 104 119 | L_EXPOINTPIC, // 105 120 | L_APOSTROPHEPIC, // 106 121 | L_GUY2PIC, // 107 122 | L_BJWINSPIC, // 108 123 | STATUSBARPIC, // 109 124 | TITLEPIC, // 110 125 | 126 | S_MOUSESENSPIC, // 111 127 | S_OPTIONSPIC, // 112 128 | S_SOUNDPIC, // 113 129 | S_SKILLPIC, // 114 130 | S_EPISODEPIC, // 115 131 | S_CHANGEPIC, // 116 132 | S_CUSTOMPIC, // 117 133 | S_CONTROLPIC, // 118 134 | 135 | CREDITSPIC, // 119 136 | HIGHSCORESPIC, // 120 137 | // Lump Start 138 | KNIFEPIC, // 121 139 | GUNPIC, // 122 140 | MACHINEGUNPIC, // 123 141 | GATLINGGUNPIC, // 124 142 | NOKEYPIC, // 125 143 | GOLDKEYPIC, // 126 144 | SILVERKEYPIC, // 127 145 | N_BLANKPIC, // 128 146 | N_0PIC, // 129 147 | N_1PIC, // 130 148 | N_2PIC, // 131 149 | N_3PIC, // 132 150 | N_4PIC, // 133 151 | N_5PIC, // 134 152 | N_6PIC, // 135 153 | N_7PIC, // 136 154 | N_8PIC, // 137 155 | N_9PIC, // 138 156 | FACE1APIC, // 139 157 | FACE1BPIC, // 140 158 | FACE1CPIC, // 141 159 | FACE2APIC, // 142 160 | FACE2BPIC, // 143 161 | FACE2CPIC, // 144 162 | FACE3APIC, // 145 163 | FACE3BPIC, // 146 164 | FACE3CPIC, // 147 165 | FACE4APIC, // 148 166 | FACE4BPIC, // 149 167 | FACE4CPIC, // 150 168 | FACE5APIC, // 151 169 | FACE5BPIC, // 152 170 | FACE5CPIC, // 153 171 | FACE6APIC, // 154 172 | FACE6BPIC, // 155 173 | FACE6CPIC, // 156 174 | FACE7APIC, // 157 175 | FACE7BPIC, // 158 176 | FACE7CPIC, // 159 177 | FACE8APIC, // 160 178 | GOTGATLINGPIC, // 161 179 | MUTANTBJPIC, // 162 180 | PAUSEDPIC, // 163 181 | GETPSYCHEDPIC, // 164 182 | 183 | TILE8, // 165 184 | 185 | ERRORSCREEN, // 166 186 | 187 | T_DEMO0, // 167 188 | T_DEMO1, // 168 189 | T_DEMO2, // 169 190 | T_DEMO3, // 170 191 | 192 | ENUMEND 193 | } graphicnums; 194 | 195 | // 196 | // Data LUMPs 197 | // 198 | #define README_LUMP_START H_BJPIC 199 | #define README_LUMP_END H_BOTTOMINFOPIC 200 | 201 | #define CONTROLS_LUMP_START C_OPTIONSPIC 202 | #define CONTROLS_LUMP_END (L_GUYPIC - 1) 203 | 204 | #define LEVELEND_LUMP_START L_GUYPIC 205 | #define LEVELEND_LUMP_END L_BJWINSPIC 206 | 207 | #define LATCHPICS_LUMP_START KNIFEPIC 208 | #define LATCHPICS_LUMP_END GETPSYCHEDPIC 209 | 210 | 211 | // 212 | // Amount of each data item 213 | // 214 | #define NUMCHUNKS ENUMEND 215 | #define NUMFONT 2 216 | #define NUMFONTM 0 217 | #define NUMPICS (GETPSYCHEDPIC - NUMFONT) 218 | #define NUMPICM 0 219 | #define NUMSPRITES 0 220 | #define NUMTILE8 72 221 | #define NUMTILE8M 0 222 | #define NUMTILE16 0 223 | #define NUMTILE16M 0 224 | #define NUMTILE32 0 225 | #define NUMTILE32M 0 226 | #define NUMEXTERNS 13 227 | // 228 | // File offsets for data items 229 | // 230 | #define STRUCTPIC 0 231 | 232 | #define STARTFONT 1 233 | #define STARTFONTM 3 234 | #define STARTPICS 3 235 | #define STARTPICM TILE8 236 | #define STARTSPRITES TILE8 237 | #define STARTTILE8 TILE8 238 | #define STARTTILE8M ERRORSCREEN 239 | #define STARTTILE16 ERRORSCREEN 240 | #define STARTTILE16M ERRORSCREEN 241 | #define STARTTILE32 ERRORSCREEN 242 | #define STARTTILE32M ERRORSCREEN 243 | #define STARTEXTERNS ERRORSCREEN 244 | -------------------------------------------------------------------------------- /src/gfxv_sod.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////// 2 | // 3 | // Graphics .H file for .SOD 4 | // IGRAB-ed on Thu Oct 08 20:38:29 1992 5 | // 6 | ////////////////////////////////////// 7 | 8 | typedef enum { 9 | // Lump Start 10 | C_BACKDROPPIC=3, 11 | C_MOUSELBACKPIC, // 4 12 | C_CURSOR1PIC, // 5 13 | C_CURSOR2PIC, // 6 14 | C_NOTSELECTEDPIC, // 7 15 | C_SELECTEDPIC, // 8 16 | // Lump Start 17 | C_CUSTOMIZEPIC, // 9 18 | C_JOY1PIC, // 10 19 | C_JOY2PIC, // 11 20 | C_MOUSEPIC, // 12 21 | C_JOYSTICKPIC, // 13 22 | C_KEYBOARDPIC, // 14 23 | C_CONTROLPIC, // 15 24 | // Lump Start 25 | C_OPTIONSPIC, // 16 26 | // Lump Start 27 | C_FXTITLEPIC, // 17 28 | C_DIGITITLEPIC, // 18 29 | C_MUSICTITLEPIC, // 19 30 | // Lump Start 31 | C_HOWTOUGHPIC, // 20 32 | C_BABYMODEPIC, // 21 33 | C_EASYPIC, // 22 34 | C_NORMALPIC, // 23 35 | C_HARDPIC, // 24 36 | // Lump Start 37 | C_DISKLOADING1PIC, // 25 38 | C_DISKLOADING2PIC, // 26 39 | C_LOADGAMEPIC, // 27 40 | C_SAVEGAMEPIC, // 28 41 | // Lump Start 42 | HIGHSCORESPIC, // 29 43 | C_WONSPEARPIC, // 30 44 | #ifndef SPEARDEMO 45 | // Lump Start 46 | BJCOLLAPSE1PIC, // 31 47 | BJCOLLAPSE2PIC, // 32 48 | BJCOLLAPSE3PIC, // 33 49 | BJCOLLAPSE4PIC, // 34 50 | ENDPICPIC, // 35 51 | #endif 52 | // Lump Start 53 | L_GUYPIC, // 36 54 | L_COLONPIC, // 37 55 | L_NUM0PIC, // 38 56 | L_NUM1PIC, // 39 57 | L_NUM2PIC, // 40 58 | L_NUM3PIC, // 41 59 | L_NUM4PIC, // 42 60 | L_NUM5PIC, // 43 61 | L_NUM6PIC, // 44 62 | L_NUM7PIC, // 45 63 | L_NUM8PIC, // 46 64 | L_NUM9PIC, // 47 65 | L_PERCENTPIC, // 48 66 | L_APIC, // 49 67 | L_BPIC, // 50 68 | L_CPIC, // 51 69 | L_DPIC, // 52 70 | L_EPIC, // 53 71 | L_FPIC, // 54 72 | L_GPIC, // 55 73 | L_HPIC, // 56 74 | L_IPIC, // 57 75 | L_JPIC, // 58 76 | L_KPIC, // 59 77 | L_LPIC, // 60 78 | L_MPIC, // 61 79 | L_NPIC, // 62 80 | L_OPIC, // 63 81 | L_PPIC, // 64 82 | L_QPIC, // 65 83 | L_RPIC, // 66 84 | L_SPIC, // 67 85 | L_TPIC, // 68 86 | L_UPIC, // 69 87 | L_VPIC, // 70 88 | L_WPIC, // 71 89 | L_XPIC, // 72 90 | L_YPIC, // 73 91 | L_ZPIC, // 74 92 | L_EXPOINTPIC, // 75 93 | L_APOSTROPHEPIC, // 76 94 | L_GUY2PIC, // 77 95 | L_BJWINSPIC, // 78 96 | // Lump Start 97 | TITLE1PIC, // 79 98 | TITLE2PIC, // 80 99 | #ifndef SPEARDEMO 100 | // Lump Start 101 | ENDSCREEN11PIC, // 81 102 | // Lump Start 103 | ENDSCREEN12PIC, // 82 104 | ENDSCREEN3PIC, // 83 105 | ENDSCREEN4PIC, // 84 106 | ENDSCREEN5PIC, // 85 107 | ENDSCREEN6PIC, // 86 108 | ENDSCREEN7PIC, // 87 109 | ENDSCREEN8PIC, // 88 110 | ENDSCREEN9PIC, // 89 111 | #endif 112 | STATUSBARPIC, // 90 113 | PG13PIC, // 91 114 | CREDITSPIC, // 92 115 | #ifndef SPEARDEMO 116 | // Lump Start 117 | IDGUYS1PIC, // 93 118 | IDGUYS2PIC, // 94 119 | // Lump Start 120 | COPYPROTTOPPIC, // 95 121 | COPYPROTBOXPIC, // 96 122 | BOSSPIC1PIC, // 97 123 | BOSSPIC2PIC, // 98 124 | BOSSPIC3PIC, // 99 125 | BOSSPIC4PIC, // 100 126 | #endif 127 | // Lump Start 128 | KNIFEPIC, // 101 129 | GUNPIC, // 102 130 | MACHINEGUNPIC, // 103 131 | GATLINGGUNPIC, // 104 132 | NOKEYPIC, // 105 133 | GOLDKEYPIC, // 106 134 | SILVERKEYPIC, // 107 135 | N_BLANKPIC, // 108 136 | N_0PIC, // 109 137 | N_1PIC, // 110 138 | N_2PIC, // 111 139 | N_3PIC, // 112 140 | N_4PIC, // 113 141 | N_5PIC, // 114 142 | N_6PIC, // 115 143 | N_7PIC, // 116 144 | N_8PIC, // 117 145 | N_9PIC, // 118 146 | FACE1APIC, // 119 147 | FACE1BPIC, // 120 148 | FACE1CPIC, // 121 149 | FACE2APIC, // 122 150 | FACE2BPIC, // 123 151 | FACE2CPIC, // 124 152 | FACE3APIC, // 125 153 | FACE3BPIC, // 126 154 | FACE3CPIC, // 127 155 | FACE4APIC, // 128 156 | FACE4BPIC, // 129 157 | FACE4CPIC, // 130 158 | FACE5APIC, // 131 159 | FACE5BPIC, // 132 160 | FACE5CPIC, // 133 161 | FACE6APIC, // 134 162 | FACE6BPIC, // 135 163 | FACE6CPIC, // 136 164 | FACE7APIC, // 137 165 | FACE7BPIC, // 138 166 | FACE7CPIC, // 139 167 | FACE8APIC, // 140 168 | GOTGATLINGPIC, // 141 169 | GODMODEFACE1PIC, // 142 170 | GODMODEFACE2PIC, // 143 171 | GODMODEFACE3PIC, // 144 172 | BJWAITING1PIC, // 145 173 | BJWAITING2PIC, // 146 174 | BJOUCHPIC, // 147 175 | PAUSEDPIC, // 148 176 | GETPSYCHEDPIC, // 149 177 | 178 | TILE8, // 150 179 | 180 | ORDERSCREEN, // 151 181 | ERRORSCREEN, // 152 182 | TITLEPALETTE, // 153 183 | #ifndef SPEARDEMO 184 | END1PALETTE, // 154 185 | END2PALETTE, // 155 186 | END3PALETTE, // 156 187 | END4PALETTE, // 157 188 | END5PALETTE, // 158 189 | END6PALETTE, // 159 190 | END7PALETTE, // 160 191 | END8PALETTE, // 161 192 | END9PALETTE, // 162 193 | IDGUYSPALETTE, // 163 194 | #endif 195 | T_DEMO0, // 164 196 | #ifndef SPEARDEMO 197 | T_DEMO1, // 165 198 | T_DEMO2, // 166 199 | T_DEMO3, // 167 200 | T_ENDART1, // 168 201 | #endif 202 | ENUMEND 203 | } graphicnums; 204 | 205 | // 206 | // Data LUMPs 207 | // 208 | #define BACKDROP_LUMP_START 3 209 | #define BACKDROP_LUMP_END 8 210 | 211 | #define CONTROL_LUMP_START 9 212 | #define CONTROL_LUMP_END 15 213 | 214 | #define OPTIONS_LUMP_START 16 215 | #define OPTIONS_LUMP_END 16 216 | 217 | #define SOUND_LUMP_START 17 218 | #define SOUND_LUMP_END 19 219 | 220 | #define NEWGAME_LUMP_START 20 221 | #define NEWGAME_LUMP_END 24 222 | 223 | #define LOADSAVE_LUMP_START 25 224 | #define LOADSAVE_LUMP_END 28 225 | 226 | #define HIGHSCORES_LUMP_START 29 227 | #define HIGHSCORES_LUMP_END 30 228 | 229 | #define ENDGAME_LUMP_START 31 230 | #define ENDGAME_LUMP_END 35 231 | 232 | #define LEVELEND_LUMP_START L_GUYPIC 233 | #define LEVELEND_LUMP_END L_BJWINSPIC 234 | 235 | #define TITLESCREEN_LUMP_START TITLE1PIC 236 | #define TITLESCREEN_LUMP_END TITLE2PIC 237 | 238 | #define ENDGAME1_LUMP_START ENDSCREEN11PIC 239 | #define ENDGAME1_LUMP_END ENDSCREEN11PIC 240 | 241 | #define ENDGAME2_LUMP_START ENDSCREEN12PIC 242 | #define ENDGAME2_LUMP_END ENDSCREEN12PIC 243 | 244 | #define EASTEREGG_LUMP_START IDGUYS1PIC 245 | #define EASTEREGG_LUMP_END IDGUYS2PIC 246 | 247 | #define COPYPROT_LUMP_START COPYPROTTOPPIC 248 | #define COPYPROT_LUMP_END BOSSPIC4PIC 249 | 250 | #define LATCHPICS_LUMP_START KNIFEPIC 251 | #define LATCHPICS_LUMP_END GETPSYCHEDPIC 252 | 253 | 254 | // 255 | // Amount of each data item 256 | // 257 | #define NUMCHUNKS ENUMEND 258 | #define NUMFONT 2 259 | #define NUMFONTM 0 260 | #define NUMPICS (GETPSYCHEDPIC - NUMFONT) 261 | #define NUMPICM 0 262 | #define NUMSPRITES 0 263 | #define NUMTILE8 72 264 | #define NUMTILE8M 0 265 | #define NUMTILE16 0 266 | #define NUMTILE16M 0 267 | #define NUMTILE32 0 268 | #define NUMTILE32M 0 269 | #define NUMEXTERNS 18 270 | // 271 | // File offsets for data items 272 | // 273 | #define STRUCTPIC 0 274 | 275 | #define STARTFONT 1 276 | #define STARTFONTM 3 277 | #define STARTPICS 3 278 | #define STARTPICM TILE8 279 | #define STARTSPRITES TILE8 280 | #define STARTTILE8 TILE8 281 | #define STARTTILE8M ORDERSCREEN 282 | #define STARTTILE16 ORDERSCREEN 283 | #define STARTTILE16M ORDERSCREEN 284 | #define STARTTILE32 ORDERSCREEN 285 | #define STARTTILE32M ORDERSCREEN 286 | #define STARTEXTERNS ORDERSCREEN 287 | 288 | // 289 | // Thank you for using IGRAB! 290 | // 291 | -------------------------------------------------------------------------------- /src/gfxv_wl6.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////// 2 | // 3 | // Graphics .H file for .WL6 4 | // IGRAB-ed on Wed Apr 13 06:58:44 1994 5 | // 6 | ////////////////////////////////////// 7 | 8 | typedef enum { 9 | // Lump Start 10 | H_BJPIC=3, 11 | H_CASTLEPIC, // 4 12 | H_BLAZEPIC, // 5 13 | H_TOPWINDOWPIC, // 6 14 | H_LEFTWINDOWPIC, // 7 15 | H_RIGHTWINDOWPIC, // 8 16 | H_BOTTOMINFOPIC, // 9 17 | // Lump Start 18 | C_OPTIONSPIC, // 10 19 | C_CURSOR1PIC, // 11 20 | C_CURSOR2PIC, // 12 21 | C_NOTSELECTEDPIC, // 13 22 | C_SELECTEDPIC, // 14 23 | C_FXTITLEPIC, // 15 24 | C_DIGITITLEPIC, // 16 25 | C_MUSICTITLEPIC, // 17 26 | C_MOUSELBACKPIC, // 18 27 | C_BABYMODEPIC, // 19 28 | C_EASYPIC, // 20 29 | C_NORMALPIC, // 21 30 | C_HARDPIC, // 22 31 | C_LOADSAVEDISKPIC, // 23 32 | C_DISKLOADING1PIC, // 24 33 | C_DISKLOADING2PIC, // 25 34 | C_CONTROLPIC, // 26 35 | C_CUSTOMIZEPIC, // 27 36 | C_LOADGAMEPIC, // 28 37 | C_SAVEGAMEPIC, // 29 38 | C_EPISODE1PIC, // 30 39 | C_EPISODE2PIC, // 31 40 | C_EPISODE3PIC, // 32 41 | C_EPISODE4PIC, // 33 42 | C_EPISODE5PIC, // 34 43 | C_EPISODE6PIC, // 35 44 | C_CODEPIC, // 36 45 | C_TIMECODEPIC, // 37 46 | C_LEVELPIC, // 38 47 | C_NAMEPIC, // 39 48 | C_SCOREPIC, // 40 49 | C_JOY1PIC, // 41 50 | C_JOY2PIC, // 42 51 | // Lump Start 52 | L_GUYPIC, // 43 53 | L_COLONPIC, // 44 54 | L_NUM0PIC, // 45 55 | L_NUM1PIC, // 46 56 | L_NUM2PIC, // 47 57 | L_NUM3PIC, // 48 58 | L_NUM4PIC, // 49 59 | L_NUM5PIC, // 50 60 | L_NUM6PIC, // 51 61 | L_NUM7PIC, // 52 62 | L_NUM8PIC, // 53 63 | L_NUM9PIC, // 54 64 | L_PERCENTPIC, // 55 65 | L_APIC, // 56 66 | L_BPIC, // 57 67 | L_CPIC, // 58 68 | L_DPIC, // 59 69 | L_EPIC, // 60 70 | L_FPIC, // 61 71 | L_GPIC, // 62 72 | L_HPIC, // 63 73 | L_IPIC, // 64 74 | L_JPIC, // 65 75 | L_KPIC, // 66 76 | L_LPIC, // 67 77 | L_MPIC, // 68 78 | L_NPIC, // 69 79 | L_OPIC, // 70 80 | L_PPIC, // 71 81 | L_QPIC, // 72 82 | L_RPIC, // 73 83 | L_SPIC, // 74 84 | L_TPIC, // 75 85 | L_UPIC, // 76 86 | L_VPIC, // 77 87 | L_WPIC, // 78 88 | L_XPIC, // 79 89 | L_YPIC, // 80 90 | L_ZPIC, // 81 91 | L_EXPOINTPIC, // 82 92 | L_APOSTROPHEPIC, // 83 93 | L_GUY2PIC, // 84 94 | L_BJWINSPIC, // 85 95 | STATUSBARPIC, // 86 96 | TITLEPIC, // 87 97 | PG13PIC, // 88 98 | CREDITSPIC, // 89 99 | HIGHSCORESPIC, // 90 100 | // Lump Start 101 | KNIFEPIC, // 91 102 | GUNPIC, // 92 103 | MACHINEGUNPIC, // 93 104 | GATLINGGUNPIC, // 94 105 | NOKEYPIC, // 95 106 | GOLDKEYPIC, // 96 107 | SILVERKEYPIC, // 97 108 | N_BLANKPIC, // 98 109 | N_0PIC, // 99 110 | N_1PIC, // 100 111 | N_2PIC, // 101 112 | N_3PIC, // 102 113 | N_4PIC, // 103 114 | N_5PIC, // 104 115 | N_6PIC, // 105 116 | N_7PIC, // 106 117 | N_8PIC, // 107 118 | N_9PIC, // 108 119 | FACE1APIC, // 109 120 | FACE1BPIC, // 110 121 | FACE1CPIC, // 111 122 | FACE2APIC, // 112 123 | FACE2BPIC, // 113 124 | FACE2CPIC, // 114 125 | FACE3APIC, // 115 126 | FACE3BPIC, // 116 127 | FACE3CPIC, // 117 128 | FACE4APIC, // 118 129 | FACE4BPIC, // 119 130 | FACE4CPIC, // 120 131 | FACE5APIC, // 121 132 | FACE5BPIC, // 122 133 | FACE5CPIC, // 123 134 | FACE6APIC, // 124 135 | FACE6BPIC, // 125 136 | FACE6CPIC, // 126 137 | FACE7APIC, // 127 138 | FACE7BPIC, // 128 139 | FACE7CPIC, // 129 140 | FACE8APIC, // 130 141 | GOTGATLINGPIC, // 131 142 | MUTANTBJPIC, // 132 143 | PAUSEDPIC, // 133 144 | GETPSYCHEDPIC, // 134 145 | 146 | 147 | 148 | ORDERSCREEN=136, 149 | ERRORSCREEN, // 137 150 | T_HELPART, // 138 151 | T_DEMO0, // 139 152 | T_DEMO1, // 140 153 | T_DEMO2, // 141 154 | T_DEMO3, // 142 155 | T_ENDART1, // 143 156 | T_ENDART2, // 144 157 | T_ENDART3, // 145 158 | T_ENDART4, // 146 159 | T_ENDART5, // 147 160 | T_ENDART6, // 148 161 | ENUMEND 162 | } graphicnums; 163 | 164 | // 165 | // Data LUMPs 166 | // 167 | #define README_LUMP_START 3 168 | #define README_LUMP_END 9 169 | 170 | #define CONTROLS_LUMP_START 10 171 | #define CONTROLS_LUMP_END 42 172 | 173 | #define LEVELEND_LUMP_START 43 174 | #define LEVELEND_LUMP_END 85 175 | 176 | #define LATCHPICS_LUMP_START 91 177 | #define LATCHPICS_LUMP_END 134 178 | 179 | 180 | // 181 | // Amount of each data item 182 | // 183 | #define NUMCHUNKS 149 184 | #define NUMFONT 2 185 | #define NUMFONTM 0 186 | #define NUMPICS 132 187 | #define NUMPICM 0 188 | #define NUMSPRITES 0 189 | #define NUMTILE8 72 190 | #define NUMTILE8M 0 191 | #define NUMTILE16 0 192 | #define NUMTILE16M 0 193 | #define NUMTILE32 0 194 | #define NUMTILE32M 0 195 | #define NUMEXTERNS 13 196 | // 197 | // File offsets for data items 198 | // 199 | #define STRUCTPIC 0 200 | 201 | #define STARTFONT 1 202 | #define STARTFONTM 3 203 | #define STARTPICS 3 204 | #define STARTPICM 135 205 | #define STARTSPRITES 135 206 | #define STARTTILE8 135 207 | #define STARTTILE8M 136 208 | #define STARTTILE16 136 209 | #define STARTTILE16M 136 210 | #define STARTTILE32 136 211 | #define STARTTILE32M 136 212 | #define STARTEXTERNS 136 213 | 214 | // 215 | // Thank you for using IGRAB! 216 | // 217 | -------------------------------------------------------------------------------- /src/id_ca.h: -------------------------------------------------------------------------------- 1 | #ifndef __ID_CA__ 2 | #define __ID_CA__ 3 | 4 | //=========================================================================== 5 | 6 | #define NUMMAPS 60 7 | #ifdef USE_FLOORCEILINGTEX 8 | #define MAPPLANES 3 9 | #else 10 | #define MAPPLANES 2 11 | #endif 12 | 13 | #define UNCACHEGRCHUNK(chunk) {if(grsegs[chunk]) {free(grsegs[chunk]); grsegs[chunk]=NULL;}} 14 | #define UNCACHEAUDIOCHUNK(chunk) {if(audiosegs[chunk]) {free(audiosegs[chunk]); audiosegs[chunk]=NULL;}} 15 | 16 | //=========================================================================== 17 | 18 | typedef struct 19 | { 20 | int32_t planestart[3]; 21 | word planelength[3]; 22 | word width,height; 23 | char name[16]; 24 | } maptype; 25 | 26 | //=========================================================================== 27 | 28 | extern int mapon; 29 | 30 | extern word *mapsegs[MAPPLANES]; 31 | extern byte *audiosegs[NUMSNDCHUNKS]; 32 | extern byte *grsegs[NUMCHUNKS]; 33 | 34 | extern char extension[5]; 35 | extern char graphext[5]; 36 | extern char audioext[5]; 37 | 38 | //=========================================================================== 39 | 40 | boolean CA_LoadFile (const char *filename, memptr *ptr); 41 | boolean CA_WriteFile (const char *filename, void *ptr, int32_t length); 42 | 43 | int32_t CA_RLEWCompress (word *source, int32_t length, word *dest, word rlewtag); 44 | 45 | void CA_RLEWexpand (word *source, word *dest, int32_t length, word rlewtag); 46 | 47 | void CA_Startup (void); 48 | void CA_Shutdown (void); 49 | 50 | int32_t CA_CacheAudioChunk (int chunk); 51 | void CA_LoadAllSounds (void); 52 | 53 | void CA_CacheGrChunk (int chunk); 54 | void CA_CacheMap (int mapnum); 55 | 56 | void CA_CacheScreen (int chunk); 57 | void CA_CacheScreenxy (int chunk, int scx, int scy); 58 | 59 | void CA_CannotOpen(const char *name); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/id_in.h: -------------------------------------------------------------------------------- 1 | // 2 | // ID Engine 3 | // ID_IN.h - Header file for Input Manager 4 | // v1.0d1 5 | // By Jason Blochowiak 6 | // 7 | 8 | #ifndef __ID_IN__ 9 | #define __ID_IN__ 10 | 11 | #ifdef __DEBUG__ 12 | #define __DEBUG_InputMgr__ 13 | #endif 14 | 15 | typedef int ScanCode; 16 | #define sc_None 0 17 | #define sc_Bad 0xff 18 | #define sc_Return SDLK_MINUS 19 | #define sc_Enter sc_Return // ZR 20 | #define sc_Escape SDLK_PLUS //SDLK_j // ZL 21 | #define sc_Space SDLK_b 22 | #define sc_BackSpace SDLK_BACKSPACE 23 | #define sc_Tab SDLK_TAB 24 | #define sc_Alt SDLK_x 25 | #define sc_Control SDLK_a 26 | #define sc_CapsLock SDLK_CAPSLOCK 27 | #define sc_LShift SDLK_y 28 | #define sc_RShift SDLK_RSHIFT 29 | #define sc_UpArrow SDLK_UP 30 | #define sc_DownArrow SDLK_DOWN 31 | #define sc_LeftArrow SDLK_LEFT 32 | #define sc_RightArrow SDLK_RIGHT 33 | #define sc_Insert SDLK_INSERT 34 | #define sc_Delete SDLK_DELETE 35 | #define sc_Home SDLK_HOME 36 | #define sc_End SDLK_END 37 | #define sc_PgUp SDLK_PAGEUP 38 | #define sc_PgDn SDLK_PAGEDOWN 39 | #define sc_F1 SDLK_F1 40 | #define sc_F2 SDLK_F2 41 | #define sc_F3 SDLK_F3 42 | #define sc_F4 SDLK_F4 43 | #define sc_F5 SDLK_F5 44 | #define sc_F6 SDLK_F6 45 | #define sc_F7 SDLK_F7 46 | #define sc_F8 SDLK_F8 47 | #define sc_F9 SDLK_F9 48 | #define sc_F10 SDLK_F10 49 | #define sc_F11 SDLK_F11 50 | #define sc_F12 SDLK_F12 51 | 52 | #define sc_ScrollLock SDLK_SCROLLOCK 53 | #define sc_PrintScreen SDLK_PRINT 54 | 55 | #define sc_1 SDLK_q 56 | #define sc_2 SDLK_q 57 | #define sc_3 SDLK_q 58 | #define sc_4 SDLK_q 59 | #define sc_5 SDLK_q 60 | #define sc_6 SDLK_q 61 | #define sc_7 SDLK_q 62 | #define sc_8 SDLK_q 63 | #define sc_9 SDLK_q 64 | #define sc_0 SDLK_q 65 | 66 | #define sc_A SDLK_q 67 | #define sc_B SDLK_q 68 | #define sc_C SDLK_q 69 | #define sc_D SDLK_q 70 | #define sc_E SDLK_q 71 | #define sc_F SDLK_q 72 | #define sc_G SDLK_q 73 | #define sc_H SDLK_q 74 | #define sc_I SDLK_q 75 | #define sc_J SDLK_q 76 | #define sc_K SDLK_q 77 | #define sc_L SDLK_q 78 | #define sc_M SDLK_q 79 | #define sc_N SDLK_q 80 | #define sc_O SDLK_q 81 | #define sc_P SDLK_q 82 | #define sc_Q SDLK_q 83 | #define sc_R SDLK_q 84 | #define sc_S SDLK_q 85 | #define sc_T SDLK_q 86 | #define sc_U SDLK_q 87 | #define sc_V SDLK_q 88 | #define sc_W SDLK_q 89 | #define sc_X SDLK_q 90 | #define sc_Y SDLK_q 91 | #define sc_Z SDLK_q 92 | 93 | #define key_None 0 94 | 95 | typedef enum { 96 | demo_Off,demo_Record,demo_Playback,demo_PlayDone 97 | } Demo; 98 | typedef enum { 99 | ctrl_Keyboard, 100 | ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2, 101 | ctrl_Joystick, 102 | ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2, 103 | ctrl_Mouse 104 | } ControlType; 105 | typedef enum { 106 | motion_Left = -1,motion_Up = -1, 107 | motion_None = 0, 108 | motion_Right = 1,motion_Down = 1 109 | } Motion; 110 | typedef enum { 111 | dir_North,dir_NorthEast, 112 | dir_East,dir_SouthEast, 113 | dir_South,dir_SouthWest, 114 | dir_West,dir_NorthWest, 115 | dir_None 116 | } Direction; 117 | typedef struct { 118 | boolean button0,button1,button2,button3; 119 | short x,y; 120 | Motion xaxis,yaxis; 121 | Direction dir; 122 | } CursorInfo; 123 | typedef CursorInfo ControlInfo; 124 | typedef struct { 125 | ScanCode button0,button1, 126 | upleft, up, upright, 127 | left, right, 128 | downleft, down, downright; 129 | } KeyboardDef; 130 | typedef struct { 131 | word joyMinX,joyMinY, 132 | threshMinX,threshMinY, 133 | threshMaxX,threshMaxY, 134 | joyMaxX,joyMaxY, 135 | joyMultXL,joyMultYL, 136 | joyMultXH,joyMultYH; 137 | } JoystickDef; 138 | // Global variables 139 | extern volatile boolean Keyboard[]; 140 | extern boolean MousePresent; 141 | extern volatile boolean Paused; 142 | extern volatile char LastASCII; 143 | extern volatile ScanCode LastScan; 144 | extern int JoyNumButtons; 145 | extern boolean forcegrabmouse; 146 | 147 | 148 | // Function prototypes 149 | #define IN_KeyDown(code) (Keyboard[(code)]) 150 | #define IN_ClearKey(code) {Keyboard[code] = false;\ 151 | if (code == LastScan) LastScan = sc_None;} 152 | 153 | // DEBUG - put names in prototypes 154 | extern void IN_Startup(void),IN_Shutdown(void); 155 | extern void IN_ClearKeysDown(void); 156 | extern void IN_ReadControl(int,ControlInfo *); 157 | extern void IN_GetJoyAbs(word joy,word *xp,word *yp); 158 | extern void IN_SetupJoy(word joy,word minx,word maxx, 159 | word miny,word maxy); 160 | extern void IN_StopDemo(void),IN_FreeDemoBuffer(void), 161 | IN_Ack(void); 162 | extern boolean IN_UserInput(longword delay); 163 | extern char IN_WaitForASCII(void); 164 | extern ScanCode IN_WaitForKey(void); 165 | extern word IN_GetJoyButtonsDB(word joy); 166 | extern const char *IN_GetScanName(ScanCode); 167 | 168 | void IN_WaitAndProcessEvents(); 169 | void IN_ProcessEvents(); 170 | 171 | int IN_MouseButtons (void); 172 | 173 | boolean IN_JoyPresent(); 174 | void IN_SetJoyCurrent(int joyIndex); 175 | int IN_JoyButtons (void); 176 | void IN_GetJoyDelta(int *dx,int *dy); 177 | void IN_GetJoyFineDelta(int *dx, int *dy); 178 | 179 | void IN_StartAck(void); 180 | boolean IN_CheckAck (void); 181 | bool IN_IsInputGrabbed(); 182 | void IN_CenterMouse(); 183 | 184 | #endif 185 | -------------------------------------------------------------------------------- /src/id_pm.cpp: -------------------------------------------------------------------------------- 1 | #include "wl_def.h" 2 | 3 | int ChunksInFile; 4 | int PMSpriteStart; 5 | int PMSoundStart; 6 | 7 | bool PMSoundInfoPagePadded = false; 8 | 9 | // holds the whole VSWAP 10 | uint32_t *PMPageData; 11 | size_t PMPageDataSize; 12 | 13 | // ChunksInFile+1 pointers to page starts. 14 | // The last pointer points one byte after the last page. 15 | uint8_t **PMPages; 16 | 17 | void PM_Startup() 18 | { 19 | char fname[13 + sizeof(DATADIR)] = DATADIR "vswap."; 20 | strcat(fname,extension); 21 | 22 | FILE *file = fopen(fname,"rb"); 23 | if(!file) 24 | CA_CannotOpen(fname); 25 | 26 | ChunksInFile = 0; 27 | fread(&ChunksInFile, sizeof(word), 1, file); 28 | PMSpriteStart = 0; 29 | fread(&PMSpriteStart, sizeof(word), 1, file); 30 | PMSoundStart = 0; 31 | fread(&PMSoundStart, sizeof(word), 1, file); 32 | 33 | uint32_t* pageOffsets = (uint32_t *) malloc((ChunksInFile + 1) * sizeof(int32_t)); 34 | CHECKMALLOCRESULT(pageOffsets); 35 | fread(pageOffsets, sizeof(uint32_t), ChunksInFile, file); 36 | 37 | word *pageLengths = (word *) malloc(ChunksInFile * sizeof(word)); 38 | CHECKMALLOCRESULT(pageLengths); 39 | fread(pageLengths, sizeof(word), ChunksInFile, file); 40 | 41 | fseek(file, 0, SEEK_END); 42 | long fileSize = ftell(file); 43 | long pageDataSize = fileSize - pageOffsets[0]; 44 | if(pageDataSize > (size_t) -1) 45 | Quit("The page file \"%s\" is too large!", fname); 46 | 47 | pageOffsets[ChunksInFile] = fileSize; 48 | 49 | uint32_t dataStart = pageOffsets[0]; 50 | int i; 51 | 52 | // Check that all pageOffsets are valid 53 | for(i = 0; i < ChunksInFile; i++) 54 | { 55 | if(!pageOffsets[i]) continue; // sparse page 56 | if(pageOffsets[i] < dataStart || pageOffsets[i] >= (size_t) fileSize) 57 | Quit("Illegal page offset for page %i: %u (filesize: %u)", 58 | i, pageOffsets[i], fileSize); 59 | } 60 | 61 | // Calculate total amount of padding needed for sprites and sound info page 62 | int alignPadding = 0; 63 | for(i = PMSpriteStart; i < PMSoundStart; i++) 64 | { 65 | if(!pageOffsets[i]) continue; // sparse page 66 | uint32_t offs = pageOffsets[i] - dataStart + alignPadding; 67 | if(offs & 1) 68 | alignPadding++; 69 | } 70 | 71 | if((pageOffsets[ChunksInFile - 1] - dataStart + alignPadding) & 1) 72 | alignPadding++; 73 | 74 | PMPageDataSize = (size_t) pageDataSize + alignPadding; 75 | PMPageData = (uint32_t *) malloc(PMPageDataSize); 76 | CHECKMALLOCRESULT(PMPageData); 77 | 78 | PMPages = (uint8_t **) malloc((ChunksInFile + 1) * sizeof(uint8_t *)); 79 | CHECKMALLOCRESULT(PMPages); 80 | 81 | // Load pages and initialize PMPages pointers 82 | uint8_t *ptr = (uint8_t *) PMPageData; 83 | for(i = 0; i < ChunksInFile; i++) 84 | { 85 | if(i >= PMSpriteStart && i < PMSoundStart || i == ChunksInFile - 1) 86 | { 87 | size_t offs = ptr - (uint8_t *) PMPageData; 88 | 89 | // pad with zeros to make it 2-byte aligned 90 | if(offs & 1) 91 | { 92 | *ptr++ = 0; 93 | if(i == ChunksInFile - 1) PMSoundInfoPagePadded = true; 94 | } 95 | } 96 | 97 | PMPages[i] = ptr; 98 | 99 | if(!pageOffsets[i]) 100 | continue; // sparse page 101 | 102 | // Use specified page length, when next page is sparse page. 103 | // Otherwise, calculate size from the offset difference between this and the next page. 104 | uint32_t size; 105 | if(!pageOffsets[i + 1]) size = pageLengths[i]; 106 | else size = pageOffsets[i + 1] - pageOffsets[i]; 107 | 108 | fseek(file, pageOffsets[i], SEEK_SET); 109 | fread(ptr, 1, size, file); 110 | ptr += size; 111 | } 112 | 113 | // last page points after page buffer 114 | PMPages[ChunksInFile] = ptr; 115 | 116 | free(pageLengths); 117 | free(pageOffsets); 118 | fclose(file); 119 | } 120 | 121 | void PM_Shutdown() 122 | { 123 | free(PMPages); 124 | free(PMPageData); 125 | } 126 | -------------------------------------------------------------------------------- /src/id_pm.h: -------------------------------------------------------------------------------- 1 | #ifndef __ID_PM__ 2 | #define __ID_PM__ 3 | 4 | #ifdef USE_HIRES 5 | #define PMPageSize 16384 6 | #else 7 | #define PMPageSize 4096 8 | #endif 9 | 10 | extern int ChunksInFile; 11 | extern int PMSpriteStart; 12 | extern int PMSoundStart; 13 | 14 | extern bool PMSoundInfoPagePadded; 15 | 16 | // ChunksInFile+1 pointers to page starts. 17 | // The last pointer points one byte after the last page. 18 | extern uint8_t **PMPages; 19 | 20 | void PM_Startup(); 21 | void PM_Shutdown(); 22 | 23 | static inline uint32_t PM_GetPageSize(int page) 24 | { 25 | if(page < 0 || page >= ChunksInFile) 26 | Quit("PM_GetPageSize: Tried to access illegal page: %i", page); 27 | return (uint32_t) (PMPages[page + 1] - PMPages[page]); 28 | } 29 | 30 | static inline uint8_t *PM_GetPage(int page) 31 | { 32 | if(page < 0 || page >= ChunksInFile) 33 | Quit("PM_GetPage: Tried to access illegal page: %i", page); 34 | return PMPages[page]; 35 | } 36 | 37 | static inline uint8_t *PM_GetEnd() 38 | { 39 | return PMPages[ChunksInFile]; 40 | } 41 | 42 | static inline byte *PM_GetTexture(int wallpic) 43 | { 44 | return PM_GetPage(wallpic); 45 | } 46 | 47 | static inline uint16_t *PM_GetSprite(int shapenum) 48 | { 49 | // correct alignment is enforced by PM_Startup() 50 | return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum); 51 | } 52 | 53 | static inline byte *PM_GetSound(int soundpagenum) 54 | { 55 | return PM_GetPage(PMSoundStart + soundpagenum); 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/id_sd.h: -------------------------------------------------------------------------------- 1 | // 2 | // ID Engine 3 | // ID_SD.h - Sound Manager Header 4 | // Version for Wolfenstein 5 | // By Jason Blochowiak 6 | // 7 | 8 | #ifndef __ID_SD__ 9 | #define __ID_SD__ 10 | 11 | #define alOut(n,b) YM3812Write(oplChip, n, b) 12 | 13 | #define TickBase 70 // 70Hz per tick - used as a base for timer 0 14 | 15 | typedef enum 16 | { 17 | sdm_Off, 18 | sdm_PC,sdm_AdLib, 19 | } SDMode; 20 | 21 | typedef enum 22 | { 23 | smm_Off,smm_AdLib 24 | } SMMode; 25 | 26 | typedef enum 27 | { 28 | sds_Off,sds_PC,sds_SoundBlaster 29 | } SDSMode; 30 | 31 | typedef struct 32 | { 33 | longword length; 34 | word priority; 35 | } SoundCommon; 36 | 37 | #define ORIG_SOUNDCOMMON_SIZE 6 38 | 39 | // PC Sound stuff 40 | #define pcTimer 0x42 41 | #define pcTAccess 0x43 42 | #define pcSpeaker 0x61 43 | 44 | #define pcSpkBits 3 45 | 46 | typedef struct 47 | { 48 | SoundCommon common; 49 | byte data[1]; 50 | } PCSound; 51 | 52 | // Register addresses 53 | // Operator stuff 54 | #define alChar 0x20 55 | #define alScale 0x40 56 | #define alAttack 0x60 57 | #define alSus 0x80 58 | #define alWave 0xe0 59 | // Channel stuff 60 | #define alFreqL 0xa0 61 | #define alFreqH 0xb0 62 | #define alFeedCon 0xc0 63 | // Global stuff 64 | #define alEffects 0xbd 65 | 66 | typedef struct 67 | { 68 | byte mChar,cChar, 69 | mScale,cScale, 70 | mAttack,cAttack, 71 | mSus,cSus, 72 | mWave,cWave, 73 | nConn, 74 | 75 | // These are only for Muse - these bytes are really unused 76 | voice, 77 | mode; 78 | byte unused[3]; 79 | } Instrument; 80 | 81 | #define ORIG_INSTRUMENT_SIZE 16 82 | 83 | typedef struct 84 | { 85 | SoundCommon common; 86 | Instrument inst; 87 | byte block; 88 | byte data[1]; 89 | } AdLibSound; 90 | 91 | #define ORIG_ADLIBSOUND_SIZE (ORIG_SOUNDCOMMON_SIZE + ORIG_INSTRUMENT_SIZE + 2) 92 | 93 | // 94 | // Sequencing stuff 95 | // 96 | #define sqMaxTracks 10 97 | 98 | typedef struct 99 | { 100 | word length; 101 | word values[1]; 102 | } MusicGroup; 103 | 104 | typedef struct 105 | { 106 | int valid; 107 | fixed globalsoundx, globalsoundy; 108 | } globalsoundpos; 109 | 110 | extern globalsoundpos channelSoundPos[]; 111 | 112 | // Global variables 113 | extern boolean AdLibPresent, 114 | SoundBlasterPresent, 115 | SoundPositioned; 116 | extern SDMode SoundMode; 117 | extern SDSMode DigiMode; 118 | extern SMMode MusicMode; 119 | extern int DigiMap[]; 120 | extern int DigiChannel[]; 121 | 122 | #define GetTimeCount() ((SDL_GetTicks()*7)/100) 123 | 124 | inline void Delay(int wolfticks) 125 | { 126 | if(wolfticks>0) SDL_Delay(wolfticks * 100 / 7); 127 | } 128 | 129 | // Function prototypes 130 | extern void SD_Startup(void), 131 | SD_Shutdown(void); 132 | 133 | extern int SD_GetChannelForDigi(int which); 134 | extern void SD_PositionSound(int leftvol,int rightvol); 135 | extern boolean SD_PlaySound(soundnames sound); 136 | extern void SD_SetPosition(int channel, int leftvol,int rightvol); 137 | extern void SD_StopSound(void), 138 | SD_WaitSoundDone(void); 139 | 140 | extern void SD_StartMusic(int chunk); 141 | extern void SD_ContinueMusic(int chunk, int startoffs); 142 | extern void SD_MusicOn(void), 143 | SD_FadeOutMusic(void); 144 | extern int SD_MusicOff(void); 145 | 146 | extern boolean SD_MusicPlaying(void); 147 | extern boolean SD_SetSoundMode(SDMode mode); 148 | extern boolean SD_SetMusicMode(SMMode mode); 149 | extern word SD_SoundPlaying(void); 150 | 151 | extern void SD_SetDigiDevice(SDSMode); 152 | extern void SD_PrepareSound(int which); 153 | extern int SD_PlayDigitized(word which,int leftpos,int rightpos); 154 | extern void SD_StopDigitized(void); 155 | 156 | #endif 157 | -------------------------------------------------------------------------------- /src/id_us.h: -------------------------------------------------------------------------------- 1 | // 2 | // ID Engine 3 | // ID_US.h - Header file for the User Manager 4 | // v1.0d1 5 | // By Jason Blochowiak 6 | // 7 | 8 | #ifndef __ID_US__ 9 | #define __ID_US__ 10 | 11 | #ifdef __DEBUG__ 12 | #define __DEBUG_UserMgr__ 13 | #endif 14 | 15 | //#define HELPTEXTLINKED 16 | 17 | #define MaxX 320 18 | #define MaxY 200 19 | 20 | #define MaxHelpLines 500 21 | 22 | #define MaxHighName 57 23 | #define MaxScores 7 24 | typedef struct 25 | { 26 | char name[MaxHighName + 1]; 27 | int32_t score; 28 | word completed,episode; 29 | } HighScore; 30 | 31 | #define MaxGameName 32 32 | #define MaxSaveGames 6 33 | typedef struct 34 | { 35 | char signature[4]; 36 | word *oldtest; 37 | boolean present; 38 | char name[MaxGameName + 1]; 39 | } SaveGame; 40 | 41 | #define MaxString 128 // Maximum input string size 42 | 43 | typedef struct 44 | { 45 | int x,y, 46 | w,h, 47 | px,py; 48 | } WindowRec; // Record used to save & restore screen windows 49 | 50 | extern boolean ingame, // Set by game code if a game is in progress 51 | loadedgame; // Set if the current game was loaded 52 | extern word PrintX,PrintY; // Current printing location in the window 53 | extern word WindowX,WindowY,// Current location of window 54 | WindowW,WindowH;// Current size of window 55 | 56 | extern void (*USL_MeasureString)(const char *,word *,word *); 57 | extern void (*USL_DrawString)(const char *); 58 | 59 | extern boolean (*USL_SaveGame)(int),(*USL_LoadGame)(int); 60 | extern void (*USL_ResetGame)(void); 61 | extern SaveGame Games[MaxSaveGames]; 62 | extern HighScore Scores[]; 63 | 64 | #define US_HomeWindow() {PrintX = WindowX; PrintY = WindowY;} 65 | 66 | void US_Startup(void); 67 | void US_Shutdown(void); 68 | void US_TextScreen(void), 69 | US_UpdateTextScreen(void), 70 | US_FinishTextScreen(void); 71 | void US_DrawWindow(word x,word y,word w,word h); 72 | void US_CenterWindow(word,word); 73 | void US_SaveWindow(WindowRec *win), 74 | US_RestoreWindow(WindowRec *win); 75 | void US_ClearWindow(void); 76 | void US_SetPrintRoutines(void (*measure)(const char *,word *,word *), 77 | void (*print)(const char *)); 78 | void US_PrintCentered(const char *s), 79 | US_CPrint(const char *s), 80 | US_CPrintLine(const char *s), 81 | US_Print(const char *s); 82 | void US_Printf(const char *formatStr, ...); 83 | void US_CPrintf(const char *formatStr, ...); 84 | 85 | void US_PrintUnsigned(longword n); 86 | void US_PrintSigned(int32_t n); 87 | void US_StartCursor(void), 88 | US_ShutCursor(void); 89 | void US_CheckHighScore(int32_t score,word other); 90 | void US_DisplayHighScores(int which); 91 | extern boolean US_UpdateCursor(void); 92 | boolean US_LineInput(int x,int y,char *buf,const char *def,boolean escok, 93 | int maxchars,int maxwidth); 94 | 95 | void USL_PrintInCenter(const char *s,Rect r); 96 | char *USL_GiveSaveName(word game); 97 | 98 | void US_InitRndT(int randomize); 99 | int US_RndT(); 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /src/id_vh.cpp: -------------------------------------------------------------------------------- 1 | #include "wl_def.h" 2 | 3 | 4 | pictabletype *pictable; 5 | SDL_Surface *latchpics[NUMLATCHPICS]; 6 | 7 | int px,py; 8 | byte fontcolor,backcolor; 9 | int fontnumber; 10 | 11 | //========================================================================== 12 | 13 | void VWB_DrawPropString(const char* string) 14 | { 15 | fontstruct *font; 16 | int width, step, height; 17 | byte *source, *dest; 18 | byte ch; 19 | int i; 20 | unsigned sx, sy; 21 | 22 | byte *vbuf = VL_LockSurface(curSurface); 23 | if(vbuf == NULL) return; 24 | 25 | font = (fontstruct *) grsegs[STARTFONT+fontnumber]; 26 | height = font->height; 27 | dest = vbuf + scaleFactor * (py * curPitch + px); 28 | 29 | while ((ch = (byte)*string++)!=0) 30 | { 31 | width = step = font->width[ch]; 32 | source = ((byte *)font)+font->location[ch]; 33 | while (width--) 34 | { 35 | for(i=0; iheight; 102 | for (*width = 0;*string;string++) 103 | *width += font->width[*((byte *)string)]; // proportional width 104 | } 105 | 106 | void VW_MeasurePropString (const char *string, word *width, word *height) 107 | { 108 | VWL_MeasureString(string,width,height,(fontstruct *)grsegs[STARTFONT+fontnumber]); 109 | } 110 | 111 | /* 112 | ============================================================================= 113 | 114 | Double buffer management routines 115 | 116 | ============================================================================= 117 | */ 118 | 119 | void VH_UpdateScreen() 120 | { 121 | SDL_BlitSurface(screenBuffer, NULL, screen, NULL); 122 | SDL_Flip(screen); 123 | } 124 | 125 | 126 | void VWB_DrawTile8 (int x, int y, int tile) 127 | { 128 | LatchDrawChar(x,y,tile); 129 | } 130 | 131 | void VWB_DrawTile8M (int x, int y, int tile) 132 | { 133 | VL_MemToScreen (((byte *)grsegs[STARTTILE8M])+tile*64,8,8,x,y); 134 | } 135 | 136 | void VWB_DrawPic (int x, int y, int chunknum) 137 | { 138 | int picnum = chunknum - STARTPICS; 139 | unsigned width,height; 140 | 141 | x &= ~7; 142 | 143 | width = pictable[picnum].width; 144 | height = pictable[picnum].height; 145 | 146 | VL_MemToScreen (grsegs[chunknum],width,height,x,y); 147 | } 148 | 149 | void VWB_DrawPicScaledCoord (int scx, int scy, int chunknum) 150 | { 151 | int picnum = chunknum - STARTPICS; 152 | unsigned width,height; 153 | 154 | width = pictable[picnum].width; 155 | height = pictable[picnum].height; 156 | 157 | VL_MemToScreenScaledCoord (grsegs[chunknum],width,height,scx,scy); 158 | } 159 | 160 | 161 | void VWB_Bar (int x, int y, int width, int height, int color) 162 | { 163 | VW_Bar (x,y,width,height,color); 164 | } 165 | 166 | void VWB_Plot (int x, int y, int color) 167 | { 168 | if(scaleFactor == 1) 169 | VW_Plot(x,y,color); 170 | else 171 | VW_Bar(x, y, 1, 1, color); 172 | } 173 | 174 | void VWB_Hlin (int x1, int x2, int y, int color) 175 | { 176 | if(scaleFactor == 1) 177 | VW_Hlin(x1,x2,y,color); 178 | else 179 | VW_Bar(x1, y, x2-x1+1, 1, color); 180 | } 181 | 182 | void VWB_Vlin (int y1, int y2, int x, int color) 183 | { 184 | if(scaleFactor == 1) 185 | VW_Vlin(y1,y2,x,color); 186 | else 187 | VW_Bar(x, y1, 1, y2-y1+1, color); 188 | } 189 | 190 | 191 | /* 192 | ============================================================================= 193 | 194 | WOLFENSTEIN STUFF 195 | 196 | ============================================================================= 197 | */ 198 | 199 | /* 200 | ===================== 201 | = 202 | = LatchDrawPic 203 | = 204 | ===================== 205 | */ 206 | 207 | void LatchDrawPic (unsigned x, unsigned y, unsigned picnum) 208 | { 209 | VL_LatchToScreen (latchpics[2+picnum-LATCHPICS_LUMP_START], x*8, y); 210 | } 211 | 212 | void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum) 213 | { 214 | VL_LatchToScreenScaledCoord (latchpics[2+picnum-LATCHPICS_LUMP_START], scx*8, scy); 215 | } 216 | 217 | 218 | //========================================================================== 219 | 220 | void FreeLatchMem() 221 | { 222 | int i; 223 | for(i = 0; i < 2 + LATCHPICS_LUMP_END - LATCHPICS_LUMP_START; i++) 224 | { 225 | SDL_FreeSurface(latchpics[i]); 226 | latchpics[i] = NULL; 227 | } 228 | } 229 | 230 | /* 231 | =================== 232 | = 233 | = LoadLatchMem 234 | = 235 | =================== 236 | */ 237 | 238 | void LoadLatchMem (void) 239 | { 240 | int i,width,height,start,end; 241 | byte *src; 242 | SDL_Surface *surf; 243 | 244 | // 245 | // tile 8s 246 | // 247 | surf = SDL_CreateRGBSurface(SDL_HWSURFACE, 8*8, 248 | ((NUMTILE8 + 7) / 8) * 8, 8, 0, 0, 0, 0); 249 | if(surf == NULL) 250 | { 251 | Quit("Unable to create surface for tiles!"); 252 | } 253 | SDL_SetColors(surf, gamepal, 0, 256); 254 | 255 | latchpics[0] = surf; 256 | CA_CacheGrChunk (STARTTILE8); 257 | src = grsegs[STARTTILE8]; 258 | 259 | for (i=0;i> 3) * 8); 262 | src += 64; 263 | } 264 | UNCACHEGRCHUNK (STARTTILE8); 265 | 266 | latchpics[1] = NULL; // not used 267 | 268 | // 269 | // pics 270 | // 271 | start = LATCHPICS_LUMP_START; 272 | end = LATCHPICS_LUMP_END; 273 | 274 | for (i=start;i<=end;i++) 275 | { 276 | width = pictable[i-STARTPICS].width; 277 | height = pictable[i-STARTPICS].height; 278 | surf = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 8, 0, 0, 0, 0); 279 | if(surf == NULL) 280 | { 281 | Quit("Unable to create surface for picture!"); 282 | } 283 | SDL_SetColors(surf, gamepal, 0, 256); 284 | 285 | latchpics[2+i-start] = surf; 286 | CA_CacheGrChunk (i); 287 | VL_MemToLatch (grsegs[i], width, height, surf, 0, 0); 288 | UNCACHEGRCHUNK(i); 289 | } 290 | } 291 | 292 | //========================================================================== 293 | 294 | /* 295 | =================== 296 | = 297 | = FizzleFade 298 | = 299 | = returns true if aborted 300 | = 301 | = It uses maximum-length Linear Feedback Shift Registers (LFSR) counters. 302 | = You can find a list of them with lengths from 3 to 168 at: 303 | = http://www.xilinx.com/support/documentation/application_notes/xapp052.pdf 304 | = Many thanks to Xilinx for this list!!! 305 | = 306 | =================== 307 | */ 308 | 309 | // XOR masks for the pseudo-random number sequence starting with n=17 bits 310 | static const uint32_t rndmasks[] = { 311 | // n XNOR from (starting at 1, not 0 as usual) 312 | 0x00012000, // 17 17,14 313 | 0x00020400, // 18 18,11 314 | 0x00040023, // 19 19,6,2,1 315 | 0x00090000, // 20 20,17 316 | 0x00140000, // 21 21,19 317 | 0x00300000, // 22 22,21 318 | 0x00420000, // 23 23,18 319 | 0x00e10000, // 24 24,23,22,17 320 | 0x01200000, // 25 25,22 (this is enough for 8191x4095) 321 | }; 322 | 323 | static unsigned int rndbits_y; 324 | static unsigned int rndmask; 325 | 326 | extern SDL_Color curpal[256]; 327 | 328 | // Returns the number of bits needed to represent the given value 329 | static int log2_ceil(uint32_t x) 330 | { 331 | int n = 0; 332 | uint32_t v = 1; 333 | while(v < x) 334 | { 335 | n++; 336 | v <<= 1; 337 | } 338 | return n; 339 | } 340 | 341 | void VH_Startup() 342 | { 343 | int rndbits_x = log2_ceil(screenWidth); 344 | rndbits_y = log2_ceil(screenHeight); 345 | 346 | int rndbits = rndbits_x + rndbits_y; 347 | if(rndbits < 17) 348 | rndbits = 17; // no problem, just a bit slower 349 | else if(rndbits > 25) 350 | rndbits = 25; // fizzle fade will not fill whole screen 351 | 352 | rndmask = rndmasks[rndbits - 17]; 353 | } 354 | 355 | boolean FizzleFade (SDL_Surface *source, int x1, int y1, 356 | unsigned width, unsigned height, unsigned frames, boolean abortable) 357 | { 358 | unsigned x, y, frame, pixperframe; 359 | int32_t rndval, lastrndval; 360 | int first = 1; 361 | 362 | lastrndval = 0; 363 | pixperframe = width * height / frames; 364 | 365 | IN_StartAck (); 366 | 367 | frame = GetTimeCount(); 368 | byte *srcptr = VL_LockSurface(source); 369 | if(srcptr == NULL) return false; 370 | 371 | do 372 | { 373 | IN_ProcessEvents(); 374 | 375 | if(abortable && IN_CheckAck ()) 376 | { 377 | VL_UnlockSurface(source); 378 | SDL_BlitSurface(source, NULL, screen, NULL); 379 | SDL_Flip(screen); 380 | return true; 381 | } 382 | 383 | byte *destptr = VL_LockSurface(screen); 384 | 385 | if(destptr != NULL) 386 | { 387 | rndval = lastrndval; 388 | 389 | // When using double buffering, we have to copy the pixels of the last AND the current frame. 390 | // Only for the first frame, there is no "last frame" 391 | for(int i = first; i < 2; i++) 392 | { 393 | for(unsigned p = 0; p < pixperframe; p++) 394 | { 395 | // 396 | // seperate random value into x/y pair 397 | // 398 | 399 | x = rndval >> rndbits_y; 400 | y = rndval & ((1 << rndbits_y) - 1); 401 | 402 | // 403 | // advance to next random element 404 | // 405 | 406 | rndval = (rndval >> 1) ^ (rndval & 1 ? 0 : rndmask); 407 | 408 | if(x >= width || y >= height) 409 | { 410 | if(rndval == 0) // entire sequence has been completed 411 | goto finished; 412 | p--; 413 | continue; 414 | } 415 | 416 | // 417 | // copy one pixel 418 | // 419 | 420 | if(screenBits == 8) 421 | { 422 | *(destptr + (y1 + y) * screen->pitch + x1 + x) 423 | = *(srcptr + (y1 + y) * source->pitch + x1 + x); 424 | } 425 | else 426 | { 427 | byte col = *(srcptr + (y1 + y) * source->pitch + x1 + x); 428 | uint32_t fullcol = SDL_MapRGB(screen->format, curpal[col].r, curpal[col].g, curpal[col].b); 429 | memcpy(destptr + (y1 + y) * screen->pitch + (x1 + x) * screen->format->BytesPerPixel, 430 | &fullcol, screen->format->BytesPerPixel); 431 | } 432 | 433 | if(rndval == 0) // entire sequence has been completed 434 | goto finished; 435 | } 436 | 437 | if(!i || first) lastrndval = rndval; 438 | } 439 | 440 | // If there is no double buffering, we always use the "first frame" case 441 | if(usedoublebuffering) first = 0; 442 | 443 | VL_UnlockSurface(screen); 444 | SDL_Flip(screen); 445 | } 446 | else 447 | { 448 | // No surface, so only enhance rndval 449 | for(int i = first; i < 2; i++) 450 | { 451 | for(unsigned p = 0; p < pixperframe; p++) 452 | { 453 | rndval = (rndval >> 1) ^ (rndval & 1 ? 0 : rndmask); 454 | if(rndval == 0) 455 | goto finished; 456 | } 457 | } 458 | } 459 | 460 | frame++; 461 | Delay(frame - GetTimeCount()); // don't go too fast 462 | } while (1); 463 | 464 | finished: 465 | VL_UnlockSurface(source); 466 | VL_UnlockSurface(screen); 467 | SDL_BlitSurface(source, NULL, screen, NULL); 468 | SDL_Flip(screen); 469 | return false; 470 | } 471 | -------------------------------------------------------------------------------- /src/id_vh.h: -------------------------------------------------------------------------------- 1 | // ID_VH.H 2 | 3 | 4 | #define WHITE 15 // graphics mode independant colors 5 | #define BLACK 0 6 | #define FIRSTCOLOR 1 7 | #define SECONDCOLOR 12 8 | #define F_WHITE 15 9 | #define F_BLACK 0 10 | #define F_FIRSTCOLOR 1 11 | #define F_SECONDCOLOR 12 12 | 13 | //=========================================================================== 14 | 15 | #define MAXSHIFTS 1 16 | 17 | typedef struct 18 | { 19 | int16_t width,height; 20 | } pictabletype; 21 | 22 | 23 | typedef struct 24 | { 25 | int16_t height; 26 | int16_t location[256]; 27 | int8_t width[256]; 28 | } fontstruct; 29 | 30 | 31 | //=========================================================================== 32 | 33 | 34 | extern pictabletype *pictable; 35 | extern pictabletype *picmtable; 36 | 37 | extern byte fontcolor,backcolor; 38 | extern int fontnumber; 39 | extern int px,py; 40 | 41 | #define SETFONTCOLOR(f,b) fontcolor=f;backcolor=b; 42 | 43 | // 44 | // mode independant routines 45 | // coordinates in pixels, rounded to best screen res 46 | // regions marked in double buffer 47 | // 48 | 49 | void VWB_DrawPropString (const char *string); 50 | 51 | void VWB_DrawTile8 (int x, int y, int tile); 52 | void VWB_DrawTile8M (int x, int y, int tile); 53 | void VWB_DrawTile16 (int x, int y, int tile); 54 | void VWB_DrawTile16M (int x, int y, int tile); 55 | void VWB_DrawPic (int x, int y, int chunknum); 56 | void VWB_DrawPicScaledCoord (int x, int y, int chunknum); 57 | void VWB_DrawMPic(int x, int y, int chunknum); 58 | void VWB_Bar (int x, int y, int width, int height, int color); 59 | #define VWB_BarScaledCoord VL_BarScaledCoord 60 | void VWB_Plot (int x, int y, int color); 61 | #define VWB_PlotScaledCoord VW_Plot 62 | void VWB_Hlin (int x1, int x2, int y, int color); 63 | void VWB_Vlin (int y1, int y2, int x, int color); 64 | #define VWB_HlinScaledCoord VW_Hlin 65 | #define VWB_VlinScaledCoord VW_Vlin 66 | 67 | void VH_UpdateScreen(); 68 | #define VW_UpdateScreen VH_UpdateScreen 69 | 70 | // 71 | // wolfenstein EGA compatability stuff 72 | // 73 | 74 | 75 | #define VW_Shutdown VL_Shutdown 76 | #define VW_Bar VL_Bar 77 | #define VW_Plot VL_Plot 78 | #define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c) 79 | #define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c) 80 | #define VW_DrawPic VH_DrawPic 81 | #define VW_WaitVBL VL_WaitVBL 82 | #define VW_FadeIn() VL_FadeIn(0,255,gamepal,30); 83 | #define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30); 84 | #define VW_ScreenToScreen VL_ScreenToScreen 85 | void VW_MeasurePropString (const char *string, word *width, word *height); 86 | 87 | #define LatchDrawChar(x,y,p) VL_LatchToScreen(latchpics[0],((p)&7)*8,((p)>>3)*8*64,8,8,x,y) 88 | #define LatchDrawTile(x,y,p) VL_LatchToScreen(latchpics[1],(p)*64,0,16,16,x,y) 89 | 90 | void LatchDrawPic (unsigned x, unsigned y, unsigned picnum); 91 | void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum); 92 | void LoadLatchMem (void); 93 | void FreeLatchMem(); 94 | 95 | void VH_Startup(); 96 | boolean FizzleFade (SDL_Surface *source, int x1, int y1, 97 | unsigned width, unsigned height, unsigned frames, boolean abortable); 98 | 99 | #define NUMLATCHPICS 100 100 | extern SDL_Surface *latchpics[NUMLATCHPICS]; 101 | -------------------------------------------------------------------------------- /src/id_vl.h: -------------------------------------------------------------------------------- 1 | // ID_VL.H 2 | 3 | // wolf compatability 4 | 5 | void Quit (const char *error,...); 6 | 7 | //=========================================================================== 8 | 9 | #define CHARWIDTH 2 10 | #define TILEWIDTH 4 11 | 12 | //=========================================================================== 13 | 14 | extern SDL_Surface *screen, *screenBuffer, *curSurface; 15 | 16 | extern boolean fullscreen, usedoublebuffering; 17 | extern unsigned screenWidth, screenHeight, screenBits, screenPitch, bufferPitch, curPitch; 18 | extern unsigned scaleFactor; 19 | 20 | extern boolean screenfaded; 21 | extern unsigned bordercolor; 22 | 23 | extern SDL_Color gamepal[256]; 24 | 25 | //=========================================================================== 26 | 27 | // 28 | // VGA hardware routines 29 | // 30 | 31 | #define VL_WaitVBL(a) SDL_Delay((a)*8) 32 | 33 | void VL_SetVGAPlaneMode (void); 34 | void VL_SetTextMode (void); 35 | void VL_Shutdown (void); 36 | 37 | void VL_ConvertPalette(byte *srcpal, SDL_Color *destpal, int numColors); 38 | void VL_FillPalette (int red, int green, int blue); 39 | void VL_SetColor (int color, int red, int green, int blue); 40 | void VL_GetColor (int color, int *red, int *green, int *blue); 41 | void VL_SetPalette (SDL_Color *palette, bool forceupdate); 42 | void VL_GetPalette (SDL_Color *palette); 43 | void VL_FadeOut (int start, int end, int red, int green, int blue, int steps); 44 | void VL_FadeIn (int start, int end, SDL_Color *palette, int steps); 45 | 46 | byte *VL_LockSurface(SDL_Surface *surface); 47 | void VL_UnlockSurface(SDL_Surface *surface); 48 | 49 | byte VL_GetPixel (int x, int y); 50 | void VL_Plot (int x, int y, int color); 51 | void VL_Hlin (unsigned x, unsigned y, unsigned width, int color); 52 | void VL_Vlin (int x, int y, int height, int color); 53 | void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color); 54 | void inline VL_Bar (int x, int y, int width, int height, int color) 55 | { 56 | VL_BarScaledCoord(scaleFactor*x, scaleFactor*y, 57 | scaleFactor*width, scaleFactor*height, color); 58 | } 59 | void inline VL_ClearScreen(int color) 60 | { 61 | SDL_FillRect(curSurface, NULL, color); 62 | } 63 | 64 | void VL_MungePic (byte *source, unsigned width, unsigned height); 65 | void VL_DrawPicBare (int x, int y, byte *pic, int width, int height); 66 | void VL_MemToLatch (byte *source, int width, int height, 67 | SDL_Surface *destSurface, int x, int y); 68 | void VL_ScreenToScreen (SDL_Surface *source, SDL_Surface *dest); 69 | void VL_MemToScreenScaledCoord (byte *source, int width, int height, int scx, int scy); 70 | void VL_MemToScreenScaledCoord (byte *source, int origwidth, int origheight, int srcx, int srcy, 71 | int destx, int desty, int width, int height); 72 | 73 | void inline VL_MemToScreen (byte *source, int width, int height, int x, int y) 74 | { 75 | VL_MemToScreenScaledCoord(source, width, height, 76 | scaleFactor*x, scaleFactor*y); 77 | } 78 | 79 | void VL_MaskedToScreen (byte *source, int width, int height, int x, int y); 80 | 81 | void VL_LatchToScreenScaledCoord (SDL_Surface *source, int xsrc, int ysrc, 82 | int width, int height, int scxdest, int scydest); 83 | 84 | void inline VL_LatchToScreen (SDL_Surface *source, int xsrc, int ysrc, 85 | int width, int height, int xdest, int ydest) 86 | { 87 | VL_LatchToScreenScaledCoord(source,xsrc,ysrc,width,height, 88 | scaleFactor*xdest,scaleFactor*ydest); 89 | } 90 | void inline VL_LatchToScreenScaledCoord (SDL_Surface *source, int scx, int scy) 91 | { 92 | VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h,scx,scy); 93 | } 94 | void inline VL_LatchToScreen (SDL_Surface *source, int x, int y) 95 | { 96 | VL_LatchToScreenScaledCoord(source,0,0,source->w,source->h, 97 | scaleFactor*x,scaleFactor*y); 98 | } 99 | -------------------------------------------------------------------------------- /src/mame/fmopl.h: -------------------------------------------------------------------------------- 1 | #ifndef __FMOPL_H_ 2 | #define __FMOPL_H_ 3 | 4 | #define HAS_YM3812 1 5 | 6 | /* --- select emulation chips --- */ 7 | #define BUILD_YM3812 (HAS_YM3812) 8 | #define BUILD_YM3526 (HAS_YM3526) 9 | #define BUILD_Y8950 (HAS_Y8950) 10 | 11 | /* select output bits size of output : 8 or 16 */ 12 | #define OPL_SAMPLE_BITS 16 13 | 14 | /* compiler dependence */ 15 | #ifndef OSD_CPU_H 16 | #define OSD_CPU_H 17 | typedef unsigned char UINT8; /* unsigned 8bit */ 18 | typedef unsigned short UINT16; /* unsigned 16bit */ 19 | typedef unsigned int UINT32; /* unsigned 32bit */ 20 | typedef signed char INT8; /* signed 8bit */ 21 | typedef signed short INT16; /* signed 16bit */ 22 | typedef signed int INT32; /* signed 32bit */ 23 | 24 | typedef int BOOL; 25 | #endif 26 | 27 | #if (OPL_SAMPLE_BITS==16) 28 | typedef INT16 OPLSAMPLE; 29 | #endif 30 | #if (OPL_SAMPLE_BITS==8) 31 | typedef INT8 OPLSAMPLE; 32 | #endif 33 | 34 | 35 | typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec); 36 | typedef void (*OPL_IRQHANDLER)(int param,int irq); 37 | typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us); 38 | typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data); 39 | typedef unsigned char (*OPL_PORTHANDLER_R)(int param); 40 | 41 | 42 | #if BUILD_YM3812 43 | 44 | int YM3812Init(int num, int clock, int rate); 45 | void YM3812Shutdown(void); 46 | void YM3812ResetChip(int which); 47 | int YM3812Write(int which, int a, int v); 48 | unsigned char YM3812Read(int which, int a); 49 | void YM3812Mute(int which,int channel,BOOL mute); 50 | int YM3812TimerOver(int which, int c); 51 | void YM3812UpdateOne(int which, INT16 *buffer, int length); 52 | 53 | void YM3812SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset); 54 | void YM3812SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param); 55 | void YM3812SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param); 56 | 57 | #endif 58 | 59 | 60 | #if BUILD_YM3526 61 | 62 | /* 63 | ** Initialize YM3526 emulator(s). 64 | ** 65 | ** 'num' is the number of virtual YM3526's to allocate 66 | ** 'clock' is the chip clock in Hz 67 | ** 'rate' is sampling rate 68 | */ 69 | int YM3526Init(int num, int clock, int rate); 70 | /* shutdown the YM3526 emulators*/ 71 | void YM3526Shutdown(void); 72 | void YM3526ResetChip(int which); 73 | int YM3526Write(int which, int a, int v); 74 | unsigned char YM3526Read(int which, int a); 75 | int YM3526TimerOver(int which, int c); 76 | /* 77 | ** Generate samples for one of the YM3526's 78 | ** 79 | ** 'which' is the virtual YM3526 number 80 | ** '*buffer' is the output buffer pointer 81 | ** 'length' is the number of samples that should be generated 82 | */ 83 | void YM3526UpdateOne(int which, INT16 *buffer, int length); 84 | 85 | void YM3526SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset); 86 | void YM3526SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param); 87 | void YM3526SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param); 88 | 89 | #endif 90 | 91 | 92 | #if BUILD_Y8950 93 | 94 | /* Y8950 port handlers */ 95 | void Y8950SetPortHandler(int which, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, int param); 96 | void Y8950SetKeyboardHandler(int which, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, int param); 97 | void Y8950SetDeltaTMemory(int which, void * deltat_mem_ptr, int deltat_mem_size ); 98 | 99 | int Y8950Init (int num, int clock, int rate); 100 | void Y8950Shutdown (void); 101 | void Y8950ResetChip (int which); 102 | int Y8950Write (int which, int a, int v); 103 | unsigned char Y8950Read (int which, int a); 104 | int Y8950TimerOver (int which, int c); 105 | void Y8950UpdateOne (int which, INT16 *buffer, int length); 106 | 107 | void Y8950SetTimerHandler (int which, OPL_TIMERHANDLER TimerHandler, int channelOffset); 108 | void Y8950SetIRQHandler (int which, OPL_IRQHANDLER IRQHandler, int param); 109 | void Y8950SetUpdateHandler (int which, OPL_UPDATEHANDLER UpdateHandler, int param); 110 | 111 | #endif 112 | 113 | 114 | #endif /* __FMOPL_H_ */ 115 | -------------------------------------------------------------------------------- /src/sodpal.inc: -------------------------------------------------------------------------------- 1 | RGB( 0, 0, 0),RGB( 0, 0, 42),RGB( 0, 42, 0),RGB( 0, 42, 42),RGB( 42, 0, 0), 2 | RGB( 42, 0, 42),RGB( 42, 21, 0),RGB( 42, 42, 42),RGB( 21, 21, 21),RGB( 21, 21, 63), 3 | RGB( 21, 63, 21),RGB( 21, 63, 63),RGB( 63, 21, 21),RGB( 63, 21, 63),RGB( 63, 63, 21), 4 | RGB( 63, 63, 63),RGB( 59, 59, 59),RGB( 55, 55, 55),RGB( 52, 52, 52),RGB( 48, 48, 48), 5 | RGB( 45, 45, 45),RGB( 42, 42, 42),RGB( 38, 38, 38),RGB( 35, 35, 35),RGB( 31, 31, 31), 6 | RGB( 28, 28, 28),RGB( 25, 25, 25),RGB( 21, 21, 21),RGB( 18, 18, 18),RGB( 14, 14, 14), 7 | RGB( 11, 11, 11),RGB( 8, 8, 8),RGB( 63, 0, 0),RGB( 59, 0, 0),RGB( 56, 0, 0), 8 | RGB( 53, 0, 0),RGB( 50, 0, 0),RGB( 47, 0, 0),RGB( 44, 0, 0),RGB( 41, 0, 0), 9 | RGB( 38, 0, 0),RGB( 34, 0, 0),RGB( 31, 0, 0),RGB( 28, 0, 0),RGB( 25, 0, 0), 10 | RGB( 22, 0, 0),RGB( 19, 0, 0),RGB( 16, 0, 0),RGB( 63, 54, 54),RGB( 63, 46, 46), 11 | RGB( 63, 39, 39),RGB( 63, 31, 31),RGB( 63, 23, 23),RGB( 63, 16, 16),RGB( 63, 8, 8), 12 | RGB( 63, 0, 0),RGB( 63, 42, 23),RGB( 63, 38, 16),RGB( 63, 34, 8),RGB( 63, 30, 0), 13 | RGB( 57, 27, 0),RGB( 51, 24, 0),RGB( 45, 21, 0),RGB( 39, 19, 0),RGB( 63, 63, 54), 14 | RGB( 63, 63, 46),RGB( 63, 63, 39),RGB( 63, 63, 31),RGB( 63, 62, 23),RGB( 63, 61, 16), 15 | RGB( 63, 61, 8),RGB( 63, 61, 0),RGB( 57, 54, 0),RGB( 51, 49, 0),RGB( 45, 43, 0), 16 | RGB( 39, 39, 0),RGB( 33, 33, 0),RGB( 28, 27, 0),RGB( 22, 21, 0),RGB( 16, 16, 0), 17 | RGB( 52, 63, 23),RGB( 49, 63, 16),RGB( 45, 63, 8),RGB( 40, 63, 0),RGB( 36, 57, 0), 18 | RGB( 32, 51, 0),RGB( 29, 45, 0),RGB( 24, 39, 0),RGB( 54, 63, 54),RGB( 47, 63, 46), 19 | RGB( 39, 63, 39),RGB( 32, 63, 31),RGB( 24, 63, 23),RGB( 16, 63, 16),RGB( 8, 63, 8), 20 | RGB( 0, 63, 0),RGB( 0, 63, 0),RGB( 0, 59, 0),RGB( 0, 56, 0),RGB( 0, 53, 0), 21 | RGB( 1, 50, 0),RGB( 1, 47, 0),RGB( 1, 44, 0),RGB( 1, 41, 0),RGB( 1, 38, 0), 22 | RGB( 1, 34, 0),RGB( 1, 31, 0),RGB( 1, 28, 0),RGB( 1, 25, 0),RGB( 1, 22, 0), 23 | RGB( 1, 19, 0),RGB( 1, 16, 0),RGB( 54, 63, 63),RGB( 46, 63, 63),RGB( 39, 63, 63), 24 | RGB( 31, 63, 62),RGB( 23, 63, 63),RGB( 16, 63, 63),RGB( 8, 63, 63),RGB( 0, 63, 63), 25 | RGB( 0, 57, 57),RGB( 0, 51, 51),RGB( 0, 45, 45),RGB( 0, 39, 39),RGB( 0, 33, 33), 26 | RGB( 0, 28, 28),RGB( 0, 22, 22),RGB( 0, 16, 16),RGB( 23, 47, 63),RGB( 16, 44, 63), 27 | RGB( 8, 42, 63),RGB( 0, 39, 63),RGB( 0, 35, 57),RGB( 0, 31, 51),RGB( 0, 27, 45), 28 | RGB( 0, 23, 39),RGB( 54, 54, 63),RGB( 46, 47, 63),RGB( 39, 39, 63),RGB( 31, 32, 63), 29 | RGB( 23, 24, 63),RGB( 16, 16, 63),RGB( 8, 9, 63),RGB( 0, 1, 63),RGB( 0, 0, 63), 30 | RGB( 0, 0, 59),RGB( 0, 0, 56),RGB( 0, 0, 53),RGB( 0, 0, 50),RGB( 0, 0, 47), 31 | RGB( 0, 0, 44),RGB( 0, 0, 41),RGB( 0, 0, 38),RGB( 0, 0, 34),RGB( 0, 0, 31), 32 | RGB( 0, 0, 28),RGB( 0, 0, 25),RGB( 0, 0, 22),RGB( 0, 0, 19),RGB( 0, 0, 16), 33 | RGB( 10, 10, 10),RGB( 63, 56, 13),RGB( 63, 53, 9),RGB( 63, 51, 6),RGB( 63, 48, 2), 34 | RGB( 63, 45, 0),RGB( 0, 14, 0),RGB( 0, 10, 0),RGB( 38, 0, 57),RGB( 32, 0, 51), 35 | RGB( 29, 0, 45),RGB( 24, 0, 39),RGB( 20, 0, 33),RGB( 17, 0, 28),RGB( 13, 0, 22), 36 | RGB( 10, 0, 16),RGB( 63, 54, 63),RGB( 63, 46, 63),RGB( 63, 39, 63),RGB( 63, 31, 63), 37 | RGB( 63, 23, 63),RGB( 63, 16, 63),RGB( 63, 8, 63),RGB( 63, 0, 63),RGB( 56, 0, 57), 38 | RGB( 50, 0, 51),RGB( 45, 0, 45),RGB( 39, 0, 39),RGB( 33, 0, 33),RGB( 27, 0, 28), 39 | RGB( 22, 0, 22),RGB( 16, 0, 16),RGB( 63, 58, 55),RGB( 63, 56, 52),RGB( 63, 54, 49), 40 | RGB( 63, 53, 47),RGB( 63, 51, 44),RGB( 63, 49, 41),RGB( 63, 47, 39),RGB( 63, 46, 36), 41 | RGB( 63, 44, 32),RGB( 63, 41, 28),RGB( 63, 39, 24),RGB( 60, 37, 23),RGB( 58, 35, 22), 42 | RGB( 55, 34, 21),RGB( 52, 32, 20),RGB( 50, 31, 19),RGB( 47, 30, 18),RGB( 45, 28, 17), 43 | RGB( 42, 26, 16),RGB( 40, 25, 15),RGB( 39, 24, 14),RGB( 36, 23, 13),RGB( 34, 22, 12), 44 | RGB( 32, 20, 11),RGB( 29, 19, 10),RGB( 27, 18, 9),RGB( 23, 16, 8),RGB( 21, 15, 7), 45 | RGB( 18, 14, 6),RGB( 16, 12, 6),RGB( 14, 11, 5),RGB( 10, 8, 3),RGB( 24, 0, 25), 46 | RGB( 0, 25, 25),RGB( 0, 24, 24),RGB( 0, 0, 7),RGB( 0, 0, 11),RGB( 12, 9, 4), 47 | RGB( 18, 0, 18),RGB( 20, 0, 20),RGB( 0, 0, 13),RGB( 7, 7, 7),RGB( 19, 19, 19), 48 | RGB( 23, 23, 23),RGB( 16, 16, 16),RGB( 12, 12, 12),RGB( 13, 13, 13),RGB( 54, 61, 61), 49 | RGB( 46, 58, 58),RGB( 39, 55, 55),RGB( 29, 50, 50),RGB( 18, 48, 48),RGB( 8, 45, 45), 50 | RGB( 8, 44, 44),RGB( 0, 41, 41),RGB( 0, 38, 38),RGB( 0, 35, 35),RGB( 0, 33, 33), 51 | RGB( 0, 31, 31),RGB( 0, 30, 30),RGB( 0, 29, 29),RGB( 0, 28, 28),RGB( 0, 27, 27), 52 | RGB( 38, 0, 34) 53 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #ifndef _VERSION_H_ 2 | #define _VERSION_H_ 3 | 4 | #ifndef VERSIONALREADYCHOSEN // used for batch compiling 5 | 6 | #ifndef DATADIR 7 | #define DATADIR "/3ds/wolf4sdl/wolf3d/" 8 | #endif 9 | 10 | /* Defines used for different versions */ 11 | 12 | //#define SPEAR 13 | //#define SPEARDEMO 14 | //#define UPLOAD 15 | #define GOODTIMES 16 | #define CARMACIZED 17 | //#define APOGEE_1_0 18 | //#define APOGEE_1_1 19 | //#define APOGEE_1_2 20 | //#define JAPAN 21 | 22 | /* 23 | Wolf3d Full v1.1 Apogee (with ReadThis) - define CARMACIZED and APOGEE_1_1 24 | Wolf3d Full v1.4 Apogee (with ReadThis) - define CARMACIZED 25 | Wolf3d Full v1.4 GT/ID/Activision - define CARMACIZED and GOODTIMES 26 | Wolf3d Full v1.4 Imagineer (Japanese) - define CARMACIZED and JAPAN 27 | Wolf3d Shareware v1.0 - define UPLOAD and APOGEE_1_0 28 | Wolf3d Shareware v1.1 - define CARMACIZED and UPLOAD and APOGEE_1_1 29 | Wolf3d Shareware v1.2 - define CARMACIZED and UPLOAD and APOGEE_1_2 30 | Wolf3d Shareware v1.4 - define CARMACIZED and UPLOAD 31 | Spear of Destiny Full and Mission Disks - define CARMACIZED and SPEAR 32 | (and GOODTIMES for no FormGen quiz) 33 | Spear of Destiny Demo - define CARMACIZED and SPEAR and SPEARDEMO 34 | */ 35 | 36 | #endif 37 | 38 | //#define USE_FEATUREFLAGS // Enables the level feature flags (see bottom of wl_def.h) 39 | //#define USE_SHADING // Enables shading support (see wl_shade.cpp) 40 | //#define USE_DIR3DSPR // Enables directional 3d sprites (see wl_dir3dspr.cpp) 41 | //#define USE_FLOORCEILINGTEX // Enables floor and ceiling textures stored in the third mapplane (see wl_floorceiling.cpp) 42 | //#define USE_HIRES // Enables high resolution textures/sprites (128x128) 43 | //#define USE_PARALLAX 16 // Enables parallax sky with 16 textures per sky (see wl_parallax.cpp) 44 | //#define USE_CLOUDSKY // Enables cloud sky support (see wl_cloudsky.cpp) 45 | //#define USE_STARSKY // Enables star sky support (see wl_atmos.cpp) 46 | //#define USE_RAIN // Enables rain support (see wl_atmos.cpp) 47 | //#define USE_SNOW // Enables snow support (see wl_atmos.cpp) 48 | //#define FIXRAINSNOWLEAKS // Enables leaking ceilings fix (by Adam Biser, only needed if maps with rain/snow and ceilings exist) 49 | 50 | #define DEBUGKEYS // Comment this out to compile without the Tab debug keys 51 | #define ARTSEXTERN 52 | #define DEMOSEXTERN 53 | #define PLAYDEMOLIKEORIGINAL // When playing or recording demos, several bug fixes do not take 54 | // effect to let the original demos work as in the original Wolf3D v1.4 55 | // (actually better, as the second demo rarely worked) 56 | //#define USE_GPL // Replaces the MAME OPL emulator by the DosBox one, which is under a GPL license 57 | 58 | #define ADDEDFIX // Post-revision 262 fixes described in http://diehardwolfers.areyep.com/viewtopic.php?t=6693 59 | 60 | #define FIXCALCROTATE // Apply a modified version of Ginyu's fix to make CalcRotate more accurate at high resolutions 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/wl_atmos.cpp: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | #if defined(USE_STARSKY) || defined(USE_RAIN) || defined(USE_SNOW) 4 | 5 | #include "wl_def.h" 6 | 7 | #if defined(USE_RAIN) || defined(USE_SNOW) 8 | uint32_t rainpos = 0; 9 | #endif 10 | 11 | typedef struct { 12 | int32_t x, y, z; 13 | } point3d_t; 14 | 15 | #define MAXPOINTS 400 16 | point3d_t points[MAXPOINTS]; 17 | 18 | byte moon[100]={ 19 | 0, 0, 27, 18, 15, 16, 19, 29, 0, 0, 20 | 0, 22, 16, 15, 15, 16, 16, 18, 24, 0, 21 | 27, 17, 15, 17, 16, 16, 17, 17, 18, 29, 22 | 18, 15, 15, 15, 16, 16, 17, 17, 18, 20, 23 | 16, 15, 15, 16, 16, 17, 17, 18, 19, 21, 24 | 16, 15, 17, 20, 18, 17, 18, 18, 20, 22, 25 | 19, 16, 18, 19, 17, 17, 18, 19, 22, 24, 26 | 28, 19, 17, 17, 17, 18, 19, 21, 25, 31, 27 | 0, 23, 18, 19, 18, 20, 22, 24, 28, 0, 28 | 0, 0, 28, 21, 20, 22, 28, 30, 0, 0 }; 29 | 30 | void Init3DPoints() 31 | { 32 | int hvheight = viewheight >> 1; 33 | for(int i = 0; i < MAXPOINTS; i++) 34 | { 35 | point3d_t *pt = &points[i]; 36 | pt->x = 16384 - (rand() & 32767); 37 | pt->z = 16384 - (rand() & 32767); 38 | float len = sqrt((float)pt->x * pt->x + (float)pt->z * pt->z); 39 | int j=50; 40 | do 41 | { 42 | pt->y = 1024 + (rand() & 8191); 43 | j--; 44 | } 45 | while(j > 0 && (float)pt->y * 256.F / len >= hvheight); 46 | } 47 | } 48 | 49 | #endif 50 | 51 | #ifdef USE_STARSKY 52 | 53 | void DrawStarSky(byte *vbuf, uint32_t vbufPitch) 54 | { 55 | int hvheight = viewheight >> 1; 56 | int hvwidth = viewwidth >> 1; 57 | 58 | byte *ptr = vbuf; 59 | int i; 60 | for(i = 0; i < hvheight; i++, ptr += vbufPitch) 61 | memset(ptr, 0, viewwidth); 62 | 63 | for(i = 0; i < MAXPOINTS; i++) 64 | { 65 | point3d_t *pt = &points[i]; 66 | int32_t x = pt->x * viewcos + pt->z * viewsin; 67 | int32_t y = pt->y << 16; 68 | int32_t z = (pt->z * viewcos - pt->x * viewsin) >> 8; 69 | if(z <= 0) continue; 70 | int shade = z >> 18; 71 | if(shade > 15) continue; 72 | int32_t xx = x / z * scaleFactor + hvwidth; 73 | int32_t yy = hvheight - y / z; 74 | if(xx >= 0 && xx < viewwidth && yy >= 0 && yy < hvheight) 75 | vbuf[yy * vbufPitch + xx] = shade + 15; 76 | } 77 | 78 | int32_t x = 16384 * viewcos + 16384 * viewsin; 79 | int32_t z = (16384 * viewcos - 16384 * viewsin) >> 8; 80 | if(z <= 0) return; 81 | int32_t xx = x / z * scaleFactor + hvwidth; 82 | int32_t yy = hvheight - ((hvheight - (hvheight >> 3)) << 22) / z; 83 | if(xx > -10 && xx < viewwidth) 84 | { 85 | int stopx = 10 * scaleFactor, starty = 0, stopy = 10 * scaleFactor; 86 | i = 0; 87 | if(xx < 0) i = -xx; 88 | if(xx > viewwidth - 11) stopx = viewwidth - xx; 89 | if(yy < 0) starty = -yy; // ADDEDFIX 1 - fixed typo (was startj) 90 | if(yy > viewheight - 11) stopy = viewheight - yy; 91 | for(; i < stopx; i++) 92 | for(int j = starty; j < stopy; j++) 93 | vbuf[(yy + j) * vbufPitch + xx + i] = moon[j / scaleFactor * 10 + i / scaleFactor]; 94 | } 95 | } 96 | 97 | #endif 98 | 99 | #ifdef USE_RAIN 100 | 101 | void DrawRain(byte *vbuf, uint32_t vbufPitch) 102 | { 103 | #if defined(USE_FLOORCEILINGTEX) && defined(FIXRAINSNOWLEAKS) 104 | fixed dist; // distance to row projection 105 | fixed tex_step; // global step per one screen pixel 106 | fixed gu, gv, floorx, floory; // global texture coordinates 107 | #endif 108 | 109 | fixed px = (player->y + FixedMul(0x7900, viewsin)) >> 6; 110 | fixed pz = (player->x - FixedMul(0x7900, viewcos)) >> 6; 111 | int32_t ax, az, x, y, z, xx, yy, height, actheight; 112 | int shade; 113 | int hvheight = viewheight >> 1; 114 | int hvwidth = viewwidth >> 1; 115 | 116 | rainpos -= tics * 900; 117 | for(int i = 0; i < MAXPOINTS; i++) 118 | { 119 | point3d_t *pt = &points[i]; 120 | ax = pt->x + px; 121 | ax = 0x1fff - (ax & 0x3fff); 122 | az = pt->z + pz; 123 | az = 0x1fff - (az & 0x3fff); 124 | x = ax * viewcos + az * viewsin; 125 | y = -(heightnumerator << 7) + ((((pt->y << 6) + rainpos) & 0x0ffff) << 11); 126 | z = (az * viewcos - ax * viewsin) >> 8; 127 | if(z <= 0) continue; 128 | shade = z >> 17; 129 | if(shade > 13) continue; 130 | xx = x / z + hvwidth; 131 | if(xx < 0 || xx >= viewwidth) continue; 132 | actheight = y / z; 133 | yy = hvheight - actheight; 134 | height = (heightnumerator << 10) / z; 135 | if(actheight < 0) actheight = -actheight; 136 | if(actheight < (wallheight[xx] >> 3) && height < wallheight[xx]) continue; 137 | 138 | if(xx >= 0 && xx < viewwidth && yy > 0 && yy < viewheight) 139 | { 140 | #if defined(USE_FLOORCEILINGTEX) && defined(FIXRAINSNOWLEAKS) 141 | // Find the rain's tile coordinate 142 | // NOTE: This sometimes goes over the map edges. 143 | dist = ((heightnumerator / ((height >> 3) + 1)) << 5); 144 | gu = viewx + FixedMul(dist, viewcos); 145 | gv = -viewy + FixedMul(dist, viewsin); 146 | floorx = ( gu >> TILESHIFT ) & (MAPSIZE - 1); 147 | floory = (-(gv >> TILESHIFT) - 1) & (MAPSIZE - 1); 148 | 149 | // Is there a ceiling tile? 150 | if(MAPSPOT(floorx, floory, 2) >> 8) continue; 151 | #endif 152 | 153 | vbuf[yy * vbufPitch + xx] = shade+15; 154 | vbuf[(yy - 1) * vbufPitch + xx] = shade+16; 155 | if(yy > 2) 156 | vbuf[(yy - 2) * vbufPitch + xx] = shade+17; 157 | } 158 | } 159 | } 160 | 161 | #endif 162 | 163 | #ifdef USE_SNOW 164 | 165 | void DrawSnow(byte *vbuf, uint32_t vbufPitch) 166 | { 167 | #if defined(USE_FLOORCEILINGTEX) && defined(FIXRAINSNOWLEAKS) 168 | fixed dist; // distance to row projection 169 | fixed tex_step; // global step per one screen pixel 170 | fixed gu, gv, floorx, floory; // global texture coordinates 171 | #endif 172 | 173 | fixed px = (player->y + FixedMul(0x7900, viewsin)) >> 6; 174 | fixed pz = (player->x - FixedMul(0x7900, viewcos)) >> 6; 175 | int32_t ax, az, x, y, z, xx, yy, height, actheight; 176 | int shade; 177 | int hvheight = viewheight >> 1; 178 | int hvwidth = viewwidth >> 1; 179 | 180 | rainpos -= tics * 256; 181 | for(int i = 0; i < MAXPOINTS; i++) 182 | { 183 | point3d_t *pt = &points[i]; 184 | ax = pt->x + px; 185 | ax = 0x1fff - (ax & 0x3fff); 186 | az = pt->z + pz; 187 | az = 0x1fff - (az & 0x3fff); 188 | x = ax * viewcos + az * viewsin; 189 | y = -(heightnumerator << 7) + ((((pt->y << 6) + rainpos) & 0x0ffff) << 11); 190 | z = (az * viewcos - ax * viewsin) >> 8; 191 | if(z <= 0) continue; 192 | shade = z >> 17; 193 | if(shade > 13) continue; 194 | xx = x / z + hvwidth; 195 | if(xx < 0 || xx >= viewwidth) continue; 196 | actheight = y / z; 197 | yy = hvheight - actheight; 198 | height = (heightnumerator << 10) / z; 199 | if(actheight < 0) actheight = -actheight; 200 | if(actheight < (wallheight[xx] >> 3) && height < wallheight[xx]) continue; 201 | if(xx > 0 && xx < viewwidth && yy > 0 && yy < viewheight) 202 | { 203 | #if defined(USE_FLOORCEILINGTEX) && defined(FIXRAINSNOWLEAKS) 204 | // Find the snow's tile coordinate 205 | // NOTE: This sometimes goes over the map edges. 206 | dist = ((heightnumerator / ((height >> 3) + 1)) << 5); 207 | gu = viewx + FixedMul(dist, viewcos); 208 | gv = -viewy + FixedMul(dist, viewsin); 209 | floorx = ( gu >> TILESHIFT ) & (MAPSIZE - 1); 210 | floory = (-(gv >> TILESHIFT) - 1) & (MAPSIZE - 1); 211 | 212 | // Is there a ceiling tile? 213 | if(MAPSPOT(floorx, floory, 2) >> 8) continue; 214 | #endif 215 | 216 | if(shade < 10) 217 | { 218 | vbuf[yy * vbufPitch + xx] = shade+17; 219 | vbuf[yy * vbufPitch + xx - 1] = shade+16; 220 | vbuf[(yy - 1) * vbufPitch + xx] = shade+16; 221 | vbuf[(yy - 1) * vbufPitch + xx - 1] = shade+15; 222 | } 223 | else 224 | vbuf[yy * vbufPitch + xx] = shade+15; 225 | } 226 | } 227 | } 228 | 229 | #endif 230 | -------------------------------------------------------------------------------- /src/wl_atmos.h: -------------------------------------------------------------------------------- 1 | #ifndef _WL_ATMOS_H_ 2 | #define _WL_ATMOS_H_ 3 | 4 | #if defined(USE_STARSKY) || defined(USE_RAIN) || defined(USE_SNOW) 5 | void Init3DPoints(); 6 | #endif 7 | 8 | #ifdef USE_STARSKY 9 | void DrawStarSky(byte *vbuf, uint32_t vbufPitch); 10 | #endif 11 | 12 | #ifdef USE_RAIN 13 | void DrawRain(byte *vbuf, uint32_t vbufPitch); 14 | #endif 15 | 16 | #ifdef USE_SNOW 17 | void DrawSnow(byte *vbuf, uint32_t vbufPitch); 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/wl_cloudsky.cpp: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | #ifdef USE_CLOUDSKY 4 | 5 | #include "wl_def.h" 6 | #include "wl_cloudsky.h" 7 | 8 | // Each colormap defines a number of colors which should be mapped from 9 | // the skytable. The according colormapentry_t array defines how these colors should 10 | // be mapped to the wolfenstein palette. The first int of each entry defines 11 | // how many colors are grouped to this entry and the absolute value of the 12 | // second int sets the starting palette index for this pair. If this value is 13 | // negative the index will be decremented for every color, if it's positive 14 | // it will be incremented. 15 | // 16 | // Example colormap: 17 | // colormapentry_t colmapents_1[] = { { 6, -10 }, { 2, 40 } }; 18 | // colormap_t colorMaps[] = { 19 | // { 8, colmapents_1 } 20 | // }; 21 | // 22 | // The colormap 0 consists of 8 colors. The first color group consists of 6 23 | // colors and starts descending at palette index 10: 10, 9, 8, 7, 6, 5 24 | // The second color group consists of 2 colors and starts ascending at 25 | // index 40: 40, 41 26 | // There's no other color group because all colors of this colormap are 27 | // already used (6+2=8) 28 | // 29 | // Warning: Always make sure that the sum of the amount of the colors in all 30 | // color groups is the number of colors used for your colormap! 31 | 32 | colormapentry_t colmapents_1[] = { { 16, -31 }, { 16, 136 } }; 33 | colormapentry_t colmapents_2[] = { { 16, -31 } }; 34 | 35 | colormap_t colorMaps[] = { 36 | { 32, colmapents_1 }, 37 | { 16, colmapents_2 } 38 | }; 39 | 40 | const int numColorMaps = lengthof(colorMaps); 41 | 42 | // The sky definitions which can be selected as defined by GetCloudSkyDefID() in wl_def.h 43 | // You can use +Z in debug mode to find out suitable values for seed and colorMapIndex 44 | // Each entry consists of seed, speed, angle and colorMapIndex 45 | cloudsky_t cloudSkys[] = { 46 | { 626, 800, 20, 0 }, 47 | { 1234, 650, 60, 1 }, 48 | { 0, 700, 120, 0 }, 49 | { 0, 0, 0, 0 }, 50 | { 11243, 750, 310, 0 }, 51 | { 32141, 750, 87, 0 }, 52 | { 12124, 750, 64, 0 }, 53 | { 55543, 500, 240, 0 }, 54 | { 65535, 200, 54, 1 }, 55 | { 4, 1200, 290, 0 }, 56 | }; 57 | 58 | byte skyc[65536L]; 59 | 60 | long cloudx = 0, cloudy = 0; 61 | cloudsky_t *curSky = NULL; 62 | 63 | #ifdef USE_FEATUREFLAGS 64 | 65 | // The lower left tile of every map determines the used cloud sky definition from cloudSkys. 66 | static int GetCloudSkyDefID() 67 | { 68 | int skyID = ffDataBottomLeft; 69 | assert(skyID >= 0 && skyID < lengthof(cloudSkys)); 70 | return skyID; 71 | } 72 | 73 | #else 74 | 75 | static int GetCloudSkyDefID() 76 | { 77 | int skyID; 78 | switch(gamestate.episode * 10 + mapon) 79 | { 80 | case 0: skyID = 0; break; 81 | case 1: skyID = 1; break; 82 | case 2: skyID = 2; break; 83 | case 3: skyID = 3; break; 84 | case 4: skyID = 4; break; 85 | case 5: skyID = 5; break; 86 | case 6: skyID = 6; break; 87 | case 7: skyID = 7; break; 88 | case 8: skyID = 8; break; 89 | case 9: skyID = 9; break; 90 | default: skyID = 9; break; 91 | } 92 | assert(skyID >= 0 && skyID < lengthof(cloudSkys)); 93 | return skyID; 94 | } 95 | 96 | #endif 97 | 98 | void SplitS(unsigned size,unsigned x1,unsigned y1,unsigned x2,unsigned y2) 99 | { 100 | if(size==1) return; 101 | if(!skyc[((x1+size/2)*256+y1)]) 102 | { 103 | skyc[((x1+size/2)*256+y1)]=(byte)(((int)skyc[(x1*256+y1)] 104 | +(int)skyc[((x2&0xff)*256+y1)])/2)+rand()%(size*2)-size; 105 | if(!skyc[((x1+size/2)*256+y1)]) skyc[((x1+size/2)*256+y1)]=1; 106 | } 107 | if(!skyc[((x1+size/2)*256+(y2&0xff))]) 108 | { 109 | skyc[((x1+size/2)*256+(y2&0xff))]=(byte)(((int)skyc[(x1*256+(y2&0xff))] 110 | +(int)skyc[((x2&0xff)*256+(y2&0xff))])/2)+rand()%(size*2)-size; 111 | if(!skyc[((x1+size/2)*256+(y2&0xff))]) 112 | skyc[((x1+size/2)*256+(y2&0xff))]=1; 113 | } 114 | if(!skyc[(x1*256+y1+size/2)]) 115 | { 116 | skyc[(x1*256+y1+size/2)]=(byte)(((int)skyc[(x1*256+y1)] 117 | +(int)skyc[(x1*256+(y2&0xff))])/2)+rand()%(size*2)-size; 118 | if(!skyc[(x1*256+y1+size/2)]) skyc[(x1*256+y1+size/2)]=1; 119 | } 120 | if(!skyc[((x2&0xff)*256+y1+size/2)]) 121 | { 122 | skyc[((x2&0xff)*256+y1+size/2)]=(byte)(((int)skyc[((x2&0xff)*256+y1)] 123 | +(int)skyc[((x2&0xff)*256+(y2&0xff))])/2)+rand()%(size*2)-size; 124 | if(!skyc[((x2&0xff)*256+y1+size/2)]) skyc[((x2&0xff)*256+y1+size/2)]=1; 125 | } 126 | 127 | skyc[((x1+size/2)*256+y1+size/2)]=(byte)(((int)skyc[(x1*256+y1)] 128 | +(int)skyc[((x2&0xff)*256+y1)]+(int)skyc[(x1*256+(y2&0xff))] 129 | +(int)skyc[((x2&0xff)*256+(y2&0xff))])/4)+rand()%(size*2)-size; 130 | 131 | SplitS(size/2,x1,y1+size/2,x1+size/2,y2); 132 | SplitS(size/2,x1+size/2,y1,x2,y1+size/2); 133 | SplitS(size/2,x1+size/2,y1+size/2,x2,y2); 134 | SplitS(size/2,x1,y1,x1+size/2,y1+size/2); 135 | } 136 | 137 | void InitSky() 138 | { 139 | unsigned cloudskyid = GetCloudSkyDefID(); 140 | if(cloudskyid >= lengthof(cloudSkys)) 141 | Quit("Illegal cloud sky id: %u", cloudskyid); 142 | curSky = &cloudSkys[cloudskyid]; 143 | 144 | memset(skyc, 0, sizeof(skyc)); 145 | // funny water texture if used instead of memset ;D 146 | // for(int i = 0; i < 65536; i++) 147 | // skyc[i] = rand() % 32 * 8; 148 | 149 | srand(curSky->seed); 150 | skyc[0] = rand() % 256; 151 | SplitS(256, 0, 0, 256, 256); 152 | 153 | // Smooth the clouds a bit 154 | for(int k = 0; k < 2; k++) 155 | { 156 | for(int i = 0; i < 256; i++) 157 | { 158 | for(int j = 0; j < 256; j++) 159 | { 160 | int32_t val = -skyc[j * 256 + i]; 161 | for(int m = 0; m < 3; m++) 162 | { 163 | for(int n = 0; n < 3; n++) 164 | { 165 | val += skyc[((j + n - 1) & 0xff) * 256 + ((i + m - 1) & 0xff)]; 166 | } 167 | } 168 | skyc[j * 256 + i] = (byte)(val >> 3); 169 | } 170 | } 171 | } 172 | 173 | // the following commented line could be useful, if you're trying to 174 | // create a new color map. This will display your current color map 175 | // in one (of course repeating) stripe of the sky 176 | 177 | // for(int i = 0; i < 256; i++) 178 | // skyc[i] = skyc[i + 256] = skyc[i + 512] = i; 179 | 180 | if(curSky->colorMapIndex >= lengthof(colorMaps)) 181 | Quit("Illegal colorMapIndex for cloud sky def %u: %u", cloudskyid, curSky->colorMapIndex); 182 | 183 | colormap_t *curMap = &colorMaps[curSky->colorMapIndex]; 184 | int numColors = curMap->numColors; 185 | byte colormap[256]; 186 | colormapentry_t *curEntry = curMap->entries; 187 | for(int calcedCols = 0; calcedCols < numColors; curEntry++) 188 | { 189 | if(curEntry->startAndDir < 0) 190 | { 191 | for(int i = 0, ind = -curEntry->startAndDir; i < curEntry->length; i++, ind--) 192 | colormap[calcedCols++] = ind; 193 | } 194 | else 195 | { 196 | for(int i = 0, ind = curEntry->startAndDir; i < curEntry->length; i++, ind++) 197 | colormap[calcedCols++] = ind; 198 | } 199 | } 200 | 201 | for(int i = 0; i < 256; i++) 202 | { 203 | for(int j = 0; j < 256; j++) 204 | { 205 | skyc[i * 256 + j] = colormap[skyc[i * 256 + j] * numColors / 256]; 206 | } 207 | } 208 | } 209 | 210 | // Based on Textured Floor and Ceiling by DarkOne 211 | void DrawClouds(byte *vbuf, unsigned vbufPitch, int min_wallheight) 212 | { 213 | // Move clouds 214 | fixed moveDist = tics * curSky->speed; 215 | cloudx += FixedMul(moveDist,sintable[curSky->angle]); 216 | cloudy -= FixedMul(moveDist,costable[curSky->angle]); 217 | 218 | // Draw them 219 | int y0, halfheight; 220 | unsigned top_offset0; 221 | fixed dist; // distance to row projection 222 | fixed tex_step; // global step per one screen pixel 223 | fixed gu, gv, du, dv; // global texture coordinates 224 | int u, v; // local texture coordinates 225 | 226 | // ------ * prepare * -------- 227 | halfheight = viewheight >> 1; 228 | y0 = min_wallheight >> 3; // starting y value 229 | if(y0 > halfheight) 230 | return; // view obscured by walls 231 | if(!y0) y0 = 1; // don't let division by zero 232 | top_offset0 = vbufPitch * (halfheight - y0 - 1); 233 | 234 | // draw horizontal lines 235 | for(int y = y0, top_offset = top_offset0; y < halfheight; y++, top_offset -= vbufPitch) 236 | { 237 | dist = (heightnumerator / y) << 8; 238 | gu = viewx + FixedMul(dist, viewcos) + cloudx; 239 | gv = -viewy + FixedMul(dist, viewsin) + cloudy; 240 | tex_step = (dist << 8) / viewwidth / 175; 241 | du = FixedMul(tex_step, viewsin); 242 | dv = -FixedMul(tex_step, viewcos); 243 | gu -= (viewwidth >> 1)*du; 244 | gv -= (viewwidth >> 1)*dv; // starting point (leftmost) 245 | for(int x = 0, top_add = top_offset; x < viewwidth; x++, top_add++) 246 | { 247 | if(wallheight[x] >> 3 <= y) 248 | { 249 | u = (gu >> 13) & 255; 250 | v = (gv >> 13) & 255; 251 | vbuf[top_add] = skyc[((255 - u) << 8) + 255 - v]; 252 | } 253 | gu += du; 254 | gv += dv; 255 | } 256 | } 257 | } 258 | 259 | #endif 260 | -------------------------------------------------------------------------------- /src/wl_cloudsky.h: -------------------------------------------------------------------------------- 1 | #if defined(USE_CLOUDSKY) && !defined(_WL_CLOUDSKY_H_) 2 | #define _WL_CLOUDSKY_H_ 3 | 4 | typedef struct 5 | { 6 | int length; 7 | int startAndDir; 8 | } colormapentry_t; 9 | 10 | typedef struct 11 | { 12 | int numColors; 13 | colormapentry_t *entries; 14 | } colormap_t; 15 | 16 | typedef struct 17 | { 18 | // The seed defines the look of the sky and every value (0-4294967295) 19 | // describes an unique sky. You can play around with these inside the game 20 | // when pressing +Z in debug mode. There you'll be able to change the 21 | // active seed to find out a value, which is suitable for your needs. 22 | uint32_t seed; 23 | 24 | // The speed defines how fast the clouds will move (0-65535) 25 | uint32_t speed; 26 | 27 | // The angle defines the move direction (0-359) 28 | uint32_t angle; 29 | 30 | // An index selecting the color map to be used for this sky definition. 31 | // This value can also be chosen with +Z 32 | uint32_t colorMapIndex; 33 | } cloudsky_t; 34 | 35 | extern cloudsky_t *curSky; 36 | extern colormap_t colorMaps[]; 37 | extern const int numColorMaps; 38 | 39 | void InitSky(); 40 | void DrawClouds(byte *vbuf, unsigned vbufPitch, int min_wallheight); 41 | 42 | #ifndef USE_FEATUREFLAGS 43 | int GetCloudSkyDefID(); 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/wl_dir3dspr.cpp: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | #ifdef USE_DIR3DSPR 4 | #include "wl_def.h" 5 | #include "wl_shade.h" 6 | 7 | // Define directional 3d sprites in wl_act1.cpp (there are two examples) 8 | // Make sure you have according entries in ScanInfoPlane in wl_game.cpp. 9 | 10 | 11 | void Scale3DShaper(int x1, int x2, int shapenum, uint32_t flags, fixed ny1, fixed ny2, 12 | fixed nx1, fixed nx2, byte *vbuf, unsigned vbufPitch) 13 | { 14 | t_compshape *shape; 15 | unsigned scale1,starty,endy; 16 | word *cmdptr; 17 | byte *line; 18 | byte *vmem; 19 | int dx,len,i,newstart,ycnt,pixheight,screndy,upperedge,scrstarty; 20 | unsigned j; 21 | fixed height,dheight,height1,height2; 22 | int xpos[TEXTURESIZE+1]; 23 | int slinex; 24 | fixed dxx=(ny2-ny1)<<8,dzz=(nx2-nx1)<<8; 25 | fixed dxa=0,dza=0; 26 | byte col; 27 | 28 | shape = (t_compshape *) PM_GetSprite(shapenum); 29 | 30 | len=shape->rightpix-shape->leftpix+1; 31 | if(!len) return; 32 | 33 | ny1+=dxx>>9; 34 | nx1+=dzz>>9; 35 | 36 | dxa=-(dxx>>1),dza=-(dzz>>1); 37 | dxx>>=TEXTURESHIFT,dzz>>=TEXTURESHIFT; 38 | dxa+=shape->leftpix*dxx,dza+=shape->leftpix*dzz; 39 | 40 | xpos[0]=(int)((ny1+(dxa>>8))*scale/(nx1+(dza>>8))+centerx); 41 | height1 = heightnumerator/((nx1+(dza>>8))>>8); 42 | height=(((fixed)height1)<<12)+2048; 43 | 44 | for(i=1;i<=len;i++) 45 | { 46 | dxa+=dxx,dza+=dzz; 47 | xpos[i]=(int)((ny1+(dxa>>8))*scale/(nx1+(dza>>8))+centerx); 48 | if(xpos[i-1]>viewwidth) break; 49 | } 50 | len=i-1; 51 | dx = xpos[len] - xpos[0]; 52 | if(!dx) return; 53 | 54 | height2 = heightnumerator/((nx1+(dza>>8))>>8); 55 | dheight=(((fixed)height2-(fixed)height1)<<12)/(fixed)dx; 56 | 57 | cmdptr = (word *) shape->dataofs; 58 | 59 | i=0; 60 | if(x2>viewwidth) x2=viewwidth; 61 | 62 | for(i=0;i>15); 70 | 71 | if(wallheight[slinex]<(height>>12) && scale1 /*&& scale1<=maxscale*/) 72 | { 73 | #ifdef USE_SHADING 74 | byte *curshades; 75 | if(flags & FL_FULLBRIGHT) 76 | curshades = shadetable[0]; 77 | else 78 | curshades = shadetable[GetShade(scale1<<3)]; 79 | #endif 80 | 81 | pixheight=scale1*SPRITESCALEFACTOR; 82 | upperedge=viewheight/2-scale1; 83 | 84 | line=(byte *)shape + cmdptr[i]; 85 | 86 | while((endy = READWORD(line)) != 0) 87 | { 88 | endy >>= 1; 89 | newstart = READWORD(line); 90 | starty = READWORD(line) >> 1; 91 | j=starty; 92 | ycnt=j*pixheight; 93 | screndy=(ycnt>>6)+upperedge; 94 | if(screndy<0) vmem=vbuf+slinex; 95 | else vmem=vbuf+screndy*vbufPitch+slinex; 96 | for(;j>6)+upperedge; 101 | if(scrstarty!=screndy && screndy>0) 102 | { 103 | #ifdef USE_SHADING 104 | col=curshades[((byte *)shape)[newstart+j]]; 105 | #else 106 | col=((byte *)shape)[newstart+j]; 107 | #endif 108 | if(scrstarty<0) scrstarty=0; 109 | if(screndy>viewheight) screndy=viewheight,j=endy; 110 | 111 | while(scrstartyflags & FL_DIR_POS_MASK) 142 | { 143 | case FL_DIR_POS_FW: diradd=0x7ff0+0x8000; break; 144 | case FL_DIR_POS_BW: diradd=-0x7ff0+0x8000; break; 145 | case FL_DIR_POS_MID: diradd=0x8000; break; 146 | default: 147 | Quit("Unknown directional 3d sprite position (shapenum = %i)", ob->shapenum); 148 | } 149 | 150 | if(ob->flags & FL_DIR_VERT_FLAG) // vertical dir 3d sprite 151 | { 152 | fixed gy1,gy2,gx,gyt1,gyt2,gxt; 153 | // 154 | // translate point to view centered coordinates 155 | // 156 | gy1 = (((long)ob->tiley) << TILESHIFT)+0x8000-playy-0x8000L-SIZEADD; 157 | gy2 = gy1+0x10000L+2*SIZEADD; 158 | gx = (((long)ob->tilex) << TILESHIFT)+diradd-playx; 159 | 160 | // 161 | // calculate newx 162 | // 163 | gxt = FixedMul(gx,viewcos); 164 | gyt1 = FixedMul(gy1,viewsin); 165 | gyt2 = FixedMul(gy2,viewsin); 166 | nx1 = gxt-gyt1; 167 | nx2 = gxt-gyt2; 168 | 169 | // 170 | // calculate newy 171 | // 172 | gxt = FixedMul(gx,viewsin); 173 | gyt1 = FixedMul(gy1,viewcos); 174 | gyt2 = FixedMul(gy2,viewcos); 175 | ny1 = gyt1+gxt; 176 | ny2 = gyt2+gxt; 177 | } 178 | else // horizontal dir 3d sprite 179 | { 180 | fixed gx1,gx2,gy,gxt1,gxt2,gyt; 181 | // 182 | // translate point to view centered coordinates 183 | // 184 | gx1 = (((long)ob->tilex) << TILESHIFT)+0x8000-playx-0x8000L-SIZEADD; 185 | gx2 = gx1+0x10000L+2*SIZEADD; 186 | gy = (((long)ob->tiley) << TILESHIFT)+diradd-playy; 187 | 188 | // 189 | // calculate newx 190 | // 191 | gxt1 = FixedMul(gx1,viewcos); 192 | gxt2 = FixedMul(gx2,viewcos); 193 | gyt = FixedMul(gy,viewsin); 194 | nx1 = gxt1-gyt; 195 | nx2 = gxt2-gyt; 196 | 197 | // 198 | // calculate newy 199 | // 200 | gxt1 = FixedMul(gx1,viewsin); 201 | gxt2 = FixedMul(gx2,viewsin); 202 | gyt = FixedMul(gy,viewcos); 203 | ny1 = gyt+gxt1; 204 | ny2 = gyt+gxt2; 205 | } 206 | 207 | if(nx1 < 0 || nx2 < 0) return; // TODO: Clip on viewplane 208 | 209 | // 210 | // calculate perspective ratio 211 | // 212 | if(nx1>=0 && nx1<=1792) nx1=1792; 213 | if(nx1<0 && nx1>=-1792) nx1=-1792; 214 | if(nx2>=0 && nx2<=1792) nx2=1792; 215 | if(nx2<0 && nx2>=-1792) nx2=-1792; 216 | 217 | viewx1=(int)(centerx+ny1*scale/nx1); 218 | viewx2=(int)(centerx+ny2*scale/nx2); 219 | 220 | if(viewx2 < viewx1) 221 | { 222 | Scale3DShaper(viewx2,viewx1,ob->shapenum,ob->flags,ny2,ny1,nx2,nx1,vbuf,vbufPitch); 223 | } 224 | else 225 | { 226 | Scale3DShaper(viewx1,viewx2,ob->shapenum,ob->flags,ny1,ny2,nx1,nx2,vbuf,vbufPitch); 227 | } 228 | } 229 | 230 | #endif 231 | -------------------------------------------------------------------------------- /src/wl_floorceiling.cpp: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | #ifdef USE_FLOORCEILINGTEX 4 | 5 | #include "wl_def.h" 6 | #include "wl_shade.h" 7 | 8 | // Textured Floor and Ceiling by DarkOne 9 | // With multi-textured floors and ceilings stored in lower and upper bytes of 10 | // according tile in third mapplane, respectively. 11 | void DrawFloorAndCeiling(byte *vbuf, unsigned vbufPitch, int min_wallheight) 12 | { 13 | fixed dist; // distance to row projection 14 | fixed tex_step; // global step per one screen pixel 15 | fixed gu, gv, du, dv; // global texture coordinates 16 | int u, v; // local texture coordinates 17 | byte *toptex, *bottex; 18 | unsigned lasttoptex = 0xffffffff, lastbottex = 0xffffffff; 19 | 20 | int halfheight = viewheight >> 1; 21 | int y0 = min_wallheight >> 3; // starting y value 22 | if(y0 > halfheight) 23 | return; // view obscured by walls 24 | if(!y0) y0 = 1; // don't let division by zero 25 | unsigned bot_offset0 = vbufPitch * (halfheight + y0); 26 | unsigned top_offset0 = vbufPitch * (halfheight - y0 - 1); 27 | 28 | // draw horizontal lines 29 | for(int y = y0, bot_offset = bot_offset0, top_offset = top_offset0; 30 | y < halfheight; y++, bot_offset += vbufPitch, top_offset -= vbufPitch) 31 | { 32 | dist = (heightnumerator / (y + 1)) << 5; 33 | gu = viewx + FixedMul(dist, viewcos); 34 | gv = -viewy + FixedMul(dist, viewsin); 35 | tex_step = (dist << 8) / viewwidth / 175; 36 | du = FixedMul(tex_step, viewsin); 37 | dv = -FixedMul(tex_step, viewcos); 38 | gu -= (viewwidth >> 1) * du; 39 | gv -= (viewwidth >> 1) * dv; // starting point (leftmost) 40 | #ifdef USE_SHADING 41 | byte *curshades = shadetable[GetShade(y << 3)]; 42 | #endif 43 | for(int x = 0, bot_add = bot_offset, top_add = top_offset; 44 | x < viewwidth; x++, bot_add++, top_add++) 45 | { 46 | if(wallheight[x] >> 3 <= y) 47 | { 48 | int curx = (gu >> TILESHIFT) & (MAPSIZE - 1); 49 | int cury = (-(gv >> TILESHIFT) - 1) & (MAPSIZE - 1); 50 | unsigned curtex = MAPSPOT(curx, cury, 2); 51 | if(curtex) 52 | { 53 | unsigned curtoptex = curtex >> 8; 54 | if (curtoptex != lasttoptex) 55 | { 56 | lasttoptex = curtoptex; 57 | toptex = PM_GetTexture(curtoptex); 58 | } 59 | unsigned curbottex = curtex & 0xff; 60 | if (curbottex != lastbottex) 61 | { 62 | lastbottex = curbottex; 63 | bottex = PM_GetTexture(curbottex); 64 | } 65 | u = (gu >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1); 66 | v = (gv >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1); 67 | unsigned texoffs = (u << TEXTURESHIFT) + (TEXTURESIZE - 1) - v; 68 | #ifdef USE_SHADING 69 | if(curtoptex) 70 | vbuf[top_add] = curshades[toptex[texoffs]]; 71 | if(curbottex) 72 | vbuf[bot_add] = curshades[bottex[texoffs]]; 73 | #else 74 | if(curtoptex) 75 | vbuf[top_add] = toptex[texoffs]; 76 | if(curbottex) 77 | vbuf[bot_add] = bottex[texoffs]; 78 | #endif 79 | } 80 | } 81 | gu += du; 82 | gv += dv; 83 | } 84 | } 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/wl_menu.h: -------------------------------------------------------------------------------- 1 | // 2 | // WL_MENU.H 3 | // 4 | #ifdef SPEAR 5 | 6 | #define BORDCOLOR 0x99 7 | #define BORD2COLOR 0x93 8 | #define DEACTIVE 0x9b 9 | #define BKGDCOLOR 0x9d 10 | //#define STRIPE 0x9c 11 | 12 | #define MenuFadeOut() VL_FadeOut(0,255,0,0,51,10) 13 | 14 | #else 15 | 16 | #define BORDCOLOR 0x29 17 | #define BORD2COLOR 0x23 18 | #define DEACTIVE 0x2b 19 | #define BKGDCOLOR 0x2d 20 | #define STRIPE 0x2c 21 | 22 | #define MenuFadeOut() VL_FadeOut(0,255,43,0,0,10) 23 | 24 | #endif 25 | 26 | #define READCOLOR 0x4a 27 | #define READHCOLOR 0x47 28 | #define VIEWCOLOR 0x7f 29 | #define TEXTCOLOR 0x17 30 | #define HIGHLIGHT 0x13 31 | #define MenuFadeIn() VL_FadeIn(0,255,gamepal,10) 32 | 33 | 34 | #define MENUSONG WONDERIN_MUS 35 | 36 | #ifndef SPEAR 37 | #define INTROSONG NAZI_NOR_MUS 38 | #else 39 | #define INTROSONG XTOWER2_MUS 40 | #endif 41 | 42 | #define SENSITIVE 60 43 | #define CENTERX ((int) screenWidth / 2) 44 | #define CENTERY ((int) screenHeight / 2) 45 | 46 | #define MENU_X CENTERX - 84 47 | #define MENU_Y 55 48 | #define MENU_W 178 49 | #ifndef SPEAR 50 | #ifndef GOODTIMES 51 | #define MENU_H 13*10+6 52 | #else 53 | #define MENU_H 13*9+6 54 | #endif 55 | #else 56 | #define MENU_H 13*9+6 57 | #endif 58 | 59 | #define SM_X 48 60 | #define SM_W 250 61 | 62 | #define SM_Y1 20 63 | #define SM_H1 4*13-7 64 | #define SM_Y2 SM_Y1+5*13 65 | #define SM_H2 4*13-7 66 | #define SM_Y3 SM_Y2+5*13 67 | #define SM_H3 3*13-7 68 | 69 | #define CTL_X CENTERX - (160 - 24) 70 | #ifdef JAPAN 71 | #define CTL_Y 70 72 | #else 73 | #define CTL_Y 86 74 | #endif 75 | #define CTL_W 284 76 | #define CTL_H 60 77 | 78 | #define LSM_X 85 79 | #define LSM_Y 55 80 | #define LSM_W 175 81 | #define LSM_H 10*13+10 82 | 83 | #define NM_X CENTERX - 110 84 | #define NM_Y 100 85 | #define NM_W 225 86 | #define NM_H 13*4+15 87 | 88 | #define NE_X 10 89 | #define NE_Y 23 90 | #define NE_W 400-NE_X*2 91 | #define NE_H 200-NE_Y*2 92 | 93 | #define CST_X 20 94 | #define CST_Y 48 95 | #define CST_START 60 96 | #define CST_SPC 60 97 | 98 | 99 | 100 | // 101 | // TYPEDEFS 102 | // 103 | typedef struct { 104 | short x,y,amount,curpos,indent; 105 | } CP_iteminfo; 106 | 107 | #pragma pack(0) 108 | typedef struct { 109 | short active; 110 | char string[36]; 111 | int (* routine)(int temp1); 112 | } CP_itemtype; 113 | #pragma pack(1) 114 | 115 | typedef struct { 116 | short allowed[4]; 117 | } CustomCtrls; 118 | 119 | extern CP_itemtype MainMenu[]; 120 | extern CP_iteminfo MainItems; 121 | 122 | // 123 | // FUNCTION PROTOTYPES 124 | // 125 | 126 | void US_ControlPanel(ScanCode); 127 | 128 | void EnableEndGameMenuItem(); 129 | 130 | void SetupControlPanel(void); 131 | void SetupSaveGames(); 132 | void CleanupControlPanel(void); 133 | 134 | void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items); 135 | int HandleMenu(CP_iteminfo *item_i, 136 | CP_itemtype *items, 137 | void (*routine)(int w)); 138 | void ClearMScreen(void); 139 | void DrawWindow(int x,int y,int w,int h,int wcolor); 140 | void DrawOutline(int x,int y,int w,int h,int color1,int color2); 141 | void WaitKeyUp(void); 142 | void ReadAnyControl(ControlInfo *ci); 143 | void TicDelay(int count); 144 | void CacheLump(int lumpstart,int lumpend); 145 | void UnCacheLump(int lumpstart,int lumpend); 146 | int StartCPMusic(int song); 147 | int Confirm(const char *string); 148 | void Message(const char *string); 149 | void CheckPause(void); 150 | void ShootSnd(void); 151 | void CheckSecretMissions(void); 152 | void BossKey(void); 153 | 154 | void DrawGun(CP_iteminfo *item_i,CP_itemtype *items,int x,int *y,int which,int basey,void (*routine)(int w)); 155 | void DrawHalfStep(int x,int y); 156 | void EraseGun(CP_iteminfo *item_i,CP_itemtype *items,int x,int y,int which); 157 | void SetTextColor(CP_itemtype *items,int hlight); 158 | void DrawMenuGun(CP_iteminfo *iteminfo); 159 | void DrawStripes(int y); 160 | 161 | void DefineMouseBtns(void); 162 | void DefineJoyBtns(void); 163 | void DefineKeyBtns(void); 164 | void DefineKeyMove(void); 165 | void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*PrintRtn)(int),int type); 166 | 167 | void DrawMainMenu(void); 168 | void DrawSoundMenu(void); 169 | void DrawLoadSaveScreen(int loadsave); 170 | void DrawNewEpisode(void); 171 | void DrawNewGame(void); 172 | void DrawChangeView(int view); 173 | void DrawMouseSens(void); 174 | void DrawCtlScreen(void); 175 | void DrawCustomScreen(void); 176 | void DrawLSAction(int which); 177 | void DrawCustMouse(int hilight); 178 | void DrawCustJoy(int hilight); 179 | void DrawCustKeybd(int hilight); 180 | void DrawCustKeys(int hilight); 181 | void PrintCustMouse(int i); 182 | void PrintCustJoy(int i); 183 | void PrintCustKeybd(int i); 184 | void PrintCustKeys(int i); 185 | 186 | void PrintLSEntry(int w,int color); 187 | void TrackWhichGame(int w); 188 | void DrawNewGameDiff(int w); 189 | void FixupCustom(int w); 190 | 191 | int CP_NewGame(int); 192 | int CP_Sound(int); 193 | int CP_LoadGame(int quick); 194 | int CP_SaveGame(int quick); 195 | int CP_Control(int); 196 | int CP_ChangeView(int); 197 | int CP_ExitOptions(int); 198 | int CP_Quit(int); 199 | int CP_ViewScores(int); 200 | int CP_EndGame(int); 201 | int CP_CheckQuick(ScanCode scancode); 202 | int CustomControls(int); 203 | int MouseSensitivity(int); 204 | 205 | void CheckForEpisodes(void); 206 | 207 | void FreeMusic(void); 208 | 209 | 210 | enum {MOUSE,JOYSTICK,KEYBOARDBTNS,KEYBOARDMOVE}; // FOR INPUT TYPES 211 | 212 | enum menuitems 213 | { 214 | newgame, 215 | soundmenu, 216 | control, 217 | loadgame, 218 | savegame, 219 | changeview, 220 | 221 | #ifndef GOODTIMES 222 | #ifndef SPEAR 223 | readthis, 224 | #endif 225 | #endif 226 | 227 | viewscores, 228 | backtodemo, 229 | quit 230 | }; 231 | 232 | // 233 | // WL_INTER 234 | // 235 | typedef struct { 236 | int kill,secret,treasure; 237 | int32_t time; 238 | } LRstruct; 239 | 240 | extern LRstruct LevelRatios[]; 241 | 242 | void Write (int x,int y,const char *string); 243 | void NonShareware(void); 244 | int GetYorN(int x,int y,int pic); 245 | -------------------------------------------------------------------------------- /src/wl_parallax.cpp: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | #ifdef USE_PARALLAX 4 | 5 | #include "wl_def.h" 6 | 7 | #ifdef USE_FEATUREFLAGS 8 | 9 | // The lower left tile of every map determines the start texture of the parallax sky. 10 | static int GetParallaxStartTexture() 11 | { 12 | int startTex = ffDataBottomLeft; 13 | assert(startTex >= 0 && startTex < PMSpriteStart); 14 | return startTex; 15 | } 16 | 17 | #else 18 | 19 | static int GetParallaxStartTexture() 20 | { 21 | int startTex; 22 | switch(gamestate.episode * 10 + mapon) 23 | { 24 | case 0: startTex = 20; break; 25 | default: startTex = 0; break; 26 | } 27 | assert(startTex >= 0 && startTex < PMSpriteStart); 28 | return startTex; 29 | } 30 | 31 | #endif 32 | 33 | void DrawParallax(byte *vbuf, unsigned vbufPitch) 34 | { 35 | int startpage = GetParallaxStartTexture(); 36 | int midangle = player->angle * (FINEANGLES / ANGLES); 37 | int skyheight = viewheight >> 1; 38 | int curtex = -1; 39 | byte *skytex; 40 | 41 | startpage += USE_PARALLAX - 1; 42 | 43 | for(int x = 0; x < viewwidth; x++) 44 | { 45 | int curang = pixelangle[x] + midangle; 46 | if(curang < 0) curang += FINEANGLES; 47 | else if(curang >= FINEANGLES) curang -= FINEANGLES; 48 | int xtex = curang * USE_PARALLAX * TEXTURESIZE / FINEANGLES; 49 | int newtex = xtex >> TEXTURESHIFT; 50 | if(newtex != curtex) 51 | { 52 | curtex = newtex; 53 | skytex = PM_GetTexture(startpage - curtex); 54 | } 55 | int texoffs = TEXTUREMASK - ((xtex & (TEXTURESIZE - 1)) << TEXTURESHIFT); 56 | int yend = skyheight - (wallheight[x] >> 3); 57 | if(yend <= 0) continue; 58 | 59 | for(int y = 0, offs = x; y < yend; y++, offs += vbufPitch) 60 | vbuf[offs] = skytex[texoffs + (y * TEXTURESIZE) / skyheight]; 61 | } 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/wl_shade.cpp: -------------------------------------------------------------------------------- 1 | #include "version.h" 2 | 3 | #ifdef USE_SHADING 4 | #include "wl_def.h" 5 | #include "wl_shade.h" 6 | 7 | typedef struct { 8 | uint8_t destRed, destGreen, destBlue; // values between 0 and 255 9 | uint8_t fogStrength; 10 | } shadedef_t; 11 | 12 | shadedef_t shadeDefs[] = { 13 | { 0, 0, 0, LSHADE_NOSHADING }, 14 | { 0, 0, 0, LSHADE_NORMAL }, 15 | { 0, 0, 0, LSHADE_FOG }, 16 | { 40, 40, 40, LSHADE_NORMAL }, 17 | { 60, 60, 60, LSHADE_FOG } 18 | }; 19 | 20 | uint8_t shadetable[SHADE_COUNT][256]; 21 | int LSHADE_flag; 22 | 23 | #ifdef USE_FEATUREFLAGS 24 | 25 | // The lower 8-bit of the upper left tile of every map determine 26 | // the used shading definition of shadeDefs. 27 | static inline int GetShadeDefID() 28 | { 29 | int shadeID = ffDataTopLeft & 0x00ff; 30 | assert(shadeID >= 0 && shadeID < lengthof(shadeDefs)); 31 | return shadeID; 32 | } 33 | 34 | #else 35 | 36 | static int GetShadeDefID() 37 | { 38 | int shadeID; 39 | switch(gamestate.episode * 10 + mapon) 40 | { 41 | case 0: shadeID = 4; break; 42 | case 1: 43 | case 2: 44 | case 6: shadeID = 1; break; 45 | case 3: shadeID = 0; break; 46 | case 5: shadeID = 2; break; 47 | default: shadeID = 3; break; 48 | } 49 | assert(shadeID >= 0 && shadeID < lengthof(shadeDefs)); 50 | return shadeID; 51 | } 52 | 53 | #endif 54 | 55 | 56 | // Returns the palette index of the nearest matching color of the 57 | // given RGB color in given palette 58 | byte GetColor(byte red, byte green, byte blue, SDL_Color *palette) 59 | { 60 | byte mincol = 0; 61 | double mindist = 200000.F, curdist, DRed, DGreen, DBlue; 62 | 63 | SDL_Color *palPtr = palette; 64 | 65 | for(int col = 0; col < 256; col++, palPtr++) 66 | { 67 | DRed = (double) (red - palPtr->r); 68 | DGreen = (double) (green - palPtr->g); 69 | DBlue = (double) (blue - palPtr->b); 70 | curdist = DRed * DRed + DGreen * DGreen + DBlue * DBlue; 71 | if(curdist < mindist) 72 | { 73 | mindist = curdist; 74 | mincol = (byte) col; 75 | } 76 | } 77 | return mincol; 78 | } 79 | 80 | // Fade all colors in 32 steps down to the destination-RGB 81 | // (use gray for fogging, black for standard shading) 82 | void GenerateShadeTable(byte destRed, byte destGreen, byte destBlue, 83 | SDL_Color *palette, int fog) 84 | { 85 | double curRed, curGreen, curBlue, redStep, greenStep, blueStep; 86 | SDL_Color *palPtr = palette; 87 | 88 | // Set the fog-flag 89 | LSHADE_flag=fog; 90 | 91 | // Color loop 92 | for(int i = 0; i < 256; i++, palPtr++) 93 | { 94 | // Get original palette color 95 | curRed = palPtr->r; 96 | curGreen = palPtr->g; 97 | curBlue = palPtr->b; 98 | 99 | // Calculate increment per step 100 | redStep = ((double) destRed - curRed) / (SHADE_COUNT + 8); 101 | greenStep = ((double) destGreen - curGreen) / (SHADE_COUNT + 8); 102 | blueStep = ((double) destBlue - curBlue) / (SHADE_COUNT + 8); 103 | 104 | // Calc color for each shade of the current color 105 | for (int shade = 0; shade < SHADE_COUNT; shade++) 106 | { 107 | shadetable[shade][i] = GetColor((byte) curRed, (byte) curGreen, (byte) curBlue, palette); 108 | 109 | // Inc to next shade 110 | curRed += redStep; 111 | curGreen += greenStep; 112 | curBlue += blueStep; 113 | } 114 | } 115 | } 116 | 117 | void NoShading() 118 | { 119 | for(int shade = 0; shade < SHADE_COUNT; shade++) 120 | for(int i = 0; i < 256; i++) 121 | shadetable[shade][i] = i; 122 | } 123 | 124 | void InitLevelShadeTable() 125 | { 126 | shadedef_t *shadeDef = &shadeDefs[GetShadeDefID()]; 127 | if(shadeDef->fogStrength == LSHADE_NOSHADING) 128 | NoShading(); 129 | else 130 | GenerateShadeTable(shadeDef->destRed, shadeDef->destGreen, shadeDef->destBlue, gamepal, shadeDef->fogStrength); 131 | } 132 | 133 | int GetShade(int scale) 134 | { 135 | int shade = (scale >> 1) / (((viewwidth * 3) >> 8) + 1 + LSHADE_flag); // TODO: reconsider this... 136 | if(shade > 32) shade = 32; 137 | else if(shade < 1) shade = 1; 138 | shade = 32 - shade; 139 | 140 | return shade; 141 | } 142 | 143 | #endif 144 | -------------------------------------------------------------------------------- /src/wl_shade.h: -------------------------------------------------------------------------------- 1 | #if defined(USE_SHADING) && !defined(_WL_SHADE_H_) 2 | #define _WL_SHADE_H_ 3 | 4 | #define SHADE_COUNT 32 5 | 6 | #define LSHADE_NOSHADING 0xff 7 | #define LSHADE_NORMAL 0 8 | #define LSHADE_FOG 5 9 | 10 | extern uint8_t shadetable[SHADE_COUNT][256]; 11 | 12 | void InitLevelShadeTable(); 13 | int GetShade(int scale); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/wolfpal.inc: -------------------------------------------------------------------------------- 1 | RGB( 0, 0, 0),RGB( 0, 0, 42),RGB( 0, 42, 0),RGB( 0, 42, 42),RGB( 42, 0, 0), 2 | RGB( 42, 0, 42),RGB( 42, 21, 0),RGB( 42, 42, 42),RGB( 21, 21, 21),RGB( 21, 21, 63), 3 | RGB( 21, 63, 21),RGB( 21, 63, 63),RGB( 63, 21, 21),RGB( 63, 21, 63),RGB( 63, 63, 21), 4 | RGB( 63, 63, 63),RGB( 59, 59, 59),RGB( 55, 55, 55),RGB( 52, 52, 52),RGB( 48, 48, 48), 5 | RGB( 45, 45, 45),RGB( 42, 42, 42),RGB( 38, 38, 38),RGB( 35, 35, 35),RGB( 31, 31, 31), 6 | RGB( 28, 28, 28),RGB( 25, 25, 25),RGB( 21, 21, 21),RGB( 18, 18, 18),RGB( 14, 14, 14), 7 | RGB( 11, 11, 11),RGB( 8, 8, 8),RGB( 63, 0, 0),RGB( 59, 0, 0),RGB( 56, 0, 0), 8 | RGB( 53, 0, 0),RGB( 50, 0, 0),RGB( 47, 0, 0),RGB( 44, 0, 0),RGB( 41, 0, 0), 9 | RGB( 38, 0, 0),RGB( 34, 0, 0),RGB( 31, 0, 0),RGB( 28, 0, 0),RGB( 25, 0, 0), 10 | RGB( 22, 0, 0),RGB( 19, 0, 0),RGB( 16, 0, 0),RGB( 63, 54, 54),RGB( 63, 46, 46), 11 | RGB( 63, 39, 39),RGB( 63, 31, 31),RGB( 63, 23, 23),RGB( 63, 16, 16),RGB( 63, 8, 8), 12 | RGB( 63, 0, 0),RGB( 63, 42, 23),RGB( 63, 38, 16),RGB( 63, 34, 8),RGB( 63, 30, 0), 13 | RGB( 57, 27, 0),RGB( 51, 24, 0),RGB( 45, 21, 0),RGB( 39, 19, 0),RGB( 63, 63, 54), 14 | RGB( 63, 63, 46),RGB( 63, 63, 39),RGB( 63, 63, 31),RGB( 63, 62, 23),RGB( 63, 61, 16), 15 | RGB( 63, 61, 8),RGB( 63, 61, 0),RGB( 57, 54, 0),RGB( 51, 49, 0),RGB( 45, 43, 0), 16 | RGB( 39, 39, 0),RGB( 33, 33, 0),RGB( 28, 27, 0),RGB( 22, 21, 0),RGB( 16, 16, 0), 17 | RGB( 52, 63, 23),RGB( 49, 63, 16),RGB( 45, 63, 8),RGB( 40, 63, 0),RGB( 36, 57, 0), 18 | RGB( 32, 51, 0),RGB( 29, 45, 0),RGB( 24, 39, 0),RGB( 54, 63, 54),RGB( 47, 63, 46), 19 | RGB( 39, 63, 39),RGB( 32, 63, 31),RGB( 24, 63, 23),RGB( 16, 63, 16),RGB( 8, 63, 8), 20 | RGB( 0, 63, 0),RGB( 0, 63, 0),RGB( 0, 59, 0),RGB( 0, 56, 0),RGB( 0, 53, 0), 21 | RGB( 1, 50, 0),RGB( 1, 47, 0),RGB( 1, 44, 0),RGB( 1, 41, 0),RGB( 1, 38, 0), 22 | RGB( 1, 34, 0),RGB( 1, 31, 0),RGB( 1, 28, 0),RGB( 1, 25, 0),RGB( 1, 22, 0), 23 | RGB( 1, 19, 0),RGB( 1, 16, 0),RGB( 54, 63, 63),RGB( 46, 63, 63),RGB( 39, 63, 63), 24 | RGB( 31, 63, 62),RGB( 23, 63, 63),RGB( 16, 63, 63),RGB( 8, 63, 63),RGB( 0, 63, 63), 25 | RGB( 0, 57, 57),RGB( 0, 51, 51),RGB( 0, 45, 45),RGB( 0, 39, 39),RGB( 0, 33, 33), 26 | RGB( 0, 28, 28),RGB( 0, 22, 22),RGB( 0, 16, 16),RGB( 23, 47, 63),RGB( 16, 44, 63), 27 | RGB( 8, 42, 63),RGB( 0, 39, 63),RGB( 0, 35, 57),RGB( 0, 31, 51),RGB( 0, 27, 45), 28 | RGB( 0, 23, 39),RGB( 54, 54, 63),RGB( 46, 47, 63),RGB( 39, 39, 63),RGB( 31, 32, 63), 29 | RGB( 23, 24, 63),RGB( 16, 16, 63),RGB( 8, 9, 63),RGB( 0, 1, 63),RGB( 0, 0, 63), 30 | RGB( 0, 0, 59),RGB( 0, 0, 56),RGB( 0, 0, 53),RGB( 0, 0, 50),RGB( 0, 0, 47), 31 | RGB( 0, 0, 44),RGB( 0, 0, 41),RGB( 0, 0, 38),RGB( 0, 0, 34),RGB( 0, 0, 31), 32 | RGB( 0, 0, 28),RGB( 0, 0, 25),RGB( 0, 0, 22),RGB( 0, 0, 19),RGB( 0, 0, 16), 33 | RGB( 10, 10, 10),RGB( 63, 56, 13),RGB( 63, 53, 9),RGB( 63, 51, 6),RGB( 63, 48, 2), 34 | RGB( 63, 45, 0),RGB( 45, 8, 63),RGB( 42, 0, 63),RGB( 38, 0, 57),RGB( 32, 0, 51), 35 | RGB( 29, 0, 45),RGB( 24, 0, 39),RGB( 20, 0, 33),RGB( 17, 0, 28),RGB( 13, 0, 22), 36 | RGB( 10, 0, 16),RGB( 63, 54, 63),RGB( 63, 46, 63),RGB( 63, 39, 63),RGB( 63, 31, 63), 37 | RGB( 63, 23, 63),RGB( 63, 16, 63),RGB( 63, 8, 63),RGB( 63, 0, 63),RGB( 56, 0, 57), 38 | RGB( 50, 0, 51),RGB( 45, 0, 45),RGB( 39, 0, 39),RGB( 33, 0, 33),RGB( 27, 0, 28), 39 | RGB( 22, 0, 22),RGB( 16, 0, 16),RGB( 63, 58, 55),RGB( 63, 56, 52),RGB( 63, 54, 49), 40 | RGB( 63, 53, 47),RGB( 63, 51, 44),RGB( 63, 49, 41),RGB( 63, 47, 39),RGB( 63, 46, 36), 41 | RGB( 63, 44, 32),RGB( 63, 41, 28),RGB( 63, 39, 24),RGB( 60, 37, 23),RGB( 58, 35, 22), 42 | RGB( 55, 34, 21),RGB( 52, 32, 20),RGB( 50, 31, 19),RGB( 47, 30, 18),RGB( 45, 28, 17), 43 | RGB( 42, 26, 16),RGB( 40, 25, 15),RGB( 39, 24, 14),RGB( 36, 23, 13),RGB( 34, 22, 12), 44 | RGB( 32, 20, 11),RGB( 29, 19, 10),RGB( 27, 18, 9),RGB( 23, 16, 8),RGB( 21, 15, 7), 45 | RGB( 18, 14, 6),RGB( 16, 12, 6),RGB( 14, 11, 5),RGB( 10, 8, 3),RGB( 24, 0, 25), 46 | RGB( 0, 25, 25),RGB( 0, 24, 24),RGB( 0, 0, 7),RGB( 0, 0, 11),RGB( 12, 9, 4), 47 | RGB( 18, 0, 18),RGB( 20, 0, 20),RGB( 0, 0, 13),RGB( 7, 7, 7),RGB( 19, 19, 19), 48 | RGB( 23, 23, 23),RGB( 16, 16, 16),RGB( 12, 12, 12),RGB( 13, 13, 13),RGB( 54, 61, 61), 49 | RGB( 46, 58, 58),RGB( 39, 55, 55),RGB( 29, 50, 50),RGB( 18, 48, 48),RGB( 8, 45, 45), 50 | RGB( 8, 44, 44),RGB( 0, 41, 41),RGB( 0, 38, 38),RGB( 0, 35, 35),RGB( 0, 33, 33), 51 | RGB( 0, 31, 31),RGB( 0, 30, 30),RGB( 0, 29, 29),RGB( 0, 28, 28),RGB( 0, 27, 27), 52 | RGB( 38, 0, 34) 53 | --------------------------------------------------------------------------------