├── src ├── Manifest.txt ├── p │ ├── Interceptable.java │ ├── ThinkerStates.java │ ├── RemoveState.java │ ├── sd_e.java │ ├── bwhere_e.java │ ├── result_e.java │ ├── sdt_e.java │ ├── stair_e.java │ ├── slideframe_t.java │ ├── plat_e.java │ ├── Resettable.java │ ├── plattype_e.java │ ├── ISightChecker.java │ ├── ceiling_e.java │ ├── vldoor_e.java │ ├── ThinkerList.java │ ├── DoorDefines.java │ ├── slidedoor_t.java │ ├── DoomPlayer.java │ ├── button_t.java │ ├── anim_t.java │ ├── slidename_t.java │ ├── floor_e.java │ ├── intercept_t.java │ ├── pspdef_t.java │ ├── switchlist_t.java │ ├── ChaseDirections.java │ ├── strobe_t.java │ ├── Actions │ │ └── ActiveStates │ │ │ ├── Monsters.java │ │ │ └── MonsterStates │ │ │ └── Spiders.java │ ├── vldoor_t.java │ ├── floormove_t.java │ └── animdef_t.java ├── rr │ ├── planefunction_t.java │ ├── IDetailAware.java │ ├── drawfuns │ │ ├── SpanFunction.java │ │ ├── ColumnFunction.java │ │ ├── DcFlags.java │ │ ├── SpanVars.java │ │ ├── ColFuncs.java │ │ ├── DoomSpanFunction.java │ │ ├── R_DrawColumnLow.java │ │ └── ColVars.java │ ├── IGetColumn.java │ ├── IGetCachedColumn.java │ ├── BSPVars.java │ ├── parallel │ │ ├── RWI.java │ │ ├── IGetSmpColumn.java │ │ └── RenderSegInstruction.java │ ├── ILimitResettable.java │ ├── cliprange_t.java │ ├── texpatch_t.java │ ├── SimpleThings.java │ ├── SectorAction.java │ ├── z_vertex_t.java │ ├── maskdraw_t.java │ ├── flat_t.java │ ├── IVisSpriteManagement.java │ ├── SegVars.java │ ├── IMaskedDrawer.java │ ├── base_ratio_t.java │ ├── mappatch_t.java │ ├── vertex_t.java │ ├── spritedef_t.java │ ├── subsector_t.java │ ├── vissprite_t.java │ ├── texture_t.java │ ├── spriteframe_t.java │ ├── maptexture_t.java │ ├── ISpriteManager.java │ └── pQuickSprite.java ├── i │ ├── IDrawer.java │ ├── DoomEventInterface.java │ ├── IDiskDrawer.java │ ├── IDoomSystem.java │ ├── DiskDrawer.java │ ├── i_main.c │ ├── i_net.h │ ├── Strings.java │ ├── i_video.h │ └── DummySystem.java ├── n │ ├── IDoomNet.java │ ├── DummyNetworkHandler.java │ ├── DummyNetworkDriver.java │ └── DoomSystemNetworking.java ├── automap │ ├── islope_t.java │ ├── fpoint_t.java │ ├── mpoint_t.java │ ├── fline_t.java │ ├── mline_t.java │ └── IAutoMap.java ├── st │ ├── st_chatstateenum_t.java │ ├── st_stateenum_t.java │ ├── st_enumstatcodes_t.java │ └── AbstractStatusBar.java ├── w │ ├── IReadWriteDoomObject.java │ ├── animenum_t.java │ ├── IPackableDoomObject.java │ ├── IWritableDoomObject.java │ ├── li_namespace.java │ ├── statenum_t.java │ ├── AidedReadableDoomObject.java │ ├── IReadableDoomObject.java │ ├── wad_source_t.java │ ├── wadinfo_t.java │ ├── wadfile_info_t.java │ ├── CacheableDoomObjectContainer.java │ ├── wadheader_t.java │ ├── JadDecompress.java │ ├── lumpinfo_t.java │ └── filelump_t.java ├── defines │ ├── skill_t.java │ ├── Language_t.java │ ├── slopetype_t.java │ ├── card_t.java │ ├── GameMission_t.java │ ├── gamestate_t.java │ └── ammotype_t.java ├── s │ ├── ISoundOrigin.java │ ├── AudioChunk.java │ ├── channel_t.java │ ├── degenmobj_t.java │ ├── DMXSound.java │ ├── DummyMusic.java │ ├── IMusic.java │ ├── DummySFX.java │ └── DoomSound.java ├── pooling │ ├── RoguePatchMap.java │ ├── AudioChunkPool.java │ ├── ObjectQueuePool.java │ ├── RoguePatchMap2.java │ └── GenericIntMap.java ├── f │ ├── point_t.java │ ├── castinfo_t.java │ └── Wiper.java ├── savegame │ ├── ILoadSaveGame.java │ ├── IDoomSaveGame.java │ └── IDoomSaveGameHeader.java ├── m │ ├── ISyncLogger.java │ ├── AbstractDoomMenu.java │ ├── DrawRoutine.java │ ├── MenuRoutine.java │ ├── IRandom.java │ ├── default_t.java │ ├── menuitem_t.java │ ├── menu_t.java │ └── DummyMenu.java ├── doom │ ├── playerstate_t.java │ ├── evtype_t.java │ ├── pic_t.java │ ├── gameaction_t.java │ ├── th_class.java │ ├── IDoom.java │ ├── weapontype_t.java │ ├── NetConsts.java │ ├── KeyboardManager.java │ ├── IDoomGameNetworking.java │ ├── IDoomGame.java │ ├── wbplayerstruct_t.java │ ├── weaponinfo_t.java │ ├── DoomContext.java │ ├── wbstartstruct_t.java │ ├── IDatagramSerializable.java │ └── doomcom_t.java ├── timing │ ├── FastTicker.java │ ├── ITicker.java │ ├── MilliTicker.java │ ├── NanoTicker.java │ └── DelegateTicker.java ├── boom │ ├── prboom_comp_t.java │ ├── mapsubsector_znod_t.java │ ├── mapglvertex_t.java │ ├── mapsubsector_v4_t.java │ ├── mapseg_znod_t.java │ ├── mapseg_v4_t.java │ ├── ZNodeSegs.java │ ├── DeepBSPNodesV4.java │ ├── mapnode_znod_t.java │ └── mapnode_v4_t.java ├── hu │ └── IHeadsUp.java ├── data │ ├── musicinfo_t.java │ ├── mapsubsector_t.java │ ├── mapvertex_t.java │ ├── maplinedef_t.java │ ├── mapsector_t.java │ ├── mapsidedef_t.java │ ├── mapseg_t.java │ ├── mapnode_t.java │ ├── doomtype.java │ └── mapthing_t.java ├── demo │ ├── IDemoTicCmd.java │ └── IDoomDemo.java ├── utils │ ├── OSValidator.java │ └── QuoteType.java ├── v │ ├── graphics │ │ ├── Horizontal.java │ │ ├── Relocation.java │ │ └── Points.java │ ├── renderers │ │ └── DoomScreen.java │ └── scale │ │ └── VideoScale.java ├── g │ └── g_game.h └── awt │ └── MsgBox.java ├── colors12.lmp ├── colors15.lmp ├── tranmap.dat ├── demos ├── crap.lmp ├── first.lmp ├── stuff.lmp ├── e1nm0646.lmp └── nuts.wad.lmp ├── pwads ├── easy.wad ├── grid.wad ├── web.wad ├── ABBEY.WAD ├── ZARNEK.WAD ├── cross.wad ├── easy2.wad ├── frugal.wad ├── masked.wad ├── orbit.wad ├── penta.wad ├── piano.wad ├── sprites.wad ├── swdoor.wad ├── test272.wad ├── trigon.wad ├── weird.wad ├── onesquare.wad ├── test272.wad.zip └── lotsofmonsters.wad ├── mm2-mochadoom.7z ├── DMUtils ├── PLAYPAL.lmp ├── colormap.lmp ├── colors12.lmp ├── colors15.lmp ├── playpal1.lmp ├── .classpath ├── .project └── .settings │ └── org.eclipse.jdt.core.prefs ├── .gitignore ├── default.cfg ├── CHANGES.TXT └── README.md /src/Manifest.txt: -------------------------------------------------------------------------------- 1 | Main-Class: mochadoom/Engine 2 | -------------------------------------------------------------------------------- /colors12.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/colors12.lmp -------------------------------------------------------------------------------- /colors15.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/colors15.lmp -------------------------------------------------------------------------------- /tranmap.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/tranmap.dat -------------------------------------------------------------------------------- /demos/crap.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/demos/crap.lmp -------------------------------------------------------------------------------- /pwads/easy.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/easy.wad -------------------------------------------------------------------------------- /pwads/grid.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/grid.wad -------------------------------------------------------------------------------- /pwads/web.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/web.wad -------------------------------------------------------------------------------- /demos/first.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/demos/first.lmp -------------------------------------------------------------------------------- /demos/stuff.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/demos/stuff.lmp -------------------------------------------------------------------------------- /mm2-mochadoom.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/mm2-mochadoom.7z -------------------------------------------------------------------------------- /pwads/ABBEY.WAD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/ABBEY.WAD -------------------------------------------------------------------------------- /pwads/ZARNEK.WAD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/ZARNEK.WAD -------------------------------------------------------------------------------- /pwads/cross.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/cross.wad -------------------------------------------------------------------------------- /pwads/easy2.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/easy2.wad -------------------------------------------------------------------------------- /pwads/frugal.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/frugal.wad -------------------------------------------------------------------------------- /pwads/masked.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/masked.wad -------------------------------------------------------------------------------- /pwads/orbit.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/orbit.wad -------------------------------------------------------------------------------- /pwads/penta.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/penta.wad -------------------------------------------------------------------------------- /pwads/piano.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/piano.wad -------------------------------------------------------------------------------- /pwads/sprites.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/sprites.wad -------------------------------------------------------------------------------- /pwads/swdoor.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/swdoor.wad -------------------------------------------------------------------------------- /pwads/test272.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/test272.wad -------------------------------------------------------------------------------- /pwads/trigon.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/trigon.wad -------------------------------------------------------------------------------- /pwads/weird.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/weird.wad -------------------------------------------------------------------------------- /DMUtils/PLAYPAL.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/DMUtils/PLAYPAL.lmp -------------------------------------------------------------------------------- /demos/e1nm0646.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/demos/e1nm0646.lmp -------------------------------------------------------------------------------- /demos/nuts.wad.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/demos/nuts.wad.lmp -------------------------------------------------------------------------------- /pwads/onesquare.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/onesquare.wad -------------------------------------------------------------------------------- /src/p/Interceptable.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public interface Interceptable { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /DMUtils/colormap.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/DMUtils/colormap.lmp -------------------------------------------------------------------------------- /DMUtils/colors12.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/DMUtils/colors12.lmp -------------------------------------------------------------------------------- /DMUtils/colors15.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/DMUtils/colors15.lmp -------------------------------------------------------------------------------- /DMUtils/playpal1.lmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/DMUtils/playpal1.lmp -------------------------------------------------------------------------------- /pwads/test272.wad.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/test272.wad.zip -------------------------------------------------------------------------------- /src/rr/planefunction_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | public interface planefunction_t { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /pwads/lotsofmonsters.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AXDOOMER/mochadoom/HEAD/pwads/lotsofmonsters.wad -------------------------------------------------------------------------------- /src/p/ThinkerStates.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public interface ThinkerStates { 4 | int ordinal(); 5 | } -------------------------------------------------------------------------------- /src/i/IDrawer.java: -------------------------------------------------------------------------------- 1 | package i; 2 | 3 | public interface IDrawer { 4 | 5 | public void Drawer(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/n/IDoomNet.java: -------------------------------------------------------------------------------- 1 | package n; 2 | 3 | public interface IDoomNet { 4 | public void NetUpdate(); 5 | } 6 | -------------------------------------------------------------------------------- /src/p/RemoveState.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public enum RemoveState implements ThinkerStates { 4 | REMOVE; 5 | } -------------------------------------------------------------------------------- /src/p/sd_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public enum sd_e { 4 | sd_opening, 5 | sd_waiting, 6 | sd_closing 7 | } -------------------------------------------------------------------------------- /src/p/bwhere_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public enum bwhere_e { 4 | top, 5 | middle, 6 | bottom 7 | } -------------------------------------------------------------------------------- /src/p/result_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public enum result_e { 4 | ok, 5 | crushed, 6 | pastdest 7 | } 8 | -------------------------------------------------------------------------------- /src/automap/islope_t.java: -------------------------------------------------------------------------------- 1 | package automap; 2 | 3 | public class islope_t 4 | { 5 | /** fixed_t */ 6 | int slp, islp; 7 | } 8 | -------------------------------------------------------------------------------- /src/p/sdt_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public enum sdt_e { 4 | sdt_openOnly, 5 | sdt_closeOnly, 6 | sdt_openAndClose 7 | } -------------------------------------------------------------------------------- /src/p/stair_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public enum stair_e 4 | { 5 | build8, // slowly build by 8 6 | turbo16 // quickly build by 16 7 | } -------------------------------------------------------------------------------- /src/st/st_chatstateenum_t.java: -------------------------------------------------------------------------------- 1 | package st; 2 | 3 | enum st_chatstateenum_t { 4 | StartChatState, 5 | WaitDestState, 6 | GetChatState 7 | } 8 | -------------------------------------------------------------------------------- /src/w/IReadWriteDoomObject.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | public interface IReadWriteDoomObject extends IReadableDoomObject, IWritableDoomObject{ 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/w/animenum_t.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | public enum animenum_t { 4 | 5 | ANIM_ALWAYS, 6 | ANIM_RANDOM, 7 | ANIM_LEVEL 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/p/slideframe_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public class slideframe_t { 4 | public int[] frontFrames = new int[4]; 5 | public int[] backFrames = new int[4]; 6 | } -------------------------------------------------------------------------------- /src/defines/skill_t.java: -------------------------------------------------------------------------------- 1 | package defines; 2 | 3 | 4 | public enum skill_t 5 | { 6 | sk_baby, 7 | sk_easy, 8 | sk_medium, 9 | sk_hard, 10 | sk_nightmare 11 | } 12 | -------------------------------------------------------------------------------- /src/p/plat_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | // 4 | // P_PLATS 5 | // 6 | 7 | public enum plat_e { 8 | up, 9 | down, 10 | waiting, 11 | in_stasis 12 | } 13 | -------------------------------------------------------------------------------- /src/st/st_stateenum_t.java: -------------------------------------------------------------------------------- 1 | package st; 2 | 3 | //States for status bar code. 4 | 5 | public enum st_stateenum_t { 6 | 7 | 8 | AutomapState, 9 | FirstPersonState 10 | 11 | } -------------------------------------------------------------------------------- /src/p/Resettable.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | /** For objects that needed to be memset to 0 in C, 4 | * rather than being reallocated. */ 5 | 6 | public interface Resettable { 7 | public void reset(); 8 | } 9 | -------------------------------------------------------------------------------- /src/rr/IDetailAware.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | public interface IDetailAware { 4 | 5 | public static int HIGH_DETAIL=0; 6 | public static int LOW_DETAIL=1; 7 | void setDetail(int detailshift); 8 | } 9 | -------------------------------------------------------------------------------- /src/st/st_enumstatcodes_t.java: -------------------------------------------------------------------------------- 1 | package st; 2 | 3 | // States for the chat code. 4 | 5 | enum st_enumstatcodes_t { 6 | 7 | StartChatState, 8 | WaitDestState, 9 | GetChatState 10 | 11 | } -------------------------------------------------------------------------------- /src/s/ISoundOrigin.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | /** Use this instead of that degemobj_t crud */ 4 | 5 | public interface ISoundOrigin { 6 | public int getX(); 7 | public int getY(); 8 | public int getZ(); 9 | } 10 | -------------------------------------------------------------------------------- /src/defines/Language_t.java: -------------------------------------------------------------------------------- 1 | package defines; 2 | 3 | /** Identify language to use, software localization. */ 4 | public enum Language_t { 5 | english, 6 | french, 7 | german, 8 | unknown 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/defines/slopetype_t.java: -------------------------------------------------------------------------------- 1 | package defines; 2 | 3 | /** Move clipping aid for LineDefs. */ 4 | 5 | public enum slopetype_t 6 | { 7 | ST_HORIZONTAL, 8 | ST_VERTICAL, 9 | ST_POSITIVE, 10 | ST_NEGATIVE 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/w/IPackableDoomObject.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | 6 | public interface IPackableDoomObject { 7 | public void pack(ByteBuffer buf) throws IOException ; 8 | } 9 | -------------------------------------------------------------------------------- /src/p/plattype_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public enum plattype_e { 4 | perpetualRaise, 5 | downWaitUpStay, 6 | raiseAndChange, 7 | raiseToNearestAndChange, 8 | blazeDWUS 9 | 10 | } -------------------------------------------------------------------------------- /src/pooling/RoguePatchMap.java: -------------------------------------------------------------------------------- 1 | package pooling; 2 | 3 | public class RoguePatchMap extends GenericIntMap { 4 | 5 | public RoguePatchMap(){ 6 | super(); 7 | patches = new byte[DEFAULT_CAPACITY][][]; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/f/point_t.java: -------------------------------------------------------------------------------- 1 | package f; 2 | 3 | public class point_t { 4 | public point_t(int x, int y) { 5 | this.x=x; 6 | this.y=y; 7 | } 8 | public int x; 9 | public int y; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/savegame/ILoadSaveGame.java: -------------------------------------------------------------------------------- 1 | package savegame; 2 | 3 | import p.ThinkerList; 4 | 5 | public interface ILoadSaveGame { 6 | void setThinkerList(ThinkerList li); 7 | void doSave(ThinkerList li); 8 | void doLoad(ThinkerList li); 9 | } 10 | -------------------------------------------------------------------------------- /src/w/IWritableDoomObject.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.DataOutputStream; 4 | import java.io.IOException; 5 | 6 | public interface IWritableDoomObject { 7 | 8 | public void write(DataOutputStream dos) throws IOException ; 9 | } 10 | -------------------------------------------------------------------------------- /src/defines/card_t.java: -------------------------------------------------------------------------------- 1 | package defines; 2 | 3 | /** 4 | * Key cards. 5 | */ 6 | public enum card_t 7 | { 8 | it_bluecard, 9 | it_yellowcard, 10 | it_redcard, 11 | it_blueskull, 12 | it_yellowskull, 13 | it_redskull, 14 | 15 | NUMCARDS 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/m/ISyncLogger.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | import java.io.IOException; 4 | 5 | public interface ISyncLogger { 6 | 7 | public void debugStart() throws IOException; 8 | public void debugEnd(); 9 | public void sync(String format, Object ... args); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/p/ISightChecker.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public interface ISightChecker { 4 | 5 | public void setZStartTopBOttom(int zstart, int top, int bottom); 6 | public void setSTrace(mobj_t t1, mobj_t t2); 7 | public boolean CrossBSPNode(int bspnum); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/p/ceiling_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | // 4 | // P_CEILNG 5 | // 6 | 7 | public enum ceiling_e { 8 | 9 | lowerToFloor, 10 | raiseToHighest, 11 | lowerAndCrush, 12 | crushAndRaise, 13 | fastCrushAndRaise, 14 | silentCrushAndRaise; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/rr/drawfuns/SpanFunction.java: -------------------------------------------------------------------------------- 1 | package rr.drawfuns; 2 | 3 | /** Either draws a column or a span 4 | * 5 | * @author velktron 6 | * 7 | */ 8 | 9 | public interface SpanFunction { 10 | public void invoke(); 11 | 12 | public void invoke(SpanVars dsvars); 13 | 14 | } -------------------------------------------------------------------------------- /src/automap/fpoint_t.java: -------------------------------------------------------------------------------- 1 | package automap; 2 | 3 | public class fpoint_t 4 | { 5 | int x, y; 6 | 7 | public fpoint_t(){ 8 | this(0,0); 9 | } 10 | 11 | public fpoint_t(int x, int y){ 12 | this.x=x; 13 | this.y=y; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/rr/IGetColumn.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** An interface used to ease the use of the GetCachedColumn by part 4 | * of parallelized renderers. 5 | * 6 | * @author Maes 7 | * 8 | */ 9 | 10 | public interface IGetColumn { 11 | 12 | T GetColumn(int tex, int col); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/st/AbstractStatusBar.java: -------------------------------------------------------------------------------- 1 | package st; 2 | 3 | import doom.DoomMain; 4 | 5 | public abstract class AbstractStatusBar implements IDoomStatusBar { 6 | protected final DoomMain DOOM; 7 | 8 | public AbstractStatusBar(DoomMain DOOM) { 9 | this.DOOM = DOOM; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/defines/GameMission_t.java: -------------------------------------------------------------------------------- 1 | package defines; 2 | 3 | /** Mission packs - might be useful for TC stuff? 4 | * 5 | */ 6 | public enum GameMission_t 7 | { 8 | doom, // DOOM 1 9 | doom2, // DOOM 2 10 | pack_tnt, // TNT mission pack 11 | pack_plut, // Plutonia pack 12 | none 13 | } 14 | -------------------------------------------------------------------------------- /src/rr/IGetCachedColumn.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** An interface used to ease the use of the GetCachedColumn by part 4 | * of parallelized renderers. 5 | * 6 | * @author Maes 7 | * 8 | */ 9 | 10 | public interface IGetCachedColumn { 11 | 12 | T GetCachedColumn(int tex, int col); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/doom/playerstate_t.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | // Player states. 4 | // 5 | public enum playerstate_t 6 | { 7 | // Playing or camping. 8 | PST_LIVE, 9 | // Dead on the ground, view follows killer. 10 | PST_DEAD, 11 | // Ready to restart/respawn??? 12 | PST_REBORN 13 | 14 | }; -------------------------------------------------------------------------------- /DMUtils/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/timing/FastTicker.java: -------------------------------------------------------------------------------- 1 | package timing; 2 | 3 | public class FastTicker implements ITicker { 4 | 5 | /** 6 | * I_GetTime 7 | * returns time in 1/70th second tics 8 | */ 9 | @Override 10 | public int GetTime() { 11 | return fasttic++; 12 | } 13 | 14 | protected volatile int fasttic = 0; 15 | } -------------------------------------------------------------------------------- /src/p/vldoor_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | // 4 | // P_DOORS 5 | // 6 | 7 | public enum vldoor_e { 8 | normal, 9 | close30ThenOpen, 10 | close, 11 | open, 12 | raiseIn5Mins, 13 | blazeRaise, 14 | blazeOpen, 15 | blazeClose; 16 | 17 | public static final int VALUES=vldoor_e.values().length; 18 | } -------------------------------------------------------------------------------- /src/rr/BSPVars.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | 4 | /** Stuff used to pass information between the BSP and the SegDrawer */ 5 | 6 | public class BSPVars{ 7 | /** The sectors of the line currently being considered */ 8 | public sector_t frontsector, backsector; 9 | public seg_t curline; 10 | public side_t sidedef; 11 | public line_t linedef; 12 | } 13 | -------------------------------------------------------------------------------- /src/m/AbstractDoomMenu.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | import doom.DoomMain; 4 | 5 | public abstract class AbstractDoomMenu implements IDoomMenu { 6 | 7 | ////////////////////// CONTEXT /////////////////// 8 | 9 | final DoomMain DOOM; 10 | 11 | public AbstractDoomMenu(DoomMain DOOM) { 12 | this.DOOM = DOOM; 13 | } 14 | } -------------------------------------------------------------------------------- /src/m/DrawRoutine.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | /** menu_t required a function pointer to a (routine)() that drew stuff. 4 | * So any class implementing them will implement this interface, and 5 | * we can have a single class type for all of them. 6 | * 7 | * @author Maes 8 | * 9 | */ 10 | public interface DrawRoutine { 11 | 12 | public void invoke(); 13 | } 14 | -------------------------------------------------------------------------------- /src/doom/evtype_t.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | /** The possible events according to Doom */ 4 | 5 | public enum evtype_t { 6 | ev_null, 7 | ev_keydown, 8 | ev_keyup, 9 | ev_mouse, 10 | ev_joystick, 11 | ev_mousewheel, // extension 12 | ev_clear // Forcibly clear all button input (e.g. when losing focus) 13 | }; 14 | -------------------------------------------------------------------------------- /src/m/MenuRoutine.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | /** menuitem_t required a function pointer to a (routine)(int choice) 4 | * So any class implementing them will implement this interface, and 5 | * we can have a single class type for all of them. 6 | * 7 | * @author Velktron 8 | * 9 | */ 10 | public interface MenuRoutine { 11 | public void invoke(int choice); 12 | } 13 | -------------------------------------------------------------------------------- /src/defines/gamestate_t.java: -------------------------------------------------------------------------------- 1 | package defines; 2 | 3 | /** The current state of the game: whether we are 4 | playing, gazing at the intermission screen, 5 | the game final animation, or a demo. */ 6 | public enum gamestate_t 7 | { 8 | GS_LEVEL, 9 | GS_INTERMISSION, 10 | GS_FINALE, 11 | GS_DEMOSCREEN, 12 | GS_MINUS_ONE // hack used for the "-1" state 13 | } 14 | -------------------------------------------------------------------------------- /src/w/li_namespace.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | /** killough 4/17/98: namespace tags, to prevent conflicts between resources */ 4 | 5 | public enum li_namespace { 6 | ns_global, 7 | ns_sprites, 8 | ns_flats, 9 | ns_colormaps, 10 | ns_prboom, 11 | ns_demos, 12 | ns_hires //e6y 13 | } // haleyjd 05/21/02: renamed from "namespace" 14 | 15 | -------------------------------------------------------------------------------- /src/rr/parallel/RWI.java: -------------------------------------------------------------------------------- 1 | package rr.parallel; 2 | 3 | import rr.drawfuns.ColVars; 4 | 5 | public interface RWI { 6 | public interface Init{ 7 | RenderWallExecutor[] InitRWIExecutors(int num,ColVars[] RWI); 8 | } 9 | 10 | public interface Get{ 11 | ColVars[] getRWI(); 12 | void setExecutors(RenderWallExecutor[] RWIExec); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/defines/ammotype_t.java: -------------------------------------------------------------------------------- 1 | package defines; 2 | 3 | //Ammunition types defined. 4 | public enum ammotype_t 5 | { 6 | am_clip, // Pistol / chaingun ammo. 7 | am_shell, // Shotgun / double barreled shotgun. 8 | am_cell, // Plasma rifle, BFG. 9 | am_misl, // Missile launcher. 10 | NUMAMMO, 11 | am_noammo // Unlimited for chainsaw / fist. 12 | 13 | } -------------------------------------------------------------------------------- /src/doom/pic_t.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | public class pic_t { 4 | 5 | public pic_t(byte width, byte height, byte data) { 6 | super(); 7 | this.width = width; 8 | this.height = height; 9 | this.data = data; 10 | } 11 | 12 | public byte width; 13 | public byte height; 14 | public byte data; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/rr/ILimitResettable.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** Resets limit-removing stuff back to their initial values, 4 | * either for initialization reasons or to regain memory 5 | * e.g. playing MAP02 after nuts.wad should free up some vissprite buffers. 6 | * 7 | * @author admin 8 | * 9 | */ 10 | 11 | public interface ILimitResettable { 12 | public void resetLimits(); 13 | } 14 | -------------------------------------------------------------------------------- /src/rr/drawfuns/ColumnFunction.java: -------------------------------------------------------------------------------- 1 | package rr.drawfuns; 2 | 3 | /** Either draws a column or a span 4 | * 5 | * @author velktron 6 | * 7 | */ 8 | 9 | public interface ColumnFunction { 10 | public void invoke(); 11 | 12 | public void invoke(ColVars dcvars); 13 | 14 | /** A set of flags that help identifying the type of function */ 15 | public int getFlags(); 16 | } -------------------------------------------------------------------------------- /src/doom/gameaction_t.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | public enum gameaction_t { 4 | ga_nothing, 5 | ga_loadlevel, 6 | ga_newgame, 7 | ga_loadgame, 8 | ga_savegame, 9 | ga_playdemo, 10 | ga_completed, 11 | ga_victory, 12 | ga_worlddone, 13 | ga_screenshot, 14 | ga_failure // HACK: communicate failures silently 15 | } 16 | -------------------------------------------------------------------------------- /src/w/statenum_t.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | public enum statenum_t { 4 | 5 | NoState(-1), 6 | StatCount(0), 7 | ShowNextLoc(1); 8 | 9 | private int value; 10 | 11 | private statenum_t(int val){ 12 | this.value=val; 13 | } 14 | 15 | public int getValue() { 16 | return value; 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/f/castinfo_t.java: -------------------------------------------------------------------------------- 1 | package f; 2 | 3 | import data.mobjtype_t; 4 | 5 | /** 6 | * Final DOOM 2 animation Casting by id Software. in order of appearance 7 | */ 8 | 9 | public class castinfo_t { 10 | String name; 11 | mobjtype_t type; 12 | 13 | public castinfo_t() { 14 | 15 | } 16 | 17 | public castinfo_t(String name, mobjtype_t type) { 18 | this.name = name; 19 | this.type = type; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/savegame/IDoomSaveGame.java: -------------------------------------------------------------------------------- 1 | package savegame; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.DataOutputStream; 5 | import p.ThinkerList; 6 | 7 | public interface IDoomSaveGame { 8 | void setThinkerList(ThinkerList li); 9 | boolean doLoad(DataInputStream f); 10 | IDoomSaveGameHeader getHeader(); 11 | void setHeader(IDoomSaveGameHeader header); 12 | boolean doSave(DataOutputStream f); 13 | } 14 | -------------------------------------------------------------------------------- /src/w/AidedReadableDoomObject.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | /** This is for objects that can be read from disk, but cannot 7 | * self-determine their own length for some reason. 8 | * 9 | * @author Maes 10 | * 11 | */ 12 | 13 | public interface AidedReadableDoomObject { 14 | 15 | public void read(DataInputStream f, int len) throws IOException ; 16 | } 17 | -------------------------------------------------------------------------------- /src/rr/drawfuns/DcFlags.java: -------------------------------------------------------------------------------- 1 | package rr.drawfuns; 2 | 3 | /** Flags used to mark column functions according to type, 4 | * for quick type identification. 5 | * 6 | * @author velktron 7 | * 8 | */ 9 | 10 | public final class DcFlags { 11 | public static final int FUZZY=0x1; 12 | public static final int TRANSLATED=0x2; 13 | public static final int TRANSPARENT=0x4; 14 | public static final int LOW_DETAIL=0x8; 15 | } 16 | -------------------------------------------------------------------------------- /src/boom/prboom_comp_t.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | public class prboom_comp_t { 4 | 5 | public prboom_comp_t(int minver, int maxver, boolean state, String cmd) { 6 | this.minver = minver; 7 | this.maxver = maxver; 8 | this.state = state; 9 | this.cmd = cmd; 10 | } 11 | 12 | public int minver; 13 | 14 | public int maxver; 15 | 16 | public boolean state; 17 | 18 | public String cmd; 19 | } -------------------------------------------------------------------------------- /DMUtils/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | DMUtils 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/rr/drawfuns/SpanVars.java: -------------------------------------------------------------------------------- 1 | package rr.drawfuns; 2 | 3 | public class SpanVars { 4 | 5 | public int ds_xfrac; 6 | public int ds_yfrac; 7 | public int ds_xstep; 8 | public T ds_source; 9 | 10 | /** DrawSpan colormap. */ 11 | public V ds_colormap; 12 | public int ds_y; 13 | public int ds_x2; 14 | public int ds_x1; 15 | public int ds_ystep; 16 | 17 | public DoomSpanFunction spanfunc; 18 | } 19 | -------------------------------------------------------------------------------- /src/rr/cliprange_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | public class cliprange_t { 4 | 5 | public cliprange_t(int first, int last) { 6 | this.first = first; 7 | this.last = last; 8 | } 9 | 10 | public cliprange_t(){ 11 | 12 | } 13 | 14 | public int first; 15 | public int last; 16 | 17 | public void copy(cliprange_t from){ 18 | this.first=from.first; 19 | this.last=from.last; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/doom/th_class.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | /** killough 8/29/98: threads of thinkers, for more efficient searches 4 | * cph 2002/01/13: for consistency with the main thinker list, keep objects 5 | * pending deletion on a class list too 6 | */ 7 | 8 | 9 | public enum th_class { 10 | th_delete, 11 | th_misc, 12 | th_friends, 13 | th_enemies, 14 | th_all; 15 | 16 | public static final int NUMTHCLASS=th_class.values().length; 17 | } 18 | -------------------------------------------------------------------------------- /src/m/IRandom.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | import data.mobjtype_t; 4 | import p.ActiveStates; 5 | 6 | public interface IRandom { 7 | public int P_Random (); 8 | public int M_Random (); 9 | public void ClearRandom (); 10 | public int getIndex(); 11 | public int P_Random(int caller); 12 | public int P_Random(String message); 13 | public int P_Random(ActiveStates caller, int sequence); 14 | public int P_Random(ActiveStates caller, mobjtype_t type,int sequence); 15 | } 16 | -------------------------------------------------------------------------------- /src/i/DoomEventInterface.java: -------------------------------------------------------------------------------- 1 | package i; 2 | 3 | /** Interface for Doom-to-System event handling methods 4 | * 5 | * @author Velktron 6 | * 7 | */ 8 | 9 | 10 | public interface DoomEventInterface { 11 | 12 | /** The implementation is windowing subsystem-specific 13 | * e.g. DOS, XServer, AWT or Swing or whatever. 14 | * 15 | */ 16 | public void GetEvent(); 17 | 18 | public boolean mouseMoving(); 19 | 20 | public void setMouseMoving(boolean mousMoving); 21 | } 22 | -------------------------------------------------------------------------------- /src/s/AudioChunk.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | public class AudioChunk{ 4 | public AudioChunk() { 5 | buffer=new byte[s.ISoundDriver.MIXBUFFERSIZE]; 6 | setStuff(0,0); 7 | this.free=true; 8 | } 9 | 10 | public void setStuff(int chunk, int time){ 11 | this.chunk = chunk; 12 | this.time = time; 13 | } 14 | 15 | public int chunk; 16 | public int time; 17 | public byte[] buffer; 18 | public boolean free; 19 | 20 | 21 | } -------------------------------------------------------------------------------- /src/doom/IDoom.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | import java.io.IOException; 4 | 5 | /** Stuff that the "main" is supposed to do. DoomMain implements those. 6 | * 7 | * @author Maes 8 | * 9 | */ 10 | 11 | 12 | public interface IDoom { 13 | 14 | 15 | /** Called by IO functions when input is detected. */ 16 | void PostEvent (event_t ev); 17 | void PageTicker (); 18 | void PageDrawer (); 19 | void AdvanceDemo (); 20 | void StartTitle (); 21 | void QuitNetGame() throws IOException; 22 | 23 | } -------------------------------------------------------------------------------- /src/p/ThinkerList.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import doom.SourceCode.P_Tick; 4 | import static doom.SourceCode.P_Tick.*; 5 | import doom.thinker_t; 6 | 7 | public interface ThinkerList { 8 | 9 | @P_Tick.C(P_AddThinker) 10 | void AddThinker(thinker_t thinker); 11 | @P_Tick.C(P_RemoveThinker) 12 | void RemoveThinker(thinker_t thinker); 13 | @P_Tick.C(P_InitThinkers) 14 | void InitThinkers(); 15 | 16 | thinker_t getRandomThinker(); 17 | thinker_t getThinkerCap(); 18 | } 19 | -------------------------------------------------------------------------------- /src/rr/drawfuns/ColFuncs.java: -------------------------------------------------------------------------------- 1 | package rr.drawfuns; 2 | 3 | public class ColFuncs { 4 | 5 | public DoomColumnFunction main; 6 | 7 | public DoomColumnFunction base; 8 | 9 | public DoomColumnFunction masked; 10 | 11 | public DoomColumnFunction fuzz; 12 | 13 | public DoomColumnFunction trans; 14 | 15 | public DoomColumnFunction glass; 16 | 17 | public DoomColumnFunction player; 18 | 19 | public DoomColumnFunction sky; 20 | } 21 | -------------------------------------------------------------------------------- /src/p/DoorDefines.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import static m.fixed_t.MAPFRACUNIT; 4 | 5 | public final class DoorDefines { 6 | 7 | // Doors 8 | public static final int VDOORSPEED = MAPFRACUNIT * 2; 9 | public static final int VDOORWAIT = 150; 10 | 11 | 12 | // Lights 13 | public static final int GLOWSPEED = 5; 14 | 15 | public static final int STROBEBRIGHT = 5; 16 | 17 | public static final int FASTDARK = 15; 18 | 19 | public static final int SLOWDARK = 35; 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/m/default_t.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | public class default_t { 4 | 5 | public default_t(String name, int[] location, int defaultvalue) { 6 | this.name = name; 7 | this.location = location; 8 | this.defaultvalue = defaultvalue; 9 | } 10 | 11 | public String name; 12 | 13 | /** this is supposed to be a pointer */ 14 | public int[] location; 15 | 16 | public int defaultvalue; 17 | 18 | int scantranslate; // PC scan code hack 19 | 20 | int untranslated; // lousy hack 21 | }; 22 | -------------------------------------------------------------------------------- /src/w/IReadableDoomObject.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | /** This is an interface implemented by objects that must be read form disk. 7 | * Every object is supposed to do its own umarshalling. This way, 8 | * structured and hierchical reads are possible. Another superior innovation 9 | * of Mocha Doom ;-) Err....ok :-p 10 | * 11 | * @author Velktron 12 | * 13 | */ 14 | 15 | public interface IReadableDoomObject { 16 | 17 | public void read(DataInputStream f) throws IOException ; 18 | } 19 | -------------------------------------------------------------------------------- /src/doom/weapontype_t.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | /** The defined weapons, 4 | * including a marker indicating 5 | * user has not changed weapon. 6 | */ 7 | public enum weapontype_t 8 | { 9 | wp_fist, 10 | wp_pistol, 11 | wp_shotgun, 12 | wp_chaingun, 13 | wp_missile, 14 | wp_plasma, 15 | wp_bfg, 16 | wp_chainsaw, 17 | wp_supershotgun, 18 | 19 | NUMWEAPONS, 20 | 21 | // No pending weapon change. 22 | wp_nochange; 23 | 24 | public String toString(){ 25 | return this.name(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/hu/IHeadsUp.java: -------------------------------------------------------------------------------- 1 | package hu; 2 | 3 | import doom.SourceCode.HU_Stuff; 4 | import static doom.SourceCode.HU_Stuff.HU_Responder; 5 | import doom.event_t; 6 | import rr.patch_t; 7 | 8 | public interface IHeadsUp { 9 | 10 | void Ticker(); 11 | 12 | void Erase(); 13 | 14 | void Drawer(); 15 | 16 | @HU_Stuff.C(HU_Responder) 17 | boolean Responder(event_t ev); 18 | 19 | patch_t[] getHUFonts(); 20 | 21 | char dequeueChatChar(); 22 | 23 | void Init(); 24 | 25 | void setChatMacro(int i, String s); 26 | 27 | void Start(); 28 | 29 | void Stop(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/rr/texpatch_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** 4 | * A single patch from a texture definition, 5 | * basically a rectangular area within 6 | * the texture rectangle. 7 | * @author admin 8 | * 9 | */ 10 | public class texpatch_t { 11 | // Block origin (allways UL), 12 | // which has allready accounted 13 | // for the internal origin of the patch. 14 | int originx; 15 | int originy; 16 | int patch; 17 | 18 | public void copyFromMapPatch(mappatch_t mpp) { 19 | this.originx=mpp.originx; 20 | this.originy=mpp.originy; 21 | this.patch=mpp.patch; 22 | } 23 | } -------------------------------------------------------------------------------- /src/rr/SimpleThings.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import v.scale.VideoScale; 4 | 5 | /** 6 | * A very "simple" things class which just does serial rendering and uses all 7 | * the base methods from AbstractThings. 8 | * 9 | * @author velktron 10 | * @param 11 | * @param 12 | */ 13 | 14 | 15 | public final class SimpleThings extends AbstractThings { 16 | 17 | public SimpleThings(VideoScale vs, SceneRenderer R) { 18 | super(vs, R); 19 | } 20 | 21 | @Override 22 | public void completeColumn() { 23 | colfunc.invoke(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/rr/parallel/IGetSmpColumn.java: -------------------------------------------------------------------------------- 1 | package rr.parallel; 2 | 3 | import rr.column_t; 4 | 5 | /** An interface used to ease the use of the GetCachedColumn by part 6 | * of parallelized renderers. 7 | * 8 | * @author Maes 9 | * 10 | */ 11 | 12 | /** 13 | * Special version of GetColumn meant to be called concurrently by different 14 | * seg rendering threads, identfiex by index. This serves to avoid stomping 15 | * on mutual cached textures and causing crashes. 16 | * 17 | */ 18 | 19 | public interface IGetSmpColumn { 20 | 21 | column_t GetSmpColumn(int tex, int col,int id); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/boom/mapsubsector_znod_t.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import utils.C2JUtils; 8 | import w.CacheableDoomObject; 9 | 10 | public class mapsubsector_znod_t implements CacheableDoomObject{ 11 | 12 | public long numsegs; 13 | 14 | @Override 15 | public void unpack(ByteBuffer buf) 16 | throws IOException { 17 | buf.order(ByteOrder.LITTLE_ENDIAN); 18 | this.numsegs = C2JUtils.unsigned(buf.getInt()); 19 | } 20 | 21 | public static final int sizeOf(){ 22 | return 4; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/w/wad_source_t.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | // CPhipps - defined enum in wider scope 4 | // Ty 08/29/98 - add source field to identify where this lump came from 5 | 6 | public enum wad_source_t { 7 | // CPhipps - define elements in order of 'how new/unusual' 8 | source_iwad, // iwad file load 9 | source_pre, // predefined lump 10 | source_auto_load, // lump auto-loaded by config file 11 | source_pwad, // pwad file load 12 | source_lmp, // lmp file load 13 | source_net // CPhipps 14 | //e6y 15 | // ,source_deh_auto_load 16 | ,source_deh 17 | ,source_err 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/boom/mapglvertex_t.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | import w.CacheableDoomObject; 7 | 8 | /** fixed 32 bit gl_vert format v2.0+ (glBsp 1.91) */ 9 | 10 | public class mapglvertex_t implements CacheableDoomObject{ 11 | public int x, y; // fixed_t 12 | 13 | public static int sizeOf() { 14 | return 8; 15 | } 16 | 17 | @Override 18 | public void unpack(ByteBuffer buf) 19 | throws IOException { 20 | buf.order(ByteOrder.LITTLE_ENDIAN); 21 | x=buf.getInt(); 22 | y=buf.getInt(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/data/musicinfo_t.java: -------------------------------------------------------------------------------- 1 | package data; 2 | 3 | public class musicinfo_t { 4 | 5 | public musicinfo_t() { 6 | } 7 | 8 | 9 | public musicinfo_t(String name) { 10 | this.name = name; 11 | } 12 | 13 | public musicinfo_t(String name, int lumpnum) { 14 | this.name = name; 15 | this.lumpnum = lumpnum; 16 | } 17 | 18 | // up to 6-character name 19 | public String name; 20 | 21 | // lump number of music 22 | public int lumpnum; 23 | 24 | // music data 25 | public byte[] data; 26 | 27 | // music handle once registered 28 | public int handle; 29 | } 30 | -------------------------------------------------------------------------------- /src/rr/SectorAction.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import doom.thinker_t; 4 | 5 | /** Used for special sector-based function for doors, ceilings 6 | * etc. that are treated as a thinker by the engine. The sector 7 | * is part of the spec, so extending classes don't need to override 8 | * it. Also, it extends thinker so futher extensions are thinkers too. 9 | * 10 | */ 11 | 12 | public abstract class SectorAction extends thinker_t { 13 | 14 | public sector_t sector; 15 | 16 | /** Special, only used when (un)archiving in order to re-link stuff 17 | * to their proper sector. 18 | */ 19 | public int sectorid; 20 | } 21 | -------------------------------------------------------------------------------- /src/p/slidedoor_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import static p.ActiveStates.T_SlidingDoor; 4 | import rr.SectorAction; 5 | import rr.line_t; 6 | import rr.sector_t; 7 | 8 | public class slidedoor_t extends SectorAction { 9 | public sdt_e type; 10 | public line_t line; 11 | public int frame; 12 | public int whichDoorIndex; 13 | public int timer; 14 | public sector_t frontsector; 15 | public sector_t backsector; 16 | public sd_e status; 17 | 18 | public slidedoor_t() { 19 | type = sdt_e.sdt_closeOnly; 20 | status = sd_e.sd_closing; 21 | thinkerFunction = T_SlidingDoor; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | .classpath 3 | .project 4 | nbproject/private/ 5 | build/ 6 | dist/ 7 | *.wad 8 | *.dsg 9 | build.xml 10 | nbproject/ 11 | 12 | # Intellij 13 | *.iml 14 | .idea/ 15 | out/ 16 | 17 | ### Generated by GitHub ### 18 | 19 | # Compiled class file 20 | *.class 21 | 22 | # Log file 23 | *.log 24 | 25 | # BlueJ files 26 | *.ctxt 27 | 28 | # Mobile Tools for Java (J2ME) 29 | .mtj.tmp/ 30 | 31 | # Package Files # 32 | *.jar 33 | *.war 34 | *.nar 35 | *.ear 36 | *.zip 37 | *.tar.gz 38 | *.rar 39 | 40 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 41 | hs_err_pid* 42 | -------------------------------------------------------------------------------- /src/rr/z_vertex_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | public class z_vertex_t 8 | extends vertex_t { 9 | 10 | public z_vertex_t(){ 11 | super(); 12 | } 13 | 14 | /** Notice how we auto-expand to fixed_t */ 15 | @Override 16 | public void unpack(ByteBuffer buf) 17 | throws IOException { 18 | buf.order(ByteOrder.LITTLE_ENDIAN); 19 | this.x=buf.getInt(); 20 | this.y=buf.getInt(); 21 | 22 | } 23 | 24 | public final static int sizeOf() { 25 | return 8; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/timing/ITicker.java: -------------------------------------------------------------------------------- 1 | package timing; 2 | 3 | import doom.CVarManager; 4 | import doom.CommandVariable; 5 | import doom.SourceCode.I_IBM; 6 | import static doom.SourceCode.I_IBM.*; 7 | 8 | public interface ITicker { 9 | 10 | static ITicker createTicker(CVarManager CVM) { 11 | if (CVM.bool(CommandVariable.MILLIS)) { 12 | return new MilliTicker(); 13 | } else if (CVM.bool(CommandVariable.FASTTIC) || CVM.bool(CommandVariable.FASTDEMO)) { 14 | return new DelegateTicker(); 15 | } else { 16 | return new NanoTicker(); 17 | } 18 | } 19 | 20 | @I_IBM.C(I_GetTime) 21 | public int GetTime(); 22 | } -------------------------------------------------------------------------------- /src/w/wadinfo_t.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | public class wadinfo_t implements IReadableDoomObject{ 7 | // Should be "IWAD" or "PWAD". 8 | String identification; 9 | long numlumps; 10 | long infotableofs; 11 | 12 | /** Reads the wadinfo_t from the file.*/ 13 | public void read(DataInputStream f) throws IOException { 14 | identification = DoomIO.readString(f,4); 15 | numlumps=DoomIO.readUnsignedLEInt(f); 16 | infotableofs=DoomIO.readUnsignedLEInt(f); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /src/p/DoomPlayer.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import m.fixed_t; 4 | 5 | public interface DoomPlayer { 6 | 7 | public fixed_t 8 | AimLineAttack 9 | ( mobj_t t1, 10 | int angle, 11 | fixed_t distance ); 12 | 13 | public void 14 | LineAttack 15 | ( mobj_t t1, 16 | int angle, 17 | fixed_t distance, 18 | fixed_t slope, 19 | int damage ); 20 | 21 | void 22 | RadiusAttack 23 | ( mobj_t spot, 24 | mobj_t source, 25 | int damage ); 26 | 27 | void 28 | TouchSpecialThing 29 | ( mobj_t special, 30 | mobj_t toucher ); 31 | 32 | void 33 | DamageMobj 34 | ( mobj_t target, 35 | mobj_t inflictor, 36 | mobj_t source, 37 | int damage ); 38 | } 39 | -------------------------------------------------------------------------------- /src/pooling/AudioChunkPool.java: -------------------------------------------------------------------------------- 1 | package pooling; 2 | 3 | import s.AudioChunk; 4 | 5 | // Referenced classes of package pooling: 6 | // ObjectPool 7 | 8 | public class AudioChunkPool extends ObjectQueuePool 9 | { 10 | 11 | public AudioChunkPool() 12 | { 13 | // A reasonable time limit for Audio chunks 14 | super(10000L); 15 | } 16 | 17 | protected AudioChunk create() 18 | { 19 | return new AudioChunk(); 20 | } 21 | 22 | public void expire(AudioChunk o) 23 | { 24 | o.free = true; 25 | } 26 | 27 | public boolean validate(AudioChunk o) 28 | { 29 | return o.free; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /DMUtils/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Mon Nov 14 16:52:48 EET 2011 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.6 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.6 13 | -------------------------------------------------------------------------------- /src/automap/mpoint_t.java: -------------------------------------------------------------------------------- 1 | package automap; 2 | 3 | import m.fixed_t; 4 | 5 | public class mpoint_t 6 | { 7 | public mpoint_t(fixed_t x, fixed_t y) { 8 | this.x = x.val; 9 | this.y = y.val; 10 | } 11 | 12 | public mpoint_t(int x, int y) { 13 | this.x = x; 14 | this.y = y; 15 | } 16 | 17 | public mpoint_t(double x, double y) { 18 | this.x = (int) x; 19 | this.y = (int) y; 20 | } 21 | 22 | public mpoint_t(){ 23 | this.x=0; 24 | this.y=0; 25 | } 26 | 27 | /** fixed_t */ 28 | public int x,y; 29 | 30 | public String toString(){ 31 | return (Integer.toHexString(x)+" , "+Integer.toHexString(y)); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/rr/maskdraw_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** Purpose unknown, probably unused. 4 | * On a closer examination, it could have been part of a system to 5 | * "enqueue" masked draws, not much unlike the current parallel 6 | * rendering subsystem, but discarded because of simplifications. 7 | * In theory it could be brought back one day if parallel sprite 8 | * drawing comes back.. just a thought ;-) 9 | * 10 | * 11 | * @author Maes 12 | * 13 | */ 14 | 15 | public class maskdraw_t { 16 | public int x1; 17 | public int x2; 18 | 19 | public int column; 20 | public int topclip; 21 | public int bottomclip; 22 | 23 | } -------------------------------------------------------------------------------- /src/boom/mapsubsector_v4_t.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | 9 | public class mapsubsector_v4_t implements CacheableDoomObject{ 10 | 11 | public char numsegs; 12 | /** Index of first one, segs are stored sequentially. */ 13 | public int firstseg; 14 | 15 | @Override 16 | public void unpack(ByteBuffer buf) 17 | throws IOException { 18 | buf.order(ByteOrder.LITTLE_ENDIAN); 19 | this.numsegs = buf.getChar(); 20 | this.firstseg = buf.getInt(); 21 | } 22 | 23 | public static int sizeOf(){ 24 | return 6; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/s/channel_t.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | import javax.sound.sampled.AudioFormat; 4 | import javax.sound.sampled.SourceDataLine; 5 | 6 | import p.mobj_t; 7 | import data.sfxinfo_t; 8 | 9 | public class channel_t 10 | { 11 | 12 | public channel_t(){ 13 | sfxinfo=new sfxinfo_t(); 14 | } 15 | 16 | /** Currently playing sound. If null, then it's free */ 17 | DoomSound currentSound = null; 18 | 19 | sfxinfo_t sfxinfo; 20 | 21 | // origin of sound (usually a mobj_t). 22 | mobj_t origin; 23 | 24 | // handle of the sound being played 25 | int handle; 26 | 27 | AudioFormat format; 28 | 29 | public int sfxVolume; 30 | 31 | SourceDataLine auline = null; 32 | } 33 | -------------------------------------------------------------------------------- /src/rr/flat_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | 6 | import w.CacheableDoomObject; 7 | 8 | public class flat_t 9 | implements CacheableDoomObject { 10 | 11 | public static final int FLAT_SIZE=4096; 12 | 13 | public byte[] data; 14 | 15 | public flat_t(){ 16 | this.data=new byte[FLAT_SIZE]; 17 | } 18 | 19 | public flat_t(int size){ 20 | this.data=new byte[size]; 21 | } 22 | 23 | 24 | @Override 25 | public void unpack(ByteBuffer buf) 26 | throws IOException { 27 | 28 | //buf.get(this.data); 29 | this.data=buf.array(); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/s/degenmobj_t.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | public final class degenmobj_t 4 | implements ISoundOrigin { 5 | 6 | private final int x, y, z; 7 | 8 | public degenmobj_t(int x, int y, int z) { 9 | this.x = x; 10 | this.y = y; 11 | this.z = z; 12 | } 13 | 14 | public degenmobj_t(int x, int y) { 15 | this.x = x; 16 | this.y = y; 17 | this.z = 0; 18 | } 19 | 20 | @Override 21 | public final int getX() { 22 | return x; 23 | } 24 | 25 | @Override 26 | public final int getY() { 27 | return y; 28 | } 29 | 30 | @Override 31 | public final int getZ() { 32 | return z; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/doom/NetConsts.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | public interface NetConsts { 4 | 5 | public static int NCMD_EXIT= 0x80000000; 6 | public static int NCMD_RETRANSMIT =0x40000000; 7 | public static int NCMD_SETUP =0x20000000; 8 | public static int NCMD_KILL = 0x10000000; // kill game 9 | public static int NCMD_CHECKSUM = 0x0fffffff; 10 | 11 | public static int DOOMCOM_ID = 0x12345678; 12 | 13 | 14 | //Networking and tick handling related. Moved to DEFINES 15 | //protected static int BACKUPTICS = 12; 16 | 17 | 18 | // command_t 19 | public static short CMD_SEND = 1; 20 | public static short CMD_GET = 2; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/rr/IVisSpriteManagement.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** A sprite manager does everything but drawing the sprites. It creates lists 4 | * of sprites-per-sector, sorts them, and stuff like that. 5 | * that gory visibiliy 6 | * 7 | * @author velkton 8 | * 9 | * @param 10 | */ 11 | 12 | 13 | public interface IVisSpriteManagement extends ILimitResettable { 14 | 15 | void AddSprites(sector_t sec); 16 | 17 | /** Cache the sprite manager, if possible */ 18 | 19 | void cacheSpriteManager(ISpriteManager SM); 20 | 21 | void SortVisSprites(); 22 | 23 | int getNumVisSprites(); 24 | 25 | vissprite_t[] getVisSprites(); 26 | 27 | void ClearSprites(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/rr/SegVars.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import data.Limits; 4 | import utils.C2JUtils; 5 | 6 | public class SegVars { 7 | // /// FROM BSP ///////// 8 | 9 | public int MAXDRAWSEGS = Limits.MAXDRAWSEGS; 10 | 11 | /** pointer to drawsegs */ 12 | public int ds_p; 13 | 14 | public drawseg_t[] drawsegs; 15 | 16 | public short[] maskedtexturecol; 17 | public int pmaskedtexturecol = 0; 18 | 19 | 20 | /** 21 | * R_ClearDrawSegs 22 | * 23 | * The drawseg list is reset by pointing back at 0. 24 | * 25 | */ 26 | public void ClearDrawSegs() { 27 | ds_p = 0; 28 | } 29 | 30 | public final void ResizeDrawsegs() { 31 | drawsegs = C2JUtils.resize(drawsegs[0], drawsegs, drawsegs.length*2); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/p/button_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import rr.line_t; 4 | import s.degenmobj_t; 5 | 6 | public class button_t implements Resettable{ 7 | 8 | public line_t line; 9 | public bwhere_e where; 10 | public int btexture; 11 | public int btimer; 12 | public degenmobj_t soundorg; 13 | 14 | public button_t(){ 15 | this.btexture=0; 16 | this.btimer=0; 17 | this.where=bwhere_e.top; 18 | } 19 | 20 | public void reset(){ 21 | this.line=null; 22 | this.where=bwhere_e.top; 23 | this.btexture=0; 24 | this.btimer=0; 25 | this.soundorg=null; 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/i/IDiskDrawer.java: -------------------------------------------------------------------------------- 1 | package i; 2 | 3 | public interface IDiskDrawer extends IDrawer { 4 | 5 | /** 6 | * Set a timeout (in tics) for displaying the disk icon 7 | * 8 | * @param timeout 9 | */ 10 | void setReading(int reading); 11 | 12 | /** 13 | * Disk displayer is currently active 14 | * 15 | * @return 16 | */ 17 | boolean isReading(); 18 | 19 | /** 20 | * Only call after the Wadloader is instantiated and initialized itself. 21 | * 22 | */ 23 | void Init(); 24 | 25 | /** 26 | * Status only valid after the last tic has been drawn. Use to know when to redraw status bar. 27 | * 28 | * @return 29 | */ 30 | boolean justDoneReading(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/demo/IDemoTicCmd.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import w.IWritableDoomObject; 4 | import doom.ticcmd_t; 5 | 6 | /** Demo Tic Commands can be read/written to disk/buffers, 7 | * and are not necessarily equal to the in-game ticcmd_t. 8 | * Thus, it's necessary for them to implement some 9 | * adaptor method (both ways). 10 | * 11 | * @author admin 12 | * 13 | */ 14 | 15 | public interface IDemoTicCmd extends IWritableDoomObject{ 16 | /** Decode this IDemoTicCmd into a standard ticcmd_t. 17 | * 18 | * @param source 19 | */ 20 | public void decode(ticcmd_t dest); 21 | 22 | /** Encode this IDemoTicCmd from a standard ticcmd_t. 23 | * 24 | * @param dest 25 | */ 26 | public void encode(ticcmd_t source); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/rr/IMaskedDrawer.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** Draws any masked stuff -sprites, textures, or special 3D floors */ 4 | 5 | public interface IMaskedDrawer extends IDetailAware { 6 | 7 | public static final int BASEYCENTER = 100; 8 | 9 | /** Cache the sprite manager, if possible */ 10 | 11 | void cacheSpriteManager(ISpriteManager SM); 12 | 13 | void DrawMasked(); 14 | 15 | void setPspriteIscale(int i); 16 | 17 | void setPspriteScale(int i); 18 | 19 | /** 20 | * For serial masked drawer, just complete the column function. For 21 | * parallel version, store rendering instructions and execute later on. 22 | * HINT: you need to discern between masked and non-masked draws. 23 | */ 24 | 25 | void completeColumn(); 26 | } 27 | -------------------------------------------------------------------------------- /src/timing/MilliTicker.java: -------------------------------------------------------------------------------- 1 | package timing; 2 | 3 | import static data.Defines.TICRATE; 4 | 5 | public class MilliTicker 6 | implements ITicker { 7 | 8 | /** 9 | * I_GetTime 10 | * returns time in 1/70th second tics 11 | */ 12 | 13 | @Override 14 | public int GetTime() { 15 | long tp; 16 | //struct timezone tzp; 17 | int newtics; 18 | 19 | tp = System.currentTimeMillis(); 20 | if (basetime == 0) { 21 | basetime = tp; 22 | } 23 | newtics = (int) (((tp - basetime) * TICRATE) / 1000); 24 | return newtics; 25 | } 26 | 27 | protected volatile long basetime=0; 28 | protected volatile int oldtics=0; 29 | protected volatile int discrepancies; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/p/anim_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | /** Animating textures and planes 4 | * There is another anim_t used in wi_stuff, unrelated. 5 | * 6 | * @author admin 7 | * 8 | */ 9 | 10 | 11 | 12 | public class anim_t { 13 | 14 | public anim_t(){ 15 | 16 | } 17 | 18 | public anim_t(boolean istexture, int picnum, int basepic, int numpics, 19 | int speed) { 20 | super(); 21 | this.istexture = istexture; 22 | this.picnum = picnum; 23 | this.basepic = basepic; 24 | this.numpics = numpics; 25 | this.speed = speed; 26 | } 27 | public boolean istexture; 28 | public int picnum; 29 | public int basepic; 30 | public int numpics; 31 | public int speed; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/rr/parallel/RenderSegInstruction.java: -------------------------------------------------------------------------------- 1 | package rr.parallel; 2 | 3 | /** This is all the information needed to draw a particular SEG. 4 | * It's quite a lot, actually, but much better than in testing 5 | * versions. 6 | * 7 | */ 8 | 9 | public class RenderSegInstruction { 10 | public int rw_x,rw_stopx; 11 | public int toptexture,midtexture,bottomtexture; 12 | public int pixhigh,pixlow,pixhighstep,pixlowstep, 13 | topfrac, topstep,bottomfrac, bottomstep; 14 | public boolean segtextured,markfloor,markceiling; 15 | public long rw_centerangle; // angle_t 16 | /** fixed_t */ 17 | public int rw_offset,rw_distance,rw_scale, 18 | rw_scalestep,rw_midtexturemid,rw_toptexturemid,rw_bottomtexturemid; 19 | public int viewheight; 20 | V[] walllights; 21 | public int centery; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/automap/fline_t.java: -------------------------------------------------------------------------------- 1 | package automap; 2 | 3 | public class fline_t 4 | { 5 | 6 | /* 7 | * public fline_t(){ 8 | a=new fpoint_t(); 9 | b=new fpoint_t(); 10 | } 11 | 12 | public fline_t(fpoint_t a, fpoint_t b){ 13 | this.a=a; 14 | this.b=b; 15 | } 16 | */ 17 | public fline_t(int ax, int ay, int bx, int by){ 18 | this.ay=ay; 19 | this.ax=ax; 20 | this.by=by; 21 | this.bx=bx; 22 | } 23 | 24 | public fline_t() { 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | public int ax,ay,bx,by; 29 | /* 30 | public fpoint_t a, b; 31 | 32 | public void reset() { 33 | this.a.x=0; 34 | this.a.y=0; 35 | this.b.x=0; 36 | this.b.y=0; 37 | 38 | }*/ 39 | } 40 | -------------------------------------------------------------------------------- /src/rr/base_ratio_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | public class base_ratio_t { 4 | 5 | public base_ratio_t(int base_width, int base_height, int psprite_offset, 6 | int multiplier, float gl_ratio) { 7 | this.base_width = base_width; 8 | this.base_height = base_height; 9 | this.psprite_offset = psprite_offset; 10 | this.multiplier = multiplier; 11 | this.gl_ratio = (float) (RMUL*gl_ratio); 12 | } 13 | 14 | public int base_width; // Base width (unused) 15 | public int base_height; // Base height (used for wall visibility multiplier) 16 | public int psprite_offset; // Psprite offset (needed for "tallscreen" modes) 17 | public int multiplier; // Width or height multiplier 18 | public float gl_ratio; 19 | 20 | public static final double RMUL =1.6d/1.333333d; 21 | 22 | } -------------------------------------------------------------------------------- /src/w/wadfile_info_t.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.InputStream; 4 | import java.util.zip.ZipEntry; 5 | 6 | // CPhipps - changed wad init 7 | // We _must_ have the wadfiles[] the same as those actually loaded, so there 8 | // is no point having these separate entities. This belongs here. 9 | 10 | public class wadfile_info_t { 11 | public String name; // Also used as a resource identifier, so save with full path and all. 12 | public ZipEntry entry; // Secondary resource identifier e.g. files inside zip archives. 13 | public int type; // as per InputStreamSugar 14 | public wad_source_t src; 15 | public InputStream handle; 16 | public boolean cached; // Whether we use local caching e.g. for URL or zips 17 | public long maxsize=-1; // Update when known for sure. Will speed up seeking. 18 | } 19 | -------------------------------------------------------------------------------- /src/boom/mapseg_znod_t.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | import w.CacheableDoomObject; 7 | 8 | /** ZDoom node? 9 | * 10 | */ 11 | 12 | public class mapseg_znod_t implements CacheableDoomObject{ 13 | 14 | public mapseg_znod_t(){ 15 | 16 | } 17 | 18 | public int v1,v2; // Those are unsigned :-/ 19 | public char linedef; 20 | public byte side; 21 | 22 | public static int sizeOf(){ 23 | return 11; 24 | } 25 | 26 | @Override 27 | public void unpack(ByteBuffer buf) 28 | throws IOException { 29 | buf.order(ByteOrder.LITTLE_ENDIAN); 30 | this.v1 = buf.getInt(); 31 | this.v2 = buf.getInt(); 32 | this.linedef=buf.getChar(); 33 | this.side=buf.get(); 34 | } 35 | 36 | }; 37 | -------------------------------------------------------------------------------- /src/data/mapsubsector_t.java: -------------------------------------------------------------------------------- 1 | package data; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | 9 | /** SubSector, as generated by BSP. */ 10 | 11 | public class mapsubsector_t implements CacheableDoomObject{ 12 | 13 | public mapsubsector_t(){ 14 | 15 | } 16 | 17 | public char numsegs; 18 | /** Index of first one, segs are stored sequentially. */ 19 | public char firstseg; 20 | @Override 21 | public void unpack(ByteBuffer buf) 22 | throws IOException { 23 | buf.order(ByteOrder.LITTLE_ENDIAN); 24 | this.numsegs = buf.getChar(); 25 | this.firstseg = buf.getChar(); 26 | 27 | } 28 | 29 | public static int sizeOf(){ 30 | return 4; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/p/slidename_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public class slidename_t { 4 | 5 | public slidename_t() { 6 | 7 | } 8 | 9 | public slidename_t(String frontFrame1, String frontFrame2, 10 | String frontFrame3, String frontFrame4, String backFrame1, 11 | String backFrame2, String backFrame3, String backFrame4) { 12 | this.frontFrame1 = frontFrame1; 13 | this.frontFrame2 = frontFrame2; 14 | this.frontFrame3 = frontFrame3; 15 | this.frontFrame4 = frontFrame4; 16 | this.backFrame1 = backFrame1; 17 | this.backFrame2 = backFrame2; 18 | this.backFrame3 = backFrame3; 19 | this.backFrame4 = backFrame4; 20 | } 21 | 22 | public String frontFrame1; 23 | public String frontFrame2; 24 | public String frontFrame3; 25 | public String frontFrame4; 26 | public String backFrame1; 27 | public String backFrame2; 28 | public String backFrame3; 29 | public String backFrame4; 30 | 31 | } -------------------------------------------------------------------------------- /src/doom/KeyboardManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Good Sign 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package doom; 18 | 19 | /** 20 | * 21 | * @author Good Sign 22 | */ 23 | public class KeyboardManager { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/p/floor_e.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | public enum floor_e { 4 | // lower floor to highest surrounding floor 5 | lowerFloor, 6 | 7 | // lower floor to lowest surrounding floor 8 | lowerFloorToLowest, 9 | 10 | // lower floor to highest surrounding floor VERY FAST 11 | turboLower, 12 | 13 | // raise floor to lowest surrounding CEILING 14 | raiseFloor, 15 | 16 | // raise floor to next highest surrounding floor 17 | raiseFloorToNearest, 18 | 19 | // raise floor to shortest height texture around it 20 | raiseToTexture, 21 | 22 | // lower floor to lowest surrounding floor 23 | // and change floorpic 24 | lowerAndChange, 25 | 26 | raiseFloor24, 27 | raiseFloor24AndChange, 28 | raiseFloorCrush, 29 | 30 | // raise to next highest floor, turbo-speed 31 | raiseFloorTurbo, 32 | donutRaise, 33 | raiseFloor512 34 | 35 | } 36 | -------------------------------------------------------------------------------- /default.cfg: -------------------------------------------------------------------------------- 1 | mouse_sensitivity 5 2 | sfx_volume 8 3 | music_volume 8 4 | show_messages 1 5 | key_right 77 6 | key_left 75 7 | key_up 17 8 | key_down 31 9 | key_strafeleft 30 10 | key_straferight 32 11 | key_fire 29 12 | key_use 57 13 | key_strafe 56 14 | key_speed 54 15 | use_mouse 1 16 | mouseb_fire 0 17 | mouseb_strafe 1 18 | mouseb_forward 2 19 | use_joystick 0 20 | joyb_fire 0 21 | joyb_strafe 1 22 | joyb_use 3 23 | joyb_speed 2 24 | screenblocks 9 25 | detaillevel 0 26 | snd_channels 8 27 | snd_musicdevice 3 28 | snd_sfxdevice 3 29 | snd_sbport 0 30 | snd_sbirq 0 31 | snd_sbdma 0 32 | snd_mport 0 33 | usegamma 0 34 | chatmacro0 "No" 35 | chatmacro1 "I'm ready to kick butt!" 36 | chatmacro2 "I'm OK." 37 | chatmacro3 "I'm not looking too good!" 38 | chatmacro4 "Help!" 39 | chatmacro5 "You suck!" 40 | chatmacro6 "Next time, scumbag..." 41 | chatmacro7 "Come here!" 42 | chatmacro8 "I'll take care of it." 43 | chatmacro9 "Yes" 44 | -------------------------------------------------------------------------------- /src/n/DummyNetworkHandler.java: -------------------------------------------------------------------------------- 1 | package n; 2 | 3 | import doom.IDoomGameNetworking; 4 | import doom.doomcom_t; 5 | 6 | public class DummyNetworkHandler implements IDoomGameNetworking{ 7 | 8 | @Override 9 | public void NetUpdate() { 10 | // TODO Auto-generated method stub 11 | 12 | } 13 | 14 | @Override 15 | public void TryRunTics() { 16 | // TODO Auto-generated method stub 17 | 18 | } 19 | 20 | @Override 21 | public doomcom_t getDoomCom() { 22 | // TODO Auto-generated method stub 23 | return null; 24 | } 25 | 26 | @Override 27 | public void setDoomCom(doomcom_t doomcom) { 28 | // TODO Auto-generated method stub 29 | 30 | } 31 | 32 | @Override 33 | public int getTicdup() { 34 | // TODO Auto-generated method stub 35 | return 0; 36 | } 37 | 38 | @Override 39 | public void setTicdup(int ticdup) { 40 | // TODO Auto-generated method stub 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/m/menuitem_t.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | import g.Signals; 4 | 5 | public class menuitem_t { 6 | 7 | public menuitem_t(int status, String name, MenuRoutine routine, Signals.ScanCode alphaKey) { 8 | this.status = status; 9 | this.name = name; 10 | this.routine = routine; 11 | this.alphaKey = alphaKey; 12 | } 13 | 14 | public menuitem_t(int status, String name, MenuRoutine routine) { 15 | this.status = status; 16 | this.name = name; 17 | this.routine = routine; 18 | } 19 | 20 | /** 21 | * 0 = no cursor here, 1 = ok, 2 = arrows ok 22 | */ 23 | int status; 24 | 25 | String name; 26 | 27 | // choice = menu item #. 28 | // if status = 2, 29 | // choice=0:leftarrow,1:rightarrow 30 | // MAES: OK... to probably we need some sort of "MenuRoutine" class for this one. 31 | // void (*routine)(int choice); 32 | MenuRoutine routine; 33 | 34 | /** 35 | * hotkey in menu 36 | */ 37 | Signals.ScanCode alphaKey; 38 | } 39 | -------------------------------------------------------------------------------- /src/doom/IDoomGameNetworking.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | import java.io.IOException; 4 | 5 | /** Doom is actually tied to its networking module. 6 | * Therefore, no matter where and how you implement it, these functions 7 | * need to be callable from within many modules. 8 | * 9 | * This is the so called "game networking" which is internal and game-specific, 10 | * and not system networking which deals with the low level sockets and packet 11 | * stuff. You'll need DoomSystemNetworking for that one. 12 | * 13 | * @author Velktron 14 | * 15 | */ 16 | 17 | public interface IDoomGameNetworking { 18 | 19 | public void TryRunTics() throws IOException; 20 | 21 | /** 22 | * NetUpdate 23 | * Builds ticcmds for console player, 24 | * sends out a packet 25 | * @throws IOException 26 | */ 27 | 28 | public void NetUpdate (); 29 | 30 | public doomcom_t getDoomCom(); 31 | 32 | public void setDoomCom(doomcom_t doomcom); 33 | 34 | public int getTicdup(); 35 | 36 | public void setTicdup(int ticdup); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/s/DMXSound.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | import java.io.IOException; 4 | import java.nio.BufferUnderflowException; 5 | import java.nio.ByteBuffer; 6 | import java.nio.ByteOrder; 7 | 8 | import w.CacheableDoomObject; 9 | 10 | /** An object representation of Doom's sound format */ 11 | 12 | public class DMXSound implements CacheableDoomObject{ 13 | 14 | /** ushort, all Doom samples are "type 3". No idea how */ 15 | public int type; 16 | /** ushort, speed in Hz. */ 17 | public int speed; 18 | /** uint */ 19 | public int datasize; 20 | 21 | public byte[] data; 22 | 23 | @Override 24 | public void unpack(ByteBuffer buf) 25 | throws IOException { 26 | buf.order(ByteOrder.LITTLE_ENDIAN); 27 | type=buf.getChar(); 28 | speed=buf.getChar(); 29 | try { 30 | datasize = buf.getInt(); 31 | } catch (BufferUnderflowException e) { 32 | datasize = buf.capacity() - buf.position(); 33 | } 34 | data=new byte[Math.min(buf.remaining(),datasize)]; 35 | buf.get(data); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/m/menu_t.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | /** General form for a classic, Doom-style menu with a bunch of 4 | * items and a drawing routine (menu_t's don't have action callbacks 5 | * proper, though). 6 | * 7 | * @author Maes 8 | * 9 | */ 10 | 11 | public class menu_t { 12 | public menu_t(int numitems, menu_t prev, menuitem_t[] items, 13 | DrawRoutine drawroutine, int x, int y, int lastOn) { 14 | this.numitems=numitems; 15 | this.prevMenu=prev; 16 | this.menuitems=items; 17 | this.routine=drawroutine; 18 | this.x=x; 19 | this.y=y; 20 | this.lastOn=lastOn; 21 | 22 | } 23 | /** # of menu items */ 24 | public int numitems; 25 | 26 | /** previous menu */ 27 | public menu_t prevMenu; 28 | 29 | /** menu items */ 30 | public menuitem_t[] menuitems; 31 | /** draw routine */ 32 | public DrawRoutine routine; 33 | /** x,y of menu */ 34 | public int x,y; 35 | /** last item user was on in menu */ 36 | public int lastOn; 37 | } 38 | -------------------------------------------------------------------------------- /src/data/mapvertex_t.java: -------------------------------------------------------------------------------- 1 | package data; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | 9 | /** 10 | * This is the structure of a map vertex ON DISK: in memory it gets shifted and 11 | * expanded to fixed_t. Also, on disk it only exists as part of the VERTEXES 12 | * lump: it is not individually cacheable, even though it implements 13 | * CacheableDoomObject. 14 | */ 15 | 16 | public class mapvertex_t 17 | implements CacheableDoomObject { 18 | 19 | public mapvertex_t(short x, short y) { 20 | this.x = x; 21 | this.y = y; 22 | } 23 | 24 | public mapvertex_t() { 25 | this((short) 0, (short) 0); 26 | } 27 | 28 | public short x; 29 | 30 | public short y; 31 | 32 | public static int sizeOf() { 33 | return 4; 34 | } 35 | 36 | @Override 37 | public void unpack(ByteBuffer buf) 38 | throws IOException { 39 | buf.order(ByteOrder.LITTLE_ENDIAN); 40 | x = buf.getShort(); 41 | y = buf.getShort(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/i/IDoomSystem.java: -------------------------------------------------------------------------------- 1 | package i; 2 | 3 | import doom.ticcmd_t; 4 | 5 | public interface IDoomSystem { 6 | 7 | public void AllocLow(int length); 8 | 9 | public void BeginRead(); 10 | 11 | public void EndRead(); 12 | 13 | public void WaitVBL(int count); 14 | 15 | public byte[] ZoneBase(int size); 16 | 17 | public int GetHeapSize(); 18 | 19 | public void Tactile(int on, int off, int total); 20 | 21 | public void Quit(); 22 | 23 | public ticcmd_t BaseTiccmd(); 24 | 25 | public void Error(String error, Object ... args); 26 | 27 | void Error(String error); 28 | 29 | void Init(); 30 | 31 | /** Generate a blocking alert with the intention of continuing or aborting 32 | * a certain game-altering action. E.g. loading PWADs, or upon critical 33 | * level loading failures. This can be either a popup panel or console 34 | * message. 35 | * 36 | * @param cause Provide a clear string explaining why the alert was generated 37 | * @return true if we should continue, false if an alternate action should be taken. 38 | */ 39 | boolean GenerateAlert(String title,String cause); 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/p/intercept_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import doom.SourceCode.fixed_t; 4 | import rr.line_t; 5 | 6 | /** 7 | * An object that carries...interception information, I guess...with either a line 8 | * or an object? 9 | * 10 | * @author Velktron 11 | * 12 | */ 13 | public class intercept_t { 14 | 15 | /** 16 | * most intercepts will belong to a static pool 17 | */ 18 | public intercept_t() {} 19 | 20 | public intercept_t(int frac, mobj_t thing) { 21 | this.frac = frac; 22 | this.thing = thing; 23 | this.isaline = false; 24 | } 25 | 26 | public intercept_t(int frac, line_t line) { 27 | this.frac = frac; 28 | this.line = line; 29 | this.isaline = true; 30 | } 31 | 32 | /** 33 | * fixed_t, along trace line 34 | */ 35 | @fixed_t 36 | public int frac; 37 | public boolean isaline; 38 | // MAES: this was an union of a mobj_t and a line_t, 39 | // returned as "d". 40 | public mobj_t thing; 41 | public line_t line; 42 | 43 | public Interceptable d() { 44 | return (isaline) ? line : thing; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/timing/NanoTicker.java: -------------------------------------------------------------------------------- 1 | package timing; 2 | 3 | import static data.Defines.TICRATE; 4 | 5 | public class NanoTicker 6 | implements ITicker { 7 | 8 | /** 9 | * I_GetTime 10 | * returns time in 1/70th second tics 11 | */ 12 | 13 | @Override 14 | public int GetTime() { 15 | long tp; 16 | //struct timezone tzp; 17 | int newtics; 18 | 19 | // Attention: System.nanoTime() might not be consistent across multicore CPUs. 20 | // To avoid the core getting back to the past, 21 | tp = System.nanoTime(); 22 | if (basetime == 0) { 23 | basetime = tp; 24 | } 25 | newtics = (int) (((tp - basetime) * TICRATE) / 1000000000);// + tp.tv_usec*TICRATE/1000000; 26 | if (newtics < oldtics) { 27 | System.err.printf("Timer discrepancies detected : %d", (++discrepancies)); 28 | return oldtics; 29 | } 30 | return (oldtics = newtics); 31 | } 32 | 33 | protected volatile long basetime=0; 34 | protected volatile int oldtics=0; 35 | protected volatile int discrepancies; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/savegame/IDoomSaveGameHeader.java: -------------------------------------------------------------------------------- 1 | package savegame; 2 | 3 | import defines.skill_t; 4 | 5 | 6 | /** A Save Game Header should be able to be loaded quickly and return 7 | * some basic info about it (name, version, game time, etc.) in an unified 8 | * manner, no matter what actual format you use for saving. 9 | * 10 | * @author admin 11 | * 12 | */ 13 | 14 | public interface IDoomSaveGameHeader { 15 | 16 | String getName(); 17 | 18 | void setName(String name); 19 | 20 | skill_t getGameskill(); 21 | 22 | void setGameskill(skill_t gameskill); 23 | 24 | String getVersion(); 25 | 26 | void setVersion(String vcheck); 27 | 28 | int getGameepisode(); 29 | 30 | void setGameepisode(int gameepisode); 31 | 32 | boolean isProperend(); 33 | 34 | void setWrongversion(boolean wrongversion); 35 | 36 | boolean isWrongversion(); 37 | 38 | void setLeveltime(int leveltime); 39 | 40 | int getLeveltime(); 41 | 42 | void setPlayeringame(boolean[] playeringame); 43 | 44 | boolean[] getPlayeringame(); 45 | 46 | void setGamemap(int gamemap); 47 | 48 | int getGamemap(); 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/i/DiskDrawer.java: -------------------------------------------------------------------------------- 1 | package i; 2 | 3 | import doom.DoomMain; 4 | import rr.patch_t; 5 | import static v.renderers.DoomScreen.FG; 6 | 7 | public class DiskDrawer implements IDiskDrawer { 8 | 9 | private DoomMain DOOM; 10 | private patch_t disk; 11 | private int timer=0; 12 | private String diskname; 13 | 14 | public static final String STDISK="STDISK"; 15 | public static final String STCDROM="STCDROM"; 16 | 17 | public DiskDrawer(DoomMain DOOM, String icon){ 18 | this.DOOM = DOOM; 19 | this.diskname=icon; 20 | } 21 | 22 | @Override 23 | public void Init(){ 24 | this.disk=DOOM.wadLoader.CachePatchName(diskname); 25 | } 26 | 27 | @Override 28 | public void Drawer() { 29 | if (timer>0){ 30 | if (timer%2==0) 31 | DOOM.graphicSystem.DrawPatchScaled(FG, disk, DOOM.vs, 304, 184); 32 | } 33 | if (timer>=0) 34 | timer--; 35 | } 36 | 37 | @Override 38 | public void setReading(int reading) { 39 | timer=reading; 40 | } 41 | 42 | @Override 43 | public boolean isReading() { 44 | return timer>0; 45 | } 46 | 47 | @Override 48 | public boolean justDoneReading() { 49 | return timer==0; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/rr/mappatch_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | 9 | /** 10 | * Texture definition. 11 | * Each texture is composed of one or more patches, 12 | * with patches being lumps stored in the WAD. 13 | * The lumps are referenced by number, and patched 14 | * into the rectangular texture space using origin 15 | * and possibly other attributes. 16 | */ 17 | 18 | public class mappatch_t implements CacheableDoomObject { 19 | public short originx; 20 | public short originy; 21 | public short patch; 22 | public short stepdir; 23 | public short colormap; 24 | 25 | @Override 26 | public void unpack(ByteBuffer buf) 27 | throws IOException { 28 | buf.order(ByteOrder.LITTLE_ENDIAN); 29 | originx=buf.getShort(); 30 | originy=buf.getShort(); 31 | patch=buf.getShort(); 32 | stepdir=buf.getShort(); 33 | colormap=buf.getShort(); 34 | } 35 | 36 | public static final int size() { 37 | return 10; 38 | } 39 | 40 | 41 | }; 42 | -------------------------------------------------------------------------------- /src/s/DummyMusic.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | public class DummyMusic implements IMusic { 4 | 5 | @Override 6 | public void InitMusic() { 7 | // TODO Auto-generated method stub 8 | 9 | } 10 | 11 | @Override 12 | public void ShutdownMusic() { 13 | // TODO Auto-generated method stub 14 | 15 | } 16 | 17 | @Override 18 | public void SetMusicVolume(int volume) { 19 | // TODO Auto-generated method stub 20 | 21 | } 22 | 23 | @Override 24 | public void PauseSong(int handle) { 25 | // TODO Auto-generated method stub 26 | 27 | } 28 | 29 | @Override 30 | public void ResumeSong(int handle) { 31 | // TODO Auto-generated method stub 32 | 33 | } 34 | 35 | @Override 36 | public int RegisterSong(byte[] data) { 37 | // TODO Auto-generated method stub 38 | return 0; 39 | } 40 | 41 | @Override 42 | public void PlaySong(int handle, boolean looping) { 43 | // TODO Auto-generated method stub 44 | 45 | } 46 | 47 | @Override 48 | public void StopSong(int handle) { 49 | // TODO Auto-generated method stub 50 | 51 | } 52 | 53 | @Override 54 | public void UnRegisterSong(int handle) { 55 | // TODO Auto-generated method stub 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/data/maplinedef_t.java: -------------------------------------------------------------------------------- 1 | package data; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | 10 | /** 11 | * A LineDef, as used for editing, and as input to the BSP builder. 12 | */ 13 | public class maplinedef_t implements CacheableDoomObject{ 14 | 15 | public maplinedef_t() { 16 | this.sidenum = new char[2]; 17 | } 18 | 19 | public char v1; 20 | 21 | public char v2; 22 | 23 | public short flags; 24 | 25 | public short special; 26 | 27 | public short tag; 28 | 29 | /** sidenum[1] will be 0xFFFF if one sided */ 30 | public char[] sidenum; 31 | 32 | public static int sizeOf() { 33 | return 14; 34 | } 35 | 36 | @Override 37 | public void unpack(ByteBuffer buf) 38 | throws IOException { 39 | buf.order(ByteOrder.LITTLE_ENDIAN); 40 | this.v1 = buf.getChar(); 41 | this.v2 = buf.getChar(); 42 | this.flags = buf.getShort(); 43 | this.special = buf.getShort(); 44 | this.tag = buf.getShort(); 45 | DoomBuffer.readCharArray(buf, this.sidenum, 2); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/rr/vertex_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import static m.fixed_t.FRACBITS; 4 | 5 | import java.io.IOException; 6 | import java.nio.ByteBuffer; 7 | import java.nio.ByteOrder; 8 | 9 | import p.Resettable; 10 | 11 | import w.CacheableDoomObject; 12 | 13 | /** This is the vertex structure used IN MEMORY with fixed-point arithmetic. 14 | * It's DIFFERENT than the one used on disk, which has 16-bit signed shorts. 15 | * However, it must be parsed. 16 | * 17 | */ 18 | 19 | public class vertex_t implements CacheableDoomObject, Resettable{ 20 | 21 | public vertex_t(){ 22 | 23 | } 24 | /** treat as (fixed_t) */ 25 | public int x,y; 26 | 27 | 28 | /** Notice how we auto-expand to fixed_t */ 29 | @Override 30 | public void unpack(ByteBuffer buf) 31 | throws IOException { 32 | buf.order(ByteOrder.LITTLE_ENDIAN); 33 | this.x=buf.getShort()< implements NetConsts, DoomSystemNetworking { 18 | 19 | ////////////// STATUS /////////// 20 | 21 | private final DoomMain DOOM; 22 | 23 | public DummyNetworkDriver(DoomMain DOOM){ 24 | this.DOOM = DOOM; 25 | } 26 | 27 | @Override 28 | public void InitNetwork() { 29 | doomcom_t doomcom =new doomcom_t(); 30 | doomcom.id=DOOMCOM_ID; 31 | doomcom.ticdup=1; 32 | 33 | // single player game 34 | DOOM.netgame = Engine.getCVM().present(CommandVariable.NET); 35 | doomcom.id = DOOMCOM_ID; 36 | doomcom.numplayers = doomcom.numnodes = 1; 37 | doomcom.deathmatch = 0; 38 | doomcom.consoleplayer = 0; 39 | DOOM.gameNetworking.setDoomCom(doomcom); 40 | } 41 | 42 | @Override 43 | public void NetCmd() { 44 | // TODO Auto-generated method stub 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/automap/mline_t.java: -------------------------------------------------------------------------------- 1 | package automap; 2 | 3 | /** used only in automap */ 4 | 5 | public class mline_t 6 | { 7 | public mline_t(){ 8 | this(0,0,0,0); 9 | } 10 | 11 | public int ax,ay,bx,by; 12 | 13 | public mline_t(int ax, int ay, int bx, int by) { 14 | this.ax = ax; 15 | this.ay = ay; 16 | this.bx = bx; 17 | this.by = by; 18 | } 19 | 20 | public mline_t(double ax, double ay, double bx, double by) { 21 | this.ax = (int) ax; 22 | this.ay = (int) ay; 23 | this.bx = (int) bx; 24 | this.by = (int) by; 25 | } 26 | 27 | /* 28 | public mline_t(mpoint_t a, mpoint_t b) { 29 | this.a = a; 30 | this.b = b; 31 | } 32 | 33 | public mline_t(int ax,int ay,int bx,int by) { 34 | this.a = new mpoint_t(ax,ay); 35 | this.b = new mpoint_t(bx,by); 36 | } 37 | 38 | public mline_t(double ax,double ay,double bx,double by) { 39 | this.a = new mpoint_t(ax,ay); 40 | this.b = new mpoint_t(bx,by); 41 | } 42 | 43 | public mpoint_t a, b; 44 | public int ax; 45 | 46 | public String toString(){ 47 | return a.toString()+" - "+ b.toString(); 48 | } 49 | */ 50 | } 51 | -------------------------------------------------------------------------------- /src/utils/OSValidator.java: -------------------------------------------------------------------------------- 1 | package utils; 2 | 3 | /** Half-assed way of finding the OS we're running under, shamelessly 4 | * ripped from: 5 | * 6 | * http://www.mkyong.com/java/how-to-detect-os-in-java-systemgetpropertyosname/ 7 | * . 8 | * This is required, as some things in AWT don't work exactly consistently cross-OS 9 | * (AWT frame size is the first thing that goes wrong, but also mouse grabbing 10 | * behavior). 11 | * 12 | * TODO: replace with Apache Commons library? 13 | * 14 | * @author velktron 15 | * 16 | */ 17 | 18 | public class OSValidator{ 19 | 20 | public static boolean isWindows(){ 21 | 22 | String os = System.getProperty("os.name").toLowerCase(); 23 | //windows 24 | return (os.indexOf( "win" ) >= 0); 25 | 26 | } 27 | 28 | public static boolean isMac(){ 29 | 30 | String os = System.getProperty("os.name").toLowerCase(); 31 | //Mac 32 | return (os.indexOf( "mac" ) >= 0); 33 | 34 | } 35 | 36 | public static boolean isUnix(){ 37 | 38 | String os = System.getProperty("os.name").toLowerCase(); 39 | //linux or unix 40 | return (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0); 41 | 42 | } 43 | 44 | public static boolean isUnknown(){ 45 | return (!isWindows() && !isUnix() && !isMac()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/doom/wbplayerstruct_t.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | 4 | // 5 | // INTERMISSION 6 | // Structure passed e.g. to WI_Start(wb) 7 | // 8 | 9 | public class wbplayerstruct_t implements Cloneable{ 10 | 11 | public wbplayerstruct_t(){ 12 | frags=new int[4]; 13 | } 14 | public boolean in; // whether the player is in game 15 | 16 | /** Player stats, kills, collected items etc. */ 17 | public int skills; 18 | public int sitems; 19 | public int ssecret; 20 | public int stime; 21 | public int[] frags; 22 | /** current score on entry, modified on return */ 23 | public int score; 24 | 25 | public wbplayerstruct_t clone(){ 26 | wbplayerstruct_t r=null; 27 | try { 28 | r = (wbplayerstruct_t)super.clone(); 29 | } catch (CloneNotSupportedException e) { 30 | e.printStackTrace(); 31 | } 32 | /*r.in=this.in; 33 | r.skills=this.skills; 34 | r.sitems=this.sitems; 35 | r.ssecret=this.ssecret; 36 | r.stime=this.stime; */ 37 | System.arraycopy(this.frags, 0, r.frags,0,r.frags.length); 38 | // r.score=this.score; 39 | 40 | 41 | return r; 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/data/mapsector_t.java: -------------------------------------------------------------------------------- 1 | package data; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | 10 | /** Sector definition, from editing. */ 11 | public class mapsector_t implements CacheableDoomObject { 12 | 13 | public mapsector_t(){ 14 | 15 | } 16 | 17 | public short floorheight; 18 | public short ceilingheight; 19 | public String floorpic; 20 | public String ceilingpic; 21 | public short lightlevel; 22 | public short special; 23 | public short tag; 24 | @Override 25 | public void unpack(ByteBuffer buf) 26 | throws IOException { 27 | buf.order(ByteOrder.LITTLE_ENDIAN); 28 | this.floorheight = buf.getShort(); 29 | this.ceilingheight = buf.getShort(); 30 | this.floorpic=DoomBuffer.getNullTerminatedString(buf,8).toUpperCase(); 31 | this.ceilingpic=DoomBuffer.getNullTerminatedString(buf,8).toUpperCase(); 32 | this.lightlevel= buf.getShort(); 33 | this.special= buf.getShort(); 34 | this.tag= buf.getShort(); 35 | } 36 | 37 | public static int sizeOf() { 38 | return 26; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/boom/ZNodeSegs.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.util.Arrays; 6 | import static utils.GenericCopy.malloc; 7 | import w.CacheableDoomObject; 8 | 9 | public class ZNodeSegs implements CacheableDoomObject { 10 | 11 | private static final byte[] DeepBSPHeader = { 12 | 'x', 'N', 'd', '4', 0, 0, 0, 0 13 | }; 14 | 15 | byte[] header; 16 | mapseg_znod_t[] nodes; 17 | int numnodes; 18 | 19 | public boolean formatOK() { 20 | return Arrays.equals(header, DeepBSPHeader); 21 | } 22 | 23 | public mapseg_znod_t[] getNodes() { 24 | return nodes; 25 | } 26 | 27 | @Override 28 | public void unpack(ByteBuffer buf) throws IOException { 29 | int length = buf.capacity(); 30 | 31 | // Too short, not even header. 32 | if (length < 8) { 33 | return; 34 | } 35 | 36 | numnodes = (length - 8) / mapnode_v4_t.sizeOf(); 37 | 38 | if (length < 1) { 39 | return; 40 | } 41 | 42 | buf.get(header); // read header 43 | 44 | nodes = malloc(mapseg_znod_t::new, mapseg_znod_t[]::new, length); 45 | 46 | for (int i = 0; i < length; i++) { 47 | nodes[i].unpack(buf); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/p/switchlist_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | // 10 | // P_SWITCH 11 | // 12 | 13 | public class switchlist_t 14 | implements CacheableDoomObject { 15 | 16 | public switchlist_t(){ 17 | 18 | } 19 | 20 | // Were char[9] 21 | public String name1; 22 | 23 | public String name2; 24 | 25 | public short episode; 26 | 27 | public switchlist_t(String name1, String name2, int episode) { 28 | super(); 29 | this.name1 = name1; 30 | this.name2 = name2; 31 | this.episode = (short) episode; 32 | } 33 | 34 | @Override 35 | public void unpack(ByteBuffer buf) 36 | throws IOException { 37 | // Like most Doom structs... 38 | buf.order(ByteOrder.LITTLE_ENDIAN); 39 | this.name1 = DoomBuffer.getNullTerminatedString(buf, 9); 40 | this.name2 = DoomBuffer.getNullTerminatedString(buf, 9); 41 | this.episode = buf.getShort(); 42 | } 43 | 44 | public final static int size() { 45 | return 20; 46 | } 47 | 48 | public String toString() { 49 | return String.format("%s %s %d", name1, name2, episode); 50 | } 51 | } -------------------------------------------------------------------------------- /src/boom/DeepBSPNodesV4.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.util.Arrays; 6 | import static utils.GenericCopy.malloc; 7 | import w.CacheableDoomObject; 8 | 9 | public class DeepBSPNodesV4 implements CacheableDoomObject { 10 | 11 | public static final byte[] DeepBSPHeader = { 12 | 'x', 'N', 'd', '4', 0, 0, 0, 0 13 | }; 14 | 15 | byte[] header = new byte[8]; 16 | mapnode_v4_t[] nodes; 17 | int numnodes; 18 | 19 | public boolean formatOK() { 20 | return Arrays.equals(header, DeepBSPHeader); 21 | } 22 | 23 | public mapnode_v4_t[] getNodes() { 24 | return nodes; 25 | } 26 | 27 | @Override 28 | public void unpack(ByteBuffer buf) throws IOException { 29 | int length = buf.capacity(); 30 | 31 | // Too short, not even header. 32 | if (length < 8) { 33 | return; 34 | } 35 | 36 | numnodes = (length - 8) / mapnode_v4_t.sizeOf(); 37 | 38 | if (length < 1) { 39 | return; 40 | } 41 | 42 | buf.get(header); // read header 43 | 44 | nodes = malloc(mapnode_v4_t::new, mapnode_v4_t[]::new, length); 45 | 46 | for (int i = 0; i < length; i++) { 47 | nodes[i].unpack(buf); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/i/i_main.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // $Log:$ 19 | // 20 | // DESCRIPTION: 21 | // Main program, simply calls D_DoomMain high level loop. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | static const char 26 | rcsid[] = "$Id: i_main.c,v 1.4 1997/02/03 22:45:10 b1 Exp $"; 27 | 28 | 29 | 30 | #include "doomdef.h" 31 | 32 | #include "m_argv.h" 33 | #include "d_main.h" 34 | 35 | int 36 | main 37 | ( int argc, 38 | char** argv ) 39 | { 40 | myargc = argc; 41 | myargv = argv; 42 | 43 | D_DoomMain (); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /src/s/IMusic.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | // 4 | 5 | import doom.CVarManager; 6 | import doom.CommandVariable; 7 | 8 | // MUSIC I/O 9 | // 10 | 11 | public interface IMusic { 12 | 13 | void InitMusic(); 14 | void ShutdownMusic(); 15 | // Volume. 16 | void SetMusicVolume(int volume); 17 | /** PAUSE game handling. */ 18 | void PauseSong(int handle); 19 | void ResumeSong(int handle); 20 | 21 | /** Registers a song handle to song data. 22 | * This should handle any conversions from MUS/MIDI/OPL/etc. 23 | * 24 | * */ 25 | int RegisterSong(byte[] data); 26 | 27 | 28 | /** Called by anything that wishes to start music. 29 | plays a song, and when the song is done, 30 | starts playing it again in an endless loop. 31 | Horrible thing to do, considering. */ 32 | 33 | void 34 | PlaySong 35 | ( int handle, 36 | boolean looping ); 37 | 38 | /** Stops a song over 3 seconds. */ 39 | void StopSong(int handle); 40 | 41 | /** See above (register), then think backwards */ 42 | void UnRegisterSong(int handle); 43 | 44 | public static IMusic chooseModule(CVarManager CVM) { 45 | if (CVM.bool(CommandVariable.NOMUSIC) || CVM.bool(CommandVariable.NOSOUND)) { 46 | return new DummyMusic(); 47 | } else { 48 | return new DavidMusicModule(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/w/CacheableDoomObjectContainer.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | 6 | /** A container allowing for caching of arrays of CacheableDoomObjects 7 | * 8 | * It's a massive improvement over the older system, allowing for proper 9 | * caching and auto-unpacking of arrays of CacheableDoomObjects and much 10 | * cleaner code throughout. 11 | * 12 | * The container itself is a CacheableDoomObject....can you feel the 13 | * abuse? ;-) 14 | * 15 | */ 16 | 17 | public class CacheableDoomObjectContainer implements CacheableDoomObject { 18 | 19 | private T[] stuff; 20 | 21 | public CacheableDoomObjectContainer(T[] stuff){ 22 | this.stuff=stuff; 23 | } 24 | 25 | public T[] getStuff(){ 26 | return stuff; 27 | } 28 | 29 | @Override 30 | public void unpack(ByteBuffer buf) throws IOException { 31 | for (int i = 0; i < stuff.length; i++) { 32 | stuff[i].unpack(buf); 33 | } 34 | } 35 | 36 | /** Statically usable method 37 | * 38 | * @param buf 39 | * @param stuff 40 | * @throws IOException 41 | */ 42 | 43 | public static void unpack(ByteBuffer buf, CacheableDoomObject[] stuff) throws IOException{ 44 | for (int i = 0; i < stuff.length; i++) { 45 | stuff[i].unpack(buf); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/w/wadheader_t.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.DataOutputStream; 5 | import java.io.IOException; 6 | 7 | public class wadheader_t implements IReadableDoomObject, IWritableDoomObject { 8 | public String type; 9 | public int numentries; 10 | public int tablepos; 11 | 12 | public boolean big_endian=false; 13 | 14 | public void read(DataInputStream f) throws IOException{ 15 | 16 | type=DoomIO.readNullTerminatedString(f,4); 17 | 18 | if (!big_endian){ 19 | numentries=(int) DoomIO.readUnsignedLEInt(f); 20 | tablepos=(int) DoomIO.readUnsignedLEInt(f); 21 | 22 | } else { 23 | numentries=f.readInt(); 24 | tablepos=f.readInt(); 25 | } 26 | 27 | } 28 | 29 | public static int sizeof(){ 30 | return 16; 31 | } 32 | 33 | @Override 34 | public void write(DataOutputStream dos) 35 | throws IOException { 36 | DoomIO.writeString(dos, type, 4); 37 | 38 | if (!big_endian){ 39 | DoomIO.writeLEInt(dos, (int) numentries); 40 | DoomIO.writeLEInt(dos, (int) tablepos); 41 | } else { 42 | dos.writeInt((int) numentries); 43 | dos.writeInt((int) tablepos); 44 | } 45 | 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/i/i_net.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // DESCRIPTION: 19 | // System specific network interface stuff. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __I_NET__ 25 | #define __I_NET__ 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma interface 30 | #endif 31 | 32 | 33 | 34 | // Called by D_DoomMain. 35 | 36 | 37 | void I_InitNetwork (void); 38 | void I_NetCmd (void); 39 | 40 | 41 | #endif 42 | //----------------------------------------------------------------------------- 43 | // 44 | // $Log:$ 45 | // 46 | //----------------------------------------------------------------------------- 47 | -------------------------------------------------------------------------------- /src/rr/spritedef_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** 4 | * A sprite definition: 5 | * a number of animation frames. 6 | */ 7 | 8 | public class spritedef_t { 9 | 10 | /** the very least, primitive fields won't bomb, 11 | * and copy constructors can do their job. 12 | */ 13 | public spritedef_t(){ 14 | } 15 | 16 | public spritedef_t(int numframes){ 17 | this.numframes=numframes; 18 | this.spriteframes=new spriteframe_t[numframes]; 19 | } 20 | 21 | public spritedef_t(spriteframe_t[] frames){ 22 | this.numframes=frames.length; 23 | this.spriteframes=new spriteframe_t[numframes]; 24 | // copy shit over... 25 | for (int i=0;i 16 | { 17 | 18 | private static final boolean D=false; 19 | 20 | public ObjectQueuePool(long expirationTime) 21 | { 22 | locked = new Stack(); 23 | 24 | } 25 | 26 | protected abstract K create(); 27 | 28 | public abstract boolean validate(K obj); 29 | 30 | public abstract void expire(K obj); 31 | 32 | public void drain(){ 33 | locked.clear(); 34 | } 35 | 36 | public K checkOut() 37 | { 38 | 39 | K t; 40 | if(!locked.isEmpty()) 41 | { 42 | return locked.pop(); 43 | 44 | } 45 | 46 | t = create(); 47 | return t; 48 | } 49 | 50 | public void checkIn(K t) 51 | { 52 | if (D) if (t instanceof mobj_t) 53 | System.out.printf("Object %s returned to the pool\n",t.toString()); 54 | locked.push(t); 55 | } 56 | 57 | protected Stack locked; 58 | // private Hashtable unlocked; 59 | } 60 | -------------------------------------------------------------------------------- /src/rr/subsector_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import p.Resettable; 4 | 5 | /** 6 | * 7 | * A SubSector. References a Sector. Basically, this is a list of LineSegs, 8 | * indicating the visible walls that define (all or some) sides of a convex BSP 9 | * leaf. 10 | * 11 | * @author admin 12 | */ 13 | public class subsector_t implements Resettable{ 14 | 15 | public subsector_t() { 16 | this(null, 0, 0); 17 | } 18 | 19 | public subsector_t(sector_t sector, int numlines, int firstline) { 20 | this.sector = sector; 21 | this.numlines = numlines; 22 | this.firstline = firstline; 23 | } 24 | 25 | // Maes: single pointer 26 | public sector_t sector; 27 | // e6y: support for extended nodes 28 | // 'int' instead of 'short' 29 | public int numlines; 30 | public int firstline; 31 | 32 | public String toString(){ 33 | sb.setLength(0); 34 | sb.append("Subsector"); 35 | sb.append('\t'); 36 | sb.append("Sector: "); 37 | sb.append(sector); 38 | sb.append('\t'); 39 | sb.append("numlines "); 40 | sb.append(numlines); 41 | sb.append('\t'); 42 | sb.append("firstline "); 43 | sb.append(firstline); 44 | return sb.toString(); 45 | 46 | 47 | } 48 | 49 | private static StringBuilder sb=new StringBuilder(); 50 | 51 | @Override 52 | public void reset() { 53 | sector=null; 54 | firstline=numlines=0; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/rr/drawfuns/DoomSpanFunction.java: -------------------------------------------------------------------------------- 1 | package rr.drawfuns; 2 | 3 | import i.IDoomSystem; 4 | 5 | public abstract class DoomSpanFunction implements SpanFunction { 6 | 7 | protected final boolean RANGECHECK=false; 8 | protected final int SCREENWIDTH; 9 | protected final int SCREENHEIGHT; 10 | protected SpanVars dsvars; 11 | protected final int[] ylookup; 12 | protected final int[] columnofs; 13 | protected final V screen; 14 | protected final IDoomSystem I; 15 | 16 | public DoomSpanFunction(int sCREENWIDTH, int sCREENHEIGHT, 17 | int[] ylookup, int[] columnofs,SpanVars dsvars, V screen,IDoomSystem I) { 18 | SCREENWIDTH = sCREENWIDTH; 19 | SCREENHEIGHT = sCREENHEIGHT; 20 | this.ylookup=ylookup; 21 | this.columnofs=columnofs; 22 | this.dsvars = dsvars; 23 | this.screen = screen; 24 | this.I=I; 25 | } 26 | 27 | protected final void doRangeCheck(){ 28 | if (dsvars.ds_x2 < dsvars.ds_x1 || dsvars.ds_x1 < 0 || dsvars.ds_x2 >= SCREENWIDTH 29 | || dsvars.ds_y > SCREENHEIGHT) { 30 | I.Error("R_DrawSpan: %d to %d at %d", dsvars.ds_x1, dsvars.ds_x2, dsvars.ds_y); 31 | } 32 | } 33 | 34 | @Override 35 | public final void invoke(SpanVars dsvars) { 36 | this.dsvars=dsvars; 37 | invoke(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/data/mapsidedef_t.java: -------------------------------------------------------------------------------- 1 | package data; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | 10 | /** 11 | * A SideDef, defining the visual appearance of a wall, by setting textures and 12 | * offsets. ON-DISK. 13 | */ 14 | 15 | public class mapsidedef_t implements CacheableDoomObject{ 16 | 17 | public mapsidedef_t() { 18 | 19 | } 20 | 21 | public short textureoffset; 22 | 23 | public short rowoffset; 24 | 25 | // 8-char strings. 26 | public String toptexture; 27 | 28 | public String bottomtexture; 29 | 30 | public String midtexture; 31 | 32 | /** Front sector, towards viewer. */ 33 | public short sector; 34 | 35 | public static int sizeOf() { 36 | return 30; 37 | } 38 | 39 | @Override 40 | public void unpack(ByteBuffer buf) 41 | throws IOException { 42 | buf.order(ByteOrder.LITTLE_ENDIAN); 43 | this.textureoffset = buf.getShort(); 44 | this.rowoffset = buf.getShort(); 45 | this.toptexture=DoomBuffer.getNullTerminatedString(buf,8).toUpperCase(); 46 | this.bottomtexture=DoomBuffer.getNullTerminatedString(buf,8).toUpperCase(); 47 | this.midtexture=DoomBuffer.getNullTerminatedString(buf,8).toUpperCase(); 48 | this.sector = buf.getShort(); 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/s/DummySFX.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | import data.sfxinfo_t; 4 | 5 | public class DummySFX implements ISoundDriver { 6 | 7 | @Override 8 | public boolean InitSound() { 9 | // Dummy is super-reliable ;-) 10 | return true; 11 | } 12 | 13 | @Override 14 | public void UpdateSound() { 15 | // TODO Auto-generated method stub 16 | 17 | } 18 | 19 | @Override 20 | public void SubmitSound() { 21 | // TODO Auto-generated method stub 22 | 23 | } 24 | 25 | @Override 26 | public void ShutdownSound() { 27 | // TODO Auto-generated method stub 28 | 29 | } 30 | 31 | @Override 32 | public int GetSfxLumpNum(sfxinfo_t sfxinfo) { 33 | // TODO Auto-generated method stub 34 | return 0; 35 | } 36 | 37 | @Override 38 | public int StartSound(int id, int vol, int sep, int pitch, int priority) { 39 | // TODO Auto-generated method stub 40 | return 0; 41 | } 42 | 43 | @Override 44 | public void StopSound(int handle) { 45 | // TODO Auto-generated method stub 46 | 47 | } 48 | 49 | @Override 50 | public boolean SoundIsPlaying(int handle) { 51 | // TODO Auto-generated method stub 52 | return false; 53 | } 54 | 55 | @Override 56 | public void UpdateSoundParams(int handle, int vol, int sep, int pitch) { 57 | // TODO Auto-generated method stub 58 | 59 | } 60 | 61 | @Override 62 | public void SetChannels(int numChannels) { 63 | // TODO Auto-generated method stub 64 | 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/data/mapseg_t.java: -------------------------------------------------------------------------------- 1 | package data; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | import w.CacheableDoomObject; 7 | 8 | /** 9 | * LineSeg, generated by splitting LineDefs 10 | * using partition lines selected by BSP builder. 11 | * MAES: this is the ON-DISK structure. The corresponding memory structure, 12 | * segs_t, has fixed_t members. 13 | */ 14 | 15 | public class mapseg_t implements CacheableDoomObject{ 16 | 17 | public mapseg_t(){ 18 | 19 | } 20 | 21 | public char v1; 22 | public char v2; 23 | public char angle; 24 | public char linedef; 25 | public char side; 26 | public char offset; 27 | 28 | public static int sizeOf(){ 29 | return 12; 30 | } 31 | 32 | @Override 33 | public void unpack(ByteBuffer buf) 34 | throws IOException { 35 | buf.order(ByteOrder.LITTLE_ENDIAN); 36 | this.v1 = buf.getChar(); 37 | this.v2 = buf.getChar(); 38 | this.angle=buf.getChar(); 39 | this.linedef=buf.getChar(); 40 | this.side=buf.getChar(); 41 | this.offset=buf.getChar(); 42 | 43 | } 44 | 45 | public String toString(){ 46 | return String.format("mapseg_t v1,2: %d %d ang: %d ld: %d sd: %d off: %d", 47 | (int)v1,(int)v2,(int)angle,(int)linedef,(int)side,(int)offset); 48 | } 49 | 50 | }; 51 | -------------------------------------------------------------------------------- /src/v/graphics/Horizontal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Good Sign 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package v.graphics; 18 | 19 | /** 20 | * Horizontal represents a range from a screen buffer (byte or short or int array) 21 | * 22 | * @author Good Sign 23 | */ 24 | public class Horizontal { 25 | 26 | public int start; 27 | public int length; 28 | 29 | public Horizontal() { 30 | } 31 | 32 | public Horizontal(int start, int length) { 33 | this.start = start; 34 | this.length = length; 35 | } 36 | 37 | public Relocation relocate(int amount) { 38 | return new Relocation(start, start + amount, length); 39 | } 40 | 41 | public void shift(int amount) { 42 | this.start += amount; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/s/DoomSound.java: -------------------------------------------------------------------------------- 1 | package s; 2 | 3 | import javax.sound.sampled.AudioFormat; 4 | import javax.sound.sampled.AudioFormat.Encoding; 5 | 6 | import data.sfxinfo_t; 7 | 8 | /** A class representing a sample in memory 9 | * Convenient for wrapping/mirroring it regardless of what it represents. 10 | * */ 11 | class DoomSound extends sfxinfo_t { 12 | 13 | /** This audio format is the one used by internal samples (16 bit, 11KHz, Stereo) 14 | * for Clips and AudioLines. Sure, it's not general enough... who cares though? 15 | */ 16 | public final static AudioFormat DEFAULT_SAMPLES_FORMAT=new AudioFormat(Encoding.PCM_SIGNED, ISoundDriver.SAMPLERATE, 16, 2, 4, ISoundDriver.SAMPLERATE, true); 17 | 18 | public final static AudioFormat DEFAULT_DOOM_FORMAT=new AudioFormat(Encoding.PCM_UNSIGNED, ISoundDriver.SAMPLERATE, 8, 1, 1, ISoundDriver.SAMPLERATE, true); 19 | 20 | 21 | public AudioFormat format; 22 | 23 | public DoomSound(AudioFormat format) { 24 | this.format=format; 25 | } 26 | 27 | public DoomSound(){ 28 | this.format=DEFAULT_DOOM_FORMAT; 29 | } 30 | 31 | public DoomSound(sfxinfo_t sfx,AudioFormat format){ 32 | this(format); 33 | this.data=sfx.data; 34 | this.pitch=sfx.pitch; 35 | this.link=sfx.link; 36 | this.lumpnum=sfx.lumpnum; 37 | this.name=sfx.name; 38 | this.priority=sfx.priority; 39 | this.singularity=sfx.singularity; 40 | this.usefulness=sfx.usefulness; 41 | this.volume=sfx.volume; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/v/renderers/DoomScreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Good Sign 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package v.renderers; 18 | 19 | import java.lang.reflect.Array; 20 | import java.util.Arrays; 21 | import java.util.EnumMap; 22 | import java.util.Map; 23 | 24 | /** 25 | * 26 | * @author Good Sign 27 | */ 28 | public enum DoomScreen { 29 | FG, BG, WS, WE, SB; 30 | 31 | @SuppressWarnings("unchecked") 32 | static Map mapScreensToBuffers(Class bufferType, int bufferLen) { 33 | return Arrays.stream(values()) 34 | .collect(() -> new EnumMap<>(DoomScreen.class), 35 | (map, screen) -> map.put(screen, (V) Array.newInstance(bufferType.getComponentType(), bufferLen)), 36 | EnumMap::putAll); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/boom/mapnode_znod_t.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | 10 | public class mapnode_znod_t implements CacheableDoomObject { 11 | 12 | 13 | public short x; // Partition line from (x,y) to x+dx,y+dy) 14 | public short y; 15 | public short dx; 16 | public short dy; 17 | // Bounding box for each child, clip against view frustum. 18 | public short[][] bbox; 19 | // If NF_SUBSECTOR its a subsector, else it's a node of another subtree. 20 | public int[] children; 21 | 22 | public mapnode_znod_t(){ 23 | this.bbox = new short[2][4]; 24 | this.children = new int[2]; 25 | } 26 | 27 | public static final int sizeOf() { 28 | return (8 + 16 + 8); 29 | } 30 | 31 | @Override 32 | public void unpack(ByteBuffer buf) 33 | throws IOException { 34 | buf.order(ByteOrder.LITTLE_ENDIAN); 35 | this.x = buf.getShort(); 36 | this.y = buf.getShort(); 37 | this.dx = buf.getShort(); 38 | this.dy = buf.getShort(); 39 | DoomBuffer.readShortArray(buf, this.bbox[0], 4); 40 | DoomBuffer.readShortArray(buf, this.bbox[1], 4); 41 | DoomBuffer.readIntArray(buf, this.children, 2); 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/boom/mapnode_v4_t.java: -------------------------------------------------------------------------------- 1 | package boom; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | 10 | /** BSP Node structure on-disk */ 11 | public class mapnode_v4_t 12 | implements CacheableDoomObject { 13 | 14 | public mapnode_v4_t() { 15 | this.bbox = new short[2][4]; 16 | this.children = new int[2]; 17 | } 18 | 19 | /** Partition line from (x,y) to x+dx,y+dy) */ 20 | public short x, y, dx, dy; 21 | 22 | /** Bounding box for each child, clip against view frustum. */ 23 | public short[][] bbox; 24 | 25 | /** If NF_SUBSECTOR its a subsector, else it's a node of another subtree. 26 | * In simpler words: if the first bit is set, strip it and use the rest 27 | * as a subtree index. Else it's a node index. 28 | * */ 29 | public int[] children = new int[2]; 30 | 31 | public static final int sizeOf() { 32 | return (8 + 16 + 8); 33 | } 34 | 35 | @Override 36 | public void unpack(ByteBuffer buf) 37 | throws IOException { 38 | buf.order(ByteOrder.LITTLE_ENDIAN); 39 | this.x = buf.getShort(); 40 | this.y = buf.getShort(); 41 | this.dx = buf.getShort(); 42 | this.dy = buf.getShort(); 43 | DoomBuffer.readShortArray(buf, this.bbox[0], 4); 44 | DoomBuffer.readShortArray(buf, this.bbox[1], 4); 45 | DoomBuffer.readIntArray(buf, this.children, 2); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/data/mapnode_t.java: -------------------------------------------------------------------------------- 1 | package data; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | 10 | /** BSP Node structure on-disk */ 11 | public class mapnode_t 12 | implements CacheableDoomObject { 13 | 14 | public mapnode_t() { 15 | this.bbox = new short[2][4]; 16 | this.children = new char[2]; 17 | } 18 | 19 | /** Partition line from (x,y) to x+dx,y+dy) */ 20 | public short x, y, dx, dy; 21 | 22 | /** Bounding box for each child, clip against view frustum. */ 23 | public short[][] bbox; 24 | 25 | /** If NF_SUBSECTOR its a subsector, else it's a node of another subtree. 26 | * In simpler words: if the first bit is set, strip it and use the rest 27 | * as a subtree index. Else it's a node index. 28 | * */ 29 | public char[] children = new char[2]; // MAES: used to be unsigned short. 30 | 31 | public static int sizeOf() { 32 | return (8 + 16 + 4); 33 | } 34 | 35 | @Override 36 | public void unpack(ByteBuffer buf) 37 | throws IOException { 38 | buf.order(ByteOrder.LITTLE_ENDIAN); 39 | this.x = buf.getShort(); 40 | this.y = buf.getShort(); 41 | this.dx = buf.getShort(); 42 | this.dy = buf.getShort(); 43 | DoomBuffer.readShortArray(buf, this.bbox[0], 4); 44 | DoomBuffer.readShortArray(buf, this.bbox[1], 4); 45 | DoomBuffer.readCharArray(buf, this.children, 2); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/rr/vissprite_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | 4 | /** A vissprite_t is a thing 5 | * that will be drawn during a refresh. 6 | * I.e. a sprite object that is partly visible. 7 | */ 8 | 9 | public class vissprite_t implements Comparable>{ 10 | 11 | // Doubly linked list. 12 | public vissprite_t prev; 13 | public vissprite_t next; 14 | 15 | public int x1; 16 | public int x2; 17 | 18 | // for line side calculation 19 | public int gx; 20 | public int gy; 21 | 22 | // global bottom / top for silhouette clipping 23 | public int gz; 24 | public int gzt; 25 | 26 | // horizontal position of x1 27 | public int startfrac; 28 | 29 | public int scale; 30 | 31 | // negative if flipped 32 | public int xiscale; 33 | 34 | public int texturemid; 35 | public int patch; 36 | 37 | /** for color translation and shadow draw, 38 | * maxbright frames as well. 39 | * 40 | * Use paired with pcolormap; 41 | */ 42 | public V colormap; 43 | 44 | /* pointer into colormap 45 | public int pcolormap; */ 46 | 47 | public long mobjflags; 48 | 49 | /** visspites are sorted by scale */ 50 | 51 | @Override 52 | public final int compareTo(vissprite_t o) { 53 | // We only really care if it's drawn before. 54 | if (this.scale> o.scale) return 1; 55 | if (this.scale< o.scale) return -1; 56 | return 0; 57 | } 58 | 59 | public String toString(){ 60 | return ("Effective drawing position x1: "+x1 + " x2: "+ x2 +" scale "+(scale/65535.0) +" iscale "+(xiscale/65535.0)); 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /src/p/ChaseDirections.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import static m.fixed_t.MAPFRACUNIT; 4 | import static data.Defines.TIC_MUL; 5 | 6 | public final class ChaseDirections { 7 | 8 | public static final int DI_EAST = 0; 9 | 10 | public static final int DI_NORTHEAST = 1; 11 | 12 | public static final int DI_NORTH = 2; 13 | 14 | public static final int DI_NORTHWEST = 3; 15 | 16 | public static final int DI_WEST = 4; 17 | 18 | public static final int DI_SOUTHWEST = 5; 19 | 20 | public static final int DI_SOUTH = 6; 21 | 22 | public static final int DI_SOUTHEAST = 7; 23 | 24 | public static final int DI_NODIR = 8; 25 | 26 | public static final int NUMDIR = 9; 27 | 28 | // 29 | // P_NewChaseDir related LUT. 30 | // 31 | public final static int opposite[] = 32 | { DI_WEST, DI_SOUTHWEST, DI_SOUTH, DI_SOUTHEAST, DI_EAST, DI_NORTHEAST, 33 | DI_NORTH, DI_NORTHWEST, DI_NODIR }; 34 | 35 | public final static int diags[] = 36 | { DI_NORTHWEST, DI_NORTHEAST, DI_SOUTHWEST, DI_SOUTHEAST }; 37 | 38 | public final static int[] xspeed = 39 | { MAPFRACUNIT, 47000/TIC_MUL, 0, -47000/TIC_MUL, -MAPFRACUNIT, -47000/TIC_MUL, 0, 47000/TIC_MUL }; // all 40 | // fixed 41 | 42 | public final static int[] yspeed = 43 | { 0, 47000/TIC_MUL, MAPFRACUNIT, 47000/TIC_MUL, 0, -47000/TIC_MUL, -MAPFRACUNIT, -47000/TIC_MUL }; // all 44 | // fixed 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/data/doomtype.java: -------------------------------------------------------------------------------- 1 | package data; 2 | // Emacs style mode select -*- C++ -*- 3 | //----------------------------------------------------------------------------- 4 | // 5 | // $Id: doomtype.java,v 1.3 2011/02/11 00:11:13 velktron Exp $ 6 | // 7 | // Copyright (C) 1993-1996 by id Software, Inc. 8 | // 9 | // This program is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // DESCRIPTION: 20 | // Simple basic typedefs, isolated here to make it easier 21 | // separating modules. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | 26 | public class doomtype { 27 | 28 | // C's "chars" are actually Java signed bytes. 29 | public static byte MAXCHAR =((byte)0x7f); 30 | public static short MAXSHORT= ((short)0x7fff); 31 | 32 | // Max pos 32-bit int. 33 | public static int MAXINT=((int)0x7fffffff); 34 | public static long MAXLONG=((long)0x7fffffff); 35 | public static byte MINCHAR=((byte)0x80); 36 | public static short MINSHORT=((short)0x8000); 37 | 38 | // Max negative 32-bit integer. 39 | public static int MININT=((int)0x80000000); 40 | public static long MINLONG=((long)0x80000000); 41 | } -------------------------------------------------------------------------------- /src/rr/texture_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | 4 | /** A maptexturedef_t describes a rectangular texture, 5 | * which is composed of one or more mappatch_t structures 6 | * that arrange graphic patches. 7 | * 8 | * This is the in-memory format, which is similar to maptexture_t (which is on-disk). 9 | * 10 | * @author Maes 11 | * 12 | */ 13 | 14 | public class texture_t { 15 | /** Keep name for switch changing, etc. */ 16 | public String name; 17 | public short width; 18 | public short height; 19 | 20 | // All the patches[patchcount] 21 | // are drawn back to front into the cached texture. 22 | public short patchcount; 23 | public texpatch_t[] patches; 24 | 25 | /** Unmarshalling at its best! */ 26 | 27 | public void copyFromMapTexture(maptexture_t mt){ 28 | this.name=new String(mt.name); 29 | this.width=mt.width; 30 | this.height=mt.height; 31 | this.patchcount=mt.patchcount; 32 | this.patches=new texpatch_t[patchcount]; 33 | 34 | for (int i=0;i. 16 | */ 17 | package p.Actions.ActiveStates; 18 | 19 | import p.Actions.ActiveStates.MonsterStates.Bosses; 20 | import p.Actions.ActiveStates.MonsterStates.Demonspawns; 21 | import p.Actions.ActiveStates.MonsterStates.HorrendousVisages; 22 | import p.Actions.ActiveStates.MonsterStates.Mancubi; 23 | import p.Actions.ActiveStates.MonsterStates.PainsSouls; 24 | import p.Actions.ActiveStates.MonsterStates.Skels; 25 | import p.Actions.ActiveStates.MonsterStates.Spiders; 26 | import p.Actions.ActiveStates.MonsterStates.Viles; 27 | import p.Actions.ActiveStates.MonsterStates.Zombies; 28 | 29 | /** 30 | * Include all from Monsters package 31 | * 32 | * @author Good Sign 33 | */ 34 | public interface Monsters extends 35 | Bosses, 36 | Demonspawns, 37 | HorrendousVisages, 38 | Mancubi, 39 | PainsSouls, 40 | Skels, 41 | Spiders, 42 | Viles, 43 | Zombies 44 | { 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/utils/QuoteType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Good Sign 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package utils; 18 | 19 | import java.util.Optional; 20 | 21 | /** 22 | * @author Good Sign 23 | */ 24 | public enum QuoteType { 25 | SINGLE('\''), DOUBLE('"'); 26 | public final char quoteChar; 27 | 28 | QuoteType(final char quoteChar) { 29 | this.quoteChar = quoteChar; 30 | } 31 | 32 | public boolean isQuoted(final String s) { 33 | return C2JUtils.isQuoted(s, quoteChar); 34 | } 35 | 36 | public String unQuote(final String s) { 37 | return C2JUtils.unquote(s, quoteChar); 38 | } 39 | 40 | public static Optional getQuoteType(final String stringSource) { 41 | if (stringSource.length() > 2) { 42 | for (final QuoteType type: QuoteType.values()) { 43 | if (type.isQuoted(stringSource)) { 44 | return Optional.of(type); 45 | } 46 | } 47 | } 48 | 49 | return Optional.empty(); 50 | } 51 | } -------------------------------------------------------------------------------- /src/v/graphics/Relocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Good Sign 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package v.graphics; 18 | 19 | /** 20 | * Relocation represents a move of a fixed length of bytes/shorts/ints 21 | * from one range in screen buffer to another range of the same size 22 | * 23 | * @author Good Sign 24 | */ 25 | public final class Relocation { 26 | 27 | public int source; 28 | public int destination; 29 | public int length; 30 | 31 | public Relocation() { 32 | } 33 | 34 | public Relocation(int source, int destination, int length) { 35 | this.source = source; 36 | this.destination = destination; 37 | this.length = length; 38 | } 39 | 40 | public Relocation shift(int amount) { 41 | this.source += amount; 42 | this.destination += amount; 43 | return this; 44 | } 45 | 46 | public Relocation retarget(int source, int destination) { 47 | this.source = source; 48 | this.destination = destination; 49 | return this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/i/Strings.java: -------------------------------------------------------------------------------- 1 | package i; 2 | 3 | public final class Strings { 4 | public static final String MOCHA_DOOM_TITLE="Mocha Doom Alpha 1.6"; 5 | 6 | public static final String MODIFIED_GAME= 7 | ("===========================================================================\n"+ 8 | "ATTENTION: This version of DOOM has been modified. If you would like to\n"+ 9 | "get a copy of the original game, call 1-800-IDGAMES or see the readme file.\n"+ 10 | " You will not receive technical support for modified games.\n"+ 11 | " press enter to continue\n"+ 12 | "===========================================================================\n"); 13 | 14 | public static final String MODIFIED_GAME_TITLE="Modified game alert"; 15 | 16 | public static final String MODIFIED_GAME_DIALOG= 17 | 18 | ("
"+ 19 | "===========================================================================
"+ 20 | "ATTENTION: This version of DOOM has been modified. If you would like to
"+ 21 | "get a copy of the original game, call 1-800-IDGAMES or see the readme file.
"+ 22 | " You will not receive technical support for modified games.
"+ 23 | " press OK to continue
"+ 24 | "===========================================================================
"+ 25 | "
"); 26 | 27 | public static final String LEVEL_FAILURE_TITLE="Level loading failure"; 28 | 29 | public static final String LEVEL_FAILURE_CAUSE= 30 | 31 | ("
"+ 32 | "Level loading failed!
"+ 33 | "Press OK to end this game without exiting, or cancel to quit Doom."+ 34 | "
"); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/rr/drawfuns/R_DrawColumnLow.java: -------------------------------------------------------------------------------- 1 | package rr.drawfuns; 2 | 3 | import i.IDoomSystem; 4 | import static m.fixed_t.FRACBITS; 5 | 6 | public final class R_DrawColumnLow extends DoomColumnFunction { 7 | 8 | public R_DrawColumnLow(int SCREENWIDTH, int SCREENHEIGHT, 9 | int[] ylookup, int[] columnofs, ColVars dcvars, 10 | short[] screen, IDoomSystem I) { 11 | super(SCREENWIDTH, SCREENHEIGHT, ylookup, columnofs, dcvars, screen, I); 12 | this.flags=DcFlags.LOW_DETAIL; 13 | } 14 | 15 | public void invoke() { 16 | int count; 17 | // MAES: were pointers. Of course... 18 | int dest, dest2; 19 | final byte[] dc_source=dcvars.dc_source; 20 | final short[] dc_colormap=dcvars.dc_colormap; 21 | final int dc_source_ofs=dcvars.dc_source_ofs; 22 | // Maes: fixed_t never used as such. 23 | int frac; 24 | final int fracstep; 25 | 26 | count = dcvars.dc_yh - dcvars.dc_yl; 27 | 28 | // Zero length. 29 | if (count < 0) 30 | return; 31 | 32 | if (RANGECHECK) { 33 | performRangeCheck(); 34 | } 35 | 36 | // The idea is to draw more than one pixel at a time. 37 | dest = blockyDest1(); 38 | dest2 = blockyDest2(); 39 | 40 | fracstep = dcvars.dc_iscale; 41 | frac = dcvars.dc_texturemid + (dcvars.dc_yl - dcvars.centery) * fracstep; 42 | // int spot=(frac >>> FRACBITS) & 127; 43 | do { 44 | 45 | // Hack. Does not work correctly. 46 | // MAES: that's good to know. 47 | screen[dest] = screen[dest2] = dc_colormap[0x00FF & dc_source[dc_source_ofs 48 | + ((frac >>> FRACBITS) & 127)]]; 49 | 50 | dest += SCREENWIDTH; 51 | dest2 += SCREENWIDTH; 52 | frac += fracstep; 53 | } while (count-- != 0); 54 | } 55 | } -------------------------------------------------------------------------------- /src/w/JadDecompress.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | public class JadDecompress { 4 | 5 | public final static int WINDOW_SIZE = 4096; 6 | 7 | public final static int LOOKAHEAD_SIZE = 16; 8 | 9 | public final static int LENSHIFT = 4; /* this must be log2(LOOKAHEAD_SIZE) */ 10 | 11 | public static void decode(byte[] input, byte[] output) { 12 | /* 13 | * #ifdef JAGUAR decomp_input = input; decomp_output = output; 14 | * gpufinished = zero; gpucodestart = (int)&decomp_start; while 15 | * (!I_RefreshCompleted () ) ; #else 16 | */ 17 | int getidbyte = 0; 18 | int len; 19 | int pos; 20 | int i; 21 | int source_ptr, input_ptr = 0, output_ptr = 0; 22 | int idbyte = 0; 23 | 24 | while (true) { 25 | 26 | /* get a new idbyte if necessary */ 27 | if (getidbyte == 0) idbyte = 0xFF & input[input_ptr++]; 28 | getidbyte = (getidbyte + 1) & 7; 29 | 30 | if ((idbyte & 1) != 0) { 31 | /* decompress */ 32 | pos = (0xFF & input[input_ptr++]) << LENSHIFT; 33 | pos = pos | ((0xFF & input[input_ptr]) >> LENSHIFT); 34 | source_ptr = output_ptr - pos - 1; 35 | 36 | len = ((0xFF & input[input_ptr++]) & 0xf) + 1; 37 | 38 | if (len == 1) 39 | break; 40 | for (i = 0; i < len; i++) 41 | output[output_ptr++] = output[source_ptr++]; 42 | } else { 43 | output[output_ptr++] = input[input_ptr++]; 44 | } 45 | 46 | idbyte = idbyte >> 1; 47 | 48 | } 49 | 50 | System.out.printf("Expanded %d to %d\n", input_ptr, output_ptr); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/rr/maptexture_t.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | import static utils.GenericCopy.malloc; 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | 10 | /** Texture definition. 11 | * A DOOM wall texture is a list of patches which are to be combined in a predefined order. 12 | * This is the ON-DISK structure, to be read from the TEXTURES1 and TEXTURES2 lumps. 13 | * In memory, this becomes texture_t. 14 | * 15 | * @author MAES 16 | * 17 | */ 18 | 19 | public class maptexture_t implements CacheableDoomObject{ 20 | public String name; 21 | public boolean masked; 22 | public short width; // was signed byte 23 | public short height; // was 24 | //void**t columndirectory; // OBSOLETE (yeah, but we must read a dummy integer here) 25 | public short patchcount; 26 | public mappatch_t[] patches; 27 | 28 | 29 | @Override 30 | public void unpack(ByteBuffer buf) throws IOException { 31 | buf.order(ByteOrder.LITTLE_ENDIAN); 32 | name = DoomBuffer.getNullTerminatedString(buf, 8); 33 | masked = (buf.getInt() != 0); 34 | width = buf.getShort(); 35 | height = buf.getShort(); 36 | buf.getInt(); // read a dummy integer for obsolete columndirectory. 37 | patchcount = buf.getShort(); 38 | 39 | // Simple sanity check. Do not attempt reading more patches than there 40 | // are left in the TEXTURE lump. 41 | patchcount = (short) Math.min(patchcount, (buf.capacity() - buf.position()) / mappatch_t.size()); 42 | 43 | patches = malloc(mappatch_t::new, mappatch_t[]::new, patchcount); 44 | DoomBuffer.readObjectArray(buf, patches, patchcount); 45 | } 46 | }; -------------------------------------------------------------------------------- /src/i/i_video.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // DESCRIPTION: 19 | // System specific interface stuff. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __I_VIDEO__ 25 | #define __I_VIDEO__ 26 | 27 | 28 | #include "doomtype.h" 29 | 30 | #ifdef __GNUG__ 31 | #pragma interface 32 | #endif 33 | 34 | 35 | // Called by D_DoomMain, 36 | // determines the hardware configuration 37 | // and sets up the video mode 38 | void I_InitGraphics (void); 39 | 40 | 41 | void I_ShutdownGraphics(void); 42 | 43 | // Takes full 8 bit values. 44 | void I_SetPalette (byte* palette); 45 | 46 | void I_UpdateNoBlit (void); 47 | void I_FinishUpdate (void); 48 | 49 | // Wait for vertical retrace or pause a bit. 50 | void I_WaitVBL(int count); 51 | 52 | void I_ReadScreen (byte* scr); 53 | 54 | void I_BeginRead (void); 55 | void I_EndRead (void); 56 | 57 | 58 | 59 | #endif 60 | //----------------------------------------------------------------------------- 61 | // 62 | // $Log:$ 63 | // 64 | //----------------------------------------------------------------------------- 65 | -------------------------------------------------------------------------------- /src/automap/IAutoMap.java: -------------------------------------------------------------------------------- 1 | package automap; 2 | 3 | import doom.SourceCode.AM_Map; 4 | import static doom.SourceCode.AM_Map.AM_Responder; 5 | import static doom.SourceCode.AM_Map.AM_Stop; 6 | import doom.event_t; 7 | 8 | public interface IAutoMap { 9 | // Used by ST StatusBar stuff. 10 | public final int AM_MSGHEADER =(('a'<<24)+('m'<<16)); 11 | public final int AM_MSGENTERED= (AM_MSGHEADER | ('e'<<8)); 12 | public final int AM_MSGEXITED= (AM_MSGHEADER | ('x'<<8)); 13 | 14 | // Color ranges for automap. Actual colors are bit-depth dependent. 15 | 16 | public final int REDRANGE= 16; 17 | public final int BLUERANGE =8; 18 | public final int GREENRANGE =16; 19 | public final int GRAYSRANGE =16; 20 | public final int BROWNRANGE =16; 21 | public final int YELLOWRANGE =1; 22 | 23 | public final int YOURRANGE =0; 24 | public final int WALLRANGE =REDRANGE; 25 | public final int TSWALLRANGE =GRAYSRANGE; 26 | public final int FDWALLRANGE =BROWNRANGE; 27 | public final int CDWALLRANGE =YELLOWRANGE; 28 | public final int THINGRANGE =GREENRANGE; 29 | public final int SECRETWALLRANGE =WALLRANGE; 30 | public final int GRIDRANGE =0; 31 | 32 | // Called by main loop. 33 | @AM_Map.C(AM_Responder) 34 | public boolean Responder(event_t ev); 35 | 36 | // Called by main loop. 37 | public void Ticker(); 38 | 39 | // Called by main loop, 40 | // called instead of view drawer if automap active. 41 | public void Drawer (); 42 | 43 | // Added to be informed of gamma changes - Good Sign 2017/04/05 44 | public void Repalette(); 45 | 46 | // Called to force the automap to quit 47 | // if the level is completed while it is up. 48 | @AM_Map.C(AM_Stop) 49 | public void Stop(); 50 | 51 | public void Start(); 52 | } 53 | -------------------------------------------------------------------------------- /src/m/DummyMenu.java: -------------------------------------------------------------------------------- 1 | package m; 2 | 3 | import doom.DoomMain; 4 | import doom.event_t; 5 | 6 | /** A dummy menu, useful for testers that do need a defined 7 | * menu object. 8 | * 9 | * @author Maes 10 | * 11 | */ 12 | 13 | public class DummyMenu extends AbstractDoomMenu { 14 | public DummyMenu(DoomMain DOOM) { 15 | super(DOOM); 16 | } 17 | 18 | @Override 19 | public boolean Responder(event_t ev) { 20 | // TODO Auto-generated method stub 21 | return false; 22 | } 23 | 24 | @Override 25 | public void Ticker() { 26 | // TODO Auto-generated method stub 27 | 28 | } 29 | 30 | @Override 31 | public void Drawer() { 32 | // TODO Auto-generated method stub 33 | 34 | } 35 | 36 | @Override 37 | public void Init() { 38 | // TODO Auto-generated method stub 39 | 40 | } 41 | 42 | @Override 43 | public void StartControlPanel() { 44 | // TODO Auto-generated method stub 45 | 46 | } 47 | 48 | @Override 49 | public boolean getShowMessages() { 50 | // TODO Auto-generated method stub 51 | return false; 52 | } 53 | 54 | @Override 55 | public void setShowMessages(boolean val) { 56 | // TODO Auto-generated method stub 57 | 58 | } 59 | 60 | @Override 61 | public int getScreenBlocks() { 62 | // TODO Auto-generated method stub 63 | return 0; 64 | } 65 | 66 | @Override 67 | public void setScreenBlocks(int val) { 68 | // TODO Auto-generated method stub 69 | 70 | } 71 | 72 | @Override 73 | public int getDetailLevel() { 74 | // TODO Auto-generated method stub 75 | return 0; 76 | } 77 | 78 | @Override 79 | public void ClearMenus() { 80 | // TODO Auto-generated method stub 81 | 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/timing/DelegateTicker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Good Sign 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package timing; 18 | 19 | /** 20 | * 21 | * @author Good Sign 22 | */ 23 | public class DelegateTicker implements ITicker { 24 | private final FastTicker ft = new FastTicker(); 25 | private final MilliTicker mt = new MilliTicker(); 26 | private final NanoTicker nt = new NanoTicker(); 27 | private ITicker currentTicker = ft; 28 | 29 | @Override 30 | public int GetTime() { 31 | return currentTicker.GetTime(); 32 | } 33 | 34 | public void changeTicker() { 35 | if (currentTicker == nt) { 36 | currentTicker = mt; 37 | ((MilliTicker) currentTicker).basetime = 0; 38 | ((MilliTicker) currentTicker).oldtics = 0; 39 | } else if (currentTicker == mt) { 40 | currentTicker = ft; 41 | ((FastTicker) currentTicker).fasttic = 0; 42 | } else { 43 | currentTicker = nt; 44 | ((NanoTicker) currentTicker).basetime = 0; 45 | ((NanoTicker) currentTicker).oldtics = 0; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/p/vldoor_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | import java.nio.ByteBuffer; 6 | 7 | import rr.SectorAction; 8 | import w.DoomIO; 9 | import w.IReadableDoomObject; 10 | 11 | public class vldoor_t extends SectorAction implements IReadableDoomObject{ 12 | 13 | public vldoor_e type; 14 | /** fixed_t */ 15 | public int topheight, speed; 16 | 17 | /** 1 = up, 0 = waiting at top, -1 = down */ 18 | public int direction; 19 | 20 | /** tics to wait at the top */ 21 | public int topwait; 22 | 23 | /**(keep in case a door going down is reset) 24 | when it reaches 0, start going down */ 25 | public int topcountdown; 26 | 27 | @Override 28 | public void read(DataInputStream f) throws IOException{ 29 | 30 | super.read(f); // Call thinker reader first 31 | type=vldoor_e.values()[DoomIO.readLEInt(f)]; 32 | super.sectorid=DoomIO.readLEInt(f); // Sector index (or pointer?) 33 | topheight=DoomIO.readLEInt(f); 34 | speed=DoomIO.readLEInt(f); 35 | direction=DoomIO.readLEInt(f); 36 | topwait=DoomIO.readLEInt(f); 37 | topcountdown=DoomIO.readLEInt(f); 38 | } 39 | 40 | @Override 41 | public void pack(ByteBuffer b) throws IOException{ 42 | super.pack(b); //12 43 | b.putInt(type.ordinal()); // 16 44 | b.putInt(super.sectorid); // 20 45 | b.putInt(topheight); // 24 46 | b.putInt(speed); //28 47 | b.putInt(direction); // 32 48 | b.putInt(topwait); //36 49 | b.putInt(topcountdown); //40 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /src/doom/weaponinfo_t.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | import defines.*; 3 | 4 | // 5 | // PSPRITE ACTIONS for waepons. 6 | // This struct controls the weapon animations. 7 | // 8 | // Each entry is: 9 | // ammo/amunition type 10 | // upstate 11 | // downstate 12 | // readystate 13 | // atkstate, i.e. attack/fire/hit frame 14 | // flashstate, muzzle flash 15 | // 16 | 17 | public class weaponinfo_t { 18 | 19 | /* 20 | public weaponinfo_t(ammotype_t ammo, int upstate, int downstate, 21 | int readystate, int atkstate, int flashstate) { 22 | super(); 23 | this.ammo = ammo; 24 | this.upstate = upstate; 25 | this.downstate = downstate; 26 | this.readystate = readystate; 27 | this.atkstate = atkstate; 28 | this.flashstate = flashstate; 29 | }*/ 30 | public ammotype_t ammo; 31 | 32 | 33 | public weaponinfo_t(ammotype_t ammo, statenum_t upstate, 34 | statenum_t downstate, statenum_t readystate, 35 | statenum_t atkstate, statenum_t flashstate) { 36 | super(); 37 | this.ammo = ammo; 38 | this.upstate = upstate; 39 | this.downstate = downstate; 40 | this.readystate = readystate; 41 | this.atkstate = atkstate; 42 | this.flashstate = flashstate; 43 | } 44 | 45 | public statenum_t upstate; 46 | public statenum_t downstate; 47 | public statenum_t readystate; 48 | public statenum_t atkstate; 49 | public statenum_t flashstate; 50 | 51 | 52 | /* 53 | public int upstate; 54 | public int downstate; 55 | public int readystate; 56 | public int atkstate; 57 | public int flashstate; 58 | */ 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/p/Actions/ActiveStates/MonsterStates/Spiders.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1993-1996 by id Software, Inc. 3 | * Copyright (C) 2017 Good Sign 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package p.Actions.ActiveStates.MonsterStates; 19 | 20 | import data.mobjtype_t; 21 | import p.Actions.ActionTrait; 22 | import p.mobj_t; 23 | 24 | public interface Spiders extends ActionTrait { 25 | void A_FaceTarget(mobj_t actor); 26 | 27 | default void A_SpidRefire(mobj_t actor) { 28 | // keep firing unless target got out of sight 29 | A_FaceTarget(actor); 30 | 31 | if (P_Random() < 10) { 32 | return; 33 | } 34 | 35 | if (actor.target == null || actor.target.health <= 0 || !getEnemies().CheckSight(actor, actor.target)) { 36 | actor.SetMobjState(actor.info.seestate); 37 | } 38 | } 39 | 40 | default void A_BspiAttack(mobj_t actor) { 41 | if (actor.target == null) { 42 | return; 43 | } 44 | 45 | A_FaceTarget(actor); 46 | 47 | // launch a missile 48 | getAttacks().SpawnMissile(actor, actor.target, mobjtype_t.MT_ARACHPLAZ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/doom/DoomContext.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | /** Since a lot of stuff requires shared/global access to 4 | * the WadLoader, the Renderer, the Video system etc. and 5 | * we're trying to depart from the global/static mentality, 6 | * a common sharing is required. Ideally, this would be a perfect 7 | * example of where multiple inheritance could be adopted, since most 8 | * stuff needs to share this status anyway. The next best thing is 9 | * to have local references of any used fields in the classes that use them. 10 | * 11 | * About generics: T refers to the type of the graphics resources, and is 12 | * currently byte[], as all graphics resources are 8-bit indexed. There are 13 | * no plans that this will change anytime soon. Some classes should allow 14 | * different types in theory, but it would be too complex and pointless to 15 | * make everything fully compliant at the moment. 16 | * 17 | * V refers to the type of DISPLAY, and can be 8-bit (byte[]), 16-bit (short[] 18 | * for HiColor and lesser modes such as ARGB4444, etc.), and, in the future, 19 | * int[] (truecolor). 20 | * 21 | * The general approach is sharing as much code as possible between different 22 | * implementations (e.g. rendering code), and only specialize methods/classes when 23 | * the abstraction of generics isn't enough (typically, when you have to assign 24 | * directly to primitive arrays or deal with primitive method signatures). 25 | * 26 | * Classes that have specialized code for indexed and hicolor modes should be top-level 27 | * classes in their package, and contain two nested, static, extending classes called 28 | * Indexed and HiColor e.g. new MyClass.Indexed() and new MyClass.HiColor(), while any common 29 | * code should reside in MyClass. 30 | * 31 | * @author velktron 32 | * 33 | */ 34 | 35 | public final class DoomContext{ 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/p/floormove_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | import java.nio.ByteBuffer; 6 | 7 | import rr.SectorAction; 8 | import w.DoomIO; 9 | import w.IReadableDoomObject; 10 | 11 | public class floormove_t extends SectorAction implements IReadableDoomObject{ 12 | 13 | public floormove_t(){ 14 | // MAES HACK: floors are implied to be at least of "lowerFloor" type 15 | // unless set otherwise, due to implicit zero-enum value. 16 | this.type=floor_e.lowerFloor; 17 | } 18 | 19 | public floor_e type; 20 | public boolean crush; 21 | 22 | public int direction; 23 | public int newspecial; 24 | public short texture; 25 | /** fixed_t */ 26 | public int floordestheight; 27 | /** fixed_t */ 28 | public int speed; 29 | 30 | @Override 31 | public void read(DataInputStream f) throws IOException{ 32 | 33 | super.read(f); // Call thinker reader first 34 | type=floor_e.values()[DoomIO.readLEInt(f)]; 35 | crush=DoomIO.readIntBoolean(f); 36 | super.sectorid=DoomIO.readLEInt(f); // Sector index (or pointer?) 37 | direction=DoomIO.readLEInt(f); 38 | newspecial=DoomIO.readLEInt(f); 39 | texture=DoomIO.readLEShort(f); 40 | floordestheight=DoomIO.readLEInt(f); 41 | speed=DoomIO.readLEInt(f); 42 | } 43 | 44 | @Override 45 | public void pack(ByteBuffer b) throws IOException{ 46 | super.pack(b); //12 47 | b.putInt(type.ordinal()); // 16 48 | b.putInt(crush?1:0); //20 49 | b.putInt(super.sectorid); // 24 50 | b.putInt(direction); // 28 51 | b.putInt(newspecial); // 32 52 | b.putShort(texture); // 34 53 | b.putInt(floordestheight); // 38 54 | b.putInt(speed); // 42 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/f/Wiper.java: -------------------------------------------------------------------------------- 1 | package f; 2 | 3 | import v.graphics.Wipers; 4 | 5 | public interface Wiper { 6 | boolean ScreenWipe(Wipers.WipeType type, int x, int y, int width, int height, int ticks); 7 | 8 | boolean EndScreen(int x, int y, int width, int height); 9 | 10 | boolean StartScreen(int x, int y, int width, int height); 11 | 12 | public enum Wipe implements Wipers.WipeType { 13 | // simple gradual pixel change for 8-bit only 14 | // MAES: this transition isn't guaranteed to always terminate 15 | // see Chocolate Strife develpment. Unused in Doom anyway. 16 | ColorXForm( 17 | Wipers.WipeFunc.initColorXForm, 18 | Wipers.WipeFunc.doColorXForm, 19 | Wipers.WipeFunc.exitColorXForm 20 | ), 21 | // weird screen melt 22 | Melt( 23 | Wipers.WipeFunc.initMelt, 24 | Wipers.WipeFunc.doMelt, 25 | Wipers.WipeFunc.exitMelt 26 | ), 27 | ScaledMelt( 28 | Wipers.WipeFunc.initScaledMelt, 29 | Wipers.WipeFunc.doScaledMelt, 30 | Wipers.WipeFunc.exitMelt 31 | ); 32 | 33 | private final Wipers.WipeFunc initFunc; 34 | private final Wipers.WipeFunc doFunc; 35 | private final Wipers.WipeFunc exitFunc; 36 | 37 | @Override 38 | public Wipers.WipeFunc getDoFunc() { 39 | return doFunc; 40 | } 41 | 42 | @Override 43 | public Wipers.WipeFunc getExitFunc() { 44 | return exitFunc; 45 | } 46 | 47 | @Override 48 | public Wipers.WipeFunc getInitFunc() { 49 | return initFunc; 50 | } 51 | 52 | private Wipe(Wipers.WipeFunc initFunc, Wipers.WipeFunc doFunc, Wipers.WipeFunc exitFunc) { 53 | this.initFunc = initFunc; 54 | this.doFunc = doFunc; 55 | this.exitFunc = exitFunc; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/pooling/RoguePatchMap2.java: -------------------------------------------------------------------------------- 1 | package pooling; 2 | 3 | import java.util.Arrays; 4 | 5 | public class RoguePatchMap2 { 6 | private static final int DEFAULT_CAPACITY = 16; 7 | public RoguePatchMap2() { 8 | lumps = new int[DEFAULT_CAPACITY]; 9 | patches = new byte[DEFAULT_CAPACITY][][]; 10 | } 11 | boolean containsKey(int lump) { 12 | return indexOf(lump) >= 0; 13 | } 14 | public byte[][] get(int lump) { 15 | int index = indexOf(lump); 16 | if (index >= 0) { 17 | return patches[index]; 18 | } else { 19 | return null; 20 | } 21 | } 22 | public void put(int lump, byte[][] patch) { 23 | int index = indexOf(lump); 24 | if (index >= 0) { 25 | patches[index] = patch; 26 | } else { 27 | ensureCapacity(numEntries + 1); 28 | int newIndex = ~index; 29 | int moveCount = numEntries - newIndex; 30 | if (moveCount > 0) { 31 | System.arraycopy(lumps, newIndex, lumps, newIndex+1, moveCount); 32 | System.arraycopy(patches, newIndex, patches, newIndex+1, moveCount); 33 | } 34 | lumps[newIndex] = lump; 35 | patches[newIndex] = patch; 36 | ++ numEntries; 37 | } 38 | } 39 | private void ensureCapacity(int cap) { 40 | while (lumps.length <= cap) { 41 | lumps = 42 | Arrays.copyOf(lumps, Math.max(lumps.length * 2, DEFAULT_CAPACITY)); 43 | } 44 | while (patches.length <= cap) { 45 | patches = 46 | Arrays.copyOf(patches, Math.max(patches.length * 2, DEFAULT_CAPACITY)); 47 | } 48 | } 49 | private int indexOf(int lump) { 50 | return Arrays.binarySearch(lumps, 0, numEntries, lump); 51 | } 52 | private int[] lumps; 53 | private int numEntries; 54 | private byte[][][] patches; 55 | } -------------------------------------------------------------------------------- /src/i/DummySystem.java: -------------------------------------------------------------------------------- 1 | package i; 2 | 3 | import doom.ticcmd_t; 4 | 5 | public class DummySystem implements IDoomSystem{ 6 | 7 | @Override 8 | public void AllocLow(int length) { 9 | // TODO Auto-generated method stub 10 | 11 | } 12 | 13 | @Override 14 | public void BeginRead() { 15 | // TODO Auto-generated method stub 16 | 17 | } 18 | 19 | @Override 20 | public void EndRead() { 21 | // TODO Auto-generated method stub 22 | 23 | } 24 | 25 | @Override 26 | public void WaitVBL(int count) { 27 | // TODO Auto-generated method stub 28 | 29 | } 30 | 31 | @Override 32 | public byte[] ZoneBase(int size) { 33 | // TODO Auto-generated method stub 34 | return null; 35 | } 36 | 37 | @Override 38 | public int GetHeapSize() { 39 | // TODO Auto-generated method stub 40 | return 0; 41 | } 42 | 43 | @Override 44 | public void Tactile(int on, int off, int total) { 45 | // TODO Auto-generated method stub 46 | 47 | } 48 | 49 | @Override 50 | public void Quit() { 51 | // TODO Auto-generated method stub 52 | 53 | } 54 | 55 | @Override 56 | public ticcmd_t BaseTiccmd() { 57 | // TODO Auto-generated method stub 58 | return null; 59 | } 60 | 61 | @Override 62 | public void Error(String error, Object... args) { 63 | // TODO Auto-generated method stub 64 | 65 | } 66 | 67 | @Override 68 | public void Error(String error) { 69 | // TODO Auto-generated method stub 70 | 71 | } 72 | 73 | @Override 74 | public void Init() { 75 | // TODO Auto-generated method stub 76 | 77 | } 78 | 79 | @Override 80 | public boolean GenerateAlert(String title, String cause) { 81 | // TODO Auto-generated method stub 82 | return false; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/rr/ISpriteManager.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | 3 | /** Interface for sprite managers. Handles loading sprites, fixing 4 | * rotations etc. and helping retrieving spritedefs when required. 5 | * 6 | * @author velktron. 7 | * 8 | */ 9 | 10 | public interface ISpriteManager { 11 | 12 | /** Default known sprite names for DOOM */ 13 | public final static String[] doomsprnames = { 14 | "TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG", 15 | "MISF","SAWG","PLSG","PLSF","BFGG","BFGF","BLUD","PUFF","BAL1","BAL2", 16 | "PLSS","PLSE","MISL","BFS1","BFE1","BFE2","TFOG","IFOG","PLAY","POSS", 17 | "SPOS","VILE","FIRE","FATB","FBXP","SKEL","MANF","FATT","CPOS","SARG", 18 | "HEAD","BAL7","BOSS","BOS2","SKUL","SPID","BSPI","APLS","APBX","CYBR", 19 | "PAIN","SSWV","KEEN","BBRN","BOSF","ARM1","ARM2","BAR1","BEXP","FCAN", 20 | "BON1","BON2","BKEY","RKEY","YKEY","BSKU","RSKU","YSKU","STIM","MEDI", 21 | "SOUL","PINV","PSTR","PINS","MEGA","SUIT","PMAP","PVIS","CLIP","AMMO", 22 | "ROCK","BROK","CELL","CELP","SHEL","SBOX","BPAK","BFUG","MGUN","CSAW", 23 | "LAUN","PLAS","SHOT","SGN2","COLU","SMT2","GOR1","POL2","POL5","POL4", 24 | "POL3","POL1","POL6","GOR2","GOR3","GOR4","GOR5","SMIT","COL1","COL2", 25 | "COL3","COL4","CAND","CBRA","COL6","TRE1","TRE2","ELEC","CEYE","FSKU", 26 | "COL5","TBLU","TGRN","TRED","SMBT","SMGT","SMRT","HDB1","HDB2","HDB3", 27 | "HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2" 28 | }; 29 | 30 | void InitSpriteLumps(); 31 | 32 | int getNumSprites(); 33 | 34 | int getFirstSpriteLump(); 35 | 36 | spritedef_t[] getSprites(); 37 | 38 | spritedef_t getSprite(int index); 39 | 40 | int[] getSpriteWidth(); 41 | int[] getSpriteOffset(); 42 | int[] getSpriteTopOffset(); 43 | 44 | int getSpriteWidth(int index); 45 | int getSpriteOffset(int index); 46 | int getSpriteTopOffset(int index); 47 | 48 | void InitSprites(String[] namelist); 49 | 50 | 51 | } -------------------------------------------------------------------------------- /src/p/animdef_t.java: -------------------------------------------------------------------------------- 1 | package p; 2 | 3 | import java.io.IOException; 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | 7 | import w.CacheableDoomObject; 8 | import w.DoomBuffer; 9 | 10 | /** 11 | * Source animation definition. Made readable for compatibility with Boom's 12 | * SWANTBLS system. 13 | * 14 | * @author velktron 15 | */ 16 | public class animdef_t 17 | implements CacheableDoomObject { 18 | 19 | public animdef_t() { 20 | 21 | } 22 | 23 | public animdef_t(boolean istexture, String endname, String startname, 24 | int speed) { 25 | super(); 26 | this.istexture = istexture; 27 | this.endname = endname; 28 | this.startname = startname; 29 | this.speed = speed; 30 | } 31 | 32 | 33 | /** if false, it is a flat, and will NOT be used as a texture. Unless you 34 | * use "flats on walls functionality of course. */ 35 | public boolean istexture; 36 | 37 | /** The END name and START name of a texture, given in this order when reading a lump 38 | * The animation system is agnostic to the actual names of of the "in-between" 39 | * frames, it's purely pointer based, and only the start/end are constant. It only 40 | * counts the actual number of existing textures during initialization time. 41 | * 42 | */ 43 | 44 | public String endname,startname; 45 | 46 | public int speed; 47 | 48 | public String toString() { 49 | return String.format("%s %s %s %d", istexture, startname, endname, 50 | speed); 51 | } 52 | 53 | @Override 54 | public void unpack(ByteBuffer buf) 55 | throws IOException { 56 | // Like most Doom structs... 57 | buf.order(ByteOrder.LITTLE_ENDIAN); 58 | this.istexture = (buf.get() != 0); 59 | this.startname = DoomBuffer.getNullTerminatedString(buf, 9); 60 | this.endname = DoomBuffer.getNullTerminatedString(buf, 9); 61 | this.speed = buf.getInt(); 62 | } 63 | 64 | public static int size() { 65 | return 23; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/doom/wbstartstruct_t.java: -------------------------------------------------------------------------------- 1 | package doom; 2 | 3 | import static data.Limits.MAXPLAYERS; 4 | import static utils.GenericCopy.malloc; 5 | 6 | public class wbstartstruct_t implements Cloneable{ 7 | 8 | public wbstartstruct_t(){ 9 | plyr = malloc(wbplayerstruct_t::new, wbplayerstruct_t[]::new, MAXPLAYERS); 10 | } 11 | 12 | public int epsd; // episode # (0-2) 13 | 14 | // if true, splash the secret level 15 | public boolean didsecret; 16 | 17 | // previous and next levels, origin 0 18 | public int last; 19 | public int next; 20 | 21 | public int maxkills; 22 | public int maxitems; 23 | public int maxsecret; 24 | public int maxfrags; 25 | 26 | /** the par time */ 27 | public int partime; 28 | 29 | /** index of this player in game */ 30 | public int pnum; 31 | /** meant to be treated as a "struct", therefore assignments should be deep copies */ 32 | public wbplayerstruct_t[] plyr; 33 | 34 | public wbstartstruct_t clone(){ 35 | wbstartstruct_t cl=null; 36 | try { 37 | cl=(wbstartstruct_t)super.clone(); 38 | } catch (CloneNotSupportedException e) { 39 | // TODO Auto-generated catch block 40 | e.printStackTrace(); 41 | } 42 | /*cl.epsd=this.epsd; 43 | cl.didsecret=this.didsecret; 44 | cl.last=this.last; 45 | cl.next=this.next; 46 | cl.maxfrags=this.maxfrags; 47 | cl.maxitems=this.maxitems; 48 | cl.maxsecret=this.maxsecret; 49 | cl.maxkills=this.maxkills; 50 | cl.partime=this.partime; 51 | cl.pnum=this.pnum;*/ 52 | for (int i=0;i { 6 | protected static final int DEFAULT_CAPACITY = 16; 7 | 8 | /** Concrete implementations must allocate patches 9 | * 10 | */ 11 | GenericIntMap() { 12 | 13 | lumps = new int[DEFAULT_CAPACITY]; 14 | // patches = new K[DEFAULT_CAPACITY]; 15 | } 16 | 17 | public boolean containsKey(int lump) { 18 | return indexOf(lump) >= 0; 19 | } 20 | 21 | public K get(int lump) { 22 | int index = indexOf(lump); 23 | if (index >= 0) { 24 | return patches[index]; 25 | } else { 26 | return null; 27 | } 28 | } 29 | 30 | public void put(int lump, K patch) { 31 | int index = indexOf(lump); 32 | if (index >= 0) { 33 | patches[index] = patch; 34 | } else { 35 | ensureCapacity(numEntries + 1); 36 | int newIndex = ~index; 37 | int moveCount = numEntries - newIndex; 38 | if (moveCount > 0) { 39 | System.arraycopy(lumps, newIndex, lumps, newIndex+1, moveCount); 40 | System.arraycopy(patches, newIndex, patches, newIndex+1, moveCount); 41 | } 42 | lumps[newIndex] = lump; 43 | patches[newIndex] = patch; 44 | ++ numEntries; 45 | } 46 | } 47 | 48 | protected void ensureCapacity(int cap) { 49 | while (lumps.length <= cap) { 50 | lumps = 51 | Arrays.copyOf(lumps, Math.max(lumps.length * 2, DEFAULT_CAPACITY)); 52 | } 53 | while (patches.length <= cap) { 54 | patches = 55 | Arrays.copyOf(patches, Math.max(patches.length * 2, DEFAULT_CAPACITY)); 56 | } 57 | } 58 | protected int indexOf(int lump) { 59 | return Arrays.binarySearch(lumps, 0, numEntries, lump); 60 | //for (int i=0;i. 16 | */ 17 | 18 | package v.scale; 19 | 20 | /** 21 | * Interface for an object that conveys screen resolution/scaling information, meant to replace the static declarations 22 | * in Defines. 23 | * 24 | * @author velktron 25 | * 26 | */ 27 | public interface VideoScale { 28 | 29 | //It is educational but futile to change this 30 | //scaling e.g. to 2. Drawing of status bar, 31 | //menues etc. is tied to the scale implied 32 | //by the graphics. 33 | public static double INV_ASPECT_RATIO = 0.625; // 0.75, ideally 34 | 35 | // 36 | // For resize of screen, at start of game. 37 | // It will not work dynamically, see visplanes. 38 | // 39 | public static final int BASE_WIDTH = 320; 40 | public static final int BASE_HEIGHT = (int) (INV_ASPECT_RATIO * 320); // 200 41 | 42 | int getScreenWidth(); 43 | int getScreenHeight(); 44 | int getScalingX(); 45 | int getScalingY(); 46 | 47 | /** 48 | * Safest global scaling for fixed stuff like menus, titlepic etc 49 | */ 50 | int getSafeScaling(); 51 | 52 | /** 53 | * Get floating point screen multiplier. Not recommended, as it causes visual glitches. Replace with safe scale, 54 | * whenever possible 55 | */ 56 | float getScreenMul(); 57 | 58 | /** 59 | * Future, should signal aware objects that they should refresh their resolution-dependent state, structures, 60 | * variables etc. 61 | * 62 | * @return 63 | */ 64 | boolean changed(); 65 | } 66 | -------------------------------------------------------------------------------- /src/rr/drawfuns/ColVars.java: -------------------------------------------------------------------------------- 1 | package rr.drawfuns; 2 | 3 | /** This is all the information needed to draw a particular column. Really. 4 | * So if we store all of this crap somewhere instead of drawing, we can do the 5 | * drawing when it's more convenient, and since they are non-overlapping we can 6 | * parallelize them. Any questions? 7 | * 8 | */ 9 | 10 | public class ColVars { 11 | /** when passing dc_source around, also set this */ 12 | public T dc_source; 13 | public int dc_source_ofs; 14 | 15 | public T dc_translation; 16 | public int viewheight; 17 | 18 | /** Used by functions that accept transparency or other special 19 | * remapping tables. 20 | * 21 | */ 22 | public T tranmap; 23 | 24 | public int centery; 25 | public int dc_iscale; 26 | 27 | public int dc_texturemid; 28 | public int dc_texheight; // Boom enhancement 29 | public int dc_x; 30 | public int dc_yh; 31 | public int dc_yl; 32 | 33 | public int dc_flags; 34 | 35 | /** 36 | * MAES: this was a typedef for unsigned bytes, called "lighttable_t". It 37 | * makes more sense to make it generic and parametrize it to an array of 38 | * primitives since it's performance-critical in the renderer. 39 | * Now, whether this should be made bytes or shorts or chars or even ints 40 | * is debatable. 41 | */ 42 | 43 | public V dc_colormap; 44 | 45 | /** Copies all BUT flags */ 46 | 47 | public final void copyFrom(ColVars dcvars) { 48 | this.dc_source=dcvars.dc_source; 49 | this.dc_colormap=dcvars.dc_colormap; 50 | this.dc_source_ofs=dcvars.dc_source_ofs; 51 | this.viewheight=dcvars.viewheight; 52 | this.centery=dcvars.centery; 53 | this.dc_x=dcvars.dc_x; 54 | this.dc_yh=dcvars.dc_yh; 55 | this.dc_yl=dcvars.dc_yl; 56 | this.dc_texturemid=dcvars.dc_texturemid; 57 | this.dc_iscale=dcvars.dc_iscale; 58 | this.dc_texheight=dcvars.dc_texheight; 59 | } 60 | 61 | /** Assigns specific flags */ 62 | public void copyFrom(ColVars dcvars,int flags) { 63 | this.copyFrom(dcvars); 64 | this.dc_flags=flags; 65 | } 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/w/filelump_t.java: -------------------------------------------------------------------------------- 1 | package w; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.DataOutputStream; 5 | import java.io.IOException; 6 | 7 | /** filelumps are on-disk structures. lumpinfos are almost the same, but are memory only. 8 | * 9 | * @author Maes 10 | * 11 | */ 12 | 13 | public class filelump_t implements IReadableDoomObject, IWritableDoomObject { 14 | public long filepos; 15 | public long size; // Is INT 32-bit in file! 16 | public String name; // Whatever appears inside the wadfile 17 | public String actualname; // Sanitized name, e.g. after compression markers 18 | 19 | public boolean big_endian=false; // E.g. Jaguar 20 | public boolean compressed=false; // Compressed lump 21 | 22 | public void read(DataInputStream f) throws IOException{ 23 | // MAES: Byte Buffers actually make it convenient changing byte order on-the-fly. 24 | // But RandomAccessFiles (and inputsteams) don't :-S 25 | 26 | if (!big_endian){ 27 | filepos=DoomIO.readUnsignedLEInt(f); 28 | size=DoomIO.readUnsignedLEInt(f); 29 | 30 | } else { 31 | filepos=f.readInt(); 32 | size=f.readInt(); 33 | 34 | } 35 | 36 | // Names used in the reading subsystem should be upper case, 37 | // but check for compressed status first 38 | name=DoomIO.readNullTerminatedString(f,8); 39 | 40 | 41 | char[] stuff= name.toCharArray(); 42 | 43 | // It's a compressed lump 44 | if (stuff[0] > 0x7F) { 45 | this.compressed=true; 46 | stuff[0]&=0x7F; 47 | } 48 | 49 | actualname=new String(stuff).toUpperCase(); 50 | 51 | 52 | } 53 | 54 | public static int sizeof(){ 55 | return (4+4+8); 56 | } 57 | 58 | @Override 59 | public void write(DataOutputStream dos) 60 | throws IOException { 61 | if (!big_endian){ 62 | DoomIO.writeLEInt(dos, (int) filepos); 63 | DoomIO.writeLEInt(dos, (int) size); 64 | } else { 65 | dos.writeInt((int) filepos); 66 | dos.writeInt((int) size); 67 | } 68 | DoomIO.writeString(dos, name, 8); 69 | 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /src/rr/pQuickSprite.java: -------------------------------------------------------------------------------- 1 | package rr; 2 | public class pQuickSprite{ 3 | 4 | public static final void sort(vissprite_t[] c){ 5 | int i,j,left = 0,right = c.length - 1,stack_pointer = -1; 6 | int[] stack = new int[128]; 7 | vissprite_t swap,temp; 8 | while(true){ 9 | if(right - left <= 7){ 10 | for(j=left+1;j<=right;j++){ 11 | swap = c[j]; 12 | i = j-1; 13 | while(i>=left && c[i].scale>swap.scale) 14 | c[i+1] = c[i--]; 15 | c[i+1] = swap; 16 | } 17 | if(stack_pointer == -1) 18 | break; 19 | right = stack[stack_pointer--]; 20 | left = stack[stack_pointer--]; 21 | }else{ 22 | int median = (left + right) >> 1; 23 | i = left + 1; 24 | j = right; 25 | swap = c[median]; c[median] = c[i]; c[i] = swap; 26 | /* make sure: c[left] <= c[left+1] <= c[right] */ 27 | if(c[left].scale > c[right].scale){ 28 | swap = c[left]; c[left] = c[right]; c[right] = swap; 29 | }if(c[i].scale>c[right].scale ){ 30 | swap = c[i]; c[i] = c[right]; c[right] = swap; 31 | }if(c[left].scale>c[i].scale){ 32 | swap = c[left]; c[left] = c[i]; c[i] = swap; 33 | } 34 | temp = c[i]; 35 | while(true){ 36 | do i++; while(c[i].scaletemp.scale); 38 | if(j < i) 39 | break; 40 | swap = c[i]; c[i] = c[j]; c[j] = swap; 41 | } 42 | c[left + 1] = c[j]; 43 | c[j] = temp; 44 | if(right-i+1 >= j-left){ 45 | stack[++stack_pointer] = i; 46 | stack[++stack_pointer] = right; 47 | right = j-1; 48 | }else{ 49 | stack[++stack_pointer] = left; 50 | stack[++stack_pointer] = j-1; 51 | left = i; 52 | } 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/v/graphics/Points.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Good Sign 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package v.graphics; 18 | 19 | import rr.patch_t; 20 | 21 | /** 22 | * 23 | * @author Good Sign 24 | */ 25 | public interface Points> extends Screens { 26 | default void doRangeCheck(int x, int y, int width, int height) throws BadRangeException { 27 | if (x >= 0 && y >= 0) { 28 | final int scrWidth = this.getScreenWidth(); 29 | final int scrHeight = this.getScreenHeight(); 30 | if (x + width > scrWidth || y + height > scrWidth) { 31 | throw new BadRangeException(String.format( 32 | "Coordinates overflow screen space: (%d, %d, %d, %d) on screen %dx%d", 33 | x, y, x + width, y + height, scrWidth, scrHeight) 34 | ); 35 | } 36 | } else { 37 | throw new IllegalArgumentException(String.format("Invalid coordinates: (%d, %d)", x, y)); 38 | } 39 | } 40 | 41 | default void doRangeCheck(int x, int y, patch_t patch) throws BadRangeException { 42 | doRangeCheck(x, y, patch.width, patch.height); 43 | } 44 | 45 | default void doRangeCheck(int x, int y, patch_t patch, int dupx, int dupy) throws BadRangeException { 46 | doRangeCheck(x, y, patch.width * dupx, patch.height * dupy); 47 | } 48 | 49 | default int point(int x, int y) { 50 | return y * getScreenWidth() + x; 51 | } 52 | 53 | default int point(int x, int y, int width) { 54 | return y * width + x; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/g/g_game.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // DESCRIPTION: 19 | // Duh. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __G_GAME__ 25 | #define __G_GAME__ 26 | 27 | #include "doomdef.h" 28 | #include "d_event.h" 29 | 30 | 31 | 32 | // 33 | // GAME 34 | // 35 | void G_DeathMatchSpawnPlayer (int playernum); 36 | 37 | void G_InitNew (skill_t skill, int episode, int map); 38 | 39 | // Can be called by the startup code or M_Responder. 40 | // A normal game starts at map 1, 41 | // but a warp test can start elsewhere 42 | void G_DeferedInitNew (skill_t skill, int episode, int map); 43 | 44 | void G_DeferedPlayDemo (char* demo); 45 | 46 | // Can be called by the startup code or M_Responder, 47 | // calls P_SetupLevel or W_EnterWorld. 48 | void G_LoadGame (char* name); 49 | 50 | void G_DoLoadGame (void); 51 | 52 | // Called by M_Responder. 53 | void G_SaveGame (int slot, char* description); 54 | 55 | // Only called by startup code. 56 | void G_RecordDemo (char* name); 57 | 58 | void G_BeginRecording (void); 59 | 60 | void G_PlayDemo (char* name); 61 | void G_TimeDemo (char* name); 62 | boolean G_CheckDemoStatus (void); 63 | 64 | void G_ExitLevel (void); 65 | void G_SecretExitLevel (void); 66 | 67 | void G_WorldDone (void); 68 | 69 | void G_Ticker (void); 70 | boolean G_Responder (event_t* ev); 71 | 72 | void G_ScreenShot (void); 73 | 74 | 75 | #endif 76 | //----------------------------------------------------------------------------- 77 | // 78 | // $Log:$ 79 | // 80 | //----------------------------------------------------------------------------- 81 | -------------------------------------------------------------------------------- /src/awt/MsgBox.java: -------------------------------------------------------------------------------- 1 | package awt; 2 | 3 | import java.awt.*; 4 | 5 | import java.awt.event.*; 6 | 7 | import javax.swing.JLabel; 8 | 9 | /** A convenient message box class to pop up here and there. 10 | * 11 | * @author zyklon 12 | * 13 | */ 14 | 15 | public class MsgBox extends Dialog implements ActionListener { 16 | /** 17 | * 18 | */ 19 | private static final long serialVersionUID = -872019680203708495L; 20 | private Button ok, can; 21 | private boolean isOk = false; 22 | 23 | /* 24 | * * @param frame parent frame 25 | * 26 | * @param msg message to be displayed 27 | * 28 | * @param okcan true : ok cancel buttons, false : ok button only 29 | */ 30 | 31 | public boolean isOk() { 32 | return isOk; 33 | } 34 | 35 | public MsgBox(Frame frame, String title, String msg, boolean okcan) { 36 | super(frame, title, true); 37 | setLayout(new BorderLayout()); 38 | add("Center", new JLabel(msg)); 39 | addOKCancelPanel(okcan); 40 | createFrame(); 41 | pack(); 42 | setVisible(true); 43 | this.can.requestFocus(); 44 | } 45 | 46 | public MsgBox(Frame frame, String msg) { 47 | this(frame, "Message", msg, false); 48 | } 49 | 50 | private void addOKCancelPanel(boolean okcan) { 51 | Panel p = new Panel(); 52 | p.setLayout(new FlowLayout()); 53 | createOKButton(p); 54 | if (okcan == true) 55 | createCancelButton(p); 56 | add("South", p); 57 | } 58 | 59 | private void createOKButton(Panel p) { 60 | p.add(ok = new Button("OK")); 61 | ok.addActionListener(this); 62 | } 63 | 64 | private void createCancelButton(Panel p) { 65 | p.add(can = new Button("Cancel")); 66 | can.addActionListener(this); 67 | } 68 | 69 | private void createFrame() { 70 | Dimension d = getToolkit().getScreenSize(); 71 | setLocation(d.width / 3, d.height / 3); 72 | } 73 | 74 | public void actionPerformed(ActionEvent ae) { 75 | if (ae.getSource() == ok) { 76 | isOk = true; 77 | setVisible(false); 78 | } else if (ae.getSource() == can) { 79 | setVisible(false); 80 | } 81 | } 82 | 83 | /* 84 | * public static void main(String args[]) { //Frame f = new Frame(); 85 | * //f.setSize(200,200); //f.setVisible(true); MsgBox message = new MsgBox 86 | * (null , "Hey you user, are you sure ?", true); if (message.isOk) 87 | * System.out.println("Ok pressed"); if (!message.isOk) 88 | * System.out.println("Cancel pressed"); message.dispose(); } 89 | */ 90 | } --------------------------------------------------------------------------------