Skip to content

Commit d80803d

Browse files
committed
First commit
0 parents  commit d80803d

File tree

266 files changed

+105973
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+105973
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
################################################################################
2+
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
3+
################################################################################
4+

LICENSE

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README.TXT

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
================
2+
= doomgeneric =
3+
================
4+
5+
To port DOOM easly, I made some changes to source code.
6+
Now, all you need to do is implement the functions in doomgeneric.h to port DOOM to a new system.
7+
doomgeneric_win.c is a Windows GDI port. It is also a good example for how to port doomgeneric.
8+
Sound is not supported for now.
9+
10+
Original readme
11+
===============
12+
13+
Here it is, at long last. The DOOM source code is released for your
14+
non-profit use. You still need real DOOM data to work with this code.
15+
If you don't actually own a real copy of one of the DOOMs, you should
16+
still be able to find them at software stores.
17+
18+
Many thanks to Bernd Kreimeier for taking the time to clean up the
19+
project and make sure that it actually works. Projects tends to rot if
20+
you leave it alone for a few years, and it takes effort for someone to
21+
deal with it again.
22+
23+
The bad news: this code only compiles and runs on linux. We couldn't
24+
release the dos code because of a copyrighted sound library we used
25+
(wow, was that a mistake -- I write my own sound code now), and I
26+
honestly don't even know what happened to the port that microsoft did
27+
to windows.
28+
29+
Still, the code is quite portable, and it should be straightforward to
30+
bring it up on just about any platform.
31+
32+
I wrote this code a long, long time ago, and there are plenty of things
33+
that seem downright silly in retrospect (using polar coordinates for
34+
clipping comes to mind), but overall it should still be a usefull base
35+
to experiment and build on.
36+
37+
The basic rendering concept -- horizontal and vertical lines of constant
38+
Z with fixed light shading per band was dead-on, but the implementation
39+
could be improved dramatically from the original code if it were
40+
revisited. The way the rendering proceded from walls to floors to
41+
sprites could be collapsed into a single front-to-back walk of the bsp
42+
tree to collect information, then draw all the contents of a subsector
43+
on the way back up the tree. It requires treating floors and ceilings
44+
as polygons, rather than just the gaps between walls, and it requires
45+
clipping sprite billboards into subsector fragments, but it would be
46+
The Right Thing.
47+
48+
The movement and line of sight checking against the lines is one of the
49+
bigger misses that I look back on. It is messy code that had some
50+
failure cases, and there was a vastly simpler (and faster) solution
51+
sitting in front of my face. I used the BSP tree for rendering things,
52+
but I didn't realize at the time that it could also be used for
53+
environment testing. Replacing the line of sight test with a bsp line
54+
clip would be pretty easy. Sweeping volumes for movement gets a bit
55+
tougher, and touches on many of the challenges faced in quake / quake2
56+
with edge bevels on polyhedrons.
57+
58+
Some project ideas:
59+
60+
Port it to your favorite operating system.
61+
62+
Add some rendering features -- transparency, look up / down, slopes,
63+
etc.
64+
65+
Add some game features -- weapons, jumping, ducking, flying, etc.
66+
67+
Create a packet server based internet game.
68+
69+
Create a client / server based internet game.
70+
71+
Do a 3D accelerated version. On modern hardware (fast pentium + 3DFX)
72+
you probably wouldn't even need to be clever -- you could just draw the
73+
entire level and get reasonable speed. With a touch of effort, it should
74+
easily lock at 60 fps (well, there are some issues with DOOM's 35 hz
75+
timebase...). The biggest issues would probably be the non-power of two
76+
texture sizes and the walls composed of multiple textures.
77+
78+
79+
I don't have a real good guess at how many people are going to be
80+
playing with this, but if significant projects are undertaken, it would
81+
be cool to see a level of community cooperation. I know that most early
82+
projects are going to be rough hacks done in isolation, but I would be
83+
very pleased to see a coordinated 'net release of an improved, backwards
84+
compatable version of DOOM on multiple platforms next year.
85+
86+
Have fun.
87+
88+
John Carmack
89+
12-23-97

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# DoomGeneric NTNative
2+
This is a fork of ozkl's DoomGeneric which adds port to the BootExecute environment of Windows XP and later.
3+
4+
# Requirements for building DoomGeneric NTNative
5+
1. Visual Studio 2017 Windows XP toolset.
6+
2. InbvShim (https://github.com/Cacodemon345/inbvbootdrv).
7+
3. Windows 7 DDK (for building InbvShim and ntdll.lib).
8+
9+
# Requirements for running
10+
Only tested on Windows XP 32-bit. I don't know about later versions.
11+
12+
# Building
13+
Note: Only 32-bit Debug builds are supported, anything else is broken.
14+
Copy over the ntdll.lib file from \\path\to\WinDDK\7600.16385.1\lib\wxp\i386\ to the doomgeneric directory inside the project. Open the solution, right click "doomgeneric_nt" and select "Build".
15+
16+
# Building InbvShim
17+
From the x86/x64 Free Build Environment, cd to the directory where you have cloned InbvShim repository, and type 'build' to build the driver. You will find the inbvbootdrv.sys file in the objfre_wxp_x86 (objfre_win7_x64 if building for x64) folder.
18+
19+
# Installing InbvShim
20+
Copy it to your system32\Drivers directory of your Windows installation. And then grab the inbvbootdrvinst.reg from one of the releases and double-click it to install.
21+
22+
# Installing DoomGeneric NTNative
23+
Copy doomgeneric_nt.exe to C:\Windows\system32\ directory.
24+
There are two ways of launching it:
25+
1. Registry modification:
26+
27+
**WARNING:** Backing up the registry is very important before going down this path.
28+
29+
Open Registry Editor (regedit), go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\. Double-click BootExecute.
30+
31+
Replace this:
32+
```
33+
autocheck autochk *
34+
```
35+
36+
with:
37+
```
38+
autocheck autochk *
39+
doomgeneric_nt -iwad \??\C:\Windows\doom2.wad -cdrom
40+
```
41+
42+
Replace \\??\C:\Windows\doom2.wad with the location where the IWAD is installed (remember to prefix it with \\??\ before the full path).
43+
44+
Note that I don't recommend this way because it can make input non-functional, making it impossible to quit the program and requiring a hard reset.
45+
46+
2. Native Shell (assuming you installed it beforehand):
47+
48+
cd to the directory where DoomGeneric NTNative is installed and type:
49+
```
50+
doomgeneric_nt.exe -iwad \??\path\to\iwad.wad -cdrom
51+
```
52+
53+
Replace \\path\to\ with the location where the IWAD is installed.
54+
55+
# Extra bonuses:
56+
1. 16-color mode for Windows GDI port activated with -4bit option.
57+
58+
# Bugs:
59+
1. Savegames are broken.
60+
2. Picking a weapon crashes the program (bug inherited from original DoomGeneric).
61+
3. It's slow as hell, probably could use FastDoom's EGA drawing code for it.
62+
63+
# License:
64+
Same as original DoomGeneric, except for some files:
65+
66+
i_main_nt.c: ReactOS project license.
67+
doomgeneric_nt.c: Uses code both from ZenWINX and Native Shell (LGPL).
68+
Bundled NDK: Used under the terms of GPLv2.

doomgeneric/Makefile.freebsd

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
################################################################
2+
#
3+
# $Id:$
4+
#
5+
# $Log:$
6+
#
7+
8+
VB=@
9+
10+
11+
CC=clang # gcc or g++
12+
CFLAGS+=-ggdb3 -Os -I/usr/local/include
13+
LDFLAGS+=-Wl,--gc-sections -L/usr/local/lib
14+
CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV # -DUSEASM
15+
LIBS+=-lm -lc -lX11
16+
17+
# subdirectory for objects
18+
OBJDIR=build
19+
OUTPUT=doomgeneric
20+
21+
SRC_DOOM = i_main.o dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_main.o w_wad.o z_zone.o w_file_stdc.o i_input.o i_video.o doomgeneric.o doomgeneric_xlib.o
22+
OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM))
23+
24+
all: $(OUTPUT)
25+
26+
clean:
27+
rm -rf $(OBJDIR)
28+
rm -f $(OUTPUT)
29+
rm -f $(OUTPUT).gdb
30+
rm -f $(OUTPUT).map
31+
32+
$(OUTPUT): $(OBJS)
33+
@echo [Linking $@]
34+
$(VB)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) \
35+
-o $(OUTPUT) $(LIBS) -Wl,-Map,$(OUTPUT).map
36+
@echo [Size]
37+
-$(CROSS_COMPILE)size $(OUTPUT)
38+
39+
$(OBJS): | $(OBJDIR)
40+
41+
$(OBJDIR):
42+
mkdir -p $(OBJDIR)
43+
44+
$(OBJDIR)/%.o: %.c
45+
@echo [Compiling $<]
46+
$(VB)$(CC) $(CFLAGS) -c $< -o $@
47+
48+
print:
49+
@echo OBJS: $(OBJS)
50+

doomgeneric/Makefile.sdl

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
################################################################
2+
#
3+
# $Id:$
4+
#
5+
# $Log:$
6+
#
7+
8+
ifeq ($(V),1)
9+
VB=''
10+
else
11+
VB=@
12+
endif
13+
14+
15+
SDL_CFLAGS = -D_THREAD_SAFE -I/usr/include/SDL2
16+
SDL_LIBS =
17+
18+
19+
CC=clang # gcc or g++
20+
CFLAGS+=-ggdb3 -Os $(INCLUDES) $(SDL_CFLAGS)
21+
LDFLAGS+=-Wl,-dead_strip
22+
CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV # -DUSEASM
23+
LIBS+=-lm -lc -lSDL2
24+
25+
# subdirectory for objects
26+
OBJDIR=build
27+
OUTPUT=doomgeneric
28+
29+
SRC_DOOM = i_main.o dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_main.o w_wad.o z_zone.o w_file_stdc.o i_input.o i_video.o doomgeneric.o doomgeneric_sdl.o
30+
OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM))
31+
32+
all: $(OUTPUT)
33+
34+
clean:
35+
rm -rf $(OBJDIR)
36+
rm -f $(OUTPUT)
37+
rm -f $(OUTPUT).gdb
38+
rm -f $(OUTPUT).map
39+
40+
$(OUTPUT): $(OBJS)
41+
@echo [Linking $@]
42+
$(VB)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) \
43+
-o $(OUTPUT) $(LIBS) -Wl
44+
@echo [Size]
45+
-$(CROSS_COMPILE)size $(OUTPUT)
46+
47+
$(OBJS): | $(OBJDIR)
48+
49+
$(OBJDIR):
50+
mkdir -p $(OBJDIR)
51+
52+
$(OBJDIR)/%.o: %.c
53+
@echo [Compiling $<]
54+
$(VB)$(CC) $(CFLAGS) -c $< -o $@
55+
56+
print:
57+
@echo OBJS: $(OBJS)
58+

doomgeneric/Makefile.soso

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
################################################################
2+
#
3+
# $Id:$
4+
#
5+
# $Log:$
6+
#
7+
8+
ifeq ($(V),1)
9+
VB=''
10+
else
11+
VB=@
12+
endif
13+
14+
15+
CC=soso-clang # gcc or g++
16+
CFLAGS+=-O3
17+
LDFLAGS+=$(SOSO_ROOT)/lib/crt1.o $(SOSO_ROOT)/lib/crti.o $(SOSO_ROOT)/lib/crtn.o
18+
CFLAGS+=-Wall -DNORMALUNIX -DLINUX -DSNDSERV -D_DEFAULT_SOURCE # -DUSEASM
19+
LIBS+=-lm -lc /usr/lib/llvm-10/lib/clang/10.0.0/lib/linux/libclang_rt.builtins-i386.a
20+
21+
# subdirectory for objects
22+
OBJDIR=build
23+
OUTPUT=fbdoom
24+
25+
SRC_DOOM = i_main.o dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_main.o w_wad.o z_zone.o w_file_stdc.o i_input.o i_video.o doomgeneric.o doomgeneric_soso.o
26+
OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM))
27+
28+
all: $(OUTPUT)
29+
30+
clean:
31+
rm -rf $(OBJDIR)
32+
rm -f $(OUTPUT)
33+
rm -f $(OUTPUT).gdb
34+
rm -f $(OUTPUT).map
35+
36+
$(OUTPUT): $(OBJS)
37+
@echo [Linking $@]
38+
i386-soso-ld -v $(LDFLAGS) $(OBJS) -o $(OUTPUT) $(LIBS)
39+
@echo [Size]
40+
-$(CROSS_COMPILE)size $(OUTPUT)
41+
cp $(OUTPUT) ~/git/soso/userspace/bin/
42+
43+
$(OBJS): | $(OBJDIR)
44+
45+
$(OBJDIR):
46+
mkdir -p $(OBJDIR)
47+
48+
$(OBJDIR)/%.o: %.c
49+
@echo [Compiling $<]
50+
$(VB)$(CC) $(CFLAGS) -c $< -o $@
51+
52+
print:
53+
@echo OBJS: $(OBJS)
54+

doomgeneric/Makefile.sosox

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
################################################################
2+
#
3+
# $Id:$
4+
#
5+
# $Log:$
6+
#
7+
8+
ifeq ($(V),1)
9+
VB=''
10+
else
11+
VB=@
12+
endif
13+
14+
15+
CC=soso-clang # gcc or g++
16+
CFLAGS+=-O3
17+
LDFLAGS+=$(SOSO_ROOT)/lib/crt1.o $(SOSO_ROOT)/lib/crti.o $(SOSO_ROOT)/lib/crtn.o
18+
CFLAGS+=-I$(SOSO_ROOT)/include/nano-x -Wall -DNORMALUNIX -DLINUX -DSNDSERV -D_DEFAULT_SOURCE # -DUSEASM
19+
LIBS+=-lnano-X -lm -lc /usr/lib/llvm-10/lib/clang/10.0.0/lib/linux/libclang_rt.builtins-i386.a
20+
21+
# subdirectory for objects
22+
OBJDIR=build
23+
OUTPUT=doom
24+
25+
SRC_DOOM = i_main.o dummy.o am_map.o doomdef.o doomstat.o dstrings.o d_event.o d_items.o d_iwad.o d_loop.o d_main.o d_mode.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_cdmus.o i_endoom.o i_joystick.o i_scale.o i_sound.o i_system.o i_timer.o memio.o m_argv.o m_bbox.o m_cheat.o m_config.o m_controls.o m_fixed.o m_menu.o m_misc.o m_random.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_plane.o r_segs.o r_sky.o r_things.o sha1.o sounds.o statdump.o st_lib.o st_stuff.o s_sound.o tables.o v_video.o wi_stuff.o w_checksum.o w_file.o w_main.o w_wad.o z_zone.o w_file_stdc.o i_input.o i_video.o doomgeneric.o doomgeneric_sosox.o
26+
OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM))
27+
28+
all: $(OUTPUT)
29+
30+
clean:
31+
rm -rf $(OBJDIR)
32+
rm -f $(OUTPUT)
33+
rm -f $(OUTPUT).gdb
34+
rm -f $(OUTPUT).map
35+
36+
$(OUTPUT): $(OBJS)
37+
@echo [Linking $@]
38+
i386-soso-ld -v $(LDFLAGS) $(OBJS) -o $(OUTPUT) $(LIBS)
39+
@echo [Size]
40+
-$(CROSS_COMPILE)size $(OUTPUT)
41+
cp $(OUTPUT) ~/git/soso/userspace/bin/
42+
43+
$(OBJS): | $(OBJDIR)
44+
45+
$(OBJDIR):
46+
mkdir -p $(OBJDIR)
47+
48+
$(OBJDIR)/%.o: %.c
49+
@echo [Compiling $<]
50+
$(VB)$(CC) $(CFLAGS) -c $< -o $@
51+
52+
print:
53+
@echo OBJS: $(OBJS)
54+

0 commit comments

Comments
 (0)