Upgraded to chocolate-doom port instead

This commit is contained in:
Maxime Vincent 2016-05-23 15:26:13 +02:00
parent 968f7e0090
commit 019b22b7bd
205 changed files with 30579 additions and 16534 deletions

View File

@ -1,109 +0,0 @@
/ChangeLog/1.14/Mon Feb 3 22:45:08 1997//
/DOOMLIC.TXT/1.3/Sun Jan 26 07:44:56 1997//
/FILES/1.1/Sun Jan 19 17:22:41 1997//
/FILES2/1.1/Sun Jan 19 17:22:42 1997//
/Makefile/1.6/Mon Feb 3 22:45:08 1997//
/am_data.h/1.2/Tue Jan 21 18:59:56 1997//
/am_map.c/1.4/Mon Feb 3 21:24:33 1997//
/am_map.h/1.2/Tue Jan 21 18:59:56 1997//
/d_englsh.h/1.1/Mon Feb 3 21:48:03 1997//
/d_event.h/1.2/Mon Feb 3 22:01:47 1997//
/d_french.h/1.3/Mon Feb 3 21:48:03 1997//
/d_main.c/1.8/Mon Feb 3 22:45:09 1997//
/d_net.c/1.3/Mon Feb 3 22:01:47 1997//
/d_textur.h/1.1/Mon Feb 3 16:47:51 1997//
/doomdata.h/1.5/Mon Feb 3 22:45:09 1997//
/doomdef.h/1.9/Mon Feb 3 22:45:09 1997//
/doomtype.h/1.2/Mon Feb 3 22:45:09 1997//
/dstrings.h/1.4/Mon Feb 3 21:48:03 1997//
/dutils.c/1.5/Mon Feb 3 17:11:23 1997//
/dutils.h/1.4/Mon Feb 3 17:11:23 1997//
/f_finale.c/1.5/Mon Feb 3 21:26:34 1997//
/f_finale.h/1.1/Mon Feb 3 21:26:34 1997//
/f_wipe.c/1.2/Mon Feb 3 22:45:09 1997//
/f_wipe.h/1.1/Mon Feb 3 17:11:23 1997//
/fpfunc.S/1.1/Sun Jan 19 17:22:43 1997//
/g_game.c/1.8/Mon Feb 3 22:45:09 1997//
/g_game.h/1.1/Mon Feb 3 21:34:47 1997//
/hu_lib.c/1.3/Sun Jan 26 07:44:58 1997//
/hu_lib.h/1.4/Mon Feb 3 16:47:52 1997//
/hu_stuff.c/1.4/Mon Feb 3 16:47:52 1997//
/hu_stuff.h/1.3/Sun Jan 26 07:44:58 1997//
/i_dga.c/1.3/Sun Jan 26 07:44:58 1997//
/i_ibm.c/1.3/Sun Jan 26 07:44:58 1997//
/i_main.c/1.4/Mon Feb 3 22:45:10 1997//
/i_pcnet.c/1.3/Sun Jan 26 07:44:59 1997//
/i_sound.c/1.3/Sun Jan 26 07:44:59 1997//
/i_sound.h/1.3/Sun Jan 26 07:44:59 1997//
/i_svga.c/1.3/Sun Jan 26 07:44:59 1997//
/i_unix.c/1.5/Mon Feb 3 22:45:10 1997//
/i_x.c/1.6/Mon Feb 3 22:45:10 1997//
/info.c/1.3/Sun Jan 26 07:45:00 1997//
/info.h/1.3/Sun Jan 26 07:45:00 1997//
/irix.c/1.3/Sun Jan 26 07:45:00 1997//
/irix.h/1.3/Sun Jan 26 07:45:01 1997//
/linux.c/1.3/Sun Jan 26 07:45:01 1997//
/m_argv.c/1.1/Mon Feb 3 22:45:10 1997//
/m_argv.h/1.1/Mon Feb 3 22:45:10 1997//
/m_bbox.c/1.1/Mon Feb 3 22:45:10 1997//
/m_bbox.h/1.1/Mon Feb 3 22:45:10 1997//
/m_cheat.c/1.1/Mon Feb 3 21:24:34 1997//
/m_cheat.h/1.1/Mon Feb 3 21:24:34 1997//
/m_menu.c/1.7/Mon Feb 3 22:45:10 1997//
/m_menu.h/1.1/Mon Feb 3 22:01:49 1997//
/m_misc.c/1.6/Mon Feb 3 22:45:10 1997//
/m_misc.h/1.1/Mon Feb 3 22:45:11 1997//
/m_random.c/1.1/Mon Feb 3 22:45:11 1997//
/m_random.h/1.1/Mon Feb 3 22:45:11 1997//
/p_ceilng.c/1.4/Mon Feb 3 16:47:53 1997//
/p_doors.c/1.4/Mon Feb 3 16:47:53 1997//
/p_enemy.c/1.5/Mon Feb 3 22:45:11 1997//
/p_floor.c/1.4/Mon Feb 3 16:47:54 1997//
/p_inter.c/1.4/Mon Feb 3 22:45:11 1997//
/p_lights.c/1.5/Mon Feb 3 22:45:11 1997//
/p_local.h/1.3/Tue Jan 28 22:08:27 1997//
/p_map.c/1.5/Mon Feb 3 22:45:11 1997//
/p_maputl.c/1.5/Mon Feb 3 22:45:11 1997//
/p_mobj.c/1.5/Mon Feb 3 22:45:12 1997//
/p_plats.c/1.5/Mon Feb 3 22:45:12 1997//
/p_pspr.c/1.5/Mon Feb 3 22:45:12 1997//
/p_setup.c/1.5/Mon Feb 3 22:45:12 1997//
/p_sight.c/1.3/Tue Jan 28 22:08:28 1997//
/p_spec.c/1.6/Mon Feb 3 22:45:12 1997//
/p_spec.h/1.3/Tue Jan 28 22:08:29 1997//
/p_switch.c/1.3/Tue Jan 28 22:08:29 1997//
/p_telept.c/1.3/Tue Jan 28 22:08:29 1997//
/p_tick.c/1.4/Mon Feb 3 16:47:55 1997//
/p_user.c/1.3/Tue Jan 28 22:08:29 1997//
/r_bsp.c/1.4/Mon Feb 3 22:45:12 1997//
/r_data.c/1.4/Mon Feb 3 16:47:55 1997//
/r_draw.c/1.4/Mon Feb 3 16:47:55 1997//
/r_local.h/1.4/Mon Feb 3 21:26:34 1997//
/r_main.c/1.5/Mon Feb 3 22:45:12 1997//
/r_plane.c/1.4/Mon Feb 3 16:47:55 1997//
/r_segs.c/1.3/Wed Jan 29 20:10:19 1997//
/r_things.c/1.5/Mon Feb 3 16:47:56 1997//
/s_sound.c/1.6/Mon Feb 3 22:45:12 1997//
/sounds.c/1.3/Wed Jan 29 22:40:44 1997//
/sounds.h/1.3/Wed Jan 29 22:40:44 1997//
/soundsrv.c/1.3/Wed Jan 29 22:40:44 1997//
/soundsrv.h/1.3/Wed Jan 29 22:40:44 1997//
/soundst.h/1.3/Wed Jan 29 22:40:45 1997//
/st_lib.c/1.4/Mon Feb 3 16:47:56 1997//
/st_lib.h/1.4/Mon Feb 3 16:47:56 1997//
/st_stuff.c/1.6/Mon Feb 3 22:45:13 1997//
/st_stuff.h/1.3/Thu Jan 30 19:54:22 1997//
/sun.c/1.3/Thu Jan 30 19:54:22 1997//
/tables.c/1.4/Mon Feb 3 16:47:57 1997//
/tables.h/1.1/Mon Feb 3 16:47:57 1997//
/tmap.S/1.1/Sun Jan 19 17:22:51 1997//
/v_video.c/1.5/Mon Feb 3 22:45:13 1997//
/v_video.h/1.2/Mon Feb 3 17:11:59 1997//
/w_wad.c/1.5/Mon Feb 3 16:47:57 1997//
/wadread.c/1.3/Thu Jan 30 19:54:23 1997//
/wadread.h/1.3/Thu Jan 30 19:54:23 1997//
/wi_data.h/1.3/Thu Jan 30 19:54:23 1997//
/wi_stuff.c/1.7/Mon Feb 3 22:45:13 1997//
/wi_stuff.h/1.4/Mon Feb 3 16:47:58 1997//
/z_zone.c/1.4/Mon Feb 3 16:47:58 1997//
/z_zone.h/1.1/Mon Feb 3 16:47:58 1997//

View File

@ -1 +0,0 @@
/info/cvsroot/id/id_doom

View File

@ -1 +0,0 @@
/info/cvsroot/

View File

@ -1,922 +0,0 @@
* TODO: see below, and in the "TODO" file. Enjoy!
Mon Dec 22 20:29:16 1997 <bk@gamers.org>
* CVS logs and other obsolete stuff removed. Anybody
who wants to keep some revision control now has a
clean slate to start with.
Mon Dec 22 19:53:34 1997 <bk@gamers.org>
* i_sound.c: enabled SNDSERV, as SNDINTR for
some reason just gives ghastly results e.g.
on E4M2. Frankly, I am at a loss. SNDSERV is
now default, until the internal sound driver
is a bit more reliable.
Note that the current redundancy means that
changes like the one below will have to
be propagated manually to the soundserver
sources.
* m_menu.c: the 4th episode is now removed with
the original doom.wad. You need to rename the
Ultimate DOOM/Special Edition retail IWAD to
doomu.wad now, or you won't see the 4th episode
in the menu. The compile time SPECIAL define
is thus gone.
Mon Dec 22 17:08:33 1997 <bk@gamers.org>
* v_video.c (V_DrawPatch): another last minute hack.
While shareware, retail, commercial, and plutonia
(being a full DOOM2 IWAD) seem to work okay now,
TNT gives an error on finishing the first mission:
"Patch at -35, -5 exceeds LFB".
I changed the error abort into a simple return,
thus the patch is ignored. The intermission screen
seems to come up okay.
* TODO: check which patch, and whether it is an IWAD
problem.
* i_sound.c: the sound table is hardwired in
sounds.h/sounds.c. As our current crude
sound handling simply loads *all* sounds at
startup, we are going to miss some with DOOM1
WAD files. I could skip them, but decided to
load a placeholder instead (dspistol). It might
be good to use a distinct default sound for
WAD debug purposes. A zero length sound lump
would work, but would not be noticeable.
Anyway, shareware and retail work now.
* TODO: implement proper handling for missing
lumps, sound and otherwise.
Perhaps move sound table into WAD?
* g_game.c (G_DoPlayDemo): finally removed the
annoying "Demo is from a different game version"
abort. It now simply declines to playback the
demo, and waits for user input on some
do_nothing screen.
* doomdef.h&Cie.: Lesson of the day - do not
replace a bunch of booleans with an enum and
use the same identifiers. Point in case:
"if ( commercial )" will not give an error,
and will always be true as long as the enum
value is greater than zero.
I found that the DOOM2 vs. DOOM differences
are everywhere (weapons, monsters, doors).
Number of episodes varies from shareware/commercial
to registered to retail, while commercial has
a unique set (two of them, counting the german
edition) of maps in one episode. Plus, TNT and
Plutonia add some TITLE strings to the mixture.
Well, Plutonia and TNT are treated as DOOM2 for
now, so you will miss the startup message.
* wi_stuff.h (NUMEPISODES): removed SPECIAL switch.
It is no 4 times 9 for wi_stuff.c internal
static arrays - doesn't matter.
* TODO: unified handling with DOOM 2 - dynamic
allocation of arrays.
* i_sound.c (I_UpdateSound): okay, I separated
the mixing, now done synchonously, along with
a flag signalling the timer that the mixing buffer
has been updated. The handler is now very short,
and I tried several intervals down to 50usecs,
w/o complaints. Now the man page says:
"system timer resolution currently 10ms". Odd.
Anyway, while the double shotgun/plasma rapid
fire problem seems to be a bit less disturbing
at higher refresh, it's still there. I set the
interval to 500usec, which is sufficient for
avoiding any buffer update misses.
Conclusion after just two days of experimentation:
yep, sound driver code isn't fun at all.
As for the bug - well, Dave Taylor suggested
close distance getting into a divide-by-near-zero
situation, screwing up the volume. I can't figure
why latency of an external sound driver or screen
size affect this, but I am running out of ideas.
* i_sound.c:
Some more experimentation with the timer driven
sound. It doesn't work well using an intervall
of less then 30 msecs - there will be artifacts
with say 50 msecs. This is pretty obvious with
a target frame rate of at least 30fps, methinks.
Using the REAL/SIGALRM timer with 30msec gets
rid of the artifacts, it seems - at the expense
of slowing down things on a P133 to a noticeable
jerkiness. Bah.
Mon Dec 22 00:36:54 1997 <bk@gamers.org>
* info.c: and i_video.c and i_sound.c - don't ask
me why some Linux header files are different with
gcc vs. g++, or what the complaint about the g++
complaint info.c state table is all about:
"initializer element for `states[..].action.acp1'
is not constant"
Undid some changes, compiled with gcc, playtested,
seems okay. Done for today... yesterday.
* i_net.c (ntohl): okay, htons/htonl, ntohs,ntohl
are back to haunt me. Copied the macros that
on my box aren't used for whatever reason directly
into the source. Got rid of all other multiple and
undefined references. CC=g++ now compiles (still
many warnings) and links, but the binary dumps a
core after Init PlayLoop. So be it.
Sun Dec 21 12:38:08 1997 <bk@gamers.org>
* p_enemy.c (P_NewChaseDir): changed tdir to int,
removed the LUTs - spurious locks were due to
endless loops created by boneheaded predecessor
map. Has to be a better way to do enum dirtype_t
anyway. Problem seems to be fixed.
* CC=gcc again, this time loads of #includes to
fix "implicit declarations, and one or two
unused variables. DOOM now compiles without
any -Wall warnings left, as C.
* Bug: compiled the reworked code with gcc. Within a
solid while of testing and blasting away, it
locked once. Got a core, which gdb doesn't grok.
Bah.
* TODO: okay, linkage of g++ build modules give loads
of errors, because we have many implicits, plus
missing #pragma implementation causing multiple
definitions. Yet, this is the very first time DOOM
was compiled as C++ without a parsing error. So there.
* sounds.c: included doomtype.h and removed yet another
enum { false, true } definition.
* p_saveg.c (misc): several.
* p_mobj.c (P_SpawnMobj): (actionf_p1)P_MobjThinker
* p_spec.c (EV_DoDonut): (action_p1) T_MoveFloor (twice).
* p_plats.c (EV_DoPlat): (actionf_p1) T_PlatRaise.
* p_plats.c (EV_StopPlat): (actionf_v)NULL.
* p_plats.c (P_ActivateInStasis): same
* p_lights.c (P_SpawnGlowingLight): (actionf_p1) T_Glow.
* p_lights.c (P_SpawnStrobeFlash): (actionf_p1) T_StrobeFlash.
* p_lights.c (P_SpawnLightFlash): (actionf_p1) T_LightFlash.
* p_lights.c (P_SpawnFireFlicker): (actionf_p1) T_FireFlicker.
* p_floor.c (EV_DoFloor): (actionf_p1) T_MoveFloor.
* p_floor.c (EV_BuildStairs): same (twice).
* p_doors.c (EV_VerticalDoor): (actionf_p1)T_VerticalDoor.
* p_doors.c (P_SpawnDoorCloseIn30): same
* p_doors.c (P_SpawnDoorRaiseIn5Mins): same
* p_doors.c (EV_DoDoor): same
* p_ceilng.c (EV_CeilingCrushStop): (actionf_v)NULL.
* p_ceilng.c (EV_DoCeiling): (actionf_p1)T_MoveCeiling.
* p_ceilng.c (P_ActivateInStasisCeiling): same.
These gave g++ errors, but have been ignored by gcc.
* r_data.c (R_PrecacheLevel): (actionf_p1)P_MobjThinker.
* p_saveg.c: conversions (actionf_p1)T_Whatever.
* p_tick.c: cast (actionf_v)(-1).
* p_telept.c: yet another (actionf_p1)P_MobjThinker.
* p_mobj.c (P_MobjThinker): cast (actionf_v)(-1).
* TODO: decent NOP/NULL/Nil function pointer.
I'd introduce a global A_NOP() function that
chokes up an error message.
Why -1 instead of NULL?
* p_enemy.c: conversions (actionf_p1)P_MobjThinker.
* d_think.h/info.h: think_t is essentially
the same action function pointer stuff.
I moved the definitions from info.h to
d_think.h, and aliased them with a typedef.
Now more changes needed.
* p_enemy.c (successor, predecessor): new LUT,
to provide increments/decrements for enum
dirtype_t, as g++ complaints:
"no post-increment/decrement operator for type"
* Makefile (CC): okay, tried "g++" once more.
A few errors (above). Plus shitloads of warnings
(obviously, better "unused" checking with C++,
lots of the usual int2enum suspects, implicit
declarations, the works).
* p_mobj.c: action.acp1 used accordingly.
* p_pspr.c: action.acp2 used accordingly.
* TODO: info.c:144 warning
"missing braces around initializer for `states[0].action'"
* info.h/info.c: some experimental stuff on
action function pointers.
* TODO: still some sound glitches at startup.
* i_sound.c: few more cleanups. Made mixing use
channel loop instead of unroll, set mixbuffer
to zero ot start.
Removed some more DOS leftovers (8bit),
kept some as comment.
* hu_stuff.c (HU_Start):
More gamemode changes. As in d_main.c, I
decided to use DOOM2 as default whenever
one needed - it was sold most, and had the
superset of items, enemies and monsters.
* TODO: the handling of WAD specific messages
like HU_TITLE, HU_TITLE2, HU_TITLEP etc.
should definitely be removed.
* d_main.c (CheckBetaTest):
Removed outdated, DOS specific BETATEST stuff.
d_main.c (IdentifyVersion):
Numerous changes to gamemode handling.
* TODO: currently, french language is enabled by
detecting an doom2f.wad - yet it needs FRENCH
define at compile time. I removed most language
stuff, and propose handling that at runtime,
using a switch in the config file. Well,
mission specific texts won't work outside the
WAD anyway.
* TODO: along the same lines: I suggest removing
the misc. devparm switches as well - lots of
redundancy not needed anymore.
* Makefile: finally added a doomstat.c for all
the global state variables listing internal
engine configuration. Right now, these are
scattered everywhere. Declaration to be found
in doomstat.h header.
* f_finale.c (F_StartFinale):
Reworked the entire finale handling based on
game mode enum.
* doomstat.h:
Global variables for game mode and language.
Removed old booleans.
* doomdef.h: GameMode_t and Language_t enum added.
Boolean for language was kinda limiting to 2
alternatives (french, english), and five boolean
plus #define SPECIAL for game version is just ugly.
* wi_stuff.h: SPECIAL switch compiles two
different EXE's, one for 3 episodes of 9 maps
each (DOOM 1 registered), one for 4 episodes
of 9 maps each (DOOM 1 retail/FinalDOOM).
Implicitely, the DOOM2 config (one episode,
34 missions) is handled. How is the german
edition (32 missions only) done?
Frankly, this is a mess. The problem is that
intermission (animated as in DOOM 1, simple
backdrop as in DOOM2) as well as certain
items (double shotgun) as well as certain
rendering stuff (sky texture) depend on this.
Plus, it ties into runtime flags as "commercial"
as well. Yuck.
Each change will change the game. Postponed.
* d_net.c,m_misc.c: removed last two NeXT remains.
* d_englsh.h,d_french.h,d_main.c,m_misc.c,r_draw.c,v_video.c:
more WATCOM remains removed. Kept some stuff that
handeld the blocky mode/detailshift in DOS, which
is n.a. in Linux - but probably not worth fixing.
Sat Dec 20 15:16:51 1997 <bk@gamers.org>
* Bug: core dump when using doom.wad or doom1.wad
without a "-file UNUSED/doom2.wad". Version
dependend handling of stuff (double shotgun)
comes to mind.
* doomdef.h:
SNDSERV enables external sound server
support. SNDINTR enables internal sound
output with timer (asynchronous). Default
is internal, synchronous.
* i_sound.c (I_HandleSoundTimer):
Okay, the plasma/double shotgun sound bug
(crapyy sund when firing nose-to-wall) is
obviously a problem with blocking at
refresh - smaller screen size makes it go
away.
I won't do threads w/o a proper gdb, and
I can't do whatever Dave Taylor did with
LinuxQuake w/o the sources, thus I broke
down and implemented a timer based solution.
Seems to work fine, given the fact that
this is the first time ever I implemented
sound handling.
Fri Dec 19 10:02:48 1997 <bk@gamers.org>
* m_menu.c/i_sound.c/s_sound.c:
Removed a few more inconsistencies due to
old internal sound handling (DOS),
external (Linux sndserver), and
new internal (the unfinished merge of
both the former).
The Options/Sound/Music volume menu is
accessible now. It was due to an internal
scaling of the menu (effective range 0-15),
up to 0..120, by multiply with 8 scattered
all over the place, that we got a
v_video.c: I_Error ("Bad V_DrawPatch")
Now I am using the menu resolution
everywhere, and scaling should only be done
in the actual mixing/output.
* OK, obviously this hasn't been updated in months.
This is because: a) most of the time nothing
happened, and b) when something got done, it was
too much to keep track of it by CVS and/or ChangeLog.
Basically, what happened in the meantime is that
I did not find a publisher who believed that the book
sales would be worth doing it. Within the limited
amount of time that I could dedicate to a project
that will not generate any revenue whatsoever,
I spent some time on cleaning up the Linux code
base which works, essentially. I might or might not
be able to participate in a Mesa+Voodoo+Glide based
GLDOOM port for Linux. I won't waste a minute on
Win32 without getting paid for it.
Because of the legal issues involved with the
DMX sound library id licensed for DOS DOOM, Linuxdoom
is the only code base that has sound support at all.
Other UNIX ports (SGI, Sun) could probably be revived
and integrated w/o too many problems. There is no
Win32 port - I never had access to WinDOOM or
Jim Dose's GLDOOM sources. There is no Linux
OpenGL (read: Mesa) support yet - that'd involve
internal changes which will best be done after a
public source release.
John Carmack opted for a release of the Linux code.
I have removed all DMX references I could get a
hold of, but preserved some of the original
sound handling within DOOM that interfaced
with DMX. Linuxdoom (like previous UNIX ports)
used a separate sound server binary. I did some
work on putting the sound server module back into
the engine. It works, but shutdown (pending sounds),
and sound output parallel to refresh (blocking)
is crappy, and there is a problem with double
shotgun and plasma at close distance (as well as
with lots of other noises going on). As the
mixing code is identical to the separate
soundserver, and as it doesn't seem to be a
blocking issue, I am currently at a loss - I
wonder whether the IPC communication with the
soundserver process introduced a delay that
changed behaviour, or whether I simply overlooked
a bug. I am currently lacking the time to track
this down, so I am keeping both internal and
soundserver source.
I did remove DOS and Watcom specifics. I did also
remove the texture mapping and fixed point assembly.
From my experience, it isn't worth the trouble
to ue GCC inline assembler, as performance of
the same loop written in C is perfectly sufficient.
On demand I will put both assembly modules into some
documentation, as they are probably of historic
interest.
There is no Sun DGA, Irix, or other non-Linux stuff
in this code base (at least, not intentionally).
They will be back when ports to other UNIX
environments will be merged back (I can't do
testing, and the modules were separate and not
consistent, so I refrained from wasting time on
this prior to a public release).
While I made only minor changes to the actual code
(some fixes, some cleaning up of SHM and audio),
I did a huge amount of shuffling around. I
introduced many more header files and modules,
some of them laughably small (doing these changes
is bound to screw up CVS, so no CVS record anymore
for the time being). I would introduce even more
separation if I had the time. Splitting the
animation/AI/behaviour code that defines
"DOOM - The Game" into a separate game.so (like
Quake2 does) should definitely be done. Separating
a ref_soft.so aka "DOOM - The Engine", and defining
a clean interface prior to introducing a ref_gl.so
is recommended as well.
I am going to purge some more leftovers, remove
the obsolete CVS history except for comments,
and try to clean up the last "implicit declaration"
and "unused variable" warnings. Except for enabling
cheats in nightmare (to have more fun while testing),
I did not change the game mechanics at all. I would
strongly advise against doing so w/o the proper
separations suggested above. I will not waste time
on fixing detail and blocky mode, lack of resize,
or other stuff that it better addressed by a proper
GLDOOM port.
Sat Aug 16 08:07:16 1997 <bk@hal.gamers.org>
* p_pspr.c:
Moved the sprite animation stuff from doomdef.h here.
* info.h:
Added #ifndef __INFO__ for multiple inclusion. I am
not going to deal with multigen, or changing the
original DOOM monster animation anyway.
* p_spec.h/c:
Moved anim_t etc., locally used only. There is
another anim_t in wi_stuff.h/c, now local as well,
so collisions on header inclusion should not occur.
#include "doomdef.h"
#include "doomstat.h"
these should now be topmost includes.
* doomstat.h, doomdef.h, wi_stuff.h, d_player.h:
I moved wbstartstruct_t to d_player.h, and wminfo
to doomstat.h. Basically, I will try to move all
global state related stuff into doomstat.h, and
all data structures defined for state variables
into doomdef.h - this will be kinda greek tragedy,
and never finished, but a body can try.
* wi_stuff.h/c, wi_data.h:
Removed wi_data.h, put all local stuff blah... see
below.
I have found several unused global variables,
started outcommenting them with //U, will remove
them later. It might be Watcom/PC stuff, or
somebody put the actual numbers into the implementation
instead of using STARDIST, ANIMPERIOD & Cie.
* st_stuff.h/c: from doomdef.h, local stuff moved
into st_stuff.c, etc.
In the current revisions, I am tolerating warnings
of the "implicit declaration" kind - the linker
resolves the stuff, and it will be handy in
unmangling the modules once the headers contain
only the globally visible stuff.
* am_map.h/c, am_data.h:
Removed am_data.h, put all local stuff into
am_map.c, moved globally needed headers from
doomdef.h into am_map.h.
* p_saveg.h, p_setup.h, p_tick.h:
created, stuff from doomde.h moved there
* d_main.c, d_net.c, doomdef.h:
Decided to dump mprintf, as only needed for
Watcom support which is not going to happen.
* doomdef.h:
Moved function prototypes to appropriate headers:
d_main.h, d_net.h.
Fri Aug 15 16:38:53 1997 <bk@hal.gamers.org>
* doomstat.h:
added a few more comments, regrouped some of the
state variables.
* doomdata.h: added a few more comments.
Thu Aug 14 10:38:37 1997 <bk@hal.gamers.org>
* g_game.c (G_DoLoadLevel):
copied the skyflatnum determination here, from
the R_InitSkyMap - once should be sufficient.
* Makefile, r_sky.h/c:
added r_sky module. The sky handling was scattered
over r_bsp, r_main, r_plane, doomstat.h...
* r_bsp.c, r_main.c, r_segs.c:
Removed RD_* calls from R_debug.m, NeXT switches.
* r_local.h:
Removed the R_debug.m NeXT specific debugging
code headers. Removed "drawbsp" flag from
here, and r_main.c, too.
* r_data.c:
Started to remove NORMALUNIX switches, using
LINUX instead. Basically, different UNIX
platforms using the same code should simply
be ANDed in the #ifdef switches.
* r_draw.c:
Removed some more, but not all WATCOMC support.
There is an unresolved problem with the fuzzy
blitting in the lowres (blocky) modes - either
the "detailshift" flag triggered lowres mode
will be removed, or the bug has to be fixed.
* r_bsp.h, r_draw.h, r_things.h, r_data.h,
r_segs.h, r_main.h, r_plane.h:
Created from r_local.h.
* Back to work.
Till March 22nd, a lot of source shuffling and addition
of new header files, separating stuff, and creating
new, smaller modules. Some Watcom/PC/DMX/NeXT etc.
related stuff got removed, but not all (yet). None of
this ended up in the Log (sorry) or the revision control
(CVS is not well suited while number of files and
respective names change a lot, especially if stuff gets
deleted and/or re-introduced).
Major change: part of the sound code got copied from the
separate Linux sndserver sources to the linuxdoom source.
Re-integration and removal of sndserver pending.
Nothing of importance happend since then (priorities).
Mon Feb 3 16:41:05 1997 <bk@gamers.org ()>
* m_misc.c:
Created m_argv, m_random and m_bbox, kept remains in m_misc
for the time being. Misc. files changed to include only
necessary modules. Moved bbox definitions from doomdata.h.
* m_menu.h:
Created from doomdef.h. Misc. changes in dependend modules.
I am not going to list every affected file from now on.
See Log entries within each file.
* dstrings.h:
Now handles multi-language support and switches.
So far, only english (default) and french are available.
* d_englsh.h:
Created from dstrings.h.
* g_game.h:
Created, from doomdef.h.
* am_map.c, st_stuff.c, wi_stuff.c:
* Makefile:
Added m_cheat, removed dutils. Doubly linked list stuff unused.
* m_cheat.h, m_cheat.c:
Created, basci cheat string scrambling and check, from dutils.h
and dutils.c.
* doomdef.h
Moved screen declaration to v_video.h.
* dutils.h, dutils.c
Remode code for f_wipe.h and f_wipe.c.
* Makefile
* d_main.c,
Added f_wipe files.
* f_wipe.h, f_wipe.c:
Created, screen wipe/melt at mission begin, from dutils.h
and dutils.c.
* d_textur.h:
Created from doomdata.h. Separates all the patch/texture
defintions. Needed for v_video module.
* r_local.h, wi_stuff.h, st_lib.h, hu_lib.h:
* i_x.c, d_main.c, m_menu.c, m_misc.c:
Added v_video.h.
* v_video.h:
Created. Using headers from doomdef.h. Forward of patch_t.
Moved bool and byte to doomtype.h.
Thu Jan 30 20:50:16 1997 <bk@gamers.org ()>
* doomtype.h:
Created, for fixed_t. Should add angle_t here, too.
* tables.c:
Added SlopeDiv from r_main.c, added all defines and typedefs
related to basic trig table use here, removed it.
Currently "tables.h" is included in doomdef.h and
r_local.h, too. This is not too cleanly separated, but
we have to start somewhere, right?
* tables.h:
Created from doomdef.h.
Note that tables.c had fixed size tables, while doomdef.h
calculated from the value of FINEANGLES. In addition,
entries were given as either "int" or "fixed_t". Bad boys.
* z_zone.c:
* s_sound.c:
* hu_stuff.c:
* st_lib.c, st_stuff.c:
* wi_stuff.c:
* w_wad.c:
* r_things.c, r_plane.c, r_draw.c, r_data.c:
* p_tick.c, p_mobj.c, p_spec.c, p_setup.c, p_lights.c,
p_plats.c, p_floor.c, p_doors.c, p_ceilng.c:
* am_map.c:
* m_misc.c, m_menu.c:
* g_game.c:
* d_main.c:
* f_finale.c:
Added #include "z_zone.h".
* z_zone.h:
Created, from stuff in doomdef.h
* CVS checkin. Reformatting run, last one.
Took a week to go through all the sources, w/o even
looking to closely.
* st_stuff.c (ST_Responder):
Removed a first tiny bit of redundancy (NO_CLIP checks).
Should remove idspispod completely, later.
Wed Jan 29 19:53:43 1997 <bk@gamers.org ()>
* Another one, while we are on it. All S (Sound) files.
* CVS checkin. Reformatting run, all R (Refresh) files.
* r_draw.c (R_DrawSpanLow):
The non-Watcom, non-asm lowres mode was just a copy
of the default mode. As detailshift was used to scale
the image down, lowres mode just filled the left half
of the buffer.
* r_draw.c (R_DrawColumnLow):
Tried the same hack for walls, horribly broken.
Postponed.
Tue Jan 28 19:32:48 1997 <bk@gamers.org ()>
* CVS checkin. Another reformatting run. Did all P files.
* p_spec.c: P_FindNextHighestFloor
The number of adjoining sectors is limited to 20, because
of a temporary LUT needed for determining lowest height
in adjacent sectors. No overflow checking is done.
Sun Jan 26 08:41:21 1997 <bk@gamers.org ()>
* Another CVS checkin of a formatting run.
D,F,G,HU,I,M have been changed.
* Note: in initial and current release,
linuxxdoom -3 -file plutonia.wad, idclev 12
produces a Segmentation fault.
Wed Jan 22 14:03:00 1997 <bk@gamers.org ()>
* m_menu.c:
initializer-string for array of chars is too long (skullName)
warning: unused parameter `int choice' (a couple of times)
* Attempt to compile as C++. Loads of warnings, a couple of errors.
p_enemy.c (P_Move):
r_things.c (R_ProjectSprite)
`catch', `throw', and `try' are all C++ reserved words,
thus changed "try" to "try_ok". Fixed.
p_pspr.c: In function `void P_SetPsprite(struct player_s *, ... )':
too many arguments to function
No convenient fix - state->action is declared void action(),
but called w/o, with one, or with two parameters.
There are more like this. Going to be a tough one.
Union of pointers?
Postponed.
r_plane.c: In function `void R_DrawPlanes()':
s_sound.c: In function `int S_AdjustSoundParams(struct mobj_s *, .. )':
p_map.c: In function `bool PIT_StompThing(struct mobj_s *)':
p_maputl.c: In function `int P_AproxDistance(int, int)':
r_main.c: In function `int R_PointToDist(int, int)':
p_enemy.c: In function `void P_NewChaseDir(struct mobj_s *)':
warning: implicit declaration of function `int abs(...)' <stdlib.h>
Wed Jan 22 12:15:00 1997 <bk@gamers.org ()>
* CVS checkin of purification run. Sources now compile
without any "-Wall" warnings.
* Note: with -file "tnt.wad", we get an "Error: Bad V_DrawPatch"
abort each time we enter an exit. Invalid or missing
intermission screen?
* Makefile (CFLAGS): added -Wall, first purification run.
d_main.c: In function `D_DoomMain':
warning: implicit declaration of function `mkdir' <fcntl.h>
i_unix.c: In function `I_StartSound':
warning: control reaches end of non-void function
i_unix.c: In function `I_InitNetwork':
warning: implicit declaration of function `inet_addr' <arpa/inet.h>
i_unix.c: At top level:
warning: `endianness' defined but not used
i_x.c: In function `I_Error':
warning: unused variable `string'
i_x.c: In function `I_GetEvent':
warning: suggest parentheses around arithmetic in operand of |
i_x.c: In function `I_FinishUpdate':
warning: unused variable `bigscreen'
i_x.c: In function `grabsharedmemory':
warning: implicit declaration of function `getuid' <unistd.h>
warning: unused variable `done'
i_x.c: In function `I_InitGraphics':
warning: suggest parentheses around assignment used as truth value
warning: char format, different type arg (arg 3)
warning: char format, different type arg (arg 5)
warning: implicit declaration of function `XShmGetEventBase'
i_x.c: In function `InitExpand2':
warning: unused variable `jexp'
warning: unused variable `iexp'
m_menu.c: In function `M_ReadSaveStrings':
warning: implicit declaration of function `read' <sys/types.h>
warning: implicit declaration of function `close' <unistd.h>
m_misc.c: In function `M_WriteFile':
warning: implicit declaration of function `write'
warning: implicit declaration of function `close'
m_misc.c: In function `M_ReadFile':
warning: implicit declaration of function `read'
m_misc.c: In function `M_ScreenShot':
warning: implicit declaration of function `access' <unistd.h>
p_pspr.c: In function `P_MovePsprites':
suggest parentheses around assignment used as truth value
p_spec.c: In function `P_SpawnSpecials':
warning: implicit declaration of function `atoi' <stdlib.h>
w_wad.c: In function `strupr':
warning: implicit declaration of function `toupper' <ctype.h>
w_wad.c: In function `W_AddFile':
warning: implicit declaration of function `read' <sys/types.h>
warning: implicit declaration of function `lseek'
warning: implicit declaration of function `close' <unistd.h>
wi_stuff.c: In function `WI_loadData':
warning: unused variable `pic'
wi_stuff.c: At top level:
warning: `background' defined but not used
Tue Jan 21 22:00:00 1997 <bk@gamers.org ()>
* doomdata.h (__BYTEBOOL__):
Use builtin ANSI C++ bool.
* d_main.c (IdentifyVersion):
Bug fix: insufficient malloc created errors in malloc/realloc
calls later on. Welcome to the risks of Copy'n'paste.
Tue Jan 21 13:20:05 1997 <bk@gamers.org ()>
* First formatting checkin.
A word of explanation: prior to making any changes to the
source, a couple of formatting runs will be made, followed
by some purification runs.
For this run, the Emacs mode selection line has been changed
to use C++ style indenting (cc-mode.el). Each file has
been automatically reformatted using Emacs indent-region.
A few files have been changed manually already (i.e.,
comments, use of tabs).
Warning: using "diff" to compare files of different states
during the reformatting will not give useful results.
* hu_stuff.c:
fixed "assignment discard const", the last remaining error
message with default compilation.
Sun Jan 19 14:27:06 1997 <bk@gamers.org ()>
* Makefile:
Minor fix for sndserver target, removed linuxsdoom target
for the time being, added CVS header (kind of).
* Initial CVS checkin.
* soundsrv/irix/linux/sun.c:
Changed includes (irix.h removed, soundsrv.h included).
* i_svga.c:
Changed to DOS 8+3.
* soundsrv.h/c:
Changed to DOS 8+3, included irix.h in soundsrv.h.
* r_local.h:
Same for PI, include math.h with Linux.
* doomdef.h:
Got rid of multiply defined warnings for Linux,
included values.h.
* FILES2:
created a commented list of all files, removed a few
more files (sndserver test, NeXT leftovers, DMX header).
Identified the following main modules (see FILES2):
AM, HU, M, P, R, S, ST, W, WI. Some stuff is separate
(Z, F), some not clearly separable (G, D). System specific
interfaces are in I. Some of the latter replace i_main.c
(i.e. the void/int main(argc,argv) call), e.g. SVGA,
others (X11, SHM, DGA) don't. There is a certain amount
of overlap, and the largest module (with possibly most
overlap) is P - playing, i.e. all the games state and
animation handling.
Dithering is currently not used.
Sat Jan 18 15:14:41 1997 <bk@gamers.org ()>
* r_draw.c:
fixed !defined(USEASM) lines for R_DrawColumn/Span.
Removed fpfunc.o/S from Makefile, now compiling
X11 w/o any assembler.
Got a running linuxxdoom again. We are in business.
This source is going to be used for the initial CVS
check in.
* Tried a quick hack compiling it as COFF a.out instead
of ELF, with "gcc -b i486-linuxaout". Same linker
errors.
Tried removing -DUSE_ASM. Still using fpfunc.S.
* Tried linuxxdoom.
Compile run: some warnings (redefinition of MAX/MIN
SHORT/INT/LONG) in doomdef.h and (PI redefined)
r_local.h.
Link run: crashed, undefined references in
d_main.c: undefined reference to `FixedDiv2'
am_map.c: undefined reference to `FixedMul'
r_main.c: undefined reference to `R_DrawColumn'
r_main.c: undefined reference to `R_DrawSpan'
r_plane.c: undefined reference to `FixedMul'
This stuff is defined in fpfunc.S (Fixed point) and
in r_draw.c (assembler in tmap.S not used).
However, "nm," shows that r_draw.o does not include
the drawing functions (see below - USE_ASM).
Furthermore, the global symbols in fpfunc.S begin
with an underscore, "_FixedMul" and "_FixedDiv2".
More problems within fpfunc.o: undefined references to
`_dc_yl' `_dc_yh'
`_ylookup'
`_centery'
`_dc_x'
`_columnofs'
`_dc_iscale'
`_dc_texturemid'
`_dc_source'
`_dc_colormap'
`_ds_y' `_ds_x1' `_ds_x2'
`_ds_xfrac' `_ds_yfrac'
`_ds_xstep' `_ds_ystep'
`_ds_colormap'
`_ds_source'
Again, underscore problem.
Note: tmap.S currently obsolete, as somebody pasted all
the texture mapping assembly into fpfunc.S. Gotta clean
that up.
* Created initial release from CD sources, created ChangeLog.
Let the games begin.
**************************************************************
DOOM source code ChangeLog file
**************************************************************

View File

@ -1,112 +0,0 @@
LIMITED USE SOFTWARE LICENSE AGREEMENT
This Limited Use Software License Agreement (the "Agreement")
is a legal agreement between you, the end-user, and Id Software, Inc.
("ID"). By downloading or purchasing the software material, which
includes source code (the "Source Code"), artwork data, music and
software tools (collectively, the "Software"), you are agreeing to
be bound by the terms of this Agreement. If you do not agree to the
terms of this Agreement, promptly destroy the Software you may have
downloaded or copied.
ID SOFTWARE LICENSE
1. Grant of License. ID grants to you the right to use the
Software. You have no ownership or proprietary rights in or to the
Software, or the Trademark. For purposes of this section, "use" means
loading the Software into RAM, as well as installation on a hard disk
or other storage device. The Software, together with any archive copy
thereof, shall be destroyed when no longer used in accordance with
this Agreement, or when the right to use the Software is terminated.
You agree that the Software will not be shipped, transferred or
exported into any country in violation of the U.S. Export
Administration Act (or any other law governing such matters) and that
you will not utilize, in any other manner, the Software in violation
of any applicable law.
2. Permitted Uses. For educational purposes only, you, the
end-user, may use portions of the Source Code, such as particular
routines, to develop your own software, but may not duplicate the
Source Code, except as noted in paragraph 4. The limited right
referenced in the preceding sentence is hereinafter referred to as
"Educational Use." By so exercising the Educational Use right you
shall not obtain any ownership, copyright, proprietary or other
interest in or to the Source Code, or any portion of the Source
Code. You may dispose of your own software in your sole discretion.
With the exception of the Educational Use right, you may not
otherwise use the Software, or an portion of the Software, which
includes the Source Code, for commercial gain.
3. Prohibited Uses: Under no circumstances shall you, the
end-user, be permitted, allowed or authorized to commercially exploit
the Software. Neither you nor anyone at your direction shall do any
of the following acts with regard to the Software, or any portion
thereof:
Rent;
Sell;
Lease;
Offer on a pay-per-play basis;
Distribute for money or any other consideration; or
In any other manner and through any medium whatsoever
commercially exploit or use for any commercial purpose.
Notwithstanding the foregoing prohibitions, you may commercially
exploit the software you develop by exercising the Educational Use
right, referenced in paragraph 2. hereinabove.
4. Copyright. The Software and all copyrights related thereto
(including all characters and other images generated by the Software
or depicted in the Software) are owned by ID and is protected by
United States copyright laws and international treaty provisions.
Id shall retain exclusive ownership and copyright in and to the
Software and all portions of the Software and you shall have no
ownership or other proprietary interest in such materials. You must
treat the Software like any other copyrighted material. You may not
otherwise reproduce, copy or disclose to others, in whole or in any
part, the Software. You may not copy the written materials
accompanying the Software. You agree to use your best efforts to
see that any user of the Software licensed hereunder complies with
this Agreement.
5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS
IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT
TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL
RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO
JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE
WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS.
THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS
WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES,
DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE
MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF
OF ID.
Exclusive Remedies. The Software is being offered to you
free of any charge. You agree that you have no remedy against ID, its
affiliates, contractors, suppliers, and agents for loss or damage
caused by any defect or failure in the Software regardless of the form
of action, whether in contract, tort, includinegligence, strict
liability or otherwise, with regard to the Software. This Agreement
shall be construed in accordance with and governed by the laws of the
State of Texas. Copyright and other proprietary matters will be
governed by United States laws and international treaties. IN ANY
CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST
SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER
SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT,
NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
OTHER PARTY. Some jurisdictions do not allow the exclusion or
limitation of incidental or consequential damages, so the above
limitation or exclusion may not apply to you.

View File

@ -1,98 +0,0 @@
total 1258
-rw-r--r-- 1 b1 prog 0 Jan 18 15:08 FILES
-rw-r--r-- 1 b1 prog 5799 Jan 18 15:07 Makefile
-rw-r--r-- 1 b1 prog 1943 Jan 18 15:07 am_data.h
-rw-r--r-- 1 b1 prog 20263 Jan 18 15:07 am_map.c
-rw-r--r-- 1 b1 prog 2494 Jan 18 15:07 am_map.h
-rw-r--r-- 1 b1 prog 1499 Jan 18 15:07 am_oids.c
-rw-r--r-- 1 b1 prog 338 Jan 18 15:07 am_oids.h
-rw-r--r-- 1 b1 prog 14005 Jan 18 15:07 d_french.h
-rw-r--r-- 1 b1 prog 25287 Jan 18 15:07 d_main.c
-rw-r--r-- 1 b1 prog 15586 Jan 18 15:07 d_net.c
-rw-r--r-- 1 b1 prog 744 Jan 18 15:07 defs.inc
-rw-r--r-- 1 b1 prog 3569 Jan 18 15:07 dither.c
-rw-r--r-- 1 b1 prog 355 Jan 18 15:07 dither.h
-rw-r--r-- 1 b1 prog 4234 Jan 18 15:07 doomdata.h
-rw-r--r-- 1 b1 prog 32779 Jan 18 15:07 doomdef.h
-rw-r--r-- 1 b1 prog 192 Jan 18 15:07 drcoord.h
-rw-r--r-- 1 b1 prog 22377 Jan 18 15:07 dstrings.h
-rw-r--r-- 1 b1 prog 6582 Jan 18 15:07 dutils.c
-rw-r--r-- 1 b1 prog 1821 Jan 18 15:07 dutils.h
-rw-r--r-- 1 b1 prog 14072 Jan 18 15:07 f_finale.c
-rw-r--r-- 1 b1 prog 7357 Jan 18 15:07 fpfunc.S
-rw-r--r-- 1 b1 prog 34770 Jan 18 15:07 g_game.c
-rw-r--r-- 1 b1 prog 5394 Jan 18 15:07 hu_lib.c
-rw-r--r-- 1 b1 prog 2878 Jan 18 15:07 hu_lib.h
-rw-r--r-- 1 b1 prog 12040 Jan 18 15:07 hu_stuff.c
-rw-r--r-- 1 b1 prog 934 Jan 18 15:07 hu_stuff.h
-rw-r--r-- 1 b1 prog 6238 Jan 18 15:07 i_cyber.c
-rw-r--r-- 1 b1 prog 18324 Jan 18 15:07 i_dga.c
-rw-r--r-- 1 b1 prog 2499 Jan 18 15:07 i_header.h
-rw-r--r-- 1 b1 prog 32815 Jan 18 15:07 i_ibm.c
-rw-r--r-- 1 b1 prog 1867 Jan 18 15:07 i_ibm_a.asm
-rw-r--r-- 1 b1 prog 121 Jan 18 15:07 i_main.c
-rw-r--r-- 1 b1 prog 8251 Jan 18 15:07 i_pcnet.c
-rw-r--r-- 1 b1 prog 8561 Jan 18 15:07 i_sound.c
-rw-r--r-- 1 b1 prog 439 Jan 18 15:07 i_sound.h
-rw-r--r-- 1 b1 prog 9537 Jan 18 15:07 i_svgalib.c
-rw-r--r-- 1 b1 prog 10886 Jan 18 15:07 i_unix.c
-rw-r--r-- 1 b1 prog 20891 Jan 18 15:07 i_x.c
-rw-r--r-- 1 b1 prog 128797 Jan 18 15:07 info.c
-rw-r--r-- 1 b1 prog 15840 Jan 18 15:07 info.h
-rw-r--r-- 1 b1 prog 3477 Jan 18 15:07 irix.c
-rw-r--r-- 1 b1 prog 240 Jan 18 15:07 irix.h
-rw-r--r-- 1 b1 prog 1363 Jan 18 15:07 linux.c
-rw-r--r-- 1 b1 prog 34628 Jan 18 15:07 m_menu.c
-rw-r--r-- 1 b1 prog 13741 Jan 18 15:07 m_misc.c
-rw-r--r-- 1 b1 prog 6117 Jan 18 15:07 p_ceilng.c
-rw-r--r-- 1 b1 prog 15062 Jan 18 15:07 p_doors.c
-rw-r--r-- 1 b1 prog 33758 Jan 18 15:07 p_enemy.c
-rw-r--r-- 1 b1 prog 11409 Jan 18 15:07 p_floor.c
-rw-r--r-- 1 b1 prog 16265 Jan 18 15:07 p_inter.c
-rw-r--r-- 1 b1 prog 7592 Jan 18 15:07 p_lights.c
-rw-r--r-- 1 b1 prog 6447 Jan 18 15:07 p_local.h
-rw-r--r-- 1 b1 prog 30138 Jan 18 15:07 p_map.c
-rw-r--r-- 1 b1 prog 14672 Jan 18 15:07 p_maputl.c
-rw-r--r-- 1 b1 prog 17276 Jan 18 15:07 p_mobj.c
-rw-r--r-- 1 b1 prog 5940 Jan 18 15:07 p_plats.c
-rw-r--r-- 1 b1 prog 17084 Jan 18 15:07 p_pspr.c
-rw-r--r-- 1 b1 prog 12828 Jan 18 15:07 p_setup.c
-rw-r--r-- 1 b1 prog 5962 Jan 18 15:07 p_sight.c
-rw-r--r-- 1 b1 prog 23846 Jan 18 15:07 p_spec.c
-rw-r--r-- 1 b1 prog 11140 Jan 18 15:07 p_spec.h
-rw-r--r-- 1 b1 prog 14229 Jan 18 15:07 p_switch.c
-rw-r--r-- 1 b1 prog 1910 Jan 18 15:07 p_telept.c
-rw-r--r-- 1 b1 prog 14075 Jan 18 15:07 p_tick.c
-rw-r--r-- 1 b1 prog 7044 Jan 18 15:07 p_user.c
-rw-r--r-- 1 b1 prog 13013 Jan 18 15:07 planar.asm
-rw-r--r-- 1 b1 prog 9811 Jan 18 15:07 r_bsp.c
-rw-r--r-- 1 b1 prog 14619 Jan 18 15:07 r_data.c
-rw-r--r-- 1 b1 prog 13591 Jan 18 15:07 r_draw.c
-rw-r--r-- 1 b1 prog 11378 Jan 18 15:07 r_local.h
-rw-r--r-- 1 b1 prog 14868 Jan 18 15:07 r_main.c
-rw-r--r-- 1 b1 prog 7108 Jan 18 15:07 r_plane.c
-rw-r--r-- 1 b1 prog 15420 Jan 18 15:07 r_segs.c
-rw-r--r-- 1 b1 prog 18969 Jan 18 15:07 r_things.c
-rw-r--r-- 1 b1 prog 12274 Jan 18 15:07 s_sound.c
-rw-r--r-- 1 b1 prog 12812 Jan 18 15:07 sndserver.c
-rw-r--r-- 1 b1 prog 141 Jan 18 15:07 sndserver.h
-rw-r--r-- 1 b1 prog 5811 Jan 18 15:07 sounds.c
-rw-r--r-- 1 b1 prog 2674 Jan 18 15:07 sounds.h
-rw-r--r-- 1 b1 prog 3975 Jan 18 15:07 soundst.h
-rw-r--r-- 1 b1 prog 3461 Jan 18 15:07 st_lib.c
-rw-r--r-- 1 b1 prog 2254 Jan 18 15:07 st_lib.h
-rw-r--r-- 1 b1 prog 22769 Jan 18 15:07 st_stuff.c
-rw-r--r-- 1 b1 prog 4685 Jan 18 15:07 st_stuff.h
-rw-r--r-- 1 b1 prog 1725 Jan 18 15:07 sun.c
-rw-r--r-- 1 b1 prog 75 Jan 18 15:07 t.c
-rw-r--r-- 1 b1 prog 114621 Jan 18 15:07 tables.c
-rw-r--r-- 1 b1 prog 5485 Jan 18 15:07 tmap.S
-rw-r--r-- 1 b1 prog 10904 Jan 18 15:07 v_video.c
-rw-r--r-- 1 b1 prog 268 Jan 18 15:07 vgaview.h
-rw-r--r-- 1 b1 prog 9920 Jan 18 15:07 w_wad.c
-rw-r--r-- 1 b1 prog 3629 Jan 18 15:07 wadread.c
-rw-r--r-- 1 b1 prog 551 Jan 18 15:07 wadread.h
-rw-r--r-- 1 b1 prog 3583 Jan 18 15:07 wi_data.h
-rw-r--r-- 1 b1 prog 25608 Jan 18 15:07 wi_stuff.c
-rw-r--r-- 1 b1 prog 1544 Jan 18 15:07 wi_stuff.h
-rw-r--r-- 1 b1 prog 8501 Jan 18 15:07 z_zone.c

View File

@ -1,221 +0,0 @@
ChangeLog
FILES
FILES2
Makefile
-----------------------------------------------------------------------
Global and misc. stuff
-----------------------------------------------------------------------
doomdata.h - external data definitions (WAD file structure)
doomdef.h - internal data definitions (game structs)
dstrings.h - printed strings for translation, english
d_french.h - printed strings for translation
info.h
info.c - LUT's for Thing TAB, Frame TAB,
generated by multigen utility
dutils.h
dutils.c - Dave's utilities
including doubly-linked lists & simple state machines.
Used in WI, ST, AM, and d_main.c
------------------------------------------------------------------------
DOOM game loop and top level stuff
------------------------------------------------------------------------
g_game.c - Game loop functions, event handling etc.
boolean G_CheckDemoStatus (void);
void G_ReadDemoTiccmd (ticcmd_t *cmd);
void G_WriteDemoTiccmd (ticcmd_t *cmd);
void G_PlayerReborn (int player);
void G_InitNew (skill_t skill, int episode, int map);
void G_DoReborn (int playernum);
void G_DoLoadLevel (void);
void G_DoNewGame (void);
void G_DoLoadGame (void);
void G_DoPlayDemo (void);
void G_DoCompleted (void);
void G_DoVictory (void);
void G_DoWorldDone (void);
void G_DoSaveGame (void);
d_main.c - event handling, D_DoomMain() and other functions
NOT int main()
d_net.c - high level networking protocol code
------------------------------------------------------------------
I Interfaces, system specifics
------------------------------------------------------------------
i_main.c - main(), calls D_DoomMain().
i_svgalib.c - Linux SVGAlib code, including main(),
replaces i_main.c
i_x.c - X11 with SHM code, use with i_main.c
i_dga.c - X11 DGA code, use with i_main.c
i_unix.c - fixed point, networking, and display stuff for UNIX
i_ibm.c - IBM DOS VGA graphics and key/mouse/joystick,
use with i_main.c
i_pcnet.c - IPX networking, DOS
fpfunc.S - fixed point assembly and (currently) duplicate of
tmap.S - texture mapping assembly (currently unused)
------------------------------------------------------------------
AM AutoMap
------------------------------------------------------------------
am_data.h - vector graphics for the automap
am_map.h
am_map.c - automap code
------------------------------------------------------------------
HU Heads Up
------------------------------------------------------------------
hu_lib.h
hu_lib.c - heads-up text and input code
hu_stuff.h
hu_stuff.c - Heads-up displays
-------------------------------------------------------------------
M Menu
-------------------------------------------------------------------
m_menu.c - DOOM options code and leaving messages
m_misc.c - misc. HUD text display, input checks, and
random table, file I/O
-------------------------------------------------------------------
P Play???
-------------------------------------------------------------------
p_local.h - header for all play modules
p_spec.h - specials, lighting, doors, plats, texture animation
p_spec.c - specials, texture animation
p_doors.c - door code
p_plats.c - platform raising/lowering code
p_ceilng.c - active (e.g. crushing) ceilings
p_floor.c - active (e.g. raising) floors
p_lights.c - dynamic (e.g. flickering) lighting
p_switch.c - button switches and animation
p_enemy.c - enemy AI and animation
p_inter.c - object/object interaction?
p_map.c - movement objects, handling of collisions
p_maputl.c - distance, position etc. utilities for movement
p_mobj.c - mobile objects handling, spawn etc.
p_user.c - more movement, bobbing etc.
p_telept.c - teleportation code
p_sight.c - LOS checks, REJECT
p_pspr.c - weapon overlays, bobbing, raising, sprite tables,
firing, ammo bookkeeping
p_setup.c - load map from WAF file, setup code
p_tick.c - savegame function (archive/unarchive),
thinker list handling, allocation,
game tick execution (updates)
-------------------------------------------------------------------
R Rendering
-------------------------------------------------------------------
r_local.h - header for all rendering modules,
internal map data structure definitions
r_bsp.c - BSP seg's clipping
r_data.c - texture column caching, patch assembly,
flats, colormaps, sprites,
lookup by name
r_draw.c - access to framebuffer API, drawing C functions
r_main.c - geometry functions, trigonometry lookups,
R_RenderPlayerView
r_plane.c - floor/ceiling visplanes, sky
r_segs.c - drawing segs, marking hslices for floors/ceilings
r_things.c - sprite and sprite frame/rotation handling, drawing
tables.c - trigonometry lookup tables, static
v_video.c - gamma correction lookup, patch drawing to rectangle
-------------------------------------------------------------------
S Sound
-------------------------------------------------------------------
s_sound.c - more sound and music handling
soundst.h - sound and music data structures
sounds.h
sounds.c - sound and music lump LUT's (manually maintained)
sndserver.h
sndserver.c - (Irix) sndserver code
irix.h
irix.c - SGI Irix sound/sndserver support code
linux.c - Linux voxware sound/sndserver support code,
replaces irix.c, uses irix.h
sun.c - SUN replacement for irix.c
i_sound.h
i_sound.c - DOS DMX music and sound interface
-------------------------------------------------------------------
ST STatus bar
-------------------------------------------------------------------
st_lib.h
st_lib.c - status bar widget code
st_stuff.c
st_stuff.h - status bar code
-------------------------------------------------------------------
W Wad file I/O
-------------------------------------------------------------------
w_wad.c - lump based functions
wadread.h
wadread.c - lump I/O, get SFX
-------------------------------------------------------------------
WI WIn / level end screens
-------------------------------------------------------------------
wi_data.h - lookups for intermission screens, patch positions
wi_stuff.h
wi_stuff.c - intermission animation patchwork
-------------------------------------------------------------------
Z Zone memory allocation
-------------------------------------------------------------------
z_zone.c
-------------------------------------------------------------------
F Final screen animation
-------------------------------------------------------------------
f_finale.c - DOOM mission end screens? (bunny)
-------------------------------------------------------------------

View File

@ -15,7 +15,7 @@ endif
ifeq ($(ARM),1)
CROSS_COMPILE = arm-frosted-eabi-
OBJS+=$(O)/i_video_fbdev.o
OBJS+=$(OBJDIR)/i_video_fbdev.o
CFLAGS+=-mthumb -mlittle-endian -mthumb-interwork -ffunction-sections -fdata-sections -mcpu=cortex-m3
CFLAGS+=-DCORE_M3 -D__frosted__
# COMPILER FLAGS -- No gcc libraries
@ -26,109 +26,51 @@ ifeq ($(ARM),1)
LDFLAGS+=-fPIC -mlong-calls -fno-common -Wl,-elf2flt -lgloss
else
CFLAGS+=-m32 -fsanitize=address -Wunused-const-variable=0
LIBS+=-lXext -lX11 -lnsl -lm -lSDL2
OBJS+=$(O)/i_video_SDL.o
LIBS+=-lXext -lX11 -lnsl -lm -lSDL
OBJS+=$(OBJDIR)/i_video.o
endif
CC= $(CROSS_COMPILE)gcc # gcc or g++
# Debugging
CFLAGS+=-ggdb3
CFLAGS+=-ggdb3 -Os
LDFLAGS+=-Wl,--gc-sections
CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV # -DUSEASM
CFLAGS+=-Icompat
LIBS+=-lm -lc
#LDFLAGS=-L/usr/X11R6/lib
#LIBS=-lXext -lX11 -lnsl -lm
# subdirectory for objects
O=frosted
OBJDIR=build
OUTPUT=fdoom
# not too sophisticated dependency
OBJS+= \
$(O)/stubs.o \
$(O)/doomdef.o \
$(O)/doomstat.o \
$(O)/dstrings.o \
$(O)/i_system.o \
$(O)/i_sound_dummy.o \
$(O)/i_net.o \
$(O)/tables.o \
$(O)/f_finale.o \
$(O)/f_wipe.o \
$(O)/d_main.o \
$(O)/d_net.o \
$(O)/d_items.o \
$(O)/g_game.o \
$(O)/m_menu.o \
$(O)/m_misc.o \
$(O)/m_argv.o \
$(O)/m_bbox.o \
$(O)/m_fixed.o \
$(O)/m_swap.o \
$(O)/m_cheat.o \
$(O)/m_random.o \
$(O)/am_map.o \
$(O)/p_ceilng.o \
$(O)/p_doors.o \
$(O)/p_enemy.o \
$(O)/p_floor.o \
$(O)/p_inter.o \
$(O)/p_lights.o \
$(O)/p_map.o \
$(O)/p_maputl.o \
$(O)/p_plats.o \
$(O)/p_pspr.o \
$(O)/p_setup.o \
$(O)/p_sight.o \
$(O)/p_spec.o \
$(O)/p_switch.o \
$(O)/p_mobj.o \
$(O)/p_telept.o \
$(O)/p_tick.o \
$(O)/p_saveg.o \
$(O)/p_user.o \
$(O)/r_bsp.o \
$(O)/r_data.o \
$(O)/r_draw.o \
$(O)/r_main.o \
$(O)/r_plane.o \
$(O)/r_segs.o \
$(O)/r_sky.o \
$(O)/r_things.o \
$(O)/w_wad.o \
$(O)/wi_stuff.o \
$(O)/v_video.o \
$(O)/st_lib.o \
$(O)/st_stuff.o \
$(O)/hu_stuff.o \
$(O)/hu_lib.o \
$(O)/s_sound.o \
$(O)/z_zone.o \
$(O)/info.o \
$(O)/sounds.o
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_file_stdc_unbuffered.o w_main.o w_wad.o z_zone.o
OBJS += $(addprefix $(OBJDIR)/, $(SRC_DOOM))
all: $(O)/fdoom
all: $(OUTPUT)
clean:
rm -f *.o *~ *.flc
rm -f frosted/*.o
rm -f frosted/fdoom
rm -rf $(OBJDIR)
rm -f $(OUTPUT)
rm -f $(OUTPUT).gdb
rm -f $(OUTPUT).map
$(O)/fdoom: $(OBJS) $(O)/i_main.o
$(OUTPUT): $(OBJS)
@echo [Linking $@]
$(VB)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \
-o $(O)/fdoom $(LIBS) -Wl,-Map,fdoom.map
$(VB)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) \
-o $(OUTPUT) $(LIBS) -Wl,-Map,$(OUTPUT).map
@echo [Size]
-$(CROSS_COMPILE)size $(OUTPUT)
-$(CROSS_COMPILE)flthdr $(OUTPUT)
$(O):
mkdir -p $(O)
$(OBJS): | $(OBJDIR)
$(O)/%.o: %.c $(O)
$(OBJDIR):
mkdir -p $(OBJDIR)
$(OBJDIR)/%.o: %.c
@echo [Compiling $<]
$(VB)$(CC) $(CFLAGS) -c $< -o $@
print:
@echo OBJS: $(OBJS)
#############################################################
#
#############################################################

View File

@ -1,283 +0,0 @@
README - DOOM assembly code
Okay, I add the DOS assembly module for the historically
inclined here (may rec.games.programmer suffer). If anyone
feels the urge to port these to GNU GCC; either inline or
as separate modules including Makefile support, be my guest.
Module tmap.S includes the inner loops for texture mapping,
the interesting one being the floor/ceiling span rendering.
There was another module in the source dump, fpfunc.S, that
had both texture mapping and fixed point functions. It
contained implementations both for i386 and M68k. For
brevity, I include only the i386 fixed point stuff below.
//====================================================
// tmap.S as of January 10th, 1997
//================
//
// R_DrawColumn
//
//================
.data
loopcount .long 0
pixelcount .long 0
.text
.align 16
.globl _R_DrawColumn
_R_DrawColumn:
pushad
movl ebp,[_dc_yl]
movl ebx,ebp
movl edi,[_ylookup+ebx*4]
movl ebx,[_dc_x]
addl edi,[_columnofs + ebx*4]
movl eax,[_dc_yh]
incl eax
subl eax,ebp // pixel count
movl [pixelcount],eax // save for final pixel
js done // nothing to scale
shrl eax,1 // double pixel count
movl [loopcount],eax
movl ecx,[_dc_iscale]
movl eax,[_centery]
subl eax,ebp
imull ecx
movl ebp,[_dc_texturemid]
subl ebp,eax
shll ebp,9 // 7 significant bits, 25 frac
movl esi,[_dc_source]
movl ebx,[_dc_iscale]
shll ebx,9
movl eax,OFFSET patch1+2 // convice tasm to modify code...
movl [eax],ebx
movl eax,OFFSET patch2+2 // convice tasm to modify code...
movl [eax],ebx
// eax aligned colormap
// ebx aligned colormap
// ecx,edx scratch
// esi virtual source
// edi moving destination pointer
// ebp frac
movl ecx,ebp // begin calculating first pixel
addl ebp,ebx // advance frac pointer
shrl ecx,25 // finish calculation for first pixel
movl edx,ebp // begin calculating second pixel
addl ebp,ebx // advance frac pointer
shrl edx,25 // finish calculation for second pixel
movl eax,[_dc_colormap]
movl ebx,eax
movb al,[esi+ecx] // get first pixel
movb bl,[esi+edx] // get second pixel
movb al,[eax] // color translate first pixel
movb bl,[ebx] // color translate second pixel
testl [pixelcount],0fffffffeh
jnz doubleloop // at least two pixels to map
jmp checklast
.align 16
doubleloop:
movl ecx,ebp // begin calculating third pixel
patch1:
addl ebp,12345678h // advance frac pointer
movb [edi],al // write first pixel
shrl ecx,25 // finish calculation for third pixel
movl edx,ebp // begin calculating fourth pixel
patch2:
addl ebp,12345678h // advance frac pointer
movl [edi+SCREENWIDTH],bl // write second pixel
shrl edx,25 // finish calculation for fourth pixel
movb al,[esi+ecx] // get third pixel
addl edi,SCREENWIDTH*2 // advance to third pixel destination
movb bl,[esi+edx] // get fourth pixel
decl [loopcount] // done with loop?
movb al,[eax] // color translate third pixel
movb bl,[ebx] // color translate fourth pixel
jnz doubleloop
// check for final pixel
checklast:
testl [pixelcount],1
jz done
movb [edi],al // write final pixel
done:
popad
ret
//================
//
// R_DrawSpan
//
// Horizontal texture mapping
//
//================
.align 16
.globl _R_DrawSpan
_R_DrawSpan:
pushad
//
// find loop count
//
movl eax,[_ds_x2]
incl eax
subl eax,[_ds_x1] // pixel count
movl [pixelcount],eax // save for final pixel
js hdone // nothing to scale
shrl eax,1 // double pixel count
movl [loopcount],eax
//
// build composite position
//
movl ebp,[_ds_xfrac]
shll ebp,10
andl ebp,0ffff0000h
movl eax,[_ds_yfrac]
shrl eax,6
andl eax,0ffffh
orl ebp,eax
movl esi,[_ds_source]
//
// calculate screen dest
//
movl edi,[_ds_y]
movl edi,[_ylookup+edi*4]
movl eax,[_ds_x1]
addl edi,[_columnofs+eax*4]
//
// build composite step
//
movl ebx,[_ds_xstep]
shll ebx,10
andl ebx,0ffff0000h
movl eax,[_ds_ystep]
shrl eax,6
andl eax,0ffffh
orl ebx,eax
movl eax,OFFSET hpatch1+2 // convice tasm to modify code...
movl [eax],ebx
movl eax,OFFSET hpatch2+2 // convice tasm to modify code...
movl [eax],ebx
// eax aligned colormap
// ebx aligned colormap
// ecx,edx scratch
// esi virtual source
// edi moving destination pointer
// ebp frac
shldl ecx,ebp,22 // begin calculating third pixel (y units)
shldl ecx,ebp,6 // begin calculating third pixel (x units)
addl ebp,ebx // advance frac pointer
andl ecx,4095 // finish calculation for third pixel
shldl edx,ebp,22 // begin calculating fourth pixel (y units)
shldl edx,ebp,6 // begin calculating fourth pixel (x units)
addl ebp,ebx // advance frac pointer
andl edx,4095 // finish calculation for fourth pixel
movl eax,[_ds_colormap]
movl ebx,eax
movb al,[esi+ecx] // get first pixel
movb bl,[esi+edx] // get second pixel
movb al,[eax] // color translate first pixel
movb bl,[ebx] // color translate second pixel
testl [pixelcount],0fffffffeh
jnz hdoubleloop // at least two pixels to map
jmp hchecklast
.align 16
hdoubleloop:
shldl ecx,ebp,22 // begin calculating third pixel (y units)
shldl ecx,ebp,6 // begin calculating third pixel (x units)
hpatch1:
addl ebp,12345678h // advance frac pointer
movb [edi],al // write first pixel
andl ecx,4095 // finish calculation for third pixel
shldl edx,ebp,22 // begin calculating fourth pixel (y units)
shldl edx,ebp,6 // begin calculating fourth pixel (x units)
hpatch2:
addl ebp,12345678h // advance frac pointer
movb [edi+1],bl // write second pixel
andl edx,4095 // finish calculation for fourth pixel
movb al,[esi+ecx] // get third pixel
addl edi,2 // advance to third pixel destination
movb bl,[esi+edx] // get fourth pixel
decl [loopcount] // done with loop?
movb al,[eax] // color translate third pixel
movb bl,[ebx] // color translate fourth pixel
jnz hdoubleloop
// check for final pixel
hchecklast:
testl [pixelcount],1
jz hdone
movb [edi],al // write final pixel
hdone:
popad
ret
//====================================================
// fpfunc.S as of January 10th, 1997 (parts)
#ifdef i386
.text
.align 4
.globl _FixedMul
_FixedMul:
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%eax
imull 12(%ebp)
shrdl $16,%edx,%eax
popl %ebp
ret
.align 4
.globl _FixedDiv2
_FixedDiv2:
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%eax
cdq
shldl $16,%eax,%edx
sall $16,%eax
idivl 12(%ebp)
popl %ebp
ret
#endif

View File

@ -1,140 +0,0 @@
README for Linux DOOM Source distribution
=========================================
DISCLAIMER
----------
This is not "The DOOM Source Code" dump for a bunch
of reasons. It is based on a DOOM development directory
snapshot as of January 10th, but has been stripped and
changed. Thus it is the DOOM source, but there are many
minor differences to the source as last used by id
Software.
Note that thus neither John Carmack nor Dave Taylor nor
anybody else at id is responsible for the contents of
this archive, or the changes introduced to the original
source.
If there are any questions, contact me at bk@gamers.org,
or preferably post to the mailing list at
doom-editing@gamers.org
(send mail to majordomo@gamers.org, content just
a single "info doom-editing"). I will post any updates
or notifcation of corrections there. I will probably
put some stuff at
http://www.gamers.org/dEngine/doom/
as well. Look there for the "Unofficial DOOM Specs" as
minimal recommended documentation.
REMARKS
-------
I made a few minor bug fixes, added some experimental sound
code, and, and changed the handling of IWAD dependend game
modes. Most of the changes though have been shuffling
around sources in a sometimes futile attempt to separate
modules more cleanly, and make certain parts easier
to locate and modify. There is still much left to do, but
I hope that the current source is a good base to start
with, especially with a cooperative effort in mind. Those
so inclined will find the source prepared for CVS.
There is a list of changes and fixes I did not get around
to in TODO, and an incomplete worklog in ChangeLog, that
also includes some minor ToDo statements scattered throughout
the log.
a) Linux SVGA
There is no SVGA support. For development and debug
purposes, the X11 version seems to be more handy.
b) Sound - see README.sound,
and the sndserver.tgz archive.
c) GLDOOM - see README.gl
d) Win32
There was no Win32 support in the original dump.
e) DOS
Original DOS support (including the texture
mapping and fixed point assembler) has been
removed, mainly because of the lack of sound
support.
f) DoomEd
The NeXTStep DoomEd sources in the dump were
garbled (filenames - prolly an issue of ISO9660
with or w/o extensions). Somehow Bear never got
around to send me a list of the correct filenames,
and I won't bother guessing without a NeXT box
at hand.
There is a plethora of useful editors
for DOOM. I suggest using DEU for X11.
g) BSP Tools
The BSP builder and other tools have
been released by John Carmack long ago,
and since improved/replaced by others.
Again, I recommend taking a pick among
the tools available for Linux.
h) DOOM game tools
There are a number of tools that have
not been released, namely those which
compiled the Things and State Tables,
the frame animation LUT's, sound tables
etc. Basically, they compile similarly
complex LUT's to generate C files. The
tools are omitted from this distribution.
There are some files in the
distribution (info.h/c, sounds.h/c)
that are essentially the output of these
tools. This is the data that defines
DOOM (as a game) for all practical
purposes.
I recommend keeping them, as they are
part of the source. In the long run,
handling them as well as the action/
animation functions as a separate game.so
library (as with Quake2) seems to be a
good idea.
i) Artwork
Neither the original artwork nor the
misc. WAD files are included in this
archive. You will at least need the
shareware WAD file to run the executable,
but it shouldn't be to difficult to get
a hold of that.
Note that the mechanism to detect the
presence of a registered or commercial
version is still in the source, and
homebrew maps are still disabled. This
is easily removed now, but as FinalDOOM,
Ultimate DOOM and DOOM 2 are still in
the shops, it is probably polite not
to distribute a source or binary without
that mechanism.
This version of Linuxdoom supports Plutonia
and TNT WAD from FinalDOOM as well. No
guarantees, though.
Enjoy!
b. 97/12/22

View File

@ -1,57 +0,0 @@
The DOOM Book
Shortly after the Wolfenstein 3D source release,
I sent a mail to Jay Wilbur suggesting a book
about the DOOM engine. I anticipated a similar
release of the DOOM sources within a year or
two, and the obvious problems with the Wolfenstein
sources (lack of accompanying artwork, a code
base not maintained for quite some time) seemed
to demand a better approach. I talked to some
publishing company reps at the Book Fair in 1995,
and while they were cautiously interested, id was
not.
In the last weeks of 1996, following a visit at
id Software two months earlier, and after the
departure of Jay Wilbur, John Carmack asked me
whether I was still interested in doing the book.
I was, Bear sent me a code dump, and Todd
Hollenshead set out to address the legal concerns
(of which were many).
Unfortunately, what might have worked in 1995
turned out to be a doomed attempt in 1997. I won't
go into the details - let's just say that my
leaving university and going back to full time
writing for a living repeatedly forced me to
change priorities on what looked more and more
like a project unlikely to generate any revenue.
By mid of the year, when the legal issues had
finally been settled, it didn't look like I was
going to find a publisher at all. Following the
Book Fair in 1997 and some more discussions
(with about a dozen publishers, total), I gritted
my teeth and decided to abandon the project.
Note that the book project as such wasn't supposed
to hold up the source release to the public.
However, given the legal concerns relating to
the third party sound code in DOS DOOM, and the
lack of Win32 support as well as the advantages of
an OpenGL based release, the idea was to put
together a consistent, stable code base prior to
public release - most of which was supposed to be
an offspring of my reformatting and modifying the
code for the book.
None of this worked out as intended. However, I
hope that, at long last, this distribution
will finally provide a good point to start for
any cooperative effort to extend the already
impressive lifespan of DOOM into the age of
multiplayer servers and hardware-accelerated
clients.

View File

@ -1,149 +0,0 @@
README: glDOOM
I never got around to do anything with respect to
a Linux glDOOM port except for assembling a Linux3Dfx
HOWTO (which, at that time, was a prerequisite
to get permission to publicly distribute the
already finished LinuxGlide port by Daryll Strauss).
Linux q2test (and soon LinuxQuake2) demonstrate that
Mesa with the MesaVoodoo driver is quite up to the
requirements for a glDOOM port. If anybody wants to
get into Linux glDOOM, please drop me a line.
There is a Win32 GLDOOM port in the works, by Jim Dose.
Quoting a recent posting by him:
"I haven't had as much time lately to really work on
the conversion. I currently have the renderer drawing
the walls and floors as texture spans as the are in
the software renderer. There's lighting on the walls,
but not the floors, and sprites are being drawn, but
not with the right texture. I figure that this is one
nights work to get the game looking "normal". I haven't
tested the game on less than a p200, so I'm not sure
how it will perform under the average machine, but I
don't expect it to be blindingly fast because of the
number of spans that have to be drawn each frame.
Rendering as polys is definitely the way to go.
The reason I chose to do spans first was because it
left the base renderer intact and I could concentrate
on ironing out any Windows compatibility problems.
Actually, the first version I had running was simply
a blit of the 320x200 game screen through Open GL.
Surprisingly, this actually was very playable, but
certainly wasn't taking any advantage of 3D acceleration.
Once the game was running, I started converting all
the span routines over."
Comment: for merging Linuxdoom with Win32, this is
probably the best source for getting the Win32
environment done - before more significant changes
occur.
"One problem with drawing spans is that the engine
doesn't calculate the texture coordinates with
fractional accuracy, so the bilinear filtering works
vertically, but not horizontally on the walls. I may
try to fix this, but since I plan to use polys for
the final version, it's not really high priority.
Also, spans don't really allow for looking up and
down."
Comment: true looking up/down vs. Heretic-style
y-shearing seems to require either a strange kind
of transofrmation matrix (he probably does not use
the OpenGL transformation at all), or rendering
all the spans as textured rectangular slices
instead of using glDrawBitmap. No, polys are the
way to go.
"When I tackle the conversion to polys, one big problem
I'll encounter is drawing floors. Since the world is
stored in a 2D bsp tree, there is no information on
the shape of the floors. In fact the floors can be
concave and may include holes (typically, most renderers
break concave polys down into a collection of convex
polys or triangles). In software, the floors are actually
drawn using an algorithm that's similar to a flood fill
(except that a list of open spans is kept instead of a
buffer of pixels). This makes drawing the floors as
polys fairly difficult."
A polygon based approach will require significant changes
to the data structures used in the refresh module. I
recommend either separating a libref_soft.so first (a
Quake2 like approach), and creating libref_gl afterwards,
or abandoning the software rendering entirely.
John Carmack wrote once upon a time:
"... the U64 DOOM engine is much more what I would consider
The Right Thing now -- it turns the subsector boundaries
into polygons for the floors and ceilings ahead of time,
then for rendering it walks the BSP front to back, doing
visibility determination of subsectors by the one dimensional
occlusion buffer and clipping sprites into subsectors, then
it goes backwards through the visible subsectors, drawing
floors, ceilings, walls, then sorted internal sprite fragments.
It's a ton simpler and a ton faster, although it does suffer
some overdraw when a high subsector overlooks a low one (but
that is more than made up for by the simplicity of everything
else)."
Well, IMO compiling a separate list of floor/ceiling polygons
after having read the WAD file, and thus introducing this as
a completely separate data structure to the current code base
might be the easiest thing to do. Jim Dose writes:
"One method I may use to draw the floors as polys was suggested
by Billy Zelsnack of Rebel Boat Rocker when we were working
at 3D Realms together a few years ago. Basically, Billy was
designing an engine that dealt with the world in a 2D portal
format similar to the one that Build used, except that it had
true looking up and down (no shearing). Since floors were
basically implicit and could be concave, Billy drew them as
if the walls extended downwards to infinity, but fixed the
texture coordinates to appear that they were on the plane of
the floor. The effect was that you could look up and down and
there were no gaps or overdraw. It's a fairly clever method
and allows you to store the world in a simpler data format.
Had perspective texture mapping been fast enough back then,
both Build and Doom could have done this in software."
Perhaps the above is sufficient to get you started.
Other Issues:
1. Occlusion
DOOM uses a per-column lookup (top/bottom index) to do HLHSR.
This works fine with span based rendering (well, getting
horizontal spans of floors/ceilings into the picture is a
separate story). It isn't really mindboggling with polygon
based rendering. GLDOOM should abandon that.
2. Precalculated Visibility
DOOM has the data used by Quake's PVS - in REJECT.
During Quake development, lots of replacements for the
occlusion buffer were tried, and PVS turned out to be best.
I suggest usind the REJECT as PVS.
There have been special effects using a utility named RMB.
REJECT is a lump meant for enemy AI LoS calculation - a
nonstandard REJECT will not work as a PVS, and introduce
rendering errors. I suggest looking for a PVS lump in the
WAD, and using REJECT if none is found. That way, it might
be feasible to eat the cake and keep it.
3. Mipmaps
DOOM does not have mipmapping. As we have 8bit palettized
textures, OpenGL mipmapping might not give the desired
results. Plus, composing textures from patches at runtime
would require runtime mipmapping. Precalculated mipmaps
in the WAD?
4. Sprites
Partly transparent textures and sprites impose another
problem related to mipmapping. Without alpha channel,
this could give strange results. Precalculated, valid
sprite mipmaps (w/o alpha)?

View File

@ -1,110 +0,0 @@
README: sound in DOOM
1) DOS/Win32 sound
id licensed a third party sound library called
DMX for DOS DOOM. The situation exhibited
many symptons of serious NIH "Not Invented Here"),
and one of the consequences is that the original
DOOM sound code does not work without DMX. As
DMX is not publicly available, the original DOOM
sound support is removed.
Win32 was not supported in the source dump I got.
I have no knowledge how the WinDOOM port did the
sound handling. A Win32 port should probaly rely on
DirectSound. So far, the Win32 glDOOM port Jim Dose
is working on has no sound support.
In consequence, the only target with a working sound
code is UNIX, which I could only verify with Linux
on Intel586.
2) Linux sound
DOOM for Linux used a separate process, sndserver.
Quoting Dave Taylor:
"Sound drivers should be an asychronous model, either
a seperate thread or a seperate process. This is
because sound should always be fed to the card without
interruption or else you get pops and with low latency
or else you get angry players.
Now it turns out that this kind of code isn't too fun
to write. In the days of Linux Doom, threads were not a
happnin thing in Linux. In fact, they still largely
aren't. You can use them these days if you have gnu's
libc installed, but you still can't debug them because
gdb doesn't support them properly yet. I believe the
original seperate process had a bad latency delay
because of the time it took for commands to be flushed
through the pipe used to communicate with the seperate
process. I should have looked into this more thoroughly.
In Quake, I discovered that I could feed multiple
acknowledgements to a SoundBlaster or compatible without
any side-effects such as pops or other malfunctions.
This discovery led me to switch to a completely synchronous
model, much much easier to debug and understand, so I
think this was fairly intelligent. Although we had to
populate the game with calls in the right places to keep
the sound buffers fed, and although it wasn't gauranteed to
be always fed, well over 99% of the time, it was fed, and
your the latency was never worse than the frequency of your
refills (several times per frame) plus a small lead time
(40th of a second?)."
The separate sndserver code base introduced some redundancy
(WAD access for sound lumps) for each UNIX target (Sun, SGI,
Linux) and more differences between DOS and UNIX version.
However, I kept the IPC based parts in the source, and
separated the sndserver target in another directory to avoid
further redundancy. There seem to be a few bug-like things
going on in the sndserver that do not receive penalty as
the program has to do only a simple task. One example would
be a libc realloc mixed with zone memory allocation.
Ungraceful and untimely demise of Linuxdoom (core instead
of I_Error) will leave idle sndserver processes in your
system, blocking /dev/bsp. Kill them manually.
I put the non-redundant parts of the sndserver program
into the i_sound module of doom, and with the SND_SERV
compiler switch you can choose to use the internal sound
support. However, there is a problem with e.g. the
double shotgun and the plasma gun - walk up to a wall,
face it straight, and fire. The sound output is crappy.
This vanishes with decreasing screen size. A similar
problem occurs with trimer driven asynchronous output
enabled by SNDINTR.
I agree with Dave that threads would be preferable.
With respect to Linux ports of John Carmack's next
Trinity engine, this one will rely on Win32
multithreading e.g. for input sampling. So the Linux
community will have to sort out threads anyway :-).
To improve the current sound server, other means of
IPC should take care of the latency. The mixing
buffer/command buffer as shared memory comes to mind.
3) Music support
There is, and was, no music support in Linuxdoom. Fine with
me - I wouldn't give a bat's tail feathers for DOOM music.
Your mileage may vary. There are a few leftovers of the DOS
music support also interfacing DMX, so there is a place
to start. However, in the age of CDROM based music, I
recommend getting e.g. Workman to cooperate with DOOM
(currently, DOOM accessing the soundcard SpekerOut
interferes with Workman controlling the CD drives
SpeakerOut), so musci could be chosen and run completely
independend of the game. You could try Linuxdoom with
Q2 music that way.

View File

@ -1,123 +0,0 @@
- create Web repository for sources, patches,
news, and pointer to doom-editing mailing
list.
- get DOOM Public License from id
-----------------------------------------------
- remove m_fixed, switch to floating point
More stable, and prolly even faster.
- make SCREENWIDTH/HEIGHT work at startup?
Well, the HUD/STBar stuff is tied to the
scales implied by the graphics. Rather do
GLDOOM and use texture mapping.
- fix aspect ratio?
320x200 is nothing viable nowadays.
A 320x240 base (4:3) would be a lot better.
See above on width/height.
- limited look up/down by y-shearing?
Prolly not worth it, rather switch to GLDOOM.
- switch to C++?
The action function pointers have varying
argument lists (no parameter, one, etc.).
C++ doesn't like that much. A major rewrite.
- switch to doommain.c plus libdoom? Have
libref, libgame etc.?
Another major rewrite.
- use XFree86 DGA, prolly not that much faster
than MIT SHM, but allows for directly sampled
mouse (and even freelook). Recommended for
GLDOOM.
- put together an accompanying developer toolkit
source distribution: DEU, RMB, BSP for Linux/X.
- move info.h, info.c, sounds.h, sounds.c and
other data to a separate lump in the WAD,
or into a libgame.so, to separate the
generic stuff (refresh, I/O) from the
DOOM specifics.
- decide whether precaching all sounds is
better than retrieving and releasing
every so often. DOOM seems to do that
frequently (8bit stuff, originally for
DOS), and the Linux sound is 16bit
(conversion in the mixing, requires
some padding) - we prolly got the memory
to spare.
- 16bpp CLUT. The lightmaps and the
framebuffer could be changed to switch
to 64K colors. Prolly better to do
GLDOOM right away.
- remove checks for commercial etc., in
non-essential issues (enabling PWAD's).
- change (simplify) determination of
sky texture (done by game version).
Explicit?
- remove all game version checks
- different handling of Demo - don't
exit on "different game version"
- how about shareware/retail "You are here"
intermission animation? Wasn't in
commercial (DOOM 2).
- double shotgun in DOOM1, all weapons with
shareware
- checks for required lumps. We need fallbacks
for lumps that are not present, that is,
default sounds etc. to be used instead,
or removing THINGS w/o sprites etc.
- client/server? I'd suggest ripping off some stuff
from the abandoned IBM WebView project
- Blockmap
The BLOCKMAP lump might be (partly) redundant,
as the BSP allows for clipping (except certain
LineDefs that will not spawn Segs).
- LOS
REJECT and intersection based LOS checking could be
done using the BSP. In case of REJECT, certain
monster AI special effects would be lost, though.
- correct handling of height in collision. This is
not done, and the checks are scattered around in
many places. It does require handling of "player
on top of monster" situations, too - we have to
make sure the players falls off far enough to
avoid getting "stuck in monster".
- remove obsolete menus (Detail. Music Volume?)
- clip explosion range damage (and sprites) using
REJECT? That is, if one Sector/SSector not
visible from the other, do not apply damage,
not render sprite if player in other sector.
Hmmm - explosion behind small pillar might not be
visible at all, but do we care?
- Ungraceful and untimely demise of Linuxdoom (core
instead of I_Error) will leave idle sndserver
processes in your system, blocking /dev/bsp.
A timeout on lack of input for "sndserver"?
- threaded sndserver? SHM mixing buffer?
Or internal, timer-based?

View File

@ -1,38 +1,36 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// $Log:$
//
// DESCRIPTION: the automap code
//
//-----------------------------------------------------------------------------
static const char rcsid[] = "$Id: am_map.c,v 1.4 1997/02/03 21:24:33 b1 Exp $";
#include <stdio.h>
#include "deh_main.h"
#include "z_zone.h"
#include "doomkeys.h"
#include "doomdef.h"
#include "st_stuff.h"
#include "p_local.h"
#include "w_wad.h"
#include "m_cheat.h"
#include "m_controls.h"
#include "m_misc.h"
#include "i_system.h"
// Needs access to LFB.
@ -85,21 +83,6 @@ static const char rcsid[] = "$Id: am_map.c,v 1.4 1997/02/03 21:24:33 b1 Exp $";
#define XHAIRCOLORS GRAYS
// drawing stuff
#define FB 0
#define AM_PANDOWNKEY KEY_DOWNARROW
#define AM_PANUPKEY KEY_UPARROW
#define AM_PANRIGHTKEY KEY_RIGHTARROW
#define AM_PANLEFTKEY KEY_LEFTARROW
#define AM_ZOOMINKEY '='
#define AM_ZOOMOUTKEY '-'
#define AM_STARTKEY KEY_TAB
#define AM_ENDKEY KEY_TAB
#define AM_GOBIGKEY '0'
#define AM_FOLLOWKEY 'f'
#define AM_GRIDKEY 'g'
#define AM_MARKKEY 'm'
#define AM_CLEARMARKKEY 'c'
#define AM_NUMMARKPOINTS 10
@ -168,7 +151,6 @@ mline_t player_arrow[] = {
{ { -R+3*R/8, 0 }, { -R+R/8, -R/4 } }
};
#undef R
#define NUMPLYRLINES (sizeof(player_arrow)/sizeof(mline_t))
#define R ((8*PLAYERRADIUS)/7)
mline_t cheat_player_arrow[] = {
@ -190,25 +172,22 @@ mline_t cheat_player_arrow[] = {
{ { R/6+R/32, -R/7-R/32 }, { R/6+R/10, -R/7 } }
};
#undef R
#define NUMCHEATPLYRLINES (sizeof(cheat_player_arrow)/sizeof(mline_t))
#define R (FRACUNIT)
mline_t triangle_guy[] = {
{ { -.867*R, -.5*R }, { .867*R, -.5*R } },
{ { .867*R, -.5*R } , { 0, R } },
{ { 0, R }, { -.867*R, -.5*R } }
{ { (fixed_t)(-.867*R), (fixed_t)(-.5*R) }, { (fixed_t)(.867*R ), (fixed_t)(-.5*R) } },
{ { (fixed_t)(.867*R ), (fixed_t)(-.5*R) }, { (fixed_t)(0 ), (fixed_t)(R ) } },
{ { (fixed_t)(0 ), (fixed_t)(R ) }, { (fixed_t)(-.867*R), (fixed_t)(-.5*R) } }
};
#undef R
#define NUMTRIANGLEGUYLINES (sizeof(triangle_guy)/sizeof(mline_t))
#define R (FRACUNIT)
mline_t thintriangle_guy[] = {
{ { -.5*R, -.7*R }, { R, 0 } },
{ { R, 0 }, { -.5*R, .7*R } },
{ { -.5*R, .7*R }, { -.5*R, -.7*R } }
{ { (fixed_t)(-.5*R), (fixed_t)(-.7*R) }, { (fixed_t)(R ), (fixed_t)(0 ) } },
{ { (fixed_t)(R ), (fixed_t)(0 ) }, { (fixed_t)(-.5*R), (fixed_t)(.7*R ) } },
{ { (fixed_t)(-.5*R), (fixed_t)(.7*R ) }, { (fixed_t)(-.5*R), (fixed_t)(-.7*R) } }
};
#undef R
#define NUMTHINTRIANGLEGUYLINES (sizeof(thintriangle_guy)/sizeof(mline_t))
@ -272,7 +251,7 @@ static fixed_t old_m_x, old_m_y;
static mpoint_t f_oldloc;
// used by MTOF to scale from map-to-frame-buffer coords
static fixed_t scale_mtof = INITSCALEMTOF;
static fixed_t scale_mtof = (fixed_t)INITSCALEMTOF;
// used by FTOM to scale from frame-buffer-to-map coords (=1/scale_mtof)
static fixed_t scale_ftom;
@ -284,23 +263,10 @@ static int markpointnum = 0; // next point to be assigned
static int followplayer = 1; // specifies whether to follow the player around
static unsigned char cheat_amap_seq[] = { 0xb2, 0x26, 0x26, 0x2e, 0xff };
static cheatseq_t cheat_amap = { cheat_amap_seq, 0 };
cheatseq_t cheat_amap = CHEAT("iddt", 0);
static boolean stopped = true;
extern boolean viewactive;
//extern byte screens[][SCREENWIDTH*SCREENHEIGHT];
void
V_MarkRect
( int x,
int y,
int width,
int height );
// Calculates the slope and slope according to the x-axis of a line
// segment in map coordinates (with the upright y-axis n' all) so
// that it can be used with the brain-dead drawing stuff.
@ -314,9 +280,9 @@ AM_getIslope
dy = ml->a.y - ml->b.y;
dx = ml->b.x - ml->a.x;
if (!dy) is->islp = (dx<0?-MAXINT:MAXINT);
if (!dy) is->islp = (dx<0?-INT_MAX:INT_MAX);
else is->islp = FixedDiv(dx, dy);
if (!dx) is->slp = (dy<0?-MAXINT:MAXINT);
if (!dx) is->slp = (dy<0?-INT_MAX:INT_MAX);
else is->slp = FixedDiv(dy, dx);
}
@ -392,8 +358,8 @@ void AM_findMinMaxBoundaries(void)
fixed_t a;
fixed_t b;
min_x = min_y = MAXINT;
max_x = max_y = -MAXINT;
min_x = min_y = INT_MAX;
max_x = max_y = -INT_MAX;
for (i=0;i<numvertexes;i++)
{
@ -431,7 +397,7 @@ void AM_changeWindowLoc(void)
if (m_paninc.x || m_paninc.y)
{
followplayer = 0;
f_oldloc.x = MAXINT;
f_oldloc.x = INT_MAX;
}
m_x += m_paninc.x;
@ -458,12 +424,12 @@ void AM_changeWindowLoc(void)
void AM_initVariables(void)
{
int pnum;
static event_t st_notify = { ev_keyup, AM_MSGENTERED };
static event_t st_notify = { ev_keyup, AM_MSGENTERED, 0, 0 };
automapactive = true;
fb = screens[0];
fb = I_VideoBuffer;
f_oldloc.x = MAXINT;
f_oldloc.x = INT_MAX;
amclock = 0;
lightlev = 0;
@ -475,12 +441,24 @@ void AM_initVariables(void)
m_h = FTOM(f_h);
// find player to center on initially
if (!playeringame[pnum = consoleplayer])
if (playeringame[consoleplayer])
{
plr = &players[consoleplayer];
}
else
{
plr = &players[0];
for (pnum=0;pnum<MAXPLAYERS;pnum++)
{
if (playeringame[pnum])
{
plr = &players[pnum];
break;
plr = &players[pnum];
}
}
}
m_x = plr->mo->x - m_w/2;
m_y = plr->mo->y - m_h/2;
AM_changeWindowLoc();
@ -506,7 +484,7 @@ void AM_loadPics(void)
for (i=0;i<10;i++)
{
sprintf(namebuf, "AMMNUM%d", i);
DEH_snprintf(namebuf, 9, "AMMNUM%d", i);
marknums[i] = W_CacheLumpName(namebuf, PU_STATIC);
}
@ -515,10 +493,13 @@ void AM_loadPics(void)
void AM_unloadPics(void)
{
int i;
char namebuf[9];
for (i=0;i<10;i++)
Z_ChangeTag(marknums[i], PU_CACHE);
{
DEH_snprintf(namebuf, 9, "AMMNUM%d", i);
W_ReleaseLumpName(namebuf);
}
}
void AM_clearMarks(void)
@ -559,7 +540,7 @@ void AM_LevelInit(void)
//
void AM_Stop (void)
{
static event_t st_notify = { 0, ev_keyup, AM_MSGEXITED };
static event_t st_notify = { 0, ev_keyup, AM_MSGEXITED, 0 };
AM_unloadPics();
automapactive = false;
@ -616,118 +597,138 @@ AM_Responder
{
int rc;
//static int cheatstate=0;
static int bigstate=0;
static char buffer[20];
int key;
rc = false;
if (!automapactive)
{
if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY)
if (ev->type == ev_keydown && ev->data1 == key_map_toggle)
{
AM_Start ();
viewactive = false;
rc = true;
}
}
else if (ev->type == ev_keydown)
{
rc = true;
switch(ev->data1)
{
case AM_PANRIGHTKEY: // pan right
if (!followplayer) m_paninc.x = FTOM(F_PANINC);
else rc = false;
break;
case AM_PANLEFTKEY: // pan left
if (!followplayer) m_paninc.x = -FTOM(F_PANINC);
else rc = false;
break;
case AM_PANUPKEY: // pan up
if (!followplayer) m_paninc.y = FTOM(F_PANINC);
else rc = false;
break;
case AM_PANDOWNKEY: // pan down
if (!followplayer) m_paninc.y = -FTOM(F_PANINC);
else rc = false;
break;
case AM_ZOOMOUTKEY: // zoom out
mtof_zoommul = M_ZOOMOUT;
ftom_zoommul = M_ZOOMIN;
break;
case AM_ZOOMINKEY: // zoom in
mtof_zoommul = M_ZOOMIN;
ftom_zoommul = M_ZOOMOUT;
break;
case AM_ENDKEY:
bigstate = 0;
viewactive = true;
AM_Stop ();
break;
case AM_GOBIGKEY:
bigstate = !bigstate;
if (bigstate)
{
AM_saveScaleAndLoc();
AM_minOutWindowScale();
}
else AM_restoreScaleAndLoc();
break;
case AM_FOLLOWKEY:
followplayer = !followplayer;
f_oldloc.x = MAXINT;
plr->message = followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF;
break;
case AM_GRIDKEY:
grid = !grid;
plr->message = grid ? AMSTR_GRIDON : AMSTR_GRIDOFF;
break;
case AM_MARKKEY:
sprintf(buffer, "%s %d", AMSTR_MARKEDSPOT, markpointnum);
plr->message = buffer;
AM_addMark();
break;
case AM_CLEARMARKKEY:
AM_clearMarks();
plr->message = AMSTR_MARKSCLEARED;
break;
default:
//cheatstate=0;
rc = false;
}
if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data1))
key = ev->data1;
if (key == key_map_east) // pan right
{
if (!followplayer) m_paninc.x = FTOM(F_PANINC);
else rc = false;
}
else if (key == key_map_west) // pan left
{
if (!followplayer) m_paninc.x = -FTOM(F_PANINC);
else rc = false;
}
else if (key == key_map_north) // pan up
{
if (!followplayer) m_paninc.y = FTOM(F_PANINC);
else rc = false;
}
else if (key == key_map_south) // pan down
{
if (!followplayer) m_paninc.y = -FTOM(F_PANINC);
else rc = false;
}
else if (key == key_map_zoomout) // zoom out
{
mtof_zoommul = M_ZOOMOUT;
ftom_zoommul = M_ZOOMIN;
}
else if (key == key_map_zoomin) // zoom in
{
mtof_zoommul = M_ZOOMIN;
ftom_zoommul = M_ZOOMOUT;
}
else if (key == key_map_toggle)
{
bigstate = 0;
viewactive = true;
AM_Stop ();
}
else if (key == key_map_maxzoom)
{
bigstate = !bigstate;
if (bigstate)
{
AM_saveScaleAndLoc();
AM_minOutWindowScale();
}
else AM_restoreScaleAndLoc();
}
else if (key == key_map_follow)
{
followplayer = !followplayer;
f_oldloc.x = INT_MAX;
if (followplayer)
plr->message = DEH_String(AMSTR_FOLLOWON);
else
plr->message = DEH_String(AMSTR_FOLLOWOFF);
}
else if (key == key_map_grid)
{
grid = !grid;
if (grid)
plr->message = DEH_String(AMSTR_GRIDON);
else
plr->message = DEH_String(AMSTR_GRIDOFF);
}
else if (key == key_map_mark)
{
M_snprintf(buffer, sizeof(buffer), "%s %d",
DEH_String(AMSTR_MARKEDSPOT), markpointnum);
plr->message = buffer;
AM_addMark();
}
else if (key == key_map_clearmark)
{
AM_clearMarks();
plr->message = DEH_String(AMSTR_MARKSCLEARED);
}
else
{
rc = false;
}
if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data2))
{
rc = false;
cheating = (cheating+1) % 3;
}
}
else if (ev->type == ev_keyup)
{
rc = false;
switch (ev->data1)
{
case AM_PANRIGHTKEY:
if (!followplayer) m_paninc.x = 0;
break;
case AM_PANLEFTKEY:
if (!followplayer) m_paninc.x = 0;
break;
case AM_PANUPKEY:
if (!followplayer) m_paninc.y = 0;
break;
case AM_PANDOWNKEY:
if (!followplayer) m_paninc.y = 0;
break;
case AM_ZOOMOUTKEY:
case AM_ZOOMINKEY:
mtof_zoommul = FRACUNIT;
ftom_zoommul = FRACUNIT;
break;
}
rc = false;
key = ev->data1;
if (key == key_map_east)
{
if (!followplayer) m_paninc.x = 0;
}
else if (key == key_map_west)
{
if (!followplayer) m_paninc.x = 0;
}
else if (key == key_map_north)
{
if (!followplayer) m_paninc.y = 0;
}
else if (key == key_map_south)
{
if (!followplayer) m_paninc.y = 0;
}
else if (key == key_map_zoomout || key == key_map_zoomin)
{
mtof_zoommul = FRACUNIT;
ftom_zoommul = FRACUNIT;
}
}
return rc;
@ -792,7 +793,7 @@ void AM_updateLightLev(void)
if (amclock>nexttic)
{
lightlev = litelevels[litelevelscnt++];
if (litelevelscnt == sizeof(litelevels)/sizeof(int)) litelevelscnt = 0;
if (litelevelscnt == arrlen(litelevels)) litelevelscnt = 0;
nexttic = amclock + 6 - (amclock % 6);
}
@ -856,9 +857,9 @@ AM_clipMline
TOP =8
};
register int outcode1 = 0;
register int outcode2 = 0;
register int outside;
register int outcode1 = 0;
register int outcode2 = 0;
register int outside;
fpoint_t tmp;
int dx;
@ -950,6 +951,11 @@ AM_clipMline
tmp.y = fl->a.y + (dy*(-fl->a.x))/dx;
tmp.x = 0;
}
else
{
tmp.x = 0;
tmp.y = 0;
}
if (outside == outcode1)
{
@ -989,7 +995,7 @@ AM_drawFline
register int ay;
register int d;
//static fuck = 0;
static int fuck = 0;
// For debugging only
if ( fl->a.x < 0 || fl->a.x >= f_w
@ -997,7 +1003,7 @@ AM_drawFline
|| fl->b.x < 0 || fl->b.x >= f_w
|| fl->b.y < 0 || fl->b.y >= f_h)
{
//fprintf(stderr, "fuck %d \r", fuck++);
DEH_fprintf(stderr, "fuck %d \r", fuck++);
return;
}
@ -1249,11 +1255,11 @@ void AM_drawPlayers(void)
{
if (cheating)
AM_drawLineCharacter
(cheat_player_arrow, NUMCHEATPLYRLINES, 0,
(cheat_player_arrow, arrlen(cheat_player_arrow), 0,
plr->mo->angle, WHITE, plr->mo->x, plr->mo->y);
else
AM_drawLineCharacter
(player_arrow, NUMPLYRLINES, 0, plr->mo->angle,
(player_arrow, arrlen(player_arrow), 0, plr->mo->angle,
WHITE, plr->mo->x, plr->mo->y);
return;
}
@ -1275,7 +1281,7 @@ void AM_drawPlayers(void)
color = their_colors[their_color];
AM_drawLineCharacter
(player_arrow, NUMPLYRLINES, 0, p->mo->angle,
(player_arrow, arrlen(player_arrow), 0, p->mo->angle,
color, p->mo->x, p->mo->y);
}
@ -1295,7 +1301,7 @@ AM_drawThings
while (t)
{
AM_drawLineCharacter
(thintriangle_guy, NUMTHINTRIANGLEGUYLINES,
(thintriangle_guy, arrlen(thintriangle_guy),
16<<FRACBITS, t->angle, colors+lightlev, t->x, t->y);
t = t->snext;
}
@ -1317,7 +1323,7 @@ void AM_drawMarks(void)
fx = CXMTOF(markpoints[i].x);
fy = CYMTOF(markpoints[i].y);
if (fx >= f_x && fx <= f_w - w && fy >= f_y && fy <= f_h - h)
V_DrawPatch(fx, fy, FB, marknums[i]);
V_DrawPatch(fx, fy, marknums[i]);
}
}

View File

@ -1,27 +1,27 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// AutoMap module.
//
//-----------------------------------------------------------------------------
#ifndef __AMMAP_H__
#define __AMMAP_H__
#include "d_event.h"
#include "m_cheat.h"
// Used by ST StatusBar stuff.
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
@ -43,10 +43,7 @@ void AM_Drawer (void);
void AM_Stop (void);
extern cheatseq_t cheat_amap;
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,67 +0,0 @@
/* Old compatibility names for <limits.h> and <float.h> constants.
Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* This interface is obsolete. New programs should use
<limits.h> and/or <float.h> instead of <values.h>. */
#ifndef _VALUES_H
#define _VALUES_H 1
#include <features.h>
#include <limits.h>
#define _TYPEBITS(type) (sizeof (type) * CHAR_BIT)
#define CHARBITS _TYPEBITS (char)
#define SHORTBITS _TYPEBITS (short int)
#define INTBITS _TYPEBITS (int)
#define LONGBITS _TYPEBITS (long int)
#define PTRBITS _TYPEBITS (char *)
#define DOUBLEBITS _TYPEBITS (double)
#define FLOATBITS _TYPEBITS (float)
#define MINSHORT SHRT_MIN
#define MININT INT_MIN
#define MINLONG LONG_MIN
#define MAXSHORT SHRT_MAX
#define MAXINT INT_MAX
#define MAXLONG LONG_MAX
#define HIBITS MINSHORT
#define HIBITL MINLONG
#include <float.h>
#define MAXDOUBLE DBL_MAX
#define MINDOUBLE DBL_MIN
#define MINFLOAT FLT_MIN
#define DMINEXP DBL_MIN_EXP
#define FMINEXP FLT_MIN_EXP
#define DMAXEXP DBL_MAX_EXP
#define FMAXEXP FLT_MAX_EXP
#ifdef __USE_MISC
/* Some systems define this name instead of CHAR_BIT or CHARBITS. */
# define BITSPERBYTE CHAR_BIT
#endif
#endif /* values.h */

100
frosted-doom/config.h Normal file
View File

@ -0,0 +1,100 @@
/* config.hin. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dev/isa/spkrio.h> header file. */
#undef HAVE_DEV_ISA_SPKRIO_H
/* Define to 1 if you have the <dev/speaker/speaker.h> header file. */
#undef HAVE_DEV_SPEAKER_SPEAKER_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `ioperm' function. */
#undef HAVE_IOPERM
/* Define to 1 if you have the `amd64' library (-lamd64). */
#undef HAVE_LIBAMD64
/* Define to 1 if you have the `i386' library (-li386). */
#undef HAVE_LIBI386
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `png' library (-lpng). */
#undef HAVE_LIBPNG
/* Define to 1 if you have the `samplerate' library (-lsamplerate). */
#undef HAVE_LIBSAMPLERATE
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the <linux/kd.h> header file. */
#undef HAVE_LINUX_KD_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP
/* Define to 1 if you have the `sched_setaffinity' function. */
#undef HAVE_SCHED_SETAFFINITY
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#define PACKAGE "Doom"
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#define PACKAGE_NAME "FDoom"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "FDoom 0.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "fdoom.tar"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION 0.1
/* Change this when you create your awesome forked version */
#define PROGRAM_PREFIX "fdoom"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION 0.1
/* Define to 1 if you want to compile the unmodified code */
#undef ORIGCODE
/* Define to the directory where all game files are located */
#define FILES_DIR "/mnt"

View File

@ -1,24 +1,21 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Printed strings for translation.
// English language support (default).
//
//-----------------------------------------------------------------------------
#ifndef __D_ENGLSH__
#define __D_ENGLSH__
@ -63,7 +60,7 @@
#define NETEND "you can't end a netgame!\n\n"PRESSKEY
#define ENDGAME "are you sure you want to end the game?\n\n"PRESSYN
#define DOSY "(press y to quit)"
#define DOSY "(press y to quit to dos.)"
#define DETAILHI "High detail"
#define DETAILLO "Low detail"
@ -694,8 +691,3 @@
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

63
frosted-doom/d_event.c Normal file
View File

@ -0,0 +1,63 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// DESCRIPTION: Event handling.
//
// Events are asynchronous inputs generally generated by the game user.
// Events can be discarded if no responder claims them
//
#include <stdlib.h>
#include "d_event.h"
#define MAXEVENTS 64
static event_t events[MAXEVENTS];
static int eventhead;
static int eventtail;
//
// D_PostEvent
// Called by the I/O functions when input is detected
//
void D_PostEvent (event_t* ev)
{
events[eventhead] = *ev;
eventhead = (eventhead + 1) % MAXEVENTS;
}
// Read an event from the queue.
event_t *D_PopEvent(void)
{
event_t *result;
// No more events waiting.
if (eventtail == eventhead)
{
return NULL;
}
result = &events[eventtail];
// Advance to the next event in the queue.
eventtail = (eventtail + 1) % MAXEVENTS;
return result;
}

View File

@ -1,23 +1,20 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#ifndef __D_EVENT__
@ -37,35 +34,40 @@ typedef enum
ev_keydown,
ev_keyup,
ev_mouse,
ev_joystick
ev_joystick,
ev_quit
} evtype_t;
// Event structure.
typedef struct
{
evtype_t type;
int data1; // keys / mouse/joystick buttons
int data2; // mouse/joystick x move
int data3; // mouse/joystick y move
evtype_t type;
// Event-related data that depends on the type of event:
//
// ev_keydown/ev_keyup:
// data1: Key code (from doomkeys.h) of the key that was
// pressed or released.
// data2: Ascii text of the character that was pressed,
// shifted appropriately (eg. '$' if 4 was pressed
// while shift was held).
//
// ev_mouse:
// data1: Bitfield of buttons currently held down.
// (bit 0 = left; bit 1 = right; bit 2 = middle).
// data2: X axis mouse movement (turn).
// data3: Y axis mouse movement (forward/backward).
//
// ev_joystick:
// data1: Bitfield of buttons currently pressed.
// data2: X axis mouse movement (turn).
// data3: Y axis mouse movement (forward/backward).
// data4: Third axis mouse movement (strafe).
int data1, data2, data3, data4;
} event_t;
typedef enum
{
ga_nothing,
ga_loadlevel,
ga_newgame,
ga_loadgame,
ga_savegame,
ga_playdemo,
ga_completed,
ga_victory,
ga_worlddone,
ga_screenshot
} gameaction_t;
//
// Button/action code definitions.
//
@ -99,24 +101,37 @@ typedef enum
} buttoncode_t;
// villsa [STRIFE] Strife specific buttons
// TODO - not finished
typedef enum
{
// Player view look up
BT2_LOOKUP = 1,
// Player view look down
BT2_LOOKDOWN = 2,
// Center player's view
BT2_CENTERVIEW = 4,
// Use inventory item
BT2_INVUSE = 8,
// Drop inventory item
BT2_INVDROP = 16,
// Jump up and down
BT2_JUMP = 32,
// Use medkit
BT2_HEALTH = 128,
} buttoncode2_t;
//
// GLOBAL VARIABLES
//
#define MAXEVENTS 64
extern event_t events[MAXEVENTS];
extern int eventhead;
extern int eventtail;
// Called by IO functions when input is detected.
void D_PostEvent (event_t *ev);
extern gameaction_t gameaction;
// Read an event from the event queue
event_t *D_PopEvent(void);
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,433 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Printed strings, french translation.
//
//-----------------------------------------------------------------------------
#ifndef __D_FRENCH__
#define __D_FRENCH__
//
// D_Main.C
//
#define D_DEVSTR "MODE DEVELOPPEMENT ON.\n"
#define D_CDROM "VERSION CD-ROM: DEFAULT.CFG DANS C:\\DOOMDATA\n"
//
// M_Menu.C
//
#define PRESSKEY "APPUYEZ SUR UNE TOUCHE."
#define PRESSYN "APPUYEZ SUR Y OU N"
#define QUITMSG "VOUS VOULEZ VRAIMENT\nQUITTER CE SUPER JEU?"
#define LOADNET "VOUS NE POUVEZ PAS CHARGER\nUN JEU EN RESEAU!\n\n"PRESSKEY
#define QLOADNET "CHARGEMENT RAPIDE INTERDIT EN RESEAU!\n\n"PRESSKEY
#define QSAVESPOT "VOUS N'AVEZ PAS CHOISI UN EMPLACEMENT!\n\n"PRESSKEY
#define SAVEDEAD "VOUS NE POUVEZ PAS SAUVER SI VOUS NE JOUEZ "\
"PAS!\n\n"PRESSKEY
#define QSPROMPT "SAUVEGARDE RAPIDE DANS LE FICHIER \n\n'%s'?\n\n"PRESSYN
#define QLPROMPT "VOULEZ-VOUS CHARGER LA SAUVEGARDE"\
"\n\n'%s'?\n\n"PRESSYN
#define NEWGAME "VOUS NE POUVEZ PAS LANCER\n"\
"UN NOUVEAU JEU SUR RESEAU.\n\n"PRESSKEY
#define NIGHTMARE "VOUS CONFIRMEZ? CE NIVEAU EST\n"\
"VRAIMENT IMPITOYABLE!n"PRESSYN
#define SWSTRING "CECI EST UNE VERSION SHAREWARE DE DOOM.\n\n"\
"VOUS DEVRIEZ COMMANDER LA TRILOGIE COMPLETE.\n\n"PRESSKEY
#define MSGOFF "MESSAGES OFF"
#define MSGON "MESSAGES ON"
#define NETEND "VOUS NE POUVEZ PAS METTRE FIN A UN JEU SUR "\
"RESEAU!\n\n"PRESSKEY
#define ENDGAME "VOUS VOULEZ VRAIMENT METTRE FIN AU JEU?\n\n"PRESSYN
#define DOSY "(APPUYEZ SUR Y POUR REVENIR AU OS.)"
#define DETAILHI "GRAPHISMES MAXIMUM "
#define DETAILLO "GRAPHISMES MINIMUM "
#define GAMMALVL0 "CORRECTION GAMMA OFF"
#define GAMMALVL1 "CORRECTION GAMMA NIVEAU 1"
#define GAMMALVL2 "CORRECTION GAMMA NIVEAU 2"
#define GAMMALVL3 "CORRECTION GAMMA NIVEAU 3"
#define GAMMALVL4 "CORRECTION GAMMA NIVEAU 4"
#define EMPTYSTRING "EMPLACEMENT VIDE"
//
// P_inter.C
//
#define GOTARMOR "ARMURE RECUPEREE."
#define GOTMEGA "MEGA-ARMURE RECUPEREE!"
#define GOTHTHBONUS "BONUS DE SANTE RECUPERE."
#define GOTARMBONUS "BONUS D'ARMURE RECUPERE."
#define GOTSTIM "STIMPACK RECUPERE."
#define GOTMEDINEED "MEDIKIT RECUPERE. VOUS EN AVEZ VRAIMENT BESOIN!"
#define GOTMEDIKIT "MEDIKIT RECUPERE."
#define GOTSUPER "SUPERCHARGE!"
#define GOTBLUECARD "CARTE MAGNETIQUE BLEUE RECUPEREE."
#define GOTYELWCARD "CARTE MAGNETIQUE JAUNE RECUPEREE."
#define GOTREDCARD "CARTE MAGNETIQUE ROUGE RECUPEREE."
#define GOTBLUESKUL "CLEF CRANE BLEUE RECUPEREE."
#define GOTYELWSKUL "CLEF CRANE JAUNE RECUPEREE."
#define GOTREDSKULL "CLEF CRANE ROUGE RECUPEREE."
#define GOTINVUL "INVULNERABILITE!"
#define GOTBERSERK "BERSERK!"
#define GOTINVIS "INVISIBILITE PARTIELLE "
#define GOTSUIT "COMBINAISON ANTI-RADIATIONS "
#define GOTMAP "CARTE INFORMATIQUE "
#define GOTVISOR "VISEUR A AMPLIFICATION DE LUMIERE "
#define GOTMSPHERE "MEGASPHERE!"
#define GOTCLIP "CHARGEUR RECUPERE."
#define GOTCLIPBOX "BOITE DE BALLES RECUPEREE."
#define GOTROCKET "ROQUETTE RECUPEREE."
#define GOTROCKBOX "CAISSE DE ROQUETTES RECUPEREE."
#define GOTCELL "CELLULE D'ENERGIE RECUPEREE."
#define GOTCELLBOX "PACK DE CELLULES D'ENERGIE RECUPERE."
#define GOTSHELLS "4 CARTOUCHES RECUPEREES."
#define GOTSHELLBOX "BOITE DE CARTOUCHES RECUPEREE."
#define GOTBACKPACK "SAC PLEIN DE MUNITIONS RECUPERE!"
#define GOTBFG9000 "VOUS AVEZ UN BFG9000! OH, OUI!"
#define GOTCHAINGUN "VOUS AVEZ LA MITRAILLEUSE!"
#define GOTCHAINSAW "UNE TRONCONNEUSE!"
#define GOTLAUNCHER "VOUS AVEZ UN LANCE-ROQUETTES!"
#define GOTPLASMA "VOUS AVEZ UN FUSIL A PLASMA!"
#define GOTSHOTGUN "VOUS AVEZ UN FUSIL!"
#define GOTSHOTGUN2 "VOUS AVEZ UN SUPER FUSIL!"
//
// P_Doors.C
//
#define PD_BLUEO "IL VOUS FAUT UNE CLEF BLEUE"
#define PD_REDO "IL VOUS FAUT UNE CLEF ROUGE"
#define PD_YELLOWO "IL VOUS FAUT UNE CLEF JAUNE"
#define PD_BLUEK PD_BLUEO
#define PD_REDK PD_REDO
#define PD_YELLOWK PD_YELLOWO
//
// G_game.C
//
#define GGSAVED "JEU SAUVEGARDE."
//
// HU_stuff.C
//
#define HUSTR_MSGU "[MESSAGE NON ENVOYE]"
#define HUSTR_E1M1 "E1M1: HANGAR"
#define HUSTR_E1M2 "E1M2: USINE NUCLEAIRE "
#define HUSTR_E1M3 "E1M3: RAFFINERIE DE TOXINES "
#define HUSTR_E1M4 "E1M4: CENTRE DE CONTROLE "
#define HUSTR_E1M5 "E1M5: LABORATOIRE PHOBOS "
#define HUSTR_E1M6 "E1M6: TRAITEMENT CENTRAL "
#define HUSTR_E1M7 "E1M7: CENTRE INFORMATIQUE "
#define HUSTR_E1M8 "E1M8: ANOMALIE PHOBOS "
#define HUSTR_E1M9 "E1M9: BASE MILITAIRE "
#define HUSTR_E2M1 "E2M1: ANOMALIE DEIMOS "
#define HUSTR_E2M2 "E2M2: ZONE DE CONFINEMENT "
#define HUSTR_E2M3 "E2M3: RAFFINERIE"
#define HUSTR_E2M4 "E2M4: LABORATOIRE DEIMOS "
#define HUSTR_E2M5 "E2M5: CENTRE DE CONTROLE "
#define HUSTR_E2M6 "E2M6: HALLS DES DAMNES "
#define HUSTR_E2M7 "E2M7: CUVES DE REPRODUCTION "
#define HUSTR_E2M8 "E2M8: TOUR DE BABEL "
#define HUSTR_E2M9 "E2M9: FORTERESSE DU MYSTERE "
#define HUSTR_E3M1 "E3M1: DONJON DE L'ENFER "
#define HUSTR_E3M2 "E3M2: BOURBIER DU DESESPOIR "
#define HUSTR_E3M3 "E3M3: PANDEMONIUM"
#define HUSTR_E3M4 "E3M4: MAISON DE LA DOULEUR "
#define HUSTR_E3M5 "E3M5: CATHEDRALE PROFANE "
#define HUSTR_E3M6 "E3M6: MONT EREBUS"
#define HUSTR_E3M7 "E3M7: LIMBES"
#define HUSTR_E3M8 "E3M8: DIS"
#define HUSTR_E3M9 "E3M9: CLAPIERS"
#define HUSTR_1 "NIVEAU 1: ENTREE "
#define HUSTR_2 "NIVEAU 2: HALLS SOUTERRAINS "
#define HUSTR_3 "NIVEAU 3: LE FEU NOURRI "
#define HUSTR_4 "NIVEAU 4: LE FOYER "
#define HUSTR_5 "NIVEAU 5: LES EGOUTS "
#define HUSTR_6 "NIVEAU 6: LE BROYEUR "
#define HUSTR_7 "NIVEAU 7: L'HERBE DE LA MORT"
#define HUSTR_8 "NIVEAU 8: RUSES ET PIEGES "
#define HUSTR_9 "NIVEAU 9: LE PUITS "
#define HUSTR_10 "NIVEAU 10: BASE DE RAVITAILLEMENT "
#define HUSTR_11 "NIVEAU 11: LE CERCLE DE LA MORT!"
#define HUSTR_12 "NIVEAU 12: L'USINE "
#define HUSTR_13 "NIVEAU 13: LE CENTRE VILLE"
#define HUSTR_14 "NIVEAU 14: LES ANTRES PROFONDES "
#define HUSTR_15 "NIVEAU 15: LA ZONE INDUSTRIELLE "
#define HUSTR_16 "NIVEAU 16: LA BANLIEUE"
#define HUSTR_17 "NIVEAU 17: LES IMMEUBLES"
#define HUSTR_18 "NIVEAU 18: LA COUR "
#define HUSTR_19 "NIVEAU 19: LA CITADELLE "
#define HUSTR_20 "NIVEAU 20: JE T'AI EU!"
#define HUSTR_21 "NIVEAU 21: LE NIRVANA"
#define HUSTR_22 "NIVEAU 22: LES CATACOMBES "
#define HUSTR_23 "NIVEAU 23: LA GRANDE FETE "
#define HUSTR_24 "NIVEAU 24: LE GOUFFRE "
#define HUSTR_25 "NIVEAU 25: LES CHUTES DE SANG"
#define HUSTR_26 "NIVEAU 26: LES MINES ABANDONNEES "
#define HUSTR_27 "NIVEAU 27: CHEZ LES MONSTRES "
#define HUSTR_28 "NIVEAU 28: LE MONDE DE L'ESPRIT "
#define HUSTR_29 "NIVEAU 29: LA LIMITE "
#define HUSTR_30 "NIVEAU 30: L'ICONE DU PECHE "
#define HUSTR_31 "NIVEAU 31: WOLFENSTEIN"
#define HUSTR_32 "NIVEAU 32: LE MASSACRE"
#define HUSTR_CHATMACRO1 "JE SUIS PRET A LEUR EN FAIRE BAVER!"
#define HUSTR_CHATMACRO2 "JE VAIS BIEN."
#define HUSTR_CHATMACRO3 "JE N'AI PAS L'AIR EN FORME!"
#define HUSTR_CHATMACRO4 "AU SECOURS!"
#define HUSTR_CHATMACRO5 "TU CRAINS!"
#define HUSTR_CHATMACRO6 "LA PROCHAINE FOIS, MINABLE..."
#define HUSTR_CHATMACRO7 "VIENS ICI!"
#define HUSTR_CHATMACRO8 "JE VAIS M'EN OCCUPER."
#define HUSTR_CHATMACRO9 "OUI"
#define HUSTR_CHATMACRO0 "NON"
#define HUSTR_TALKTOSELF1 "VOUS PARLEZ TOUT SEUL "
#define HUSTR_TALKTOSELF2 "QUI EST LA?"
#define HUSTR_TALKTOSELF3 "VOUS VOUS FAITES PEUR "
#define HUSTR_TALKTOSELF4 "VOUS COMMENCEZ A DELIRER "
#define HUSTR_TALKTOSELF5 "VOUS ETES LARGUE..."
#define HUSTR_MESSAGESENT "[MESSAGE ENVOYE]"
// The following should NOT be changed unless it seems
// just AWFULLY necessary
#define HUSTR_PLRGREEN "VERT: "
#define HUSTR_PLRINDIGO "INDIGO: "
#define HUSTR_PLRBROWN "BRUN: "
#define HUSTR_PLRRED "ROUGE: "
#define HUSTR_KEYGREEN 'g' // french key should be "V"
#define HUSTR_KEYINDIGO 'i'
#define HUSTR_KEYBROWN 'b'
#define HUSTR_KEYRED 'r'
//
// AM_map.C
//
#define AMSTR_FOLLOWON "MODE POURSUITE ON"
#define AMSTR_FOLLOWOFF "MODE POURSUITE OFF"
#define AMSTR_GRIDON "GRILLE ON"
#define AMSTR_GRIDOFF "GRILLE OFF"
#define AMSTR_MARKEDSPOT "REPERE MARQUE "
#define AMSTR_MARKSCLEARED "REPERES EFFACES "
//
// ST_stuff.C
//
#define STSTR_MUS "CHANGEMENT DE MUSIQUE "
#define STSTR_NOMUS "IMPOSSIBLE SELECTION"
#define STSTR_DQDON "INVULNERABILITE ON "
#define STSTR_DQDOFF "INVULNERABILITE OFF"
#define STSTR_KFAADDED "ARMEMENT MAXIMUM! "
#define STSTR_FAADDED "ARMES (SAUF CLEFS) AJOUTEES"
#define STSTR_NCON "BARRIERES ON"
#define STSTR_NCOFF "BARRIERES OFF"
#define STSTR_BEHOLD " inVuln, Str, Inviso, Rad, Allmap, or Lite-amp"
#define STSTR_BEHOLDX "AMELIORATION ACTIVEE"
#define STSTR_CHOPPERS "... DOESN'T SUCK - GM"
#define STSTR_CLEV "CHANGEMENT DE NIVEAU..."
//
// F_Finale.C
//
#define E1TEXT "APRES AVOIR VAINCU LES GROS MECHANTS\n"\
"ET NETTOYE LA BASE LUNAIRE, VOUS AVEZ\n"\
"GAGNE, NON? PAS VRAI? OU EST DONC VOTRE\n"\
" RECOMPENSE ET VOTRE BILLET DE\n"\
"RETOUR? QU'EST-QUE CA VEUT DIRE?CE"\
"N'EST PAS LA FIN ESPEREE!\n"\
"\n" \
"CA SENT LA VIANDE PUTREFIEE, MAIS\n"\
"ON DIRAIT LA BASE DEIMOS. VOUS ETES\n"\
"APPAREMMENT BLOQUE AUX PORTES DE L'ENFER.\n"\
"LA SEULE ISSUE EST DE L'AUTRE COTE.\n"\
"\n"\
"POUR VIVRE LA SUITE DE DOOM, JOUEZ\n"\
"A 'AUX PORTES DE L'ENFER' ET A\n"\
"L'EPISODE SUIVANT, 'L'ENFER'!\n"
#define E2TEXT "VOUS AVEZ REUSSI. L'INFAME DEMON\n"\
"QUI CONTROLAIT LA BASE LUNAIRE DE\n"\
"DEIMOS EST MORT, ET VOUS AVEZ\n"\
"TRIOMPHE! MAIS... OU ETES-VOUS?\n"\
"VOUS GRIMPEZ JUSQU'AU BORD DE LA\n"\
"LUNE ET VOUS DECOUVREZ L'ATROCE\n"\
"VERITE.\n" \
"\n"\
"DEIMOS EST AU-DESSUS DE L'ENFER!\n"\
"VOUS SAVEZ QUE PERSONNE NE S'EN\n"\
"EST JAMAIS ECHAPPE, MAIS CES FUMIERS\n"\
"VONT REGRETTER DE VOUS AVOIR CONNU!\n"\
"VOUS REDESCENDEZ RAPIDEMENT VERS\n"\
"LA SURFACE DE L'ENFER.\n"\
"\n" \
"VOICI MAINTENANT LE CHAPITRE FINAL DE\n"\
"DOOM! -- L'ENFER."
#define E3TEXT "LE DEMON ARACHNEEN ET REPUGNANT\n"\
"QUI A DIRIGE L'INVASION DES BASES\n"\
"LUNAIRES ET SEME LA MORT VIENT DE SE\n"\
"FAIRE PULVERISER UNE FOIS POUR TOUTES.\n"\
"\n"\
"UNE PORTE SECRETE S'OUVRE. VOUS ENTREZ.\n"\
"VOUS AVEZ PROUVE QUE VOUS POUVIEZ\n"\
"RESISTER AUX HORREURS DE L'ENFER.\n"\
"IL SAIT ETRE BEAU JOUEUR, ET LORSQUE\n"\
"VOUS SORTEZ, VOUS REVOYEZ LES VERTES\n"\
"PRAIRIES DE LA TERRE, VOTRE PLANETE.\n"\
"\n"\
"VOUS VOUS DEMANDEZ CE QUI S'EST PASSE\n"\
"SUR TERRE PENDANT QUE VOUS AVEZ\n"\
"COMBATTU LE DEMON. HEUREUSEMENT,\n"\
"AUCUN GERME DU MAL N'A FRANCHI\n"\
"CETTE PORTE AVEC VOUS..."
// after level 6, put this:
#define C1TEXT "VOUS ETES AU PLUS PROFOND DE L'ASTROPORT\n" \
"INFESTE DE MONSTRES, MAIS QUELQUE CHOSE\n" \
"NE VA PAS. ILS ONT APPORTE LEUR PROPRE\n" \
"REALITE, ET LA TECHNOLOGIE DE L'ASTROPORT\n" \
"EST AFFECTEE PAR LEUR PRESENCE.\n" \
"\n"\
"DEVANT VOUS, VOUS VOYEZ UN POSTE AVANCE\n" \
"DE L'ENFER, UNE ZONE FORTIFIEE. SI VOUS\n" \
"POUVEZ PASSER, VOUS POURREZ PENETRER AU\n" \
"COEUR DE LA BASE HANTEE ET TROUVER \n" \
"L'INTERRUPTEUR DE CONTROLE QUI GARDE LA \n" \
"POPULATION DE LA TERRE EN OTAGE."
// After level 11, put this:
#define C2TEXT "VOUS AVEZ GAGNE! VOTRE VICTOIRE A PERMIS\n" \
"A L'HUMANITE D'EVACUER LA TERRE ET \n"\
"D'ECHAPPER AU CAUCHEMAR. VOUS ETES \n"\
"MAINTENANT LE DERNIER HUMAIN A LA SURFACE \n"\
"DE LA PLANETE. VOUS ETES ENTOURE DE \n"\
"MUTANTS CANNIBALES, D'EXTRATERRESTRES \n"\
"CARNIVORES ET D'ESPRITS DU MAL. VOUS \n"\
"ATTENDEZ CALMEMENT LA MORT, HEUREUX \n"\
"D'AVOIR PU SAUVER VOTRE RACE.\n"\
"MAIS UN MESSAGE VOUS PARVIENT SOUDAIN\n"\
"DE L'ESPACE: \"NOS CAPTEURS ONT LOCALISE\n"\
"LA SOURCE DE L'INVASION EXTRATERRESTRE.\n"\
"SI VOUS Y ALLEZ, VOUS POURREZ PEUT-ETRE\n"\
"LES ARRETER. LEUR BASE EST SITUEE AU COEUR\n"\
"DE VOTRE VILLE NATALE, PRES DE L'ASTROPORT.\n"\
"VOUS VOUS RELEVEZ LENTEMENT ET PENIBLEMENT\n"\
"ET VOUS REPARTEZ POUR LE FRONT."
// After level 20, put this:
#define C3TEXT "VOUS ETES AU COEUR DE LA CITE CORROMPUE,\n"\
"ENTOURE PAR LES CADAVRES DE VOS ENNEMIS.\n"\
"VOUS NE VOYEZ PAS COMMENT DETRUIRE LA PORTE\n"\
"DES CREATURES DE CE COTE. VOUS SERREZ\n"\
"LES DENTS ET PLONGEZ DANS L'OUVERTURE.\n"\
"\n"\
"IL DOIT Y AVOIR UN MOYEN DE LA FERMER\n"\
"DE L'AUTRE COTE. VOUS ACCEPTEZ DE\n"\
"TRAVERSER L'ENFER POUR LE FAIRE?"
// After level 29, put this:
#define C4TEXT "LE VISAGE HORRIBLE D'UN DEMON D'UNE\n"\
"TAILLE INCROYABLE S'EFFONDRE DEVANT\n"\
"VOUS LORSQUE VOUS TIREZ UNE SALVE DE\n"\
"ROQUETTES DANS SON CERVEAU. LE MONSTRE\n"\
"SE RATATINE, SES MEMBRES DECHIQUETES\n"\
"SE REPANDANT SUR DES CENTAINES DE\n"\
"KILOMETRES A LA SURFACE DE L'ENFER.\n"\
"\n"\
"VOUS AVEZ REUSSI. L'INVASION N'AURA.\n"\
"PAS LIEU. LA TERRE EST SAUVEE. L'ENFER\n"\
"EST ANEANTI. EN VOUS DEMANDANT OU IRONT\n"\
"MAINTENANT LES DAMNES, VOUS ESSUYEZ\n"\
"VOTRE FRONT COUVERT DE SUEUR ET REPARTEZ\n"\
"VERS LA TERRE. SA RECONSTRUCTION SERA\n"\
"BEAUCOUP PLUS DROLE QUE SA DESTRUCTION.\n"
// Before level 31, put this:
#define C5TEXT "FELICITATIONS! VOUS AVEZ TROUVE LE\n"\
"NIVEAU SECRET! IL SEMBLE AVOIR ETE\n"\
"CONSTRUIT PAR LES HUMAINS. VOUS VOUS\n"\
"DEMANDEZ QUELS PEUVENT ETRE LES\n"\
"HABITANTS DE CE COIN PERDU DE L'ENFER."
// Before level 32, put this:
#define C6TEXT "FELICITATIONS! VOUS AVEZ DECOUVERT\n"\
"LE NIVEAU SUPER SECRET! VOUS FERIEZ\n"\
"MIEUX DE FONCER DANS CELUI-LA!\n"
//
// Character cast strings F_FINALE.C
//
#define CC_ZOMBIE "ZOMBIE"
#define CC_SHOTGUN "TYPE AU FUSIL"
#define CC_HEAVY "MEC SUPER-ARME"
#define CC_IMP "DIABLOTIN"
#define CC_DEMON "DEMON"
#define CC_LOST "AME PERDUE"
#define CC_CACO "CACODEMON"
#define CC_HELL "CHEVALIER DE L'ENFER"
#define CC_BARON "BARON DE L'ENFER"
#define CC_ARACH "ARACHNOTRON"
#define CC_PAIN "ELEMENTAIRE DE LA DOULEUR"
#define CC_REVEN "REVENANT"
#define CC_MANCU "MANCUBUS"
#define CC_ARCH "ARCHI-INFAME"
#define CC_SPIDER "L'ARAIGNEE CERVEAU"
#define CC_CYBER "LE CYBERDEMON"
#define CC_HERO "NOTRE HEROS"
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,34 +1,24 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id:$";
// We are referring to sprite numbers.
#include "info.h"
#ifdef __GNUG__
#pragma implementation "d_items.h"
#endif
#include "d_items.h"

View File

@ -1,23 +1,20 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Items: key cards, artifacts, weapon, ammunition.
//
//-----------------------------------------------------------------------------
#ifndef __D_ITEMS__
@ -25,9 +22,6 @@
#include "doomdef.h"
#ifdef __GNUG__
#pragma interface
#endif
// Weapon info: sprite frames, ammunition use.
@ -45,8 +39,3 @@ typedef struct
extern weaponinfo_t weaponinfo[NUMWEAPONS];
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

844
frosted-doom/d_iwad.c Normal file
View File

@ -0,0 +1,844 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Search for and locate an IWAD file, and initialize according
// to the IWAD type.
//
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "config.h"
#include "deh_str.h"
#include "doomkeys.h"
#include "d_iwad.h"
#include "i_system.h"
#include "m_argv.h"
#include "m_config.h"
#include "m_misc.h"
#include "w_wad.h"
#include "z_zone.h"
static const iwad_t iwads[] =
{
{ "doom2.wad", doom2, commercial, "Doom II" },
{ "plutonia.wad", pack_plut, commercial, "Final Doom: Plutonia Experiment" },
{ "tnt.wad", pack_tnt, commercial, "Final Doom: TNT: Evilution" },
{ "doom.wad", doom, retail, "Doom" },
{ "DOOM1.WAD", doom, shareware, "Doom Shareware" },
{ "chex.wad", pack_chex, shareware, "Chex Quest" },
{ "hacx.wad", pack_hacx, commercial, "Hacx" },
{ "freedm.wad", doom2, commercial, "FreeDM" },
{ "freedoom2.wad", doom2, commercial, "Freedoom: Phase 2" },
{ "freedoom1.wad", doom, retail, "Freedoom: Phase 1" },
{ "heretic.wad", heretic, retail, "Heretic" },
{ "heretic1.wad", heretic, shareware, "Heretic Shareware" },
{ "hexen.wad", hexen, commercial, "Hexen" },
//{ "strife0.wad", strife, commercial, "Strife" }, // haleyjd: STRIFE-FIXME
{ "strife1.wad", strife, commercial, "Strife" },
};
// Array of locations to search for IWAD files
//
// "128 IWAD search directories should be enough for anybody".
#define MAX_IWAD_DIRS 128
static boolean iwad_dirs_built = false;
static char *iwad_dirs[MAX_IWAD_DIRS];
static int num_iwad_dirs = 0;
static void AddIWADDir(char *dir)
{
if (num_iwad_dirs < MAX_IWAD_DIRS)
{
iwad_dirs[num_iwad_dirs] = dir;
++num_iwad_dirs;
}
}
// This is Windows-specific code that automatically finds the location
// of installed IWAD files. The registry is inspected to find special
// keys installed by the Windows installers for various CD versions
// of Doom. From these keys we can deduce where to find an IWAD.
#if defined(_WIN32) && !defined(_WIN32_WCE)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef struct
{
HKEY root;
char *path;
char *value;
} registry_value_t;
#define UNINSTALLER_STRING "\\uninstl.exe /S "
// Keys installed by the various CD editions. These are actually the
// commands to invoke the uninstaller and look like this:
//
// C:\Program Files\Path\uninstl.exe /S C:\Program Files\Path
//
// With some munging we can find where Doom was installed.
// [AlexMax] From the persepctive of a 64-bit executable, 32-bit registry
// keys are located in a different spot.
#if _WIN64
#define SOFTWARE_KEY "Software\\Wow6432Node"
#else
#define SOFTWARE_KEY "Software"
#endif
static registry_value_t uninstall_values[] =
{
// Ultimate Doom, CD version (Depths of Doom trilogy)
{
HKEY_LOCAL_MACHINE,
SOFTWARE_KEY "\\Microsoft\\Windows\\CurrentVersion\\"
"Uninstall\\Ultimate Doom for Windows 95",
"UninstallString",
},
// Doom II, CD version (Depths of Doom trilogy)
{
HKEY_LOCAL_MACHINE,
SOFTWARE_KEY "\\Microsoft\\Windows\\CurrentVersion\\"
"Uninstall\\Doom II for Windows 95",
"UninstallString",
},
// Final Doom
{
HKEY_LOCAL_MACHINE,
SOFTWARE_KEY "\\Microsoft\\Windows\\CurrentVersion\\"
"Uninstall\\Final Doom for Windows 95",
"UninstallString",
},
// Shareware version
{
HKEY_LOCAL_MACHINE,
SOFTWARE_KEY "\\Microsoft\\Windows\\CurrentVersion\\"
"Uninstall\\Doom Shareware for Windows 95",
"UninstallString",
},
};
// Value installed by the Collector's Edition when it is installed
static registry_value_t collectors_edition_value =
{
HKEY_LOCAL_MACHINE,
SOFTWARE_KEY "\\Activision\\DOOM Collector's Edition\\v1.0",
"INSTALLPATH",
};
// Subdirectories of the above install path, where IWADs are installed.
static char *collectors_edition_subdirs[] =
{
"Doom2",
"Final Doom",
"Ultimate Doom",
};
// Location where Steam is installed
static registry_value_t steam_install_location =
{
HKEY_LOCAL_MACHINE,
SOFTWARE_KEY "\\Valve\\Steam",
"InstallPath",
};
// Subdirs of the steam install directory where IWADs are found
static char *steam_install_subdirs[] =
{
"steamapps\\common\\doom 2\\base",
"steamapps\\common\\final doom\\base",
"steamapps\\common\\ultimate doom\\base",
"steamapps\\common\\heretic shadow of the serpent riders\\base",
"steamapps\\common\\hexen\\base",
"steamapps\\common\\hexen deathkings of the dark citadel\\base",
// From Doom 3: BFG Edition:
"steamapps\\common\\DOOM 3 BFG Edition\\base\\wads",
};
#define STEAM_BFG_GUS_PATCHES \
"steamapps\\common\\DOOM 3 BFG Edition\\base\\classicmusic\\instruments"
static char *GetRegistryString(registry_value_t *reg_val)
{
HKEY key;
DWORD len;
DWORD valtype;
char *result;
// Open the key (directory where the value is stored)
if (RegOpenKeyEx(reg_val->root, reg_val->path,
0, KEY_READ, &key) != ERROR_SUCCESS)
{
return NULL;
}
result = NULL;
// Find the type and length of the string, and only accept strings.
if (RegQueryValueEx(key, reg_val->value,
NULL, &valtype, NULL, &len) == ERROR_SUCCESS
&& valtype == REG_SZ)
{
// Allocate a buffer for the value and read the value
result = malloc(len);
if (RegQueryValueEx(key, reg_val->value, NULL, &valtype,
(unsigned char *) result, &len) != ERROR_SUCCESS)
{
free(result);
result = NULL;
}
}
// Close the key
RegCloseKey(key);
return result;
}
// Check for the uninstall strings from the CD versions
static void CheckUninstallStrings(void)
{
unsigned int i;
for (i=0; i<arrlen(uninstall_values); ++i)
{
char *val;
char *path;
char *unstr;
val = GetRegistryString(&uninstall_values[i]);
if (val == NULL)
{
continue;
}
unstr = strstr(val, UNINSTALLER_STRING);
if (unstr == NULL)
{
free(val);
}
else
{
path = unstr + strlen(UNINSTALLER_STRING);
AddIWADDir(path);
}
}
}
// Check for Doom: Collector's Edition
static void CheckCollectorsEdition(void)
{
char *install_path;
char *subpath;
unsigned int i;
install_path = GetRegistryString(&collectors_edition_value);
if (install_path == NULL)
{
return;
}
for (i=0; i<arrlen(collectors_edition_subdirs); ++i)
{
subpath = M_StringJoin(install_path, DIR_SEPARATOR_S,
collectors_edition_subdirs[i], NULL);
AddIWADDir(subpath);
}
free(install_path);
}
// Check for Doom downloaded via Steam
static void CheckSteamEdition(void)
{
char *install_path;
char *subpath;
size_t i;
install_path = GetRegistryString(&steam_install_location);
if (install_path == NULL)
{
return;
}
for (i=0; i<arrlen(steam_install_subdirs); ++i)
{
subpath = M_StringJoin(install_path, DIR_SEPARATOR_S,
steam_install_subdirs[i], NULL);
AddIWADDir(subpath);
}
free(install_path);
}
// The BFG edition ships with a full set of GUS patches. If we find them,
// we can autoconfigure to use them.
static void CheckSteamGUSPatches(void)
{
const char *current_path;
char *install_path;
char *patch_path;
int len;
// Already configured? Don't stomp on the user's choices.
current_path = M_GetStrVariable("gus_patch_path");
if (current_path != NULL && strlen(current_path) > 0)
{
return;
}
install_path = GetRegistryString(&steam_install_location);
if (install_path == NULL)
{
return;
}
len = strlen(install_path) + strlen(STEAM_BFG_GUS_PATCHES) + 20;
patch_path = malloc(len);
M_snprintf(patch_path, len, "%s\\%s\\ACBASS.PAT",
install_path, STEAM_BFG_GUS_PATCHES);
// Does acbass.pat exist? If so, then set gus_patch_path.
if (M_FileExists(patch_path))
{
M_snprintf(patch_path, len, "%s\\%s",
install_path, STEAM_BFG_GUS_PATCHES);
M_SetVariable("gus_patch_path", patch_path);
}
free(patch_path);
free(install_path);
}
// Default install directories for DOS Doom
static void CheckDOSDefaults(void)
{
// These are the default install directories used by the deice
// installer program:
AddIWADDir("\\doom2"); // Doom II
AddIWADDir("\\plutonia"); // Final Doom
AddIWADDir("\\tnt");
AddIWADDir("\\doom_se"); // Ultimate Doom
AddIWADDir("\\doom"); // Shareware / Registered Doom
AddIWADDir("\\dooms"); // Shareware versions
AddIWADDir("\\doomsw");
AddIWADDir("\\heretic"); // Heretic
AddIWADDir("\\hrtic_se"); // Heretic Shareware from Quake disc
AddIWADDir("\\hexen"); // Hexen
AddIWADDir("\\hexendk"); // Hexen Deathkings of the Dark Citadel
AddIWADDir("\\strife"); // Strife
}
#endif
// Returns true if the specified path is a path to a file
// of the specified name.
static boolean DirIsFile(char *path, char *filename)
{
size_t path_len;
size_t filename_len;
path_len = strlen(path);
filename_len = strlen(filename);
return path_len >= filename_len + 1
&& path[path_len - filename_len - 1] == DIR_SEPARATOR
&& !strcasecmp(&path[path_len - filename_len], filename);
}
// Check if the specified directory contains the specified IWAD
// file, returning the full path to the IWAD if found, or NULL
// if not found.
static char *CheckDirectoryHasIWAD(char *dir, char *iwadname)
{
char *filename;
// As a special case, the "directory" may refer directly to an
// IWAD file if the path comes from DOOMWADDIR or DOOMWADPATH.
if (DirIsFile(dir, iwadname) && M_FileExists(dir))
{
return strdup(dir);
}
// Construct the full path to the IWAD if it is located in
// this directory, and check if it exists.
if (!strcmp(dir, "."))
{
filename = strdup(iwadname);
}
else
{
filename = M_StringJoin(dir, DIR_SEPARATOR_S, iwadname, NULL);
}
if (M_FileExists(filename))
{
return filename;
}
free(filename);
return NULL;
}
// Search a directory to try to find an IWAD
// Returns the location of the IWAD if found, otherwise NULL.
static char *SearchDirectoryForIWAD(char *dir, int mask, GameMission_t *mission)
{
char *filename;
size_t i;
for (i=0; i<arrlen(iwads); ++i)
{
if (((1 << iwads[i].mission) & mask) == 0)
{
continue;
}
filename = CheckDirectoryHasIWAD(dir, DEH_String(iwads[i].name));
if (filename != NULL)
{
*mission = iwads[i].mission;
return filename;
}
}
return NULL;
}
// When given an IWAD with the '-iwad' parameter,
// attempt to identify it by its name.
static GameMission_t IdentifyIWADByName(char *name, int mask)
{
size_t i;
GameMission_t mission;
char *p;
p = strrchr(name, DIR_SEPARATOR);
if (p != NULL)
{
name = p + 1;
}
mission = none;
for (i=0; i<arrlen(iwads); ++i)
{
// Check if the filename is this IWAD name.
// Only use supported missions:
if (((1 << iwads[i].mission) & mask) == 0)
continue;
// Check if it ends in this IWAD name.
if (!strcasecmp(name, iwads[i].name))
{
mission = iwads[i].mission;
break;
}
}
return mission;
}
#if ORIGCODE
//
// Add directories from the list in the DOOMWADPATH environment variable.
//
static void AddDoomWadPath(void)
{
char *doomwadpath;
char *p;
// Check the DOOMWADPATH environment variable.
doomwadpath = getenv("DOOMWADPATH");
if (doomwadpath == NULL)
{
return;
}
doomwadpath = strdup(doomwadpath);
// Add the initial directory
AddIWADDir(doomwadpath);
// Split into individual dirs within the list.
p = doomwadpath;
for (;;)
{
p = strchr(p, PATH_SEPARATOR);
if (p != NULL)
{
// Break at the separator and store the right hand side
// as another iwad dir
*p = '\0';
p += 1;
AddIWADDir(p);
}
else
{
break;
}
}
}
#endif
//
// Build a list of IWAD files
//
static void BuildIWADDirList(void)
{
#if ORIGCODE
char *doomwaddir;
if (iwad_dirs_built)
{
return;
}
// Look in the current directory. Doom always does this.
AddIWADDir(".");
// Add DOOMWADDIR if it is in the environment
doomwaddir = getenv("DOOMWADDIR");
if (doomwaddir != NULL)
{
AddIWADDir(doomwaddir);
}
// Add dirs from DOOMWADPATH
AddDoomWadPath();
#ifdef _WIN32
// Search the registry and find where IWADs have been installed.
CheckUninstallStrings();
CheckCollectorsEdition();
CheckSteamEdition();
CheckDOSDefaults();
// Check for GUS patches installed with the BFG edition!
CheckSteamGUSPatches();
#else
// Standard places where IWAD files are installed under Unix.
AddIWADDir("/usr/share/games/doom");
AddIWADDir("/usr/local/share/games/doom");
#endif
#else
AddIWADDir (FILES_DIR);
// Don't run this function again.
iwad_dirs_built = true;
#endif
}
//
// Searches WAD search paths for an WAD with a specific filename.
//
char *D_FindWADByName(char *name)
{
char *path;
int i;
// Absolute path?
if (M_FileExists(name))
{
return name;
}
BuildIWADDirList();
// Search through all IWAD paths for a file with the given name.
for (i=0; i<num_iwad_dirs; ++i)
{
// As a special case, if this is in DOOMWADDIR or DOOMWADPATH,
// the "directory" may actually refer directly to an IWAD
// file.
if (DirIsFile(iwad_dirs[i], name) && M_FileExists(iwad_dirs[i]))
{
return strdup(iwad_dirs[i]);
}
// Construct a string for the full path
path = M_StringJoin(iwad_dirs[i], DIR_SEPARATOR_S, name, NULL);
if (M_FileExists(path))
{
return path;
}
free(path);
}
// File not found
return NULL;
}
//
// D_TryWADByName
//
// Searches for a WAD by its filename, or passes through the filename
// if not found.
//
char *D_TryFindWADByName(char *filename)
{
char *result;
result = D_FindWADByName(filename);
if (result != NULL)
{
return result;
}
else
{
return filename;
}
}
//
// FindIWAD
// Checks availability of IWAD files by name,
// to determine whether registered/commercial features
// should be executed (notably loading PWADs).
//
char *D_FindIWAD(int mask, GameMission_t *mission)
{
char *result;
char *iwadfile;
int iwadparm;
int i;
// Check for the -iwad parameter
//!
// Specify an IWAD file to use.
//
// @arg <file>
//
iwadparm = M_CheckParmWithArgs("-iwad", 1);
if (iwadparm)
{
// Search through IWAD dirs for an IWAD with the given name.
iwadfile = myargv[iwadparm + 1];
result = D_FindWADByName(iwadfile);
if (result == NULL)
{
I_Error("IWAD file '%s' not found!", iwadfile);
}
*mission = IdentifyIWADByName(result, mask);
}
else
{
// Search through the list and look for an IWAD
result = NULL;
BuildIWADDirList();
for (i=0; result == NULL && i<num_iwad_dirs; ++i)
{
result = SearchDirectoryForIWAD(iwad_dirs[i], mask, mission);
}
}
return result;
}
// Find all IWADs in the IWAD search path matching the given mask.
const iwad_t **D_FindAllIWADs(int mask)
{
const iwad_t **result;
int result_len;
char *filename;
int i;
result = malloc(sizeof(iwad_t *) * (arrlen(iwads) + 1));
result_len = 0;
// Try to find all IWADs
for (i=0; i<arrlen(iwads); ++i)
{
if (((1 << iwads[i].mission) & mask) == 0)
{
continue;
}
filename = D_FindWADByName(iwads[i].name);
if (filename != NULL)
{
result[result_len] = &iwads[i];
++result_len;
}
}
// End of list
result[result_len] = NULL;
return result;
}
//
// Get the IWAD name used for savegames.
//
char *D_SaveGameIWADName(GameMission_t gamemission)
{
size_t i;
// Determine the IWAD name to use for savegames.
// This determines the directory the savegame files get put into.
//
// Note that we match on gamemission rather than on IWAD name.
// This ensures that doom1.wad and doom.wad saves are stored
// in the same place.
for (i=0; i<arrlen(iwads); ++i)
{
if (gamemission == iwads[i].mission)
{
return iwads[i].name;
}
}
// Default fallback:
return "unknown.wad";
}
char *D_SuggestIWADName(GameMission_t mission, GameMode_t mode)
{
int i;
for (i = 0; i < arrlen(iwads); ++i)
{
if (iwads[i].mission == mission && iwads[i].mode == mode)
{
return iwads[i].name;
}
}
return "unknown.wad";
}
char *D_SuggestGameName(GameMission_t mission, GameMode_t mode)
{
int i;
for (i = 0; i < arrlen(iwads); ++i)
{
if (iwads[i].mission == mission
&& (mode == indetermined || iwads[i].mode == mode))
{
return iwads[i].description;
}
}
return "Unknown game?";
}

52
frosted-doom/d_iwad.h Normal file
View File

@ -0,0 +1,52 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Find IWAD and initialize according to IWAD type.
//
#ifndef __D_IWAD__
#define __D_IWAD__
#include "d_mode.h"
#define IWAD_MASK_DOOM ((1 << doom) \
| (1 << doom2) \
| (1 << pack_tnt) \
| (1 << pack_plut) \
| (1 << pack_chex) \
| (1 << pack_hacx))
#define IWAD_MASK_HERETIC (1 << heretic)
#define IWAD_MASK_HEXEN (1 << hexen)
#define IWAD_MASK_STRIFE (1 << strife)
typedef struct
{
char *name;
GameMission_t mission;
GameMode_t mode;
char *description;
} iwad_t;
char *D_FindWADByName(char *filename);
char *D_TryFindWADByName(char *filename);
char *D_FindIWAD(int mask, GameMission_t *mission);
const iwad_t **D_FindAllIWADs(int mask);
char *D_SaveGameIWADName(GameMission_t gamemission);
char *D_SuggestIWADName(GameMission_t mission, GameMode_t mode);
char *D_SuggestGameName(GameMission_t mission, GameMode_t mode);
void D_CheckCorrectIWAD(GameMission_t mission);
#endif

826
frosted-doom/d_loop.c Normal file
View File

@ -0,0 +1,826 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Main loop code.
//
#include <stdlib.h>
#include <string.h>
#include "doomfeatures.h"
#include "d_event.h"
#include "d_loop.h"
#include "d_ticcmd.h"
#include "i_system.h"
#include "i_timer.h"
#include "i_video.h"
#include "m_argv.h"
#include "m_fixed.h"
#include "net_client.h"
#include "net_gui.h"
#include "net_io.h"
#include "net_query.h"
#include "net_server.h"
#include "net_sdl.h"
#include "net_loop.h"
// The complete set of data for a particular tic.
typedef struct
{
ticcmd_t cmds[NET_MAXPLAYERS];
boolean ingame[NET_MAXPLAYERS];
} ticcmd_set_t;
//
// gametic is the tic about to (or currently being) run
// maketic is the tic that hasn't had control made for it yet
// recvtic is the latest tic received from the server.
//
// a gametic cannot be run until ticcmds are received for it
// from all players.
//
static ticcmd_set_t ticdata[BACKUPTICS];
// The index of the next tic to be made (with a call to BuildTiccmd).
static int maketic;
// The number of complete tics received from the server so far.
static int recvtic;
// The number of tics that have been run (using RunTic) so far.
int gametic;
// When set to true, a single tic is run each time TryRunTics() is called.
// This is used for -timedemo mode.
boolean singletics = false;
// Index of the local player.
static int localplayer;
// Used for original sync code.
static int skiptics = 0;
// Reduce the bandwidth needed by sampling game input less and transmitting
// less. If ticdup is 2, sample half normal, 3 = one third normal, etc.
int ticdup;
// Amount to offset the timer for game sync.
fixed_t offsetms;
// Use new client syncronisation code
static boolean new_sync = true;
// Callback functions for loop code.
static loop_interface_t *loop_interface = NULL;
// Current players in the multiplayer game.
// This is distinct from playeringame[] used by the game code, which may
// modify playeringame[] when playing back multiplayer demos.
static boolean local_playeringame[NET_MAXPLAYERS];
// Requested player class "sent" to the server on connect.
// If we are only doing a single player game then this needs to be remembered
// and saved in the game settings.
static int player_class;
// 35 fps clock adjusted by offsetms milliseconds
static int GetAdjustedTime(void)
{
int time_ms;
time_ms = I_GetTimeMS();
if (new_sync)
{
// Use the adjustments from net_client.c only if we are
// using the new sync mode.
time_ms += (offsetms / FRACUNIT);
}
return (time_ms * TICRATE) / 1000;
}
static boolean BuildNewTic(void)
{
int gameticdiv;
ticcmd_t cmd;
gameticdiv = gametic/ticdup;
I_StartTic ();
loop_interface->ProcessEvents();
// Always run the menu
loop_interface->RunMenu();
if (drone)
{
// In drone mode, do not generate any ticcmds.
return false;
}
if (new_sync)
{
// If playing single player, do not allow tics to buffer
// up very far
if (!net_client_connected && maketic - gameticdiv > 2)
return false;
// Never go more than ~200ms ahead
if (maketic - gameticdiv > 8)
return false;
}
else
{
if (maketic - gameticdiv >= 5)
return false;
}
//printf ("mk:%i ",maketic);
memset(&cmd, 0, sizeof(ticcmd_t));
loop_interface->BuildTiccmd(&cmd, maketic);
#ifdef FEATURE_MULTIPLAYER
if (net_client_connected)
{
NET_CL_SendTiccmd(&cmd, maketic);
}
#endif
ticdata[maketic % BACKUPTICS].cmds[localplayer] = cmd;
ticdata[maketic % BACKUPTICS].ingame[localplayer] = true;
++maketic;
return true;
}
//
// NetUpdate
// Builds ticcmds for console player,
// sends out a packet
//
int lasttime;
void NetUpdate (void)
{
int nowtime;
int newtics;
int i;
// If we are running with singletics (timing a demo), this
// is all done separately.
if (singletics)
return;
#ifdef FEATURE_MULTIPLAYER
// Run network subsystems
NET_CL_Run();
NET_SV_Run();
#endif
// check time
nowtime = GetAdjustedTime() / ticdup;
newtics = nowtime - lasttime;
lasttime = nowtime;
if (skiptics <= newtics)
{
newtics -= skiptics;
skiptics = 0;
}
else
{
skiptics -= newtics;
newtics = 0;
}
// build new ticcmds for console player
for (i=0 ; i<newtics ; i++)
{
if (!BuildNewTic())
{
break;
}
}
}
static void D_Disconnected(void)
{
// In drone mode, the game cannot continue once disconnected.
if (drone)
{
I_Error("Disconnected from server in drone mode.");
}
// disconnected from server
printf("Disconnected from server.\n");
}
//
// Invoked by the network engine when a complete set of ticcmds is
// available.
//
void D_ReceiveTic(ticcmd_t *ticcmds, boolean *players_mask)
{
int i;
// Disconnected from server?
if (ticcmds == NULL && players_mask == NULL)
{
D_Disconnected();
return;
}
for (i = 0; i < NET_MAXPLAYERS; ++i)
{
if (!drone && i == localplayer)
{
// This is us. Don't overwrite it.
}
else
{
ticdata[recvtic % BACKUPTICS].cmds[i] = ticcmds[i];
ticdata[recvtic % BACKUPTICS].ingame[i] = players_mask[i];
}
}
++recvtic;
}
//
// Start game loop
//
// Called after the screen is set but before the game starts running.
//
void D_StartGameLoop(void)
{
lasttime = GetAdjustedTime() / ticdup;
}
#if ORIGCODE
//
// Block until the game start message is received from the server.
//
static void BlockUntilStart(net_gamesettings_t *settings,
netgame_startup_callback_t callback)
{
while (!NET_CL_GetSettings(settings))
{
NET_CL_Run();
NET_SV_Run();
if (!net_client_connected)
{
I_Error("Lost connection to server");
}
if (callback != NULL && !callback(net_client_wait_data.ready_players,
net_client_wait_data.num_players))
{
I_Error("Netgame startup aborted.");
}
I_Sleep(100);
}
}
#endif
void D_StartNetGame(net_gamesettings_t *settings,
netgame_startup_callback_t callback)
{
#if ORIGCODE
int i;
offsetms = 0;
recvtic = 0;
settings->consoleplayer = 0;
settings->num_players = 1;
settings->player_classes[0] = player_class;
//!
// @category net
//
// Use new network client sync code rather than the classic
// sync code. This is currently disabled by default because it
// has some bugs.
//
if (M_CheckParm("-newsync") > 0)
settings->new_sync = 1;
else
settings->new_sync = 0;
// TODO: New sync code is not enabled by default because it's
// currently broken.
//if (M_CheckParm("-oldsync") > 0)
// settings->new_sync = 0;
//else
// settings->new_sync = 1;
//!
// @category net
// @arg <n>
//
// Send n extra tics in every packet as insurance against dropped
// packets.
//
i = M_CheckParmWithArgs("-extratics", 1);
if (i > 0)
settings->extratics = atoi(myargv[i+1]);
else
settings->extratics = 1;
//!
// @category net
// @arg <n>
//
// Reduce the resolution of the game by a factor of n, reducing
// the amount of network bandwidth needed.
//
i = M_CheckParmWithArgs("-dup", 1);
if (i > 0)
settings->ticdup = atoi(myargv[i+1]);
else
settings->ticdup = 1;
if (net_client_connected)
{
// Send our game settings and block until game start is received
// from the server.
NET_CL_StartGame(settings);
BlockUntilStart(settings, callback);
// Read the game settings that were received.
NET_CL_GetSettings(settings);
}
if (drone)
{
settings->consoleplayer = 0;
}
// Set the local player and playeringame[] values.
localplayer = settings->consoleplayer;
for (i = 0; i < NET_MAXPLAYERS; ++i)
{
local_playeringame[i] = i < settings->num_players;
}
// Copy settings to global variables.
ticdup = settings->ticdup;
new_sync = settings->new_sync;
// TODO: Message disabled until we fix new_sync.
//if (!new_sync)
//{
// printf("Syncing netgames like Vanilla Doom.\n");
//}
#else
settings->consoleplayer = 0;
settings->num_players = 1;
settings->player_classes[0] = player_class;
settings->new_sync = 0;
settings->extratics = 1;
settings->ticdup = 1;
ticdup = settings->ticdup;
new_sync = settings->new_sync;
#endif
}
boolean D_InitNetGame(net_connect_data_t *connect_data)
{
boolean result = false;
#ifdef FEATURE_MULTIPLAYER
net_addr_t *addr = NULL;
int i;
#endif
// Call D_QuitNetGame on exit:
I_AtExit(D_QuitNetGame, true);
player_class = connect_data->player_class;
#ifdef FEATURE_MULTIPLAYER
//!
// @category net
//
// Start a multiplayer server, listening for connections.
//
if (M_CheckParm("-server") > 0
|| M_CheckParm("-privateserver") > 0)
{
NET_SV_Init();
NET_SV_AddModule(&net_loop_server_module);
NET_SV_AddModule(&net_sdl_module);
NET_SV_RegisterWithMaster();
net_loop_client_module.InitClient();
addr = net_loop_client_module.ResolveAddress(NULL);
}
else
{
//!
// @category net
//
// Automatically search the local LAN for a multiplayer
// server and join it.
//
i = M_CheckParm("-autojoin");
if (i > 0)
{
addr = NET_FindLANServer();
if (addr == NULL)
{
I_Error("No server found on local LAN");
}
}
//!
// @arg <address>
// @category net
//
// Connect to a multiplayer server running on the given
// address.
//
i = M_CheckParmWithArgs("-connect", 1);
if (i > 0)
{
net_sdl_module.InitClient();
addr = net_sdl_module.ResolveAddress(myargv[i+1]);
if (addr == NULL)
{
I_Error("Unable to resolve '%s'\n", myargv[i+1]);
}
}
}
if (addr != NULL)
{
if (M_CheckParm("-drone") > 0)
{
connect_data->drone = true;
}
if (!NET_CL_Connect(addr, connect_data))
{
I_Error("D_InitNetGame: Failed to connect to %s\n",
NET_AddrToString(addr));
}
printf("D_InitNetGame: Connected to %s\n", NET_AddrToString(addr));
// Wait for launch message received from server.
NET_WaitForLaunch();
result = true;
}
#endif
return result;
}
//
// D_QuitNetGame
// Called before quitting to leave a net game
// without hanging the other players
//
void D_QuitNetGame (void)
{
#ifdef FEATURE_MULTIPLAYER
NET_SV_Shutdown();
NET_CL_Disconnect();
#endif
}
static int GetLowTic(void)
{
int lowtic;
lowtic = maketic;
#ifdef FEATURE_MULTIPLAYER
if (net_client_connected)
{
if (drone || recvtic < lowtic)
{
lowtic = recvtic;
}
}
#endif
return lowtic;
}
static int frameon;
static int frameskip[4];
static int oldnettics;
static void OldNetSync(void)
{
unsigned int i;
int keyplayer = -1;
frameon++;
// ideally maketic should be 1 - 3 tics above lowtic
// if we are consistantly slower, speed up time
for (i=0 ; i<NET_MAXPLAYERS ; i++)
{
if (local_playeringame[i])
{
keyplayer = i;
break;
}
}
if (keyplayer < 0)
{
// If there are no players, we can never advance anyway
return;
}
if (localplayer == keyplayer)
{
// the key player does not adapt
}
else
{
if (maketic <= recvtic)
{
lasttime--;
// printf ("-");
}
frameskip[frameon & 3] = oldnettics > recvtic;
oldnettics = maketic;
if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
{
skiptics = 1;
// printf ("+");
}
}
}
// Returns true if there are players in the game:
static boolean PlayersInGame(void)
{
boolean result = false;
unsigned int i;
// If we are connected to a server, check if there are any players
// in the game.
if (net_client_connected)
{
for (i = 0; i < NET_MAXPLAYERS; ++i)
{
result = result || local_playeringame[i];
}
}
// Whether single or multi-player, unless we are running as a drone,
// we are in the game.
if (!drone)
{
result = true;
}
return result;
}
// When using ticdup, certain values must be cleared out when running
// the duplicate ticcmds.
static void TicdupSquash(ticcmd_set_t *set)
{
ticcmd_t *cmd;
unsigned int i;
for (i = 0; i < NET_MAXPLAYERS ; ++i)
{
cmd = &set->cmds[i];
cmd->chatchar = 0;
if (cmd->buttons & BT_SPECIAL)
cmd->buttons = 0;
}
}
// When running in single player mode, clear all the ingame[] array
// except the local player.
static void SinglePlayerClear(ticcmd_set_t *set)
{
unsigned int i;
for (i = 0; i < NET_MAXPLAYERS; ++i)
{
if (i != localplayer)
{
set->ingame[i] = false;
}
}
}
//
// TryRunTics
//
void TryRunTics (void)
{
int i;
int lowtic;
int entertic;
static int oldentertics;
int realtics;
int availabletics;
int counts;
// get real tics
entertic = I_GetTime() / ticdup;
realtics = entertic - oldentertics;
oldentertics = entertic;
// in singletics mode, run a single tic every time this function
// is called.
if (singletics)
{
BuildNewTic();
}
else
{
NetUpdate ();
}
lowtic = GetLowTic();
availabletics = lowtic - gametic/ticdup;
// decide how many tics to run
if (new_sync)
{
counts = availabletics;
}
else
{
// decide how many tics to run
if (realtics < availabletics-1)
counts = realtics+1;
else if (realtics < availabletics)
counts = realtics;
else
counts = availabletics;
if (counts < 1)
counts = 1;
if (net_client_connected)
{
OldNetSync();
}
}
if (counts < 1)
counts = 1;
// wait for new tics if needed
while (!PlayersInGame() || lowtic < gametic/ticdup + counts)
{
NetUpdate ();
lowtic = GetLowTic();
if (lowtic < gametic/ticdup)
I_Error ("TryRunTics: lowtic < gametic");
// Don't stay in this loop forever. The menu is still running,
// so return to update the screen
if (I_GetTime() / ticdup - entertic > 0)
{
return;
}
I_Sleep(1);
}
// run the count * ticdup dics
while (counts--)
{
ticcmd_set_t *set;
if (!PlayersInGame())
{
return;
}
set = &ticdata[(gametic / ticdup) % BACKUPTICS];
if (!net_client_connected)
{
SinglePlayerClear(set);
}
for (i=0 ; i<ticdup ; i++)
{
if (gametic/ticdup > lowtic)
I_Error ("gametic>lowtic");
memcpy(local_playeringame, set->ingame, sizeof(local_playeringame));
loop_interface->RunTic(set->cmds, set->ingame);
gametic++;
// modify command for duplicated tics
TicdupSquash(set);
}
NetUpdate (); // check for new console commands
}
}
void D_RegisterLoopCallbacks(loop_interface_t *i)
{
loop_interface = i;
}

81
frosted-doom/d_loop.h Normal file
View File

@ -0,0 +1,81 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Main loop stuff.
//
#ifndef __D_LOOP__
#define __D_LOOP__
#include "net_defs.h"
// Callback function invoked while waiting for the netgame to start.
// The callback is invoked when new players are ready. The callback
// should return true, or return false to abort startup.
typedef boolean (*netgame_startup_callback_t)(int ready_players,
int num_players);
typedef struct
{
// Read events from the event queue, and process them.
void (*ProcessEvents)();
// Given the current input state, fill in the fields of the specified
// ticcmd_t structure with data for a new tic.
void (*BuildTiccmd)(ticcmd_t *cmd, int maketic);
// Advance the game forward one tic, using the specified player input.
void (*RunTic)(ticcmd_t *cmds, boolean *ingame);
// Run the menu (runs independently of the game).
void (*RunMenu)();
} loop_interface_t;
// Register callback functions for the main loop code to use.
void D_RegisterLoopCallbacks(loop_interface_t *i);
// Create any new ticcmds and broadcast to other players.
void NetUpdate (void);
// Broadcasts special packets to other players
// to notify of game exit
void D_QuitNetGame (void);
//? how many ticks to run?
void TryRunTics (void);
// Called at start of game loop to initialize timers
void D_StartGameLoop(void);
// Initialize networking code and connect to server.
boolean D_InitNetGame(net_connect_data_t *connect_data);
// Start game with specified settings. The structure will be updated
// with the actual settings for the game.
void D_StartNetGame(net_gamesettings_t *settings,
netgame_startup_callback_t callback);
extern boolean singletics;
extern int gametic, ticdup;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,56 +1,33 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __D_MAIN__
#define __D_MAIN__
#include "d_event.h"
#ifdef __GNUG__
#pragma interface
#endif
#include "doomdef.h"
#define MAXWADFILES 20
extern char* wadfiles[MAXWADFILES];
void D_AddFile (char *file);
//
// D_DoomMain()
// Not a globally visible function, just included for source reference,
// calls all startup code, parses command line options.
// If not overrided by user input, calls N_AdvanceDemo.
//
void D_DoomMain (void);
// Called by IO functions when input is detected.
void D_PostEvent (event_t* ev);
// Read events from all input devices
void D_ProcessEvents (void);
//
@ -59,6 +36,15 @@ void D_PostEvent (event_t* ev);
void D_PageTicker (void);
void D_PageDrawer (void);
void D_AdvanceDemo (void);
void D_DoAdvanceDemo (void);
void D_StartTitle (void);
//
// GLOBAL VARIABLES
//
extern gameaction_t gameaction;
#endif

209
frosted-doom/d_mode.c Normal file
View File

@ -0,0 +1,209 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// DESCRIPTION:
// Functions and definitions relating to the game type and operational
// mode.
//
#include "doomtype.h"
#include "d_mode.h"
// Valid game mode/mission combinations, with the number of
// episodes/maps for each.
static struct
{
GameMission_t mission;
GameMode_t mode;
int episode;
int map;
} valid_modes[] = {
{ pack_chex, shareware, 1, 5 },
{ doom, shareware, 1, 9 },
{ doom, registered, 3, 9 },
{ doom, retail, 4, 9 },
{ doom2, commercial, 1, 32 },
{ pack_tnt, commercial, 1, 32 },
{ pack_plut, commercial, 1, 32 },
{ pack_hacx, commercial, 1, 32 },
{ heretic, shareware, 1, 9 },
{ heretic, registered, 3, 9 },
{ heretic, retail, 5, 9 },
{ hexen, commercial, 1, 60 },
{ strife, commercial, 1, 34 },
};
// Check that a gamemode+gamemission received over the network is valid.
boolean D_ValidGameMode(GameMission_t mission, GameMode_t mode)
{
int i;
for (i=0; i<arrlen(valid_modes); ++i)
{
if (valid_modes[i].mode == mode && valid_modes[i].mission == mission)
{
return true;
}
}
return false;
}
boolean D_ValidEpisodeMap(GameMission_t mission, GameMode_t mode,
int episode, int map)
{
int i;
// Hacks for Heretic secret episodes
if (mission == heretic)
{
if (mode == retail && episode == 6)
{
return map >= 1 && map <= 3;
}
else if (mode == registered && episode == 4)
{
return map == 1;
}
}
// Find the table entry for this mission/mode combination.
for (i=0; i<arrlen(valid_modes); ++i)
{
if (mission == valid_modes[i].mission
&& mode == valid_modes[i].mode)
{
return episode >= 1 && episode <= valid_modes[i].episode
&& map >= 1 && map <= valid_modes[i].map;
}
}
// Unknown mode/mission combination
return false;
}
// Get the number of valid episodes for the specified mission/mode.
int D_GetNumEpisodes(GameMission_t mission, GameMode_t mode)
{
int episode;
episode = 1;
while (D_ValidEpisodeMap(mission, mode, episode, 1))
{
++episode;
}
return episode - 1;
}
// Table of valid versions
static struct {
GameMission_t mission;
GameVersion_t version;
} valid_versions[] = {
{ doom, exe_doom_1_9 },
{ doom, exe_hacx },
{ doom, exe_ultimate },
{ doom, exe_final },
{ doom, exe_final2 },
{ doom, exe_chex },
{ heretic, exe_heretic_1_3 },
{ hexen, exe_hexen_1_1 },
{ strife, exe_strife_1_2 },
{ strife, exe_strife_1_31 },
};
boolean D_ValidGameVersion(GameMission_t mission, GameVersion_t version)
{
int i;
// All Doom variants can use the Doom versions.
if (mission == doom2 || mission == pack_plut || mission == pack_tnt
|| mission == pack_hacx || mission == pack_chex)
{
mission = doom;
}
for (i=0; i<arrlen(valid_versions); ++i)
{
if (valid_versions[i].mission == mission
&& valid_versions[i].version == version)
{
return true;
}
}
return false;
}
// Does this mission type use ExMy form, rather than MAPxy form?
boolean D_IsEpisodeMap(GameMission_t mission)
{
switch (mission)
{
case doom:
case heretic:
case pack_chex:
return true;
case none:
case hexen:
case doom2:
case pack_hacx:
case pack_tnt:
case pack_plut:
case strife:
default:
return false;
}
}
char *D_GameMissionString(GameMission_t mission)
{
switch (mission)
{
case none:
default:
return "none";
case doom:
return "doom";
case doom2:
return "doom2";
case pack_tnt:
return "tnt";
case pack_plut:
return "plutonia";
case pack_hacx:
return "hacx";
case pack_chex:
return "chex";
case heretic:
return "heretic";
case hexen:
return "hexen";
case strife:
return "strife";
}
}

98
frosted-doom/d_mode.h Normal file
View File

@ -0,0 +1,98 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Functions and definitions relating to the game type and operational
// mode.
//
#ifndef __D_MODE__
#define __D_MODE__
#include "doomtype.h"
// The "mission" controls what game we are playing.
typedef enum
{
doom, // Doom 1
doom2, // Doom 2
pack_tnt, // Final Doom: TNT: Evilution
pack_plut, // Final Doom: The Plutonia Experiment
pack_chex, // Chex Quest (modded doom)
pack_hacx, // Hacx (modded doom2)
heretic, // Heretic
hexen, // Hexen
strife, // Strife
none
} GameMission_t;
// The "mode" allows more accurate specification of the game mode we are
// in: eg. shareware vs. registered. So doom1.wad and doom.wad are the
// same mission, but a different mode.
typedef enum
{
shareware, // Doom/Heretic shareware
registered, // Doom/Heretic registered
commercial, // Doom II/Hexen
retail, // Ultimate Doom
indetermined // Unknown.
} GameMode_t;
// What version are we emulating?
typedef enum
{
exe_doom_1_2, // Doom 1.2: shareware and registered
exe_doom_1_666, // Doom 1.666: for shareware, registered and commercial
exe_doom_1_7, // Doom 1.7/1.7a: "
exe_doom_1_8, // Doom 1.8: "
exe_doom_1_9, // Doom 1.9: "
exe_hacx, // Hacx
exe_ultimate, // Ultimate Doom (retail)
exe_final, // Final Doom
exe_final2, // Final Doom (alternate exe)
exe_chex, // Chex Quest executable (based on Final Doom)
exe_heretic_1_3, // Heretic 1.3
exe_hexen_1_1, // Hexen 1.1
exe_strife_1_2, // Strife v1.2
exe_strife_1_31 // Strife v1.31
} GameVersion_t;
// Skill level.
typedef enum
{
sk_noitems = -1, // the "-skill 0" hack
sk_baby = 0,
sk_easy,
sk_medium,
sk_hard,
sk_nightmare
} skill_t;
boolean D_ValidGameMode(GameMission_t mission, GameMode_t mode);
boolean D_ValidGameVersion(GameMission_t mission, GameVersion_t version);
boolean D_ValidEpisodeMap(GameMission_t mission, GameMode_t mode,
int episode, int map);
int D_GetNumEpisodes(GameMission_t mission, GameMode_t mode);
boolean D_IsEpisodeMap(GameMission_t mission);
char *D_GameMissionString(GameMission_t mission);
#endif /* #ifndef __D_MODE__ */

View File

@ -1,548 +1,235 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// DOOM Network game communication and protocol,
// all OS independend parts.
//
//-----------------------------------------------------------------------------
#include <stdlib.h>
static const char rcsid[] = "$Id: d_net.c,v 1.3 1997/02/03 22:01:47 b1 Exp $";
#include "doomfeatures.h"
#include "d_main.h"
#include "m_argv.h"
#include "m_menu.h"
#include "m_misc.h"
#include "i_system.h"
#include "i_timer.h"
#include "i_video.h"
#include "i_net.h"
#include "g_game.h"
#include "doomdef.h"
#include "doomstat.h"
#include "w_checksum.h"
#include "w_wad.h"
#define NCMD_EXIT 0x80000000
#define NCMD_RETRANSMIT 0x40000000
#define NCMD_SETUP 0x20000000
#define NCMD_KILL 0x10000000 // kill game
#define NCMD_CHECKSUM 0x0fffffff
#include "deh_main.h"
doomcom_t* doomcom;
doomdata_t* netbuffer; // points inside doomcom
#include "d_loop.h"
ticcmd_t *netcmds;
//
// NETWORKING
//
// gametic is the tic about to (or currently being) run
// maketic is the tick that hasn't had control made for it yet
// nettics[] has the maketics for all players
//
// a gametic cannot be run until nettics[] > gametic for all players
//
#define RESENDCOUNT 10
#define PL_DRONE 0x80 // bit flag in doomdata->player
// Called when a player leaves the game
ticcmd_t localcmds[BACKUPTICS];
ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
int nettics[MAXNETNODES];
boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
boolean remoteresend[MAXNETNODES]; // set when local needs tics
int resendto[MAXNETNODES]; // set when remote needs tics
int resendcount[MAXNETNODES];
int nodeforplayer[MAXPLAYERS];
int maketic;
int lastnettic;
int skiptics;
int ticdup;
int maxsend; // BACKUPTICS/(2*ticdup)-1
void D_ProcessEvents (void);
void G_BuildTiccmd (ticcmd_t *cmd);
void D_DoAdvanceDemo (void);
boolean reboundpacket;
doomdata_t reboundstore;
//
//
//
int NetbufferSize (void)
static void PlayerQuitGame(player_t *player)
{
return (int)&(((doomdata_t *)0)->cmds[netbuffer->numtics]);
static char exitmsg[80];
unsigned int player_num;
player_num = player - players;
// Do this the same way as Vanilla Doom does, to allow dehacked
// replacements of this message
M_StringCopy(exitmsg, DEH_String("Player 1 left the game"),
sizeof(exitmsg));
exitmsg[7] += player_num;
playeringame[player_num] = false;
players[consoleplayer].message = exitmsg;
// TODO: check if it is sensible to do this:
if (demorecording)
{
G_CheckDemoStatus ();
}
}
//
// Checksum
//
unsigned NetbufferChecksum (void)
static void RunTic(ticcmd_t *cmds, boolean *ingame)
{
unsigned c;
int i,l;
extern boolean advancedemo;
unsigned int i;
c = 0x1234567;
// Check for player quits.
// FIXME -endianess?
#ifdef NORMALUNIX
return 0; // byte order problems
#endif
l = (NetbufferSize () - (int)&(((doomdata_t *)0)->retransmitfrom))/4;
for (i=0 ; i<l ; i++)
c += ((unsigned *)&netbuffer->retransmitfrom)[i] * (i+1);
return c & NCMD_CHECKSUM;
}
//
//
//
int ExpandTics (int low)
{
int delta;
delta = low - (maketic&0xff);
if (delta >= -64 && delta <= 64)
return (maketic&~0xff) + low;
if (delta > 64)
return (maketic&~0xff) - 256 + low;
if (delta < -64)
return (maketic&~0xff) + 256 + low;
I_Error ("ExpandTics: strange value %i at maketic %i",low,maketic);
return 0;
}
//
// HSendPacket
//
void
HSendPacket
(int node,
int flags )
{
netbuffer->checksum = NetbufferChecksum () | flags;
if (!node)
for (i = 0; i < MAXPLAYERS; ++i)
{
reboundstore = *netbuffer;
reboundpacket = true;
return;
}
if (demoplayback)
return;
if (!netgame)
I_Error ("Tried to transmit to another node");
doomcom->command = CMD_SEND;
doomcom->remotenode = node;
doomcom->datalength = NetbufferSize ();
if (debugfile)
{
int i;
int realretrans;
if (netbuffer->checksum & NCMD_RETRANSMIT)
realretrans = ExpandTics (netbuffer->retransmitfrom);
else
realretrans = -1;
fprintf (debugfile,"send (%i + %i, R %i) [%i] ",
ExpandTics(netbuffer->starttic),
netbuffer->numtics, realretrans, doomcom->datalength);
for (i=0 ; i<doomcom->datalength ; i++)
fprintf (debugfile,"%i ",((byte *)netbuffer)[i]);
fprintf (debugfile,"\n");
}
I_NetCmd ();
}
//
// HGetPacket
// Returns false if no packet is waiting
//
boolean HGetPacket (void)
{
if (reboundpacket)
{
*netbuffer = reboundstore;
doomcom->remotenode = 0;
reboundpacket = false;
return true;
}
if (!netgame)
return false;
if (demoplayback)
return false;
doomcom->command = CMD_GET;
I_NetCmd ();
if (doomcom->remotenode == -1)
return false;
if (doomcom->datalength != NetbufferSize ())
{
if (debugfile)
fprintf (debugfile,"bad packet length %i\n",doomcom->datalength);
return false;
}
if (NetbufferChecksum () != (netbuffer->checksum&NCMD_CHECKSUM) )
{
if (debugfile)
fprintf (debugfile,"bad packet checksum\n");
return false;
}
if (debugfile)
{
int realretrans;
int i;
if (netbuffer->checksum & NCMD_SETUP)
fprintf (debugfile,"setup packet\n");
else
{
if (netbuffer->checksum & NCMD_RETRANSMIT)
realretrans = ExpandTics (netbuffer->retransmitfrom);
else
realretrans = -1;
fprintf (debugfile,"get %i = (%i + %i, R %i)[%i] ",
doomcom->remotenode,
ExpandTics(netbuffer->starttic),
netbuffer->numtics, realretrans, doomcom->datalength);
for (i=0 ; i<doomcom->datalength ; i++)
fprintf (debugfile,"%i ",((byte *)netbuffer)[i]);
fprintf (debugfile,"\n");
}
}
return true;
}
//
// GetPackets
//
char exitmsg[80];
void GetPackets (void)
{
int netconsole;
int netnode;
ticcmd_t *src, *dest;
int realend;
int realstart;
while ( HGetPacket() )
{
if (netbuffer->checksum & NCMD_SETUP)
continue; // extra setup packet
netconsole = netbuffer->player & ~PL_DRONE;
netnode = doomcom->remotenode;
// to save bytes, only the low byte of tic numbers are sent
// Figure out what the rest of the bytes are
realstart = ExpandTics (netbuffer->starttic);
realend = (realstart+netbuffer->numtics);
// check for exiting the game
if (netbuffer->checksum & NCMD_EXIT)
{
if (!nodeingame[netnode])
continue;
nodeingame[netnode] = false;
playeringame[netconsole] = false;
strcpy (exitmsg, "Player 1 left the game");
exitmsg[7] += netconsole;
players[consoleplayer].message = exitmsg;
if (demorecording)
G_CheckDemoStatus ();
continue;
}
// check for a remote game kill
if (netbuffer->checksum & NCMD_KILL)
I_Error ("Killed by network driver");
nodeforplayer[netconsole] = netnode;
// check for retransmit request
if ( resendcount[netnode] <= 0
&& (netbuffer->checksum & NCMD_RETRANSMIT) )
{
resendto[netnode] = ExpandTics(netbuffer->retransmitfrom);
if (debugfile)
fprintf (debugfile,"retransmit from %i\n", resendto[netnode]);
resendcount[netnode] = RESENDCOUNT;
}
else
resendcount[netnode]--;
// check for out of order / duplicated packet
if (realend == nettics[netnode])
continue;
if (realend < nettics[netnode])
{
if (debugfile)
fprintf (debugfile,
"out of order packet (%i + %i)\n" ,
realstart,netbuffer->numtics);
continue;
}
// check for a missed packet
if (realstart > nettics[netnode])
{
// stop processing until the other system resends the missed tics
if (debugfile)
fprintf (debugfile,
"missed tics from %i (%i - %i)\n",
netnode, realstart, nettics[netnode]);
remoteresend[netnode] = true;
continue;
}
// update command store from the packet
if (!demoplayback && playeringame[i] && !ingame[i])
{
int start;
PlayerQuitGame(&players[i]);
}
}
remoteresend[netnode] = false;
start = nettics[netnode] - realstart;
src = &netbuffer->cmds[start];
netcmds = cmds;
while (nettics[netnode] < realend)
{
dest = &netcmds[netconsole][nettics[netnode]%BACKUPTICS];
nettics[netnode]++;
*dest = *src;
src++;
}
}
// check that there are players in the game. if not, we cannot
// run a tic.
if (advancedemo)
D_DoAdvanceDemo ();
G_Ticker ();
}
static loop_interface_t doom_loop_interface = {
D_ProcessEvents,
G_BuildTiccmd,
RunTic,
M_Ticker
};
// Load game settings from the specified structure and
// set global variables.
static void LoadGameSettings(net_gamesettings_t *settings)
{
unsigned int i;
deathmatch = settings->deathmatch;
startepisode = settings->episode;
startmap = settings->map;
startskill = settings->skill;
startloadgame = settings->loadgame;
lowres_turn = settings->lowres_turn;
nomonsters = settings->nomonsters;
fastparm = settings->fast_monsters;
respawnparm = settings->respawn_monsters;
timelimit = settings->timelimit;
consoleplayer = settings->consoleplayer;
if (lowres_turn)
{
printf("NOTE: Turning resolution is reduced; this is probably "
"because there is a client recording a Vanilla demo.\n");
}
for (i = 0; i < MAXPLAYERS; ++i)
{
playeringame[i] = i < settings->num_players;
}
}
// Save the game settings from global variables to the specified
// game settings structure.
//
// NetUpdate
// Builds ticcmds for console player,
// sends out a packet
//
int gametime;
void NetUpdate (void)
static void SaveGameSettings(net_gamesettings_t *settings)
{
int nowtime;
int newtics;
int i,j;
int realstart;
int gameticdiv;
// check time
nowtime = I_GetTime ()/ticdup;
newtics = nowtime - gametime;
gametime = nowtime;
if (newtics <= 0) // nothing new to update
goto listen;
// Fill in game settings structure with appropriate parameters
// for the new game
if (skiptics <= newtics)
{
newtics -= skiptics;
skiptics = 0;
}
else
{
skiptics -= newtics;
newtics = 0;
}
netbuffer->player = consoleplayer;
// build new ticcmds for console player
gameticdiv = gametic/ticdup;
for (i=0 ; i<newtics ; i++)
{
I_StartTic ();
D_ProcessEvents ();
if (maketic - gameticdiv >= BACKUPTICS/2-1)
break; // can't hold any more
//printf ("mk:%i ",maketic);
G_BuildTiccmd (&localcmds[maketic%BACKUPTICS]);
maketic++;
}
settings->deathmatch = deathmatch;
settings->episode = startepisode;
settings->map = startmap;
settings->skill = startskill;
settings->loadgame = startloadgame;
settings->gameversion = gameversion;
settings->nomonsters = nomonsters;
settings->fast_monsters = fastparm;
settings->respawn_monsters = respawnparm;
settings->timelimit = timelimit;
if (singletics)
return; // singletic update is syncronous
// send the packet to the other nodes
for (i=0 ; i<doomcom->numnodes ; i++)
if (nodeingame[i])
{
netbuffer->starttic = realstart = resendto[i];
netbuffer->numtics = maketic - realstart;
if (netbuffer->numtics > BACKUPTICS)
I_Error ("NetUpdate: netbuffer->numtics > BACKUPTICS");
resendto[i] = maketic - doomcom->extratics;
for (j=0 ; j< netbuffer->numtics ; j++)
netbuffer->cmds[j] =
localcmds[(realstart+j)%BACKUPTICS];
if (remoteresend[i])
{
netbuffer->retransmitfrom = nettics[i];
HSendPacket (i, NCMD_RETRANSMIT);
}
else
{
netbuffer->retransmitfrom = 0;
HSendPacket (i, 0);
}
}
// listen for other packets
listen:
GetPackets ();
settings->lowres_turn = M_CheckParm("-record") > 0
&& M_CheckParm("-longtics") == 0;
}
//
// CheckAbort
//
void CheckAbort (void)
static void InitConnectData(net_connect_data_t *connect_data)
{
event_t *ev;
int stoptic;
stoptic = I_GetTime () + 2;
while (I_GetTime() < stoptic)
I_StartTic ();
I_StartTic ();
for ( ; eventtail != eventhead
; eventtail = (eventtail+1)%(MAXEVENTS) )
{
ev = &events[eventtail];
if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
I_Error ("Network game synchronization aborted.");
}
}
connect_data->max_players = MAXPLAYERS;
connect_data->drone = false;
//!
// @category net
//
// Run as the left screen in three screen mode.
//
//
// D_ArbitrateNetStart
//
void D_ArbitrateNetStart (void)
{
int i;
boolean gotinfo[MAXNETNODES];
autostart = true;
memset (gotinfo,0,sizeof(gotinfo));
if (doomcom->consoleplayer)
if (M_CheckParm("-left") > 0)
{
// listen for setup info from key player
printf ("listening for network start info...\n");
while (1)
{
CheckAbort ();
if (!HGetPacket ())
continue;
if (netbuffer->checksum & NCMD_SETUP)
{
if (netbuffer->player != VERSION)
I_Error ("Different DOOM versions cannot play a net game!");
startskill = netbuffer->retransmitfrom & 15;
deathmatch = (netbuffer->retransmitfrom & 0xc0) >> 6;
nomonsters = (netbuffer->retransmitfrom & 0x20) > 0;
respawnparm = (netbuffer->retransmitfrom & 0x10) > 0;
startmap = netbuffer->starttic & 0x3f;
startepisode = netbuffer->starttic >> 6;
return;
}
}
viewangleoffset = ANG90;
connect_data->drone = true;
}
else
{
// key player, send the setup info
printf ("sending network start info...\n");
do
{
CheckAbort ();
for (i=0 ; i<doomcom->numnodes ; i++)
{
netbuffer->retransmitfrom = startskill;
if (deathmatch)
netbuffer->retransmitfrom |= (deathmatch<<6);
if (nomonsters)
netbuffer->retransmitfrom |= 0x20;
if (respawnparm)
netbuffer->retransmitfrom |= 0x10;
netbuffer->starttic = startepisode * 64 + startmap;
netbuffer->player = VERSION;
netbuffer->numtics = 0;
HSendPacket (i, NCMD_SETUP);
}
#if 1
for(i = 10 ; i && HGetPacket(); --i)
{
if((netbuffer->player&0x7f) < MAXNETNODES)
gotinfo[netbuffer->player&0x7f] = true;
}
#else
while (HGetPacket ())
{
gotinfo[netbuffer->player&0x7f] = true;
}
//!
// @category net
//
// Run as the right screen in three screen mode.
//
if (M_CheckParm("-right") > 0)
{
viewangleoffset = ANG270;
connect_data->drone = true;
}
//
// Connect data
//
// Game type fields:
connect_data->gamemode = gamemode;
connect_data->gamemission = gamemission;
// Are we recording a demo? Possibly set lowres turn mode
connect_data->lowres_turn = M_CheckParm("-record") > 0
&& M_CheckParm("-longtics") == 0;
// Read checksums of our WAD directory and dehacked information
W_Checksum(connect_data->wad_sha1sum);
#if ORIGCODE
DEH_Checksum(connect_data->deh_sha1sum);
#endif
for (i=1 ; i<doomcom->numnodes ; i++)
if (!gotinfo[i])
break;
} while (i < doomcom->numnodes);
// Are we playing with the Freedoom IWAD?
connect_data->is_freedoom = W_CheckNumForName("FREEDOOM") >= 0;
}
void D_ConnectNetGame(void)
{
net_connect_data_t connect_data;
InitConnectData(&connect_data);
netgame = D_InitNetGame(&connect_data);
//!
// @category net
//
// Start the game playing as though in a netgame with a single
// player. This can also be used to play back single player netgame
// demos.
//
if (M_CheckParm("-solo-net") > 0)
{
netgame = true;
}
}
@ -550,218 +237,45 @@ void D_ArbitrateNetStart (void)
// D_CheckNetGame
// Works out player numbers among the net participants
//
extern int viewangleoffset;
void D_CheckNetGame (void)
{
int i;
for (i=0 ; i<MAXNETNODES ; i++)
{
nodeingame[i] = false;
nettics[i] = 0;
remoteresend[i] = false; // set when local needs tics
resendto[i] = 0; // which tic to start sending
}
// I_InitNetwork sets doomcom and netgame
I_InitNetwork ();
if (doomcom->id != DOOMCOM_ID)
I_Error ("Doomcom buffer invalid!");
netbuffer = &doomcom->data;
consoleplayer = displayplayer = doomcom->consoleplayer;
net_gamesettings_t settings;
if (netgame)
D_ArbitrateNetStart ();
printf ("startskill %i deathmatch: %i startmap: %i startepisode: %i\n",
startskill, deathmatch, startmap, startepisode);
// read values out of doomcom
ticdup = doomcom->ticdup;
maxsend = BACKUPTICS/(2*ticdup)-1;
if (maxsend<1)
maxsend = 1;
for (i=0 ; i<doomcom->numplayers ; i++)
playeringame[i] = true;
for (i=0 ; i<doomcom->numnodes ; i++)
nodeingame[i] = true;
printf ("player %i of %i (%i nodes)\n",
consoleplayer+1, doomcom->numplayers, doomcom->numnodes);
}
//
// D_QuitNetGame
// Called before quitting to leave a net game
// without hanging the other players
//
void D_QuitNetGame (void)
{
int i, j;
if (debugfile)
fclose (debugfile);
if (!netgame || !usergame || consoleplayer == -1 || demoplayback)
return;
// send a bunch of packets for security
netbuffer->player = consoleplayer;
netbuffer->numtics = 0;
for (i=0 ; i<4 ; i++)
{
for (j=1 ; j<doomcom->numnodes ; j++)
if (nodeingame[j])
HSendPacket (j, NCMD_EXIT);
I_WaitVBL (1);
autostart = true;
}
D_RegisterLoopCallbacks(&doom_loop_interface);
SaveGameSettings(&settings);
D_StartNetGame(&settings, NULL);
LoadGameSettings(&settings);
DEH_printf("startskill %i deathmatch: %i startmap: %i startepisode: %i\n",
startskill, deathmatch, startmap, startepisode);
DEH_printf("player %i of %i (%i nodes)\n",
consoleplayer+1, settings.num_players, settings.num_players);
// Show players here; the server might have specified a time limit
if (timelimit > 0 && deathmatch)
{
// Gross hack to work like Vanilla:
if (timelimit == 20 && M_CheckParm("-avg"))
{
DEH_printf("Austin Virtual Gaming: Levels will end "
"after 20 minutes\n");
}
else
{
DEH_printf("Levels will end after %d minute", timelimit);
if (timelimit > 1)
printf("s");
printf(".\n");
}
}
}
//
// TryRunTics
//
int frametics[4];
int frameon;
int frameskip[4];
int oldnettics;
extern boolean advancedemo;
void TryRunTics (void)
{
int i;
int lowtic;
int entertic;
static int oldentertics;
int realtics;
int availabletics;
int counts;
int numplaying;
// get real tics
entertic = I_GetTime ()/ticdup;
realtics = entertic - oldentertics;
oldentertics = entertic;
// get available tics
NetUpdate ();
lowtic = MAXINT;
numplaying = 0;
for (i=0 ; i<doomcom->numnodes ; i++)
{
if (nodeingame[i])
{
numplaying++;
if (nettics[i] < lowtic)
lowtic = nettics[i];
}
}
availabletics = lowtic - gametic/ticdup;
// decide how many tics to run
if (realtics < availabletics-1)
counts = realtics+1;
else if (realtics < availabletics)
counts = realtics;
else
counts = availabletics;
if (counts < 1)
counts = 1;
frameon++;
if (debugfile)
fprintf (debugfile,
"=======real: %i avail: %i game: %i\n",
realtics, availabletics,counts);
if (!demoplayback)
{
// ideally nettics[0] should be 1 - 3 tics above lowtic
// if we are consistantly slower, speed up time
for (i=0 ; i<MAXPLAYERS ; i++)
if (playeringame[i])
break;
if (consoleplayer == i)
{
// the key player does not adapt
}
else
{
if (nettics[0] <= nettics[nodeforplayer[i]])
{
gametime--;
// printf ("-");
}
frameskip[frameon&3] = (oldnettics > nettics[nodeforplayer[i]]);
oldnettics = nettics[0];
if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
{
skiptics = 1;
// printf ("+");
}
}
}// demoplayback
// wait for new tics if needed
while (lowtic < gametic/ticdup + counts)
{
NetUpdate ();
lowtic = MAXINT;
for (i=0 ; i<doomcom->numnodes ; i++)
if (nodeingame[i] && nettics[i] < lowtic)
lowtic = nettics[i];
if (lowtic < gametic/ticdup)
I_Error ("TryRunTics: lowtic < gametic");
// don't stay in here forever -- give the menu a chance to work
if (I_GetTime ()/ticdup - entertic >= 20)
{
M_Ticker ();
return;
}
}
// run the count * ticdup dics
while (counts--)
{
for (i=0 ; i<ticdup ; i++)
{
if (gametic/ticdup > lowtic)
I_Error ("gametic>lowtic");
if (advancedemo)
D_DoAdvanceDemo ();
M_Ticker ();
G_Ticker ();
gametic++;
// modify command for duplicated tics
if (i != ticdup-1)
{
ticcmd_t *cmd;
int buf;
int j;
buf = (gametic/ticdup)%BACKUPTICS;
for (j=0 ; j<MAXPLAYERS ; j++)
{
cmd = &netcmds[j][buf];
cmd->chatchar = 0;
if (cmd->buttons & BT_SPECIAL)
cmd->buttons = 0;
}
}
}
NetUpdate (); // check for new console commands
}
}

View File

@ -1,149 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// Networking stuff.
//
//-----------------------------------------------------------------------------
#ifndef __D_NET__
#define __D_NET__
#include "d_player.h"
#ifdef __GNUG__
#pragma interface
#endif
//
// Network play related stuff.
// There is a data struct that stores network
// communication related stuff, and another
// one that defines the actual packets to
// be transmitted.
//
#define DOOMCOM_ID 0x12345678l
// Max computers/players in a game.
#define MAXNETNODES 8
// Networking and tick handling related.
#define BACKUPTICS 12
typedef enum
{
CMD_SEND = 1,
CMD_GET = 2
} command_t;
//
// Network packet data.
//
typedef struct
{
// High bit is retransmit request.
unsigned checksum;
// Only valid if NCMD_RETRANSMIT.
byte retransmitfrom;
byte starttic;
byte player;
byte numtics;
ticcmd_t cmds[BACKUPTICS];
} doomdata_t;
typedef struct
{
// Supposed to be DOOMCOM_ID?
long id;
// DOOM executes an int to execute commands.
short intnum;
// Communication between DOOM and the driver.
// Is CMD_SEND or CMD_GET.
short command;
// Is dest for send, set by get (-1 = no packet).
short remotenode;
// Number of bytes in doomdata to be sent
short datalength;
// Info common to all nodes.
// Console is allways node 0.
short numnodes;
// Flag: 1 = no duplication, 2-5 = dup for slow nets.
short ticdup;
// Flag: 1 = send a backup tic in every packet.
short extratics;
// Flag: 1 = deathmatch.
short deathmatch;
// Flag: -1 = new game, 0-5 = load savegame
short savegame;
short episode; // 1-3
short map; // 1-9
short skill; // 1-5
// Info specific to this node.
short consoleplayer;
short numplayers;
// These are related to the 3-display mode,
// in which two drones looking left and right
// were used to render two additional views
// on two additional computers.
// Probably not operational anymore.
// 1 = left, 0 = center, -1 = right
short angleoffset;
// 1 = drone
short drone;
// The packet data to be sent.
doomdata_t data;
} doomcom_t;
// Create any new ticcmds and broadcast to other players.
void NetUpdate (void);
// Broadcasts special packets to other players
// to notify of game exit
void D_QuitNetGame (void);
//? how many ticks to run?
void TryRunTics (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,23 +1,20 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#ifndef __D_PLAYER__
@ -40,9 +37,7 @@
// as commands per game tick.
#include "d_ticcmd.h"
#ifdef __GNUG__
#pragma interface
#endif
#include "net_defs.h"
@ -212,8 +207,3 @@ typedef struct
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,24 +1,21 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Typedefs related to to textures etc.,
// isolated here to make it easier separating modules.
//
//-----------------------------------------------------------------------------
#ifndef __D_TEXTUR__
@ -44,8 +41,3 @@ typedef struct
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,34 +1,28 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// MapObj data. Map Objects or mobjs are actors, entities,
// thinker, take-your-pick... anything that moves, acts, or
// suffers state changes of more or less violent nature.
//
//-----------------------------------------------------------------------------
#ifndef __D_THINK__
#define __D_THINK__
#ifdef __GNUG__
#pragma interface
#endif
@ -44,8 +38,8 @@ typedef void (*actionf_p2)( void*, void* );
typedef union
{
actionf_p1 acp1;
actionf_v acv;
actionf_p1 acp1;
actionf_p2 acp2;
} actionf_t;
@ -72,8 +66,3 @@ typedef struct thinker_s
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,23 +1,21 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 1993-2008 Raven Software
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __D_TICCMD__
@ -25,29 +23,34 @@
#include "doomtype.h"
#ifdef __GNUG__
#pragma interface
#endif
// The data sampled per tick (single player)
// and transmitted to other peers (multiplayer).
// Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency.
typedef struct
{
char forwardmove; // *2048 for move
char sidemove; // *2048 for move
short angleturn; // <<16 for angle delta
short consistancy; // checks for net game
byte chatchar;
byte buttons;
signed char forwardmove; // *2048 for move
signed char sidemove; // *2048 for move
short angleturn; // <<16 for angle delta
byte chatchar;
byte buttons;
// villsa [STRIFE] according to the asm,
// consistancy is a short, not a byte
byte consistancy; // checks for net game
// villsa - Strife specific:
byte buttons2;
int inventory;
// Heretic/Hexen specific:
byte lookfly; // look/fly up/down/centering
byte arti; // artitype_t to use
} ticcmd_t;
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

48
frosted-doom/deh_main.h Normal file
View File

@ -0,0 +1,48 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// Dehacked entrypoint and common code
//
#ifndef DEH_MAIN_H
#define DEH_MAIN_H
#include "doomtype.h"
#include "doomfeatures.h"
#include "deh_str.h"
#include "sha1.h"
// These are the limits that dehacked uses (from dheinit.h in the dehacked
// source). If these limits are exceeded, it does not generate an error, but
// a warning is displayed.
#define DEH_VANILLA_NUMSTATES 966
#define DEH_VANILLA_NUMSFX 107
void DEH_ParseCommandLine(void);
int DEH_LoadFile(char *filename);
int DEH_LoadLump(int lumpnum, boolean allow_long, boolean allow_error);
int DEH_LoadLumpByName(char *name, boolean allow_long, boolean allow_error);
boolean DEH_ParseAssignment(char *line, char **variable_name, char **value);
void DEH_Checksum(sha1_digest_t digest);
extern boolean deh_allow_extended_strings;
extern boolean deh_allow_long_strings;
extern boolean deh_allow_long_cheats;
extern boolean deh_apply_cheats;
#endif /* #ifndef DEH_MAIN_H */

83
frosted-doom/deh_misc.h Normal file
View File

@ -0,0 +1,83 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// Parses "Misc" sections in dehacked files
//
#ifndef DEH_MISC_H
#define DEH_MISC_H
#include "doomfeatures.h"
#define DEH_DEFAULT_INITIAL_HEALTH 100
#define DEH_DEFAULT_INITIAL_BULLETS 50
#define DEH_DEFAULT_MAX_HEALTH 200
#define DEH_DEFAULT_MAX_ARMOR 200
#define DEH_DEFAULT_GREEN_ARMOR_CLASS 1
#define DEH_DEFAULT_BLUE_ARMOR_CLASS 2
#define DEH_DEFAULT_MAX_SOULSPHERE 200
#define DEH_DEFAULT_SOULSPHERE_HEALTH 100
#define DEH_DEFAULT_MEGASPHERE_HEALTH 200
#define DEH_DEFAULT_GOD_MODE_HEALTH 100
#define DEH_DEFAULT_IDFA_ARMOR 200
#define DEH_DEFAULT_IDFA_ARMOR_CLASS 2
#define DEH_DEFAULT_IDKFA_ARMOR 200
#define DEH_DEFAULT_IDKFA_ARMOR_CLASS 2
#define DEH_DEFAULT_BFG_CELLS_PER_SHOT 40
#define DEH_DEFAULT_SPECIES_INFIGHTING 0
#ifdef FEATURE_DEHACKED
extern int deh_initial_health;
extern int deh_initial_bullets;
extern int deh_max_health;
extern int deh_max_armor;
extern int deh_green_armor_class;
extern int deh_blue_armor_class;
extern int deh_max_soulsphere;
extern int deh_soulsphere_health;
extern int deh_megasphere_health;
extern int deh_god_mode_health;
extern int deh_idfa_armor;
extern int deh_idfa_armor_class;
extern int deh_idkfa_armor;
extern int deh_idkfa_armor_class;
extern int deh_bfg_cells_per_shot;
extern int deh_species_infighting;
#else
// If dehacked is disabled, hard coded values
#define deh_initial_health DEH_DEFAULT_INITIAL_HEALTH
#define deh_initial_bullets DEH_DEFAULT_INITIAL_BULLETS
#define deh_max_health DEH_DEFAULT_MAX_HEALTH
#define deh_max_armor DEH_DEFAULT_MAX_ARMOR
#define deh_green_armor_class DEH_DEFAULT_GREEN_ARMOR_CLASS
#define deh_blue_armor_class DEH_DEFAULT_BLUE_ARMOR_CLASS
#define deh_max_soulsphere DEH_DEFAULT_MAX_SOULSPHERE
#define deh_soulsphere_health DEH_DEFAULT_SOULSPHERE_HEALTH
#define deh_megasphere_health DEH_DEFAULT_MEGASPHERE_HEALTH
#define deh_god_mode_health DEH_DEFAULT_GOD_MODE_HEALTH
#define deh_idfa_armor DEH_DEFAULT_IDFA_ARMOR
#define deh_idfa_armor_class DEH_DEFAULT_IDFA_ARMOR_CLASS
#define deh_idkfa_armor DEH_DEFAULT_IDKFA_ARMOR
#define deh_idkfa_armor_class DEH_DEFAULT_IDKFA_ARMOR_CLASS
#define deh_bfg_cells_per_shot DEH_DEFAULT_BFG_CELLS_PER_SHOT
#define deh_species_infighting DEH_DEFAULT_SPECIES_INFIGHTING
#endif
#endif /* #ifndef DEH_MISC_H */

47
frosted-doom/deh_str.h Normal file
View File

@ -0,0 +1,47 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// Dehacked string replacements
//
#ifndef DEH_STR_H
#define DEH_STR_H
#include <stdio.h>
#include "doomfeatures.h"
// Used to do dehacked text substitutions throughout the program
#ifdef FEATURE_DEHACKED
char *DEH_String(char *s);
void DEH_printf(char *fmt, ...);
void DEH_fprintf(FILE *fstream, char *fmt, ...);
void DEH_snprintf(char *buffer, size_t len, char *fmt, ...);
void DEH_AddStringReplacement(char *from_text, char *to_text);
#else
#define DEH_String(x) (x)
#define DEH_printf printf
#define DEH_fprintf fprintf
#define DEH_snprintf snprintf
#define DEH_AddStringReplacement(x, y)
#endif
#endif /* #ifndef DEH_STR_H */

42
frosted-doom/doom.h Normal file
View File

@ -0,0 +1,42 @@
/*
* doom.h
*
* Created on: 18.02.2015
* Author: Florian
*/
#ifndef SRC_CHOCDOOM_DOOM_H_
#define SRC_CHOCDOOM_DOOM_H_
/*---------------------------------------------------------------------*
* additional includes *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* global definitions *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* type declarations *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* function prototypes *
*---------------------------------------------------------------------*/
void D_DoomMain (void);
/*---------------------------------------------------------------------*
* global data *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* inline functions and function-like macros *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* eof *
*---------------------------------------------------------------------*/
#endif /* SRC_CHOCDOOM_DOOM_H_ */

View File

@ -1,25 +1,22 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// all external data is defined here
// most of the data is loaded into different structures at run time
// some internal structures shared by many modules are here
//
//-----------------------------------------------------------------------------
#ifndef __DOOMDATA__
#define __DOOMDATA__
@ -61,7 +58,7 @@ typedef struct
{
short x;
short y;
} mapvertex_t;
} PACKEDATTR mapvertex_t;
// A SideDef, defining the visual appearance of a wall,
@ -75,7 +72,7 @@ typedef struct
char midtexture[8];
// Front sector, towards viewer.
short sector;
} mapsidedef_t;
} PACKEDATTR mapsidedef_t;
@ -90,7 +87,7 @@ typedef struct
short tag;
// sidenum[1] will be -1 if one sided
short sidenum[2];
} maplinedef_t;
} PACKEDATTR maplinedef_t;
//
@ -147,7 +144,7 @@ typedef struct
short lightlevel;
short special;
short tag;
} mapsector_t;
} PACKEDATTR mapsector_t;
// SubSector, as generated by BSP.
typedef struct
@ -155,7 +152,7 @@ typedef struct
short numsegs;
// Index of first one, segs are stored sequentially.
short firstseg;
} mapsubsector_t;
} PACKEDATTR mapsubsector_t;
// LineSeg, generated by splitting LineDefs
@ -168,7 +165,7 @@ typedef struct
short linedef;
short side;
short offset;
} mapseg_t;
} PACKEDATTR mapseg_t;
@ -193,7 +190,7 @@ typedef struct
// else it's a node of another subtree.
unsigned short children[2];
} mapnode_t;
} PACKEDATTR mapnode_t;
@ -207,16 +204,10 @@ typedef struct
short angle;
short type;
short options;
} mapthing_t;
} PACKEDATTR mapthing_t;
#endif // __DOOMDATA__
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,34 +1,24 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// DoomDef - basic defines for DOOM, e.g. Version, game mode
// and skill level, and display parameters.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
#ifdef __GNUG__
#pragma implementation "doomdef.h"
#endif
#include "doomdef.h"
// Location for any defines turned variables.

View File

@ -1,24 +1,21 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Internally used data structures for virtually everything,
// key definitions, lots of other stuff.
// lots of other stuff.
//
//-----------------------------------------------------------------------------
#ifndef __DOOMDEF__
#define __DOOMDEF__
@ -26,104 +23,26 @@
#include <stdio.h>
#include <string.h>
#include "doomtype.h"
#include "i_timer.h"
#include "d_mode.h"
//
// Global parameters/defines.
//
// DOOM version
enum { VERSION = 110 };
#define DOOM_VERSION 109
// Game mode handling - identify IWAD version
// to handle IWAD dependend animations etc.
typedef enum
{
shareware, // DOOM 1 shareware, E1, M9
registered, // DOOM 1 registered, E3, M27
commercial, // DOOM 2 retail, E1 M34
// DOOM 2 german edition not handled
retail, // DOOM 1 retail, E4, M36
indetermined // Well, no IWAD found.
} GameMode_t;
// Mission packs - might be useful for TC stuff?
typedef enum
{
doom, // DOOM 1
doom2, // DOOM 2
pack_tnt, // TNT mission pack
pack_plut, // Plutonia pack
none
} GameMission_t;
// Identify language to use, software localization.
typedef enum
{
english,
french,
german,
unknown
} Language_t;
// Version code for cph's longtics hack ("v1.91")
#define DOOM_191_VERSION 111
// If rangecheck is undefined,
// most parameter validation debugging code will not be compiled
#define RANGECHECK
// Do or do not use external soundserver.
// The sndserver binary to be run separately
// has been introduced by Dave Taylor.
// The integrated sound support is experimental,
// and unfinished. Default is synchronous.
// Experimental asynchronous timer based is
// handled by SNDINTR.
#define SNDSERV 1
//#define SNDINTR 1
// This one switches between MIT SHM (no proper mouse)
// and XFree86 DGA (mickey sampling). The original
// linuxdoom used SHM, which is default.
//#define X11_DGA 1
//
// For resize of screen, at start of game.
// It will not work dynamically, see visplanes.
//
#define BASE_WIDTH 320
//#define BASE_WIDTH 480
// It is educational but futile to change this
// scaling e.g. to 2. Drawing of status bar,
// menues etc. is tied to the scale implied
// by the graphics.
#define SCREEN_MUL 1
#define INV_ASPECT_RATIO 0.625 // 0.75, ideally
//#define INV_ASPECT_RATIO 0.567// 0.75, ideally
// Defines suck. C sucks.
// C++ might sucks for OOP, but it sure is a better C.
// So there.
#define SCREENWIDTH 320
//#define SCREENWIDTH 480
//SCREEN_MUL*BASE_WIDTH //320
#define SCREENHEIGHT 200
//#define SCREENHEIGHT 272
//(int)(SCREEN_MUL*BASE_WIDTH*INV_ASPECT_RATIO) //200
// The maximum number of players, multiplayer/networking.
#define MAXPLAYERS 4
// State updates, number of tics / second.
#define TICRATE 35
#define MAXPLAYERS 4
// The current state of the game: whether we are
// playing, gazing at the intermission screen,
@ -133,9 +52,23 @@ typedef enum
GS_LEVEL,
GS_INTERMISSION,
GS_FINALE,
GS_DEMOSCREEN
GS_DEMOSCREEN,
} gamestate_t;
typedef enum
{
ga_nothing,
ga_loadlevel,
ga_newgame,
ga_loadgame,
ga_savegame,
ga_playdemo,
ga_completed,
ga_victory,
ga_worlddone,
ga_screenshot
} gameaction_t;
//
// Difficulty/skill settings/filters.
//
@ -148,17 +81,6 @@ typedef enum
// Deaf monsters/do not react to sound.
#define MTF_AMBUSH 8
typedef enum
{
sk_baby,
sk_easy,
sk_medium,
sk_hard,
sk_nightmare
} skill_t;
//
// Key cards.
@ -243,100 +165,4 @@ typedef enum
} powerduration_t;
//
// DOOM keyboard definition.
// This is the stuff configured by Setup.Exe.
// Most key data are simple ascii (uppercased).
//
#define KEY_RIGHTARROW 0xae
#define KEY_LEFTARROW 0xac
#define KEY_UPARROW 0xad
#define KEY_DOWNARROW 0xaf
#define KEY_ESCAPE 27
#define KEY_ENTER 13
#define KEY_TAB 9
#define KEY_F1 (0x80+0x3b)
#define KEY_F2 (0x80+0x3c)
#define KEY_F3 (0x80+0x3d)
#define KEY_F4 (0x80+0x3e)
#define KEY_F5 (0x80+0x3f)
#define KEY_F6 (0x80+0x40)
#define KEY_F7 (0x80+0x41)
#define KEY_F8 (0x80+0x42)
#define KEY_F9 (0x80+0x43)
#define KEY_F10 (0x80+0x44)
#define KEY_F11 (0x80+0x57)
#define KEY_F12 (0x80+0x58)
#define KEY_BACKSPACE 127
#define KEY_PAUSE 0xff
#define KEY_EQUALS 0x3d
#define KEY_MINUS 0x2d
#define KEY_RSHIFT (0x80+0x36)
#define KEY_RCTRL (0x80+0x1d)
#define KEY_RALT (0x80+0x38)
#define KEY_LALT KEY_RALT
// DOOM basic types (boolean),
// and max/min values.
//#include "doomtype.h"
// Fixed point.
//#include "m_fixed.h"
// Endianess handling.
//#include "m_swap.h"
// Binary Angles, sine/cosine/atan lookups.
//#include "tables.h"
// Event type.
//#include "d_event.h"
// Game function, skills.
//#include "g_game.h"
// All external data is defined here.
//#include "doomdata.h"
// All important printed strings.
// Language selection (message strings).
//#include "dstrings.h"
// Player is a special actor.
//struct player_s;
//#include "d_items.h"
//#include "d_player.h"
//#include "p_mobj.h"
//#include "d_net.h"
// PLAY
//#include "p_tick.h"
// Header, generated by sound utility.
// The utility was written by Dave Taylor.
//#include "sounds.h"
#endif // __DOOMDEF__
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -0,0 +1,40 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// List of features which can be enabled/disabled to slim down the
// program.
//
#ifndef DOOM_FEATURES_H
#define DOOM_FEATURES_H
// Enables wad merging (the '-merge' command line parameter)
#undef FEATURE_WAD_MERGE
// Enables dehacked support ('-deh')
#undef FEATURE_DEHACKED
// Enables multiplayer support (network games)
#undef FEATURE_MULTIPLAYER
// Enables sound output
#undef FEATURE_SOUND
#endif /* #ifndef DOOM_FEATURES_H */

97
frosted-doom/doomkeys.h Normal file
View File

@ -0,0 +1,97 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Key definitions
//
#ifndef __DOOMKEYS__
#define __DOOMKEYS__
//
// DOOM keyboard definition.
// This is the stuff configured by Setup.Exe.
// Most key data are simple ascii (uppercased).
//
#define KEY_RIGHTARROW 0xae
#define KEY_LEFTARROW 0xac
#define KEY_UPARROW 0xad
#define KEY_DOWNARROW 0xaf
#define KEY_STRAFE_L 0xa0
#define KEY_STRAFE_R 0xa1
#define KEY_USE 0xa2
#define KEY_FIRE 0xa3
#define KEY_ESCAPE 27
#define KEY_ENTER 13
#define KEY_TAB 9
#define KEY_F1 (0x80+0x3b)
#define KEY_F2 (0x80+0x3c)
#define KEY_F3 (0x80+0x3d)
#define KEY_F4 (0x80+0x3e)
#define KEY_F5 (0x80+0x3f)
#define KEY_F6 (0x80+0x40)
#define KEY_F7 (0x80+0x41)
#define KEY_F8 (0x80+0x42)
#define KEY_F9 (0x80+0x43)
#define KEY_F10 (0x80+0x44)
#define KEY_F11 (0x80+0x57)
#define KEY_F12 (0x80+0x58)
#define KEY_BACKSPACE 0x7f
#define KEY_PAUSE 0xff
#define KEY_EQUALS 0x3d
#define KEY_MINUS 0x2d
#define KEY_RSHIFT (0x80+0x36)
#define KEY_RCTRL (0x80+0x1d)
#define KEY_RALT (0x80+0x38)
#define KEY_LALT KEY_RALT
// new keys:
#define KEY_CAPSLOCK (0x80+0x3a)
#define KEY_NUMLOCK (0x80+0x45)
#define KEY_SCRLCK (0x80+0x46)
#define KEY_PRTSCR (0x80+0x59)
#define KEY_HOME (0x80+0x47)
#define KEY_END (0x80+0x4f)
#define KEY_PGUP (0x80+0x49)
#define KEY_PGDN (0x80+0x51)
#define KEY_INS (0x80+0x52)
#define KEY_DEL (0x80+0x53)
#define KEYP_0 0
#define KEYP_1 KEY_END
#define KEYP_2 KEY_DOWNARROW
#define KEYP_3 KEY_PGDN
#define KEYP_4 KEY_LEFTARROW
#define KEYP_5 '5'
#define KEYP_6 KEY_RIGHTARROW
#define KEYP_7 KEY_HOME
#define KEYP_8 KEY_UPARROW
#define KEYP_9 KEY_PGUP
#define KEYP_DIVIDE '/'
#define KEYP_PLUS '+'
#define KEYP_MINUS '-'
#define KEYP_MULTIPLY '*'
#define KEYP_PERIOD 0
#define KEYP_EQUALS KEY_EQUALS
#define KEYP_ENTER KEY_ENTER
#endif // __DOOMKEYS__

View File

@ -1,42 +1,31 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Put all global tate variables here.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
#include <stdio.h>
#ifdef __GNUG__
#pragma implementation "doomstat.h"
#endif
#include "doomstat.h"
// Game Mode - identify IWAD as shareware, retail etc.
GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom;
// Language.
Language_t language = english;
GameVersion_t gameversion = exe_final2;
char *gamedescription;
// Set if homebrew PWAD stuff has been added.
boolean modifiedgame;

View File

@ -1,18 +1,16 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// All the global variables that store the internal state.
@ -22,7 +20,6 @@
// this header file.
// In practice, things are a bit messy.
//
//-----------------------------------------------------------------------------
#ifndef __D_STATE__
@ -31,15 +28,15 @@
// We need globally shared data structures,
// for defining the global state variables.
#include "doomdata.h"
#include "d_net.h"
#include "d_loop.h"
// We need the playr data structure as well.
#include "d_player.h"
// Game mode/mission
#include "d_mode.h"
#ifdef __GNUG__
#pragma interface
#endif
#include "net_defs.h"
@ -53,22 +50,30 @@ extern boolean fastparm; // checkparm of -fast
extern boolean devparm; // DEBUG: launched with -devparm
// -----------------------------------------------------
// Game Mode - identify IWAD as shareware, retail etc.
//
extern GameMode_t gamemode;
extern GameMission_t gamemission;
extern GameVersion_t gameversion;
extern char *gamedescription;
// If true, we're using one of the mangled BFG edition IWADs.
extern boolean bfgedition;
// Convenience macro.
// 'gamemission' can be equal to pack_chex or pack_hacx, but these are
// just modified versions of doom and doom2, and should be interpreted
// as the same most of the time.
#define logical_gamemission \
(gamemission == pack_chex ? doom : \
gamemission == pack_hacx ? doom2 : gamemission)
// Set if homebrew PWAD stuff has been added.
extern boolean modifiedgame;
// -------------------------------------------
// Language.
extern Language_t language;
// -------------------------------------------
// Selected skill type, map etc.
//
@ -78,6 +83,11 @@ extern skill_t startskill;
extern int startepisode;
extern int startmap;
// Savegame slot to load on startup. This is the value provided to
// the -loadgame option. If this has not been provided, this is -1.
extern int startloadgame;
extern boolean autostart;
// Selected by user.
@ -85,29 +95,30 @@ extern skill_t gameskill;
extern int gameepisode;
extern int gamemap;
// If non-zero, exit the level after this number of minutes
extern int timelimit;
// Nightmare mode flag, single player.
extern boolean respawnmonsters;
// Netgame? Only true if >1 player.
extern boolean netgame;
// Flag: true only if started as net deathmatch.
// An enum might handle altdeath/cooperative better.
extern boolean deathmatch;
// 0=Cooperative; 1=Deathmatch; 2=Altdeath
extern int deathmatch;
// -------------------------
// Internal parameters for sound rendering.
// These have been taken from the DOS version,
// but are not (yet) supported with Linux
// (e.g. no sound volume adjustment with menu.
// These are not used, but should be (menu).
// From m_menu.c:
// Sound FX volume has default, 0 - 15
// Music volume has default, 0 - 15
// These are multiplied by 8.
extern int snd_SfxVolume; // maximum volume for sound
extern int snd_MusicVolume; // maximum volume for music
extern int sfxVolume;
extern int musicVolume;
// Current music/sfx card - index useless
// w/o a reference LUT in a sound module.
@ -137,15 +148,10 @@ extern boolean paused; // Game Pause?
extern boolean viewactive;
extern boolean nodrawers;
extern boolean noblit;
extern int viewwindowx;
extern int viewwindowy;
extern int viewheight;
extern int viewwidth;
extern int scaledviewwidth;
extern boolean testcontrols;
extern int testcontrols_mousespeed;
@ -183,6 +189,11 @@ extern boolean usergame;
extern boolean demoplayback;
extern boolean demorecording;
// Round angleturn in ticcmds to the nearest 256. This is used when
// recording Vanilla demos in netgames.
extern boolean lowres_turn;
// Quit after playing a demo from cmdline.
extern boolean singledemo;
@ -205,9 +216,6 @@ extern gamestate_t gamestate;
extern int gametic;
// Bookkeeping on players - state.
extern player_t players[MAXPLAYERS];
@ -228,9 +236,6 @@ extern mapthing_t playerstarts[MAXPLAYERS];
extern wbstartstruct_t wminfo;
// LUT of ammunition limits for each kind.
// This doubles with BackPack powerup item.
extern int maxammo[NUMAMMO];
@ -241,8 +246,8 @@ extern int maxammo[NUMAMMO];
//
// File handling stuff.
extern char * savegamedir;
extern char basedefault[1024];
extern FILE* debugfile;
// if true, load all graphics at level load
extern boolean precache;
@ -253,9 +258,6 @@ extern boolean precache;
extern gamestate_t wipegamestate;
extern int mouseSensitivity;
//?
// debug flag to cancel adaptiveness
extern boolean singletics;
extern int bodyqueslot;
@ -270,27 +272,10 @@ extern int skyflatnum;
// Netgame stuff (buffers and pointers, i.e. indices).
// This is ???
extern doomcom_t* doomcom;
// This points inside doomcom.
extern doomdata_t* netbuffer;
extern ticcmd_t localcmds[BACKUPTICS];
extern int rndindex;
extern int maketic;
extern int nettics[MAXNETNODES];
extern ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
extern int ticdup;
extern ticcmd_t *netcmds;
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,66 +1,103 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Simple basic typedefs, isolated here to make it easier
// separating modules.
//
//-----------------------------------------------------------------------------
#ifndef __DOOMTYPE__
#define __DOOMTYPE__
// #define macros to provide functions missing in Windows.
// Outside Windows, we use strings.h for str[n]casecmp.
#ifdef _WIN32
#define strcasecmp stricmp
#define strncasecmp strnicmp
#else
#include <strings.h>
#endif
//
// The packed attribute forces structures to be packed into the minimum
// space necessary. If this is not done, the compiler may align structure
// fields differently to optimize memory access, inflating the overall
// structure size. It is important to use the packed attribute on certain
// structures where alignment is important, particularly data read/written
// to disk.
//
#ifdef __GNUC__
#define PACKEDATTR __attribute__((packed))
#else
#define PACKEDATTR
#endif
// C99 integer types; with gcc we just use this. Other compilers
// should add conditional statements that define the C99 types.
// What is really wanted here is stdint.h; however, some old versions
// of Solaris don't have stdint.h and only have inttypes.h (the
// pre-standardisation version). inttypes.h is also in the C99
// standard and defined to include stdint.h, so include this.
#include <inttypes.h>
#ifndef __BYTEBOOL__
#define __BYTEBOOL__
// Fixed to use builtin bool type with C++.
#ifdef __cplusplus
// Use builtin bool type with C++.
typedef bool boolean;
#else
typedef enum {false, true} boolean;
#endif
typedef unsigned char byte;
typedef enum
{
false = 0,
true = 1,
undef = 0xFFFFFFFF
} boolean;
#endif
typedef uint8_t byte;
#include <limits.h>
#ifdef _WIN32
#define DIR_SEPARATOR '\\'
#define DIR_SEPARATOR_S "\\"
#define PATH_SEPARATOR ';'
// Predefined with some OS.
#ifdef LINUX
#include <values.h>
#else
#define MAXCHAR ((char)0x7f)
#define MAXSHORT ((short)0x7fff)
// Max pos 32-bit int.
#define MAXINT ((int)0x7fffffff)
#define MAXLONG ((long)0x7fffffff)
#define MINCHAR ((char)0x80)
#define MINSHORT ((short)0x8000)
// Max negative 32-bit integer.
#define MININT ((int)0x80000000)
#define MINLONG ((long)0x80000000)
#endif
#define DIR_SEPARATOR '/'
#define DIR_SEPARATOR_S "/"
#define PATH_SEPARATOR ':'
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------
#define arrlen(array) (sizeof(array) / sizeof(*array))
#endif

View File

@ -1,58 +1,58 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Globally defined strings.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
#ifdef __GNUG__
#pragma implementation "dstrings.h"
#endif
#include "dstrings.h"
char* endmsg[NUM_QUITMESSAGES+1]=
char *doom1_endmsg[] =
{
// DOOM1
QUITMSG,
"are you sure you want to\nquit this great game?",
"please don't leave, there's more\ndemons to toast!",
"let's beat it -- this is turning\ninto a bloodbath!",
"i wouldn't leave if i were you.\ndos is much worse.",
"you're trying to say you like dos\nbetter than me, right?",
"don't leave yet -- there's a\ndemon around that corner!",
"ya know, next time you come in here\ni'm gonna toast ya.",
"go ahead and leave. see if i care."
"go ahead and leave. see if i care.",
};
char *doom2_endmsg[] =
{
// QuitDOOM II messages
"are you sure you want to\nquit this great game?",
"you want to quit?\nthen, thou hast lost an eighth!",
"don't go now, there's a \ndimensional shambler waiting\nat the dos prompt!",
"get outta here and go back\nto your boring programs.",
"if i were your boss, i'd \n deathmatch ya in a minute!",
"look, bud. you leave now\nand you forfeit your body count!",
"just leave. when you come\nback, i'll be waiting with a bat.",
"you're lucky i don't smack\nyou for thinking about leaving."
"you're lucky i don't smack\nyou for thinking about leaving.",
};
#if 0
// UNUSED messages included in the source release
char* endmsg[] =
{
// DOOM1
QUITMSG,
// FinalDOOM?
"fuck you, pussy!\nget the fuck out!",
"you quit and i'll jizz\nin your cystholes!",
@ -66,6 +66,7 @@ char* endmsg[NUM_QUITMESSAGES+1]=
"THIS IS NO MESSAGE!\nPage intentionally left blank."
};
#endif

View File

@ -1,26 +1,21 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// $Log:$
//
// DESCRIPTION:
// DOOM strings, by language.
//
//-----------------------------------------------------------------------------
#ifndef __DSTRINGS__
@ -28,39 +23,19 @@
// All important printed strings.
// Language selection (message strings).
// Use -DFRENCH etc.
#ifdef FRENCH
#include "d_french.h"
#else
#include "d_englsh.h"
#endif
// Misc. other strings.
#define SAVEGAMENAME "doomsav"
//
// File locations,
// relative to current position.
// Path names are OS-sensitive.
//
#define DEVMAPS "devmaps"
#define DEVDATA "devdata"
// Not done in french?
// QuitDOOM messages
#define NUM_QUITMESSAGES 22
// 8 per each game type
#define NUM_QUITMESSAGES 8
extern char* endmsg[];
extern char *doom1_endmsg[];
extern char *doom2_endmsg[];
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

49
frosted-doom/dummy.c Normal file
View File

@ -0,0 +1,49 @@
/*
* dummy.c
*
* Created on: 16.02.2015
* Author: Florian
*/
/*---------------------------------------------------------------------*
* include files *
*---------------------------------------------------------------------*/
#include "doomtype.h"
/*---------------------------------------------------------------------*
* local definitions *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* external declarations *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* public data *
*---------------------------------------------------------------------*/
boolean net_client_connected = false;
boolean drone = false;
/*---------------------------------------------------------------------*
* private data *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* private functions *
*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*
* public functions *
*---------------------------------------------------------------------*/
void I_InitTimidityConfig(void)
{
}
/*---------------------------------------------------------------------*
* eof *
*---------------------------------------------------------------------*/

View File

@ -1,86 +1,98 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Game completion, final screen animation.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: f_finale.c,v 1.5 1997/02/03 21:26:34 b1 Exp $";
#include <stdio.h>
#include <ctype.h>
// Functions.
#include "deh_main.h"
#include "i_system.h"
#include "m_swap.h"
#include "i_swap.h"
#include "z_zone.h"
#include "v_video.h"
#include "w_wad.h"
#include "s_sound.h"
// Data.
#include "d_main.h"
#include "dstrings.h"
#include "sounds.h"
#include "doomstat.h"
#include "r_state.h"
typedef enum
{
F_STAGE_TEXT,
F_STAGE_ARTSCREEN,
F_STAGE_CAST,
} finalestage_t;
// ?
//#include "doomstat.h"
//#include "r_local.h"
//#include "f_finale.h"
// Stage of animation:
// 0 = text, 1 = art screen, 2 = character cast
int finalestage;
finalestage_t finalestage;
int finalecount;
unsigned int finalecount;
#define TEXTSPEED 3
#define TEXTWAIT 250
char* e1text = E1TEXT;
char* e2text = E2TEXT;
char* e3text = E3TEXT;
char* e4text = E4TEXT;
typedef struct
{
GameMission_t mission;
int episode, level;
char *background;
char *text;
} textscreen_t;
char* c1text = C1TEXT;
char* c2text = C2TEXT;
char* c3text = C3TEXT;
char* c4text = C4TEXT;
char* c5text = C5TEXT;
char* c6text = C6TEXT;
static textscreen_t textscreens[] =
{
{ doom, 1, 8, "FLOOR4_8", E1TEXT},
{ doom, 2, 8, "SFLR6_1", E2TEXT},
{ doom, 3, 8, "MFLR8_4", E3TEXT},
{ doom, 4, 8, "MFLR8_3", E4TEXT},
char* p1text = P1TEXT;
char* p2text = P2TEXT;
char* p3text = P3TEXT;
char* p4text = P4TEXT;
char* p5text = P5TEXT;
char* p6text = P6TEXT;
{ doom2, 1, 6, "SLIME16", C1TEXT},
{ doom2, 1, 11, "RROCK14", C2TEXT},
{ doom2, 1, 20, "RROCK07", C3TEXT},
{ doom2, 1, 30, "RROCK17", C4TEXT},
{ doom2, 1, 15, "RROCK13", C5TEXT},
{ doom2, 1, 31, "RROCK19", C6TEXT},
char* t1text = T1TEXT;
char* t2text = T2TEXT;
char* t3text = T3TEXT;
char* t4text = T4TEXT;
char* t5text = T5TEXT;
char* t6text = T6TEXT;
{ pack_tnt, 1, 6, "SLIME16", T1TEXT},
{ pack_tnt, 1, 11, "RROCK14", T2TEXT},
{ pack_tnt, 1, 20, "RROCK07", T3TEXT},
{ pack_tnt, 1, 30, "RROCK17", T4TEXT},
{ pack_tnt, 1, 15, "RROCK13", T5TEXT},
{ pack_tnt, 1, 31, "RROCK19", T6TEXT},
{ pack_plut, 1, 6, "SLIME16", P1TEXT},
{ pack_plut, 1, 11, "RROCK14", P2TEXT},
{ pack_plut, 1, 20, "RROCK07", P3TEXT},
{ pack_plut, 1, 30, "RROCK17", P4TEXT},
{ pack_plut, 1, 15, "RROCK13", P5TEXT},
{ pack_plut, 1, 31, "RROCK19", P6TEXT},
};
char* finaletext;
char* finaleflat;
@ -95,97 +107,50 @@ void F_CastDrawer (void);
//
void F_StartFinale (void)
{
size_t i;
gameaction = ga_nothing;
gamestate = GS_FINALE;
viewactive = false;
automapactive = false;
// Okay - IWAD dependend stuff.
// This has been changed severly, and
// some stuff might have changed in the process.
switch ( gamemode )
if (logical_gamemission == doom)
{
// DOOM 1 - E1, E3 or E4, but each nine missions
case shareware:
case registered:
case retail:
{
S_ChangeMusic(mus_victor, true);
switch (gameepisode)
{
case 1:
finaleflat = "FLOOR4_8";
finaletext = e1text;
break;
case 2:
finaleflat = "SFLR6_1";
finaletext = e2text;
break;
case 3:
finaleflat = "MFLR8_4";
finaletext = e3text;
break;
case 4:
finaleflat = "MFLR8_3";
finaletext = e4text;
break;
default:
// Ouch.
break;
}
break;
}
// DOOM II and missions packs with E1, M34
case commercial:
{
S_ChangeMusic(mus_read_m, true);
switch (gamemap)
{
case 6:
finaleflat = "SLIME16";
finaletext = c1text;
break;
case 11:
finaleflat = "RROCK14";
finaletext = c2text;
break;
case 20:
finaleflat = "RROCK07";
finaletext = c3text;
break;
case 30:
finaleflat = "RROCK17";
finaletext = c4text;
break;
case 15:
finaleflat = "RROCK13";
finaletext = c5text;
break;
case 31:
finaleflat = "RROCK19";
finaletext = c6text;
break;
default:
// Ouch.
break;
}
break;
}
// Indeterminate.
default:
S_ChangeMusic(mus_read_m, true);
finaleflat = "F_SKY1"; // Not used anywhere else.
finaletext = c1text; // FIXME - other text, music?
break;
S_ChangeMusic(mus_victor, true);
}
else
{
S_ChangeMusic(mus_read_m, true);
}
// Find the right screen and set the text and background
for (i=0; i<arrlen(textscreens); ++i)
{
textscreen_t *screen = &textscreens[i];
// Hack for Chex Quest
if (gameversion == exe_chex && screen->mission == doom)
{
screen->level = 5;
}
if (logical_gamemission == screen->mission
&& (logical_gamemission != doom || gameepisode == screen->episode)
&& gamemap == screen->level)
{
finaletext = screen->text;
finaleflat = screen->background;
}
}
// Do dehacked substitutions of strings
finaletext = DEH_String(finaletext);
finaleflat = DEH_String(finaleflat);
finalestage = 0;
finalestage = F_STAGE_TEXT;
finalecount = 0;
}
@ -194,7 +159,7 @@ void F_StartFinale (void)
boolean F_Responder (event_t *event)
{
if (finalestage == 2)
if (finalestage == F_STAGE_CAST)
return F_CastResponder (event);
return false;
@ -206,7 +171,7 @@ boolean F_Responder (event_t *event)
//
void F_Ticker (void)
{
int i;
size_t i;
// check for skipping
if ( (gamemode == commercial)
@ -229,7 +194,7 @@ void F_Ticker (void)
// advance animation
finalecount++;
if (finalestage == 2)
if (finalestage == F_STAGE_CAST)
{
F_CastTicker ();
return;
@ -238,10 +203,11 @@ void F_Ticker (void)
if ( gamemode == commercial)
return;
if (!finalestage && finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT)
if (finalestage == F_STAGE_TEXT
&& finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT)
{
finalecount = 0;
finalestage = 1;
finalestage = F_STAGE_ARTSCREEN;
wipegamestate = -1; // force a wipe
if (gameepisode == 3)
S_StartMusic (mus_bunny);
@ -264,7 +230,7 @@ void F_TextWrite (void)
byte* dest;
int x,y,w;
int count;
signed int count;
char* ch;
int c;
int cx;
@ -272,7 +238,7 @@ void F_TextWrite (void)
// erase the entire screen to a tiled background
src = W_CacheLumpName ( finaleflat , PU_CACHE);
dest = screens[0];
dest = I_VideoBuffer;
for (y=0 ; y<SCREENHEIGHT ; y++)
{
@ -295,7 +261,7 @@ void F_TextWrite (void)
cy = 10;
ch = finaletext;
count = (finalecount - 10)/TEXTSPEED;
count = ((signed int) finalecount - 10) / TEXTSPEED;
if (count < 0)
count = 0;
for ( ; count ; count-- )
@ -320,7 +286,7 @@ void F_TextWrite (void)
w = SHORT (hu_font[c]->width);
if (cx+w > SCREENWIDTH)
break;
V_DrawPatch(cx, cy, 0, hu_font[c]);
V_DrawPatch(cx, cy, hu_font[c]);
cx+=w;
}
@ -371,9 +337,6 @@ boolean castattacking;
//
// F_StartCast
//
extern gamestate_t wipegamestate;
void F_StartCast (void)
{
wipegamestate = -1; // force a screen wipe
@ -381,7 +344,7 @@ void F_StartCast (void)
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
casttics = caststate->tics;
castdeath = false;
finalestage = 2;
finalestage = F_STAGE_CAST;
castframes = 0;
castonmelee = 0;
castattacking = false;
@ -564,7 +527,7 @@ void F_CastPrint (char* text)
}
w = SHORT (hu_font[c]->width);
V_DrawPatch(cx, 180, 0, hu_font[c]);
V_DrawPatch(cx, 180, hu_font[c]);
cx+=w;
}
@ -574,7 +537,6 @@ void F_CastPrint (char* text)
//
// F_CastDrawer
//
void V_DrawPatchFlipped (int x, int y, int scrn, patch_t *patch);
void F_CastDrawer (void)
{
@ -585,9 +547,9 @@ void F_CastDrawer (void)
patch_t* patch;
// erase the entire screen to a background
V_DrawPatch (0,0,0, W_CacheLumpName ("BOSSBACK", PU_CACHE));
V_DrawPatch (0, 0, W_CacheLumpName (DEH_String("BOSSBACK"), PU_CACHE));
F_CastPrint (castorder[castnum].name);
F_CastPrint (DEH_String(castorder[castnum].name));
// draw the current frame in the middle of the screen
sprdef = &sprites[caststate->sprite];
@ -597,9 +559,9 @@ void F_CastDrawer (void)
patch = W_CacheLumpNum (lump+firstspritelump, PU_CACHE);
if (flip)
V_DrawPatchFlipped (160,170,0,patch);
V_DrawPatchFlipped(160, 170, patch);
else
V_DrawPatch (160,170,0,patch);
V_DrawPatch(160, 170, patch);
}
@ -619,7 +581,7 @@ F_DrawPatchCol
int count;
column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
desttop = screens[0]+x;
desttop = I_VideoBuffer + x;
// step through the posts in a column
while (column->topdelta != 0xff )
@ -643,7 +605,7 @@ F_DrawPatchCol
//
void F_BunnyScroll (void)
{
int scrolled;
signed int scrolled;
int x;
patch_t* p1;
patch_t* p2;
@ -651,12 +613,12 @@ void F_BunnyScroll (void)
int stage;
static int laststage;
p1 = W_CacheLumpName ("PFUB2", PU_LEVEL);
p2 = W_CacheLumpName ("PFUB1", PU_LEVEL);
p1 = W_CacheLumpName (DEH_String("PFUB2"), PU_LEVEL);
p2 = W_CacheLumpName (DEH_String("PFUB1"), PU_LEVEL);
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
scrolled = 320 - (finalecount-230)/2;
scrolled = (320 - ((signed int) finalecount-230)/2);
if (scrolled > 320)
scrolled = 320;
if (scrolled < 0)
@ -674,8 +636,9 @@ void F_BunnyScroll (void)
return;
if (finalecount < 1180)
{
V_DrawPatch ((SCREENWIDTH-13*8)/2,
(SCREENHEIGHT-8*8)/2,0, W_CacheLumpName ("END0",PU_CACHE));
V_DrawPatch((SCREENWIDTH - 13 * 8) / 2,
(SCREENHEIGHT - 8 * 8) / 2,
W_CacheLumpName(DEH_String("END0"), PU_CACHE));
laststage = 0;
return;
}
@ -689,50 +652,67 @@ void F_BunnyScroll (void)
laststage = stage;
}
sprintf (name,"END%i",stage);
V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName (name,PU_CACHE));
DEH_snprintf(name, 10, "END%i", stage);
V_DrawPatch((SCREENWIDTH - 13 * 8) / 2,
(SCREENHEIGHT - 8 * 8) / 2,
W_CacheLumpName (name,PU_CACHE));
}
static void F_ArtScreenDrawer(void)
{
char *lumpname;
if (gameepisode == 3)
{
F_BunnyScroll();
}
else
{
switch (gameepisode)
{
case 1:
if (gamemode == retail)
{
lumpname = "CREDIT";
}
else
{
lumpname = "HELP2";
}
break;
case 2:
lumpname = "VICTORY2";
break;
case 4:
lumpname = "ENDPIC";
break;
default:
return;
}
lumpname = DEH_String(lumpname);
V_DrawPatch (0, 0, W_CacheLumpName(lumpname, PU_CACHE));
}
}
//
// F_Drawer
//
void F_Drawer (void)
{
if (finalestage == 2)
switch (finalestage)
{
F_CastDrawer ();
return;
case F_STAGE_CAST:
F_CastDrawer();
break;
case F_STAGE_TEXT:
F_TextWrite();
break;
case F_STAGE_ARTSCREEN:
F_ArtScreenDrawer();
break;
}
if (!finalestage)
F_TextWrite ();
else
{
switch (gameepisode)
{
case 1:
if ( gamemode == retail )
V_DrawPatch (0,0,0,
W_CacheLumpName("CREDIT",PU_CACHE));
else
V_DrawPatch (0,0,0,
W_CacheLumpName("HELP2",PU_CACHE));
break;
case 2:
V_DrawPatch(0,0,0,
W_CacheLumpName("VICTORY2",PU_CACHE));
break;
case 3:
F_BunnyScroll ();
break;
case 4:
V_DrawPatch (0,0,0,
W_CacheLumpName("ENDPIC",PU_CACHE));
break;
}
}
}

View File

@ -1,23 +1,20 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//
//
//-----------------------------------------------------------------------------
#ifndef __F_FINALE__
@ -46,8 +43,3 @@ void F_StartFinale (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,37 +1,29 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Mission begin melt/wipe screen special effect.
//
//-----------------------------------------------------------------------------
static const char rcsid[] = "$Id: f_wipe.c,v 1.2 1997/02/03 22:45:09 b1 Exp $";
#include <string.h>
#include "z_zone.h"
#include "i_video.h"
#include "v_video.h"
#include "m_random.h"
#include "doomdef.h"
#include "doomtype.h"
#include "f_wipe.h"
@ -230,6 +222,8 @@ wipe_exitMelt
int ticks )
{
Z_Free(y);
Z_Free(wipe_scr_start);
Z_Free(wipe_scr_end);
return 0;
}
@ -240,7 +234,7 @@ wipe_StartScreen
int width,
int height )
{
wipe_scr_start = screens[2];
wipe_scr_start = Z_Malloc(SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
I_ReadScreen(wipe_scr_start);
return 0;
}
@ -252,9 +246,9 @@ wipe_EndScreen
int width,
int height )
{
wipe_scr_end = screens[3];
wipe_scr_end = Z_Malloc(SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
I_ReadScreen(wipe_scr_end);
V_DrawBlock(x, y, 0, width, height, wipe_scr_start); // restore start scr.
V_DrawBlock(x, y, width, height, wipe_scr_start); // restore start scr.
return 0;
}
@ -274,14 +268,12 @@ wipe_ScreenWipe
wipe_initMelt, wipe_doMelt, wipe_exitMelt
};
void V_MarkRect(int, int, int, int);
// initial stuff
if (!go)
{
go = 1;
// wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG
wipe_scr = screens[0];
wipe_scr = I_VideoBuffer;
(*wipes[wipeno*3])(width, height, ticks);
}
@ -298,5 +290,5 @@ wipe_ScreenWipe
}
return !go;
}

View File

@ -1,23 +1,20 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Mission start screen wipe/melt, special effects.
//
//-----------------------------------------------------------------------------
#ifndef __F_WIPE_H__
@ -64,8 +61,3 @@ wipe_ScreenWipe
int ticks );
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,20 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Duh.
//
//-----------------------------------------------------------------------------
#ifndef __G_GAME__
@ -25,7 +22,7 @@
#include "doomdef.h"
#include "d_event.h"
#include "d_ticcmd.h"
//
@ -65,15 +62,19 @@ void G_SecretExitLevel (void);
void G_WorldDone (void);
// Read current data from inputs and build a player movement command.
void G_BuildTiccmd (ticcmd_t *cmd, int maketic);
void G_Ticker (void);
boolean G_Responder (event_t* ev);
void G_ScreenShot (void);
void G_DrawMouseSpeedBox(void);
int G_VanillaVersionCode(void);
extern int vanilla_savegame_limit;
extern int vanilla_demo_limit;
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

271
frosted-doom/gusconf.c Normal file
View File

@ -0,0 +1,271 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// GUS emulation code.
//
// Actually emulating a GUS is far too much work; fortunately
// GUS "emulation" already exists in the form of Timidity, which
// supports GUS patch files. This code therefore converts Doom's
// DMXGUS lump into an equivalent Timidity configuration file.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "w_wad.h"
#include "z_zone.h"
#define MAX_INSTRUMENTS 256
typedef struct
{
char *patch_names[MAX_INSTRUMENTS];
int mapping[MAX_INSTRUMENTS];
} gus_config_t;
char *gus_patch_path = "";
unsigned int gus_ram_kb = 1024;
static unsigned int MappingIndex(void)
{
unsigned int result = gus_ram_kb / 256;
if (result < 1)
{
return 1;
}
else if (result > 4)
{
return 4;
}
else
{
return result;
}
}
static int SplitLine(char *line, char **fields, unsigned int max_fields)
{
unsigned int num_fields;
char *p;
fields[0] = line;
num_fields = 1;
for (p = line; *p != '\0'; ++p)
{
if (*p == ',')
{
*p = '\0';
// Skip spaces following the comma.
do
{
++p;
} while (*p != '\0' && isspace(*p));
fields[num_fields] = p;
++num_fields;
--p;
if (num_fields >= max_fields)
{
break;
}
}
else if (*p == '#')
{
*p = '\0';
break;
}
}
// Strip off trailing whitespace from the end of the line.
p = fields[num_fields - 1] + strlen(fields[num_fields - 1]);
while (p > fields[num_fields - 1] && isspace(*(p - 1)))
{
--p;
*p = '\0';
}
return num_fields;
}
static void ParseLine(gus_config_t *config, char *line)
{
char *fields[6];
unsigned int num_fields;
unsigned int instr_id, mapped_id;
num_fields = SplitLine(line, fields, 6);
if (num_fields < 6)
{
return;
}
instr_id = atoi(fields[0]);
mapped_id = atoi(fields[MappingIndex()]);
free(config->patch_names[instr_id]);
config->patch_names[instr_id] = strdup(fields[5]);
config->mapping[instr_id] = mapped_id;
}
static void ParseDMXConfig(char *dmxconf, gus_config_t *config)
{
char *p, *newline;
unsigned int i;
memset(config, 0, sizeof(gus_config_t));
for (i = 0; i < MAX_INSTRUMENTS; ++i)
{
config->mapping[i] = -1;
}
p = dmxconf;
for (;;)
{
newline = strchr(p, '\n');
if (newline != NULL)
{
*newline = '\0';
}
ParseLine(config, p);
if (newline == NULL)
{
break;
}
else
{
p = newline + 1;
}
}
}
static void FreeDMXConfig(gus_config_t *config)
{
unsigned int i;
for (i = 0; i < MAX_INSTRUMENTS; ++i)
{
free(config->patch_names[i]);
}
}
static char *ReadDMXConfig(void)
{
int lumpnum;
unsigned int len;
char *data;
// TODO: This should be chosen based on gamemode == commercial:
lumpnum = W_CheckNumForName("DMXGUS");
if (lumpnum < 0)
{
lumpnum = W_GetNumForName("DMXGUSC");
}
len = W_LumpLength(lumpnum);
data = Z_Malloc(len + 1, PU_STATIC, NULL);
W_ReadLump(lumpnum, data);
return data;
}
static boolean WriteTimidityConfig(char *path, gus_config_t *config)
{
FILE *fstream;
unsigned int i;
fstream = fopen(path, "w");
if (fstream == NULL)
{
return false;
}
fprintf(fstream, "# Autogenerated Timidity config.\n\n");
fprintf(fstream, "dir %s\n", gus_patch_path);
fprintf(fstream, "\nbank 0\n\n");
for (i = 0; i < 128; ++i)
{
if (config->mapping[i] >= 0 && config->mapping[i] < MAX_INSTRUMENTS
&& config->patch_names[config->mapping[i]] != NULL)
{
fprintf(fstream, "%i %s\n",
i, config->patch_names[config->mapping[i]]);
}
}
fprintf(fstream, "\ndrumset 0\n\n");
for (i = 128 + 25; i < MAX_INSTRUMENTS; ++i)
{
if (config->mapping[i] >= 0 && config->mapping[i] < MAX_INSTRUMENTS
&& config->patch_names[config->mapping[i]] != NULL)
{
fprintf(fstream, "%i %s\n",
i - 128, config->patch_names[config->mapping[i]]);
}
}
fprintf(fstream, "\n");
fclose(fstream);
return true;
}
boolean GUS_WriteConfig(char *path)
{
boolean result;
char *dmxconf;
gus_config_t config;
if (!strcmp(gus_patch_path, ""))
{
printf("You haven't configured gus_patch_path.\n");
printf("gus_patch_path needs to point to the location of "
"your GUS patch set.\n"
"To get a copy of the \"standard\" GUS patches, "
"download a copy of dgguspat.zip.\n");
return false;
}
dmxconf = ReadDMXConfig();
ParseDMXConfig(dmxconf, &config);
result = WriteTimidityConfig(path, &config);
FreeDMXConfig(&config);
Z_Free(dmxconf);
return result;
}

29
frosted-doom/gusconf.h Normal file
View File

@ -0,0 +1,29 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// GUS emulation code.
//
#ifndef __GUSCONF_H__
#define __GUSCONF_H__
#include "doomtype.h"
extern char *gus_patch_path;
extern unsigned int gus_ram_kb;
boolean GUS_WriteConfig(char *path);
#endif /* #ifndef __GUSCONF_H__ */

View File

@ -1,34 +1,28 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION: heads-up text and input code
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: hu_lib.c,v 1.3 1997/01/26 07:44:58 b1 Exp $";
#include <ctype.h>
#include "doomdef.h"
#include "doomkeys.h"
#include "v_video.h"
#include "m_swap.h"
#include "i_swap.h"
#include "hu_lib.h"
#include "r_local.h"
@ -111,7 +105,7 @@ HUlib_drawTextLine
x = l->x;
for (i=0;i<l->len;i++)
{
c = toupper(l->l[i]);
c = toupper((int)l->l[i]);
if (c != ' '
&& c >= l->sc
&& c <= '_')
@ -119,7 +113,7 @@ HUlib_drawTextLine
w = SHORT(l->f[c - l->sc]->width);
if (x+w > SCREENWIDTH)
break;
V_DrawPatchDirect(x, l->y, FG, l->f[c - l->sc]);
V_DrawPatchDirect(x, l->y, l->f[c - l->sc]);
x += w;
}
else
@ -134,7 +128,7 @@ HUlib_drawTextLine
if (drawcursor
&& x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH)
{
V_DrawPatchDirect(x, l->y, FG, l->f['_' - l->sc]);
V_DrawPatchDirect(x, l->y, l->f['_' - l->sc]);
}
}
@ -145,7 +139,6 @@ void HUlib_eraseTextLine(hu_textline_t* l)
int lh;
int y;
int yoffset;
//static boolean lastautomapactive = true;
// Only erases when NOT in automap and the screen is reduced,
// and the text must either need updating or refreshing
@ -168,7 +161,6 @@ void HUlib_eraseTextLine(hu_textline_t* l)
}
}
//lastautomapactive = automapactive;
if (l->needsupdate) l->needsupdate--;
}
@ -319,6 +311,7 @@ HUlib_keyInIText
( hu_itext_t* it,
unsigned char ch )
{
ch = toupper(ch);
if (ch >= ' ' && ch <= '_')
HUlib_addCharToTextLine(&it->l, (char) ch);

View File

@ -1,22 +1,19 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION: none
//
//-----------------------------------------------------------------------------
#ifndef __HULIB__
#define __HULIB__
@ -24,12 +21,6 @@
// We are referring to patches.
#include "r_defs.h"
// background and foreground screen numbers
// different from other modules.
#define BG 1
#define FG 0
// font stuff
#define HU_CHARERASE KEY_BACKSPACE
@ -189,8 +180,3 @@ void HUlib_drawIText(hu_itext_t* it);
void HUlib_eraseIText(hu_itext_t* it);
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,38 +1,36 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION: Heads-up displays
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: hu_stuff.c,v 1.4 1997/02/03 16:47:52 b1 Exp $";
#include <ctype.h>
#include "doomdef.h"
#include "doomkeys.h"
#include "z_zone.h"
#include "m_swap.h"
#include "deh_main.h"
#include "i_swap.h"
#include "i_video.h"
#include "hu_stuff.h"
#include "hu_lib.h"
#include "m_controls.h"
#include "m_misc.h"
#include "w_wad.h"
#include "s_sound.h"
@ -47,9 +45,10 @@ rcsid[] = "$Id: hu_stuff.c,v 1.4 1997/02/03 16:47:52 b1 Exp $";
// Locally used constants, shortcuts.
//
#define HU_TITLE (mapnames[(gameepisode-1)*9+gamemap-1])
#define HU_TITLE2 (mapnames2[gamemap-1])
#define HU_TITLEP (mapnamesp[gamemap-1])
#define HU_TITLET (mapnamest[gamemap-1])
#define HU_TITLE2 (mapnames_commercial[gamemap-1])
#define HU_TITLEP (mapnames_commercial[gamemap-1 + 32])
#define HU_TITLET (mapnames_commercial[gamemap-1 + 64])
#define HU_TITLE_CHEX (mapnames[gamemap - 1])
#define HU_TITLEHEIGHT 1
#define HU_TITLEX 0
#define HU_TITLEY (167 - SHORT(hu_font[0]->height))
@ -62,7 +61,7 @@ rcsid[] = "$Id: hu_stuff.c,v 1.4 1997/02/03 16:47:52 b1 Exp $";
char* chat_macros[] =
char *chat_macros[10] =
{
HUSTR_CHATMACRO0,
HUSTR_CHATMACRO1,
@ -84,7 +83,6 @@ char* player_names[] =
HUSTR_PLRRED
};
char chat_char; // remove later.
static player_t* plr;
patch_t* hu_font[HU_FONTSIZE];
@ -103,7 +101,6 @@ static hu_stext_t w_message;
static int message_counter;
extern int showMessages;
extern boolean automapactive;
static boolean headsupactive = false;
@ -166,8 +163,16 @@ char* mapnames[] = // DOOM shareware/registered/retail (Ultimate) names.
"NEWLEVEL"
};
char* mapnames2[] = // DOOM 2 map names.
// List of names for levels in commercial IWADs
// (doom2.wad, plutonia.wad, tnt.wad). These are stored in a
// single large array; WADs like pl2.wad have a MAP33, and rely on
// the layout in the Vanilla executable, where it is possible to
// overflow the end of one array into the next.
char *mapnames_commercial[] =
{
// DOOM 2 map names.
HUSTR_1,
HUSTR_2,
HUSTR_3,
@ -201,12 +206,10 @@ char* mapnames2[] = // DOOM 2 map names.
HUSTR_29,
HUSTR_30,
HUSTR_31,
HUSTR_32
};
HUSTR_32,
// Plutonia WAD map names.
char* mapnamesp[] = // Plutonia WAD map names.
{
PHUSTR_1,
PHUSTR_2,
PHUSTR_3,
@ -240,12 +243,10 @@ char* mapnamesp[] = // Plutonia WAD map names.
PHUSTR_29,
PHUSTR_30,
PHUSTR_31,
PHUSTR_32
};
PHUSTR_32,
// TNT WAD map names.
char *mapnamest[] = // TNT WAD map names.
{
THUSTR_1,
THUSTR_2,
THUSTR_3,
@ -282,113 +283,6 @@ char *mapnamest[] = // TNT WAD map names.
THUSTR_32
};
const char* shiftxform;
const char french_shiftxform[] =
{
0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31,
' ', '!', '"', '#', '$', '%', '&',
'"', // shift-'
'(', ')', '*', '+',
'?', // shift-,
'_', // shift--
'>', // shift-.
'?', // shift-/
'0', // shift-0
'1', // shift-1
'2', // shift-2
'3', // shift-3
'4', // shift-4
'5', // shift-5
'6', // shift-6
'7', // shift-7
'8', // shift-8
'9', // shift-9
'/',
'.', // shift-;
'<',
'+', // shift-=
'>', '?', '@',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'[', // shift-[
'!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
']', // shift-]
'"', '_',
'\'', // shift-`
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'{', '|', '}', '~', 127
};
const char english_shiftxform[] =
{
0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31,
' ', '!', '"', '#', '$', '%', '&',
'"', // shift-'
'(', ')', '*', '+',
'<', // shift-,
'_', // shift--
'>', // shift-.
'?', // shift-/
')', // shift-0
'!', // shift-1
'@', // shift-2
'#', // shift-3
'$', // shift-4
'%', // shift-5
'^', // shift-6
'&', // shift-7
'*', // shift-8
'(', // shift-9
':',
':', // shift-;
'<',
'+', // shift-=
'>', '?', '@',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'[', // shift-[
'!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
']', // shift-]
'"', '_',
'\'', // shift-`
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'{', '|', '}', '~', 127
};
char frenchKeyMap[128]=
{
0,
1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,
31,
' ','!','"','#','$','%','&','%','(',')','*','+',';','-',':','!',
'0','1','2','3','4','5','6','7','8','9',':','M','<','=','>','?',
'@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^','_',
'@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^',127
};
char ForeignTranslation(unsigned char ch)
{
return ch < 128 ? frenchKeyMap[ch] : ch;
}
void HU_Init(void)
{
@ -396,16 +290,11 @@ void HU_Init(void)
int j;
char buffer[9];
if (french)
shiftxform = french_shiftxform;
else
shiftxform = english_shiftxform;
// load the heads-up font
j = HU_FONTSTART;
for (i=0;i<HU_FONTSIZE;i++)
{
sprintf(buffer, "STCFN%.3d", j++);
DEH_snprintf(buffer, 9, "STCFN%.3d", j++);
hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC);
}
@ -443,28 +332,36 @@ void HU_Start(void)
hu_font,
HU_FONTSTART);
switch ( gamemode )
switch ( logical_gamemission )
{
case shareware:
case registered:
case retail:
case doom:
s = HU_TITLE;
break;
/* FIXME
case doom2:
s = HU_TITLE2;
break;
case pack_plut:
s = HU_TITLEP;
break;
case pack_tnt:
s = HU_TITLET;
break;
*/
case commercial:
default:
s = HU_TITLE2;
break;
s = "Unknown level";
break;
}
// Chex.exe always uses the episode 1 level title
// eg. E2M1 gives the title for E1M1
if (gameversion == exe_chex)
{
s = HU_TITLE_CHEX;
}
// dehacked substitution to get modified level name
s = DEH_String(s);
while (*s)
HUlib_addCharToTextLine(&w_title, *(s++));
@ -546,8 +443,6 @@ void HU_Ticker(void)
chat_dest[i] = c;
else
{
if (c >= 'a' && c <= 'z')
c = (char) shiftxform[(unsigned char) c];
rc = HUlib_keyInIText(&w_inputbuffer[i], c);
if (rc && c == KEY_ENTER)
{
@ -556,7 +451,7 @@ void HU_Ticker(void)
|| chat_dest[i] == HU_BROADCAST))
{
HUlib_addMessageToSText(&w_message,
player_names[i],
DEH_String(player_names[i]),
w_inputbuffer[i].l.l);
message_nottobefuckedwith = true;
@ -588,7 +483,7 @@ void HU_queueChatChar(char c)
{
if (((head + 1) & (QUEUESIZE-1)) == tail)
{
plr->message = HUSTR_MSGU;
plr->message = DEH_String(HUSTR_MSGU);
}
else
{
@ -620,20 +515,11 @@ boolean HU_Responder(event_t *ev)
static char lastmessage[HU_MAXLINELENGTH+1];
char* macromessage;
boolean eatkey = false;
static boolean shiftdown = false;
static boolean altdown = false;
unsigned char c;
int i;
int numplayers;
static char destination_keys[MAXPLAYERS] =
{
HUSTR_KEYGREEN,
HUSTR_KEYINDIGO,
HUSTR_KEYBROWN,
HUSTR_KEYRED
};
static int num_nobrainers = 0;
numplayers = 0;
@ -642,7 +528,6 @@ boolean HU_Responder(event_t *ev)
if (ev->data1 == KEY_RSHIFT)
{
shiftdown = ev->type == ev_keydown;
return false;
}
else if (ev->data1 == KEY_RALT || ev->data1 == KEY_LALT)
@ -656,13 +541,13 @@ boolean HU_Responder(event_t *ev)
if (!chat_on)
{
if (ev->data1 == HU_MSGREFRESH)
if (ev->data1 == key_message_refresh)
{
message_on = true;
message_counter = HU_MSGTIMEOUT;
eatkey = true;
}
else if (netgame && ev->data1 == HU_INPUTTOGGLE)
else if (netgame && ev->data2 == key_multi_msg)
{
eatkey = chat_on = true;
HUlib_resetIText(&w_chat);
@ -672,7 +557,7 @@ boolean HU_Responder(event_t *ev)
{
for (i=0; i<MAXPLAYERS ; i++)
{
if (ev->data1 == destination_keys[i])
if (ev->data2 == key_multi_msgplayer[i])
{
if (playeringame[i] && i!=consoleplayer)
{
@ -685,15 +570,15 @@ boolean HU_Responder(event_t *ev)
{
num_nobrainers++;
if (num_nobrainers < 3)
plr->message = HUSTR_TALKTOSELF1;
plr->message = DEH_String(HUSTR_TALKTOSELF1);
else if (num_nobrainers < 6)
plr->message = HUSTR_TALKTOSELF2;
plr->message = DEH_String(HUSTR_TALKTOSELF2);
else if (num_nobrainers < 9)
plr->message = HUSTR_TALKTOSELF3;
plr->message = DEH_String(HUSTR_TALKTOSELF3);
else if (num_nobrainers < 32)
plr->message = HUSTR_TALKTOSELF4;
plr->message = DEH_String(HUSTR_TALKTOSELF4);
else
plr->message = HUSTR_TALKTOSELF5;
plr->message = DEH_String(HUSTR_TALKTOSELF5);
}
}
}
@ -701,11 +586,10 @@ boolean HU_Responder(event_t *ev)
}
else
{
c = ev->data1;
// send a macro
if (altdown)
{
c = c - '0';
c = ev->data1 - '0';
if (c > 9)
return false;
// fprintf(stderr, "got here\n");
@ -719,35 +603,33 @@ boolean HU_Responder(event_t *ev)
HU_queueChatChar(*macromessage++);
HU_queueChatChar(KEY_ENTER);
// leave chat mode and notify that it was sent
chat_on = false;
strcpy(lastmessage, chat_macros[c]);
plr->message = lastmessage;
eatkey = true;
// leave chat mode and notify that it was sent
chat_on = false;
M_StringCopy(lastmessage, chat_macros[c], sizeof(lastmessage));
plr->message = lastmessage;
eatkey = true;
}
else
{
if (french)
c = ForeignTranslation(c);
if (shiftdown || (c >= 'a' && c <= 'z'))
c = shiftxform[c];
c = ev->data2;
eatkey = HUlib_keyInIText(&w_chat, c);
if (eatkey)
{
// static unsigned char buf[20]; // DEBUG
HU_queueChatChar(c);
// sprintf(buf, "KEY: %d => %d", ev->data1, c);
// plr->message = buf;
// M_snprintf(buf, sizeof(buf), "KEY: %d => %d", ev->data1, c);
// plr->message = buf;
}
if (c == KEY_ENTER)
{
chat_on = false;
if (w_chat.l.len)
{
strcpy(lastmessage, w_chat.l.l);
plr->message = lastmessage;
}
if (w_chat.l.len)
{
M_StringCopy(lastmessage, w_chat.l.l, sizeof(lastmessage));
plr->message = lastmessage;
}
}
else if (c == KEY_ESCAPE)
chat_on = false;

View File

@ -1,22 +1,19 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION: Head up display
//
//-----------------------------------------------------------------------------
#ifndef __HU_STUFF_H__
#define __HU_STUFF_H__
@ -35,7 +32,6 @@
#define HU_BROADCAST 5
#define HU_MSGREFRESH KEY_ENTER
#define HU_MSGX 0
#define HU_MSGY 0
#define HU_MSGWIDTH 64 // in characters
@ -57,10 +53,7 @@ void HU_Drawer(void);
char HU_dequeueChatChar(void);
void HU_Erase(void);
extern char *chat_macros[10];
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

243
frosted-doom/i_cdmus.c Normal file
View File

@ -0,0 +1,243 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 1993-2008 Raven Software
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// SDL implementation of the Hexen CD interface.
//
#include <stdio.h>
#ifdef ORIGCODE
#include "SDL.h"
#include "SDL_cdrom.h"
#endif
#include "doomtype.h"
#include "i_cdmus.h"
#ifdef ORIGCODE
static SDL_CD *cd_handle = NULL;
static char *startup_error = NULL;
static const char *cd_name = NULL;
#endif
int cd_Error;
int I_CDMusInit(void)
{
#ifdef ORIGCODE
int drive_num = 0;
// The initialize function is re-invoked when the CD track play cheat
// is used, so use the opportunity to call SDL_CDStatus() to update
// the status of the drive.
if (cd_handle == NULL)
{
if (SDL_Init(SDL_INIT_CDROM) < 0)
{
startup_error = "Failed to init CD subsystem.";
cd_Error = 1;
return -1;
}
// TODO: config variable to control CDROM to use.
cd_handle = SDL_CDOpen(drive_num);
if (cd_handle == NULL)
{
startup_error = "Failed to open CD-ROM drive.";
cd_Error = 1;
return -1;
}
cd_name = SDL_CDName(drive_num);
}
if (SDL_CDStatus(cd_handle) == CD_ERROR)
{
startup_error = "Failed to read CD status.";
cd_Error = 1;
return -1;
}
if (!CD_INDRIVE(cd_handle->status))
{
startup_error = "No CD in drive.";
cd_Error = 1;
return -1;
}
cd_Error = 0;
#endif
return 0;
}
// We cannot print status messages inline during startup, they must
// be deferred until after I_CDMusInit has returned.
void I_CDMusPrintStartup(void)
{
#ifdef ORIGCODE
if (cd_name != NULL)
{
printf("I_CDMusInit: Using CD-ROM drive: %s\n", cd_name);
}
if (startup_error != NULL)
{
fprintf(stderr, "I_CDMusInit: %s\n", startup_error);
}
#endif
}
int I_CDMusPlay(int track)
{
#ifdef ORIGCODE
int result;
if (cd_handle == NULL)
{
cd_Error = 1;
return -1;
}
// Play one track
// Track is indexed from 1.
result = SDL_CDPlayTracks(cd_handle, track - 1, 0, 1, 0);
cd_Error = 0;
return result;
#else
return 0;
#endif
}
int I_CDMusStop(void)
{
#ifdef ORIGCODE
int result;
result = SDL_CDStop(cd_handle);
cd_Error = 0;
return result;
#else
return 0;
#endif
}
int I_CDMusResume(void)
{
#ifdef ORIGCODE
int result;
result = SDL_CDResume(cd_handle);
cd_Error = 0;
return result;
#else
return 0;
#endif
}
int I_CDMusSetVolume(int volume)
{
/* Not supported yet */
cd_Error = 0;
return 0;
}
int I_CDMusFirstTrack(void)
{
#ifdef ORIGCODE
int i;
if (cd_handle == NULL)
{
cd_Error = 1;
return -1;
}
// Find the first audio track.
for (i=0; i<cd_handle->numtracks; ++i)
{
if (cd_handle->track[i].type == SDL_AUDIO_TRACK)
{
cd_Error = 0;
// Tracks are indexed from 1.
return i + 1;
}
}
// Don't know?
cd_Error = 1;
return -1;
#else
return 0;
#endif
}
int I_CDMusLastTrack(void)
{
#ifdef ORIGCODE
if (cd_handle == NULL)
{
cd_Error = 1;
return -1;
}
cd_Error = 0;
return cd_handle->numtracks;
#else
return 0;
#endif
}
int I_CDMusTrackLength(int track_num)
{
#ifdef ORIGCODE
SDL_CDtrack *track;
if (cd_handle == NULL || track_num < 1 || track_num > cd_handle->numtracks)
{
cd_Error = 1;
return -1;
}
// Track number is indexed from 1.
track = &cd_handle->track[track_num - 1];
// Round up to the next second
cd_Error = 0;
return (track->length + CD_FPS - 1) / CD_FPS;
#else
return 0;
#endif
}

41
frosted-doom/i_cdmus.h Normal file
View File

@ -0,0 +1,41 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 1993-2008 Raven Software
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// i_cdmus.h
#ifndef __ICDMUS__
#define __ICDMUS__
#define CDERR_NOTINSTALLED 10 // MSCDEX not installed
#define CDERR_NOAUDIOSUPPORT 11 // CD-ROM Doesn't support audio
#define CDERR_NOAUDIOTRACKS 12 // Current CD has no audio tracks
#define CDERR_BADDRIVE 20 // Bad drive number
#define CDERR_BADTRACK 21 // Bad track number
#define CDERR_IOCTLBUFFMEM 22 // Not enough low memory for IOCTL
#define CDERR_DEVREQBASE 100 // DevReq errors
extern int cd_Error;
int I_CDMusInit(void);
void I_CDMusPrintStartup(void);
int I_CDMusPlay(int track);
int I_CDMusStop(void);
int I_CDMusResume(void);
int I_CDMusSetVolume(int volume);
int I_CDMusFirstTrack(void);
int I_CDMusLastTrack(void);
int I_CDMusTrackLength(int track);
#endif

81
frosted-doom/i_endoom.c Normal file
View File

@ -0,0 +1,81 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Exit text-mode ENDOOM screen.
//
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "doomtype.h"
#include "i_video.h"
#ifdef ORIGCODE
#include "txt_main.h"
#endif
#define ENDOOM_W 80
#define ENDOOM_H 25
//
// Displays the text mode ending screen after the game quits
//
void I_Endoom(byte *endoom_data)
{
#ifdef ORIGCODE
unsigned char *screendata;
int y;
int indent;
// Set up text mode screen
TXT_Init();
I_InitWindowTitle();
I_InitWindowIcon();
// Write the data to the screen memory
screendata = TXT_GetScreenData();
indent = (ENDOOM_W - TXT_SCREEN_W) / 2;
for (y=0; y<TXT_SCREEN_H; ++y)
{
memcpy(screendata + (y * TXT_SCREEN_W * 2),
endoom_data + (y * ENDOOM_W + indent) * 2,
TXT_SCREEN_W * 2);
}
// Wait for a keypress
while (true)
{
TXT_UpdateScreen();
if (TXT_GetChar() > 0)
{
break;
}
TXT_Sleep(0);
}
// Shut down text mode screen
TXT_Shutdown();
#endif
}

29
frosted-doom/i_endoom.h Normal file
View File

@ -0,0 +1,29 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Exit text-mode ENDOOM screen.
//
#ifndef __I_ENDOOM__
#define __I_ENDOOM__
// Display the Endoom screen on shutdown. Pass a pointer to the
// ENDOOM lump.
void I_Endoom(byte *data);
#endif

359
frosted-doom/i_joystick.c Normal file
View File

@ -0,0 +1,359 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// SDL Joystick code.
//
#ifdef ORIGCODE
#include "SDL.h"
#include "SDL_joystick.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "doomtype.h"
#include "d_event.h"
#include "i_joystick.h"
#include "i_system.h"
#include "m_config.h"
#include "m_misc.h"
// When an axis is within the dead zone, it is set to zero.
// This is 5% of the full range:
#define DEAD_ZONE (32768 / 3)
#ifdef ORIGCODE
static SDL_Joystick *joystick = NULL;
#endif
// Configuration variables:
// Standard default.cfg Joystick enable/disable
static int usejoystick = 0;
// Joystick to use, as an SDL joystick index:
static int joystick_index = -1;
// Which joystick axis to use for horizontal movement, and whether to
// invert the direction:
static int joystick_x_axis = 0;
static int joystick_x_invert = 0;
// Which joystick axis to use for vertical movement, and whether to
// invert the direction:
static int joystick_y_axis = 1;
static int joystick_y_invert = 0;
// Which joystick axis to use for strafing?
static int joystick_strafe_axis = -1;
static int joystick_strafe_invert = 0;
// Virtual to physical button joystick button mapping. By default this
// is a straight mapping.
static int joystick_physical_buttons[NUM_VIRTUAL_BUTTONS] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
};
void I_ShutdownJoystick(void)
{
#ifdef ORIGCODE
if (joystick != NULL)
{
SDL_JoystickClose(joystick);
joystick = NULL;
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
#endif
}
#ifdef ORIGCODE
static boolean IsValidAxis(int axis)
{
int num_axes;
if (axis < 0)
{
return true;
}
if (IS_BUTTON_AXIS(axis))
{
return true;
}
if (IS_HAT_AXIS(axis))
{
return HAT_AXIS_HAT(axis) < SDL_JoystickNumHats(joystick);
}
num_axes = SDL_JoystickNumAxes(joystick);
return axis < num_axes;
}
#endif
void I_InitJoystick(void)
{
#ifdef ORIGCODE
if (!usejoystick)
{
return;
}
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
{
return;
}
if (joystick_index < 0 || joystick_index >= SDL_NumJoysticks())
{
printf("I_InitJoystick: Invalid joystick ID: %i\n", joystick_index);
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
return;
}
// Open the joystick
joystick = SDL_JoystickOpen(joystick_index);
if (joystick == NULL)
{
printf("I_InitJoystick: Failed to open joystick #%i\n",
joystick_index);
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
return;
}
if (!IsValidAxis(joystick_x_axis)
|| !IsValidAxis(joystick_y_axis)
|| !IsValidAxis(joystick_strafe_axis))
{
printf("I_InitJoystick: Invalid joystick axis for joystick #%i "
"(run joystick setup again)\n",
joystick_index);
SDL_JoystickClose(joystick);
joystick = NULL;
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
SDL_JoystickEventState(SDL_ENABLE);
// Initialized okay!
printf("I_InitJoystick: %s\n", SDL_JoystickName(joystick_index));
I_AtExit(I_ShutdownJoystick, true);
#endif
}
#ifdef ORIGCODE
static boolean IsAxisButton(int physbutton)
{
if (IS_BUTTON_AXIS(joystick_x_axis))
{
if (physbutton == BUTTON_AXIS_NEG(joystick_x_axis)
|| physbutton == BUTTON_AXIS_POS(joystick_x_axis))
{
return true;
}
}
if (IS_BUTTON_AXIS(joystick_y_axis))
{
if (physbutton == BUTTON_AXIS_NEG(joystick_y_axis)
|| physbutton == BUTTON_AXIS_POS(joystick_y_axis))
{
return true;
}
}
if (IS_BUTTON_AXIS(joystick_strafe_axis))
{
if (physbutton == BUTTON_AXIS_NEG(joystick_strafe_axis)
|| physbutton == BUTTON_AXIS_POS(joystick_strafe_axis))
{
return true;
}
}
return false;
}
// Get the state of the given virtual button.
static int ReadButtonState(int vbutton)
{
int physbutton;
// Map from virtual button to physical (SDL) button.
if (vbutton < NUM_VIRTUAL_BUTTONS)
{
physbutton = joystick_physical_buttons[vbutton];
}
else
{
physbutton = vbutton;
}
// Never read axis buttons as buttons.
if (IsAxisButton(physbutton))
{
return 0;
}
return SDL_JoystickGetButton(joystick, physbutton);
}
// Get a bitmask of all currently-pressed buttons
static int GetButtonsState(void)
{
int i;
int result;
result = 0;
for (i = 0; i < 20; ++i)
{
if (ReadButtonState(i))
{
result |= 1 << i;
}
}
return result;
}
// Read the state of an axis, inverting if necessary.
static int GetAxisState(int axis, int invert)
{
int result;
// Axis -1 means disabled.
if (axis < 0)
{
return 0;
}
// Is this a button axis, or a hat axis?
// If so, we need to handle it specially.
result = 0;
if (IS_BUTTON_AXIS(axis))
{
if (SDL_JoystickGetButton(joystick, BUTTON_AXIS_NEG(axis)))
{
result -= 32767;
}
if (SDL_JoystickGetButton(joystick, BUTTON_AXIS_POS(axis)))
{
result += 32767;
}
}
else if (IS_HAT_AXIS(axis))
{
int direction = HAT_AXIS_DIRECTION(axis);
int hatval = SDL_JoystickGetHat(joystick, HAT_AXIS_HAT(axis));
if (direction == HAT_AXIS_HORIZONTAL)
{
if ((hatval & SDL_HAT_LEFT) != 0)
{
result -= 32767;
}
else if ((hatval & SDL_HAT_RIGHT) != 0)
{
result += 32767;
}
}
else if (direction == HAT_AXIS_VERTICAL)
{
if ((hatval & SDL_HAT_UP) != 0)
{
result -= 32767;
}
else if ((hatval & SDL_HAT_DOWN) != 0)
{
result += 32767;
}
}
}
else
{
result = SDL_JoystickGetAxis(joystick, axis);
if (result < DEAD_ZONE && result > -DEAD_ZONE)
{
result = 0;
}
}
if (invert)
{
result = -result;
}
return result;
}
#endif
void I_UpdateJoystick(void)
{
#ifdef ORIGCODE
if (joystick != NULL)
{
event_t ev;
ev.type = ev_joystick;
ev.data1 = GetButtonsState();
ev.data2 = GetAxisState(joystick_x_axis, joystick_x_invert);
ev.data3 = GetAxisState(joystick_y_axis, joystick_y_invert);
ev.data4 = GetAxisState(joystick_strafe_axis, joystick_strafe_invert);
D_PostEvent(&ev);
}
#endif
}
void I_BindJoystickVariables(void)
{
int i;
M_BindVariable("use_joystick", &usejoystick);
M_BindVariable("joystick_index", &joystick_index);
M_BindVariable("joystick_x_axis", &joystick_x_axis);
M_BindVariable("joystick_y_axis", &joystick_y_axis);
M_BindVariable("joystick_strafe_axis", &joystick_strafe_axis);
M_BindVariable("joystick_x_invert", &joystick_x_invert);
M_BindVariable("joystick_y_invert", &joystick_y_invert);
M_BindVariable("joystick_strafe_invert",&joystick_strafe_invert);
for (i = 0; i < NUM_VIRTUAL_BUTTONS; ++i)
{
char name[32];
M_snprintf(name, sizeof(name), "joystick_physical_button%i", i);
M_BindVariable(name, &joystick_physical_buttons[i]);
}
}

70
frosted-doom/i_joystick.h Normal file
View File

@ -0,0 +1,70 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// System-specific joystick interface.
//
#ifndef __I_JOYSTICK__
#define __I_JOYSTICK__
// Number of "virtual" joystick buttons defined in configuration files.
// This needs to be at least as large as the number of different key
// bindings supported by the higher-level game code (joyb* variables).
#define NUM_VIRTUAL_BUTTONS 10
// If this bit is set in a configuration file axis value, the axis is
// not actually a joystick axis, but instead is a "button axis". This
// means that instead of reading an SDL joystick axis, we read the
// state of two buttons to get the axis value. This is needed for eg.
// the PS3 SIXAXIS controller, where the D-pad buttons register as
// buttons, not as two axes.
#define BUTTON_AXIS 0x10000
// Query whether a given axis value describes a button axis.
#define IS_BUTTON_AXIS(axis) ((axis) >= 0 && ((axis) & BUTTON_AXIS) != 0)
// Get the individual buttons from a button axis value.
#define BUTTON_AXIS_NEG(axis) ((axis) & 0xff)
#define BUTTON_AXIS_POS(axis) (((axis) >> 8) & 0xff)
// Create a button axis value from two button values.
#define CREATE_BUTTON_AXIS(neg, pos) (BUTTON_AXIS | (neg) | ((pos) << 8))
// If this bit is set in an axis value, the axis is not actually a
// joystick axis, but is a "hat" axis. This means that we read (one of)
// the hats on the joystick.
#define HAT_AXIS 0x20000
#define IS_HAT_AXIS(axis) ((axis) >= 0 && ((axis) & HAT_AXIS) != 0)
// Get the hat number from a hat axis value.
#define HAT_AXIS_HAT(axis) ((axis) & 0xff)
// Which axis of the hat? (horizonal or vertical)
#define HAT_AXIS_DIRECTION(axis) (((axis) >> 8) & 0xff)
#define CREATE_HAT_AXIS(hat, direction) \
(HAT_AXIS | (hat) | ((direction) << 8))
#define HAT_AXIS_HORIZONTAL 1
#define HAT_AXIS_VERTICAL 2
void I_InitJoystick(void);
void I_ShutdownJoystick(void);
void I_UpdateJoystick(void);
void I_BindJoystickVariables(void);
#endif /* #ifndef __I_JOYSTICK__ */

View File

@ -1,45 +1,50 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Main program, simply calls D_DoomMain high level loop.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: i_main.c,v 1.4 1997/02/03 22:45:10 b1 Exp $";
#include "config.h"
#include <stdio.h>
#include "doomdef.h"
#include "doomtype.h"
#include "i_system.h"
#include "m_argv.h"
#include "d_main.h"
int
main
( int argc,
char** argv )
{
myargc = argc;
myargv = argv;
D_DoomMain ();
//
// D_DoomMain()
// Not a globally visible function, just included for source reference,
// calls all startup code, parses command line options.
//
void D_DoomMain (void);
int main(int argc, char **argv)
{
// save arguments
myargc = argc;
myargv = argv;
M_FindResponseFile();
// start doom
printf("Starting D_DoomMain\r\n");
D_DoomMain ();
return 0;
}
}

View File

@ -1,332 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
//
// DESCRIPTION:
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include "i_system.h"
#include "d_event.h"
#include "d_net.h"
#include "m_argv.h"
#include "doomstat.h"
#ifdef __GNUG__
#pragma implementation "i_net.h"
#endif
#include "i_net.h"
void NetSend (void);
boolean NetListen (void);
//
// NETWORKING
//
int DOOMPORT = (IPPORT_USERRESERVED +0x1d );
int sendsocket;
int insocket;
struct sockaddr_in sendaddress[MAXNETNODES];
void (*netget) (void);
void (*netsend) (void);
//
// UDPsocket
//
int UDPsocket (void)
{
int s;
// allocate a socket
s = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s<0)
I_Error ("can't create socket: %s",strerror(errno));
return s;
}
//
// BindToLocalPort
//
void
BindToLocalPort
( int s,
int port )
{
int v;
struct sockaddr_in address;
memset (&address, 0, sizeof(address));
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = port;
v = bind (s, (void *)&address, sizeof(address));
if (v == -1)
I_Error ("BindToPort: bind: %s", strerror(errno));
}
//
// PacketSend
//
void PacketSend (void)
{
int c;
doomdata_t sw;
// byte swap
sw.checksum = htonl(netbuffer->checksum);
sw.player = netbuffer->player;
sw.retransmitfrom = netbuffer->retransmitfrom;
sw.starttic = netbuffer->starttic;
sw.numtics = netbuffer->numtics;
for (c=0 ; c< netbuffer->numtics ; c++)
{
sw.cmds[c].forwardmove = netbuffer->cmds[c].forwardmove;
sw.cmds[c].sidemove = netbuffer->cmds[c].sidemove;
sw.cmds[c].angleturn = htons(netbuffer->cmds[c].angleturn);
sw.cmds[c].consistancy = htons(netbuffer->cmds[c].consistancy);
sw.cmds[c].chatchar = netbuffer->cmds[c].chatchar;
sw.cmds[c].buttons = netbuffer->cmds[c].buttons;
}
//printf ("sending %i\n",gametic);
c = sendto (sendsocket , &sw, doomcom->datalength
,0,(void *)&sendaddress[doomcom->remotenode]
,sizeof(sendaddress[doomcom->remotenode]));
// if (c == -1)
// I_Error ("SendPacket error: %s",strerror(errno));
}
//
// PacketGet
//
void PacketGet (void)
{
int i;
int c;
struct sockaddr_in fromaddress;
int fromlen;
doomdata_t sw;
fromlen = sizeof(fromaddress);
c = recvfrom (insocket, &sw, sizeof(sw), 0
, (struct sockaddr *)&fromaddress, (socklen_t *)&fromlen );
if (c == -1 )
{
if (errno != EWOULDBLOCK)
I_Error ("GetPacket: %s",strerror(errno));
doomcom->remotenode = -1; // no packet
return;
}
{
static int first=1;
if (first)
printf("len=%d:p=[0x%x 0x%x] \n", c, *(int*)&sw, *((int*)&sw+1));
first = 0;
}
// find remote node number
for (i=0 ; i<doomcom->numnodes ; i++)
if ( fromaddress.sin_addr.s_addr == sendaddress[i].sin_addr.s_addr )
break;
if (i == doomcom->numnodes)
{
// packet is not from one of the players (new game broadcast)
doomcom->remotenode = -1; // no packet
return;
}
doomcom->remotenode = i; // good packet from a game player
doomcom->datalength = c;
// byte swap
netbuffer->checksum = ntohl(sw.checksum);
netbuffer->player = sw.player;
netbuffer->retransmitfrom = sw.retransmitfrom;
netbuffer->starttic = sw.starttic;
netbuffer->numtics = sw.numtics;
for (c=0 ; c< netbuffer->numtics ; c++)
{
netbuffer->cmds[c].forwardmove = sw.cmds[c].forwardmove;
netbuffer->cmds[c].sidemove = sw.cmds[c].sidemove;
netbuffer->cmds[c].angleturn = ntohs(sw.cmds[c].angleturn);
netbuffer->cmds[c].consistancy = ntohs(sw.cmds[c].consistancy);
netbuffer->cmds[c].chatchar = sw.cmds[c].chatchar;
netbuffer->cmds[c].buttons = sw.cmds[c].buttons;
}
}
int GetLocalAddress (void)
{
struct hostent* hostentry; // host information entry
int v;
static char hostname[512];
// get local address
v = gethostname (hostname, sizeof(hostname));
if (v == -1)
I_Error ("GetLocalAddress : gethostname: errno %d",errno);
hostentry = gethostbyname (hostname);
if (!hostentry)
I_Error ("GetLocalAddress : gethostbyname: couldn't get local host");
return *(int *)hostentry->h_addr_list[0];
}
//
// I_InitNetwork
//
void I_InitNetwork (void)
{
//boolean trueval = true;
int i;
int p;
struct hostent* hostentry; // host information entry
doomcom = malloc (sizeof (*doomcom) );
memset (doomcom, 0, sizeof(*doomcom) );
// set up for network
i = M_CheckParm ("-dup");
if (i && i< myargc-1)
{
doomcom->ticdup = myargv[i+1][0]-'0';
if (doomcom->ticdup < 1)
doomcom->ticdup = 1;
if (doomcom->ticdup > 9)
doomcom->ticdup = 9;
}
else
doomcom-> ticdup = 1;
if (M_CheckParm ("-extratic"))
doomcom-> extratics = 1;
else
doomcom-> extratics = 0;
p = M_CheckParm ("-port");
if (p && p<myargc-1)
{
DOOMPORT = atoi (myargv[p+1]);
printf ("using alternate port %i\n",DOOMPORT);
}
// parse network game options,
// -net <consoleplayer> <host> <host> ...
i = M_CheckParm ("-net");
if (!i)
{
// single player game
netgame = false;
doomcom->id = DOOMCOM_ID;
doomcom->numplayers = doomcom->numnodes = 1;
doomcom->deathmatch = false;
doomcom->consoleplayer = 0;
return;
}
netsend = PacketSend;
netget = PacketGet;
netgame = true;
// parse player number and host list
doomcom->consoleplayer = myargv[i+1][0]-'1';
doomcom->numnodes = 1; // this node for sure
i++;
while (++i < myargc && myargv[i][0] != '-')
{
sendaddress[doomcom->numnodes].sin_family = AF_INET;
sendaddress[doomcom->numnodes].sin_port = htons(DOOMPORT);
if (myargv[i][0] == '.')
{
sendaddress[doomcom->numnodes].sin_addr.s_addr
= inet_addr (myargv[i]+1);
}
else
{
hostentry = gethostbyname (myargv[i]);
if (!hostentry)
I_Error ("gethostbyname: couldn't find %s", myargv[i]);
sendaddress[doomcom->numnodes].sin_addr.s_addr
= *(int *)hostentry->h_addr_list[0];
}
doomcom->numnodes++;
}
doomcom->id = DOOMCOM_ID;
doomcom->numplayers = doomcom->numnodes;
// build message to receive
insocket = UDPsocket ();
BindToLocalPort (insocket,htons(DOOMPORT));
//XXX ioctl (insocket, FIONBIO, &trueval);
fcntl (insocket,F_SETFL, O_NONBLOCK);
sendsocket = UDPsocket ();
}
void I_NetCmd (void)
{
if (doomcom->command == CMD_SEND)
{
netsend ();
}
else if (doomcom->command == CMD_GET)
{
netget ();
}
else
I_Error ("Bad net cmd: %i\n",doomcom->command);
}

View File

@ -1,45 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// DESCRIPTION:
// System specific network interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __I_NET__
#define __I_NET__
#ifdef __GNUG__
#pragma interface
#endif
// Called by D_DoomMain.
void I_InitNetwork (void);
void I_NetCmd (void);
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

1616
frosted-doom/i_oplmusic.c Normal file

File diff suppressed because it is too large Load Diff

330
frosted-doom/i_pcsound.c Normal file
View File

@ -0,0 +1,330 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// System interface for PC speaker sound.
//
#include "SDL.h"
#include <string.h>
#include "doomtype.h"
#include "deh_str.h"
#include "i_sound.h"
#include "m_misc.h"
#include "w_wad.h"
#include "z_zone.h"
#include "pcsound.h"
#define TIMER_FREQ 1193181 /* hz */
static boolean pcs_initialized = false;
static SDL_mutex *sound_lock;
static boolean use_sfx_prefix;
static uint8_t *current_sound_lump = NULL;
static uint8_t *current_sound_pos = NULL;
static unsigned int current_sound_remaining = 0;
static int current_sound_handle = 0;
static int current_sound_lump_num = -1;
static const uint16_t divisors[] = {
0,
6818, 6628, 6449, 6279, 6087, 5906, 5736, 5575,
5423, 5279, 5120, 4971, 4830, 4697, 4554, 4435,
4307, 4186, 4058, 3950, 3836, 3728, 3615, 3519,
3418, 3323, 3224, 3131, 3043, 2960, 2875, 2794,
2711, 2633, 2560, 2485, 2415, 2348, 2281, 2213,
2153, 2089, 2032, 1975, 1918, 1864, 1810, 1757,
1709, 1659, 1612, 1565, 1521, 1478, 1435, 1395,
1355, 1316, 1280, 1242, 1207, 1173, 1140, 1107,
1075, 1045, 1015, 986, 959, 931, 905, 879,
854, 829, 806, 783, 760, 739, 718, 697,
677, 658, 640, 621, 604, 586, 570, 553,
538, 522, 507, 493, 479, 465, 452, 439,
427, 415, 403, 391, 380, 369, 359, 348,
339, 329, 319, 310, 302, 293, 285, 276,
269, 261, 253, 246, 239, 232, 226, 219,
213, 207, 201, 195, 190, 184, 179,
};
static void PCSCallbackFunc(int *duration, int *freq)
{
unsigned int tone;
*duration = 1000 / 140;
if (SDL_LockMutex(sound_lock) < 0)
{
*freq = 0;
return;
}
if (current_sound_lump != NULL && current_sound_remaining > 0)
{
// Read the next tone
tone = *current_sound_pos;
// Use the tone -> frequency lookup table. See pcspkr10.zip
// for a full discussion of this.
// Check we don't overflow the frequency table.
if (tone < arrlen(divisors) && divisors[tone] != 0)
{
*freq = (int) (TIMER_FREQ / divisors[tone]);
}
else
{
*freq = 0;
}
++current_sound_pos;
--current_sound_remaining;
}
else
{
*freq = 0;
}
SDL_UnlockMutex(sound_lock);
}
static boolean CachePCSLump(sfxinfo_t *sfxinfo)
{
int lumplen;
int headerlen;
// Free the current sound lump back to the cache
if (current_sound_lump != NULL)
{
W_ReleaseLumpNum(current_sound_lump_num);
current_sound_lump = NULL;
}
// Load from WAD
current_sound_lump = W_CacheLumpNum(sfxinfo->lumpnum, PU_STATIC);
lumplen = W_LumpLength(sfxinfo->lumpnum);
// Read header
if (current_sound_lump[0] != 0x00 || current_sound_lump[1] != 0x00)
{
return false;
}
headerlen = (current_sound_lump[3] << 8) | current_sound_lump[2];
if (headerlen > lumplen - 4)
{
return false;
}
// Header checks out ok
current_sound_remaining = headerlen;
current_sound_pos = current_sound_lump + 4;
current_sound_lump_num = sfxinfo->lumpnum;
return true;
}
// These Doom PC speaker sounds are not played - this can be seen in the
// Heretic source code, where there are remnants of this left over
// from Doom.
static boolean IsDisabledSound(sfxinfo_t *sfxinfo)
{
int i;
const char *disabled_sounds[] = {
"posact",
"bgact",
"dmact",
"dmpain",
"popain",
"sawidl",
};
for (i=0; i<arrlen(disabled_sounds); ++i)
{
if (!strcmp(sfxinfo->name, disabled_sounds[i]))
{
return true;
}
}
return false;
}
static int I_PCS_StartSound(sfxinfo_t *sfxinfo,
int channel,
int vol,
int sep)
{
int result;
if (!pcs_initialized)
{
return -1;
}
if (IsDisabledSound(sfxinfo))
{
return -1;
}
if (SDL_LockMutex(sound_lock) < 0)
{
return -1;
}
result = CachePCSLump(sfxinfo);
if (result)
{
current_sound_handle = channel;
}
SDL_UnlockMutex(sound_lock);
if (result)
{
return channel;
}
else
{
return -1;
}
}
static void I_PCS_StopSound(int handle)
{
if (!pcs_initialized)
{
return;
}
if (SDL_LockMutex(sound_lock) < 0)
{
return;
}
// If this is the channel currently playing, immediately end it.
if (current_sound_handle == handle)
{
current_sound_remaining = 0;
}
SDL_UnlockMutex(sound_lock);
}
//
// Retrieve the raw data lump index
// for a given SFX name.
//
static int I_PCS_GetSfxLumpNum(sfxinfo_t* sfx)
{
char namebuf[9];
if (use_sfx_prefix)
{
M_snprintf(namebuf, sizeof(namebuf), "dp%s", DEH_String(sfx->name));
}
else
{
M_StringCopy(namebuf, DEH_String(sfx->name), sizeof(namebuf));
}
return W_GetNumForName(namebuf);
}
static boolean I_PCS_SoundIsPlaying(int handle)
{
if (!pcs_initialized)
{
return false;
}
if (handle != current_sound_handle)
{
return false;
}
return current_sound_lump != NULL && current_sound_remaining > 0;
}
static boolean I_PCS_InitSound(boolean _use_sfx_prefix)
{
use_sfx_prefix = _use_sfx_prefix;
// Use the sample rate from the configuration file
PCSound_SetSampleRate(snd_samplerate);
// Initialize the PC speaker subsystem.
pcs_initialized = PCSound_Init(PCSCallbackFunc);
if (pcs_initialized)
{
sound_lock = SDL_CreateMutex();
}
return pcs_initialized;
}
static void I_PCS_ShutdownSound(void)
{
if (pcs_initialized)
{
PCSound_Shutdown();
}
}
static void I_PCS_UpdateSound(void)
{
// no-op.
}
void I_PCS_UpdateSoundParams(int channel, int vol, int sep)
{
// no-op.
}
static snddevice_t sound_pcsound_devices[] =
{
SNDDEVICE_PCSPEAKER,
};
sound_module_t sound_pcsound_module =
{
sound_pcsound_devices,
arrlen(sound_pcsound_devices),
I_PCS_InitSound,
I_PCS_ShutdownSound,
I_PCS_GetSfxLumpNum,
I_PCS_UpdateSound,
I_PCS_UpdateSoundParams,
I_PCS_StartSound,
I_PCS_StopSound,
I_PCS_SoundIsPlaying,
};

1452
frosted-doom/i_scale.c Normal file

File diff suppressed because it is too large Load Diff

53
frosted-doom/i_scale.h Normal file
View File

@ -0,0 +1,53 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Pixel-doubling scale up functions.
//
#ifndef __I_SCALE__
#define __I_SCALE__
#include "doomtype.h"
void I_InitScale(byte *_src_buffer, byte *_dest_buffer, int _dest_pitch);
void I_ResetScaleTables(byte *palette);
// Scaled modes (direct multiples of 320x200)
extern screen_mode_t mode_scale_1x;
extern screen_mode_t mode_scale_2x;
extern screen_mode_t mode_scale_3x;
extern screen_mode_t mode_scale_4x;
extern screen_mode_t mode_scale_5x;
// Vertically stretched modes (320x200 -> multiples of 320x240)
extern screen_mode_t mode_stretch_1x;
extern screen_mode_t mode_stretch_2x;
extern screen_mode_t mode_stretch_3x;
extern screen_mode_t mode_stretch_4x;
extern screen_mode_t mode_stretch_5x;
// Horizontally squashed modes (320x200 -> multiples of 256x200)
extern screen_mode_t mode_squash_1x;
extern screen_mode_t mode_squash_2x;
extern screen_mode_t mode_squash_3x;
extern screen_mode_t mode_squash_4x;
extern screen_mode_t mode_squash_5x;
#endif /* #ifndef __I_SCALE__ */

1322
frosted-doom/i_sdlmusic.c Normal file

File diff suppressed because it is too large Load Diff

1092
frosted-doom/i_sdlsound.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,122 +1,238 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// System interface, sound.
// The not so system specific sound interface.
//
//-----------------------------------------------------------------------------
#ifndef __I_SOUND__
#define __I_SOUND__
#include "doomdef.h"
// UNIX hack, to be removed.
#ifdef SNDSERV
#include <stdio.h>
extern FILE* sndserver;
extern char* sndserver_filename;
#endif
#include "doomstat.h"
#include "sounds.h"
#include "doomtype.h"
//
// SoundFX struct.
//
typedef struct sfxinfo_struct sfxinfo_t;
// Init at program start...
void I_InitSound();
struct sfxinfo_struct
{
// tag name, used for hexen.
char *tagname;
// lump name. If we are running with use_sfx_prefix=true, a
// 'DS' (or 'DP' for PC speaker sounds) is prepended to this.
// ... update sound buffer and audio device at runtime...
void I_UpdateSound(void);
void I_SubmitSound(void);
char name[9];
// ... shut down and relase at program termination.
// Sfx priority
int priority;
// referenced sound if a link
sfxinfo_t *link;
// pitch if a link
int pitch;
// volume if a link
int volume;
// this is checked every second to see if sound
// can be thrown out (if 0, then decrement, if -1,
// then throw out, if > 0, then it is in use)
int usefulness;
// lump number of sfx
int lumpnum;
// Maximum number of channels that the sound can be played on
// (Heretic)
int numchannels;
// data used by the low level code
void *driver_data;
};
//
// MusicInfo struct.
//
typedef struct
{
// up to 6-character name
char *name;
// lump number of music
int lumpnum;
// music data
void *data;
// music handle once registered
void *handle;
} musicinfo_t;
typedef enum
{
SNDDEVICE_NONE = 0,
SNDDEVICE_PCSPEAKER = 1,
SNDDEVICE_ADLIB = 2,
SNDDEVICE_SB = 3,
SNDDEVICE_PAS = 4,
SNDDEVICE_GUS = 5,
SNDDEVICE_WAVEBLASTER = 6,
SNDDEVICE_SOUNDCANVAS = 7,
SNDDEVICE_GENMIDI = 8,
SNDDEVICE_AWE32 = 9,
SNDDEVICE_CD = 10,
} snddevice_t;
// Interface for sound modules
typedef struct
{
// List of sound devices that this sound module is used for.
snddevice_t *sound_devices;
int num_sound_devices;
// Initialise sound module
// Returns true if successfully initialised
boolean (*Init)(boolean use_sfx_prefix);
// Shutdown sound module
void (*Shutdown)(void);
// Returns the lump index of the given sound.
int (*GetSfxLumpNum)(sfxinfo_t *sfxinfo);
// Called periodically to update the subsystem.
void (*Update)(void);
// Update the sound settings on the given channel.
void (*UpdateSoundParams)(int channel, int vol, int sep);
// Start a sound on a given channel. Returns the channel id
// or -1 on failure.
int (*StartSound)(sfxinfo_t *sfxinfo, int channel, int vol, int sep);
// Stop the sound playing on the given channel.
void (*StopSound)(int channel);
// Query if a sound is playing on the given channel
boolean (*SoundIsPlaying)(int channel);
// Called on startup to precache sound effects (if necessary)
void (*CacheSounds)(sfxinfo_t *sounds, int num_sounds);
} sound_module_t;
void I_InitSound(boolean use_sfx_prefix);
void I_ShutdownSound(void);
int I_GetSfxLumpNum(sfxinfo_t *sfxinfo);
void I_UpdateSound(void);
void I_UpdateSoundParams(int channel, int vol, int sep);
int I_StartSound(sfxinfo_t *sfxinfo, int channel, int vol, int sep);
void I_StopSound(int channel);
boolean I_SoundIsPlaying(int channel);
void I_PrecacheSounds(sfxinfo_t *sounds, int num_sounds);
// Interface for music modules
//
// SFX I/O
//
typedef struct
{
// List of sound devices that this music module is used for.
// Initialize channels?
void I_SetChannels();
snddevice_t *sound_devices;
int num_sound_devices;
// Get raw data lump index for sound descriptor.
int I_GetSfxLumpNum (sfxinfo_t* sfxinfo );
// Initialise the music subsystem
boolean (*Init)(void);
// Starts a sound in a particular sound channel.
int
I_StartSound
( int id,
int vol,
int sep,
int pitch,
int priority );
// Shutdown the music subsystem
void (*Shutdown)(void);
// Stops a sound channel.
void I_StopSound(int handle);
// Set music volume - range 0-127
// Called by S_*() functions
// to see if a channel is still playing.
// Returns 0 if no longer playing, 1 if playing.
int I_SoundIsPlaying(int handle);
void (*SetMusicVolume)(int volume);
// Updates the volume, separation,
// and pitch of a sound channel.
void
I_UpdateSoundParams
( int handle,
int vol,
int sep,
int pitch );
// Pause music
void (*PauseMusic)(void);
// Un-pause music
void (*ResumeMusic)(void);
// Register a song handle from data
// Returns a handle that can be used to play the song
void *(*RegisterSong)(void *data, int len);
// Un-register (free) song data
void (*UnRegisterSong)(void *handle);
// Play the song
void (*PlaySong)(void *handle, boolean looping);
// Stop playing the current song.
void (*StopSong)(void);
// Query if music is playing.
boolean (*MusicIsPlaying)(void);
// Invoked periodically to poll.
void (*Poll)(void);
} music_module_t;
//
// MUSIC I/O
//
void I_InitMusic(void);
void I_ShutdownMusic(void);
// Volume.
void I_SetMusicVolume(int volume);
// PAUSE game handling.
void I_PauseSong(int handle);
void I_ResumeSong(int handle);
// Registers a song handle to song data.
int I_RegisterSong(void *data);
// Called by anything that wishes to start music.
// plays a song, and when the song is done,
// starts playing it again in an endless loop.
// Horrible thing to do, considering.
void
I_PlaySong
( int handle,
int looping );
// Stops a song over 3 seconds.
void I_StopSong(int handle);
// See above (register), then think backwards
void I_UnRegisterSong(int handle);
void I_PauseSong(void);
void I_ResumeSong(void);
void *I_RegisterSong(void *data, int len);
void I_UnRegisterSong(void *handle);
void I_PlaySong(void *handle, boolean looping);
void I_StopSong(void);
boolean I_MusicIsPlaying(void);
extern int snd_sfxdevice;
extern int snd_musicdevice;
extern int snd_samplerate;
extern int snd_cachesize;
extern int snd_maxslicetime_ms;
extern char *snd_musiccmd;
void I_BindSoundVariables(void);
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

54
frosted-doom/i_swap.h Normal file
View File

@ -0,0 +1,54 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Endianess handling, swapping 16bit and 32bit.
//
#ifndef __I_SWAP__
#define __I_SWAP__
#ifdef ORIGCODE
#include "SDL_endian.h"
// Endianess handling.
// WAD files are stored little endian.
// Just use SDL's endianness swapping functions.
// These are deliberately cast to signed values; this is the behaviour
// of the macros in the original source and some code relies on it.
#define SHORT(x) ((signed short) SDL_SwapLE16(x))
#define LONG(x) ((signed int) SDL_SwapLE32(x))
// Defines for checking the endianness of the system.
#if SDL_BYTEORDER == SYS_LIL_ENDIAN
#define SYS_LITTLE_ENDIAN
#elif SDL_BYTEORDER == SYS_BIG_ENDIAN
#define SYS_BIG_ENDIAN
#endif
#else
#define SHORT(x) ((signed short) (x))
#define LONG(x) ((signed int) (x))
#define SYS_LITTLE_ENDIAN
#endif
#endif

View File

@ -1,182 +1,574 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <sys/time.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <unistd.h>
#include "doomdef.h"
#include "m_misc.h"
#include "i_video.h"
#include "i_sound.h"
#include "d_net.h"
#include "g_game.h"
#ifdef __GNUG__
#pragma implementation "i_system.h"
#endif
#ifdef ORIGCODE
#include "SDL.h"
#endif
#include "config.h"
#include "deh_str.h"
#include "doomtype.h"
#include "m_argv.h"
#include "m_config.h"
#include "m_misc.h"
#include "i_joystick.h"
#include "i_sound.h"
#include "i_timer.h"
#include "i_video.h"
#include "i_system.h"
#include "w_wad.h"
#include "z_zone.h"
#ifdef __MACOSX__
#include <CoreFoundation/CFUserNotification.h>
#endif
#define DEFAULT_RAM 6 /* MiB */
#define MIN_RAM 6 /* MiB */
typedef struct atexit_listentry_s atexit_listentry_t;
int mb_used = 6;
void
I_Tactile
( int on,
int off,
int total )
struct atexit_listentry_s
{
// UNUSED.
on = off = total = 0;
atexit_func_t func;
boolean run_on_error;
atexit_listentry_t *next;
};
static atexit_listentry_t *exit_funcs = NULL;
void I_AtExit(atexit_func_t func, boolean run_on_error)
{
atexit_listentry_t *entry;
entry = malloc(sizeof(*entry));
entry->func = func;
entry->run_on_error = run_on_error;
entry->next = exit_funcs;
exit_funcs = entry;
}
ticcmd_t emptycmd;
ticcmd_t* I_BaseTiccmd(void)
// Tactile feedback function, probably used for the Logitech Cyberman
void I_Tactile(int on, int off, int total)
{
return &emptycmd;
}
// Zone memory auto-allocation function that allocates the zone size
// by trying progressively smaller zone sizes until one is found that
// works.
int I_GetHeapSize (void)
static byte *AutoAllocMemory(int *size, int default_ram, int min_ram)
{
return mb_used*1024*1024;
byte *zonemem;
// Allocate the zone memory. This loop tries progressively smaller
// zone sizes until a size is found that can be allocated.
// If we used the -mb command line parameter, only the parameter
// provided is accepted.
zonemem = NULL;
while (zonemem == NULL)
{
// We need a reasonable minimum amount of RAM to start.
if (default_ram < min_ram)
{
I_Error("Unable to allocate %i MiB of RAM for zone", default_ram);
}
// Try to allocate the zone memory.
*size = default_ram * 1024 * 1024;
zonemem = malloc(*size);
// Failed to allocate? Reduce zone size until we reach a size
// that is acceptable.
if (zonemem == NULL)
{
default_ram -= 1;
}
}
return zonemem;
}
byte* I_ZoneBase (int* size)
byte *I_ZoneBase (int *size)
{
*size = mb_used*1024*1024;
return (byte *) malloc (*size);
byte *zonemem;
int min_ram, default_ram;
int p;
//!
// @arg <mb>
//
// Specify the heap size, in MiB (default 16).
//
p = M_CheckParmWithArgs("-mb", 1);
if (p > 0)
{
default_ram = atoi(myargv[p+1]);
min_ram = default_ram;
}
else
{
default_ram = DEFAULT_RAM;
min_ram = MIN_RAM;
}
zonemem = AutoAllocMemory(size, default_ram, min_ram);
printf("zone memory: %p, %x allocated for zone\n",
zonemem, *size);
return zonemem;
}
void I_PrintBanner(char *msg)
{
int i;
int spaces = 35 - (strlen(msg) / 2);
for (i=0; i<spaces; ++i)
putchar(' ');
puts(msg);
}
void I_PrintDivider(void)
{
int i;
for (i=0; i<75; ++i)
{
putchar('=');
}
putchar('\n');
}
void I_PrintStartupBanner(char *gamedescription)
{
I_PrintDivider();
I_PrintBanner(gamedescription);
I_PrintDivider();
printf(
" " PACKAGE_NAME " is free software, covered by the GNU General Public\n"
" License. There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"
" FOR A PARTICULAR PURPOSE. You are welcome to change and distribute\n"
" copies under certain conditions. See the source for more information.\n");
I_PrintDivider();
}
//
// I_ConsoleStdout
//
// I_GetTime
// returns time in 1/70th second tics
// Returns true if stdout is a real console, false if it is a file
//
int I_GetTime (void)
boolean I_ConsoleStdout(void)
{
struct timeval tp;
struct timezone tzp;
int newtics;
static int basetime=0;
gettimeofday(&tp, &tzp);
if (!basetime)
basetime = tp.tv_sec;
newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000;
return newtics;
#ifdef _WIN32
// SDL "helpfully" always redirects stdout to a file.
return 0;
#else
#if ORIGCODE
return isatty(fileno(stdout));
#else
return 0;
#endif
#endif
}
//
// I_Init
//
/*
void I_Init (void)
{
I_InitSound();
// I_InitGraphics();
I_CheckIsScreensaver();
I_InitTimer();
I_InitJoystick();
}
void I_BindVariables(void)
{
I_BindVideoVariables();
I_BindJoystickVariables();
I_BindSoundVariables();
}
*/
//
// I_Quit
//
void I_Quit (void)
{
D_QuitNetGame ();
I_ShutdownSound();
I_ShutdownMusic();
M_SaveDefaults ();
I_ShutdownGraphics();
atexit_listentry_t *entry;
// Run through all exit functions
entry = exit_funcs;
while (entry != NULL)
{
entry->func();
entry = entry->next;
}
#if ORIGCODE
SDL_Quit();
exit(0);
}
void I_WaitVBL(int count)
{
#ifdef SGI
sginap(1);
#else
#ifdef SUN
sleep(0);
#else
usleep (count * (1000000/70) );
#endif
#endif
}
void I_BeginRead(void)
#if !defined(_WIN32) && !defined(__MACOSX__)
#define ZENITY_BINARY "/usr/bin/zenity"
// returns non-zero if zenity is available
static int ZenityAvailable(void)
{
return system(ZENITY_BINARY " --help >/dev/null 2>&1") == 0;
}
void I_EndRead(void)
// Escape special characters in the given string so that they can be
// safely enclosed in shell quotes.
static char *EscapeShellString(char *string)
{
char *result;
char *r, *s;
// In the worst case, every character might be escaped.
result = malloc(strlen(string) * 2 + 3);
r = result;
// Enclosing quotes.
*r = '"';
++r;
for (s = string; *s != '\0'; ++s)
{
// From the bash manual:
//
// "Enclosing characters in double quotes preserves the literal
// value of all characters within the quotes, with the exception
// of $, `, \, and, when history expansion is enabled, !."
//
// Therefore, escape these characters by prefixing with a backslash.
if (strchr("$`\\!", *s) != NULL)
{
*r = '\\';
++r;
}
*r = *s;
++r;
}
// Enclosing quotes.
*r = '"';
++r;
*r = '\0';
return result;
}
byte* I_AllocLow(int length)
// Open a native error box with a message using zenity
static int ZenityErrorBox(char *message)
{
byte* mem;
mem = (byte *)malloc (length);
memset (mem,0,length);
return mem;
int result;
char *escaped_message;
char *errorboxpath;
static size_t errorboxpath_size;
if (!ZenityAvailable())
{
return 0;
}
escaped_message = EscapeShellString(message);
errorboxpath_size = strlen(ZENITY_BINARY) + strlen(escaped_message) + 19;
errorboxpath = malloc(errorboxpath_size);
M_snprintf(errorboxpath, errorboxpath_size, "%s --error --text=%s",
ZENITY_BINARY, escaped_message);
result = system(errorboxpath);
free(errorboxpath);
free(escaped_message);
return result;
}
#endif /* !defined(_WIN32) && !defined(__MACOSX__) */
//
// I_Error
//
extern boolean demorecording;
static boolean already_quitting = false;
void I_Error (char *error, ...)
{
va_list argptr;
char msgbuf[512];
va_list argptr;
atexit_listentry_t *entry;
boolean exit_gui_popup;
if (already_quitting)
{
fprintf(stderr, "Warning: recursive call to I_Error detected.\n");
#if ORIGCODE
exit(-1);
#endif
}
else
{
already_quitting = true;
}
// Message first.
va_start (argptr,error);
fprintf (stderr, "Error: ");
vfprintf (stderr,error,argptr);
fprintf (stderr, "\n");
va_end (argptr);
va_start(argptr, error);
//fprintf(stderr, "\nError: ");
vfprintf(stderr, error, argptr);
fprintf(stderr, "\n\n");
va_end(argptr);
fflush(stderr);
fflush( stderr );
// Write a copy of the message into buffer.
va_start(argptr, error);
memset(msgbuf, 0, sizeof(msgbuf));
M_vsnprintf(msgbuf, sizeof(msgbuf), error, argptr);
va_end(argptr);
// Shutdown. Here might be other errors.
if (demorecording)
G_CheckDemoStatus();
D_QuitNetGame ();
I_ShutdownGraphics();
entry = exit_funcs;
while (entry != NULL)
{
if (entry->run_on_error)
{
entry->func();
}
entry = entry->next;
}
exit_gui_popup = !M_ParmExists("-nogui");
// Pop up a GUI dialog box to show the error message, if the
// game was not run from the console (and the user will
// therefore be unable to otherwise see the message).
if (exit_gui_popup && !I_ConsoleStdout())
#ifdef _WIN32
{
wchar_t wmsgbuf[512];
MultiByteToWideChar(CP_ACP, 0,
msgbuf, strlen(msgbuf) + 1,
wmsgbuf, sizeof(wmsgbuf));
MessageBoxW(NULL, wmsgbuf, L"", MB_OK);
}
#elif defined(__MACOSX__)
{
CFStringRef message;
int i;
// The CoreFoundation message box wraps text lines, so replace
// newline characters with spaces so that multiline messages
// are continuous.
for (i = 0; msgbuf[i] != '\0'; ++i)
{
if (msgbuf[i] == '\n')
{
msgbuf[i] = ' ';
}
}
message = CFStringCreateWithCString(NULL, msgbuf,
kCFStringEncodingUTF8);
CFUserNotificationDisplayNotice(0,
kCFUserNotificationCautionAlertLevel,
NULL,
NULL,
NULL,
CFSTR(PACKAGE_STRING),
message,
NULL);
}
#else
{
ZenityErrorBox(msgbuf);
}
#endif
// abort();
#if ORIGCODE
SDL_Quit();
exit(-1);
#else
while (true)
{
}
#endif
}
//
// Read Access Violation emulation.
//
// From PrBoom+, by entryway.
//
// C:\>debug
// -d 0:0
//
// DOS 6.22:
// 0000:0000 (57 92 19 00) F4 06 70 00-(16 00)
// DOS 7.1:
// 0000:0000 (9E 0F C9 00) 65 04 70 00-(16 00)
// Win98:
// 0000:0000 (9E 0F C9 00) 65 04 70 00-(16 00)
// DOSBox under XP:
// 0000:0000 (00 00 00 F1) ?? ?? ?? 00-(07 00)
#define DOS_MEM_DUMP_SIZE 10
static const unsigned char mem_dump_dos622[DOS_MEM_DUMP_SIZE] = {
0x57, 0x92, 0x19, 0x00, 0xF4, 0x06, 0x70, 0x00, 0x16, 0x00};
static const unsigned char mem_dump_win98[DOS_MEM_DUMP_SIZE] = {
0x9E, 0x0F, 0xC9, 0x00, 0x65, 0x04, 0x70, 0x00, 0x16, 0x00};
static const unsigned char mem_dump_dosbox[DOS_MEM_DUMP_SIZE] = {
0x00, 0x00, 0x00, 0xF1, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00};
static unsigned char mem_dump_custom[DOS_MEM_DUMP_SIZE];
static const unsigned char *dos_mem_dump = mem_dump_dos622;
boolean I_GetMemoryValue(unsigned int offset, void *value, int size)
{
static boolean firsttime = true;
if (firsttime)
{
int p, i, val;
firsttime = false;
i = 0;
//!
// @category compat
// @arg <version>
//
// Specify DOS version to emulate for NULL pointer dereference
// emulation. Supported versions are: dos622, dos71, dosbox.
// The default is to emulate DOS 7.1 (Windows 98).
//
p = M_CheckParmWithArgs("-setmem", 1);
if (p > 0)
{
if (!strcasecmp(myargv[p + 1], "dos622"))
{
dos_mem_dump = mem_dump_dos622;
}
if (!strcasecmp(myargv[p + 1], "dos71"))
{
dos_mem_dump = mem_dump_win98;
}
else if (!strcasecmp(myargv[p + 1], "dosbox"))
{
dos_mem_dump = mem_dump_dosbox;
}
else
{
for (i = 0; i < DOS_MEM_DUMP_SIZE; ++i)
{
++p;
if (p >= myargc || myargv[p][0] == '-')
{
break;
}
M_StrToInt(myargv[p], &val);
mem_dump_custom[i++] = (unsigned char) val;
}
dos_mem_dump = mem_dump_custom;
}
}
}
switch (size)
{
case 1:
*((unsigned char *) value) = dos_mem_dump[offset];
return true;
case 2:
*((unsigned short *) value) = dos_mem_dump[offset]
| (dos_mem_dump[offset + 1] << 8);
return true;
case 4:
*((unsigned int *) value) = dos_mem_dump[offset]
| (dos_mem_dump[offset + 1] << 8)
| (dos_mem_dump[offset + 2] << 16)
| (dos_mem_dump[offset + 3] << 24);
return true;
}
return false;
}

View File

@ -1,23 +1,20 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __I_SYSTEM__
@ -26,10 +23,8 @@
#include "d_ticcmd.h"
#include "d_event.h"
#ifdef __GNUG__
#pragma interface
#endif
typedef void (*atexit_func_t)(void);
// Called by DoomMain.
void I_Init (void);
@ -39,29 +34,8 @@ void I_Init (void);
// for the zone management.
byte* I_ZoneBase (int *size);
boolean I_ConsoleStdout(void);
// Called by D_DoomLoop,
// returns current time in tics.
int I_GetTime (void);
//
// Called by D_DoomLoop,
// called before processing any tics in a frame
// (just after displaying a frame).
// Time consuming syncronous operations
// are performed here (joystick reading).
// Can call D_PostEvent.
//
void I_StartFrame (void);
//
// Called by D_DoomLoop,
// called before processing each tic in a frame.
// Quick syncronous operations are performed here.
// Can call D_PostEvent.
void I_StartTic (void);
// Asynchronous interrupt functions should maintain private queues
// that are read by the synchronous functions
@ -78,20 +52,33 @@ ticcmd_t* I_BaseTiccmd (void);
// Clean exit, displays sell blurb.
void I_Quit (void);
// Allocates from low memory under dos,
// just mallocs under unix
byte* I_AllocLow (int length);
void I_Error (char *error, ...);
void I_Tactile (int on, int off, int total);
boolean I_GetMemoryValue(unsigned int offset, void *value, int size);
void I_Error (char *error, ...);
// Schedule a function to be called when the program exits.
// If run_if_error is true, the function is called if the exit
// is due to an error (I_Error)
void I_AtExit(atexit_func_t func, boolean run_if_error);
// Add all system-specific config file variable bindings.
void I_BindVariables(void);
// Print startup banner copyright message.
void I_PrintStartupBanner(char *gamedescription);
// Print a centered text banner displaying the given string.
void I_PrintBanner(char *text);
// Print a dividing line for startup banners.
void I_PrintDivider(void);
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

93
frosted-doom/i_timer.c Normal file
View File

@ -0,0 +1,93 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Timer functions.
//
#include "i_timer.h"
#include "doomtype.h"
#include <stdarg.h>
#include <sys/time.h>
#include <unistd.h>
//
// I_GetTime
// returns time in 1/35th second tics
//
static uint32_t basetime = 0;
int I_GetTicks(void)
{
struct timeval tp;
struct timezone tzp;
gettimeofday(&tp, &tzp);
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000); /* return milliseconds */
}
int I_GetTime (void)
{
uint32_t ticks;
ticks = I_GetTicks();
if (basetime == 0)
basetime = ticks;
ticks -= basetime;
return (ticks * TICRATE) / 1000;
}
//
// Same as I_GetTime, but returns time in milliseconds
//
int I_GetTimeMS(void)
{
uint32_t ticks;
ticks = I_GetTicks();
if (basetime == 0)
basetime = ticks;
return ticks - basetime;
}
// Sleep for a specified number of ms
void I_Sleep(int ms)
{
//SDL_Delay(ms);
usleep (ms * 1000);
}
void I_WaitVBL(int count)
{
//I_Sleep((count * 1000) / 70);
}
void I_InitTimer(void)
{
// initialize timer
//SDL_Init(SDL_INIT_TIMER);
}

42
frosted-doom/i_timer.h Normal file
View File

@ -0,0 +1,42 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// System-specific timer interface
//
#ifndef __I_TIMER__
#define __I_TIMER__
#define TICRATE 35
// Called by D_DoomLoop,
// returns current time in tics.
int I_GetTime (void);
// returns current time in ms
int I_GetTimeMS (void);
// Pause for a specified number of ms
void I_Sleep(int ms);
// Initialize timer
void I_InitTimer(void);
// Wait for vertical retrace or pause a bit.
void I_WaitVBL(int count);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +1,158 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef __I_VIDEO__
#define __I_VIDEO__
#include "doomtype.h"
#ifdef __GNUG__
#pragma interface
#endif
// Screen width and height.
#define SCREENWIDTH 320
#define SCREENHEIGHT 200
// Screen width used for "squash" scale functions
#define SCREENWIDTH_4_3 256
// Screen height used for "stretch" scale functions.
#define SCREENHEIGHT_4_3 240
#define MAX_MOUSE_BUTTONS 8
typedef struct
{
// Screen width and height
int width;
int height;
// Initialisation function to call when using this mode.
// Called with a pointer to the Doom palette.
//
// If NULL, no init function is called.
void (*InitMode)(byte *palette);
// Function to call to draw the screen from the source buffer.
// Return true if draw was successful.
boolean (*DrawScreen)(int x1, int y1, int x2, int y2);
// If true, this is a "poor quality" mode. The autoadjust
// code should always attempt to use a different mode to this
// mode in fullscreen.
//
// Some notes about what "poor quality" means in this context:
//
// The aspect ratio correction works by scaling up to the larger
// screen size and then drawing pixels on the edges between the
// "virtual" pixels so that an authentic blocky look-and-feel is
// achieved.
//
// For a mode like 640x480, you can imagine the grid of the
// "original" pixels spaced out, with extra "blurry" pixels added
// in the space between them to fill it out. However, when you're
// running at a resolution like 320x240, this is not the case. In
// the small screen case, every single pixel has to be a blurry
// interpolation of two pixels from the original image.
//
// If you run in 320x240 and put your face up close to the screen
// you can see this: it's particularly visible in the small yellow
// status bar numbers for example. Overall it still looks "okay"
// but there's an obvious - albeit small - deterioration in
// quality.
//
// Once you get to 640x480, all the original pixels are there at
// least once and it's okay (the higher the resolution, the more
// accurate it is). When I first wrote the code I was expecting
// that even higher resolutions would be needed before it would
// look acceptable, but it turned out to be okay even at 640x480.
boolean poor_quality;
} screen_mode_t;
typedef boolean (*grabmouse_callback_t)(void);
// Called by D_DoomMain,
// determines the hardware configuration
// and sets up the video mode
void I_InitGraphics (void);
void I_GraphicsCheckCommandLine(void);
void I_ShutdownGraphics(void);
// Takes full 8 bit values.
void I_SetPalette (byte* palette);
int I_GetPaletteIndex(int r, int g, int b);
void I_UpdateNoBlit (void);
void I_FinishUpdate (void);
// Wait for vertical retrace or pause a bit.
void I_WaitVBL(int count);
void I_ReadScreen (byte* scr);
void I_BeginRead (void);
void I_EndRead (void);
void I_SetWindowTitle(char *title);
void I_CheckIsScreensaver(void);
void I_SetGrabMouseCallback(grabmouse_callback_t func);
void I_DisplayFPSDots(boolean dots_on);
void I_BindVideoVariables(void);
void I_InitWindowTitle(void);
void I_InitWindowIcon(void);
// Called before processing any tics in a frame (just after displaying a frame).
// Time consuming syncronous operations are performed here (joystick reading).
void I_StartFrame (void);
// Called before processing each tic in a frame.
// Quick syncronous operations are performed here.
void I_StartTic (void);
// Enable the loading disk image displayed when reading from disk.
void I_EnableLoadingDisk(void);
extern char *video_driver;
extern boolean screenvisible;
extern float mouse_acceleration;
extern int mouse_threshold;
extern int vanilla_keyboard_mapping;
extern boolean screensaver_mode;
extern int usegamma;
extern byte *I_VideoBuffer;
extern int screen_width;
extern int screen_height;
extern int screen_bpp;
extern int fullscreen;
extern int aspect_ratio_correct;
extern int show_diskicon;
extern int diskicon_readbytes;
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,756 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
//
// DESCRIPTION:
// DOOM graphics stuff for X11, UNIX.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $";
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <signal.h>
#include <SDL2/SDL.h>
#include "doomstat.h"
#include "i_system.h"
#include "v_video.h"
#include "m_argv.h"
#include "d_main.h"
#include "doomdef.h"
SDL_Window *window = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *rgbsurf = NULL;
int X_width;
int X_height;
void I_ShutdownGraphics(void)
{
printf("I_ShutdownGraphics\n");
// Always be sure to clean up
SDL_Quit();
}
//
// I_StartFrame
//
void I_StartFrame (void)
{
// er?
}
void I_GetEvent(void)
{
/* An SDL_Event */
SDL_Event event;
while (SDL_PollEvent(&event))
{
/* If a quit event has been sent */
if (event.type == SDL_QUIT)
{
/* Quit the application */
I_Quit();
}
if (event.type == SDL_WINDOWEVENT)
{
switch (event.window.event)
{
case SDL_WINDOWEVENT_CLOSE:
SDL_Log("Window %d closed", event.window.windowID);
break;
default:
break;
}
}
}
/*
event_t event;
// put event-grabbing stuff in here
XNextEvent(X_display, &X_event);
switch (X_event.type)
{
case KeyPress:
event.type = ev_keydown;
event.data1 = xlatekey();
D_PostEvent(&event);
// fprintf(stderr, "k");
break;
case KeyRelease:
event.type = ev_keyup;
event.data1 = xlatekey();
D_PostEvent(&event);
// fprintf(stderr, "ku");
break;
case ButtonPress:
event.type = ev_mouse;
event.data1 =
(X_event.xbutton.state & Button1Mask)
| (X_event.xbutton.state & Button2Mask ? 2 : 0)
| (X_event.xbutton.state & Button3Mask ? 4 : 0)
| (X_event.xbutton.button == Button1)
| (X_event.xbutton.button == Button2 ? 2 : 0)
| (X_event.xbutton.button == Button3 ? 4 : 0);
event.data2 = event.data3 = 0;
D_PostEvent(&event);
// fprintf(stderr, "b");
break;
case ButtonRelease:
event.type = ev_mouse;
event.data1 =
(X_event.xbutton.state & Button1Mask)
| (X_event.xbutton.state & Button2Mask ? 2 : 0)
| (X_event.xbutton.state & Button3Mask ? 4 : 0);
// suggest parentheses around arithmetic in operand of |
event.data1 =
event.data1
^ (X_event.xbutton.button == Button1 ? 1 : 0)
^ (X_event.xbutton.button == Button2 ? 2 : 0)
^ (X_event.xbutton.button == Button3 ? 4 : 0);
event.data2 = event.data3 = 0;
D_PostEvent(&event);
// fprintf(stderr, "bu");
break;
case MotionNotify:
event.type = ev_mouse;
event.data1 =
(X_event.xmotion.state & Button1Mask)
| (X_event.xmotion.state & Button2Mask ? 2 : 0)
| (X_event.xmotion.state & Button3Mask ? 4 : 0);
event.data2 = (X_event.xmotion.x - lastmousex) << 2;
event.data3 = (lastmousey - X_event.xmotion.y) << 2;
if (event.data2 || event.data3)
{
lastmousex = X_event.xmotion.x;
lastmousey = X_event.xmotion.y;
if (X_event.xmotion.x != X_width/2 &&
X_event.xmotion.y != X_height/2)
{
D_PostEvent(&event);
// fprintf(stderr, "m");
mousemoved = false;
} else
{
mousemoved = true;
}
}
break;
case Expose:
case ConfigureNotify:
break;
default:
if (doShm && X_event.type == X_shmeventtype) shmFinished = true;
break;
}
*/
}
// Cursor
// createnullcursor
// ( Display* display,
// Window root )
// {
// Pixmap cursormask;
// XGCValues xgc;
// GC gc;
// XColor dummycolour;
// Cursor cursor;
//
// cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/);
// xgc.function = GXclear;
// gc = XCreateGC(display, cursormask, GCFunction, &xgc);
// XFillRectangle(display, cursormask, gc, 0, 0, 1, 1);
// dummycolour.pixel = 0;
// dummycolour.red = 0;
// dummycolour.flags = 04;
// cursor = XCreatePixmapCursor(display, cursormask, cursormask,
// &dummycolour,&dummycolour, 0,0);
// XFreePixmap(display,cursormask);
// XFreeGC(display,gc);
// return cursor;
// }
//
// I_StartTic
//
void I_StartTic (void)
{
return;
/*
if (!X_display)
return;
while (XPending(X_display))
I_GetEvent();
// Warp the pointer back to the middle of the window
// or it will wander off - that is, the game will
// loose input focus within X11.
if (grabMouse)
{
if (!--doPointerWarp)
{
XWarpPointer( X_display,
None,
X_mainWindow,
0, 0,
0, 0,
X_width/2, X_height/2);
doPointerWarp = POINTER_WARP_COUNTDOWN;
}
}
mousemoved = false;
*/
}
//
// I_UpdateNoBlit
//
void I_UpdateNoBlit (void)
{
// what is this?
}
//
// I_FinishUpdate
//
void I_FinishUpdate (void)
{
static int lasttic;
int tics;
int i;
// draws little dots on the bottom of the screen
if (devparm)
{
i = I_GetTime();
tics = i - lasttic;
lasttic = i;
if (tics > 20) tics = 20;
for (i=0 ; i<tics*2 ; i+=2)
screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
for ( ; i<20*2 ; i+=2)
screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
}
/* DRAW SCREEN */
//if (multiply == 1)
{
unsigned char *line_out;
unsigned char *line_in;
int y;
line_in = (unsigned char *) screens[0];
line_out = (unsigned char *) rgbsurf->pixels;
y = SCREENHEIGHT;
while (y--)
{
memcpy(line_out, line_in, rgbsurf->w);
line_in += SCREENWIDTH;
line_out += rgbsurf->pitch;
}
}
/* LOCK SCREEN */
if (SDL_MUSTLOCK(screen)) {
if (SDL_LockSurface(screen) < 0) {
return;
}
}
/* BLIT to SCREEN */
SDL_BlitSurface(rgbsurf, NULL, screen, NULL); // blit it to the screen
/* UNLOCK SCREEN */
if ( SDL_MUSTLOCK(screen) ) {
SDL_UnlockSurface(screen);
}
SDL_UpdateWindowSurface(window);
}
//
// I_ReadScreen
//
void I_ReadScreen (byte* scr)
{
printf("I_ReadScreen\n");
memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT);
//memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT);
}
//
// I_SetPalette
//
void I_SetPalette (byte* palette)
{
SDL_Color colors[256];
printf("I_SetPalette\n");
for (int i=0; i<256; ++i ) {
colors[i].r = gammatable[usegamma][*palette++];
colors[i].g = gammatable[usegamma][*palette++];
colors[i].b = gammatable[usegamma][*palette++];
}
if(rgbsurf->format->BitsPerPixel!=8){
printf("Not an 8-bit surface.\n");
return;
}
int j = SDL_SetPaletteColors(rgbsurf->format->palette, colors, 0, 256);
printf("SDL_SetPaletteColors: %i\n", j);
}
void I_InitGraphics(void)
{
uint32_t video_flags = 0;
//video_flags = (SDL_SWSURFACE|SDL_HWPALETTE);
if (M_CheckParm("-fullscreen"))
video_flags |= SDL_WINDOW_FULLSCREEN;
X_width = SCREENWIDTH;
X_height = SCREENHEIGHT;
printf("I_InitGraphics: w x h: %d x %d\n", X_width, X_height);
// Initialize SDL.
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
printf("SDL_Init failed\n");
return;
}
// Create the window where we will draw.
window = SDL_CreateWindow("fDOOM v1.0",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
X_width, X_height,
video_flags);
screen = SDL_GetWindowSurface(window);
rgbsurf = SDL_CreateRGBSurface(0,X_width,X_height,8,0,0,0,0);
screens[0] = (unsigned char *)screen->pixels;
/* Blit shit to the screen */
// image = SDL_LoadBMP("box.bmp"); // loads image
// SDL_BlitSurface(image, NULL, screen, NULL); // blit it to the screen
// SDL_FreeSurface(image);
// SDL_UpdateWindowSurface(window);
signal(SIGINT, (void (*)(int)) I_Quit);
return;
/*
char* displayname;
char* d;
int n;
int pnum;
int x=0;
int y=0;
// warning: char format, different type arg
char xsign=' ';
char ysign=' ';
int oktodraw;
unsigned long attribmask;
XSetWindowAttributes attribs;
XGCValues xgcvalues;
int valuemask;
static int firsttime=1;
if (!firsttime)
return;
firsttime = 0;
signal(SIGINT, (void (*)(int)) I_Quit);
if (M_CheckParm("-2"))
multiply = 2;
if (M_CheckParm("-3"))
multiply = 3;
if (M_CheckParm("-4"))
multiply = 4;
X_width = SCREENWIDTH * multiply;
X_height = SCREENHEIGHT * multiply;
// check for command-line display name
if ( (pnum=M_CheckParm("-disp")) ) // suggest parentheses around assignment
displayname = myargv[pnum+1];
else
displayname = 0;
// check if the user wants to grab the mouse (quite unnice)
grabMouse = !!M_CheckParm("-grabmouse");
// check for command-line geometry
if ( (pnum=M_CheckParm("-geom")) ) // suggest parentheses around assignment
{
// warning: char format, different type arg 3,5
n = sscanf(myargv[pnum+1], "%c%d%c%d", &xsign, &x, &ysign, &y);
if (n==2)
x = y = 0;
else if (n==6)
{
if (xsign == '-')
x = -x;
if (ysign == '-')
y = -y;
}
else
I_Error("bad -geom parameter");
}
// open the display
X_display = XOpenDisplay(displayname);
if (!X_display)
{
if (displayname)
I_Error("Could not open display [%s]", displayname);
else
I_Error("Could not open display (DISPLAY=[%s])", getenv("DISPLAY"));
}
// use the default visual
X_screen = DefaultScreen(X_display);
if (!XMatchVisualInfo(X_display, X_screen, 8, PseudoColor, &X_visualinfo))
I_Error("xdoom currently only supports 256-color PseudoColor screens");
X_visual = X_visualinfo.visual;
// check for the MITSHM extension
doShm = XShmQueryExtension(X_display);
// even if it's available, make sure it's a local connection
if (doShm)
{
if (!displayname) displayname = (char *) getenv("DISPLAY");
if (displayname)
{
d = displayname;
while (*d && (*d != ':')) d++;
if (*d) *d = 0;
if (!(!strcasecmp(displayname, "unix") || !*displayname)) doShm = false;
}
}
fprintf(stderr, "Using MITSHM extension\n");
// create the colormap
X_cmap = XCreateColormap(X_display, RootWindow(X_display,
X_screen), X_visual, AllocAll);
// setup attributes for main window
attribmask = CWEventMask | CWColormap | CWBorderPixel;
attribs.event_mask =
KeyPressMask
| KeyReleaseMask
// | PointerMotionMask | ButtonPressMask | ButtonReleaseMask
| ExposureMask;
attribs.colormap = X_cmap;
attribs.border_pixel = 0;
// create the main window
X_mainWindow = XCreateWindow( X_display,
RootWindow(X_display, X_screen),
x, y,
X_width, X_height,
0, // borderwidth
8, // depth
InputOutput,
X_visual,
attribmask,
&attribs );
XDefineCursor(X_display, X_mainWindow,
createnullcursor( X_display, X_mainWindow ) );
// create the GC
valuemask = GCGraphicsExposures;
xgcvalues.graphics_exposures = False;
X_gc = XCreateGC( X_display,
X_mainWindow,
valuemask,
&xgcvalues );
// map the window
XMapWindow(X_display, X_mainWindow);
// wait until it is OK to draw
oktodraw = 0;
while (!oktodraw)
{
XNextEvent(X_display, &X_event);
if (X_event.type == Expose
&& !X_event.xexpose.count)
{
oktodraw = 1;
}
}
// grabs the pointer so it is restricted to this window
if (grabMouse)
XGrabPointer(X_display, X_mainWindow, True,
ButtonPressMask|ButtonReleaseMask|PointerMotionMask,
GrabModeAsync, GrabModeAsync,
X_mainWindow, None, CurrentTime);
if (doShm)
{
X_shmeventtype = XShmGetEventBase(X_display) + ShmCompletion;
// create the image
image = XShmCreateImage( X_display,
X_visual,
8,
ZPixmap,
0,
&X_shminfo,
X_width,
X_height );
grabsharedmemory(image->bytes_per_line * image->height);
// UNUSED
// create the shared memory segment
// X_shminfo.shmid = shmget (IPC_PRIVATE,
// image->bytes_per_line * image->height, IPC_CREAT | 0777);
// if (X_shminfo.shmid < 0)
// {
// perror("");
// I_Error("shmget() failed in InitGraphics()");
// }
// fprintf(stderr, "shared memory id=%d\n", X_shminfo.shmid);
// attach to the shared memory segment
// image->data = X_shminfo.shmaddr = shmat(X_shminfo.shmid, 0, 0);
if (!image->data)
{
perror("");
I_Error("shmat() failed in InitGraphics()");
}
// get the X server to attach to it
if (!XShmAttach(X_display, &X_shminfo))
I_Error("XShmAttach() failed in InitGraphics()");
}
else
{
image = XCreateImage( X_display,
X_visual,
8,
ZPixmap,
0,
(char*)malloc(X_width * X_height),
X_width, X_height,
8,
X_width );
}
if (multiply == 1)
screens[0] = (unsigned char *) (image->data);
else
screens[0] = (unsigned char *) malloc (SCREENWIDTH * SCREENHEIGHT);
*/
}
void InitExpand (void)
{
/*
int i;
for (i=0 ; i<256 ; i++)
exptable[i] = i | (i<<8) | (i<<16) | (i<<24);
*/
}
void InitExpand2 (void)
{
return;
/*
int i;
int j;
// UNUSED unsigned iexp, jexp;
double* exp;
union
{
double d;
unsigned u[2];
} pixel;
printf ("building exptable2...\n");
exp = exptable2;
for (i=0 ; i<256 ; i++)
{
pixel.u[0] = i | (i<<8) | (i<<16) | (i<<24);
for (j=0 ; j<256 ; j++)
{
pixel.u[1] = j | (j<<8) | (j<<16) | (j<<24);
*exp++ = pixel.d;
}
}
printf ("done.\n");
*/
}
int inited;
void
Expand4
( unsigned* lineptr,
double* xline )
{
return;
/*
double dpixel;
unsigned x;
unsigned y;
unsigned fourpixels;
unsigned step;
double* exp;
exp = exptable2;
if (!inited)
{
inited = 1;
InitExpand2 ();
}
step = 3*SCREENWIDTH/2;
y = SCREENHEIGHT-1;
do
{
x = SCREENWIDTH;
do
{
fourpixels = lineptr[0];
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
xline[0] = dpixel;
xline[160] = dpixel;
xline[320] = dpixel;
xline[480] = dpixel;
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
xline[1] = dpixel;
xline[161] = dpixel;
xline[321] = dpixel;
xline[481] = dpixel;
fourpixels = lineptr[1];
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
xline[2] = dpixel;
xline[162] = dpixel;
xline[322] = dpixel;
xline[482] = dpixel;
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
xline[3] = dpixel;
xline[163] = dpixel;
xline[323] = dpixel;
xline[483] = dpixel;
fourpixels = lineptr[2];
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
xline[4] = dpixel;
xline[164] = dpixel;
xline[324] = dpixel;
xline[484] = dpixel;
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
xline[5] = dpixel;
xline[165] = dpixel;
xline[325] = dpixel;
xline[485] = dpixel;
fourpixels = lineptr[3];
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
xline[6] = dpixel;
xline[166] = dpixel;
xline[326] = dpixel;
xline[486] = dpixel;
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
xline[7] = dpixel;
xline[167] = dpixel;
xline[327] = dpixel;
xline[487] = dpixel;
lineptr+=4;
xline+=8;
} while (x-=16);
xline += step;
} while (y--);
*/
}

View File

@ -1,919 +0,0 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
//
// DESCRIPTION:
// DOOM graphics stuff for X11, UNIX.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $";
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <signal.h>
#include "doomstat.h"
#include "i_system.h"
#include "v_video.h"
#include "m_argv.h"
#include "d_main.h"
#include "doomdef.h"
#define POINTER_WARP_COUNTDOWN 1
//Display* X_display=0;
//Window X_mainWindow;
//Colormap X_cmap;
//Visual* X_visual;
//GC X_gc;
//XEvent X_event;
//int X_screen;
//XVisualInfo X_visualinfo;
//XImage* image;
int X_width;
int X_height;
// MIT SHared Memory extension.
boolean doShm;
//XShmSegmentInfo X_shminfo;
int X_shmeventtype;
// Fake mouse handling.
// This cannot work properly w/o DGA.
// Needs an invisible mouse cursor at least.
boolean grabMouse;
int doPointerWarp = POINTER_WARP_COUNTDOWN;
// Blocky mode,
// replace each 320x200 pixel with multiply*multiply pixels.
// According to Dave Taylor, it still is a bonehead thing
// to use ....
static int multiply=1;
//
// Translates the key currently in X_event
//
int xlatekey(void)
{
return 0;
/*
int rc;
switch(rc = XKeycodeToKeysym(X_display, X_event.xkey.keycode, 0))
{
case XK_Left: rc = KEY_LEFTARROW; break;
case XK_Right: rc = KEY_RIGHTARROW; break;
case XK_Down: rc = KEY_DOWNARROW; break;
case XK_Up: rc = KEY_UPARROW; break;
case XK_Escape: rc = KEY_ESCAPE; break;
case XK_Return: rc = KEY_ENTER; break;
case XK_Tab: rc = KEY_TAB; break;
case XK_F1: rc = KEY_F1; break;
case XK_F2: rc = KEY_F2; break;
case XK_F3: rc = KEY_F3; break;
case XK_F4: rc = KEY_F4; break;
case XK_F5: rc = KEY_F5; break;
case XK_F6: rc = KEY_F6; break;
case XK_F7: rc = KEY_F7; break;
case XK_F8: rc = KEY_F8; break;
case XK_F9: rc = KEY_F9; break;
case XK_F10: rc = KEY_F10; break;
case XK_F11: rc = KEY_F11; break;
case XK_F12: rc = KEY_F12; break;
case XK_BackSpace:
case XK_Delete: rc = KEY_BACKSPACE; break;
case XK_Pause: rc = KEY_PAUSE; break;
case XK_KP_Equal:
case XK_equal: rc = KEY_EQUALS; break;
case XK_KP_Subtract:
case XK_minus: rc = KEY_MINUS; break;
case XK_Shift_L:
case XK_Shift_R:
rc = KEY_RSHIFT;
break;
case XK_Control_L:
case XK_Control_R:
rc = KEY_RCTRL;
break;
case XK_Alt_L:
case XK_Meta_L:
case XK_Alt_R:
case XK_Meta_R:
rc = KEY_RALT;
break;
default:
if (rc >= XK_space && rc <= XK_asciitilde)
rc = rc - XK_space + ' ';
if (rc >= 'A' && rc <= 'Z')
rc = rc - 'A' + 'a';
break;
}
return rc;
*/
}
void I_ShutdownGraphics(void)
{
return;
/*
// Detach from X server
if (!XShmDetach(X_display, &X_shminfo))
I_Error("XShmDetach() failed in I_ShutdownGraphics()");
// Release shared memory.
shmdt(X_shminfo.shmaddr);
shmctl(X_shminfo.shmid, IPC_RMID, 0);
// Paranoia.
image->data = NULL;
*/
}
//
// I_StartFrame
//
void I_StartFrame (void)
{
// er?
}
static int lastmousex = 0;
static int lastmousey = 0;
boolean mousemoved = false;
boolean shmFinished;
void I_GetEvent(void)
{
return;
/*
event_t event;
// put event-grabbing stuff in here
XNextEvent(X_display, &X_event);
switch (X_event.type)
{
case KeyPress:
event.type = ev_keydown;
event.data1 = xlatekey();
D_PostEvent(&event);
// fprintf(stderr, "k");
break;
case KeyRelease:
event.type = ev_keyup;
event.data1 = xlatekey();
D_PostEvent(&event);
// fprintf(stderr, "ku");
break;
case ButtonPress:
event.type = ev_mouse;
event.data1 =
(X_event.xbutton.state & Button1Mask)
| (X_event.xbutton.state & Button2Mask ? 2 : 0)
| (X_event.xbutton.state & Button3Mask ? 4 : 0)
| (X_event.xbutton.button == Button1)
| (X_event.xbutton.button == Button2 ? 2 : 0)
| (X_event.xbutton.button == Button3 ? 4 : 0);
event.data2 = event.data3 = 0;
D_PostEvent(&event);
// fprintf(stderr, "b");
break;
case ButtonRelease:
event.type = ev_mouse;
event.data1 =
(X_event.xbutton.state & Button1Mask)
| (X_event.xbutton.state & Button2Mask ? 2 : 0)
| (X_event.xbutton.state & Button3Mask ? 4 : 0);
// suggest parentheses around arithmetic in operand of |
event.data1 =
event.data1
^ (X_event.xbutton.button == Button1 ? 1 : 0)
^ (X_event.xbutton.button == Button2 ? 2 : 0)
^ (X_event.xbutton.button == Button3 ? 4 : 0);
event.data2 = event.data3 = 0;
D_PostEvent(&event);
// fprintf(stderr, "bu");
break;
case MotionNotify:
event.type = ev_mouse;
event.data1 =
(X_event.xmotion.state & Button1Mask)
| (X_event.xmotion.state & Button2Mask ? 2 : 0)
| (X_event.xmotion.state & Button3Mask ? 4 : 0);
event.data2 = (X_event.xmotion.x - lastmousex) << 2;
event.data3 = (lastmousey - X_event.xmotion.y) << 2;
if (event.data2 || event.data3)
{
lastmousex = X_event.xmotion.x;
lastmousey = X_event.xmotion.y;
if (X_event.xmotion.x != X_width/2 &&
X_event.xmotion.y != X_height/2)
{
D_PostEvent(&event);
// fprintf(stderr, "m");
mousemoved = false;
} else
{
mousemoved = true;
}
}
break;
case Expose:
case ConfigureNotify:
break;
default:
if (doShm && X_event.type == X_shmeventtype) shmFinished = true;
break;
}
*/
}
// Cursor
// createnullcursor
// ( Display* display,
// Window root )
// {
// Pixmap cursormask;
// XGCValues xgc;
// GC gc;
// XColor dummycolour;
// Cursor cursor;
//
// cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/);
// xgc.function = GXclear;
// gc = XCreateGC(display, cursormask, GCFunction, &xgc);
// XFillRectangle(display, cursormask, gc, 0, 0, 1, 1);
// dummycolour.pixel = 0;
// dummycolour.red = 0;
// dummycolour.flags = 04;
// cursor = XCreatePixmapCursor(display, cursormask, cursormask,
// &dummycolour,&dummycolour, 0,0);
// XFreePixmap(display,cursormask);
// XFreeGC(display,gc);
// return cursor;
// }
//
// I_StartTic
//
void I_StartTic (void)
{
return 0;
/*
if (!X_display)
return;
while (XPending(X_display))
I_GetEvent();
// Warp the pointer back to the middle of the window
// or it will wander off - that is, the game will
// loose input focus within X11.
if (grabMouse)
{
if (!--doPointerWarp)
{
XWarpPointer( X_display,
None,
X_mainWindow,
0, 0,
0, 0,
X_width/2, X_height/2);
doPointerWarp = POINTER_WARP_COUNTDOWN;
}
}
mousemoved = false;
*/
}
//
// I_UpdateNoBlit
//
void I_UpdateNoBlit (void)
{
// what is this?
}
//
// I_FinishUpdate
//
void I_FinishUpdate (void)
{
return;
/*
static int lasttic;
int tics;
int i;
// UNUSED static unsigned char *bigscreen=0;
// draws little dots on the bottom of the screen
if (devparm)
{
i = I_GetTime();
tics = i - lasttic;
lasttic = i;
if (tics > 20) tics = 20;
for (i=0 ; i<tics*2 ; i+=2)
screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
for ( ; i<20*2 ; i+=2)
screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
}
// scales the screen size before blitting it
if (multiply == 2)
{
unsigned int *olineptrs[2];
unsigned int *ilineptr;
int x, y, i;
unsigned int twoopixels;
unsigned int twomoreopixels;
unsigned int fouripixels;
ilineptr = (unsigned int *) (screens[0]);
for (i=0 ; i<2 ; i++)
olineptrs[i] = (unsigned int *) &image->data[i*X_width];
y = SCREENHEIGHT;
while (y--)
{
x = SCREENWIDTH;
do
{
fouripixels = *ilineptr++;
twoopixels = (fouripixels & 0xff000000)
| ((fouripixels>>8) & 0xffff00)
| ((fouripixels>>16) & 0xff);
twomoreopixels = ((fouripixels<<16) & 0xff000000)
| ((fouripixels<<8) & 0xffff00)
| (fouripixels & 0xff);
#ifdef __BIG_ENDIAN__
*olineptrs[0]++ = twoopixels;
*olineptrs[1]++ = twoopixels;
*olineptrs[0]++ = twomoreopixels;
*olineptrs[1]++ = twomoreopixels;
#else
*olineptrs[0]++ = twomoreopixels;
*olineptrs[1]++ = twomoreopixels;
*olineptrs[0]++ = twoopixels;
*olineptrs[1]++ = twoopixels;
#endif
} while (x-=4);
olineptrs[0] += X_width/4;
olineptrs[1] += X_width/4;
}
}
else if (multiply == 3)
{
unsigned int *olineptrs[3];
unsigned int *ilineptr;
int x, y, i;
unsigned int fouropixels[3];
unsigned int fouripixels;
ilineptr = (unsigned int *) (screens[0]);
for (i=0 ; i<3 ; i++)
olineptrs[i] = (unsigned int *) &image->data[i*X_width];
y = SCREENHEIGHT;
while (y--)
{
x = SCREENWIDTH;
do
{
fouripixels = *ilineptr++;
fouropixels[0] = (fouripixels & 0xff000000)
| ((fouripixels>>8) & 0xff0000)
| ((fouripixels>>16) & 0xffff);
fouropixels[1] = ((fouripixels<<8) & 0xff000000)
| (fouripixels & 0xffff00)
| ((fouripixels>>8) & 0xff);
fouropixels[2] = ((fouripixels<<16) & 0xffff0000)
| ((fouripixels<<8) & 0xff00)
| (fouripixels & 0xff);
#ifdef __BIG_ENDIAN__
*olineptrs[0]++ = fouropixels[0];
*olineptrs[1]++ = fouropixels[0];
*olineptrs[2]++ = fouropixels[0];
*olineptrs[0]++ = fouropixels[1];
*olineptrs[1]++ = fouropixels[1];
*olineptrs[2]++ = fouropixels[1];
*olineptrs[0]++ = fouropixels[2];
*olineptrs[1]++ = fouropixels[2];
*olineptrs[2]++ = fouropixels[2];
#else
*olineptrs[0]++ = fouropixels[2];
*olineptrs[1]++ = fouropixels[2];
*olineptrs[2]++ = fouropixels[2];
*olineptrs[0]++ = fouropixels[1];
*olineptrs[1]++ = fouropixels[1];
*olineptrs[2]++ = fouropixels[1];
*olineptrs[0]++ = fouropixels[0];
*olineptrs[1]++ = fouropixels[0];
*olineptrs[2]++ = fouropixels[0];
#endif
} while (x-=4);
olineptrs[0] += 2*X_width/4;
olineptrs[1] += 2*X_width/4;
olineptrs[2] += 2*X_width/4;
}
}
else if (multiply == 4)
{
// Broken. Gotta fix this some day.
void Expand4(unsigned *, double *);
Expand4 ((unsigned *)(screens[0]), (double *) (image->data));
}
if (doShm)
{
if (!XShmPutImage( X_display,
X_mainWindow,
X_gc,
image,
0, 0,
0, 0,
X_width, X_height,
True ))
I_Error("XShmPutImage() failed\n");
// wait for it to finish and processes all input events
shmFinished = false;
do
{
I_GetEvent();
} while (!shmFinished);
}
else
{
// draw the image
XPutImage( X_display,
X_mainWindow,
X_gc,
image,
0, 0,
0, 0,
X_width, X_height );
// sync up with server
XSync(X_display, False);
}
*/
}
//
// I_ReadScreen
//
void I_ReadScreen (byte* scr)
{
//memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT);
}
//
// Palette stuff.
//
//static XColor colors[256];
//
// I_SetPalette
//
void I_SetPalette (byte* palette)
{
//UploadNewPalette(X_cmap, palette);
}
void I_InitGraphics(void)
{
return;
/*
char* displayname;
char* d;
int n;
int pnum;
int x=0;
int y=0;
// warning: char format, different type arg
char xsign=' ';
char ysign=' ';
int oktodraw;
unsigned long attribmask;
XSetWindowAttributes attribs;
XGCValues xgcvalues;
int valuemask;
static int firsttime=1;
if (!firsttime)
return;
firsttime = 0;
signal(SIGINT, (void (*)(int)) I_Quit);
if (M_CheckParm("-2"))
multiply = 2;
if (M_CheckParm("-3"))
multiply = 3;
if (M_CheckParm("-4"))
multiply = 4;
X_width = SCREENWIDTH * multiply;
X_height = SCREENHEIGHT * multiply;
// check for command-line display name
if ( (pnum=M_CheckParm("-disp")) ) // suggest parentheses around assignment
displayname = myargv[pnum+1];
else
displayname = 0;
// check if the user wants to grab the mouse (quite unnice)
grabMouse = !!M_CheckParm("-grabmouse");
// check for command-line geometry
if ( (pnum=M_CheckParm("-geom")) ) // suggest parentheses around assignment
{
// warning: char format, different type arg 3,5
n = sscanf(myargv[pnum+1], "%c%d%c%d", &xsign, &x, &ysign, &y);
if (n==2)
x = y = 0;
else if (n==6)
{
if (xsign == '-')
x = -x;
if (ysign == '-')
y = -y;
}
else
I_Error("bad -geom parameter");
}
// open the display
X_display = XOpenDisplay(displayname);
if (!X_display)
{
if (displayname)
I_Error("Could not open display [%s]", displayname);
else
I_Error("Could not open display (DISPLAY=[%s])", getenv("DISPLAY"));
}
// use the default visual
X_screen = DefaultScreen(X_display);
if (!XMatchVisualInfo(X_display, X_screen, 8, PseudoColor, &X_visualinfo))
I_Error("xdoom currently only supports 256-color PseudoColor screens");
X_visual = X_visualinfo.visual;
// check for the MITSHM extension
doShm = XShmQueryExtension(X_display);
// even if it's available, make sure it's a local connection
if (doShm)
{
if (!displayname) displayname = (char *) getenv("DISPLAY");
if (displayname)
{
d = displayname;
while (*d && (*d != ':')) d++;
if (*d) *d = 0;
if (!(!strcasecmp(displayname, "unix") || !*displayname)) doShm = false;
}
}
fprintf(stderr, "Using MITSHM extension\n");
// create the colormap
X_cmap = XCreateColormap(X_display, RootWindow(X_display,
X_screen), X_visual, AllocAll);
// setup attributes for main window
attribmask = CWEventMask | CWColormap | CWBorderPixel;
attribs.event_mask =
KeyPressMask
| KeyReleaseMask
// | PointerMotionMask | ButtonPressMask | ButtonReleaseMask
| ExposureMask;
attribs.colormap = X_cmap;
attribs.border_pixel = 0;
// create the main window
X_mainWindow = XCreateWindow( X_display,
RootWindow(X_display, X_screen),
x, y,
X_width, X_height,
0, // borderwidth
8, // depth
InputOutput,
X_visual,
attribmask,
&attribs );
XDefineCursor(X_display, X_mainWindow,
createnullcursor( X_display, X_mainWindow ) );
// create the GC
valuemask = GCGraphicsExposures;
xgcvalues.graphics_exposures = False;
X_gc = XCreateGC( X_display,
X_mainWindow,
valuemask,
&xgcvalues );
// map the window
XMapWindow(X_display, X_mainWindow);
// wait until it is OK to draw
oktodraw = 0;
while (!oktodraw)
{
XNextEvent(X_display, &X_event);
if (X_event.type == Expose
&& !X_event.xexpose.count)
{
oktodraw = 1;
}
}
// grabs the pointer so it is restricted to this window
if (grabMouse)
XGrabPointer(X_display, X_mainWindow, True,
ButtonPressMask|ButtonReleaseMask|PointerMotionMask,
GrabModeAsync, GrabModeAsync,
X_mainWindow, None, CurrentTime);
if (doShm)
{
X_shmeventtype = XShmGetEventBase(X_display) + ShmCompletion;
// create the image
image = XShmCreateImage( X_display,
X_visual,
8,
ZPixmap,
0,
&X_shminfo,
X_width,
X_height );
grabsharedmemory(image->bytes_per_line * image->height);
// UNUSED
// create the shared memory segment
// X_shminfo.shmid = shmget (IPC_PRIVATE,
// image->bytes_per_line * image->height, IPC_CREAT | 0777);
// if (X_shminfo.shmid < 0)
// {
// perror("");
// I_Error("shmget() failed in InitGraphics()");
// }
// fprintf(stderr, "shared memory id=%d\n", X_shminfo.shmid);
// attach to the shared memory segment
// image->data = X_shminfo.shmaddr = shmat(X_shminfo.shmid, 0, 0);
if (!image->data)
{
perror("");
I_Error("shmat() failed in InitGraphics()");
}
// get the X server to attach to it
if (!XShmAttach(X_display, &X_shminfo))
I_Error("XShmAttach() failed in InitGraphics()");
}
else
{
image = XCreateImage( X_display,
X_visual,
8,
ZPixmap,
0,
(char*)malloc(X_width * X_height),
X_width, X_height,
8,
X_width );
}
if (multiply == 1)
screens[0] = (unsigned char *) (image->data);
else
screens[0] = (unsigned char *) malloc (SCREENWIDTH * SCREENHEIGHT);
*/
}
void InitExpand (void)
{
/*
int i;
for (i=0 ; i<256 ; i++)
exptable[i] = i | (i<<8) | (i<<16) | (i<<24);
*/
}
void InitExpand2 (void)
{
return;
/*
int i;
int j;
// UNUSED unsigned iexp, jexp;
double* exp;
union
{
double d;
unsigned u[2];
} pixel;
printf ("building exptable2...\n");
exp = exptable2;
for (i=0 ; i<256 ; i++)
{
pixel.u[0] = i | (i<<8) | (i<<16) | (i<<24);
for (j=0 ; j<256 ; j++)
{
pixel.u[1] = j | (j<<8) | (j<<16) | (j<<24);
*exp++ = pixel.d;
}
}
printf ("done.\n");
*/
}
int inited;
void
Expand4
( unsigned* lineptr,
double* xline )
{
return;
/*
double dpixel;
unsigned x;
unsigned y;
unsigned fourpixels;
unsigned step;
double* exp;
exp = exptable2;
if (!inited)
{
inited = 1;
InitExpand2 ();
}
step = 3*SCREENWIDTH/2;
y = SCREENHEIGHT-1;
do
{
x = SCREENWIDTH;
do
{
fourpixels = lineptr[0];
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
xline[0] = dpixel;
xline[160] = dpixel;
xline[320] = dpixel;
xline[480] = dpixel;
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
xline[1] = dpixel;
xline[161] = dpixel;
xline[321] = dpixel;
xline[481] = dpixel;
fourpixels = lineptr[1];
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
xline[2] = dpixel;
xline[162] = dpixel;
xline[322] = dpixel;
xline[482] = dpixel;
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
xline[3] = dpixel;
xline[163] = dpixel;
xline[323] = dpixel;
xline[483] = dpixel;
fourpixels = lineptr[2];
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
xline[4] = dpixel;
xline[164] = dpixel;
xline[324] = dpixel;
xline[484] = dpixel;
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
xline[5] = dpixel;
xline[165] = dpixel;
xline[325] = dpixel;
xline[485] = dpixel;
fourpixels = lineptr[3];
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
xline[6] = dpixel;
xline[166] = dpixel;
xline[326] = dpixel;
xline[486] = dpixel;
dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
xline[7] = dpixel;
xline[167] = dpixel;
xline[327] = dpixel;
xline[487] = dpixel;
lineptr+=4;
xline+=8;
} while (x-=16);
xline += step;
} while (y--);
*/
}

View File

@ -5,25 +5,38 @@
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// $Log:$
//
// DESCRIPTION:
// DOOM graphics stuff for fbdev on Frosted
// DOOM graphics stuff for X11, UNIX.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $";
#include "config.h"
#include "v_video.h"
#include "m_argv.h"
#include "d_event.h"
#include "d_main.h"
#include "i_video.h"
#include "z_zone.h"
#include "tables.h"
#include "doomkeys.h"
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
@ -34,18 +47,6 @@ rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $";
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <errno.h>
#include <signal.h>
#include "doomstat.h"
#include "i_system.h"
#include "v_video.h"
#include "m_argv.h"
#include "d_main.h"
#include "doomdef.h"
struct color {
uint32_t b:8;
uint32_t g:8;
@ -53,7 +54,11 @@ struct color {
uint32_t a:8;
};
struct color colors[256];
static struct color colors[256];
// The screen buffer; this is modified to draw things to the screen
byte *I_VideoBuffer = NULL;
/* framebuffer file descriptor */
int fd_fb = 0;
@ -61,160 +66,290 @@ int fd_fb = 0;
int X_width;
int X_height;
// If true, game is running as a screensaver
void I_ShutdownGraphics(void)
boolean screensaver_mode = false;
// Flag indicating whether the screen is currently visible:
// when the screen isnt visible, don't render the screen
boolean screenvisible;
// Mouse acceleration
//
// This emulates some of the behavior of DOS mouse drivers by increasing
// the speed when the mouse is moved fast.
//
// The mouse input values are input directly to the game, but when
// the values exceed the value of mouse_threshold, they are multiplied
// by mouse_acceleration to increase the speed.
float mouse_acceleration = 2.0;
int mouse_threshold = 10;
// Gamma correction level to use
int usegamma = 0;
int usemouse = 0;
// If true, keyboard mapping is ignored, like in Vanilla Doom.
// The sensible thing to do is to disable this if you have a non-US
// keyboard.
int vanilla_keyboard_mapping = true;
typedef struct
{
printf("I_ShutdownGraphics\n");
// Always be sure to clean up
//SDL_Quit();
close(fd_fb);
byte r;
byte g;
byte b;
} col_t;
// Palette converted to RGB565
static uint16_t rgb565_palette[256];
// Last touch state
//static touch_state_t last_touch_state;
// Last button state
//static bool last_button_state;
// run state
//static bool run;
void I_InitGraphics (void)
{
// gfx_image_t keys_img;
// gfx_coord_t coords;
//
// gfx_init_img (&keys_img, 40, 320, GFX_PIXEL_FORMAT_RGB565, RGB565_BLACK);
// keys_img.pixel_data = (uint8_t*)img_keys;
// gfx_init_img_coord (&coords, &keys_img);
//
// gfx_draw_img (&keys_img, &coords);
// lcd_refresh ();
//
// gfx_draw_img (&keys_img, &coords);
// lcd_refresh ();
X_width = SCREENWIDTH;
X_height = SCREENHEIGHT;
printf("I_InitGraphics: w x h: %d x %d\n", X_width, X_height);
/* Open fbdev file descriptor */
fd_fb = open("/dev/fb0", O_RDWR);
if (fd_fb < 0)
{
printf("Could not open /dev/fb0");
exit(-1);
}
/* Allocate screen to draw to */
//screen_pixels = malloc(X_width * X_height);
//
I_VideoBuffer = (byte*)Z_Malloc (SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
screenvisible = true;
//screens[0] = (unsigned char *)screen_pixels;
//screens[0] = (unsigned char *)I_VideoBuffer;
}
void I_ShutdownGraphics (void)
{
Z_Free (I_VideoBuffer);
}
//
// I_StartFrame
//
void I_StartFrame (void)
{
// er?
}
void I_GetEvent(void)
void I_GetEvent (void)
{
/*
event_t event;
// put event-grabbing stuff in here
XNextEvent(X_display, &X_event);
switch (X_event.type)
{
case KeyPress:
event.type = ev_keydown;
event.data1 = xlatekey();
D_PostEvent(&event);
// fprintf(stderr, "k");
break;
case KeyRelease:
event.type = ev_keyup;
event.data1 = xlatekey();
D_PostEvent(&event);
// fprintf(stderr, "ku");
break;
case ButtonPress:
event.type = ev_mouse;
event.data1 =
(X_event.xbutton.state & Button1Mask)
| (X_event.xbutton.state & Button2Mask ? 2 : 0)
| (X_event.xbutton.state & Button3Mask ? 4 : 0)
| (X_event.xbutton.button == Button1)
| (X_event.xbutton.button == Button2 ? 2 : 0)
| (X_event.xbutton.button == Button3 ? 4 : 0);
event.data2 = event.data3 = 0;
D_PostEvent(&event);
// fprintf(stderr, "b");
break;
case ButtonRelease:
event.type = ev_mouse;
event.data1 =
(X_event.xbutton.state & Button1Mask)
| (X_event.xbutton.state & Button2Mask ? 2 : 0)
| (X_event.xbutton.state & Button3Mask ? 4 : 0);
// suggest parentheses around arithmetic in operand of |
event.data1 =
event.data1
^ (X_event.xbutton.button == Button1 ? 1 : 0)
^ (X_event.xbutton.button == Button2 ? 2 : 0)
^ (X_event.xbutton.button == Button3 ? 4 : 0);
event.data2 = event.data3 = 0;
D_PostEvent(&event);
// fprintf(stderr, "bu");
break;
case MotionNotify:
event.type = ev_mouse;
event.data1 =
(X_event.xmotion.state & Button1Mask)
| (X_event.xmotion.state & Button2Mask ? 2 : 0)
| (X_event.xmotion.state & Button3Mask ? 4 : 0);
event.data2 = (X_event.xmotion.x - lastmousex) << 2;
event.data3 = (lastmousey - X_event.xmotion.y) << 2;
if (event.data2 || event.data3)
{
lastmousex = X_event.xmotion.x;
lastmousey = X_event.xmotion.y;
if (X_event.xmotion.x != X_width/2 &&
X_event.xmotion.y != X_height/2)
{
D_PostEvent(&event);
// fprintf(stderr, "m");
mousemoved = false;
} else
{
mousemoved = true;
}
}
break;
case Expose:
case ConfigureNotify:
break;
default:
if (doShm && X_event.type == X_shmeventtype) shmFinished = true;
break;
}
*/
// event_t event;
// bool button_state;
//
// button_state = button_read ();
//
// if (last_button_state != button_state)
// {
// last_button_state = button_state;
//
// event.type = last_button_state ? ev_keydown : ev_keyup;
// event.data1 = KEY_FIRE;
// event.data2 = -1;
// event.data3 = -1;
//
// D_PostEvent (&event);
// }
//
// touch_main ();
//
// if ((touch_state.x != last_touch_state.x) || (touch_state.y != last_touch_state.y) || (touch_state.status != last_touch_state.status))
// {
// last_touch_state = touch_state;
//
// event.type = (touch_state.status == TOUCH_PRESSED) ? ev_keydown : ev_keyup;
// event.data1 = -1;
// event.data2 = -1;
// event.data3 = -1;
//
// if ((touch_state.x > 49)
// && (touch_state.x < 72)
// && (touch_state.y > 104)
// && (touch_state.y < 143))
// {
// // select weapon
// if (touch_state.x < 60)
// {
// // lower row (5-7)
// if (touch_state.y < 119)
// {
// event.data1 = '5';
// }
// else if (touch_state.y < 131)
// {
// event.data1 = '6';
// }
// else
// {
// event.data1 = '1';
// }
// }
// else
// {
// // upper row (2-4)
// if (touch_state.y < 119)
// {
// event.data1 = '2';
// }
// else if (touch_state.y < 131)
// {
// event.data1 = '3';
// }
// else
// {
// event.data1 = '4';
// }
// }
// }
// else if (touch_state.x < 40)
// {
// // button bar at bottom screen
// if (touch_state.y < 40)
// {
// // enter
// event.data1 = KEY_ENTER;
// }
// else if (touch_state.y < 80)
// {
// // escape
// event.data1 = KEY_ESCAPE;
// }
// else if (touch_state.y < 120)
// {
// // use
// event.data1 = KEY_USE;
// }
// else if (touch_state.y < 160)
// {
// // map
// event.data1 = KEY_TAB;
// }
// else if (touch_state.y < 200)
// {
// // pause
// event.data1 = KEY_PAUSE;
// }
// else if (touch_state.y < 240)
// {
// // toggle run
// if (touch_state.status == TOUCH_PRESSED)
// {
// run = !run;
//
// event.data1 = KEY_RSHIFT;
//
// if (run)
// {
// event.type = ev_keydown;
// }
// else
// {
// event.type = ev_keyup;
// }
// }
// else
// {
// return;
// }
// }
// else if (touch_state.y < 280)
// {
// // save
// event.data1 = KEY_F2;
// }
// else if (touch_state.y < 320)
// {
// // load
// event.data1 = KEY_F3;
// }
// }
// else
// {
// // movement/menu navigation
// if (touch_state.x < 100)
// {
// if (touch_state.y < 100)
// {
// event.data1 = KEY_STRAFE_L;
// }
// else if (touch_state.y < 220)
// {
// event.data1 = KEY_DOWNARROW;
// }
// else
// {
// event.data1 = KEY_STRAFE_R;
// }
// }
// else if (touch_state.x < 180)
// {
// if (touch_state.y < 160)
// {
// event.data1 = KEY_LEFTARROW;
// }
// else
// {
// event.data1 = KEY_RIGHTARROW;
// }
// }
// else
// {
// event.data1 = KEY_UPARROW;
// }
// }
//
// D_PostEvent (&event);
// }
}
//
// I_StartTic
//
void I_StartTic (void)
{
return;
/*
if (!X_display)
return;
while (XPending(X_display))
I_GetEvent();
// Warp the pointer back to the middle of the window
// or it will wander off - that is, the game will
// loose input focus within X11.
if (grabMouse)
{
if (!--doPointerWarp)
{
XWarpPointer( X_display,
None,
X_mainWindow,
0, 0,
0, 0,
X_width/2, X_height/2);
doPointerWarp = POINTER_WARP_COUNTDOWN;
}
}
mousemoved = false;
*/
}
//
// I_UpdateNoBlit
//
void I_UpdateNoBlit (void)
{
// what is this?
}
//
@ -224,51 +359,34 @@ void I_UpdateNoBlit (void)
#define FB_HEIGHT (272)
#define FB_BPP_RGB565 (16)
unsigned char line_out[FB_WIDTH * (FB_BPP_RGB565/8)];
void cmap_to_rgb565(uint16_t * out, uint8_t * in, int in_pixels)
{
int i;
struct color c;
uint16_t r, g, b;
for (i = 0; i < in_pixels; i++)
{
c = colors[*in];
r = ((uint16_t)(c.r >> 3)) << 11;
g = ((uint16_t)(c.g >> 2)) << 5;
b = ((uint16_t)(c.b >> 3)) << 0;
*out = (r | g | b);
in++;
out++;
}
}
void I_FinishUpdate (void)
{
//int x, y;
int y;
unsigned char *line_in;
static int lasttic;
int tics;
int i;
int y;
//byte index;
// draws little dots on the bottom of the screen
if (devparm)
{
i = I_GetTime();
tics = i - lasttic;
lasttic = i;
if (tics > 20) tics = 20;
//lcd_vsync = false;
for (i=0 ; i<tics*2 ; i+=2)
screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
for ( ; i<20*2 ; i+=2)
screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
}
//for (y = 0; y < SCREENHEIGHT; y++)
//{
// for (x = 0; x < SCREENWIDTH; x++)
// {
// index = I_VideoBuffer[y * SCREENWIDTH + x];
// ((uint16_t*)lcd_frame_buffer)[x * GFX_MAX_WIDTH + (GFX_MAX_WIDTH - y - 1)] = rgb565_palette[index];
// }
//}
//lcd_refresh ();
//lcd_vsync = true;
//
//
/* DRAW SCREEN */
line_in = (unsigned char *) screens[0];
line_in = (unsigned char *) I_VideoBuffer;
lseek(fd_fb, 0, SEEK_SET);
y = SCREENHEIGHT;
@ -288,35 +406,42 @@ void I_FinishUpdate (void)
line_in += SCREENWIDTH;
}
#endif
}
}
//
// I_ReadScreen
//
void I_ReadScreen (byte* scr)
{
/* Our framebuffer is not the same resolution, so makes reading difficult */
//lseek(fd_fb, 0, SEEK_SET);
//int left = SCREENWIDTH * SCREENHEIGHT;
//while (left)
//{
// int rd = read(fd_fb, scr, left);
// if (rd > 0)
// left -= rd;
//}
memcpy(scr, screens[0], SCREENWIDTH * SCREENHEIGHT);
memcpy (scr, I_VideoBuffer, SCREENWIDTH * SCREENHEIGHT);
}
//
// I_SetPalette
//
#define GFX_RGB565(r, g, b) ((((r & 0xF8) >> 3) << 11) | (((g & 0xFC) >> 2) << 5) | ((b & 0xF8) >> 3))
#define GFX_RGB565_R(color) ((0xF800 & color) >> 11)
#define GFX_RGB565_G(color) ((0x07E0 & color) >> 5)
#define GFX_RGB565_B(color) (0x001F & color)
void I_SetPalette (byte* palette)
{
//printf("I_SetPalette\n");
int i;
//col_t* c;
for (int i=0; i<256; ++i ) {
//for (i = 0; i < 256; i++)
//{
// c = (col_t*)palette;
// rgb565_palette[i] = GFX_RGB565(gammatable[usegamma][c->r],
// gammatable[usegamma][c->g],
// gammatable[usegamma][c->b]);
// palette += 3;
//}
for (i=0; i<256; ++i ) {
colors[i].a = 0;
colors[i].r = gammatable[usegamma][*palette++];
colors[i].g = gammatable[usegamma][*palette++];
@ -327,27 +452,76 @@ void I_SetPalette (byte* palette)
ioctl(fd_fb, IOCTL_FB_PUTCMAP, colors);
}
void I_InitGraphics(void)
// Given an RGB value, find the closest matching palette index.
int I_GetPaletteIndex (int r, int g, int b)
{
unsigned char * screen_pixels;
int best, best_diff, diff;
int i;
col_t color;
X_width = SCREENWIDTH;
X_height = SCREENHEIGHT;
//printf("I_GetPaletteIndex\n");
printf("I_InitGraphics: w x h: %d x %d\n", X_width, X_height);
best = 0;
best_diff = INT_MAX;
/* Open fbdev file descriptor */
fd_fb = open("/dev/fb0", O_RDWR);
if (fd_fb < 0)
for (i = 0; i < 256; ++i)
{
printf("Could not open /dev/fb0");
exit(-1);
color.r = GFX_RGB565_R(rgb565_palette[i]);
color.g = GFX_RGB565_G(rgb565_palette[i]);
color.b = GFX_RGB565_B(rgb565_palette[i]);
diff = (r - color.r) * (r - color.r)
+ (g - color.g) * (g - color.g)
+ (b - color.b) * (b - color.b);
if (diff < best_diff)
{
best = i;
best_diff = diff;
}
if (diff == 0)
{
break;
}
}
/* Allocate screen to draw to */
screen_pixels = malloc(X_width * X_height);
screens[0] = (unsigned char *)screen_pixels;
return best;
}
void I_BeginRead (void)
{
}
void I_EndRead (void)
{
}
void I_SetWindowTitle (char *title)
{
}
void I_GraphicsCheckCommandLine (void)
{
}
void I_SetGrabMouseCallback (grabmouse_callback_t func)
{
}
void I_EnableLoadingDisk(void)
{
}
void I_BindVideoVariables (void)
{
}
void I_DisplayFPSDots (boolean dots_on)
{
}
void I_CheckIsScreensaver (void)
{
}

262
frosted-doom/icon.c Normal file
View File

@ -0,0 +1,262 @@
static int icon_w = 32;
static int icon_h = 32;
static unsigned char icon_data[] = {
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xa2,0x86,0x73,
0xa9,0x8d,0x7a, 0xbd,0xa0,0x8c, 0xda,0xba,0xa0, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xbd,0x8d,0x67, 0xd7,0xb9,0xa5, 0xeb,0xd8,0xcd, 0xd3,0xbf,0xae,
0xbd,0xa0,0x8c, 0xeb,0xd8,0xcd, 0xc2,0x9d,0x86, 0x95,0x5d,0x38,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x9b,0x7e,0x66,
0xc5,0x9e,0x81, 0xd3,0xb3,0x99, 0xd4,0xac,0x8e, 0xee,0xdc,0xd1,
0xb9,0x93,0x76, 0xad,0x71,0x45, 0xd4,0xac,0x8e, 0xb9,0x93,0x76,
0xa3,0x77,0x58, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x39,0x1d,0x2d, 0x55,0x20,0x22, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0xda,0xb4,0x9c, 0xd3,0xa3,0x83,
0xaf,0x91,0x78, 0xa7,0x83,0x6d, 0xc4,0xa7,0x93, 0xee,0xe2,0xd5,
0xeb,0xd8,0xcd, 0x8c,0x60,0x3d, 0x9b,0x7e,0x66, 0xce,0x9f,0x7e,
0x84,0x54,0x33, 0xba,0x83,0x5b, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x24,0x1c,0x35, 0x00,0x0f,0x32, 0x29,0x18,0x2e, 0x55,0x20,0x22,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0xd3,0xb3,0x99, 0xca,0x93,0x6f, 0xc4,0x94,0x6e,
0x98,0x66,0x45, 0x78,0x50,0x2d, 0xd7,0xb9,0xa5, 0xee,0xdc,0xd1,
0xc4,0x9b,0x79, 0xa1,0x6d,0x45, 0x66,0x40,0x24, 0xb8,0x7a,0x4f,
0xcf,0xa6,0x83, 0x98,0x6d,0x4e, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x30,0x1c,0x2f, 0x08,0x13,0x30, 0x00,0x0f,0x32, 0x00,0x0f,0x32,
0x39,0x1d,0x2d, 0x52,0x1c,0x1a, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x9e,0x7b,0x65, 0xb9,0x89,0x64, 0xaa,0x7d,0x5e, 0x9e,0x72,0x53,
0x88,0x5e,0x40, 0xc4,0xa7,0x93, 0xb9,0x89,0x64, 0x90,0x6c,0x51,
0x7f,0x50,0x2f, 0x90,0x5e,0x37, 0x75,0x4d,0x30, 0x7f,0x50,0x2f,
0xd3,0xa3,0x83, 0xd4,0xac,0x8e, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x29,0x18,0x2e, 0x08,0x13,0x30, 0x08,0x13,0x30, 0x08,0x13,0x30,
0x00,0x0f,0x32, 0x08,0x13,0x30, 0x49,0x1e,0x2b, 0x49,0x1a,0x16,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xda,0xba,0xa0,
0xd4,0xac,0x8e, 0xc4,0x9b,0x79, 0xaa,0x7d,0x5e, 0xaa,0x7d,0x5e,
0xbd,0xa0,0x8c, 0x8c,0x60,0x3d, 0x70,0x49,0x2c, 0x89,0x60,0x42,
0x57,0x38,0x20, 0x6c,0x45,0x29, 0x66,0x40,0x24, 0x51,0x35,0x21,
0x7e,0x55,0x38, 0xce,0x9f,0x7e, 0xc2,0x8a,0x61, 0x00,0x00,0x00,
0x30,0x1c,0x2f, 0x00,0x0f,0x32, 0x00,0x0f,0x32, 0x08,0x13,0x30,
0x00,0x0f,0x32, 0x00,0x0f,0x32, 0x08,0x13,0x30, 0x08,0x13,0x30,
0x59,0x25,0x2b, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xcb,0x9a,0x74,
0xb7,0x81,0x58, 0x8c,0x60,0x3d, 0x79,0x4b,0x2b, 0x89,0x58,0x31,
0x89,0x58,0x31, 0x7f,0x50,0x2f, 0x9e,0x64,0x39, 0x75,0x4c,0x2a,
0x51,0x35,0x21, 0x84,0x54,0x33, 0x54,0x36,0x1d, 0x98,0x6d,0x4e,
0xb4,0x7f,0x5c, 0xba,0x83,0x5b, 0xb8,0x7a,0x4f, 0x00,0x00,0x00,
0x3e,0x28,0x36, 0x08,0x13,0x30, 0x00,0x0f,0x32, 0x08,0x13,0x30,
0x00,0x0f,0x32, 0x00,0x0f,0x32, 0x00,0x0f,0x32, 0x08,0x13,0x30,
0x20,0x1f,0x36, 0x35,0x19,0x12, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xc2,0x8a,0x61,
0x89,0x60,0x42, 0x84,0x54,0x33, 0x7f,0x50,0x2f, 0x86,0x56,0x35,
0x8d,0x5b,0x35, 0x75,0x4c,0x2a, 0x8d,0x5b,0x35, 0x5c,0x38,0x22,
0x5e,0x3f,0x27, 0x75,0x4d,0x30, 0x9d,0x64,0x3f, 0x75,0x4c,0x2a,
0x78,0x50,0x2d, 0x7f,0x50,0x2f, 0xb7,0x81,0x58, 0x00,0x00,0x00,
0x46,0x35,0x42, 0x04,0x18,0x3a, 0x08,0x13,0x30, 0x5d,0x30,0x28,
0x20,0x1f,0x36, 0x08,0x13,0x30, 0x08,0x13,0x30, 0x04,0x18,0x3a,
0x19,0x1c,0x37, 0x3a,0x1d,0x16, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x91,0x5f,0x3e,
0x84,0x54,0x33, 0x89,0x58,0x31, 0x7e,0x6e,0x64, 0xc4,0x94,0x6e,
0x78,0x50,0x2d, 0x92,0x6f,0x59, 0xa1,0x7c,0x60, 0x9c,0x6f,0x4b,
0x8d,0x5b,0x35, 0xbc,0x7f,0x53, 0xad,0x71,0x45, 0x75,0x4d,0x30,
0x51,0x35,0x21, 0x4b,0x2f,0x1c, 0x70,0x49,0x2c, 0x00,0x00,0x00,
0x59,0x44,0x4d, 0x1e,0x28,0x42, 0x1e,0x28,0x42, 0x48,0x19,0x10,
0x42,0x19,0x12, 0x53,0x2b,0x30, 0x0c,0x26,0x48, 0x1e,0x28,0x42,
0x24,0x2d,0x48, 0x5f,0x2c,0x1d, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x89,0x58,0x31,
0xa1,0x84,0x6c, 0xc4,0x94,0x6e, 0x88,0x64,0x44, 0xb5,0x8f,0x73,
0x9e,0x72,0x53, 0xa1,0x6d,0x45, 0x93,0x60,0x3a, 0xad,0x71,0x45,
0xb4,0x7f,0x5c, 0xbd,0x8d,0x67, 0xc2,0x8a,0x61, 0xb3,0x76,0x4b,
0xb8,0x7a,0x4f, 0x88,0x64,0x44, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x61,0x50,0x52, 0x1c,0x34,0x52, 0x1c,0x34,0x52, 0x54,0x27,0x16,
0x29,0x17,0x09, 0x5d,0x30,0x28, 0x1c,0x34,0x52, 0x1c,0x34,0x52,
0x24,0x35,0x4f, 0x69,0x34,0x24, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xa7,0x83,0x6d,
0xac,0x86,0x6a, 0x74,0x47,0x2d, 0x84,0x54,0x33, 0x5c,0x38,0x22,
0x54,0x36,0x1d, 0x6c,0x45,0x29, 0x96,0x63,0x3c, 0xa3,0x6e,0x41,
0xb3,0x76,0x4b, 0xb3,0x76,0x4b, 0xa2,0x68,0x3d, 0x7c,0x4e,0x2d,
0x63,0x3e,0x27, 0x96,0x63,0x3c, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x6b,0x5d,0x59, 0x22,0x42,0x5f, 0x22,0x42,0x5f, 0x5d,0x34,0x1a,
0x38,0x23,0x0f, 0x5c,0x38,0x22, 0x22,0x42,0x5f, 0x22,0x42,0x5f,
0x2c,0x45,0x5e, 0x6f,0x3e,0x2b, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb7,0x81,0x58,
0x98,0x74,0x59, 0x6c,0x45,0x29, 0x4b,0x35,0x25, 0x78,0x50,0x2d,
0x78,0x50,0x2d, 0x78,0x50,0x2d, 0x7f,0x50,0x2f, 0x84,0x54,0x33,
0x8d,0x5b,0x35, 0x96,0x63,0x3c, 0x74,0x47,0x2d, 0x65,0x45,0x26,
0x65,0x45,0x26, 0x7c,0x4e,0x2d, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x77,0x69,0x64, 0x30,0x4e,0x6d, 0x32,0x52,0x6b, 0x69,0x42,0x26,
0x49,0x31,0x11, 0x6c,0x47,0x2f, 0x27,0x4f,0x6d, 0x27,0x4f,0x6d,
0x32,0x52,0x6b, 0x70,0x49,0x2c, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb7,0x81,0x58,
0x8a,0x5a,0x39, 0x8a,0x5a,0x39, 0x91,0x5f,0x3e, 0x5e,0x3f,0x27,
0x5c,0x38,0x22, 0x89,0x58,0x31, 0x89,0x58,0x31, 0x95,0x5d,0x38,
0x9d,0x64,0x3f, 0x65,0x45,0x26, 0x4b,0x2f,0x1c, 0x7f,0x50,0x2f,
0x78,0x50,0x2d, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x77,0x69,0x64, 0x36,0x5c,0x7a, 0x3e,0x5e,0x78, 0x76,0x52,0x2e,
0x5d,0x42,0x22, 0x75,0x4d,0x30, 0x36,0x5c,0x7a, 0x36,0x5c,0x7a,
0x3e,0x5e,0x78, 0x74,0x47,0x2d, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x89,0x58,0x31, 0x63,0x3e,0x27, 0xa8,0x6d,0x42, 0x4b,0x2f,0x1c,
0x65,0x45,0x26, 0x70,0x49,0x2c, 0x51,0x35,0x21, 0x78,0x50,0x2d,
0x42,0x30,0x14, 0x49,0x31,0x11, 0x59,0x44,0x22, 0x7c,0x5c,0x2a,
0x8a,0x71,0x27, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x71,0x67,0x5c, 0x37,0x52,0x66, 0x3f,0x55,0x64, 0x80,0x55,0x27,
0x64,0x4c,0x1f, 0x7e,0x59,0x2e, 0x37,0x52,0x66, 0x37,0x52,0x66,
0x3f,0x55,0x64, 0x6c,0x47,0x2f, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x70,0x49,0x2c, 0x65,0x45,0x26, 0x65,0x45,0x26, 0x63,0x3e,0x27,
0x76,0x4d,0x25, 0x5d,0x42,0x22, 0x5e,0x3f,0x27, 0x4e,0x43,0x18,
0x4e,0x43,0x18, 0x6a,0x5b,0x1c, 0x4e,0x43,0x18, 0x5f,0x51,0x19,
0x8a,0x76,0x2a, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x63,0x38,0x19, 0x34,0x11,0x04, 0x32,0x0f,0x00, 0x86,0x58,0x1e,
0x74,0x59,0x25, 0x86,0x58,0x1e, 0x34,0x15,0x00, 0x32,0x0f,0x00,
0x34,0x15,0x00, 0x4e,0x31,0x18, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x7e,0x6c,0x27, 0x5a,0x4d,0x1c,
0x4d,0x3e,0x15, 0x67,0x58,0x21, 0x5a,0x4d,0x1c, 0x57,0x4b,0x1a,
0x5f,0x51,0x19, 0x64,0x55,0x1e, 0x5a,0x4d,0x1c, 0x8a,0x71,0x27,
0x8e,0x79,0x26, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x63,0x38,0x19, 0x34,0x11,0x04, 0x32,0x0f,0x00, 0x8d,0x63,0x1f,
0x83,0x66,0x2c, 0x8d,0x63,0x1f, 0x32,0x0f,0x00, 0x35,0x19,0x12,
0x34,0x11,0x04, 0x53,0x3a,0x20, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0xac,0x93,0x39, 0x76,0x65,0x20,
0x6a,0x5b,0x1c, 0x6a,0x5b,0x1c, 0x67,0x58,0x21, 0x4e,0x43,0x18,
0x4e,0x43,0x18, 0x9b,0x85,0x32, 0xb8,0x9e,0x3c, 0xb1,0x8d,0x36,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x63,0x38,0x19, 0x34,0x15,0x00, 0x32,0x0f,0x00, 0x8d,0x63,0x1f,
0x83,0x66,0x2c, 0x8d,0x63,0x1f, 0x32,0x0f,0x00, 0x32,0x0f,0x00,
0x34,0x15,0x00, 0x53,0x3a,0x20, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0xb0,0x96,0x34, 0x76,0x65,0x20,
0x7e,0x66,0x23, 0x8e,0x79,0x26, 0x8a,0x71,0x27, 0x7e,0x6c,0x27,
0x8a,0x71,0x27, 0x8a,0x71,0x27, 0xb0,0x96,0x34, 0x98,0x82,0x2f,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x75,0x4c,0x2a, 0x38,0x19,0x05, 0x38,0x19,0x05, 0x99,0x6d,0x22,
0x96,0x70,0x2a, 0x99,0x6d,0x22, 0x38,0x19,0x05, 0x38,0x19,0x05,
0x38,0x19,0x05, 0x59,0x3f,0x25, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0xac,0x93,0x39, 0x8a,0x76,0x2a,
0x7e,0x66,0x23, 0x76,0x65,0x20, 0x93,0x7d,0x2a, 0x82,0x6f,0x23,
0x9f,0x88,0x35, 0xb8,0xa0,0x4c, 0xb8,0xa0,0x4c, 0xc4,0xa8,0x3f,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x7c,0x5c,0x2a, 0x52,0x2e,0x0d, 0x52,0x2e,0x0d, 0xa4,0x7b,0x27,
0xa1,0x80,0x37, 0x9f,0x77,0x1a, 0x52,0x2e,0x0d, 0x52,0x2e,0x0d,
0x52,0x2e,0x0d, 0x5f,0x4e,0x2a, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x86,0x72,0x26,
0xac,0x93,0x39, 0x97,0x82,0x36, 0xb1,0x8d,0x36, 0xac,0x93,0x39,
0x97,0x82,0x36, 0xa4,0x8c,0x32, 0xbd,0xa2,0x41, 0x8a,0x71,0x27,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x8b,0x6d,0x32, 0x66,0x44,0x14, 0x6d,0x4a,0x20, 0xab,0x86,0x29,
0xb1,0x8d,0x36, 0xa4,0x7b,0x27, 0x66,0x44,0x14, 0x66,0x44,0x14,
0x66,0x44,0x14, 0x69,0x56,0x2c, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xac,0x93,0x31,
0x7e,0x6c,0x27, 0x9f,0x88,0x35, 0x97,0x82,0x36, 0x7e,0x66,0x23,
0x7e,0x66,0x23, 0xb2,0x99,0x3f, 0xbd,0xa2,0x41, 0x8a,0x76,0x2a,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x99,0x7a,0x38, 0x86,0x58,0x1e, 0x7f,0x59,0x22, 0xb2,0x8b,0x1c,
0x94,0x6e,0x21, 0x7f,0x59,0x22, 0x7f,0x59,0x22, 0x7f,0x59,0x22,
0x7f,0x59,0x22, 0x69,0x56,0x2c, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xac,0x93,0x39,
0x8a,0x71,0x27, 0xb4,0x9c,0x48, 0x7e,0x66,0x23, 0xac,0x93,0x39,
0x9c,0x87,0x3a, 0x9c,0x87,0x3a, 0xbd,0xa2,0x41, 0x8e,0x79,0x26,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xa8,0x86,0x3d, 0x96,0x70,0x2a, 0x96,0x70,0x2a, 0x96,0x70,0x2a,
0x96,0x70,0x2a, 0x96,0x70,0x2a, 0x96,0x70,0x2a, 0x96,0x70,0x2a,
0xa1,0x80,0x37, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb4,0x9c,0x48,
0xac,0x93,0x31, 0x93,0x7d,0x2a, 0xbd,0xa3,0x48, 0x93,0x7d,0x2a,
0xb8,0xa0,0x4c, 0xb4,0x9c,0x48, 0xcc,0xa5,0x4e, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xa8,0x86,0x3d, 0xaf,0x85,0x31, 0xaf,0x85,0x31, 0xaf,0x85,0x31,
0xaf,0x85,0x31, 0xaf,0x85,0x31, 0xaf,0x85,0x31, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x97,0x82,0x36, 0xb4,0x9c,0x48, 0xb2,0x99,0x3f, 0xb4,0x9c,0x48,
0xb0,0x96,0x34, 0xc1,0xa7,0x4c, 0x9b,0x84,0x2a, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xbd,0x9e,0x4c, 0xc7,0x9a,0x3f, 0xc7,0x9a,0x3f, 0xc7,0x9a,0x3f,
0xc7,0x9a,0x3f, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x9b,0x85,0x32, 0xa7,0x8e,0x2c, 0xac,0x93,0x39, 0xb5,0x91,0x41,
0x76,0x65,0x20, 0xa7,0x8e,0x2c, 0xb4,0x9a,0x38, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xcc,0xa5,0x4e, 0xe0,0xaf,0x45, 0xe0,0xaf,0x45, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xa4,0x8c,0x32, 0xb8,0x9e,0x44, 0x86,0x72,0x26, 0x9f,0x88,0x35,
0xbd,0xa3,0x48, 0x9b,0x85,0x32, 0xa3,0x81,0x32, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xd1,0xae,0x4e, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xb0,0x97,0x3c, 0xb4,0x9a,0x38, 0xac,0x94,0x41, 0xb2,0x99,0x3f,
0xb4,0x9a,0x38, 0xb8,0x9e,0x3c, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0xcc,0xa5,0x4e, 0xa6,0x8f,0x3c, 0xb2,0x99,0x3f, 0xb4,0x9c,0x48,
0xa8,0x90,0x36, 0x9f,0x88,0x35, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
};

View File

@ -1,38 +1,30 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Thing frame/state LUT,
// generated by multigen utilitiy.
// This one is the original DOOM version, preserved.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: info.c,v 1.3 1997/01/26 07:45:00 b1 Exp $";
#include <stdio.h>
#include <stdlib.h>
// Data.
#include "sounds.h"
#include "m_fixed.h"
#ifdef __GNUG__
#pragma implementation "info.h"
#endif
#include "info.h"
#include "p_mobj.h"
@ -51,7 +43,7 @@ char *sprnames[] = {
"POL3","POL1","POL6","GOR2","GOR3","GOR4","GOR5","SMIT","COL1","COL2",
"COL3","COL4","CAND","CBRA","COL6","TRE1","TRE2","ELEC","CEYE","FSKU",
"COL5","TBLU","TGRN","TRED","SMBT","SMGT","SMRT","HDB1","HDB2","HDB3",
"HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2",NULL,"DUMM"
"HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2", NULL
};

View File

@ -1,25 +1,22 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Thing frame/state LUT,
// generated by multigen utilitiy.
// This one is the original DOOM version, preserved.
//
//-----------------------------------------------------------------------------
#ifndef __INFO__
#define __INFO__
@ -1146,20 +1143,19 @@ typedef enum
typedef struct
{
spritenum_t sprite;
long frame;
long tics;
// void (*action) ();
actionf_t action;
statenum_t nextstate;
long misc1, misc2;
spritenum_t sprite;
int frame;
int tics;
// void (*action) ();
actionf_t action;
statenum_t nextstate;
int misc1;
int misc2;
} state_t;
extern state_t states[NUMSTATES];
extern char *sprnames[];
typedef enum {
MT_PLAYER,
MT_POSSESSED,
@ -1333,8 +1329,3 @@ typedef struct
extern mobjinfo_t mobjinfo[NUMMOBJTYPES];
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,31 +1,31 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_argv.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "doomtype.h"
#include "i_system.h"
#include "m_misc.h"
#include "m_argv.h" // haleyjd 20110212: warning fix
int myargc;
char** myargv;
@ -38,19 +38,228 @@ char** myargv;
// in the program's command line arguments.
// Returns the argument number (1 to argc-1)
// or 0 if not present
int M_CheckParm (char *check)
{
int i;
//
for (i = 1;i<myargc;i++)
int M_CheckParmWithArgs(char *check, int num_args)
{
int i;
for (i = 1; i < myargc - num_args; i++)
{
if ( !strcasecmp(check, myargv[i]) )
if (!strcasecmp(check, myargv[i]))
return i;
}
return 0;
}
//
// M_ParmExists
//
// Returns true if the given parameter exists in the program's command
// line arguments, false if not.
//
boolean M_ParmExists(char *check)
{
return M_CheckParm(check) != 0;
}
int M_CheckParm(char *check)
{
return M_CheckParmWithArgs(check, 0);
}
#define MAXARGVS 100
static void LoadResponseFile(int argv_index)
{
#if ORIGCODE
FILE *handle;
int size;
char *infile;
char *file;
char *response_filename;
char **newargv;
int newargc;
int i, k;
response_filename = myargv[argv_index] + 1;
// Read the response file into memory
handle = fopen(response_filename, "rb");
if (handle == NULL)
{
printf ("\nNo such response file!");
#if ORIGCODE
exit(1);
#endif
}
printf("Found response file %s!\n", response_filename);
size = M_FileLength(handle);
// Read in the entire file
// Allocate one byte extra - this is in case there is an argument
// at the end of the response file, in which case a '\0' will be
// needed.
file = malloc(size + 1);
i = 0;
while (i < size)
{
k = fread(file + i, 1, size - i, handle);
if (k < 0)
{
I_Error("Failed to read full contents of '%s'", response_filename);
}
i += k;
}
fclose(handle);
// Create new arguments list array
newargv = malloc(sizeof(char *) * MAXARGVS);
newargc = 0;
memset(newargv, 0, sizeof(char *) * MAXARGVS);
// Copy all the arguments in the list up to the response file
for (i=0; i<argv_index; ++i)
{
newargv[i] = myargv[i];
++newargc;
}
infile = file;
k = 0;
while(k < size)
{
// Skip past space characters to the next argument
while(k < size && isspace((int)infile[k]))
{
++k;
}
if (k >= size)
{
break;
}
// If the next argument is enclosed in quote marks, treat
// the contents as a single argument. This allows long filenames
// to be specified.
if (infile[k] == '\"')
{
// Skip the first character(")
++k;
newargv[newargc++] = &infile[k];
// Read all characters between quotes
while (k < size && infile[k] != '\"' && infile[k] != '\n')
{
++k;
}
if (k >= size || infile[k] == '\n')
{
I_Error("Quotes unclosed in response file '%s'",
response_filename);
}
// Cut off the string at the closing quote
infile[k] = '\0';
++k;
}
else
{
// Read in the next argument until a space is reached
newargv[newargc++] = &infile[k];
while(k < size && !isspace((int)infile[k]))
{
++k;
}
// Cut off the end of the argument at the first space
infile[k] = '\0';
++k;
}
}
// Add arguments following the response file argument
for (i=argv_index + 1; i<myargc; ++i)
{
newargv[newargc] = myargv[i];
++newargc;
}
myargv = newargv;
myargc = newargc;
#if 0
// Disabled - Vanilla Doom does not do this.
// Display arguments
printf("%d command-line args:\n", myargc);
for (k=1; k<myargc; k++)
{
printf("'%s'\n", myargv[k]);
}
#endif
#endif
}
//
// Find a Response File
//
void M_FindResponseFile(void)
{
int i;
for (i = 1; i < myargc; i++)
{
if (myargv[i][0] == '@')
{
LoadResponseFile(i);
}
}
}
// Return the name of the executable used to start the program:
char *M_GetExecutableName(void)
{
char *sep;
sep = strrchr(myargv[0], DIR_SEPARATOR);
if (sep == NULL)
{
return myargv[0];
}
else
{
return sep + 1;
}
}

View File

@ -1,28 +1,27 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Nil.
//
//-----------------------------------------------------------------------------
#ifndef __M_ARGV__
#define __M_ARGV__
#include "doomtype.h"
//
// MISC
//
@ -33,10 +32,18 @@ extern char** myargv;
// in the arg list (0 if not found).
int M_CheckParm (char* check);
// Same as M_CheckParm, but checks that num_args arguments are available
// following the specified argument.
int M_CheckParmWithArgs(char *check, int num_args);
void M_FindResponseFile(void);
// Parameter has been specified?
boolean M_ParmExists(char *check);
// Get name of executable used to run this program:
char *M_GetExecutableName(void);
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,20 +1,16 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Main loop menu stuff.
@ -22,15 +18,9 @@
// Default Config File.
// PCX Screenshots.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
#ifdef __GNUG__
#pragma implementation "m_bbox.h"
#endif
#include "m_bbox.h"
@ -38,8 +28,8 @@ rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
void M_ClearBox (fixed_t *box)
{
box[BOXTOP] = box[BOXRIGHT] = MININT;
box[BOXBOTTOM] = box[BOXLEFT] = MAXINT;
box[BOXTOP] = box[BOXRIGHT] = INT_MIN;
box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX;
}
void

View File

@ -1,29 +1,26 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Nil.
//
//-----------------------------------------------------------------------------
#ifndef __M_BBOX__
#define __M_BBOX__
#include <values.h>
#include <limits.h>
#include "m_fixed.h"
@ -48,8 +45,3 @@ M_AddToBox
#endif
//-----------------------------------------------------------------------------
//
// $Log:$
//
//-----------------------------------------------------------------------------

View File

@ -1,40 +1,32 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// Copyright (C) 1993-1996 by id Software, Inc.
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Cheat sequence checking.
//
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_cheat.c,v 1.1 1997/02/03 21:24:34 b1 Exp $";
#include <string.h>
#include "doomtype.h"
#include "m_cheat.h"
//
// CHEAT SEQUENCE PACKAGE
//
static int firsttime = 1;
static unsigned char cheat_xlate_table[256];
//
// Called in st_stuff module, which handles the input.
// Returns a 1 if the cheat was successful, 0 if failed.
@ -44,34 +36,46 @@ cht_CheckCheat
( cheatseq_t* cht,
char key )
{
int i;
int rc = 0;
// if we make a short sequence on a cheat with parameters, this
// will not work in vanilla doom. behave the same.
if (firsttime)
if (cht->parameter_chars > 0 && strlen(cht->sequence) < cht->sequence_len)
return false;
if (cht->chars_read < strlen(cht->sequence))
{
firsttime = 0;
for (i=0;i<256;i++) cheat_xlate_table[i] = SCRAMBLE(i);
// still reading characters from the cheat code
// and verifying. reset back to the beginning
// if a key is wrong
if (key == cht->sequence[cht->chars_read])
++cht->chars_read;
else
cht->chars_read = 0;
cht->param_chars_read = 0;
}
else if (cht->param_chars_read < cht->parameter_chars)
{
// we have passed the end of the cheat sequence and are
// entering parameters now
cht->parameter_buf[cht->param_chars_read] = key;
++cht->param_chars_read;
}
if (!cht->p)
cht->p = cht->sequence; // initialize if first time
if (*cht->p == 0)
*(cht->p++) = key;
else if
(cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++;
else
cht->p = cht->sequence;
if (*cht->p == 1)
cht->p++;
else if (*cht->p == 0xff) // end of sequence character
if (cht->chars_read >= strlen(cht->sequence)
&& cht->param_chars_read >= cht->parameter_chars)
{
cht->p = cht->sequence;
rc = 1;
}
cht->chars_read = cht->param_chars_read = 0;
return rc;
return true;
}
// cheat not matched yet
return false;
}
void
@ -79,23 +83,7 @@ cht_GetParam
( cheatseq_t* cht,
char* buffer )
{
unsigned char *p, c;
p = cht->sequence;
while (*(p++) != 1);
do
{
c = *p;
*(buffer++) = c;
*(p++) = 0;
}
while (c && *p!=0xff );
if (*p==0xff)
*buffer = 0;
memcpy(buffer, cht->parameter_buf, cht->parameter_chars);
}

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