├── .gitignore ├── BINGEN.MAP ├── CODEGEN.EXE ├── CODEGEN.MAP ├── CONSTANT.INC ├── DEFAULT.CFG ├── DMX.C ├── DMX.H ├── DOOMOUT.MAP ├── D_INFO.BIN ├── D_MENUG.BIN ├── GCCIA16 ├── REALDOOM.EXE └── output.map ├── LICENSE ├── M_OFFSET.H ├── README.md ├── SNDCARDS.H ├── am_map.c ├── am_map.h ├── asmtypes.inc ├── bin ├── DOOM.EXE ├── DOOMCODE.BIN ├── DOOMDATA.BIN └── dstrings.txt ├── build ├── .DS_Store ├── bingen.lnk ├── bingen3.lnk ├── bingenht.lnk ├── bingensc.lnk ├── bingenst.lnk ├── codegen.lnk ├── make16 ├── make186 ├── make286 ├── make386 ├── makebg ├── makecg ├── makeht ├── makesc ├── makescat ├── rdoom16.lnk ├── rdoom32.lnk ├── rdoomht.lnk ├── rdoomsc.lnk ├── rdoomsct.lnk └── tools │ ├── bingen │ └── bingen.c │ ├── codegen │ └── codegen.c │ └── dumprint │ ├── DUMPDUMP.BIN │ ├── DUMPRINT.EXE │ ├── DUMPRINT.MAP │ ├── dumprint.c │ ├── dumprint.lnk │ ├── make286 │ └── make286.bat ├── current16.png ├── d_algo.asm ├── d_englsh.h ├── d_event.h ├── d_init.c ├── d_int.asm ├── d_main.c ├── d_main.h ├── d_math.h ├── d_net.c ├── d_net.h ├── d_player.h ├── d_think.h ├── d_ticcmd.h ├── defs.inc ├── doomdata.h ├── doomdef.h ├── doomstat.h ├── doomtype.h ├── dstrings.h ├── dstrings.txt ├── dutils.h ├── f_finale.asm ├── f_finale.h ├── f_wipe.asm ├── f_wipe.h ├── g_game.c ├── g_game.h ├── g_setup.c ├── hu_lib.c ├── hu_lib.h ├── hu_setup.c ├── hu_stuff.c ├── hu_stuff.h ├── i_ibm.c ├── i_init.c ├── i_main.c ├── i_quit.c ├── i_sound.c ├── i_sound.h ├── i_system.h ├── info.h ├── m_memory.h ├── m_menu.c ├── m_menu.h ├── m_misc.c ├── m_misc.h ├── m_near.c ├── m_near.h ├── main.asm ├── make.bat ├── makeall.bat ├── makebg.bat ├── makecg.bat ├── makeia16.sh ├── math.asm ├── math386.asm ├── memory.asm ├── old_c ├── d_math.c ├── dutils.c ├── f_finale.c ├── info.c ├── p_map.c ├── p_maputl.c ├── p_saveg.c ├── p_sight.c ├── p_tick.c ├── r_bsp.c ├── r_plane.c ├── r_segs.c ├── r_things.c ├── wi_stuff.c └── z_umb.c ├── olddata ├── D_FINES1.BIN ├── D_FINES2.BIN ├── D_FINET2.BIN ├── D_FINET4.BIN └── D_STATES.BIN ├── p_ceilng.c ├── p_doors.c ├── p_enemy.c ├── p_floor.c ├── p_init.c ├── p_inter.c ├── p_inter.h ├── p_lights.c ├── p_local.h ├── p_map.asm ├── p_mobj.c ├── p_mobj.h ├── p_mobja.asm ├── p_plats.c ├── p_pspr.c ├── p_pspr.h ├── p_saveg.asm ├── p_saveg.h ├── p_setup.c ├── p_setup.h ├── p_sight.asm ├── p_spec.c ├── p_spec.h ├── p_switch.c ├── p_telept.c ├── p_tick.asm ├── p_tick.h ├── p_user.c ├── r_bsp.h ├── r_column.asm ├── r_data.c ├── r_data.h ├── r_dataa.asm ├── r_defs.h ├── r_draw.c ├── r_draw.h ├── r_init.c ├── r_local.h ├── r_main.c ├── r_main.h ├── r_mainhi.asm ├── r_masked.asm ├── r_math.asm ├── r_plane.h ├── r_segs.h ├── r_setup.c ├── r_sky.asm ├── r_span.asm ├── r_state.h ├── r_things.h ├── s_init.asm ├── s_sbsfx.c ├── s_sbsfx.h ├── s_sound.c ├── s_sound.h ├── sc_adlib.c ├── sc_midi.c ├── sc_mpu.c ├── sc_music.h ├── sc_sbmid.c ├── sm_load.asm ├── sm_mpumd.asm ├── sm_opl2.asm ├── sm_opl3.asm ├── sm_sbmid.asm ├── sounds.c ├── sounds.h ├── st_init.c ├── st_lib.h ├── st_setup.c ├── st_stuff.c ├── st_stuff.h ├── superalpha.gif ├── tables.h ├── todo.txt ├── v_video.c ├── v_video.h ├── video.asm ├── w_init.c ├── w_wad.c ├── w_wad.h ├── wi_stuff.asm ├── wi_stuff.h ├── z_ht18.asm ├── z_init.c ├── z_scamp.asm ├── z_scat.asm ├── z_zone.c └── z_zone.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.obj 3 | 4 | # vs proj files 5 | *.vcxproj 6 | *.vcxproj.* 7 | 8 | 9 | *.wad 10 | 11 | # compiler err 12 | *.err 13 | 14 | # savegame 15 | *.DSG 16 | 17 | # going to leave the map in, i think its interesting to see changes over time.. 18 | # *.map 19 | 20 | /packages/Microsoft.Build.Tasks.Git.1.1.1 21 | /Debug 22 | /.vs/RealDOOM/v15 23 | /GCCIA16 24 | 010/.DS_Store 25 | .vscode/settings.json 26 | bin/scat/.DS_Store 27 | build/tools/.DS_Store 28 | bin/.DS_Store 29 | -------------------------------------------------------------------------------- /CODEGEN.EXE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/CODEGEN.EXE -------------------------------------------------------------------------------- /DEFAULT.CFG: -------------------------------------------------------------------------------- 1 | mouse_sensitivity 9 2 | sfx_volume 8 3 | music_volume 8 4 | show_messages 1 5 | key_right 77 6 | key_left 75 7 | key_up 72 8 | key_down 80 9 | key_strafeleft 51 10 | key_straferight 52 11 | key_fire 29 12 | key_use 57 13 | key_strafe 56 14 | key_speed 54 15 | use_mouse 0 16 | mouseb_fire 0 17 | mouseb_strafe 1 18 | mouseb_forward 2 19 | screenblocks 8 20 | detaillevel 0 21 | snd_channels 3 22 | snd_musicdevice 0 23 | snd_sfxdevice 0 24 | snd_sbport 34 25 | snd_sbirq 5 26 | snd_sbdma 1 27 | snd_mport 51 28 | usegamma 0 29 | -------------------------------------------------------------------------------- /DMX.H: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015 Alexey Khokholov (Nuke.YKT) 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (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 | 15 | #ifndef _DMX_H_ 16 | #define _DMX_H_ 17 | 18 | #include "doomtype.h" 19 | 20 | 21 | /* 22 | void StartTimer(void(*function)(void)); 23 | void StopTimer(void); 24 | */ 25 | 26 | typedef struct task{ 27 | volatile int8_t count; 28 | int8_t active; 29 | } task; 30 | 31 | typedef uint8_t sfxenum_t; 32 | 33 | 34 | void TS_ScheduleMainTask(); 35 | void TS_Dispatch(void); 36 | void TS_SetTaskRate(task *Task, uint16_t rate); 37 | 38 | int8_t __far SFX_PlayPatch(sfxenum_t sfx_id, uint8_t sep, uint8_t vol); 39 | void __far SFX_StopPatch(int8_t handle); 40 | boolean __far SFX_Playing(int8_t handle); 41 | void __far SFX_SetOrigin(int8_t handle, uint8_t sep, uint8_t vol); 42 | 43 | 44 | 45 | #define AHW_PC_SPEAKER 1 46 | #define AHW_ADLIB 2 47 | #define AHW_AWE32 4 48 | #define AHW_SOUND_BLASTER 8 49 | #define AHW_MPU_401 16 50 | #define AHW_ULTRA_SOUND 32 51 | #define AHW_MEDIA_VISION 64 52 | #define AHW_ENSONIQ 256 53 | #define AHW_CODEC 512 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /D_INFO.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/D_INFO.BIN -------------------------------------------------------------------------------- /D_MENUG.BIN: -------------------------------------------------------------------------------- 1 | M_DOOMM_RDTHISM_OPTIONM_QUITGM_NGAMEM_SKULL1`M_SKULL2M_THERMOM_THERMRM_THERMMM_THERMLM_ENDGAMM_PAUSEM_MESSGM_MSGONM_MSGOFFM_EPISODM_EPI1M_EPI2M_EPI3M_HURTM_JKILLM_ROUGHM_SKILLM_NEWGM_ULTRAM_NMAREM_SVOLM_OPTTTLM_SAVEGM_LOADGM_DISPM_MSENSM_GDHIGHM_GDLOWM_DETAILM_DISOPTM_SCRNSZM_SGTTLM_LGTTLM_SFXVOLM_MUSVOLM_LSLEFTM_LSCNTRM_LSRGHTM_EPI4 -------------------------------------------------------------------------------- /GCCIA16/REALDOOM.EXE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/GCCIA16/REALDOOM.EXE -------------------------------------------------------------------------------- /M_OFFSET.H: -------------------------------------------------------------------------------- 1 | #define R_DrawColumnOffset 0x0 2 | #define R_DrawColumnPrepMaskedMultiOffset 0x180 3 | #define R_DrawFuzzColumnOffset 0x84 4 | #define R_DrawSingleMaskedColumnOffset 0x1C9 5 | #define R_DrawMaskedColumnOffset 0xE2B 6 | #define R_SortVisSpritesOffset 0xF0C 7 | #define R_DrawMaskedOffset 0xDCF 8 | #define R_WriteBackViewConstantsMaskedOffset 0x0 9 | #define R_WriteBackMaskedFrameConstantsOffset 0x8D 10 | #define R_DrawSpanOffset 0xA0 11 | #define R_DrawPlanesOffset 0x967 12 | #define R_WriteBackViewConstantsSpanOffset 0xCBE 13 | #define R_DrawSkyColumnOffset 0x0 14 | #define R_DrawSkyPlaneOffset 0x64F 15 | #define R_DrawSkyPlaneDynamicOffset 0x5DE 16 | #define WI_StartOffset 0x1001 17 | #define WI_TickerOffset 0xE0A 18 | #define WI_DrawerOffset 0xE92 19 | #define wipe_StartScreenOffset 0x259 20 | #define wipe_WipeLoopOffset 0x268 21 | #define F_StartFinaleOffset 0x1B4 22 | #define F_ResponderOffset 0xACF 23 | #define F_TickerOffset 0xA2E 24 | #define F_DrawerOffset 0xAFA 25 | #define P_UnArchivePlayersOffset 0x2 26 | #define P_UnArchiveWorldOffset 0x17C 27 | #define P_UnArchiveThinkersOffset 0x2B6 28 | #define P_UnArchiveSpecialsOffset 0x434 29 | #define P_ArchivePlayersOffset 0x679 30 | #define P_ArchiveWorldOffset 0x773 31 | #define P_ArchiveThinkersOffset 0x838 32 | #define P_ArchiveSpecialsOffset 0x9D0 33 | #define LoadSFXWadLumpsOffset 0x0 34 | #define S_ActuallyChangeMusicOffset 0x3EE 35 | #define P_CheckSightOffset 0x0 36 | 37 | #define R_DrawColumnCodeSize 0xE46 38 | #define R_DrawSpanCodeSize 0xDB6 39 | #define R_DrawFuzzColumnCodeSize 0xFF9 40 | #define R_MaskedConstantsCodeSize 0xEB 41 | #define R_DrawSkyColumnCodeSize 0x6C0 42 | #define WI_StuffCodeSize 0x1019 43 | #define PSightCodeSize 0x60B 44 | #define WipeCodeSize 0x31B 45 | #define FinaleCodeSize 0xB56 46 | #define SaveLoadCodeSize 0xB17 47 | #define SMLoadCodeSize 0x49D 48 | #define SInitCodeSize 0x531 49 | #define MaximumMusDriverSize 0x1014 50 | -------------------------------------------------------------------------------- /SNDCARDS.H: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | /* 3 | Copyright (C) 1996, 2003 - 3D Realms Entertainment 4 | 5 | This file is part of Duke Nukem 3D version 1.5 - Atomic Edition 6 | 7 | Duke Nukem 3D is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | See the GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | Original Source: 1994 - Jim Dose 23 | Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms 24 | */ 25 | //------------------------------------------------------------------------- 26 | 27 | #ifndef __SNDCARDS_H 28 | #define __SNDCARDS_H 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /am_map.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // AutoMap module. 17 | // 18 | 19 | #ifndef __AMMAP_H__ 20 | #define __AMMAP_H__ 21 | #include "doomtype.h" 22 | 23 | 24 | // Called by main loop. 25 | void __far AM_Ticker (void); 26 | 27 | // Called by main loop, 28 | // called instead of view drawer if automap active. 29 | void __far AM_Drawer (void); 30 | 31 | // Called to force the automap to quit 32 | // if the level is completed while it is up. 33 | void __far AM_Stop (void); 34 | 35 | #define AM_NUMMARKPOINTS 10 36 | 37 | typedef struct { 38 | int16_t x, y; 39 | } fpoint_t; 40 | 41 | typedef struct { 42 | fpoint_t a, b; 43 | } fline_t; 44 | 45 | typedef struct { 46 | int16_t x,y; 47 | } mpoint_t; 48 | 49 | typedef struct { 50 | mpoint_t a, b; 51 | } mline_t; 52 | 53 | 54 | 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /bin/DOOM.EXE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/bin/DOOM.EXE -------------------------------------------------------------------------------- /bin/DOOMCODE.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/bin/DOOMCODE.BIN -------------------------------------------------------------------------------- /bin/DOOMDATA.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/bin/DOOMDATA.BIN -------------------------------------------------------------------------------- /build/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/build/.DS_Store -------------------------------------------------------------------------------- /build/bingen.lnk: -------------------------------------------------------------------------------- 1 | # bingen.EXE Linker directive file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=4096 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name bingen 13 | 14 | 15 | file m_near.obj 16 | file d_init.obj 17 | file s_init.obj 18 | file st_init.obj 19 | file r_init.obj 20 | file w_init.obj 21 | file i_init.obj 22 | file z_init.obj 23 | file p_init.obj 24 | 25 | NEWSEGMENT 26 | file d_main.obj 27 | file i_quit.obj 28 | file i_ibm.obj 29 | file i_sound.obj 30 | file sm_load.obj 31 | file bingen.obj 32 | file d_net.obj 33 | file g_game.obj 34 | file m_misc.obj 35 | file am_map.obj 36 | file st_stuff.obj 37 | file hu_stuff.obj 38 | file hu_lib.obj 39 | file m_menu.obj 40 | file f_wipe.obj 41 | file d_algo.obj 42 | file dmx.obj 43 | file d_int.obj 44 | file wi_stuff.obj 45 | file math.obj 46 | file main.obj 47 | 48 | 49 | file g_setup.obj 50 | file r_setup.obj 51 | file st_setup.obj 52 | file hu_setup.obj 53 | 54 | NEWSEGMENT 55 | file f_finale.obj 56 | 57 | NEWSEGMENT 58 | file p_saveg.obj 59 | 60 | 61 | 62 | #todo put these in the future wad segment. maybe pull out p_tick. 63 | NEWSEGMENT 64 | file s_sound.obj 65 | file p_ceilng.obj 66 | file p_doors.obj 67 | file p_enemy.obj 68 | file p_floor.obj 69 | file p_inter.obj 70 | file p_lights.obj 71 | file p_map.obj 72 | file p_plats.obj 73 | file p_pspr.obj 74 | file p_spec.obj 75 | file p_switch.obj 76 | file p_mobj.obj 77 | file p_mobja.obj 78 | file p_telept.obj 79 | file p_tick.obj 80 | file p_user.obj 81 | 82 | NEWSEGMENT 83 | file sm_opl2.obj 84 | file sm_opl3.obj 85 | file sm_sbmid.obj 86 | file sm_mpumd.obj 87 | file s_sbsfx.obj 88 | 89 | 90 | NEWSEGMENT 91 | file r_data.obj 92 | file r_dataa.obj 93 | file r_math.obj 94 | file r_mainhi.obj 95 | file r_column.obj 96 | file r_span.obj 97 | file r_sky.obj 98 | file r_draw.obj 99 | file r_main.obj 100 | file r_masked.obj 101 | file w_wad.obj 102 | file video.obj 103 | file v_video.obj 104 | file z_zone.obj 105 | 106 | 107 | NEWSEGMENT 108 | file p_setup.obj 109 | file p_sight.obj 110 | 111 | -------------------------------------------------------------------------------- /build/bingen3.lnk: -------------------------------------------------------------------------------- 1 | # bingen.EXE Linker directive file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=4096 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name bingen 13 | 14 | 15 | file m_near.obj 16 | file d_init.obj 17 | file s_init.obj 18 | file st_init.obj 19 | file r_init.obj 20 | file w_init.obj 21 | file i_init.obj 22 | file z_init.obj 23 | file p_init.obj 24 | 25 | NEWSEGMENT 26 | file d_main.obj 27 | file i_quit.obj 28 | file i_ibm.obj 29 | file i_sound.obj 30 | file sm_load.obj 31 | file bingen.obj 32 | file d_net.obj 33 | file g_game.obj 34 | file m_misc.obj 35 | file am_map.obj 36 | file st_stuff.obj 37 | file hu_stuff.obj 38 | file hu_lib.obj 39 | file m_menu.obj 40 | file f_wipe.obj 41 | file d_algo.obj 42 | file dmx.obj 43 | file d_int.obj 44 | file wi_stuff.obj 45 | file math.obj 46 | file math386.obj 47 | file main.obj 48 | 49 | 50 | file g_setup.obj 51 | file r_setup.obj 52 | file st_setup.obj 53 | file hu_setup.obj 54 | 55 | NEWSEGMENT 56 | file f_finale.obj 57 | 58 | NEWSEGMENT 59 | file p_saveg.obj 60 | 61 | 62 | #todo put these in the future wad segment. maybe pull out p_tick. 63 | NEWSEGMENT 64 | file s_sound.obj 65 | 66 | file p_ceilng.obj 67 | file p_doors.obj 68 | file p_enemy.obj 69 | file p_floor.obj 70 | file p_inter.obj 71 | file p_lights.obj 72 | file p_map.obj 73 | file p_plats.obj 74 | file p_pspr.obj 75 | file p_spec.obj 76 | file p_switch.obj 77 | file p_mobj.obj 78 | file p_mobja.obj 79 | file p_telept.obj 80 | file p_tick.obj 81 | file p_user.obj 82 | 83 | NEWSEGMENT 84 | file sm_opl2.obj 85 | file sm_opl3.obj 86 | file sm_sbmid.obj 87 | file sm_mpumd.obj 88 | file s_sbsfx.obj 89 | 90 | 91 | NEWSEGMENT 92 | file r_data.obj 93 | file r_dataa.obj 94 | file r_math.obj 95 | file r_mainhi.obj 96 | file r_column.obj 97 | file r_span.obj 98 | file r_sky.obj 99 | file r_draw.obj 100 | file r_main.obj 101 | file r_masked.obj 102 | file w_wad.obj 103 | file video.obj 104 | file v_video.obj 105 | file z_zone.obj 106 | 107 | 108 | NEWSEGMENT 109 | file p_setup.obj 110 | file p_sight.obj 111 | -------------------------------------------------------------------------------- /build/bingenht.lnk: -------------------------------------------------------------------------------- 1 | # bingen.EXE Linker directive file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=4096 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name bingen 13 | 14 | 15 | file m_near.obj 16 | file d_init.obj 17 | file s_init.obj 18 | file st_init.obj 19 | file r_init.obj 20 | file w_init.obj 21 | file i_init.obj 22 | file z_init.obj 23 | file p_init.obj 24 | 25 | NEWSEGMENT 26 | file d_main.obj 27 | file i_quit.obj 28 | file i_ibm.obj 29 | file i_sound.obj 30 | file sm_load.obj 31 | file bingen.obj 32 | file d_net.obj 33 | file g_game.obj 34 | file m_misc.obj 35 | file am_map.obj 36 | file st_stuff.obj 37 | file hu_stuff.obj 38 | file hu_lib.obj 39 | file m_menu.obj 40 | file f_wipe.obj 41 | file d_algo.obj 42 | file dmx.obj 43 | file d_int.obj 44 | file wi_stuff.obj 45 | file math.obj 46 | file main.obj 47 | 48 | 49 | 50 | file g_setup.obj 51 | file r_setup.obj 52 | file st_setup.obj 53 | file hu_setup.obj 54 | 55 | NEWSEGMENT 56 | file f_finale.obj 57 | 58 | NEWSEGMENT 59 | file p_saveg.obj 60 | 61 | 62 | #todo put these in the future wad segment. maybe pull out p_tick. 63 | NEWSEGMENT 64 | file s_sound.obj 65 | 66 | file p_ceilng.obj 67 | file p_doors.obj 68 | file p_enemy.obj 69 | file p_floor.obj 70 | file p_inter.obj 71 | file p_lights.obj 72 | file p_map.obj 73 | file p_plats.obj 74 | file p_pspr.obj 75 | file p_spec.obj 76 | file p_switch.obj 77 | file p_mobj.obj 78 | file p_mobja.obj 79 | file p_telept.obj 80 | file p_tick.obj 81 | file p_user.obj 82 | 83 | NEWSEGMENT 84 | file s_sbsfx.obj 85 | file sm_opl2.obj 86 | file sm_opl3.obj 87 | file sm_sbmid.obj 88 | file sm_mpumd.obj 89 | 90 | NEWSEGMENT 91 | file r_data.obj 92 | file r_dataa.obj 93 | file r_math.obj 94 | file r_mainhi.obj 95 | file r_column.obj 96 | file r_span.obj 97 | file r_sky.obj 98 | file r_draw.obj 99 | file r_main.obj 100 | file r_masked.obj 101 | file w_wad.obj 102 | file video.obj 103 | file v_video.obj 104 | file z_ht18.obj 105 | file z_zone.obj 106 | 107 | 108 | NEWSEGMENT 109 | file p_setup.obj 110 | file p_sight.obj 111 | -------------------------------------------------------------------------------- /build/bingensc.lnk: -------------------------------------------------------------------------------- 1 | # bingen.EXE Linker directive file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=4096 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name bingen 13 | 14 | 15 | file m_near.obj 16 | file d_init.obj 17 | file s_init.obj 18 | file st_init.obj 19 | file r_init.obj 20 | file w_init.obj 21 | file i_init.obj 22 | file z_init.obj 23 | file p_init.obj 24 | 25 | NEWSEGMENT 26 | file d_main.obj 27 | file i_quit.obj 28 | file i_ibm.obj 29 | file i_sound.obj 30 | file sm_load.obj 31 | file bingen.obj 32 | file d_net.obj 33 | file g_game.obj 34 | file m_misc.obj 35 | file am_map.obj 36 | file st_stuff.obj 37 | file hu_stuff.obj 38 | file hu_lib.obj 39 | file m_menu.obj 40 | file f_wipe.obj 41 | file d_algo.obj 42 | file dmx.obj 43 | file d_int.obj 44 | file wi_stuff.obj 45 | file math.obj 46 | file main.obj 47 | 48 | 49 | file g_setup.obj 50 | file r_setup.obj 51 | file st_setup.obj 52 | file hu_setup.obj 53 | 54 | NEWSEGMENT 55 | file f_finale.obj 56 | 57 | NEWSEGMENT 58 | file p_saveg.obj 59 | 60 | #todo put these in the future wad segment. maybe pull out p_tick. 61 | NEWSEGMENT 62 | file s_sound.obj 63 | file p_ceilng.obj 64 | file p_doors.obj 65 | file p_enemy.obj 66 | file p_floor.obj 67 | file p_inter.obj 68 | file p_lights.obj 69 | file p_plats.obj 70 | file p_pspr.obj 71 | file p_spec.obj 72 | file p_switch.obj 73 | file p_mobja.obj 74 | file p_telept.obj 75 | file p_tick.obj 76 | file p_user.obj 77 | file p_map.obj 78 | file p_mobj.obj 79 | 80 | NEWSEGMENT 81 | file s_sbsfx.obj 82 | file sm_opl2.obj 83 | file sm_opl3.obj 84 | file sm_sbmid.obj 85 | file sm_mpumd.obj 86 | 87 | 88 | NEWSEGMENT 89 | file r_data.obj 90 | file r_dataa.obj 91 | file r_math.obj 92 | file r_mainhi.obj 93 | file r_column.obj 94 | file r_span.obj 95 | file r_sky.obj 96 | file r_draw.obj 97 | file r_main.obj 98 | file r_masked.obj 99 | file w_wad.obj 100 | file video.obj 101 | file v_video.obj 102 | file z_scamp.obj 103 | file z_zone.obj 104 | 105 | 106 | NEWSEGMENT 107 | file p_setup.obj 108 | file p_sight.obj 109 | -------------------------------------------------------------------------------- /build/bingenst.lnk: -------------------------------------------------------------------------------- 1 | # bingen.EXE Linker directive file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=4096 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name bingen 13 | 14 | 15 | file m_near.obj 16 | file d_init.obj 17 | file s_init.obj 18 | file st_init.obj 19 | file r_init.obj 20 | file w_init.obj 21 | file i_init.obj 22 | file z_init.obj 23 | file p_init.obj 24 | 25 | NEWSEGMENT 26 | file d_main.obj 27 | file i_quit.obj 28 | file i_ibm.obj 29 | file i_sound.obj 30 | file sm_load.obj 31 | file bingen.obj 32 | file d_net.obj 33 | file g_game.obj 34 | file m_misc.obj 35 | file am_map.obj 36 | file st_stuff.obj 37 | file hu_stuff.obj 38 | file hu_lib.obj 39 | file m_menu.obj 40 | file f_wipe.obj 41 | 42 | file d_algo.obj 43 | file dmx.obj 44 | file d_int.obj 45 | file wi_stuff.obj 46 | file math.obj 47 | file main.obj 48 | 49 | file g_setup.obj 50 | file r_setup.obj 51 | file st_setup.obj 52 | file hu_setup.obj 53 | 54 | NEWSEGMENT 55 | file f_finale.obj 56 | 57 | NEWSEGMENT 58 | file p_saveg.obj 59 | 60 | 61 | #todo put these in the future wad segment. maybe pull out p_tick. 62 | NEWSEGMENT 63 | file s_sound.obj 64 | file p_ceilng.obj 65 | file p_doors.obj 66 | file p_enemy.obj 67 | file p_floor.obj 68 | file p_inter.obj 69 | file p_lights.obj 70 | file p_map.obj 71 | file p_plats.obj 72 | file p_pspr.obj 73 | file p_spec.obj 74 | file p_switch.obj 75 | file p_mobj.obj 76 | file p_mobja.obj 77 | file p_telept.obj 78 | file p_tick.obj 79 | file p_user.obj 80 | 81 | NEWSEGMENT 82 | file s_sbsfx.obj 83 | file sm_opl2.obj 84 | file sm_opl3.obj 85 | file sm_sbmid.obj 86 | file sm_mpumd.obj 87 | 88 | 89 | NEWSEGMENT 90 | file r_data.obj 91 | file r_dataa.obj 92 | file r_math.obj 93 | file r_mainhi.obj 94 | file r_column.obj 95 | file r_span.obj 96 | file r_sky.obj 97 | file r_draw.obj 98 | file r_main.obj 99 | file r_masked.obj 100 | file w_wad.obj 101 | file video.obj 102 | file v_video.obj 103 | file z_scat.obj 104 | file z_zone.obj 105 | 106 | 107 | NEWSEGMENT 108 | file p_setup.obj 109 | file p_sight.obj 110 | -------------------------------------------------------------------------------- /build/codegen.lnk: -------------------------------------------------------------------------------- 1 | # codegen.exe Linker directive file 2 | 3 | option quiet 4 | option map 5 | 6 | #option stack=2536 7 | option stack=3072 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name codegen 13 | 14 | 15 | file m_near.obj 16 | file codegen.obj 17 | 18 | -------------------------------------------------------------------------------- /build/make16: -------------------------------------------------------------------------------- 1 | 2 | # RealDOOM makefile 3 | 4 | # -------------------------------------------------------------------------- 5 | # 6 | # 4r use 80486 timings and register argument passing 7 | # c compile only 8 | # d1 include line number debugging information 9 | # d2 include full sybolic debugging information 10 | # ei force enums to be of type int 11 | # j change char default from unsigned to signed 12 | # oa relax aliasing checking 13 | # od do not optimize 14 | # oe[=#] expand functions inline, # = quads (default 20) 15 | # oi use the inline library functions 16 | # om generate inline 80x87 code for math functions 17 | # ot optimize for time 18 | # ox maximum optimization 19 | # s remove stack overflow checks 20 | # zp1 align structures on bytes 21 | # zq use quiet mode 22 | # /i=dir add include directories 23 | # 24 | # mh huge memory model 25 | # ml large memory model 26 | # fpi inline 80x87 instructions with emulation 27 | # -o optimization: a : relax aliasing constraints 28 | # zq operate quietly 29 | # zp1 pack structure members with alignment 1 30 | # zt# set far data threshold (i.e., larger objects go in far memory) 31 | # -------------------------------------------------------------------------- 32 | 33 | 34 | # time optimized seems a LOT faster... ? 35 | # size optimized saves around 10k 36 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -s -zdp -0 37 | #CCOPTS = -zp1 -oaxet -oi -zq -j -mm -s -zdp -wx 38 | 39 | #doom8088 build opts for comparison 40 | #CCOPTS = -oaxes -oh -ol+ -zp1 -0 -j -zq -s -ml -wx -za99 41 | ASMOPTS = /d_USED000=0 /dCOMPILE_INSTRUCTIONSET=0 42 | 43 | GLOBOBJS = & 44 | m_near.obj & 45 | i_init.obj & 46 | i_quit.obj & 47 | i_main.obj & 48 | i_ibm.obj & 49 | i_sound.obj & 50 | f_finale.obj & 51 | d_init.obj & 52 | d_main.obj & 53 | d_net.obj & 54 | g_setup.obj & 55 | g_game.obj & 56 | m_menu.obj & 57 | m_misc.obj & 58 | am_map.obj & 59 | p_init.obj & 60 | p_ceilng.obj & 61 | p_doors.obj & 62 | p_enemy.obj & 63 | p_floor.obj & 64 | p_inter.obj & 65 | p_lights.obj & 66 | p_map.obj & 67 | p_plats.obj & 68 | p_pspr.obj & 69 | p_setup.obj & 70 | p_spec.obj & 71 | p_switch.obj & 72 | p_mobj.obj & 73 | p_mobja.obj & 74 | p_telept.obj & 75 | p_tick.obj & 76 | p_user.obj & 77 | r_init.obj & 78 | r_setup.obj & 79 | r_data.obj & 80 | r_dataa.obj & 81 | r_draw.obj & 82 | r_main.obj & 83 | w_init.obj & 84 | w_wad.obj & 85 | v_video.obj & 86 | z_init.obj & 87 | z_zone.obj & 88 | st_init.obj & 89 | st_setup.obj & 90 | st_stuff.obj & 91 | hu_setup.obj & 92 | hu_stuff.obj & 93 | hu_lib.obj & 94 | s_sound.obj & 95 | s_sbsfx.obj & 96 | dmx.obj & 97 | d_int.obj & 98 | memory.obj & 99 | math.obj & 100 | main.obj & 101 | d_algo.obj & 102 | r_math.obj & 103 | r_mainhi.obj & 104 | video.obj 105 | 106 | 107 | doomout.exe : $(GLOBOBJS) i_ibm.obj 108 | wlink @build/rdoom16.lnk 109 | copy doomout.exe bin\doom.exe 110 | wstrip bin\doom.exe 111 | 112 | .c.obj : 113 | wcc $(CCOPTS) $[* 114 | 115 | .asm.obj : 116 | tasm /mx /m4 /w2 /q /zi $(ASMOPTS) $[* 117 | 118 | clean : .SYMBOLIC 119 | del *.obj 120 | del *.err 121 | del doomout.exe -------------------------------------------------------------------------------- /build/make186: -------------------------------------------------------------------------------- 1 | # RealDOOM makefile 2 | 3 | # -------------------------------------------------------------------------- 4 | # 5 | # 4r use 80486 timings and register argument passing 6 | # c compile only 7 | # d1 include line number debugging information 8 | # d2 include full sybolic debugging information 9 | # ei force enums to be of type int 10 | # j change char default from unsigned to signed 11 | # oa relax aliasing checking 12 | # od do not optimize 13 | # oe[=#] expand functions inline, # = quads (default 20) 14 | # oi use the inline library functions 15 | # om generate inline 80x87 code for math functions 16 | # ot optimize for time 17 | # os optimize for size 18 | # ox maximum optimization 19 | # s remove stack overflow checks 20 | # zp1 align structures on bytes 21 | # zq use quiet mode 22 | # /i=dir add include directories 23 | # 24 | # mh huge memory model 25 | # ml large memory model 26 | # fpi inline 80x87 instructions with emulation 27 | # -o optimization: a : relax aliasing constraints 28 | # zq operate quietly 29 | # zp1 pack structure members with alignment 1 30 | # zt# set far data threshold (i.e., larger objects go in far memory) 31 | # wx set maximum compiler warning level (helps find unused vars) 32 | # zc store strings in code instead of DGROUP (large memory model only) 33 | # zdp forces ds register to always point to dgroup. default for medium 34 | # zdf allows ds register to point to other things. default for other modes 35 | # -------------------------------------------------------------------------- 36 | 37 | 38 | # time optimized seems a LOT faster... ? 39 | # size optimized saves around 10k 40 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -1 -s -zdp 41 | #CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s -zdp -wx 42 | ASMOPTS = /d_USED000=0 /dCOMPILE_INSTRUCTIONSET=1 43 | 44 | #doom8088 build opts for comparison 45 | #CCOPTS = -oaxes -oh -ol+ -zp1 -0 -j -zq -s -ml -wx -za99 46 | 47 | GLOBOBJS = & 48 | m_near.obj & 49 | i_init.obj & 50 | i_quit.obj & 51 | i_main.obj & 52 | i_ibm.obj & 53 | i_sound.obj & 54 | f_finale.obj & 55 | d_init.obj & 56 | d_main.obj & 57 | d_net.obj & 58 | g_setup.obj & 59 | g_game.obj & 60 | m_menu.obj & 61 | m_misc.obj & 62 | am_map.obj & 63 | p_init.obj & 64 | p_ceilng.obj & 65 | p_doors.obj & 66 | p_enemy.obj & 67 | p_floor.obj & 68 | p_inter.obj & 69 | p_lights.obj & 70 | p_map.obj & 71 | p_plats.obj & 72 | p_pspr.obj & 73 | p_setup.obj & 74 | p_spec.obj & 75 | p_switch.obj & 76 | p_mobj.obj & 77 | p_mobja.obj & 78 | p_telept.obj & 79 | p_tick.obj & 80 | p_user.obj & 81 | r_init.obj & 82 | r_setup.obj & 83 | r_data.obj & 84 | r_dataa.obj & 85 | r_draw.obj & 86 | r_main.obj & 87 | w_init.obj & 88 | w_wad.obj & 89 | v_video.obj & 90 | z_init.obj & 91 | z_zone.obj & 92 | st_init.obj & 93 | st_setup.obj & 94 | st_stuff.obj & 95 | hu_setup.obj & 96 | hu_stuff.obj & 97 | hu_lib.obj & 98 | s_sound.obj & 99 | s_sbsfx.obj & 100 | & 101 | dmx.obj & 102 | d_int.obj & 103 | memory.obj & 104 | math.obj & 105 | main.obj & 106 | d_algo.obj & 107 | r_math.obj & 108 | r_mainhi.obj & 109 | video.obj 110 | 111 | doomout.exe : $(GLOBOBJS) i_ibm.obj 112 | wlink @build/rdoom16.lnk 113 | copy doomout.exe bin\doom.exe 114 | wstrip bin\doom.exe 115 | 116 | .c.obj : 117 | wcc $(CCOPTS) $[* 118 | 119 | .asm.obj : 120 | tasm /mx /m4 /w2 /q /zi $(ASMOPTS) $[* 121 | 122 | clean : .SYMBOLIC 123 | del *.obj 124 | del *.err 125 | del doomout.exe 126 | -------------------------------------------------------------------------------- /build/make286: -------------------------------------------------------------------------------- 1 | # RealDOOM makefile 2 | 3 | # -------------------------------------------------------------------------- 4 | # 5 | # 4r use 80486 timings and register argument passing 6 | # c compile only 7 | # d1 include line number debugging information 8 | # d2 include full sybolic debugging information 9 | # ei force enums to be of type int 10 | # j change char default from unsigned to signed 11 | # oa relax aliasing checking 12 | # od do not optimize 13 | # oe[=#] expand functions inline, # = quads (default 20) 14 | # oi use the inline library functions 15 | # om generate inline 80x87 code for math functions 16 | # ot optimize for time 17 | # os optimize for size 18 | # ox maximum optimization 19 | # s remove stack overflow checks 20 | # zp1 align structures on bytes 21 | # zq use quiet mode 22 | # /i=dir add include directories 23 | # 24 | # mh huge memory model 25 | # ml large memory model 26 | # fpi inline 80x87 instructions with emulation 27 | # -o optimization: a : relax aliasing constraints 28 | # zq operate quietly 29 | # zp1 pack structure members with alignment 1 30 | # zt# set far data threshold (i.e., larger objects go in far memory) 31 | # wx set maximum compiler warning level (helps find unused vars) 32 | # zc store strings in code instead of DGROUP (large memory model only) 33 | # zdp forces ds register to always point to dgroup. default for medium 34 | # zdf allows ds register to point to other things. default for other modes 35 | # -------------------------------------------------------------------------- 36 | 37 | 38 | # time optimized seems a LOT faster... ? 39 | # size optimized saves around 10k 40 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s 41 | #CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s -zdp -wx 42 | ASMOPTS = /d_USED000=0 /dCOMPILE_INSTRUCTIONSET=2 43 | 44 | #doom8088 build opts for comparison 45 | #CCOPTS = -oaxes -oh -ol+ -zp1 -0 -j -zq -s -ml -wx -za99 46 | 47 | GLOBOBJS = & 48 | m_near.obj & 49 | i_init.obj & 50 | i_quit.obj & 51 | i_main.obj & 52 | i_ibm.obj & 53 | i_sound.obj & 54 | f_finale.obj & 55 | d_init.obj & 56 | d_main.obj & 57 | d_net.obj & 58 | g_setup.obj & 59 | g_game.obj & 60 | m_menu.obj & 61 | m_misc.obj & 62 | am_map.obj & 63 | p_init.obj & 64 | p_ceilng.obj & 65 | p_doors.obj & 66 | p_enemy.obj & 67 | p_floor.obj & 68 | p_inter.obj & 69 | p_lights.obj & 70 | p_map.obj & 71 | p_plats.obj & 72 | p_pspr.obj & 73 | p_setup.obj & 74 | p_spec.obj & 75 | p_switch.obj & 76 | p_mobj.obj & 77 | p_mobja.obj & 78 | p_telept.obj & 79 | p_tick.obj & 80 | p_user.obj & 81 | r_init.obj & 82 | r_setup.obj & 83 | r_data.obj & 84 | r_dataa.obj & 85 | r_draw.obj & 86 | r_main.obj & 87 | w_init.obj & 88 | w_wad.obj & 89 | v_video.obj & 90 | z_init.obj & 91 | z_zone.obj & 92 | st_init.obj & 93 | st_setup.obj & 94 | st_stuff.obj & 95 | hu_setup.obj & 96 | hu_stuff.obj & 97 | hu_lib.obj & 98 | s_sound.obj & 99 | s_sbsfx.obj & 100 | dmx.obj & 101 | d_int.obj & 102 | memory.obj & 103 | math.obj & 104 | main.obj & 105 | d_algo.obj & 106 | r_math.obj & 107 | r_mainhi.obj & 108 | video.obj 109 | 110 | doomout.exe : $(GLOBOBJS) i_ibm.obj 111 | wlink @build/rdoom16.lnk 112 | copy doomout.exe bin\doom.exe 113 | wstrip bin\doom.exe 114 | 115 | .c.obj : 116 | wcc $(CCOPTS) $[* 117 | 118 | .asm.obj : 119 | tasm /mx /m4 /w2 /q /zi $(ASMOPTS) $[* 120 | 121 | clean : .SYMBOLIC 122 | del *.obj 123 | del *.err 124 | del doomout.exe 125 | -------------------------------------------------------------------------------- /build/make386: -------------------------------------------------------------------------------- 1 | # RealDOOM makefile 2 | 3 | # -------------------------------------------------------------------------- 4 | # 5 | # 4r use 80486 timings and register argument passing 6 | # c compile only 7 | # d1 include line number debugging information 8 | # d2 include full sybolic debugging information 9 | # ei force enums to be of type int 10 | # j change char default from unsigned to signed 11 | # oa relax aliasing checking 12 | # od do not optimize 13 | # oe[=#] expand functions inline, # = quads (default 20) 14 | # oi use the inline library functions 15 | # om generate inline 80x87 code for math functions 16 | # ot optimize for time 17 | # os optimize for size 18 | # ox maximum optimization 19 | # s remove stack overflow checks 20 | # zp1 align structures on bytes 21 | # zq use quiet mode 22 | # /i=dir add include directories 23 | # 24 | # mh huge memory model 25 | # ml large memory model 26 | # fpi inline 80x87 instructions with emulation 27 | # -o optimization: a : relax aliasing constraints 28 | # zq operate quietly 29 | # zp1 pack structure members with alignment 1 30 | # zt# set far data threshold (i.e., larger objects go in far memory) 31 | # wx set maximum compiler warning level (helps find unused vars) 32 | # zc store strings in code instead of DGROUP (large memory model only) 33 | # zdp forces ds register to always point to dgroup. default for medium 34 | # zdf allows ds register to point to other things. default for other modes 35 | # -------------------------------------------------------------------------- 36 | 37 | 38 | # time optimized seems a LOT faster... ? 39 | # size optimized saves around 10k 40 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s 41 | #CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s -zdp -wx 42 | ASMOPTS = /d_USED000=0 /dCOMPILE_INSTRUCTIONSET=3 43 | 44 | #doom8088 build opts for comparison 45 | #CCOPTS = -oaxes -oh -ol+ -zp1 -0 -j -zq -s -ml -wx -za99 46 | 47 | GLOBOBJS = & 48 | m_near.obj & 49 | i_init.obj & 50 | i_quit.obj & 51 | i_main.obj & 52 | i_ibm.obj & 53 | i_sound.obj & 54 | f_finale.obj & 55 | d_init.obj & 56 | d_main.obj & 57 | d_net.obj & 58 | g_setup.obj & 59 | g_game.obj & 60 | m_menu.obj & 61 | m_misc.obj & 62 | am_map.obj & 63 | p_init.obj & 64 | p_ceilng.obj & 65 | p_doors.obj & 66 | p_enemy.obj & 67 | p_floor.obj & 68 | p_inter.obj & 69 | p_lights.obj & 70 | p_map.obj & 71 | p_plats.obj & 72 | p_pspr.obj & 73 | p_setup.obj & 74 | p_spec.obj & 75 | p_switch.obj & 76 | p_mobj.obj & 77 | p_mobja.obj & 78 | p_telept.obj & 79 | p_tick.obj & 80 | p_user.obj & 81 | r_init.obj & 82 | r_setup.obj & 83 | r_data.obj & 84 | r_dataa.obj & 85 | r_draw.obj & 86 | r_main.obj & 87 | w_init.obj & 88 | w_wad.obj & 89 | v_video.obj & 90 | z_init.obj & 91 | z_zone.obj & 92 | st_init.obj & 93 | st_setup.obj & 94 | st_stuff.obj & 95 | hu_setup.obj & 96 | hu_stuff.obj & 97 | hu_lib.obj & 98 | s_sound.obj & 99 | s_sbsfx.obj & 100 | dmx.obj & 101 | d_int.obj & 102 | memory.obj & 103 | math.obj & 104 | math386.obj & 105 | main.obj & 106 | d_algo.obj & 107 | r_math.obj & 108 | r_mainhi.obj & 109 | video.obj 110 | 111 | doomout.exe : $(GLOBOBJS) i_ibm.obj 112 | wlink @build/rdoom32.lnk 113 | copy doomout.exe bin\doom.exe 114 | wstrip bin\doom.exe 115 | 116 | .c.obj : 117 | wcc $(CCOPTS) $[* 118 | 119 | .asm.obj : 120 | tasm /mx /m4 /w2 /q /zi $(ASMOPTS) $[* 121 | 122 | clean : .SYMBOLIC 123 | del *.obj 124 | del *.err 125 | del doomout.exe 126 | -------------------------------------------------------------------------------- /build/makebg: -------------------------------------------------------------------------------- 1 | 2 | 3 | # -------------------------------------------------------------------------- 4 | # 5 | # 4r use 80486 timings and register argument passing 6 | # c compile only 7 | # d1 include line number debugging information 8 | # d2 include full sybolic debugging information 9 | # ei force enums to be of type int 10 | # j change char default from unsigned to signed 11 | # oa relax aliasing checking 12 | # od do not optimize 13 | # oe[=#] expand functions inline, # = quads (default 20) 14 | # oi use the inline library functions 15 | # om generate inline 80x87 code for math functions 16 | # ot optimize for time 17 | # os optimize for size 18 | # ox maximum optimization 19 | # s remove stack overflow checks 20 | # zp1 align structures on bytes 21 | # zq use quiet mode 22 | # /i=dir add include directories 23 | # 24 | # mh huge memory model 25 | # ml large memory model 26 | # fpi inline 80x87 instructions with emulation 27 | # -o optimization: a : relax aliasing constraints 28 | # zq operate quietly 29 | # zp1 pack structure members with alignment 1 30 | # zt# set far data threshold (i.e., larger objects go in far memory) 31 | # wx set maximum compiler warning level (helps find unused vars) 32 | # zc store strings in code instead of DGROUP (large memory model only) 33 | # zdp forces ds register to always point to dgroup. default for medium 34 | # zdf allows ds register to point to other things. default for other modes 35 | # -------------------------------------------------------------------------- 36 | 37 | 38 | # time optimized seems a LOT faster... ? 39 | # size optimized saves around 10k 40 | 41 | compileinstructionset = $(USE_ISA) 42 | 43 | !ifeq compileinstructionset 1 44 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -1 -s $(EXTERNCOPT) 45 | !else 46 | !ifeq compileinstructionset 2 47 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s $(EXTERNCOPT) 48 | !else 49 | !ifeq compileinstructionset 3 50 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s $(EXTERNCOPT) 51 | !else 52 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -0 -s $(EXTERNCOPT) 53 | !endif 54 | !endif 55 | !endif 56 | 57 | 58 | 59 | ASMOPTS = /d_USED000=0 $(EXTERNASMOPT) 60 | 61 | build286chipset = $(286_CHIPSET) 62 | 63 | !ifeq compileinstructionset 3 64 | GLOBOBJS = $(GLOBOBJS) math386.obj 65 | !endif 66 | 67 | !ifeq build286chipset 1 68 | GLOBOBJS = $(GLOBOBJS) z_scamp.obj 69 | !endif 70 | !ifeq build286chipset 2 71 | GLOBOBJS = $(GLOBOBJS) z_scat.obj 72 | !endif 73 | !ifeq build286chipset 3 74 | GLOBOBJS = $(GLOBOBJS) z_ht18.obj 75 | !endif 76 | 77 | 78 | GLOBOBJS = $(GLOBOBJS) & 79 | m_near.obj & 80 | i_init.obj & 81 | i_quit.obj & 82 | d_main.obj & 83 | i_ibm.obj & 84 | i_sound.obj & 85 | sm_load.obj & 86 | f_finale.obj & 87 | d_init.obj & 88 | s_init.obj & 89 | bingen.obj & 90 | d_net.obj & 91 | g_setup.obj & 92 | g_game.obj & 93 | m_menu.obj & 94 | m_misc.obj & 95 | am_map.obj & 96 | p_init.obj & 97 | p_ceilng.obj & 98 | p_doors.obj & 99 | p_enemy.obj & 100 | p_floor.obj & 101 | p_inter.obj & 102 | p_lights.obj & 103 | p_map.obj & 104 | p_plats.obj & 105 | p_pspr.obj & 106 | p_setup.obj & 107 | p_sight.obj & 108 | p_sight.obj & 109 | p_spec.obj & 110 | p_switch.obj & 111 | p_mobj.obj & 112 | p_mobja.obj & 113 | p_telept.obj & 114 | p_tick.obj & 115 | p_user.obj & 116 | r_init.obj & 117 | r_setup.obj & 118 | r_data.obj & 119 | r_dataa.obj & 120 | r_draw.obj & 121 | r_main.obj & 122 | w_init.obj & 123 | w_wad.obj & 124 | v_video.obj & 125 | z_init.obj & 126 | z_zone.obj & 127 | st_init.obj & 128 | st_setup.obj & 129 | st_stuff.obj & 130 | hu_setup.obj & 131 | hu_stuff.obj & 132 | hu_lib.obj & 133 | wi_stuff.obj & 134 | s_sound.obj & 135 | s_sbsfx.obj & 136 | sm_opl2.obj & 137 | sm_opl3.obj & 138 | sm_sbmid.obj & 139 | sm_mpumd.obj & 140 | f_wipe.obj & 141 | f_finale.obj & 142 | dmx.obj & 143 | d_int.obj & 144 | memory.obj & 145 | math.obj & 146 | main.obj & 147 | p_saveg.obj & 148 | d_algo.obj & 149 | r_math.obj & 150 | r_mainhi.obj & 151 | r_masked.obj & 152 | r_column.obj & 153 | r_sky.obj & 154 | r_span.obj & 155 | video.obj 156 | 157 | bingen.exe : $(GLOBOBJS) 158 | !ifeq compileinstructionset 3 159 | wlink @build/bingen3.lnk 160 | !else 161 | !ifeq build286chipset 1 162 | wlink @build/bingensc.lnk 163 | !else 164 | !ifeq build286chipset 2 165 | wlink @build/bingenst.lnk 166 | !else 167 | !ifeq build286chipset 3 168 | wlink @build/bingenht.lnk 169 | !else 170 | wlink @build/bingen.lnk 171 | !endif 172 | !endif 173 | !endif 174 | !endif 175 | wstrip bingen.exe 176 | 177 | obj.obj : obj\ 178 | 179 | .c.obj : 180 | wcc $(CCOPTS) $[* 181 | 182 | .c : build\tools\bingen\ 183 | 184 | .asm.obj : 185 | tasm /mx /m2 /w2 /q /zi $(ASMOPTS) $[* 186 | 187 | clean : .SYMBOLIC 188 | del *.obj 189 | del *.err 190 | del bingen.exe 191 | -------------------------------------------------------------------------------- /build/makecg: -------------------------------------------------------------------------------- 1 | # RealDOOM makefile 2 | 3 | # -------------------------------------------------------------------------- 4 | # 5 | # 4r use 80486 timings and register argument passing 6 | # c compile only 7 | # d1 include line number debugging information 8 | # d2 include full sybolic debugging information 9 | # ei force enums to be of type int 10 | # j change char default from unsigned to signed 11 | # oa relax aliasing checking 12 | # od do not optimize 13 | # oe[=#] expand functions inline, # = quads (default 20) 14 | # oi use the inline library functions 15 | # om generate inline 80x87 code for math functions 16 | # ot optimize for time 17 | # ox maximum optimization 18 | # s remove stack overflow checks 19 | # zp1 align structures on bytes 20 | # zq use quiet mode 21 | # /i=dir add include directories 22 | # 23 | # mh huge memory model 24 | # ml large memory model 25 | # fpi inline 80x87 instructions with emulation 26 | # -o optimization: a : relax aliasing constraints 27 | # zq operate quietly 28 | # zp1 pack structure members with alignment 1 29 | # zt# set far data threshold (i.e., larger objects go in far memory) 30 | # -------------------------------------------------------------------------- 31 | 32 | 33 | # time optimized seems a LOT faster... ? 34 | # size optimized saves around 10k 35 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -s -zdp -0 -dCODEGEN_SKIP_MENU 36 | #CCOPTS = -zp1 -oaxet -oi -zq -j -mm -s -zdp -d__USED000=1 -dCODEGEN_SKIP_MENU 37 | 38 | GLOBOBJS = & 39 | m_near.obj & 40 | codegen.obj 41 | 42 | 43 | codegen.exe : $(GLOBOBJS) 44 | wlink @build\codegen.lnk 45 | wstrip codegen.exe 46 | 47 | .c.obj : 48 | wcc $(CCOPTS) $[* 49 | 50 | .c : build\tools\codegen\ 51 | 52 | .asm.obj : 53 | tasm /mx /m2 /w2 /q /zi $(ASMOPTS) $[* 54 | 55 | clean : .SYMBOLIC 56 | del m_near.obj 57 | del codegen.obj 58 | del *.err 59 | -------------------------------------------------------------------------------- /build/makeht: -------------------------------------------------------------------------------- 1 | # RealDOOM makefile 2 | 3 | # -------------------------------------------------------------------------- 4 | # 5 | # 4r use 80486 timings and register argument passing 6 | # c compile only 7 | # d1 include line number debugging information 8 | # d2 include full sybolic debugging information 9 | # ei force enums to be of type int 10 | # j change char default from unsigned to signed 11 | # oa relax aliasing checking 12 | # od do not optimize 13 | # oe[=#] expand functions inline, # = quads (default 20) 14 | # oi use the inline library functions 15 | # om generate inline 80x87 code for math functions 16 | # ot optimize for time 17 | # os optimize for size 18 | # ox maximum optimization 19 | # s remove stack overflow checks 20 | # zp1 align structures on bytes 21 | # zq use quiet mode 22 | # /i=dir add include directories 23 | # 24 | # mh huge memory model 25 | # ml large memory model 26 | # fpi inline 80x87 instructions with emulation 27 | # -o optimization: a : relax aliasing constraints 28 | # zq operate quietly 29 | # zp1 pack structure members with alignment 1 30 | # zt# set far data threshold (i.e., larger objects go in far memory) 31 | # wx set maximum compiler warning level (helps find unused vars) 32 | # zc store strings in code instead of DGROUP (large memory model only) 33 | # zdp forces ds register to always point to dgroup. default for medium 34 | # zdf allows ds register to point to other things. default for other modes 35 | # -------------------------------------------------------------------------- 36 | 37 | 38 | # time optimized seems a LOT faster... ? 39 | # size optimized saves around 10k 40 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s -zdp -d__HT18_BUILD=1 -d__CHIPSET_BUILD=1 -d__USED000=1 41 | ASMOPTS = /d_USED000=1 /dCOMPILE_INSTRUCTIONSET=2 42 | 43 | GLOBOBJS = & 44 | m_near.obj & 45 | i_init.obj & 46 | i_quit.obj & 47 | i_main.obj & 48 | i_ibm.obj & 49 | i_sound.obj & 50 | f_finale.obj & 51 | d_init.obj & 52 | d_main.obj & 53 | d_net.obj & 54 | g_setup.obj & 55 | g_game.obj & 56 | m_menu.obj & 57 | m_misc.obj & 58 | am_map.obj & 59 | p_init.obj & 60 | p_ceilng.obj & 61 | p_doors.obj & 62 | p_enemy.obj & 63 | p_floor.obj & 64 | p_inter.obj & 65 | p_lights.obj & 66 | p_map.obj & 67 | p_plats.obj & 68 | p_pspr.obj & 69 | p_setup.obj & 70 | p_spec.obj & 71 | p_switch.obj & 72 | p_mobj.obj & 73 | p_mobja.obj & 74 | p_telept.obj & 75 | p_tick.obj & 76 | p_user.obj & 77 | r_init.obj & 78 | r_setup.obj & 79 | r_data.obj & 80 | r_dataa.obj & 81 | r_draw.obj & 82 | r_main.obj & 83 | w_init.obj & 84 | w_wad.obj & 85 | v_video.obj & 86 | z_init.obj & 87 | z_zone.obj & 88 | z_ht18.obj & 89 | st_init.obj & 90 | st_setup.obj & 91 | st_stuff.obj & 92 | hu_setup.obj & 93 | hu_stuff.obj & 94 | hu_lib.obj & 95 | s_sound.obj & 96 | s_sbsfx.obj & 97 | dmx.obj & 98 | d_int.obj & 99 | memory.obj & 100 | math.obj & 101 | main.obj & 102 | d_algo.obj & 103 | r_math.obj & 104 | r_mainhi.obj & 105 | video.obj 106 | 107 | doomout.exe : $(GLOBOBJS) i_ibm.obj 108 | wlink @build/rdoomht.lnk 109 | copy doomout.exe bin\doom.exe 110 | wstrip bin\doom.exe 111 | 112 | .c.obj : 113 | wcc $(CCOPTS) $[* 114 | 115 | .asm.obj : 116 | tasm /mx /m2 /w2 /q /zi $(ASMOPTS) $[* 117 | 118 | clean : .SYMBOLIC 119 | del *.obj 120 | del *.err 121 | del doomout.exe 122 | -------------------------------------------------------------------------------- /build/makesc: -------------------------------------------------------------------------------- 1 | # RealDOOM makefile 2 | 3 | # -------------------------------------------------------------------------- 4 | # 5 | # 4r use 80486 timings and register argument passing 6 | # c compile only 7 | # d1 include line number debugging information 8 | # d2 include full sybolic debugging information 9 | # ei force enums to be of type int 10 | # j change char default from unsigned to signed 11 | # oa relax aliasing checking 12 | # od do not optimize 13 | # oe[=#] expand functions inline, # = quads (default 20) 14 | # oi use the inline library functions 15 | # om generate inline 80x87 code for math functions 16 | # ot optimize for time 17 | # os optimize for size 18 | # ox maximum optimization 19 | # s remove stack overflow checks 20 | # zp1 align structures on bytes 21 | # zq use quiet mode 22 | # /i=dir add include directories 23 | # 24 | # mh huge memory model 25 | # ml large memory model 26 | # fpi inline 80x87 instructions with emulation 27 | # -o optimization: a : relax aliasing constraints 28 | # zq operate quietly 29 | # zp1 pack structure members with alignment 1 30 | # zt# set far data threshold (i.e., larger objects go in far memory) 31 | # wx set maximum compiler warning level (helps find unused vars) 32 | # zc store strings in code instead of DGROUP (large memory model only) 33 | # zdp forces ds register to always point to dgroup. default for medium 34 | # zdf allows ds register to point to other things. default for other modes 35 | # -------------------------------------------------------------------------- 36 | 37 | 38 | # time optimized seems a LOT faster... ? 39 | # size optimized saves around 10k 40 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s -zdp -d__SCAMP_BUILD=1 -d__CHIPSET_BUILD=1 41 | ASMOPTS = /d_USED000=0 /dCOMPILE_INSTRUCTIONSET=2 42 | 43 | GLOBOBJS = & 44 | m_near.obj & 45 | i_init.obj & 46 | i_quit.obj & 47 | i_main.obj & 48 | i_ibm.obj & 49 | i_sound.obj & 50 | f_finale.obj & 51 | d_init.obj & 52 | d_main.obj & 53 | d_net.obj & 54 | g_setup.obj & 55 | g_game.obj & 56 | m_menu.obj & 57 | m_misc.obj & 58 | am_map.obj & 59 | p_init.obj & 60 | p_ceilng.obj & 61 | p_doors.obj & 62 | p_enemy.obj & 63 | p_floor.obj & 64 | p_inter.obj & 65 | p_lights.obj & 66 | p_map.obj & 67 | p_plats.obj & 68 | p_pspr.obj & 69 | p_setup.obj & 70 | p_spec.obj & 71 | p_switch.obj & 72 | p_mobj.obj & 73 | p_mobja.obj & 74 | p_telept.obj & 75 | p_tick.obj & 76 | p_user.obj & 77 | r_init.obj & 78 | r_setup.obj & 79 | r_data.obj & 80 | r_dataa.obj & 81 | r_draw.obj & 82 | r_main.obj & 83 | w_init.obj & 84 | w_wad.obj & 85 | v_video.obj & 86 | z_init.obj & 87 | z_zone.obj & 88 | z_scamp.obj & 89 | st_init.obj & 90 | st_setup.obj & 91 | st_stuff.obj & 92 | hu_setup.obj & 93 | hu_stuff.obj & 94 | hu_lib.obj & 95 | s_sound.obj & 96 | s_sbsfx.obj & 97 | dmx.obj & 98 | d_int.obj & 99 | memory.obj & 100 | math.obj & 101 | main.obj & 102 | d_algo.obj & 103 | r_math.obj & 104 | r_mainhi.obj & 105 | video.obj 106 | 107 | doomout.exe : $(GLOBOBJS) i_ibm.obj 108 | wlink @build/rdoomsc.lnk 109 | copy doomout.exe bin\doom.exe 110 | wstrip bin\doom.exe 111 | 112 | .c.obj : 113 | wcc $(CCOPTS) $[* 114 | 115 | .asm.obj : 116 | tasm /mx /m2 /w2 /q /zi $(ASMOPTS) $[* 117 | 118 | clean : .SYMBOLIC 119 | del *.obj 120 | del *.err 121 | -------------------------------------------------------------------------------- /build/makescat: -------------------------------------------------------------------------------- 1 | # RealDOOM makefile 2 | 3 | # -------------------------------------------------------------------------- 4 | # 5 | # 4r use 80486 timings and register argument passing 6 | # c compile only 7 | # d1 include line number debugging information 8 | # d2 include full sybolic debugging information 9 | # ei force enums to be of type int 10 | # j change char default from unsigned to signed 11 | # oa relax aliasing checking 12 | # od do not optimize 13 | # oe[=#] expand functions inline, # = quads (default 20) 14 | # oi use the inline library functions 15 | # om generate inline 80x87 code for math functions 16 | # ot optimize for time 17 | # os optimize for size 18 | # ox maximum optimization 19 | # s remove stack overflow checks 20 | # zp1 align structures on bytes 21 | # zq use quiet mode 22 | # /i=dir add include directories 23 | # 24 | # mh huge memory model 25 | # ml large memory model 26 | # fpi inline 80x87 instructions with emulation 27 | # -o optimization: a : relax aliasing constraints 28 | # zq operate quietly 29 | # zp1 pack structure members with alignment 1 30 | # zt# set far data threshold (i.e., larger objects go in far memory) 31 | # wx set maximum compiler warning level (helps find unused vars) 32 | # zc store strings in code instead of DGROUP (large memory model only) 33 | # zdp forces ds register to always point to dgroup. default for medium 34 | # zdf allows ds register to point to other things. default for other modes 35 | # -------------------------------------------------------------------------- 36 | 37 | 38 | # time optimized seems a LOT faster... ? 39 | # size optimized saves around 10k 40 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -2 -s -zdp -d__SCAT_BUILD=1 -d__CHIPSET_BUILD=1 41 | ASMOPTS = /d_USED000=0 /dCOMPILE_INSTRUCTIONSET=2 42 | 43 | GLOBOBJS = & 44 | m_near.obj & 45 | i_init.obj & 46 | i_quit.obj & 47 | i_main.obj & 48 | i_ibm.obj & 49 | i_sound.obj & 50 | f_finale.obj & 51 | d_init.obj & 52 | & 53 | d_main.obj & 54 | d_net.obj & 55 | g_setup.obj & 56 | g_game.obj & 57 | m_menu.obj & 58 | m_misc.obj & 59 | am_map.obj & 60 | p_init.obj & 61 | p_ceilng.obj & 62 | p_doors.obj & 63 | p_enemy.obj & 64 | p_floor.obj & 65 | p_inter.obj & 66 | p_lights.obj & 67 | p_map.obj & 68 | p_plats.obj & 69 | p_pspr.obj & 70 | p_setup.obj & 71 | p_spec.obj & 72 | p_switch.obj & 73 | p_mobj.obj & 74 | p_mobja.obj & 75 | p_telept.obj & 76 | p_tick.obj & 77 | p_user.obj & 78 | r_init.obj & 79 | r_setup.obj & 80 | r_data.obj & 81 | r_dataa.obj & 82 | r_draw.obj & 83 | r_main.obj & 84 | w_init.obj & 85 | w_wad.obj & 86 | v_video.obj & 87 | z_init.obj & 88 | z_zone.obj & 89 | z_scat.obj & 90 | st_init.obj & 91 | st_setup.obj & 92 | st_stuff.obj & 93 | hu_setup.obj & 94 | hu_stuff.obj & 95 | hu_lib.obj & 96 | s_sound.obj & 97 | s_sbsfx.obj & 98 | dmx.obj & 99 | d_int.obj & 100 | memory.obj & 101 | math.obj & 102 | d_algo.obj & 103 | r_math.obj & 104 | r_mainhi.obj & 105 | video.obj 106 | 107 | doomout.exe : $(GLOBOBJS) i_ibm.obj 108 | wlink @build/rdoomsct.lnk 109 | copy doomout.exe bin\doom.exe 110 | wstrip bin\doom.exe 111 | 112 | .c.obj : 113 | wcc $(CCOPTS) $[* 114 | 115 | .asm.obj : 116 | tasm /mx /m2 /w2 /q /zi $(ASMOPTS) $[* 117 | 118 | clean : .SYMBOLIC 119 | del *.obj 120 | del *.err 121 | del doomout.exe 122 | -------------------------------------------------------------------------------- /build/rdoom16.lnk: -------------------------------------------------------------------------------- 1 | # RealDOOM linker file 2 | 3 | option quiet 4 | option map 5 | # 2536 seems to work (?) 6 | #option stack=2536 7 | option stack=3072 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name doomout 13 | 14 | #NEWSEGMENT 15 | 16 | file m_near.obj 17 | file d_init.obj 18 | file st_init.obj 19 | file r_init.obj 20 | file w_init.obj 21 | file i_init.obj 22 | file z_init.obj 23 | file p_init.obj 24 | 25 | NEWSEGMENT 26 | file i_main.obj 27 | file i_quit.obj 28 | file i_ibm.obj 29 | file i_sound.obj 30 | file d_main.obj 31 | file d_net.obj 32 | file g_game.obj 33 | file m_misc.obj 34 | file am_map.obj 35 | file st_stuff.obj 36 | file hu_stuff.obj 37 | file hu_lib.obj 38 | file m_menu.obj 39 | file d_algo.obj 40 | file dmx.obj 41 | file d_int.obj 42 | file memory.obj 43 | file math.obj 44 | file main.obj 45 | 46 | 47 | #these files put in overlay 48 | file g_setup.obj 49 | file r_setup.obj 50 | file st_setup.obj 51 | file hu_setup.obj 52 | 53 | 54 | 55 | #todo put these in the future wad segment. maybe pull out p_tick. 56 | NEWSEGMENT 57 | file s_sound.obj 58 | file s_sbsfx.obj 59 | file p_ceilng.obj 60 | file p_doors.obj 61 | file p_enemy.obj 62 | file p_floor.obj 63 | file p_inter.obj 64 | file p_lights.obj 65 | file p_map.obj 66 | file p_plats.obj 67 | file p_pspr.obj 68 | file p_spec.obj 69 | file p_switch.obj 70 | file p_mobj.obj 71 | file p_mobja.obj 72 | file p_telept.obj 73 | file p_tick.obj 74 | file p_user.obj 75 | 76 | 77 | NEWSEGMENT 78 | file r_data.obj 79 | file r_dataa.obj 80 | file r_math.obj 81 | file r_mainhi.obj 82 | file r_draw.obj 83 | file r_main.obj 84 | file w_wad.obj 85 | file video.obj 86 | file v_video.obj 87 | file z_zone.obj 88 | 89 | NEWSEGMENT 90 | file p_setup.obj 91 | 92 | 93 | 94 | 95 | # here we move _DATA before CONST and CONST2. 96 | ORDER clname CODE 97 | clname FAR_DATA #segaddr=22FD 98 | clname BEGDATA segment _NULL segment _AFTERNULL 99 | clname DATA segment _FIXEDDATA segment _DATA 100 | clname BSS 101 | clname STACK 102 | clname START 103 | 104 | -------------------------------------------------------------------------------- /build/rdoom32.lnk: -------------------------------------------------------------------------------- 1 | # RealDOOM linker file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=3072 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name doomout 13 | 14 | 15 | file m_near.obj 16 | file d_init.obj 17 | file st_init.obj 18 | file r_init.obj 19 | file w_init.obj 20 | file i_init.obj 21 | file z_init.obj 22 | file p_init.obj 23 | 24 | NEWSEGMENT 25 | file i_main.obj 26 | file i_quit.obj 27 | file i_ibm.obj 28 | file i_sound.obj 29 | file d_main.obj 30 | file d_net.obj 31 | file g_game.obj 32 | file m_misc.obj 33 | file am_map.obj 34 | file st_stuff.obj 35 | file hu_stuff.obj 36 | file hu_lib.obj 37 | file m_menu.obj 38 | file d_algo.obj 39 | file dmx.obj 40 | file d_int.obj 41 | file memory.obj 42 | file math.obj 43 | file math386.obj 44 | file main.obj 45 | 46 | 47 | #these files put in overlay 48 | file g_setup.obj 49 | file r_setup.obj 50 | file st_setup.obj 51 | file hu_setup.obj 52 | 53 | 54 | #todo put these in the future wad segment. maybe pull out p_tick. 55 | NEWSEGMENT 56 | file s_sound.obj 57 | file s_sbsfx.obj 58 | file p_ceilng.obj 59 | file p_doors.obj 60 | file p_enemy.obj 61 | file p_floor.obj 62 | file p_inter.obj 63 | file p_lights.obj 64 | file p_map.obj 65 | file p_plats.obj 66 | file p_pspr.obj 67 | file p_spec.obj 68 | file p_switch.obj 69 | file p_mobj.obj 70 | file p_mobja.obj 71 | file p_telept.obj 72 | file p_tick.obj 73 | file p_user.obj 74 | 75 | 76 | NEWSEGMENT 77 | file r_data.obj 78 | file r_dataa.obj 79 | file r_math.obj 80 | file r_mainhi.obj 81 | file r_draw.obj 82 | file r_main.obj 83 | file w_wad.obj 84 | file video.obj 85 | file v_video.obj 86 | file z_zone.obj 87 | 88 | 89 | NEWSEGMENT 90 | file p_setup.obj 91 | 92 | 93 | 94 | 95 | 96 | # here we move _DATA before CONST and CONST2. 97 | ORDER clname CODE 98 | clname FAR_DATA #segaddr=22FD 99 | clname BEGDATA segment _NULL segment _AFTERNULL 100 | clname DATA segment _FIXEDDATA segment _DATA 101 | clname BSS 102 | clname STACK 103 | clname START 104 | -------------------------------------------------------------------------------- /build/rdoomht.lnk: -------------------------------------------------------------------------------- 1 | # RealDOOM linker file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=3072 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name doomout 13 | 14 | 15 | file m_near.obj 16 | file d_init.obj 17 | file st_init.obj 18 | file r_init.obj 19 | file w_init.obj 20 | file i_init.obj 21 | file z_init.obj 22 | file p_init.obj 23 | 24 | NEWSEGMENT 25 | file i_main.obj 26 | file i_quit.obj 27 | file i_ibm.obj 28 | file i_sound.obj 29 | file d_main.obj 30 | file d_net.obj 31 | file g_game.obj 32 | file m_misc.obj 33 | file am_map.obj 34 | file st_stuff.obj 35 | file hu_stuff.obj 36 | file hu_lib.obj 37 | file m_menu.obj 38 | file d_algo.obj 39 | file dmx.obj 40 | file d_int.obj 41 | file memory.obj 42 | file math.obj 43 | file main.obj 44 | 45 | 46 | #these files put in overlay 47 | file g_setup.obj 48 | file r_setup.obj 49 | file st_setup.obj 50 | file hu_setup.obj 51 | 52 | 53 | #todo put these in the future wad segment. maybe pull out p_tick. 54 | NEWSEGMENT 55 | file s_sound.obj 56 | file s_sbsfx.obj 57 | file p_ceilng.obj 58 | file p_doors.obj 59 | file p_enemy.obj 60 | file p_floor.obj 61 | file p_inter.obj 62 | file p_lights.obj 63 | file p_map.obj 64 | file p_plats.obj 65 | file p_pspr.obj 66 | file p_spec.obj 67 | file p_switch.obj 68 | file p_mobj.obj 69 | file p_mobja.obj 70 | file p_telept.obj 71 | file p_tick.obj 72 | file p_user.obj 73 | 74 | 75 | NEWSEGMENT 76 | file r_data.obj 77 | file r_dataa.obj 78 | file r_math.obj 79 | file r_mainhi.obj 80 | file r_draw.obj 81 | file r_main.obj 82 | file w_wad.obj 83 | file video.obj 84 | file v_video.obj 85 | file z_zone.obj 86 | file z_ht18.obj 87 | 88 | 89 | NEWSEGMENT 90 | file p_setup.obj 91 | 92 | 93 | # here we move _DATA before CONST and CONST2. 94 | ORDER clname CODE 95 | clname FAR_DATA #segaddr=22FD 96 | clname BEGDATA segment _NULL segment _AFTERNULL 97 | clname DATA segment _FIXEDDATA segment _DATA 98 | clname BSS 99 | clname STACK 100 | clname START 101 | -------------------------------------------------------------------------------- /build/rdoomsc.lnk: -------------------------------------------------------------------------------- 1 | # RealDOOM linker file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=3072 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name doomout 13 | 14 | 15 | file m_near.obj 16 | file d_init.obj 17 | file st_init.obj 18 | file r_init.obj 19 | file w_init.obj 20 | file i_init.obj 21 | file z_init.obj 22 | file p_init.obj 23 | 24 | NEWSEGMENT 25 | file i_main.obj 26 | file i_quit.obj 27 | file i_ibm.obj 28 | file i_sound.obj 29 | file d_main.obj 30 | file d_net.obj 31 | file g_game.obj 32 | file m_misc.obj 33 | file am_map.obj 34 | file st_stuff.obj 35 | file hu_stuff.obj 36 | file hu_lib.obj 37 | file m_menu.obj 38 | file d_algo.obj 39 | file dmx.obj 40 | file d_int.obj 41 | file memory.obj 42 | file math.obj 43 | file main.obj 44 | 45 | #these files put in overlay 46 | file g_setup.obj 47 | file r_setup.obj 48 | file st_setup.obj 49 | file hu_setup.obj 50 | 51 | 52 | 53 | #todo put these in the future wad segment. maybe pull out p_tick. 54 | NEWSEGMENT 55 | file s_sound.obj 56 | file s_sbsfx.obj 57 | file p_ceilng.obj 58 | file p_doors.obj 59 | file p_enemy.obj 60 | file p_floor.obj 61 | file p_inter.obj 62 | file p_lights.obj 63 | file p_map.obj 64 | file p_plats.obj 65 | file p_pspr.obj 66 | file p_spec.obj 67 | file p_switch.obj 68 | file p_mobj.obj 69 | file p_mobja.obj 70 | file p_telept.obj 71 | file p_tick.obj 72 | file p_user.obj 73 | 74 | 75 | NEWSEGMENT 76 | file r_data.obj 77 | file r_dataa.obj 78 | file r_math.obj 79 | file r_mainhi.obj 80 | file r_draw.obj 81 | file r_main.obj 82 | file w_wad.obj 83 | file video.obj 84 | file v_video.obj 85 | file z_zone.obj 86 | file z_scamp.obj 87 | 88 | 89 | NEWSEGMENT 90 | file p_setup.obj 91 | 92 | 93 | 94 | # here we move _DATA before CONST and CONST2. 95 | ORDER clname CODE 96 | clname FAR_DATA #segaddr=22FD 97 | clname BEGDATA segment _NULL segment _AFTERNULL 98 | clname DATA segment _FIXEDDATA segment _DATA 99 | clname BSS 100 | clname STACK 101 | clname START 102 | -------------------------------------------------------------------------------- /build/rdoomsct.lnk: -------------------------------------------------------------------------------- 1 | # RealDOOM linker file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | #option stack=2536 7 | option stack=3072 8 | debug all 9 | libpath %WATCOM%\lib286 10 | libpath %WATCOM%\lib286\dos 11 | format dos 12 | name doomout 13 | 14 | file m_near.obj 15 | file d_init.obj 16 | file st_init.obj 17 | file r_init.obj 18 | file w_init.obj 19 | file i_init.obj 20 | file z_init.obj 21 | file p_init.obj 22 | 23 | NEWSEGMENT 24 | file i_main.obj 25 | file i_quit.obj 26 | file i_ibm.obj 27 | file i_sound.obj 28 | file d_main.obj 29 | file d_net.obj 30 | file g_game.obj 31 | file m_misc.obj 32 | file am_map.obj 33 | file st_stuff.obj 34 | file hu_stuff.obj 35 | file hu_lib.obj 36 | file m_menu.obj 37 | file d_algo.obj 38 | file dmx.obj 39 | file d_int.obj 40 | file memory.obj 41 | file math.obj 42 | file main.obj 43 | 44 | 45 | #these files put in overlay 46 | file g_setup.obj 47 | file r_setup.obj 48 | file st_setup.obj 49 | file hu_setup.obj 50 | 51 | 52 | #todo put these in the future wad segment. maybe pull out p_tick. 53 | NEWSEGMENT 54 | file s_sound.obj 55 | file s_sbsfx.obj 56 | file p_ceilng.obj 57 | file p_doors.obj 58 | file p_enemy.obj 59 | file p_floor.obj 60 | file p_inter.obj 61 | file p_lights.obj 62 | file p_map.obj 63 | file p_plats.obj 64 | file p_pspr.obj 65 | file p_spec.obj 66 | file p_switch.obj 67 | file p_mobj.obj 68 | file p_mobja.obj 69 | file p_telept.obj 70 | file p_tick.obj 71 | file p_user.obj 72 | 73 | 74 | NEWSEGMENT 75 | file r_data.obj 76 | file r_dataa.obj 77 | file r_math.obj 78 | file r_mainhi.obj 79 | file r_draw.obj 80 | file r_main.obj 81 | file w_wad.obj 82 | file video.obj 83 | file v_video.obj 84 | file z_zone.obj 85 | file z_scat.obj 86 | 87 | 88 | NEWSEGMENT 89 | file p_setup.obj 90 | 91 | 92 | 93 | # here we move _DATA before CONST and CONST2. 94 | ORDER clname CODE 95 | clname FAR_DATA #segaddr=22FD 96 | clname BEGDATA segment _NULL segment _AFTERNULL 97 | clname DATA segment _FIXEDDATA segment _DATA 98 | clname BSS 99 | clname STACK 100 | clname START 101 | -------------------------------------------------------------------------------- /build/tools/dumprint/DUMPDUMP.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/build/tools/dumprint/DUMPDUMP.BIN -------------------------------------------------------------------------------- /build/tools/dumprint/DUMPRINT.EXE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/build/tools/dumprint/DUMPRINT.EXE -------------------------------------------------------------------------------- /build/tools/dumprint/dumprint.lnk: -------------------------------------------------------------------------------- 1 | # newdoom.EXE Linker directive file 2 | 3 | option quiet 4 | option map 5 | # tested as low as 3000 successfully. 2000 crashes sometimes, sorta deep into demos?? 6 | option stack=2536 7 | debug all 8 | libpath %WATCOM%\lib286 9 | libpath %WATCOM%\lib286\dos 10 | format dos 11 | name print16 12 | 13 | 14 | file dumprint.obj 15 | -------------------------------------------------------------------------------- /build/tools/dumprint/make286: -------------------------------------------------------------------------------- 1 | CCOPTS = -zp1 -oaxet -oi -zq -j -mm -0 -s -zdp -d__COMPILER_WATCOM 2 | 3 | GLOBOBJS = & 4 | dumprint.obj 5 | 6 | print16.exe : $(GLOBOBJS) 7 | wlink @dumprint.lnk 8 | copy print16.exe dumprint.exe 9 | wstrip dumprint.exe 10 | 11 | .c.obj : 12 | wcc $(CCOPTS) $[* 13 | 14 | clean : .SYMBOLIC 15 | del *.obj 16 | del *.err 17 | del dumprint.exe 18 | -------------------------------------------------------------------------------- /build/tools/dumprint/make286.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | wmake -f make286 %1 %2 %3 %4 %5 %6 %7 %8 %9 3 | -------------------------------------------------------------------------------- /current16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/current16.png -------------------------------------------------------------------------------- /d_algo.asm: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 1993-1996 Id Software, Inc. 2 | ; Copyright (C) 1993-2008 Raven Software 3 | ; Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | ; 5 | ; This program is free software; you can redistribute it and/or 6 | ; modify it under the terms of the GNU General Public License 7 | ; as published by the Free Software Foundation; either version 2 8 | ; of the License, or (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 | ; DESCRIPTION: 16 | ; 17 | INCLUDE defs.inc 18 | INSTRUCTION_SET_MACRO 19 | 20 | 21 | .CODE 22 | 23 | 24 | 25 | PROC resetDS_ FAR 26 | PUBLIC resetDS_ 27 | 28 | ;todo is ax necessary? if 286+ can push immediate. 29 | push ax 30 | mov ax, 03C00h 31 | mov ds, ax 32 | pop ax 33 | 34 | retf 35 | endp 36 | 37 | 38 | PROC hackDS_ FAR 39 | PUBLIC hackDS_ 40 | 41 | ;todo: make cli held for less time 42 | 43 | cli 44 | push cx 45 | push si 46 | push di 47 | 48 | mov ds:[_stored_ds], ds 49 | xor di, di 50 | mov si, di 51 | mov cx, 03C00h 52 | 53 | ;mov cx, ds 54 | ;add cx, 400h 55 | mov es, cx 56 | 57 | mov CX, 2000h ; 4000h bytes 58 | rep movsw 59 | 60 | mov cx, es 61 | mov ds, cx 62 | mov ss, cx 63 | 64 | COMMENT @ 65 | 66 | ;; clear out BASE_LOWER_MEMORY_SEGMENT. Not needed? if we do this then push/pop ax! 67 | push ax 68 | mov cx, BASE_LOWER_MEMORY_SEGMENT 69 | mov es, cx 70 | 71 | ; zero up till 3C00h 72 | mov cx, 03C00h 73 | sub cx, BASE_LOWER_MEMORY_SEGMENT 74 | SHIFT_MACRO shl cx 3 75 | 76 | 77 | xor ax, ax 78 | mov di, ax 79 | rep stosw 80 | pop ax 81 | @ 82 | 83 | pop di 84 | pop si 85 | pop cx 86 | 87 | 88 | 89 | 90 | sti 91 | 92 | 93 | 94 | retf 95 | 96 | ENDP 97 | 98 | 99 | ; nice for debug... 100 | COMMENT @ 101 | 102 | PROC getSPBP_ FAR 103 | PUBLIC getSPBP_ 104 | 105 | mov dx, sp 106 | mov ax, bp 107 | 108 | 109 | retf 110 | 111 | 112 | PROC getDSSS_ FAR 113 | PUBLIC getDSSS_ 114 | 115 | mov dx, ds 116 | mov ax, ss 117 | 118 | 119 | retf 120 | 121 | @ 122 | 123 | PROC hackDSBack_ FAR 124 | PUBLIC hackDSBack_ 125 | 126 | cli 127 | push cx 128 | push si 129 | push di 130 | 131 | mov es, ds:[_stored_ds] 132 | 133 | xor di, di 134 | mov si, di 135 | mov CX, 2000h ; 4000h bytes 136 | rep movsw 137 | mov cx, es 138 | mov ds, cx 139 | mov ss, cx 140 | 141 | 142 | pop di 143 | pop si 144 | pop cx 145 | 146 | 147 | sti 148 | 149 | 150 | 151 | retf 152 | 153 | ENDP 154 | 155 | ; end marker for this asm file 156 | PROC D_ALGO_END_ FAR 157 | PUBLIC D_ALGO_END_ 158 | ENDP 159 | 160 | 161 | END -------------------------------------------------------------------------------- /d_event.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // 17 | 18 | #ifndef __D_EVENT__ 19 | #define __D_EVENT__ 20 | 21 | 22 | #include "doomtype.h" 23 | 24 | 25 | // 26 | // Event handling. 27 | // 28 | 29 | // Input event types. 30 | #define ev_keydown 0 31 | #define ev_keyup 1 32 | #define ev_mouse 2 33 | 34 | typedef uint8_t evtype_t; 35 | 36 | // Event structure. 37 | // todo 13 bytes gross. maybe re-align at least. 38 | typedef struct { 39 | evtype_t type; 40 | int32_t data1; // keys / mouse buttons 41 | int32_t data2; // mouse x move 42 | int32_t data3; // mouse y move 43 | } event_t; 44 | 45 | 46 | #define ga_nothing 0 47 | #define ga_loadlevel 1 48 | #define ga_newgame 2 49 | #define ga_loadgame 3 50 | #define ga_savegame 4 51 | #define ga_playdemo 5 52 | #define ga_completed 6 53 | #define ga_victory 7 54 | #define ga_worlddone 8 55 | 56 | typedef uint8_t gameaction_t; 57 | 58 | 59 | 60 | // 61 | // Button/action code definitions. 62 | // 63 | // Press "Fire". 64 | #define BT_ATTACK 1 65 | // Use button, to open doors, activate switches. 66 | #define BT_USE 2 67 | 68 | // Flag: game events, not really buttons. 69 | #define BT_SPECIAL 128 70 | #define BT_SPECIALMASK 3 71 | 72 | // Flag, weapon change pending. 73 | // If true, the next 3 bits hold weapon num. 74 | #define BT_CHANGE 4 75 | // The 3bit weapon mask and shift, convenience. 76 | #define BT_WEAPONMASK (8+16+32) 77 | #define BT_WEAPONSHIFT 3 78 | 79 | // Pause the game. 80 | #define BTS_PAUSE 1 81 | // Save the game at each console. 82 | #define BTS_SAVEGAME 2 83 | 84 | // Savegame slot numbers 85 | // occupy the second byte of buttons. 86 | #define BTS_SAVEMASK (4+8+16) 87 | #define BTS_SAVESHIFT 2 88 | 89 | typedef uint8_t buttoncode_t; 90 | 91 | 92 | 93 | 94 | // 95 | // GLOBAL VARIABLES 96 | // 97 | #define MAXEVENTS 64 98 | 99 | 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /d_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // System specific interface stuff. 17 | // 18 | 19 | #ifndef __D_MAIN__ 20 | #define __D_MAIN__ 21 | 22 | #include "d_event.h" 23 | 24 | 25 | void __near D_DoomMain (void); 26 | 27 | // Called by IO functions when input is detected. 28 | void __near D_PostEvent (event_t __far* ev); 29 | 30 | 31 | // 32 | // BASE LEVEL 33 | // 34 | void __near D_PageTicker (void); 35 | void __near D_PageDrawer (void); 36 | void __far D_StartTitle (void); 37 | 38 | 39 | 40 | 41 | void __near D_DoomLoop(void); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /d_math.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Header for math-related optimization functions 17 | // 18 | 19 | 20 | 21 | 22 | #ifndef __D_MATH__ 23 | #define __D_MATH__ 24 | #include "doomtype.h" 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /d_net.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // DOOM Network game communication and protocol, 17 | // all OS independend parts. 18 | // 19 | 20 | #include "m_menu.h" 21 | #include "i_system.h" 22 | #include "g_game.h" 23 | #include "doomdef.h" 24 | #include "doomstat.h" 25 | #include "m_near.h" 26 | 27 | // 28 | // NETWORKING 29 | // 30 | // gametic is the tic about to (or currently being) run 31 | // maketic is the tick that hasn't had control made for it yet 32 | // nettics[] has the maketics for all players 33 | // 34 | // a gametic cannot be run until nettics[] > gametic for all players 35 | // 36 | #define PL_DRONE 0x80 // bit flag in doomdata->player 37 | 38 | 39 | 40 | //int16_t skiptics; 41 | 42 | void __near D_ProcessEvents(void); 43 | void __near G_BuildTiccmd(int8_t index); 44 | void __near D_DoAdvanceDemo(void); 45 | 46 | // 47 | // NetUpdate 48 | // Builds ticcmds for console player, 49 | // sends out a packet 50 | // 51 | 52 | void NetUpdate(void) { 53 | uint32_t nowtime; 54 | int16_t newtics; 55 | int16_t i; 56 | 57 | // check time 58 | nowtime = ticcount; 59 | newtics = nowtime - gametime; 60 | 61 | if (newtics <= 0){ // nothing new to update 62 | return; 63 | } 64 | 65 | gametime = nowtime; 66 | 67 | // build new ticcmds for console player 68 | for (i = 0; i < newtics; i++) { 69 | I_StartTic(); 70 | D_ProcessEvents(); 71 | if (maketic - gametic >= (BACKUPTICS / 2 - 1)) { 72 | break; // can't hold any more 73 | } 74 | 75 | G_BuildTiccmd(maketic & (BACKUPTICS - 1)); 76 | maketic++; 77 | } 78 | 79 | } 80 | 81 | void __far WI_otherchecksum(int16_t i); 82 | 83 | void __near TryRunTics(void) { 84 | // dont need 32 bit precision to find a diff. 85 | uint16_t entertic; 86 | int16_t realtics; 87 | int16_t availabletics; 88 | int16_t counts; 89 | 90 | // get real tics 91 | entertic = ticcount; 92 | realtics = entertic - oldentertics; 93 | oldentertics = entertic; 94 | 95 | // get available tics 96 | 97 | 98 | NetUpdate(); 99 | 100 | 101 | 102 | availabletics = maketic - gametic; 103 | 104 | // decide how many tics to run 105 | if (realtics + 1 < availabletics){ 106 | counts = realtics + 1; 107 | } else if (realtics < availabletics){ 108 | counts = realtics; 109 | } else { 110 | counts = availabletics; 111 | } 112 | 113 | if (counts < 1){ 114 | counts = 1; 115 | } 116 | 117 | // wait for new tics if needed 118 | while (maketic < gametic + counts) { 119 | NetUpdate(); 120 | 121 | // don't stay in here forever -- give the menu a chance to work 122 | if (ticcount - entertic >= 20) { 123 | M_Ticker(); 124 | return; 125 | } 126 | } 127 | 128 | // run the count dics 129 | while (counts--) { 130 | if (advancedemo){ 131 | D_DoAdvanceDemo(); 132 | } 133 | M_Ticker(); 134 | G_Ticker(); 135 | gametic++; 136 | NetUpdate(); // check for new console commands 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /d_net.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Networking stuff. 17 | // 18 | 19 | #ifndef __D_NET__ 20 | #define __D_NET__ 21 | 22 | #include "d_player.h" 23 | 24 | 25 | // 26 | // Network play related stuff. 27 | // There is a data struct that stores network 28 | // communication related stuff, and another 29 | // one that defines the actual packets to 30 | // be transmitted. 31 | // 32 | 33 | // Networking and tick handling related. 34 | #define BACKUPTICS 16 35 | 36 | typedef enum { 37 | CMD_SEND = 1, 38 | CMD_GET = 2 39 | 40 | } command_t; 41 | 42 | 43 | 44 | 45 | // Create any new ticcmds and broadcast to other players. 46 | void NetUpdate (void); 47 | 48 | 49 | //? how many ticks to run? 50 | void __near TryRunTics (void); 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /d_think.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // MapObj data. Map Objects or mobjs are actors, entities, 17 | // thinker, take-your-pick... anything that moves, acts, or 18 | // suffers state changes of more or less violent nature. 19 | // 20 | 21 | #ifndef __D_THINK__ 22 | #define __D_THINK__ 23 | 24 | #include "z_zone.h" 25 | 26 | 27 | 28 | // Historically, "think_t" is yet another 29 | // function pointer to a routine to handle 30 | // an actor. 31 | //typedef actionf_t think_t; 32 | 33 | typedef uint8_t ENEMYTHINKFUNCTION; 34 | 35 | 36 | #define ETF_NULL 0 37 | #define ETF_A_Light0 1 38 | #define ETF_A_WeaponReady 2 39 | #define ETF_A_Lower 3 40 | #define ETF_A_Raise 4 41 | #define ETF_A_Punch 5 42 | #define ETF_A_ReFire 6 43 | #define ETF_A_FirePistol 7 44 | #define ETF_A_Light1 8 45 | #define ETF_A_FireShotgun 9 46 | #define ETF_A_Light2 10 47 | #define ETF_A_FireShotgun2 11 48 | #define ETF_A_CheckReload 12 49 | #define ETF_A_OpenShotgun2 13 50 | #define ETF_A_LoadShotgun2 14 51 | #define ETF_A_CloseShotgun2 15 52 | #define ETF_A_FireCGun 16 53 | #define ETF_A_GunFlash 17 54 | #define ETF_A_FireMissile 18 55 | #define ETF_A_Saw 19 56 | #define ETF_A_FirePlasma 20 57 | #define ETF_A_BFGsound 21 58 | #define ETF_A_FireBFG 22 59 | #define ETF_A_BFGSpray 23 60 | #define ETF_A_Explode 24 61 | #define ETF_A_Pain 25 62 | #define ETF_A_PlayerScream 26 63 | #define ETF_A_Fall 27 64 | #define ETF_A_XScream 28 65 | #define ETF_A_Look 29 66 | #define ETF_A_Chase 30 67 | #define ETF_A_FaceTarget 31 68 | #define ETF_A_PosAttack 32 69 | #define ETF_A_Scream 33 70 | #define ETF_A_SPosAttack 34 71 | #define ETF_A_VileChase 35 72 | #define ETF_A_VileStart 36 73 | #define ETF_A_VileTarget 37 74 | #define ETF_A_VileAttack 38 75 | #define ETF_A_StartFire 39 76 | #define ETF_A_Fire 40 77 | #define ETF_A_FireCrackle 41 78 | #define ETF_A_Tracer 42 79 | #define ETF_A_SkelWhoosh 43 80 | #define ETF_A_SkelFist 44 81 | #define ETF_A_SkelMissile 45 82 | #define ETF_A_FatRaise 46 83 | #define ETF_A_FatAttack1 47 84 | #define ETF_A_FatAttack2 48 85 | #define ETF_A_FatAttack3 49 86 | #define ETF_A_BossDeath 50 87 | #define ETF_A_CPosAttack 51 88 | #define ETF_A_CPosRefire 52 89 | #define ETF_A_TroopAttack 53 90 | #define ETF_A_SargAttack 54 91 | #define ETF_A_HeadAttack 55 92 | #define ETF_A_BruisAttack 56 93 | #define ETF_A_SkullAttack 57 94 | #define ETF_A_Metal 58 95 | #define ETF_A_SpidRefire 59 96 | #define ETF_A_BabyMetal 60 97 | #define ETF_A_BspiAttack 61 98 | #define ETF_A_Hoof 62 99 | #define ETF_A_CyberAttack 63 100 | #define ETF_A_PainAttack 64 101 | #define ETF_A_PainDie 65 102 | #define ETF_A_KeenDie 66 103 | #define ETF_A_BrainPain 67 104 | #define ETF_A_BrainScream 68 105 | #define ETF_A_BrainDie 69 106 | #define ETF_A_BrainAwake 70 107 | #define ETF_A_BrainSpit 71 108 | #define ETF_A_SpawnSound 72 109 | #define ETF_A_SpawnFly 73 110 | #define ETF_A_BrainExplode 74 111 | 112 | 113 | 114 | 115 | 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /d_ticcmd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // System specific interface stuff. 17 | // 18 | 19 | #ifndef __D_TICCMD__ 20 | #define __D_TICCMD__ 21 | 22 | #include "doomtype.h" 23 | 24 | // The data sampled per tick (single player) 25 | // and transmitted to other peers (multiplayer). 26 | // Mainly movements/button commands per game tick, 27 | // plus a checksum for internal state consistency. 28 | // 10 bytes each.. 29 | typedef struct { 30 | int8_t forwardmove; // *2048 for move 31 | int8_t sidemove; // *2048 for move 32 | int16_t angleturn; // <<16 for angle delta 33 | int16_t consistancy; // checks for net game 34 | byte chatchar; 35 | byte buttons; 36 | } ticcmd_t; 37 | 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /doomstat.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // All the global variables that store the internal state. 17 | // Theoretically speaking, the internal state of the engine 18 | // should be found by looking at the variables collected 19 | // here, and every relevant module will have to include 20 | // this header file. 21 | // In practice, things are a bit messy. 22 | // 23 | 24 | 25 | #ifndef __D_STATE__ 26 | #define __D_STATE__ 27 | 28 | // We need globally shared data structures, 29 | // for defining the global state variables. 30 | #include "doomdata.h" 31 | #include "d_net.h" 32 | 33 | // We need the playr data structure as well. 34 | #include "d_player.h" 35 | 36 | 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /dstrings.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // DOOM strings, by language. 17 | // 18 | 19 | #ifndef __DSTRINGS__ 20 | #define __DSTRINGS__ 21 | 22 | 23 | // All important printed strings. 24 | // Language selection (message strings). 25 | // Use -DFRENCH etc. 26 | 27 | #include "d_englsh.h" 28 | 29 | // Misc. other strings. 30 | #define SAVEGAMENAME "doomsav" 31 | 32 | 33 | 34 | #define MAX_STRINGS 306 35 | 36 | // Not done in french? 37 | 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /dutils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Cheat code checking. 17 | // 18 | 19 | #ifndef __DUTILS__ 20 | #define __DUTILS__ 21 | 22 | #include "doomtype.h" 23 | #include "doomdef.h" 24 | 25 | 26 | 27 | // 28 | // CHEAT SEQUENCE PACKAGE 29 | // 30 | 31 | #define SCRAMBLE(a) \ 32 | ((((a)&1)<<7) + (((a)&2)<<5) + ((a)&4) + (((a)&8)<<1) \ 33 | + (((a)&16)>>1) + ((a)&32) + (((a)&64)>>5) + (((a)&128)>>7)) 34 | 35 | typedef struct cheatseq_s { 36 | uint8_t __near* sequence; 37 | uint8_t __near* p; 38 | } cheatseq_t; 39 | 40 | int8_t __near cht_CheckCheat ( int16_t cheatId, int8_t key ); 41 | void __near cht_GetParam ( int16_t cheatId, int8_t __near* buffer ); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /f_finale.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // 17 | // 18 | 19 | 20 | #ifndef __F_FINALE__ 21 | #define __F_FINALE__ 22 | 23 | 24 | #include "doomtype.h" 25 | #include "d_event.h" 26 | // 27 | // FINALE 28 | // 29 | 30 | 31 | 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /f_wipe.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Mission start screen wipe/melt, special effects. 17 | // 18 | 19 | 20 | #ifndef __F_WIPE_H__ 21 | #define __F_WIPE_H__ 22 | 23 | // 24 | // SCREEN WIPE PACKAGE 25 | // 26 | 27 | void __far wipe_WipeLoop(); 28 | void __far wipe_StartScreen(); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /g_game.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Duh. 17 | // 18 | 19 | #ifndef __G_GAME__ 20 | #define __G_GAME__ 21 | 22 | #include "doomdef.h" 23 | #include "d_event.h" 24 | 25 | #define SLOWTURNTICS 6 26 | 27 | 28 | // 29 | // GAME 30 | // 31 | 32 | void __far G_InitNew (skill_t skill, int8_t episode, int8_t map); 33 | 34 | // Can be called by the startup code or M_Responder. 35 | // A normal game starts at map 1, 36 | // but a warp test can start elsewhere 37 | void __near G_DeferedInitNew (skill_t skill, int8_t episode, int8_t map); 38 | 39 | void __far G_DeferedPlayDemo (int8_t* demo); 40 | 41 | // Can be called by the startup code or M_Responder, 42 | // calls P_SetupLevel or W_EnterWorld. 43 | void __far G_LoadGame (int8_t* name); 44 | 45 | 46 | // Called by M_Responder. 47 | void __far G_SaveGame (int8_t slot, int8_t __far* description); 48 | 49 | boolean __far G_CheckDemoStatus (void); 50 | 51 | void __far G_ExitLevel (void); 52 | void __far G_SecretExitLevel (void); 53 | 54 | 55 | void __near G_Ticker (void); 56 | 57 | 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /hu_lib.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: heads-up text and input code 16 | // 17 | 18 | #include 19 | 20 | #include "doomdef.h" 21 | 22 | #include "v_video.h" 23 | 24 | #include "hu_lib.h" 25 | #include "hu_stuff.h" 26 | #include "r_local.h" 27 | #include "r_draw.h" 28 | #include "i_system.h" 29 | #include 30 | #include "m_memory.h" 31 | #include "m_near.h" 32 | 33 | 34 | // boolean : whether the screen is always erased 35 | #define noterased viewwindowx 36 | 37 | 38 | 39 | void __near HUlib_addStringToTextLine(hu_textline_t __near*textline, int8_t* __far str){ 40 | int16_t index = 0; 41 | while (str[index]){ 42 | if (textline->len == HU_MAXLINELENGTH) { 43 | textline->characters[textline->len] = 0; 44 | return; 45 | } else { 46 | textline->characters[textline->len++] = locallib_toupper(str[index]); 47 | textline->needsupdate = 4; 48 | } 49 | index++; 50 | } 51 | textline->characters[textline->len] = 0; 52 | 53 | } 54 | 55 | void __near HUlib_drawTextLine ( hu_textline_t __near* textline) { 56 | 57 | int16_t i; 58 | int16_t width; 59 | int16_t x; 60 | uint8_t c; 61 | patch_t __far* currentpatch; 62 | 63 | // draw the new stuff 64 | x = textline->x; 65 | for (i=0;ilen;i++) { 66 | c = textline->characters[i]; 67 | if (c != ' ' && c >= textline->sc && c <= '_') { 68 | currentpatch = ((patch_t __far *) MK_FP(ST_GRAPHICS_SEGMENT, hu_font[c - textline->sc])); 69 | 70 | 71 | width = (currentpatch->width); 72 | if (x + width > SCREENWIDTH) { 73 | break; 74 | } 75 | V_DrawPatchDirect(x, textline->y, currentpatch); 76 | x += width; 77 | } else { 78 | x += 4; 79 | if (x >= SCREENWIDTH) { 80 | break; 81 | } 82 | } 83 | } 84 | 85 | } 86 | 87 | 88 | // sorta called by HU_Erase and just better darn get things straight 89 | void __near HUlib_eraseTextLine(hu_textline_t __near* textline) { 90 | uint16_t lineheight = 8; // hacked to reduce page swaps so it might not work with custom wad? 91 | uint16_t y; 92 | uint16_t yoffset; 93 | 94 | // Only erases when NOT in automap and the screen is reduced, 95 | // and the text must either need updating or refreshing 96 | // (because of a recent change back from the automap) 97 | 98 | if (!automapactive && viewwindowx && textline->needsupdate) { 99 | for (y=textline->y,yoffset=y*SCREENWIDTH ; yy+lineheight ; y++,yoffset+=SCREENWIDTH) { 100 | if (y < viewwindowy || y >= viewwindowy + viewheight) { 101 | R_VideoErase(yoffset, SCREENWIDTH); // erase entire line 102 | } else { 103 | R_VideoErase(yoffset, viewwindowx); // erase left border 104 | R_VideoErase(yoffset + viewwindowx + viewwidth, viewwindowx); 105 | // erase right border 106 | } 107 | } 108 | } 109 | 110 | if (textline->needsupdate) { 111 | textline->needsupdate--; 112 | } 113 | 114 | } 115 | 116 | void __near HUlib_addMessageToSText (int8_t* msg ) { 117 | hu_stext_t __near* stext = &w_message; 118 | int16_t i; 119 | hu_textline_t __near* textline; 120 | // add a clear line 121 | 122 | if (++stext->currentline == stext->height) { 123 | stext->currentline = 0; 124 | } 125 | 126 | textline = &stext->textlines[stext->currentline]; 127 | textline->len = 0; 128 | textline->characters[0] = 0; 129 | textline->needsupdate = true; 130 | 131 | // everything needs updating 132 | for (i = 0; i < stext->height; i++) { 133 | stext->textlines[i].needsupdate = 4; 134 | } 135 | 136 | HUlib_addStringToTextLine(&stext->textlines[stext->currentline], msg); 137 | hudneedsupdate = 4; 138 | } 139 | 140 | 141 | -------------------------------------------------------------------------------- /hu_lib.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: none 16 | // 17 | 18 | #ifndef __HULIB__ 19 | #define __HULIB__ 20 | 21 | // We are referring to patches. 22 | #include "r_defs.h" 23 | 24 | 25 | // font stuff 26 | #define HU_CHARERASE KEY_BACKSPACE 27 | 28 | #define HU_MAXLINES 4 29 | #define HU_MAXLINELENGTH 80 30 | 31 | // 32 | // Typedefs of widgets 33 | // 34 | 35 | // Text Line widget 36 | // (parent of Scrolling Text and Input Text widgets) 37 | typedef struct { 38 | 39 | // left-justified position of scrolling text window 40 | int16_t x; 41 | int16_t y; 42 | 43 | uint8_t sc; // start character 44 | int8_t characters[HU_MAXLINELENGTH+1]; // line of text 45 | int16_t len; // current line length 46 | 47 | // whether this line needs to be udpated 48 | int8_t needsupdate; 49 | 50 | } hu_textline_t; 51 | 52 | 53 | 54 | // Scrolling Text window widget 55 | // (child of Text Line widget) 56 | typedef struct { 57 | 58 | hu_textline_t textlines[HU_MAXLINES]; // text lines to draw 59 | int8_t height; // height in lines 60 | int8_t currentline; // current line number 61 | 62 | // pointer to boolean stating whether to update window 63 | boolean* on; 64 | boolean laston; // last value of *->on. 65 | 66 | } hu_stext_t; 67 | 68 | 69 | 70 | // Input Text Line widget 71 | // (child of Text Line widget) 72 | typedef struct { 73 | 74 | hu_textline_t l; // text line to input on 75 | 76 | // left margin past which I am not to delete characters 77 | int16_t lm; 78 | 79 | // pointer to boolean stating whether to update window 80 | boolean* on; 81 | boolean laston; // last value of *->on; 82 | 83 | } hu_itext_t; 84 | 85 | 86 | // 87 | // Widget creation, access, and update routines 88 | // 89 | 90 | // initializes heads-up widget library 91 | 92 | 93 | 94 | 95 | // returns success 96 | void __near HUlib_addStringToTextLine(hu_textline_t __near*t, int8_t* __far ch); 97 | 98 | // draws tline 99 | void __near HUlib_drawTextLine(hu_textline_t __near *l); 100 | 101 | // erases text line 102 | void __near HUlib_eraseTextLine(hu_textline_t __near *l); 103 | 104 | 105 | // 106 | // Scrolling Text window widget routines 107 | // 108 | 109 | 110 | 111 | void __near HUlib_addMessageToSText( int8_t* msg ); 112 | 113 | 114 | // Input Text Line widget routines 115 | 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /hu_setup.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: Heads-up displays 16 | // 17 | 18 | #include 19 | 20 | #include "doomdef.h" 21 | 22 | #include "z_zone.h" 23 | 24 | #include "hu_stuff.h" 25 | #include "hu_lib.h" 26 | #include "w_wad.h" 27 | 28 | #include "s_sound.h" 29 | 30 | #include "doomstat.h" 31 | #include "r_state.h" 32 | #include "i_system.h" 33 | #include "r_bsp.h" 34 | 35 | // Data. 36 | #include "dstrings.h" 37 | #include "sounds.h" 38 | #include "m_near.h" 39 | 40 | 41 | 42 | // 43 | // Locally used constants, shortcuts. 44 | // 45 | #define HUD_FONTHEIGHT 7 46 | #define HUD_LINEHEIGHT HUD_FONTHEIGHT + 1 47 | 48 | #define HU_TITLE (((gameepisode-1)*9+gamemap-1) >= 36 ? NEWLEVELMSG - title_string_offset : HUSTR_E1M1 - title_string_offset + ((gameepisode-1)*9+gamemap-1)) 49 | #define HU_TITLE2 (HUSTR_1 - title_string_offset + (gamemap-1)) 50 | #define HU_TITLEP (PHUSTR_1 - title_string_offset + (gamemap-1)) 51 | #define HU_TITLET (THUSTR_1 - title_string_offset + (gamemap-1)) 52 | #define HU_TITLEHEIGHT 1 53 | #define HU_TITLEX 0 54 | #define HU_TITLEY 167 - HUD_FONTHEIGHT 55 | 56 | 57 | #define HU_INPUTTOGGLE 't' 58 | #define HU_INPUTX HU_MSGX 59 | #define HU_INPUTWIDTH 64 60 | #define HU_INPUTHEIGHT 1 61 | 62 | #define title_string_offset HUSTR_E1M1 63 | 64 | 65 | 66 | 67 | void __far HU_Start(void) { 68 | 69 | // 70 | // Builtin map names. 71 | // The actual names can be found in DStrings.h. 72 | // 73 | 74 | // int32_t i; 75 | int16_t sindex; 76 | int8_t str[256]; 77 | hu_textline_t __near* t; 78 | 79 | 80 | message_on = false; 81 | message_dontfuckwithme = false; 82 | message_nottobefuckedwith = false; 83 | // create the message widget 84 | 85 | w_message.height = 1; 86 | w_message.on = &message_on; 87 | w_message.laston = true; 88 | w_message.currentline = 0; 89 | 90 | t = &w_message.textlines[0]; 91 | t->x = HU_MSGX; 92 | t->y = HU_MSGY; 93 | t->sc = HU_FONTSTART; 94 | 95 | t->len = 0; 96 | t->characters[0] = 0; 97 | t->needsupdate = true; 98 | 99 | 100 | 101 | 102 | 103 | 104 | // create the map title widget 105 | 106 | w_title.x = HU_TITLEX; 107 | w_title.y = HU_TITLEY; 108 | w_title.sc = HU_FONTSTART; 109 | w_title.len = 0; 110 | w_title.characters[0] = 0; 111 | w_title.needsupdate = true; 112 | 113 | 114 | if (commercial) { 115 | #if (EXE_VERSION < EXE_VERSION_FINAL) 116 | sindex = HU_TITLE2; 117 | #else 118 | if (plutonia) { 119 | sindex = HU_TITLEP; 120 | } else if (tnt) { 121 | sindex = HU_TITLET; 122 | } else { 123 | sindex = HU_TITLE2; 124 | } 125 | #endif 126 | } else { 127 | sindex = HU_TITLE; 128 | } 129 | sindex += title_string_offset; 130 | 131 | 132 | getStringByIndex(sindex, str); 133 | 134 | HUlib_addStringToTextLine(&w_title, str); 135 | 136 | 137 | 138 | } 139 | -------------------------------------------------------------------------------- /hu_stuff.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: Heads-up displays 16 | // 17 | 18 | #include 19 | 20 | #include "doomdef.h" 21 | 22 | #include "z_zone.h" 23 | 24 | #include "hu_stuff.h" 25 | #include "hu_lib.h" 26 | #include "w_wad.h" 27 | 28 | #include "s_sound.h" 29 | 30 | #include "doomstat.h" 31 | #include "r_state.h" 32 | #include "i_system.h" 33 | #include "r_bsp.h" 34 | 35 | // Data. 36 | #include "dstrings.h" 37 | #include "sounds.h" 38 | #include "m_near.h" 39 | 40 | 41 | 42 | 43 | //todo: on automap toggles and such, set needsupdate back to 4 44 | 45 | void __near HU_Drawer(void) { 46 | 47 | hu_stext_t __near* stext = &w_message; 48 | int16_t i, index; 49 | hu_textline_t __near*line; 50 | boolean mapped = false; // keep track of if we mapped out 51 | 52 | if (!*stext->on) { 53 | return; // if not on, don't draw 54 | } 55 | 56 | 57 | if (hudneedsupdate || automapactive || screenblocks >= 10){ 58 | 59 | // draw everything 60 | for (i = 0; i < stext->height; i++) { 61 | 62 | index = stext->currentline - i; 63 | if (index < 0) { 64 | index += stext->height; // handle queue of lines 65 | } 66 | 67 | line = &stext->textlines[index]; 68 | 69 | // need a decision made here on whether to skip the draw 70 | 71 | if (!mapped) { 72 | Z_QuickMapStatus(); 73 | mapped = true; 74 | } 75 | 76 | HUlib_drawTextLine(line); // no cursor, please 77 | } 78 | 79 | hudneedsupdate--; 80 | } 81 | 82 | if (automapactive) { 83 | Z_QuickMapStatus(); 84 | mapped = true; 85 | HUlib_drawTextLine(&w_title); 86 | } 87 | 88 | if (mapped) { 89 | // remap physics memory if mapped out 90 | Z_QuickMapPhysics(); 91 | } 92 | } 93 | 94 | void __near HU_Erase(void) { 95 | int16_t i; 96 | for (i = 0; i < w_message.height; i++) { 97 | if (w_message.laston && !*w_message.on) { 98 | w_message.textlines[i].needsupdate = 4; 99 | } 100 | HUlib_eraseTextLine(&(w_message.textlines[i])); 101 | } 102 | w_message.laston = *w_message.on; 103 | 104 | HUlib_eraseTextLine(&w_title); 105 | 106 | } 107 | 108 | void __near HU_Ticker(void) { 109 | 110 | // tick down message counter if message is up 111 | if (message_counter && !--message_counter) { 112 | message_on = false; 113 | message_nottobefuckedwith = false; 114 | } 115 | 116 | if (showMessages || message_dontfuckwithme) { 117 | 118 | // display message if necessary 119 | if (((player.messagestring || player.message != -1) && !message_nottobefuckedwith) || (player.message && message_dontfuckwithme)) { 120 | 121 | if (player.message != -1) { 122 | int8_t tempstring[256]; 123 | getStringByIndex(player.message, tempstring); 124 | HUlib_addMessageToSText(tempstring); 125 | player.message = -1; 126 | } else { 127 | HUlib_addMessageToSText(player.messagestring); 128 | player.messagestring = NULL; 129 | } 130 | message_on = true; 131 | message_counter = HU_MSGTIMEOUT; 132 | message_nottobefuckedwith = message_dontfuckwithme; 133 | message_dontfuckwithme = 0; 134 | } 135 | 136 | } // else message_on = false; 137 | 138 | } 139 | 140 | #define QUEUESIZE 128 141 | 142 | 143 | boolean __near HU_Responder(event_t __far *ev) { 144 | 145 | boolean eatkey = false; 146 | 147 | if (ev->data1 == KEY_RSHIFT || ev->data1 == KEY_RALT || ev->data1 == KEY_LALT) { 148 | return false; 149 | } 150 | 151 | if (ev->type != ev_keydown){ 152 | return false; 153 | } 154 | 155 | if (ev->data1 == HU_MSGREFRESH) { 156 | message_on = true; 157 | message_counter = HU_MSGTIMEOUT; 158 | eatkey = true; 159 | } 160 | 161 | return eatkey; 162 | 163 | } 164 | -------------------------------------------------------------------------------- /hu_stuff.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: Head up display 16 | // 17 | 18 | #ifndef __HU_STUFF_H__ 19 | #define __HU_STUFF_H__ 20 | 21 | #include "d_event.h" 22 | #include "r_defs.h" 23 | 24 | 25 | 26 | 27 | #define HU_BROADCAST 5 28 | 29 | #define HU_MSGREFRESH KEY_ENTER 30 | #define HU_MSGX 0 31 | #define HU_MSGY 0 32 | #define HU_MSGWIDTH 64 // in characters 33 | #define HU_MSGHEIGHT 1 // in lines 34 | #define HU_INPUTY HU_MSGY + HUD_FONTHEIGHT 35 | #define HU_MSGTIMEOUT (4*TICRATE) 36 | 37 | // 38 | // HEADS UP TEXT 39 | // 40 | 41 | void __near HU_Init(void); 42 | void __far HU_Start(void); 43 | 44 | boolean __near HU_Responder(event_t __far* ev); 45 | 46 | void __near HU_Ticker(void); 47 | void __near HU_Drawer(void); 48 | void __near HU_Erase(void); 49 | 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /i_init.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 1993-2008 Raven Software 4 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // DESCRIPTION: 17 | // IBM DOS VGA graphics and key/mouse. 18 | // 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include "d_main.h" 27 | #include "doomstat.h" 28 | #include "doomdef.h" 29 | #include "r_local.h" 30 | #include "sounds.h" 31 | #include "i_system.h" 32 | #include "i_sound.h" 33 | #include "g_game.h" 34 | #include "m_misc.h" 35 | #include "v_video.h" 36 | #include "w_wad.h" 37 | #include "z_zone.h" 38 | #include "m_near.h" 39 | void __interrupt I_KeyboardISR(void); 40 | int16_t __far I_ResetMouse(void); 41 | void __far I_StartupSound(void); 42 | 43 | 44 | #define KBDQUESIZE 32 45 | #define KEYBOARDINT 9 46 | 47 | 48 | #define GC_INDEX 0x3CE 49 | #define GC_SETRESET 0 50 | #define GC_ENABLESETRESET 1 51 | #define GC_COLORCOMPARE 2 52 | #define GC_DATAROTATE 3 53 | #define GC_READMAP 4 54 | #define GC_MODE 5 55 | #define GC_MISCELLANEOUS 6 56 | #define GC_COLORDONTCARE 7 57 | #define GC_BITMASK 8 58 | 59 | 60 | #define SC_INDEX 0x3C4 61 | #define SC_RESET 0 62 | #define SC_CLOCK 1 63 | #define SC_MAPMASK 2 64 | #define SC_CHARMAP 3 65 | #define SC_MEMMODE 4 66 | 67 | #define CRTC_INDEX 0x3D4 68 | #define CRTC_H_TOTAL 0 69 | #define CRTC_H_DISPEND 1 70 | #define CRTC_H_BLANK 2 71 | #define CRTC_H_ENDBLANK 3 72 | #define CRTC_H_RETRACE 4 73 | #define CRTC_H_ENDRETRACE 5 74 | #define CRTC_V_TOTAL 6 75 | #define CRTC_OVERFLOW 7 76 | #define CRTC_ROWSCAN 8 77 | #define CRTC_MAXSCANLINE 9 78 | #define CRTC_CURSORSTART 10 79 | #define CRTC_CURSOREND 11 80 | #define CRTC_STARTHIGH 12 81 | #define CRTC_STARTLOW 13 82 | #define CRTC_CURSORHIGH 14 83 | #define CRTC_CURSORLOW 15 84 | #define CRTC_V_RETRACE 16 85 | #define CRTC_V_ENDRETRACE 17 86 | #define CRTC_V_DISPEND 18 87 | #define CRTC_OFFSET 19 88 | #define CRTC_UNDERLINE 20 89 | #define CRTC_V_BLANK 21 90 | #define CRTC_V_ENDBLANK 22 91 | #define CRTC_MODE 23 92 | #define CRTC_LINECOMPARE 24 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | int16_t __far M_CheckParm (int8_t *check); 101 | 102 | 103 | // 104 | // StartupMouse 105 | // 106 | 107 | void __near I_StartupMouse(void) { 108 | // 109 | // General mouse detection 110 | // 111 | mousepresent = 0; 112 | if (M_CheckParm("-nomouse") || !usemouse) { 113 | return; 114 | } 115 | 116 | if (I_ResetMouse() != 0xffffu) { 117 | DEBUG_PRINT("Mouse: not present\n", 0); 118 | return; 119 | } 120 | DEBUG_PRINT("Mouse: detected\n", 0); 121 | 122 | mousepresent = 1; 123 | 124 | //I_StartupCyberMan(); 125 | } 126 | 127 | 128 | void __interrupt I_KeyboardISR(void); 129 | 130 | 131 | // 132 | // I_StartupKeyboard 133 | // 134 | void __near I_StartupKeyboard(void) { 135 | int8_t i = 0; 136 | 137 | 138 | oldkeyboardisr = _dos_getvect(KEYBOARDINT); 139 | _dos_setvect(KEYBOARDINT, I_KeyboardISR); 140 | } 141 | 142 | 143 | 144 | // 145 | // I_Init 146 | // hook interrupts and set graphics mode 147 | // 148 | void __near I_Init(void) { 149 | novideo = M_CheckParm("-nodraw"); 150 | DEBUG_PRINT("I_StartupMouse\n"); 151 | I_StartupMouse(); 152 | DEBUG_PRINT("I_StartupKeyboard\n"); 153 | I_StartupKeyboard(); 154 | DEBUG_PRINT("I_StartupSound\n"); 155 | I_StartupSound(); 156 | 157 | } 158 | -------------------------------------------------------------------------------- /i_main.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // 16 | // DESCRIPTION: 17 | // Main program, simply calls D_DoomMain high level loop. 18 | // 19 | 20 | #include "doomdef.h" 21 | 22 | //#include "m_misc.h" 23 | #include "i_system.h" 24 | #include 25 | #include "m_near.h" 26 | 27 | 28 | void __near D_DoomMain(); 29 | /* 30 | // REGS stuff used for int calls 31 | 32 | #define USED_DS 0x3A80 33 | // size of dgroup, about? 34 | #define SIZE_TO_COPY 0x5200 35 | 36 | void modify_ds_ss(int a, int b); 37 | #pragma aux modify_ds_ss = \ 38 | "mov ax, 3A80h", \ 39 | "mov ds, ax", \ 40 | "mov ss, ax", \ 41 | parm[] modify exact[ax]; 42 | 43 | void hackDS() { 44 | struct SREGS sregs; 45 | int16_t ds; 46 | int16_t ss; 47 | int16_t ds_diff; 48 | 49 | 50 | 51 | segread(&sregs); 52 | ds = sregs.ds; // 2a56 2e06 c7a 53 | ss = sregs.ss; // 2a56 2e06 c7a 54 | FAR_memcpy(MK_FP(USED_DS, 0), MK_FP(ds, 0), SIZE_TO_COPY); 55 | 56 | modify_ds_ss(USED_DS, USED_DS); 57 | 58 | 59 | } 60 | 61 | 62 | void checkDS(int16_t a) { 63 | struct SREGS sregs; 64 | uint16_t ds; 65 | uint16_t ss; 66 | //byte __far* someptr = malloc(1); 67 | return; 68 | segread(&sregs); 69 | ds = sregs.ds; // 2a56 2e06 c7a 70 | ss = sregs.ss; // 2a56 2e06 c7a 71 | 72 | if (ds != 0x3C00 || ss != 0x3C00){ 73 | I_Error("\nvalues chaged! %x %x %i\n", ds, ss, a); 74 | } 75 | 76 | //DEBUG_PRINT("%i\n", a); 77 | 78 | } 79 | */ 80 | 81 | 82 | void hackDS(); 83 | void hackDSBack(); 84 | extern uint16_t __far* _GETDS; 85 | 86 | int16_t main ( int16_t argc, int8_t** argv ) { 87 | myargc = argc; 88 | myargv = argv; 89 | 90 | // set DS to 0x3C00. we must also do this in interrupts. 91 | hackDS(); 92 | // override __GETDS mov ax, #### but im not sure anything uses it after init anyway? 93 | _GETDS[1] = 0x3C00; 94 | 95 | D_DoomMain (); 96 | 97 | return 0; 98 | } 99 | -------------------------------------------------------------------------------- /i_sound.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 id Software, Inc. 3 | // Copyright (C) 1993-2008 Raven Software 4 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // DESCRIPTION: 17 | // System interface for sound. 18 | // 19 | 20 | #ifndef __I_SOUND__ 21 | #define __I_SOUND__ 22 | 23 | #define SND_TICRATE 140 // tic rate for updating sound 24 | #define SND_MAXSONGS 40 // max number of songs in game 25 | #define SND_SAMPLERATE 11025 // sample rate of sound effects 26 | 27 | 28 | 29 | #define snd_none 0 30 | #define snd_PC 1 31 | #define snd_Adlib 2 32 | #define snd_SB 3 33 | #define snd_PAS 4 34 | #define snd_GUS 5 35 | #define snd_MPU 6 36 | #define snd_MPU2 7 37 | #define snd_MPU3 8 38 | #define snd_AWE 9 39 | #define snd_ENSONIQ 10 40 | #define snd_CODEC 11 41 | #define NUM_SCARDS 12 42 | typedef uint8_t cardenum_t; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /i_system.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 1993-2008 Raven Software 4 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // DESCRIPTION: 17 | // System specific interface stuff. 18 | // 19 | 20 | 21 | #ifndef __I_SYSTEM__ 22 | #define __I_SYSTEM__ 23 | 24 | #include "d_ticcmd.h" 25 | #include "d_event.h" 26 | #include "sounds.h" 27 | 28 | 29 | // Called by DoomMain. 30 | void __near I_Init (void); 31 | 32 | 33 | 34 | // Called by startup code 35 | // to get the ammount of memory to malloc 36 | // for the zone management. 37 | 38 | 39 | 40 | 41 | // 42 | // Called by D_DoomLoop, 43 | // called before processing each tic in a frame. 44 | // Quick syncronous operations are performed here. 45 | // Can call D_PostEvent. 46 | void __near I_StartTic (void); 47 | 48 | // Asynchronous interrupt functions should maintain private queues 49 | // that are read by the synchronous functions 50 | // to be converted into events. 51 | 52 | 53 | 54 | // Called by M_Responder when quit is selected. 55 | // Clean exit, displays sell blurb. 56 | void __near I_Quit (void); 57 | 58 | 59 | void __far I_Error (int8_t __far *error, ...); 60 | 61 | void __far I_BeginRead(void); 62 | void __far I_EndRead(void); 63 | 64 | // 65 | // MUSIC I/O 66 | // 67 | 68 | //int16_t I_LoadSong(uint16_t lump); 69 | // called by anything that wants to register a song lump with the sound lib 70 | // calls Paul's function of the similar name to register music only. 71 | // note that the song data is the same for any sound card and is paul's 72 | // MUS format. Returns a handle which will be passed to all other music 73 | // functions. 74 | 75 | // called by anything that wishes to start music. 76 | // plays a song, and when the song is done, starts playing it again in 77 | // an endless loop. the start is faded in over three seconds. 78 | 79 | // called by anything that wishes to stop music. 80 | // stops a song abruptly. 81 | void I_ResumeSong(); 82 | void I_PauseSong(); 83 | void I_ResumeSong(); 84 | 85 | // SFX I/O 86 | // 87 | typedef uint8_t sfxenum_t; 88 | 89 | 90 | // called by routines which wish to play a sound effect at some later 91 | // time. Pass it the lump name of a sound effect WITHOUT the sfx 92 | // prefix. This means the maximum name length is 7 letters/digits. 93 | // The prefixes for different sound cards are 'S','M','A', and 'P'. 94 | // They refer to the card type. The routine will cache in the 95 | // appropriate sound effect when it is played. 96 | 97 | int8_t I_StartSound (sfxenum_t id, uint8_t vol, uint8_t sep); 98 | // Starts a sound in a particular sound channel 99 | 100 | void I_UpdateSoundParams(int8_t handle, uint8_t vol, uint8_t sep); 101 | // Updates the volume, separation, and pitch of a sound channel 102 | 103 | void I_StopSound(int8_t handle); 104 | // Stops a sound channel 105 | 106 | boolean I_SoundIsPlaying(int8_t handle); 107 | // called by S_*()'s to see if a channel is still playing. Returns 0 108 | // if no longer playing, 1 if playing. 109 | 110 | 111 | 112 | 113 | 114 | // Takes full 8 bit values. 115 | void __near I_SetPalette(int8_t paletteNumber); 116 | 117 | // Wait for vertical retrace or pause a bit. 118 | void __near I_WaitVBL(int16_t count); 119 | 120 | void __far I_BeginRead(void); 121 | void __far I_EndRead(void); 122 | 123 | 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /m_menu.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Menu widget stuff, episode selection and such. 17 | // 18 | 19 | #ifndef __M_MENU__ 20 | #define __M_MENU__ 21 | 22 | 23 | 24 | #include "d_event.h" 25 | #include "doomdef.h" 26 | 27 | // 28 | // MENUS 29 | // 30 | // Called by main loop, 31 | // saves config file and calls I_Quit when user exits. 32 | // Even when the menu is not displayed, 33 | // this can resize the view and change game parameters. 34 | // Does all the real work of the menu interaction. 35 | boolean __far M_Responder (event_t __far* ev); 36 | 37 | 38 | // Called by main loop, 39 | // only used for menu (skull cursor) animation. 40 | void __near M_Ticker (void); 41 | 42 | // Called by main loop, 43 | // draws the menus directly into the screen buffer. 44 | void __far M_Drawer (int8_t isFromWipe); 45 | 46 | // Called by intro code to force menu up upon a keypress, 47 | // does nothing if menu is already up. 48 | void __near M_StartControlPanel (void); 49 | 50 | // 51 | // DOOM MENU 52 | // 53 | typedef enum main_e{ 54 | newgame = 0, 55 | options, 56 | loadgame, 57 | savegame, 58 | readthis, 59 | quitdoom, 60 | main_end 61 | } main_e; 62 | 63 | 64 | 65 | 66 | 67 | // 68 | // MENU TYPEDEFS 69 | // 70 | typedef struct{ 71 | // 0 = no cursor here, 1 = ok, 2 = arrows ok 72 | int8_t status; 73 | 74 | int8_t name; 75 | 76 | // choice = menu item #. 77 | // if status = 2, 78 | // choice=0:leftarrow,1:rightarrow 79 | void __near (*routine)(int16_t choice); 80 | 81 | // hotkey in menu 82 | int8_t alphaKey; 83 | } menuitem_t; 84 | 85 | 86 | 87 | typedef struct menu_s{ 88 | int8_t numitems; // # of menu items 89 | struct menu_s __near* prevMenu; // previous menu 90 | menuitem_t __near* menuitems; // menu items 91 | void __near (*routine)(); // draw routine 92 | int16_t x; 93 | uint8_t y; // x,y of menu 94 | int16_t lastOn; // last item user was on in menu 95 | } menu_t; 96 | 97 | 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /m_misc.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Main loop menu stuff. 17 | // Default Config File. 18 | // 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | 26 | #include "doomdef.h" 27 | 28 | #include "z_zone.h" 29 | 30 | #include "w_wad.h" 31 | 32 | #include "i_system.h" 33 | #include "v_video.h" 34 | 35 | #include "hu_stuff.h" 36 | 37 | // State. 38 | #include "doomstat.h" 39 | 40 | // Data. 41 | #include "dstrings.h" 42 | 43 | #include "m_misc.h" 44 | #include "m_memory.h" 45 | #include "m_near.h" 46 | 47 | 48 | // 49 | // M_Random 50 | // Returns a 0-255 number 51 | // 52 | 53 | 54 | 55 | 56 | uint8_t __far M_Random (void){ 57 | rndindex = (rndindex+1)&0xff; 58 | return rndtable[rndindex]; 59 | } 60 | 61 | 62 | 63 | 64 | void M_AddToBox16 ( int16_t __near* box, int16_t x, int16_t y ) { 65 | if (xbox[BOXRIGHT]) 68 | box[BOXRIGHT] = x; 69 | if (ybox[BOXTOP]) 72 | box[BOXTOP] = y; 73 | } 74 | 75 | 76 | // 77 | // M_WriteFile 78 | // 79 | #ifndef O_BINARY 80 | #define O_BINARY 0 81 | #endif 82 | 83 | boolean M_WriteFile (int8_t const* name, void __far* source, filelength_t length ){ 84 | filelength_t count; 85 | 86 | FILE* fp = fopen ( name, "wb"); 87 | 88 | if (!fp){ 89 | return false; 90 | } 91 | 92 | count = FAR_fwrite (source, 1, length, fp); 93 | fclose (fp); 94 | 95 | if (count < length){ 96 | return false; 97 | } 98 | return true; 99 | } 100 | 101 | 102 | // 103 | // M_ReadFile 104 | // 105 | 106 | 107 | void M_ReadFile (int8_t const* name, byte __far* buffer ){ 108 | int32_t length; 109 | 110 | 111 | FILE* fp = fopen(name, "rb"); 112 | fseek(fp, 0L, SEEK_END); 113 | length = ftell(fp); 114 | 115 | /* 116 | if (fp == NULL){ 117 | I_Error ("Couldn't read file %s", name); 118 | } 119 | */ 120 | fseek(fp, 0L, SEEK_SET); 121 | FAR_fread(buffer, 1, length, fp); 122 | 123 | fclose (fp); 124 | 125 | } 126 | 127 | 128 | // 129 | // DEFAULTS 130 | // 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /m_misc.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // 17 | 18 | #ifndef __M_MISC__ 19 | #define __M_MISC__ 20 | 21 | 22 | #include "doomdef.h" 23 | #include "doomtype.h" 24 | #include "z_zone.h" 25 | // 26 | // MISC 27 | // 28 | 29 | 30 | 31 | boolean M_WriteFile (int8_t const* name, void __far* source,filelength_t length ); 32 | 33 | void M_ReadFile (int8_t const* name, byte __far* bufferRef ); 34 | 35 | // Returns a number from 0 to 255, 36 | // from a lookup table. 37 | uint8_t __far M_Random(void); 38 | 39 | 40 | 41 | 42 | // Bounding box coordinate storage. 43 | 44 | 45 | #define BOXTOP 0 46 | #define BOXBOTTOM 1 47 | #define BOXLEFT 2 48 | #define BOXRIGHT 3 49 | // bbox coordinates 50 | 51 | // Bounding box functions. 52 | void M_AddToBox16( int16_t __near* box,int16_t x, int16_t y ); 53 | 54 | 55 | 56 | 57 | #define NUM_DEFAULTS 28 58 | 59 | 60 | typedef struct{ 61 | int8_t __near* name; 62 | uint8_t __near* location; 63 | uint8_t defaultvalue; 64 | uint8_t scantranslate; // PC scan code hack 65 | uint8_t untranslated; // lousy hack 66 | } default_t; 67 | 68 | 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /make.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM full make script including clean and re-run of codegen. 3 | set arg1=%1 4 | 5 | IF "%1" == "" GOTO PRINT_EXIT 6 | IF "%1" == "286" GOTO MAKE_286 7 | IF "%1" == "386" GOTO MAKE_386 8 | IF "%1" == "8086" GOTO MAKE_8086 9 | IF "%1" == "8088" GOTO MAKE_8086 10 | IF "%1" == "186" GOTO MAKE_186 11 | IF "%1" == "SCAMP" GOTO MAKE_SCAMP 12 | IF "%1" == "SCAT" GOTO MAKE_SCAT 13 | IF "%1" == "HT18" GOTO MAKE_HT18 14 | 15 | GOTO PRINT_EXIT 16 | 17 | :MAKE_8086 18 | wmake -f build\make16 %2 %3 %4 %5 %6 %7 %8 %9 19 | GOTO END 20 | 21 | :MAKE_186 22 | wmake -f build\make186 %2 %3 %4 %5 %6 %7 %8 %9 23 | GOTO END 24 | 25 | :MAKE_286 26 | wmake -f build\make286 %2 %3 %4 %5 %6 %7 %8 %9 27 | GOTO END 28 | 29 | :MAKE_386 30 | wmake -f build\make386 %2 %3 %4 %5 %6 %7 %8 %9 31 | GOTO END 32 | 33 | :MAKE_SCAT 34 | wmake -f build\makescat %2 %3 %4 %5 %6 %7 %8 %9 35 | GOTO END 36 | 37 | :MAKE_SCAMP 38 | wmake -f build\makesc %2 %3 %4 %5 %6 %7 %8 %9 39 | GOTO END 40 | 41 | :MAKE_HT18 42 | wmake -f build\makeht %2 %3 %4 %5 %6 %7 %8 %9 43 | GOTO END 44 | 45 | 46 | :PRINT_EXIT 47 | echo: 48 | echo Usage: make [286] [8086] [186] [SCAMP] [SCAT] [HT18] [386] [make options] 49 | echo: 50 | GOTO END 51 | 52 | :END -------------------------------------------------------------------------------- /makeall.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM full make script including clean and re-run of codegen. 3 | set arg1=%1 4 | 5 | IF "%1" == "" GOTO PRINT_EXIT 6 | IF "%1" == "286" GOTO MAKE_286 7 | IF "%1" == "386" GOTO MAKE_386 8 | IF "%1" == "8086" GOTO MAKE_8086 9 | IF "%1" == "8088" GOTO MAKE_8086 10 | IF "%1" == "186" GOTO MAKE_186 11 | IF "%1" == "SCAMP" GOTO MAKE_SCAMP 12 | IF "%1" == "SCAT" GOTO MAKE_SCAT 13 | IF "%1" == "HT18" GOTO MAKE_HT18 14 | 15 | GOTO PRINT_EXIT 16 | 17 | :MAKE_8086 18 | wmake -f build\make16 clean 19 | wmake -f build\makebg EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=0" USE_ISA="0" 20 | bingen.exe 21 | move doomcode.bin bin\doomcode.bin /Y 22 | wmake -f build\makecg clean 23 | wmake -f build\makecg 24 | codegen.exe 25 | wmake -f build\make16 clean 26 | wmake -f build\makebg EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=0" USE_ISA="0" 27 | bingen.exe 28 | wmake -f build\make16 29 | GOTO END 30 | 31 | :MAKE_186 32 | wmake -f build\make186 clean 33 | wmake -f build\makebg EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=1" USE_ISA="1" 34 | bingen.exe 35 | move doomcode.bin bin\doomcode.bin /Y 36 | wmake -f build\makecg clean 37 | wmake -f build\makecg 38 | codegen.exe 39 | wmake -f build\make186 clean 40 | wmake -f build\makebg EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=1" USE_ISA="1" 41 | bingen.exe 42 | wmake -f build\make186 43 | GOTO END 44 | 45 | :MAKE_286 46 | wmake -f build\make286 clean 47 | wmake -f build\makebg EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=2" USE_ISA="2" 48 | bingen.exe 49 | move doomcode.bin bin\doomcode.bin /Y 50 | wmake -f build\makecg clean 51 | wmake -f build\makecg 52 | codegen.exe 53 | wmake -f build\make286 clean 54 | wmake -f build\makebg EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=2" USE_ISA="2" 55 | bingen.exe 56 | wmake -f build\make286 57 | GOTO END 58 | 59 | :MAKE_386 60 | wmake -f build\make386 clean 61 | wmake -f build\makebg EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=3" USE_ISA="3" 62 | bingen.exe 63 | move doomcode.bin bin\doomcode.bin /Y 64 | wmake -f build\makecg clean 65 | wmake -f build\makecg 66 | codegen.exe 67 | wmake -f build\make386 clean 68 | wmake -f build\makebg EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=3" USE_ISA="3" 69 | bingen.exe 70 | wmake -f build\make386 71 | GOTO END 72 | 73 | 74 | :MAKE_SCAT 75 | wmake -f build\makescat clean 76 | wmake -f build\makebg EXTERNCOPT="-d__SCAT_BUILD=1 -d__CHIPSET_BUILD=1" EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=2" 286_CHIPSET="2" 77 | bingen.exe 78 | move doomcode.bin bin\doomcode.bin /Y 79 | wmake -f build\makecg clean 80 | wmake -f build\makecg 81 | codegen.exe 82 | wmake -f build\makescat clean 83 | wmake -f build\makebg EXTERNCOPT="-d__SCAT_BUILD=1 -d__CHIPSET_BUILD=1" EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=2" 286_CHIPSET="2" 84 | bingen.exe 85 | wmake -f build\makescat 86 | GOTO END 87 | 88 | 89 | 90 | :MAKE_SCAMP 91 | wmake -f build\makesc clean 92 | wmake -f build\makebg EXTERNCOPT="-d__SCAMP_BUILD=1 -d__CHIPSET_BUILD=1" EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=2" 286_CHIPSET="1" 93 | bingen.exe 94 | move doomcode.bin bin\doomcode.bin /Y 95 | wmake -f build\makecg clean 96 | wmake -f build\makecg 97 | codegen.exe 98 | wmake -f build\makesc clean 99 | wmake -f build\makebg EXTERNCOPT="-d__SCAMP_BUILD=1 -d__CHIPSET_BUILD=1" EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=2" 286_CHIPSET="1" 100 | bingen.exe 101 | wmake -f build\makesc 102 | GOTO END 103 | 104 | 105 | 106 | :MAKE_HT18 107 | wmake -f build\makeht clean 108 | wmake -f build\makebg EXTERNCOPT="-d__HT18_BUILD=1 -d__CHIPSET_BUILD=1 -d__USED000=1" EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=2" 286_CHIPSET="3" 109 | bingen.exe 110 | move doomcode.bin bin\doomcode.bin /Y 111 | wmake -f build\makecg clean 112 | wmake -f build\makecg 113 | codegen.exe 114 | wmake -f build\makeht clean 115 | wmake -f build\makebg EXTERNCOPT="-d__HT18_BUILD=1 -d__CHIPSET_BUILD=1 -d__USED000=1" EXTERNASMOPT="/dCOMPILE_INSTRUCTIONSET=2" 286_CHIPSET="3" 116 | bingen.exe 117 | wmake -f build\makeht 118 | GOTO END 119 | 120 | 121 | :PRINT_EXIT 122 | echo: 123 | echo Usage: makeall [286] [8086] [186] [SCAMP] [SCAT] [HT18] [386] 124 | echo: 125 | GOTO END 126 | 127 | :END -------------------------------------------------------------------------------- /makebg.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | wmake -f build\makebg %1 %2 %3 %4 %5 %6 %7 %8 %9 3 | -------------------------------------------------------------------------------- /makecg.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | wmake -f build\makecg %1 %2 %3 %4 %5 %6 %7 %8 %9 3 | -------------------------------------------------------------------------------- /makeia16.sh: -------------------------------------------------------------------------------- 1 | mkdir GCCIA16 2 | 3 | unset CCOPTS_286 4 | unset CCOPTS_REGULAR 5 | unset CCOPTS_OPTIMIZED 6 | unset EXTRA_FLAGS 7 | 8 | 9 | export EXTRA_FLAGS="-D__COMPILER_GCCIA16" 10 | export CCOPTS_OPTIMIZED="-march=i286 -mcmodel=medium -Ofast -fomit-frame-pointer -fgcse-sm -fgcse-las -fipa-pta -mregparmcall -flto -fwhole-program -funroll-loops" 11 | export CCOPTS_REGULAR="-mcmodel=medium -Ofast -fomit-frame-pointer -fgcse-sm -fgcse-las -fipa-pta -mregparmcall -flto -fwhole-program -funroll-loops" 12 | export CCOPTS_286_OLD="-march=i286 -mcmodel=medium -li86 -Os -fomit-frame-pointer -fgcse-sm -fgcse-las -fipa-pta -mregparmcall -flto -fwhole-program -funroll-loops" 13 | # -flto causes crash 14 | # -fwhole-program needs work 15 | export CCOPTS_286_WORKS="-march=i286 -mcmodel=medium -li86 -Os -fomit-frame-pointer -fgcse-sm -fgcse-las -fipa-pta -mregparmcall -funroll-loops" 16 | # currently smallest? 17 | export CCOPTS_286="-march=i286 -mcmodel=medium -li86 -Os -fomit-frame-pointer -fgcse-sm -fgcse-las -fipa-pta -mregparmcall -fpack-struct=1" 18 | export CCOPTS_286_LONG="-march=i286 -mcmodel=medium -li86 -Os -fcaller-saves -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively -fexpensive-optimizations -fgcse -fgcse-lm -finline-functions -finline-small-functions -findirect-inlining -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fisolate-erroneous-paths-dereference -flra-remat -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining -fpeephole2 -freorder-blocks-algorithm=stc -freorder-blocks-and-partition -freorder-functions -frerun-cse-after-loop -fsched-interblock -fsched-spec -fstrict-aliasing -fthread-jumps -ftree-builtin-call-dce -ftree-loop-vectorize -ftree-pre -ftree-slp-vectorize -ftree-switch-conversion -ftree-tail-merge " 19 | 20 | 21 | 22 | 23 | export GLOBOBJS="i_init.c" 24 | export GLOBOBJS+=" i_quit.c" 25 | export GLOBOBJS+=" i_main.c" 26 | export GLOBOBJS+=" i_ibm.c" 27 | export GLOBOBJS+=" i_sound.c" 28 | export GLOBOBJS+=" f_finale.c" 29 | export GLOBOBJS+=" d_init.c" 30 | export GLOBOBJS+=" d_main.c" 31 | export GLOBOBJS+=" d_net.c" 32 | export GLOBOBJS+=" g_setup.c" 33 | export GLOBOBJS+=" g_game.c" 34 | export GLOBOBJS+=" m_menu.c" 35 | export GLOBOBJS+=" m_misc.c" 36 | export GLOBOBJS+=" am_map.c" 37 | export GLOBOBJS+=" p_init.c" 38 | export GLOBOBJS+=" p_ceilng.c" 39 | export GLOBOBJS+=" p_doors.c" 40 | export GLOBOBJS+=" p_enemy.c" 41 | export GLOBOBJS+=" p_floor.c" 42 | export GLOBOBJS+=" p_inter.c" 43 | export GLOBOBJS+=" p_lights.c" 44 | export GLOBOBJS+=" p_map.c" 45 | export GLOBOBJS+=" p_maputl.c" 46 | export GLOBOBJS+=" p_plats.c" 47 | export GLOBOBJS+=" p_pspr.c" 48 | export GLOBOBJS+=" p_setup.c" 49 | export GLOBOBJS+=" p_sight.c" 50 | export GLOBOBJS+=" p_spec.c" 51 | export GLOBOBJS+=" p_switch.c" 52 | export GLOBOBJS+=" p_mobj.c" 53 | export GLOBOBJS+=" p_telept.c" 54 | export GLOBOBJS+=" p_saveg.c" 55 | export GLOBOBJS+=" p_tick.c" 56 | export GLOBOBJS+=" p_user.c" 57 | export GLOBOBJS+=" r_init.c" 58 | export GLOBOBJS+=" r_setup.c" 59 | export GLOBOBJS+=" r_bsp.c" 60 | export GLOBOBJS+=" r_data.c" 61 | export GLOBOBJS+=" r_draw.c" 62 | export GLOBOBJS+=" r_main.c" 63 | export GLOBOBJS+=" r_plane.c" 64 | export GLOBOBJS+=" r_segs.c" 65 | export GLOBOBJS+=" r_things.c" 66 | export GLOBOBJS+=" w_init.c" 67 | export GLOBOBJS+=" w_wad.c" 68 | export GLOBOBJS+=" v_video.c" 69 | export GLOBOBJS+=" z_init.c" 70 | export GLOBOBJS+=" z_umb.c" 71 | export GLOBOBJS+=" z_zone.c" 72 | export GLOBOBJS+=" st_init.c" 73 | export GLOBOBJS+=" st_setup.c" 74 | export GLOBOBJS+=" st_stuff.c" 75 | export GLOBOBJS+=" hu_setup.c" 76 | export GLOBOBJS+=" hu_stuff.c" 77 | export GLOBOBJS+=" hu_lib.c" 78 | export GLOBOBJS+=" wi_stuff.c" 79 | export GLOBOBJS+=" s_sound.c" 80 | export GLOBOBJS+=" sounds.c" 81 | export GLOBOBJS+=" dutils.c" 82 | export GLOBOBJS+=" f_wipe.c" 83 | export GLOBOBJS+=" info.c" 84 | export GLOBOBJS+=" d_math.c" 85 | export GLOBOBJS+=" dmx.c" 86 | 87 | ia16-elf-gcc $GLOBOBJS $CCOPTS_286 $EXTRA_FLAGS -o GCCIA16/REALDOOM.EXE -Xlinker -Map=GCCIA16/output.map 88 | -------------------------------------------------------------------------------- /math386.asm: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 1993-1996 Id Software, Inc. 2 | ; Copyright (C) 1993-2008 Raven Software 3 | ; Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | ; 5 | ; This program is free software; you can redistribute it and/or 6 | ; modify it under the terms of the GNU General Public License 7 | ; as published by the Free Software Foundation; either version 2 8 | ; of the License, or (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 | ; DESCRIPTION: 16 | ; 17 | INCLUDE defs.inc 18 | 19 | .386 20 | 21 | ;GLOBAL FixedMul_:FAR 22 | 23 | SEGMENT MATH_TEXT USE16 PARA PUBLIC 'CODE' 24 | 25 | ASSUME cs:MATH_TEXT 26 | 27 | 28 | PROC FixedMul_ FAR 29 | PUBLIC FixedMul_ 30 | 31 | ; DX:AX * CX:BX 32 | ; 0 1 2 3 33 | 34 | ; need to get this out of DX:AX CX:BX and into 35 | ; EAX and EBX (or something) 36 | ; todo improve 37 | sal ebx, 16 38 | shrd ebx, ecx, 16 39 | 40 | sal eax, 16 41 | shrd eax, edx, 16 42 | 43 | ; actual mult and shrd.. 44 | imul ebx 45 | ; put results in the expected spots 46 | ; edx low 16 bits already contains bits 32-48 of result 47 | ; need to move eax's high 16 bits low. 48 | shr eax, 16 49 | 50 | ret 51 | 52 | 53 | 54 | ENDP 55 | 56 | PROC FixedDiv_ FAR 57 | PUBLIC FixedDiv_ 58 | 59 | ;DX:AX / CX:BX... 60 | 61 | 62 | push si 63 | push di 64 | 65 | mov si, dx ; si will store sign bit 66 | xor si, cx ; si now stores signedness via test operator... 67 | 68 | ; here we abs the numbers before unsigned division algo 69 | 70 | or cx, cx 71 | jge b_is_positive 72 | neg cx 73 | neg bx 74 | sbb cx, 0 75 | 76 | 77 | b_is_positive: 78 | 79 | or dx, dx ; sign check 80 | jge a_is_positive 81 | neg dx 82 | neg ax 83 | sbb dx, 0 84 | 85 | 86 | a_is_positive: 87 | 88 | ; dx:ax is labs(dx:ax) now (unshifted) 89 | ; cx:bx is labs(cx:bx) now 90 | 91 | ; labs check 92 | 93 | 94 | ; set up eax 95 | shl eax, 16 96 | shrd eax, edx, 16 97 | 98 | ; set up ecx 99 | shl ebx, 16 100 | shld ecx, ebx, 16 101 | 102 | ; back up eax 103 | mov edx, eax 104 | 105 | ; do labs compare 106 | shr EAX, 14 107 | 108 | cmp eax, ecx 109 | jge do_quick_return 110 | mov eax, edx 111 | 112 | ; do divide. prepare edx:eax properly. 113 | cdq 114 | shld edx,eax,16 115 | shl eax,16 116 | 117 | 118 | div ecx ; todo optimize this function in general to be idiv with a lot less juggling. 119 | 120 | shld edx, eax, 010h 121 | 122 | 123 | test si, si 124 | 125 | jl do_negative 126 | 127 | 128 | pop di 129 | pop si 130 | ret 131 | 132 | do_negative: 133 | 134 | neg dx 135 | neg ax 136 | sbb dx, 0 137 | 138 | 139 | pop di 140 | pop si 141 | ret 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | do_quick_return: 150 | ; return (a^b) < 0 ? MINLONG : MAXLONG; 151 | test si, si ; just need to do the high word due to sign? 152 | jl return_MAXLONG 153 | 154 | return_MINLONG: 155 | 156 | mov ax, 0ffffh 157 | mov dx, 07fffh 158 | 159 | exit_and_return_early: 160 | 161 | 162 | 163 | pop di 164 | pop si 165 | ret 166 | 167 | return_MAXLONG: 168 | 169 | mov dx, 08000h 170 | xor ax, ax 171 | jmp exit_and_return_early 172 | 173 | 174 | 175 | 176 | ENDP 177 | 178 | 179 | MATH_TEXT ENDS 180 | 181 | END -------------------------------------------------------------------------------- /old_c/d_math.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // DOOM main program (D_DoomMain) and game loop (D_DoomLoop), 17 | // plus functions to determine game mode (shareware, registered), 18 | // parse command line parameters, configure game parameters (turbo), 19 | // and call the startup functions. 20 | // 21 | 22 | #include "d_math.h" 23 | #include "m_memory.h" 24 | 25 | -------------------------------------------------------------------------------- /old_c/dutils.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Cheat sequence checking. 17 | // 18 | 19 | #include "dutils.h" 20 | #include "i_system.h" 21 | #include "z_zone.h" 22 | #include "m_near.h" 23 | 24 | // 25 | // Called in st_stuff module, which handles the input. 26 | // Returns a 1 if the cheat was successful, 0 if failed. 27 | // 28 | /* 29 | int8_t __near cht_CheckCheat ( int8_t cheatId, int8_t key ) { 30 | int8_t rc = 0; 31 | cheatseq_t __near* cht = all_cheats[cheatId]; 32 | 33 | if (!cht->p){ 34 | cht->p = cht->sequence; // initialize if first time 35 | } 36 | if (*cht->p == 0){ 37 | *(cht->p++) = key; 38 | } else if ((uint8_t)key == *cht->p) { 39 | cht->p++; 40 | } else { 41 | cht->p = cht->sequence; 42 | } 43 | 44 | if (*cht->p == 1){ 45 | cht->p++; 46 | } else if (*cht->p == 0xff){ // end of sequence character 47 | cht->p = cht->sequence; 48 | rc = 1; 49 | } 50 | 51 | 52 | return rc; 53 | } 54 | 55 | void __near cht_GetParam ( int8_t cheatId, int8_t __near* buffer ) { 56 | 57 | uint8_t *p, c; 58 | cheatseq_t __near* cht = all_cheats[cheatId]; 59 | 60 | p = cht->sequence; 61 | while (*(p++) != 1); 62 | 63 | do { 64 | c = *p; 65 | *(buffer++) = c; 66 | *(p++) = 0; 67 | } while (c && *p!=0xff ); 68 | 69 | if (*p==0xff) 70 | *buffer = 0; 71 | 72 | } 73 | */ 74 | 75 | 76 | -------------------------------------------------------------------------------- /old_c/z_umb.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Zone Memory Allocation. Neat. 17 | // 18 | 19 | #include "z_zone.h" 20 | #include "i_system.h" 21 | #include "doomdef.h" 22 | 23 | #include "m_menu.h" 24 | #include "w_wad.h" 25 | #include "r_data.h" 26 | 27 | #include "doomstat.h" 28 | #include "r_bsp.h" 29 | 30 | #include 31 | 32 | #include 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | // based a bit off wolf3d and catacomb source code 41 | 42 | //void(*XMSaddr) (void); // far pointer to XMS driver 43 | //uint16_t UMBbase = 0; 44 | //uint16_t UMBsize = 0; 45 | //byte __far* conventional_far_bytes = NULL; 46 | 47 | 48 | /* 49 | 50 | #pragma aux XMS_GET_DRIVER = \ 51 | "mov ax, 0x4310",\ 52 | "int 0x2f",\ 53 | "mov[WORD PTR XMSaddr], bx",\ 54 | "mov[WORD PTR XMSaddr + 2], es",\ 55 | parm[] modify exact[ax bx es]; 56 | 57 | 58 | #pragma aux UMB_GET_BLOCK = \ 59 | "mov ah, 10h", \ 60 | "mov dx, 0FFFh", \ 61 | "int 2Fh", \ 62 | "call[DWORD PTR XMSaddr]", \ 63 | "or ax, ax", \ 64 | "jnz gotone", \ 65 | "cmp bl,0xb0", \ 66 | "jne done", \ 67 | "gotone:", \ 68 | "mov[UMBbase],bx", \ 69 | "mov[UMBsize],dx", \ 70 | "done:",\ 71 | parm [ ] modify exact [ ax dx bx ]; 72 | 73 | 74 | #pragma aux CALL_5803_CHECK_CARRY = \ 75 | "mov ax, 5803h", \ 76 | "mov bx, 0001h", \ 77 | "int 21h", \ 78 | "call[DWORD PTR XMSaddr]", \ 79 | "or ax, ax", \ 80 | "jnz gotone", \ 81 | "cmp bl,0xb0", \ 82 | "jne done", \ 83 | "gotone:", \ 84 | "mov[UMBbase],bx", \ 85 | "mov[UMBsize],dx", \ 86 | "done:",\ 87 | parm [ ] modify exact [ ax dx bx ]; 88 | */ 89 | 90 | // 54769 is how much we need currently for doom2 91 | // size in paragraphs 92 | //#define DESIRED_UMB_SIZE 0x0D60 93 | 94 | //#define DESIRED_UMB_SIZE 0x0FFE 95 | 96 | -------------------------------------------------------------------------------- /olddata/D_FINES1.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/olddata/D_FINES1.BIN -------------------------------------------------------------------------------- /olddata/D_FINES2.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/olddata/D_FINES2.BIN -------------------------------------------------------------------------------- /olddata/D_FINET2.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/olddata/D_FINET2.BIN -------------------------------------------------------------------------------- /olddata/D_FINET4.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/olddata/D_FINET4.BIN -------------------------------------------------------------------------------- /olddata/D_STATES.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/olddata/D_STATES.BIN -------------------------------------------------------------------------------- /p_inter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // 17 | // 18 | 19 | 20 | #ifndef __P_INTER__ 21 | #define __P_INTER__ 22 | 23 | boolean __far P_GivePower(int16_t); 24 | 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /p_mobja.asm: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 1993-1996 Id Software, Inc. 2 | ; Copyright (C) 1993-2008 Raven Software 3 | ; Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | ; 5 | ; This program is free software; you can redistribute it and/or 6 | ; modify it under the terms of the GNU General Public License 7 | ; as published by the Free Software Foundation; either version 2 8 | ; of the License, or (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 | ; DESCRIPTION: 16 | ; 17 | INCLUDE CONSTANT.INC 18 | INCLUDE defs.inc 19 | INSTRUCTION_SET_MACRO 20 | 21 | 22 | EXTRN FixedMul16u32_:FAR 23 | EXTRN FixedMul1632_:FAR 24 | EXTRN FixedMul2424_:FAR 25 | EXTRN FixedMul2432_:FAR 26 | EXTRN FixedMul_:FAR 27 | EXTRN FixedDiv_:FAR 28 | EXTRN FixedMulBig1632_:FAR 29 | EXTRN FixedMulTrigNoShift_:PROC 30 | EXTRN S_StartSound_:FAR 31 | EXTRN R_PointToAngle2_16_:PROC 32 | EXTRN R_PointToAngle2_:PROC 33 | EXTRN P_Random_:NEAR 34 | EXTRN P_UseSpecialLine_:PROC 35 | EXTRN P_DamageMobj_:NEAR 36 | EXTRN P_SetMobjState_:NEAR 37 | EXTRN P_TouchSpecialThing_:NEAR 38 | EXTRN P_CrossSpecialLine_:NEAR 39 | EXTRN P_ShootSpecialLine_:NEAR 40 | EXTRN P_SpawnMobj_:NEAR 41 | EXTRN P_RemoveMobj_:NEAR 42 | 43 | 44 | .DATA 45 | 46 | EXTRN _prndindex:BYTE 47 | EXTRN _setStateReturn:WORD 48 | EXTRN _attackrange16:WORD 49 | 50 | 51 | .CODE 52 | 53 | 54 | ;void __near P_SpawnPuff ( fixed_t x, fixed_t y, fixed_t z ){ 55 | 56 | ;P_SpawnPuff_ 57 | 58 | PROC P_SpawnPuff_ NEAR 59 | PUBLIC P_SpawnPuff_ 60 | 61 | 62 | push ax 63 | push dx 64 | push bx 65 | 66 | mov ax, RNDTABLE_SEGMENT 67 | mov es, ax 68 | 69 | mov al, byte ptr ds:[_prndindex] 70 | add byte ptr ds:[_prndindex], 3 ; for 3 calls this func.. 71 | xor ah, ah 72 | mov bx, ax 73 | inc bx 74 | mov al, byte ptr es:[bx] 75 | sub al, byte ptr es:[bx+1] 76 | 77 | sbb ah, 0 78 | cwd 79 | 80 | ; shift ax left 10 81 | mov dl, ah ; shift 8 82 | mov ah, al ; shift 8 83 | sal ax, 1 84 | rcl dx, 1 85 | sal ax, 1 86 | rcl dx, 1 87 | and ax, 0FC00h ; clean out bottom bits 88 | 89 | 90 | add si, ax 91 | adc di, dx 92 | 93 | mov al, byte ptr es:[bx+2] 94 | mov byte ptr cs:[SELFMODIFY_set_rnd_value_3+1], al 95 | 96 | pop bx 97 | pop dx 98 | pop ax 99 | 100 | IF COMPILE_INSTRUCTIONSET GE COMPILE_186 101 | 102 | push -1 ; complicated for 8088... 103 | push MT_PUFF 104 | push di 105 | push si 106 | 107 | 108 | ELSE 109 | 110 | mov es, si 111 | mov si, -1 112 | push si 113 | mov si, MT_PUFF 114 | push si 115 | push di 116 | push es 117 | 118 | 119 | ENDIF 120 | 121 | 122 | call P_SpawnMobj_ 123 | 124 | ; th = setStateReturn; 125 | ; th->momz.h.intbits = 1; 126 | ; th->tics -= P_Random()&3; 127 | 128 | mov bx, word ptr ds:[_setStateReturn]; 129 | mov word ptr [bx + 018h], 1 130 | SELFMODIFY_set_rnd_value_3: 131 | mov al, 0FFh 132 | and al, 3 133 | sub byte ptr [bx + 01Bh], al 134 | 135 | ; if (th->tics < 1 || th->tics > 240){ 136 | ; th->tics = 1; 137 | ; } 138 | 139 | 140 | mov al, byte ptr [bx + 01Bh] 141 | cmp al, 1 142 | jb set_tics_to_1 143 | cmp al, 240 144 | jbe dont_set_tics_to_1 145 | set_tics_to_1: 146 | mov byte ptr [bx + 01Bh], 1 147 | dont_set_tics_to_1: 148 | cmp word ptr ds:[_attackrange16], MELEERANGE 149 | je spark_punch_on_wall 150 | ret 151 | spark_punch_on_wall: 152 | mov dx, S_PUFF3 153 | mov ax, bx 154 | call P_SetMobjState_ 155 | ret 156 | 157 | 158 | ENDP 159 | 160 | 161 | 162 | 163 | 164 | END -------------------------------------------------------------------------------- /p_pspr.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Sprite animation. 17 | // 18 | 19 | #ifndef __P_PSPR__ 20 | #define __P_PSPR__ 21 | 22 | // Basic data types. 23 | // Needs fixed point, and BAM angles. 24 | #include "doomdef.h" 25 | #include "tables.h" 26 | 27 | 28 | // 29 | // Needs to include the precompiled 30 | // sprite animation tables. 31 | // Header generated by multigen utility. 32 | // This includes all the data for thing animation, 33 | // i.e. the Thing Atrributes table 34 | // and the Frame Sequence table. 35 | #include "info.h" 36 | 37 | 38 | // 39 | // Frame flags: 40 | // handles maximum brightness (torches, muzzle flare, light sources) 41 | // 42 | #define FF_FULLBRIGHT 0x80 // flag in thing->frame 43 | #define FF_FRAMEMASK 0x7f 44 | 45 | 46 | 47 | // 48 | // Overlay psprites are scaled shapes 49 | // drawn directly on the view screen, 50 | // coordinates are given for a 320*200 view screen. 51 | // 52 | typedef enum { 53 | ps_weapon, 54 | ps_flash, 55 | NUMPSPRITES 56 | 57 | } psprnum_t; 58 | 59 | // 12 bytes each 60 | typedef struct { 61 | statenum_t statenum; // a NULL state means not active 62 | int16_t tics; 63 | fixed_t sx; 64 | fixed_t sy; 65 | 66 | } pspdef_t; 67 | 68 | // Weapon info: sprite frames, ammunition use. 69 | typedef struct { 70 | ammotype_t ammo; 71 | int16_t upstate; 72 | int16_t downstate; 73 | int16_t readystate; 74 | int16_t atkstate; 75 | int16_t flashstate; 76 | 77 | } weaponinfo_t; 78 | 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /p_setup.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Setup a game, startup stuff. 17 | // 18 | 19 | #ifndef __P_SETUP__ 20 | #define __P_SETUP__ 21 | 22 | // NOT called by W_Ticker. Fixme. 23 | 24 | 25 | void __far P_SetupLevel ( int8_t episode, int8_t map, skill_t skill); 26 | 27 | 28 | // Called by startup code. 29 | void __near P_Init (void); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /p_telept.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Teleportation. 17 | // 18 | 19 | 20 | 21 | #include "doomdef.h" 22 | #include "doomstat.h" 23 | 24 | #include "s_sound.h" 25 | #include "i_system.h" 26 | 27 | #include "p_local.h" 28 | 29 | 30 | // Data. 31 | #include "sounds.h" 32 | 33 | // State. 34 | #include "r_state.h" 35 | #include "m_memory.h" 36 | #include "m_near.h" 37 | 38 | 39 | // 40 | // TELEPORTATION 41 | // 42 | int16_t __near EV_Teleport (uint8_t linetag, int16_t side,mobj_t __near* thing,mobj_pos_t __far* thing_pos){ 43 | int16_t i; 44 | mobj_t __near* m; 45 | mobj_pos_t __far* m_pos; 46 | uint16_t an; 47 | THINKERREF thinkerRef; 48 | int16_t secnum; 49 | fixed_t_union oldx; 50 | fixed_t_union oldy; 51 | fixed_t_union oldz; 52 | fixed_t_union temp; 53 | int16_t oldsecnum; 54 | THINKERREF fogRef; 55 | 56 | // don't teleport missiles 57 | if (thing_pos->flags2 & MF_MISSILE){ 58 | return 0; 59 | } 60 | 61 | // Don't teleport if hit back of line, 62 | // so you can get out of teleporter. 63 | if (side == 1){ 64 | return 0; 65 | } 66 | 67 | for (i = 0; i < numsectors; i++) { 68 | 69 | if (sectors_physics[ i ].tag == linetag ) { 70 | //I_Error("looking for thinker thinker %i %i %u", linetag, i, thinkerRef); 71 | thinkerRef = 0; 72 | while (true) { 73 | 74 | // dumb hack.. i think a compiler optimization bug is making something fuck up this loop 75 | // and teleporters never trigger. Some error catching code made the bug away. I wanted to 76 | // switch from for loop to while but the initial case and end case are the same (thinkerRef 0) 77 | // so i did this... whatever. 78 | 79 | thinkerRef = thinkerlist[thinkerRef].next; 80 | if (thinkerRef == 0){ 81 | break; 82 | } 83 | // not a mobj 84 | if ((thinkerlist[thinkerRef].prevFunctype & TF_FUNCBITS) != TF_MOBJTHINKER_HIGHBITS) { 85 | continue; 86 | } 87 | 88 | m = (mobj_t __near*)(&thinkerlist[thinkerRef].data); 89 | 90 | // not a teleportman 91 | if (m->type != MT_TELEPORTMAN ){ 92 | continue; 93 | } 94 | 95 | 96 | secnum = m->secnum; 97 | // wrong sector 98 | if (secnum != i ){ 99 | continue; 100 | } 101 | 102 | m_pos = &mobjposlist_6800[thinkerRef]; 103 | oldx = thing_pos->x; 104 | oldy = thing_pos->y; 105 | oldz = thing_pos->z; 106 | oldsecnum = thing->secnum; 107 | 108 | if (!P_TeleportMove (thing, thing_pos, m_pos->x, m_pos->y, m->secnum)){ 109 | return 0; 110 | } 111 | #if (EXE_VERSION != EXE_VERSION_FINAL) 112 | 113 | SET_FIXED_UNION_FROM_SHORT_HEIGHT(temp, thing->floorz); 114 | thing_pos->z = temp; //fixme: not needed? 115 | #endif 116 | if (thing->type == MT_PLAYER) { 117 | player.viewzvalue.w = thing_pos->z.w + player.viewheightvalue.w; 118 | } 119 | // spawn teleport fog at source and destination 120 | fogRef = P_SpawnMobj (oldx.w, oldy.w, oldz.w, MT_TFOG, oldsecnum); 121 | S_StartSound (setStateReturn, sfx_telept); 122 | an = m_pos->angle.hu.intbits >> SHORTTOFINESHIFT; 123 | fogRef = P_SpawnMobj (m_pos->x.w + FastMul16u32(20, finecosine[an]), m_pos->y.w + FastMul16u32(20,finesine[an]) 124 | , thing_pos->z.w, MT_TFOG, -1); 125 | 126 | // emit sound, where? 127 | S_StartSound(setStateReturn, sfx_telept); 128 | 129 | // don't move for a bit 130 | if (thing->type == MT_PLAYER){ 131 | playerMobj->reactiontime = 18; 132 | } 133 | thing_pos->angle = m_pos->angle; 134 | thing->momx.w = thing->momy.w = thing->momz.w = 0; 135 | return 1; 136 | } 137 | } 138 | } 139 | return 0; 140 | } 141 | 142 | -------------------------------------------------------------------------------- /p_tick.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // ? 17 | // 18 | 19 | 20 | #ifndef __P_TICK__ 21 | #define __P_TICK__ 22 | 23 | 24 | // Called by C_Ticker, 25 | // can call G_PlayerExited. 26 | // Carries out all thinking of monsters and players. 27 | void __far P_Ticker (void); 28 | 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /r_bsp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Refresh module, BSP traversal and handling. 17 | // 18 | 19 | 20 | #ifndef __R_BSP__ 21 | #define __R_BSP__ 22 | 23 | 24 | 25 | 26 | //typedef void (*drawfunc_t) (int16_t start, int16_t stop); 27 | 28 | 29 | // BSP? 30 | void __near R_ClearClipSegs (void); 31 | 32 | 33 | void __far R_RenderBSPNode (); 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /r_data.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Refresh module, data I/O, caching, retrieval of graphics 17 | // by name. 18 | // 19 | 20 | #ifndef __R_DATA__ 21 | #define __R_DATA__ 22 | 23 | #include "r_defs.h" 24 | #include "r_state.h" 25 | 26 | // Retrieve column data for span blitting. 27 | 28 | 29 | #define CACHETYPE_SPRITE 0 30 | #define CACHETYPE_FLAT 1 31 | #define CACHETYPE_PATCH 2 32 | #define CACHETYPE_COMPOSITE 3 33 | 34 | 35 | typedef struct { 36 | int8_t prev; 37 | int8_t next; 38 | 39 | // 0 for single page allocations. for multipage, 1 is the the last page of multipage 40 | // allocation and count up prev from there. allows us to idenitify connected pages in the cache 41 | int8_t pagecount; 42 | int8_t numpages; // number of the pages in a multi page allocation 43 | //uint8_t value; // lump, value, etc 44 | } cache_node_page_count_t; 45 | 46 | typedef struct { 47 | int8_t prev; 48 | int8_t next; 49 | 50 | // flats are never anything but single page.. 51 | } cache_node_t; 52 | 53 | 54 | int8_t __far R_EvictFlatCacheEMSPage(); 55 | int8_t __near R_EvictCacheEMSPage(int8_t numpages, int8_t cachetype); 56 | void __near R_MarkL2CacheMRU(int8_t index, int8_t numpages, int8_t cachetype); 57 | void __far R_MarkL2FlatCacheMRU(int8_t index); 58 | 59 | //segment_t __near R_GetColumnSegment ( int16_t tex, int16_t col, int8_t segloopcachetype ); 60 | segment_t __far R_GetMaskedColumnSegment ( int16_t tex, int16_t col ); 61 | segment_t __far getspritetexture(int16_t index); 62 | 63 | #define BAD_TEXTURE 65535 64 | 65 | // I/O, setting up the stuff. 66 | void __near R_InitData (void); 67 | void R_PrecacheLevel (void); 68 | 69 | 70 | void R_LoadPatchColumns(uint16_t lump, segment_t texlocationsegment, boolean ismasked); 71 | void R_LoadSpriteColumns(uint16_t lump, segment_t destpatchsegment); 72 | 73 | #define TEXTURE_TYPE_PATCH 1 74 | #define TEXTURE_TYPE_COMPOSITE 2 75 | #define TEXTURE_TYPE_SPRITE 3 76 | 77 | 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /r_draw.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // System specific interface stuff. 17 | // 18 | 19 | 20 | #ifndef __R_DRAW__ 21 | #define __R_DRAW__ 22 | 23 | 24 | 25 | 26 | #define COLORMAP_SHADOW 0xFF 27 | // The span blitting interface. 28 | // Hook in assembler or system specific BLT 29 | // here. 30 | void __far R_DrawColumn (void); 31 | void __far R_DrawColumnLow (void); 32 | 33 | // The Spectre/Invisibility effect. 34 | void __far R_DrawFuzzColumn (int16_t count, byte __far * dest); 35 | 36 | 37 | void __far R_VideoErase (uint16_t ofs, int16_t count ); 38 | 39 | 40 | 41 | // Span blitting for rows, floor/ceiling. 42 | // No Sepctre effect needed. 43 | void __far R_DrawSpan (void); 44 | void __far R_DrawSpanPrep(); 45 | 46 | 47 | // Rendering function. 48 | void __far R_FillBackScreen (void); 49 | 50 | // If the view size is not full screen, draws a border around it. 51 | void __far R_DrawViewBorder (void); 52 | 53 | void __far R_DrawColumnPrep(uint16_t lookup_offset_difference); 54 | void __far R_DrawColumnPrepMasked(uint16_t lookup_offset_difference); 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /r_local.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Refresh (R_*) module, global header. 17 | // All the rendering/drawing stuff is here. 18 | // 19 | 20 | #ifndef __R_LOCAL__ 21 | #define __R_LOCAL__ 22 | 23 | // Binary Angles, sine/cosine/atan lookups. 24 | #include "tables.h" 25 | 26 | // Screen size related parameters. 27 | #include "doomdef.h" 28 | 29 | // Include the refresh/render data structs. 30 | #include "r_data.h" 31 | 32 | 33 | 34 | // 35 | // Separate header file for each module. 36 | // 37 | #include "r_main.h" 38 | #include "r_bsp.h" 39 | #include "r_segs.h" 40 | #include "r_plane.h" 41 | #include "r_data.h" 42 | #include "r_things.h" 43 | #include "r_draw.h" 44 | 45 | #define PATCHMASK 0x7FFF 46 | #define ORIGINX_SIGN_FLAG 0x8000 47 | 48 | typedef struct { 49 | // Block origin (allways UL), 50 | // which has allready accounted 51 | // for the internal origin of the patch. 52 | uint8_t originx; // in practice values range from ~-120 to 240. we use high bit of patch as negative 53 | int8_t originy; // in practice values range from ~-120 to 120 54 | int16_t patch; // lump num 55 | } texpatch_t; 56 | 57 | typedef struct { 58 | // Keep name for switch changing, etc. 59 | int8_t name[8]; 60 | // width and height max out at 256 and are never 0. we store as real size - 1 and add 1 whenever we readd it 61 | uint8_t width; 62 | uint8_t height; 63 | 64 | // All the patches[patchcount] 65 | // are drawn back to front into the cached texture. 66 | uint8_t patchcount; 67 | texpatch_t patches[1]; 68 | 69 | } texture_t; 70 | 71 | 72 | 73 | #endif // __R_LOCAL__ 74 | -------------------------------------------------------------------------------- /r_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // System specific interface stuff. 17 | // 18 | 19 | 20 | #ifndef __R_MAIN__ 21 | #define __R_MAIN__ 22 | 23 | #include "d_player.h" 24 | #include "r_data.h" 25 | 26 | 27 | 28 | // 29 | // Lighting LUT. 30 | // Used for z-depth cuing per column/row, 31 | // and other lighting effects (sector ambient, flash). 32 | // 33 | 34 | // Lighting constants. 35 | // Now why not 32 levels here? 36 | #define LIGHTLEVELS 16 37 | #define LIGHTSEGSHIFT 4 38 | 39 | #define MAXLIGHTSCALE 48 40 | #define LIGHTSCALESHIFT 12 41 | #define MAXLIGHTZ 128 42 | #define LIGHTZSHIFT 20 43 | 44 | 45 | 46 | // Number of diminishing brightness levels. 47 | // There a 0-31, i.e. 32 LUT in the COLORMAP lump. 48 | #define NUMCOLORMAPS 32 49 | 50 | 51 | // Blocky/low detail mode. 52 | //B remove this? 53 | // 0 = high, 1 = low 54 | 55 | 56 | // 57 | // Function pointers to switch refresh/drawing functions. 58 | // Used to select shadow mode etc. 59 | // 60 | // No shadow effects on floors. 61 | 62 | 63 | // 64 | // Utility functions. 65 | 66 | 67 | /**/ 68 | #pragma aux fiveparam \ 69 | __parm [dx ax] [cx bx] [si] \ 70 | __modify [ax bx cx dx si]; 71 | 72 | #pragma aux (fiveparam) R_PointOnSegSide; 73 | int16_t __near R_PointOnSegSide ( fixed_t_union x, fixed_t_union y, int16_t segindex); 74 | 75 | uint32_t __far R_PointToAngle ( fixed_t_union x, fixed_t_union y ); 76 | uint32_t __far R_PointToAngle2 ( fixed_t_union x1, fixed_t_union y1, fixed_t_union x2, fixed_t_union y2 ); 77 | uint32_t __far R_PointToAngle2_16 ( int16_t x2, int16_t y2 ); 78 | fixed_t __near R_PointToDist ( int16_t x,int16_t y ); 79 | 80 | 81 | fixed_t __far R_ScaleFromGlobalAngle (fineangle_t visangle_shift3); 82 | 83 | 84 | 85 | 86 | 87 | // 88 | // REFRESH - the actual rendering functions. 89 | // 90 | 91 | // Called by G_Drawer. 92 | void __far R_RenderPlayerView (); 93 | 94 | // Called by startup code. 95 | void __near R_Init (void); 96 | 97 | // Called by M_Responder. 98 | void __far R_SetViewSize (uint8_t blocks, uint8_t detail); 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /r_plane.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Refresh, visplane stuff (floor, ceilings). 17 | // 18 | 19 | 20 | #ifndef __R_PLANE__ 21 | #define __R_PLANE__ 22 | 23 | 24 | #include "r_data.h" 25 | 26 | // Visplane related. 27 | 28 | 29 | void __near R_ClearPlanes (void); 30 | void __near R_DrawPlanes (void); 31 | 32 | #define IS_CEILING_PLANE 1 33 | #define IS_FLOOR_PLANE 0 34 | int16_t __near R_FindPlane ( fixed_t height, int8_t isceil, visplanepiclight_t picandlight ); 35 | int16_t __near R_CheckPlane (int16_t index, int16_t start, int16_t stop,int8_t isceil); 36 | 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /r_segs.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Refresh module, drawing LineSegs from BSP. 17 | // 18 | 19 | 20 | #ifndef __R_SEGS__ 21 | #define __R_SEGS__ 22 | 23 | 24 | void __near R_RenderMaskedSegRange ( drawseg_t __far* ds, int16_t x1, int16_t x2 ); 25 | void __near R_RenderMaskedSegRange2 ( drawseg_t __far* ds, int16_t x1, int16_t x2 ); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /r_state.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Refresh/render internal state variables (global). 17 | // 18 | 19 | 20 | #ifndef __R_STATE__ 21 | #define __R_STATE__ 22 | 23 | // Need data structure definitions. 24 | #include "d_player.h" 25 | #include "r_data.h" 26 | #include "z_zone.h" 27 | 28 | 29 | #define SECNUM_NULL -1 30 | #define LINENUM_NULL -1 31 | #define SBARHEIGHT 32 32 | 33 | // max values in doom 1 and doom2 combined 34 | #define MAX_SIDES 2587u 35 | #define MAX_SECTORS 348u 36 | #define MAX_VERTEXES 1626u 37 | #define MAX_LINES 1764u 38 | #define MAX_SUBSECTORS 956u 39 | #define MAX_NODES 955u 40 | //#define MAX_SUBSECTORS 875u 41 | //#define MAX_NODES 874u 42 | 43 | #define MAX_SEGS 2815u 44 | #define MAX_LINEBUFFER_COUNT 2542u 45 | 46 | #define MAX_SIDES_SIZE (MAX_SIDES * sizeof(side_t)) 47 | #define MAX_SECTORS_SIZE (MAX_SECTORS * sizeof(sector_t)) 48 | #define MAX_VERTEXES_SIZE (MAX_VERTEXES * sizeof(vertex_t)) 49 | #define MAX_LINES_SIZE (MAX_LINES * sizeof(line_t)) 50 | #define MAX_LINEFLAGS_SIZE (MAX_LINES * sizeof(uint8_t)) 51 | #define MAX_SEENLINES_SIZE ((MAX_LINES / 8) + 1) 52 | #define MAX_SUBSECTORS_SIZE (MAX_SUBSECTORS * sizeof(subsector_t)) 53 | #define MAX_SUBSECTOR_LINES_SIZE (MAX_SUBSECTORS * sizeof(uint8_t)) 54 | #define MAX_NODES_SIZE (MAX_NODES * sizeof(node_t)) 55 | #define MAX_NODE_CHILDREN_SIZE (MAX_NODES * sizeof(node_children_t)) 56 | #define MAX_SEGS_SIZE (MAX_SEGS * sizeof(seg_t)) 57 | 58 | #define MAX_SEGS_PHYSICS_SIZE (MAX_SEGS * sizeof(seg_physics_t)) 59 | #define MAX_SECTORS_PHYSICS_SIZE (MAX_SECTORS * sizeof(sector_physics_t)) 60 | #define MAX_SECTORS_SOUNDORGS_SIZE (MAX_SECTORS * sizeof(sector_soundorg_t)) 61 | #define MAX_SECTORS_SOUNDTRAVERSED_SIZE (MAX_SECTORS * sizeof(int8_t)) 62 | #define MAX_LINES_PHYSICS_SIZE (MAX_LINES * sizeof(line_physics_t)) 63 | 64 | #define MAX_SIDES_RENDER_SIZE (MAX_SIDES * sizeof(side_render_t)) 65 | #define MAX_NODES_RENDER_SIZE (MAX_NODES * sizeof(node_render_t)) 66 | #define MAX_SEGS_RENDER_SIZE (MAX_SEGS * sizeof(seg_render_t)) 67 | 68 | #define MAX_LINEBUFFER_SIZE (MAX_LINEBUFFER_COUNT * sizeof(int16_t)) 69 | #define MAX_BLOCKMAP_LUMPSIZE 26870u 70 | #define MAX_BLOCKLINKS_SIZE 7866u 71 | #define MAX_REJECT_SIZE 15138u 72 | #define NIGHTMARE_SPAWN_SIZE (MAX_THINKERS * sizeof(mapthing_t)) 73 | 74 | 75 | #define MAX_LEVEL_THINKERS 509u 76 | 77 | /* 78 | 79 | MAX_SIDES_SIZE 10348 80 | MAX_SECTORS_SIZE 5568 81 | MAX_VERTEXES_SIZE 6504 82 | MAX_LINES_SIZE 8820 83 | MAX_SUBSECTORS_SIZE 4375 84 | MAX_NODES_SIZE 10488 85 | MAX_SEGS_SIZE 8445 86 | 87 | 12138 88 | 89 | 90 | //65442 91 | MAX_SEGS_PHYSICS_SIZE 11260 92 | MAX_LINES_PHYSICS_SIZE 28224 93 | MAX_BLOCKMAP_LUMPSIZE 26870u 94 | 95 | 96 | 818 over!!! 97 | 98 | //43448 99 | MAX_SECTORS_PHYSICS_SIZE 6960 100 | MAX_LINEBUFFER_SIZE 5084 101 | MAX_BLOCKLINKS_SIZE 7866u 102 | NIGHTMARE_SPAWN_SIZE 8400u 103 | MAX_REJECT_SIZE 15138u 104 | 105 | 106 | 107 | 108 | MAX_SIDES_RENDER_SIZE 10348 109 | MAX_NODES_RENDER_SIZE 13984 110 | MAX_SEGS_RENDER_SIZE 28150 111 | 112 | 113 | */ 114 | 115 | // 116 | // Refresh internal data structures, 117 | // for rendering. 118 | // 119 | 120 | 121 | 122 | 123 | #define MAXOPENINGS SCREENWIDTH*64 124 | #define MAXVISSPRITES 128 125 | 126 | 127 | 128 | 129 | 130 | // 646 131 | // sizeof(visplane_t) 132 | #define VISPLANE_BYTE_SIZE (6 + (2 * SCREENWIDTH)) 133 | // 25 134 | #define VISPLANES_PER_EMS_PAGE (PAGE_FRAME_SIZE / VISPLANE_BYTE_SIZE) 135 | #define NUM_VISPLANE_PAGES 5 136 | #define MAXEMSVISPLANES (NUM_VISPLANE_PAGES * VISPLANES_PER_EMS_PAGE) 137 | 138 | // before swapping becomes required... 139 | #define MAX_CONVENTIONAL_VISPLANES 75 140 | 141 | 142 | 143 | 144 | 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /r_things.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Rendering of moving objects, sprites. 17 | // 18 | 19 | 20 | #ifndef __R_THINGS__ 21 | #define __R_THINGS__ 22 | 23 | 24 | 25 | // Constant arrays used for psprite clipping 26 | // and initializing clipping. 27 | 28 | 29 | 30 | void __near R_DrawSingleMaskedColumn (segment_t pixeldata_segment, byte length); 31 | void __near R_DrawMaskedColumn (segment_t pixeldata_segment, column_t __far* postdata); 32 | void __near R_DrawMaskedSpriteShadow (segment_t pixeldata, column_t __far* column); 33 | 34 | void __near R_SortVisSprites (void); 35 | 36 | void __near R_ClearSprites (void); 37 | 38 | void __near R_PrepareMaskedPSprites(void); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /s_sbsfx.h: -------------------------------------------------------------------------------- 1 | #ifndef __S_SBSFX_H__ 2 | #define __S_SBSFX_H__ 3 | 4 | #include "doomdef.h" 5 | #include "m_near.h" 6 | 7 | 8 | int16_t __far SB_InitCard(); 9 | void __far SB_Shutdown(); 10 | void __far SB_StartInit(); 11 | 12 | 13 | 14 | enum SB_ERRORS 15 | { 16 | SB_Warning = -2, 17 | SB_Error = -1, 18 | SB_OK = 0, 19 | SB_EnvNotFound, 20 | SB_AddrNotSet, 21 | SB_DMANotSet, 22 | SB_DMA16NotSet, 23 | SB_InvalidParameter, 24 | SB_CardNotReady, 25 | SB_NoSoundPlaying, 26 | SB_InvalidIrq, 27 | SB_UnableToSetIrq, 28 | SB_DmaError, 29 | SB_NoMixer, 30 | SB_DPMI_Error, 31 | SB_OutOfMemory 32 | }; 33 | 34 | #define SB_MixBufferSize 256 35 | #define SB_TotalBufferSize (SB_MixBufferSize * 2) 36 | 37 | #define SB_TransferLength SB_MixBufferSize 38 | #define SB_DoubleBufferLength SB_TransferLength * 2 39 | 40 | #define SAMPLE_RATE_11_KHZ_UINT 11025 41 | #define SAMPLE_RATE_22_KHZ_UINT 22050 42 | 43 | #define SAMPLE_RATE_11_KHZ_FLAG 0 44 | #define SAMPLE_RATE_22_KHZ_FLAG 1 45 | 46 | 47 | #define MIXER_MPU401_INT 0x04 48 | #define MIXER_16BITDMA_INT 0x02 49 | #define MIXER_8BITDMA_INT 0x01 50 | 51 | 52 | 53 | // 11/22 khz mode switch 54 | // when a 22 khz sound is started, set sample mode to mode 22 khz for the next dma cycle... 55 | // if mode is 22 and last interrupt was not mode 22, do a switch 56 | // in 22 mode, 11 khz samples are doubled. 57 | // when a 22 sound is ended, set a flag 58 | // if any 22s played in that interrupt, dont do anything 59 | // if none played, go back to 11 mode next interrupt? 60 | 61 | 62 | 63 | 64 | 65 | #define SB_DSP_Set_DA_Rate 0x41 66 | #define SB_DSP_Set_AD_Rate 0x42 67 | 68 | #define SB_Ready 0xAA 69 | 70 | #define SB_MixerAddressPort 0x4 71 | #define SB_MixerDataPort 0x5 72 | #define SB_ResetPort 0x6 73 | #define SB_ReadPort 0xA 74 | #define SB_WritePort 0xC 75 | #define SB_DataAvailablePort 0xE 76 | 77 | // hacked settings for now 78 | 79 | //todo! configure these! 80 | #define UNDEFINED_DMA -1 81 | 82 | #define FIXED_SB_PORT 0x220 83 | #define FIXED_SB_DMA_8 1 84 | #define FIXED_SB_DMA_16 5 85 | #define FIXED_SB_IRQ 7 86 | 87 | // #define SB_STEREO 1 88 | // #define SB_SIXTEEN_BIT 2 89 | 90 | 91 | #define SB_TYPE_NONE 0 92 | 93 | #define SB_TYPE_SB 1 94 | #define SB_TYPE_SBPro 2 95 | #define SB_TYPE_SB20 3 96 | #define SB_TYPE_SBPro2 4 97 | #define SB_TYPE_SB16 6 98 | 99 | 100 | #define PLAYING_FLAG 0x80 101 | #define SFX_ID_MASK 0x7F 102 | 103 | #define SB_DSP_Version1xx 0x0100 104 | #define SB_DSP_Version2xx 0x0200 105 | #define SB_DSP_Version201 0x0201 106 | #define SB_DSP_Version3xx 0x0300 107 | #define SB_DSP_Version4xx 0x0400 108 | 109 | 110 | 111 | #define NUM_SFX_LUMPS 10 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | #define SOUND_NOT_IN_CACHE 0xFF 120 | #define SFX_PAGE_SEGMENT 0xD400 121 | #define SFX_PAGE_ADDRESS (byte __far*) 0xD4000000 122 | #define SOUND_SINGULARITY_FLAG 0x8000 123 | #define SOUND_22_KHZ_FLAG 0x4000 124 | #define SOUND_LUMP_BITMASK 0x3FFF 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | #endif 140 | -------------------------------------------------------------------------------- /s_sound.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // The not so system specific sound interface. 17 | // 18 | 19 | 20 | #ifndef __S_SOUND__ 21 | #define __S_SOUND__ 22 | 23 | #include "z_zone.h" 24 | #include "doomdef.h" 25 | #include "p_mobj.h" 26 | #include "sounds.h" 27 | 28 | typedef uint8_t musicenum_t; 29 | typedef uint8_t sfxenum_t; 30 | 31 | // 32 | // Initializes sound stuff, including volume 33 | // Sets channels, SFX and music volume, 34 | // allocates channel buffer, sets S_sfx lookup. 35 | // 36 | 37 | 38 | #define MAX_SFX_CHANNELS 8 39 | 40 | 41 | typedef struct { 42 | // sound information (if null, channel avail.) 43 | 44 | // hack for doing degen mobjs 45 | int16_t soundorg_secnum; 46 | 47 | // origin of sound 48 | THINKERREF originRef; 49 | 50 | // handle of the sound being played 51 | int8_t handle; 52 | 53 | sfxenum_t sfx_id; 54 | 55 | } channel_t; 56 | // 57 | // Per level startup code. 58 | // Kills playing sounds at start of level, 59 | // determines music if any, changes music. 60 | // 61 | void S_Start(void); 62 | 63 | 64 | // 65 | // Start sound for thing at 66 | // using from sounds.h 67 | // 68 | void S_StartSound (mobj_t __near* origin, sfxenum_t sound_id ); 69 | 70 | void S_StartSoundWithParams(int16_t soundorg_secnum, sfxenum_t sound_id); 71 | 72 | 73 | 74 | // Will start a sound at a given volume. 75 | void S_StartSoundWithPosition ( mobj_t __near* origin, sfxenum_t sfx_id, int16_t soundorg_secnum ); 76 | 77 | 78 | // Stop sound for thing at 79 | void S_StopSound(mobj_t __near* origin, int16_t soundorg_secnum); 80 | void S_StopSoundMobjRef(mobj_t __near* origin); 81 | 82 | 83 | // Start music using from sounds.h 84 | void S_StartMusic(musicenum_t music_id); 85 | 86 | // Start music using from sounds.h, 87 | // and set whether looping 88 | void S_ChangeMusic ( musicenum_t music_id, boolean looping ); 89 | 90 | 91 | 92 | // Stops the music fer sure. 93 | void S_StopMusic(void); 94 | 95 | // Stop and resume music, during game PAUSE. 96 | void S_PauseSound(void); 97 | void S_ResumeSound(void); 98 | 99 | 100 | // 101 | // Updates music & sounds 102 | // 103 | void S_UpdateSounds(); 104 | 105 | void S_SetMusicVolume(uint8_t volume); 106 | void S_SetSfxVolume(uint8_t volume); 107 | 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /sc_mpu.c: -------------------------------------------------------------------------------- 1 | #include "doomdef.h" 2 | #include "sc_music.h" 3 | #include "m_near.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | 17 | 18 | 19 | 20 | /* MPU401 commands: (out: port 331h) */ 21 | #define MPU401_SET_UART (uint8_t)0x3F // set UART mode 22 | #define MPU401_RESET (uint8_t)0xFF // reset MIDI device 23 | 24 | // MPU401 status codes: (in: port 331h) 25 | #define MPU401_BUSY 0x40 // 1:busy, 0:ready to receive a command 26 | #define MPU401_EMPTY 0x80 // 1:empty, 0:buffer is full 27 | #define MPU401_ACK 0xFE // command acknowledged 28 | 29 | 30 | /* write one byte to MPU-401 data port */ 31 | int8_t MPU401sendByte(uint8_t value){ 32 | uint16_t timeout = 10000; 33 | uint16_t statusport = MPU401port + 1; 34 | 35 | /* wait until the device is ready */ 36 | for(;;) { 37 | uint8_t delay; 38 | uint8_t status = inp(statusport); /* read status port */ 39 | if ((status & MPU401_BUSY) == 0){ 40 | break; 41 | } 42 | if (status & MPU401_EMPTY){ 43 | continue; 44 | } 45 | _enable(); 46 | for (delay = 100; delay; delay--){ 47 | 48 | } 49 | inp(MPU401port); /* discard incoming data */ 50 | if (--timeout == 0){ 51 | return -1; /* port is not responding: timeout */ 52 | } 53 | } 54 | 55 | outp(MPU401port, value); /* write value to data port */ 56 | return 0; 57 | } 58 | 59 | /* write block of bytes to MPU-401 port */ 60 | int8_t MPU401sendBlock(uint8_t *block, uint16_t length){ 61 | runningStatus = 0; /* clear the running status byte */ 62 | 63 | _disable(); 64 | while (length--){ 65 | MPU401sendByte(*block++); 66 | } 67 | _enable(); 68 | return 0; 69 | } 70 | 71 | /* write one byte to MPU-401 command port */ 72 | uint8_t MPU401sendCommand(uint8_t value){ 73 | uint16_t timeout; 74 | uint16_t statusport = MPU401port + 1; 75 | 76 | runningStatus = 0; /* clear the running status byte */ 77 | 78 | /* wait until the device is ready */ 79 | for(timeout = 0xFFFF;;) { 80 | if ((inp(statusport) & MPU401_BUSY) == 0){ /* read status port */ 81 | break; 82 | } 83 | if (--timeout == 0){ 84 | return -1; /* port is not responding: timeout */ 85 | } 86 | } 87 | 88 | outp(statusport, value); /* write value to command port */ 89 | 90 | /* wait for acknowledging the command */ 91 | for(timeout = 0xFFFF;;) { 92 | if ((inp(statusport) & MPU401_EMPTY) == 0){ /* read status port */ 93 | if (inp(MPU401port) == MPU401_ACK){ 94 | break; 95 | } 96 | } 97 | if (--timeout == 0){ 98 | return -1; /* port is not responding: timeout */ 99 | } 100 | } 101 | 102 | return 0; 103 | } 104 | 105 | /* reset MPU-401 port */ 106 | int8_t MPU401reset(void){ 107 | runningStatus = 0; /* clear the running status byte */ 108 | 109 | if (!MPU401sendCommand(MPU401_RESET)){ /* first trial */ 110 | return 0; 111 | } 112 | return MPU401sendCommand(MPU401_RESET); /* second trial */ 113 | } 114 | 115 | 116 | /* send MIDI command */ 117 | int8_t MPU401sendMIDI(uint8_t command, uint8_t par1, uint8_t par2){ 118 | uint8_t event = command & MIDI_EVENT_MASK; 119 | //if (event == MIDI_NOTE_ON){ 120 | //} else 121 | if (event == MIDI_NOTE_OFF) { 122 | 123 | /* convert NOTE_OFF to NOTE_ON with zero velocity */ 124 | command = (command & 0x0F) | MIDI_NOTE_ON; 125 | par2 = 0; /* velocity */ 126 | } 127 | 128 | _disable(); 129 | if (runningStatus != command){ 130 | MPU401sendByte(runningStatus = command); 131 | } 132 | MPU401sendByte(par1); 133 | if (event != MIDI_PATCH && event != MIDI_CHAN_TOUCH){ 134 | MPU401sendByte(par2); 135 | } 136 | _enable(); 137 | return 0; 138 | } 139 | 140 | 141 | int8_t MPU401detectHardware(uint16_t port, uint8_t irq, uint8_t dma){ 142 | int16_t savedMPU401port = MPU401port; 143 | int8_t result; 144 | 145 | MPU401port = port; 146 | result = MPU401reset() + 1; 147 | MPU401port = savedMPU401port; 148 | 149 | return result; 150 | } 151 | 152 | int8_t MPU401initHardware(uint16_t port, uint8_t irq, uint8_t dma){ 153 | MPU401port = port; 154 | if (MPU401reset()){ 155 | return -1; 156 | } 157 | return MPU401sendCommand(MPU401_SET_UART); /* set UART mode */ 158 | } 159 | 160 | int8_t MPU401deinitHardware(void){ 161 | return MPU401sendCommand(MPU401_RESET); 162 | } 163 | -------------------------------------------------------------------------------- /sc_music.h: -------------------------------------------------------------------------------- 1 | #ifndef __SC_MUSIC_H_ 2 | #define __SC_MUSIC_H_ 3 | 4 | #include "doomdef.h" 5 | #include "m_near.h" 6 | 7 | 8 | #define ctrlPatch 0 9 | #define ctrlBank 1 10 | #define ctrlModulation 2 11 | #define ctrlVolume 3 12 | #define ctrlPan 4 13 | #define ctrlExpression 5 14 | #define ctrlReverb 6 15 | #define ctrlChorus 7 16 | #define ctrlSustainPedal 8 17 | #define ctrlSoftPedal 9 18 | #define ctrlSoundsOff 10 19 | #define ctrlNotesOff 11 20 | #define ctrlMono 12 21 | #define ctrlPoly 13 22 | #define ctrlResetCtrls 14 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | #define MIDI_NOTE_OFF 0x80 // release key, , 31 | #define MIDI_NOTE_ON 0x90 // press key, , 32 | #define MIDI_NOTE_TOUCH 0xA0 // key after-touch, , 33 | #define MIDI_CONTROL 0xB0 // control change, , 34 | #define MIDI_PATCH 0xC0 // patch change, 35 | #define MIDI_CHAN_TOUCH 0xD0 // channel after-touch (??), 36 | #define MIDI_PITCH_WHEEL 0xE0 // pitch wheel, , 37 | #define MIDI_EVENT_MASK 0xF0 // value to mask out the event number, not a command! 38 | 39 | /* the following events contain no channel number */ 40 | #define MIDI_SYSEX 0xF0 // start of System Exclusive sequence 41 | #define MIDI_SYSEX2 0xF7 // System Exclusive sequence continue 42 | #define MIDI_TIMING 0xF8 // timing clock used when synchronization 43 | // is required 44 | #define MIDI_START 0xFA // start current sequence 45 | #define MIDI_CONTINUE 0xFB // continue a stopped sequence 46 | #define MIDI_STOP 0xFC // stop a sequence 47 | 48 | 49 | 50 | void MIDIplayNote(uint8_t channel, uint8_t note, int8_t noteVolume); 51 | void MIDIreleaseNote(uint8_t channel, uint8_t note); 52 | void MIDIpitchWheel(uint8_t channel, uint8_t pitch); 53 | void MIDIchangeControl(uint8_t channel, uint8_t controller, uint8_t value); 54 | void MIDIplayMusic(); 55 | void MIDIstopMusic(); 56 | void MIDIchangeSystemVolume(uint8_t systemVolume); 57 | int8_t MIDIinitDriver(void); 58 | 59 | 60 | 61 | //OPL stuff 62 | 63 | 64 | /* MUS file header structure */ 65 | typedef struct { 66 | char ID[4]; // identifier "MUS" 0x1A 67 | uint16_t scoreLen; // score length 68 | uint16_t scoreStart; // score start 69 | uint16_t channels; // primary channels 70 | uint16_t sec_channels; // secondary channels (??) 71 | uint16_t instrCnt; // used instrument count 72 | uint16_t dummy; 73 | // uint16_t instruments[...]; // table of used instruments 74 | } MUSheader; 75 | 76 | 77 | #define FL_FIXED_PITCH 0x0001 // note has fixed pitch (see below) 78 | #define FL_UNKNOWN 0x0002 // ??? (used in instrument #65 only) 79 | #define FL_DOUBLE_VOICE 0x0004 // use two voices instead of one 80 | 81 | 82 | #define OP2INSTRSIZE sizeof( OP2instrEntry) // instrument size (36 uint8_ts) 83 | #define OP2INSTRCOUNT (128 + 81-35+1) // instrument count 84 | 85 | 86 | 87 | 88 | int8_t OPLconvertVolume(uint8_t data, int8_t noteVolume); 89 | int8_t OPLpanVolume(int8_t noteVolume, int8_t pan); 90 | void OPLinit(uint16_t port, uint8_t OPL3); 91 | void OPLdeinit(void); 92 | int16_t OPL2detect(uint16_t port); 93 | int16_t OPL3detect(uint16_t port); 94 | 95 | 96 | 97 | 98 | #define NUM_CONTROLLERS 10 99 | 100 | 101 | 102 | #define MIDI_NOTE_OFF 0x80 // release key, , 103 | #define MIDI_NOTE_ON 0x90 // press key, , 104 | #define MIDI_NOTE_TOUCH 0xA0 // key after-touch, , 105 | #define MIDI_CONTROL 0xB0 // control change, , 106 | #define MIDI_PATCH 0xC0 // patch change, 107 | #define MIDI_CHAN_TOUCH 0xD0 // channel after-touch (??), 108 | #define MIDI_PITCH_WHEEL 0xE0 // pitch wheel, , 109 | #define MIDI_EVENT_MASK 0xF0 // value to mask out the event number, not a command! 110 | 111 | 112 | 113 | #endif 114 | -------------------------------------------------------------------------------- /sc_sbmid.c: -------------------------------------------------------------------------------- 1 | #include "doomdef.h" 2 | #include "sc_music.h" 3 | #include "m_near.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | 17 | 18 | /* I/O addresses (default base = 220h) */ 19 | #define DSP_READ_DATA 0x0A 20 | #define DSP_WRITE_DATA 0x0C 21 | #define DSP_WRITE_STATUS 0x0C 22 | #define DSP_DATA_AVAIL 0x0E 23 | 24 | /* DSP commands */ 25 | #define MIDI_READ_POLL 0x30 26 | #define MIDI_READ_IRQ 0x31 27 | #define MIDI_WRITE_POLL 0x38 28 | 29 | /* write data to the DAC */ 30 | #define writedac(x) { \ 31 | uint8_t t = 0xFF; \ 32 | while (inp(SBMIDIport + DSP_WRITE_STATUS) & (uint8_t)0x80 && \ 33 | --t); \ 34 | if (!t) \ 35 | return -1; \ 36 | outp(SBMIDIport + DSP_WRITE_DATA, (x)); \ 37 | } 38 | 39 | /* write one byte to SB MIDI data port */ 40 | int8_t SBMIDIsendByte(uint8_t value) { 41 | writedac(MIDI_WRITE_POLL); 42 | writedac(value); 43 | return 0; 44 | } 45 | 46 | /* write block of bytes to MPU-401 port */ 47 | int SBMIDIsendBlock(uint8_t *block, uint16_t length){ 48 | runningStatus = 0; /* clear the running status byte */ 49 | 50 | _disable(); 51 | while (length--){ 52 | SBMIDIsendByte(*block++); 53 | } 54 | _enable(); 55 | return 0; 56 | } 57 | 58 | 59 | /* send MIDI command */ 60 | int8_t SBMIDIsendMIDI(uint8_t command, uint8_t par1, uint8_t par2){ 61 | uint8_t event = command & MIDI_EVENT_MASK; 62 | 63 | if (event == MIDI_NOTE_OFF) { 64 | /* convert NOTE_OFF to NOTE_ON with zero velocity */ 65 | command = (command & 0x0F) | MIDI_NOTE_ON; 66 | par2 = 0; /* velocity */ 67 | } 68 | 69 | _disable(); 70 | if (runningStatus != command){ 71 | runningStatus = command; 72 | SBMIDIsendByte(runningStatus); 73 | } 74 | SBMIDIsendByte(par1); 75 | if (event != MIDI_PATCH && event != MIDI_CHAN_TOUCH){ 76 | SBMIDIsendByte(par2); 77 | } 78 | _enable(); 79 | return 0; 80 | } 81 | 82 | 83 | 84 | int8_t SBMIDIdetectHardware(uint16_t port, uint8_t irq, uint8_t dma){ 85 | runningStatus = 0; 86 | return 1; /* always present */ 87 | } 88 | 89 | 90 | int8_t SBMIDIinitHardware(uint16_t port, uint8_t irq, uint8_t dma){ 91 | SBMIDIport = port; 92 | runningStatus = 0; 93 | return 0; 94 | } 95 | 96 | int8_t SBMIDIdeinitHardware(void){ 97 | runningStatus = 0; 98 | return 0; 99 | } 100 | 101 | -------------------------------------------------------------------------------- /sounds.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Created by a sound utility. 17 | // Kept as a sample, DOOM2 sounds. 18 | // 19 | 20 | 21 | #include "doomtype.h" 22 | #include "sounds.h" 23 | 24 | -------------------------------------------------------------------------------- /st_lib.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // The status bar widget code. 17 | // 18 | 19 | #ifndef __STLIB__ 20 | #define __STLIB__ 21 | 22 | 23 | // We are referring to patches. 24 | #include "r_defs.h" 25 | 26 | 27 | // 28 | // Background and foreground screen numbers 29 | // 30 | #define BG 4 31 | #define FG 0 32 | 33 | 34 | 35 | // 36 | // Typedefs of widgets 37 | // 38 | 39 | // Number widget 40 | 41 | typedef struct { 42 | // upper right-hand corner 43 | // of the number (right-justified) 44 | int16_t x; 45 | int16_t y; 46 | 47 | // max # of digits in number 48 | int16_t width; 49 | 50 | // last number value 51 | int16_t oldnum; 52 | 53 | // list of patches for 0-9 54 | uint16_t __near* patch_offset; 55 | 56 | } st_number_t; 57 | 58 | 59 | 60 | // Percent widget ("child" of number widget, 61 | // or, more precisely, contains a number widget.) 62 | typedef struct { 63 | // number information 64 | st_number_t num; 65 | 66 | // percent sign graphic 67 | //patch_t* p; 68 | uint16_t patch_offset; 69 | 70 | } st_percent_t; 71 | 72 | 73 | 74 | // Multiple Icon widget 75 | typedef struct { 76 | // center-justified location of icons 77 | int16_t x; 78 | int16_t y; 79 | 80 | // last icon number 81 | int16_t oldinum; 82 | 83 | // pointer to current icon 84 | 85 | // pointer to boolean stating 86 | // whether to update icon 87 | 88 | // list of icons 89 | uint16_t __near* patch_offset; 90 | 91 | } st_multicon_t; 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /st_setup.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Status bar code. 17 | // Does the face/direction indicator animatin. 18 | // Does palette indicators as well (red pain/berserk, bright pickup) 19 | // 20 | 21 | 22 | #include 23 | 24 | #include "i_system.h" 25 | #include "z_zone.h" 26 | #include "m_misc.h" 27 | #include "w_wad.h" 28 | 29 | #include "doomdef.h" 30 | 31 | #include "g_game.h" 32 | 33 | #include "st_stuff.h" 34 | #include "st_lib.h" 35 | #include "r_local.h" 36 | 37 | #include "p_local.h" 38 | #include "p_inter.h" 39 | 40 | #include "am_map.h" 41 | #include "dutils.h" 42 | 43 | #include "s_sound.h" 44 | 45 | // Needs access to LFB. 46 | #include "v_video.h" 47 | 48 | // State. 49 | #include "doomstat.h" 50 | 51 | // Data. 52 | #include "dstrings.h" 53 | #include "sounds.h" 54 | #include "st_stuff.h" 55 | #include "m_memory.h" 56 | #include "m_near.h" 57 | 58 | 59 | 60 | // ? 61 | void __near STlib_initNum (st_number_t __near* n,int16_t x,uint8_t y,uint16_t __near* pl,int16_t width){ 62 | n->x = x; 63 | n->y = y; 64 | n->oldnum = 0; 65 | n->width = width; 66 | n->patch_offset = pl; 67 | } 68 | 69 | 70 | // 71 | void __near STlib_initPercent (st_percent_t __near* p,int16_t x,uint8_t y,uint16_t __near* pl,uint16_t percent) { 72 | STlib_initNum(&p->num, x, y, pl, 3); 73 | p->patch_offset = percent; 74 | } 75 | 76 | 77 | 78 | void __near STlib_initMultIcon (st_multicon_t __near* i,int16_t x,uint8_t y,uint16_t __near* il) { 79 | i->x = x; 80 | i->y = y; 81 | i->oldinum = -1; 82 | i->patch_offset = il; 83 | 84 | } 85 | 86 | 87 | void __near ST_createWidgets(void){ 88 | 89 | int8_t i; 90 | uint8_t ST_MAXAMMOY[4] = {ST_MAXAMMO0Y,ST_MAXAMMO1Y,ST_MAXAMMO2Y,ST_MAXAMMO3Y}; 91 | // ready weapon ammo 92 | STlib_initNum(&w_ready, ST_AMMOX, ST_AMMOY, tallnum, ST_AMMOWIDTH); 93 | 94 | // health percentage 95 | STlib_initPercent(&w_health,ST_HEALTHX,ST_HEALTHY,tallnum,tallpercent); 96 | // arms background 97 | STlib_initMultIcon(&w_armsbg, ST_ARMSBGX, ST_ARMSBGY, armsbgarray); 98 | 99 | w_armsbg.oldinum = 0; // hack to make it work as multicon instead of binicon 100 | 101 | // weapons owned 102 | for (i = 0; i < 6; i++) { 103 | STlib_initMultIcon(&w_arms[i], ST_ARMSX + (i % 3)*ST_ARMSXSPACE, ST_ARMSY + (i / 3)*ST_ARMSYSPACE, arms[i]); 104 | } 105 | 106 | 107 | 108 | // faces 109 | STlib_initMultIcon(&w_faces, ST_FACESX, ST_FACESY, faces); 110 | 111 | // armor percentage - should be colored later 112 | STlib_initPercent(&w_armor, ST_ARMORX, ST_ARMORY, tallnum, tallpercent); 113 | 114 | // keyboxes 0-2 115 | STlib_initMultIcon(&w_keyboxes[0], ST_KEY0X, ST_KEY0Y, keys); 116 | STlib_initMultIcon(&w_keyboxes[1], ST_KEY1X, ST_KEY1Y, keys); 117 | STlib_initMultIcon(&w_keyboxes[2], ST_KEY2X, ST_KEY2Y, keys); 118 | 119 | 120 | for (i = 0; i < 4; i++){ 121 | 122 | // ammo count (all four kinds) 123 | STlib_initNum(&w_ammo[i], ST_AMMO0X, ST_MAXAMMOY[i], shortnum, ST_AMMO0WIDTH); 124 | // max ammo count (all four kinds) 125 | STlib_initNum(&w_maxammo[i], ST_MAXAMMO0X, ST_MAXAMMOY[i], shortnum, ST_MAXAMMO0WIDTH); 126 | } 127 | 128 | 129 | } 130 | 131 | 132 | 133 | void __near ST_Stop(void){ 134 | if (st_stopped){ 135 | return; 136 | } 137 | I_SetPalette(0); 138 | st_stopped = true; 139 | 140 | } 141 | 142 | 143 | void __far ST_Start(void) { 144 | int8_t i; 145 | 146 | if (!st_stopped){ 147 | ST_Stop(); 148 | } 149 | 150 | st_firsttime = true; 151 | st_gamestate = FirstPersonState; 152 | st_statusbaron = true; 153 | 154 | st_faceindex = 0; 155 | st_palette = -1; 156 | st_oldhealth = -1; 157 | 158 | for (i = 0; i < NUMWEAPONS; i++){ 159 | oldweaponsowned[i] = player.weaponowned[i]; 160 | } 161 | 162 | for (i = 0; i < 3; i++){ 163 | keyboxes[i] = -1; 164 | } 165 | 166 | 167 | ST_createWidgets(); 168 | st_stopped = false; 169 | 170 | } 171 | -------------------------------------------------------------------------------- /superalpha.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sqpat/RealDOOM/95203cc337d5808c63c9e7ff24d0241bf5bf4033/superalpha.gif -------------------------------------------------------------------------------- /tables.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Lookup tables. 17 | // Do not try to look them up :-). 18 | // In the order of appearance: 19 | // 20 | // finetangent[4096] - Tangens LUT. 21 | // Should work with BAM fairly well (12 of 16bit, 22 | // effectively, by shifting). 23 | // 24 | // finesine[10240] - Sine lookup. 25 | // Guess what, serves as cosine, too. 26 | // Remarkable thing is, how to use BAMs with this? 27 | // 28 | // tantoangle[2049] - ArcTan LUT, 29 | // maps tan(angle) to angle fast. Gotta search. 30 | // 31 | //----------------------------------------------------------------------------- 32 | 33 | 34 | #ifndef __TABLES__ 35 | #define __TABLES__ 36 | 37 | #define PI 3.141592657 38 | 39 | #include "doomdef.h" 40 | 41 | #define FINEANGLES 8192 42 | #define FINEMASK (FINEANGLES-1) 43 | 44 | 45 | 46 | 47 | 48 | 49 | // 0x100000000 to 0x2000 50 | #define ANGLETOFINESHIFT 19 51 | #define SHORTTOFINESHIFT 3 52 | 53 | 54 | 55 | // Binary Angle Measument, BAM. 56 | #define ANG45 0x20000000u 57 | #define ANG90 0x40000000u 58 | #define ANG180 0x80000000u 59 | #define ANG270 0xc0000000u 60 | 61 | #define ANG45_HIGHBITS 0x2000u 62 | #define ANG90_HIGHBITS 0x4000u 63 | #define ANG180_HIGHBITS 0x8000u 64 | #define ANG270_HIGHBITS 0xc000u 65 | 66 | #define FINE_ANG45 0x400 67 | #define FINE_ANG90 0x800 68 | #define FINE_ANG180 0x1000 69 | #define FINE_ANG270 0x1800 70 | #define FINE_ANG360 0x2000 71 | 72 | 73 | #define FINE_ANG45_NOSHIFT 0x1000 74 | #define FINE_ANG90_NOSHIFT 0x2000 75 | #define FINE_ANG180_NOSHIFT 0x4000 76 | #define FINE_ANG270_NOSHIFT 0x6000 77 | #define FINE_ANG360_NOSHIFT 0x8000 78 | 79 | 80 | #define MOD_FINE_ANGLE(x) ((x & 0x1FFF)) 81 | #define MOD_FINE_ANGLE_NOSHIFT(x) ((x & 0x7FFF)) 82 | 83 | #define SLOPERANGE 2048 84 | #define SLOPEBITS 11 85 | #define DBITS (FRACBITS-SLOPEBITS) 86 | 87 | typedef fixed_t_union angle_t; 88 | 89 | // Effective size is 10240. 90 | 91 | 92 | 93 | // this one has no issues with mirroring 2nd half of values! 94 | 95 | #define finetangent(x) (x < 2048 ? finetangentinner[x] : -(finetangentinner[(-x+4095)]) ) 96 | 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /todo.txt: -------------------------------------------------------------------------------- 1 | BUGS 2 | - fix the patch issue with doors and buttons and stuff? 3 | - why are stages not loading right anymore? 4 | - backbuffer redraw jank in intermission? 5 | 6 | 7 | 8 | MEMORY IMPROVEMENTS 9 | - reuse local variables to create fewer in stack? 10 | 11 | KNOWN ISSUES 12 | - no sound, need new 16 bit lib 13 | - no titlepic, etc. requires 65k allocation, 64k currently maximum 14 | - time counter on level finish is wrong 15 | - non shareware enemies probably nonfunctional, needs testing 16 | - savegames broken. not sure if it will be compatible with original doom 17 | - rendering issue with weird line early in demo 3 might be related to rendering fuzzy 18 | 19 | TODO 20 | 21 | ~ make actor->angle fixed_t_union for a_chase improvement 22 | - move other data into external files. sprnames? 23 | 24 | 25 | ~ Memory improvements 26 | x alternate thinker allocator block 27 | - implement Z_FreeConventional to free thinkers... or proper algorithm to allocate thinkers. 28 | - can use single byte for size. should store head and use different allocator. 29 | - can probably even use high bit for 'freed memory'. 30 | - if all mobj are the same size, then dont need size, just "free" bit map and memref map? 31 | - memref mapping to position in map? 32 | - non mobj thinker goes in different map? 33 | 34 | - fix demo1/3 crash 35 | ? how big is texcols, etc? can it fit in conventional? 36 | - // 21552 each for shareware... this could potentially fit 37 | 38 | - Do something about blocklinks and NUM_BLOCKLINKS 39 | 40 | 41 | 2 smaller static mobj 42 | - whats size of all of them combined? num mobjs? 43 | 44 | 45 | 46 | ? playpal in conventional? 47 | x re-examine pagination amounts per type 48 | ~ ems 4.0 implementation 49 | - difficult, most drivers do not support 4+ page frames... maybe qemm386 50 | 51 | 52 | - near heap is largely unused after fileinfo alloca 53 | - put something in there. over 20k (?) or so unused 54 | ? implement 'smart' allocator in setup level 55 | - allocate most important items in conventional first 56 | 57 | 58 | - NUM_BLOCKLINKS is 2000. can be way less. 59 | - block x and y are bytes. have a 2 byte thing in a list. iterate thru the list. 60 | - or consider if it can fit in conventional? (later) 61 | 62 | - do a pass of fixedmul, div calls... find 32 and 16 param ones instead of 32 and 32, use an alternate call with one fewer cast. faster? 63 | 64 | ? probably remove zoom in am_map if it makes a decent difference in code size and complexity 65 | - change keyboard down booleans to bits? can save a few hundred bytes 66 | ? integrate asm based EMS implementation from catacombs 3d or somewhere else see https://github.com/CatacombGames/Catacomb3D/blob/aa97f4995dc7dbea3ecc1794a2d4d4354839cad4/ID_MM.C#L147 67 | - clean up speed code. probably dont need make_speed in a lot of cases -is high bit projectile only? 68 | 69 | - explicitly declare things near, far when possible? 70 | - drop conventional visplanes lower, use hybrid solution with EMS visplanes when the # gets high. Definitely under 64k visplanes, but how much is optimal? 71 | - look into 24 bit fixed point. maxmove caps momx, momy to 30 * fracunit, for example... 72 | - look into time vs size optimization flags on a per-file basis ? 73 | 74 | ASM Improvement ideas 75 | - fast math calls (multiply by 10, etc) 76 | - asm draw functions (of course) 77 | - asm EMS calls 78 | 79 | 80 | PROFILING 81 | - check if using 8 instead of 16 bit local vars (especially loop vars) affects 16 bit binary code size 82 | 83 | 84 | 85 | True 16 bit mode ideas 86 | - 250 pixel width, and then 1 byte various screen width based vars incl those in visplane... 87 | 88 | 89 | 90 | TESTING: 91 | - finale 92 | - doom1/2... viles and other enemy (heads, head spawns) 93 | 94 | -------------------------------------------------------------------------------- /v_video.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Gamma correction LUT. 17 | // Functions to draw patches (by post) directly to screen. 18 | // Functions to blit a block to the screen. 19 | // 20 | 21 | 22 | #ifndef __V_VIDEO__ 23 | #define __V_VIDEO__ 24 | 25 | #include "doomtype.h" 26 | 27 | #include "doomdef.h" 28 | 29 | // Needed because we are refering to patches. 30 | #include "r_data.h" 31 | #include "st_stuff.h" 32 | 33 | // 34 | // VIDEO 35 | // 36 | 37 | #define CENTERY (SCREENHEIGHT/2) 38 | 39 | 40 | 41 | 42 | #define NUM_MENU_ITEMS 46 43 | 44 | 45 | 46 | 47 | // Allocates buffer screens, call before R_Init. 48 | //void V_Init (void); 49 | 50 | 51 | void V_CopyRect ( uint16_t srcoffset, uint16_t destoffset, uint16_t width, uint16_t height); 52 | void V_DrawFullscreenPatch ( int8_t __near* texname, int8_t screen) ; 53 | 54 | /* 55 | #pragma aux drawpatchparams \ 56 | __modify [ax] [dx] \ 57 | __parm [ax] [dh] [dl] [cx bx] ; 58 | #pragma aux (drawpatchparams) V_DrawPatch; 59 | */ 60 | void __far V_DrawPatch ( int16_t x, int16_t y, int8_t scrn, patch_t __far* patch); 61 | 62 | void V_DrawPatchDirect( int16_t x,int16_t y, patch_t __far* patch ); 63 | void __far V_MarkRect( int16_t x, int16_t y, int16_t width, int16_t height ); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /w_wad.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // WAD I/O functions. 17 | // 18 | 19 | 20 | #ifndef __W_WAD__ 21 | #define __W_WAD__ 22 | #include "r_defs.h" 23 | 24 | 25 | // 26 | // TYPES 27 | // 28 | typedef struct { 29 | // Should be "IWAD" or "PWAD". 30 | int8_t identification[4]; 31 | int32_t numlumps; 32 | int32_t infotableofs; 33 | 34 | } wadinfo_t; 35 | 36 | 37 | typedef struct { 38 | int32_t filepos; 39 | int32_t size; 40 | int8_t name[8]; 41 | 42 | } filelump_t; 43 | 44 | // 45 | // WADFILE I/O related stuff. 46 | // 47 | 48 | 49 | 50 | // (OLD) 13 bytes each. LUMP_PER_EMS_PAGE is 1260 51 | // (NOW) 16 bytes each. LUMP_PER_EMS_PAGE is 1024 52 | //#define LUMP_PER_EMS_PAGE 16384 / sizeof(lumpinfo_t) 53 | #define LUMP_PER_EMS_PAGE 1024 54 | 55 | typedef struct { 56 | int8_t name[8]; 57 | int32_t position; 58 | // int8_t sizediff; // calculate size from next position minus your own plus diff. 59 | int32_t size; 60 | } lumpinfo_t; 61 | 62 | 63 | 64 | //#define lumpinfo4000 ((lumpinfo_t __far*) 0x44000000) 65 | 66 | 67 | int16_t W_CheckNumForName (int8_t* name); 68 | int16_t W_GetNumForName(int8_t* name); 69 | 70 | int32_t __far W_LumpLength (int16_t lump); 71 | 72 | 73 | void W_CacheLumpNumDirectFragment(int16_t lump, byte __far* dest, int32_t offset); 74 | 75 | void W_CacheLumpNameDirect(int8_t* name, byte __far* dest); 76 | void __far W_CacheLumpNumDirect(int16_t lump, byte __far* dest); 77 | void __far W_CacheLumpNumDirectWithOffset (int16_t lump, byte __far* dest, uint16_t offset, uint16_t length); 78 | 79 | 80 | // correct value for DOOM Sharware 81 | #define LUMPINFO_SIZE 16432 82 | //#define LUMPCACHE_SIZE 2528 83 | 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /wi_stuff.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 1993-1996 Id Software, Inc. 3 | // Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (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 | // DESCRIPTION: 16 | // Intermission. 17 | // 18 | 19 | #ifndef __WI_STUFF__ 20 | #define __WI_STUFF__ 21 | 22 | //#include "v_video.h" 23 | 24 | #include "doomdef.h" 25 | 26 | // States for the intermission 27 | 28 | #define NoState -1 29 | #define StatCount 0 30 | #define ShowNextLoc 1 31 | 32 | typedef int8_t stateenum_t; 33 | 34 | // Called by main loop, animate the intermission. 35 | //void __far WI_Ticker (void); 36 | // Called by main loop, 37 | // draws the intermission directly into the screen buffer. 38 | //void __far WI_Drawer (void); 39 | // Setup for an intermission screen. 40 | //void __far WI_Start(wbstartstruct_t __near* wbstartstruct, boolean playerdidsecret); 41 | 42 | 43 | typedef uint8_t animenum_t; 44 | 45 | // in practice the used values are all 8 bit, 0 - 224 46 | typedef struct { 47 | uint8_t x; 48 | uint8_t y; 49 | 50 | } point_t; 51 | 52 | // 20 bytes each .. 10, 9, 6 of them so 25 * 20 = 500 bytes total. 53 | // 54 | // Animation. 55 | // 56 | typedef struct { 57 | animenum_t type; 58 | 59 | // period in tics between animations 60 | uint8_t period; 61 | 62 | // number of animation frames 63 | int8_t nanims; 64 | 65 | // location of animation 66 | point_t loc; 67 | 68 | // ALWAYS: n/a, 69 | // RANDOM: period deviation (<256), 70 | // LEVEL: level 71 | // in practice values up to 8 are used 72 | int8_t data1; 73 | 74 | // ALWAYS: n/a, 75 | // RANDOM: random base period, 76 | // LEVEL: n/a 77 | 78 | // actual graphics for frames of animations 79 | int16_t pRef[3]; 80 | 81 | // following must be initialized to zero before use! 82 | 83 | // next value of bcnt (used in conjunction with period) 84 | uint16_t nexttic; 85 | 86 | // last drawn animation frame 87 | 88 | // next frame number to animate 89 | int8_t ctr; 90 | 91 | // used by RANDOM and LEVEL when animating 92 | uint8_t state; 93 | 94 | } wianim_t; 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /z_ht18.asm: -------------------------------------------------------------------------------- 1 | ; Copyright (C) 1993-1996 Id Software, Inc. 2 | ; Copyright (C) 1993-2008 Raven Software 3 | ; Copyright (C) 2016-2017 Alexey Khokholov (Nuke.YKT) 4 | ; 5 | ; This program is free software; you can redistribute it and/or 6 | ; modify it under the terms of the GNU General Public License 7 | ; as published by the Free Software Foundation; either version 2 8 | ; of the License, or (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 | ; DESCRIPTION: 16 | ; 17 | .MODEL medium 18 | .286 19 | 20 | 21 | INCLUDE defs.inc 22 | 23 | 24 | .DATA 25 | 26 | 27 | HT18_PAGE_SELECT_REGISTER = 01EEh 28 | HT18_PAGE_SET_REGISTER = 01ECh 29 | EXTRN _currentpageframes:BYTE 30 | 31 | .CODE 32 | 33 | 34 | 35 | 36 | 37 | ; no need for input registers because its always going to be ems page 0x4000 38 | PROC Z_QuickMap24AIC_ NEAR 39 | PUBLIC Z_QuickMap24AIC_ 40 | push si 41 | push cx 42 | push dx 43 | mov si, ax 44 | mov al, 080h ; 080h for autoincrement enable. 00h for page 4000 index 45 | mov dx, HT18_PAGE_SELECT_REGISTER 46 | out dx, al 47 | mov dx, HT18_PAGE_SET_REGISTER 48 | mov cx, 24 49 | rep outsw 50 | pop dx 51 | pop cx 52 | pop si 53 | ret 54 | ENDP 55 | 56 | 57 | PROC Z_QuickMap16AIC_ NEAR 58 | PUBLIC Z_QuickMap16AIC_ 59 | push si 60 | push cx 61 | push dx 62 | mov si, ax 63 | mov al, dl 64 | mov dx, HT18_PAGE_SELECT_REGISTER 65 | out dx, al 66 | mov dx, HT18_PAGE_SET_REGISTER 67 | mov cx, 16 68 | rep outsw 69 | pop dx 70 | pop cx 71 | pop si 72 | ret 73 | ENDP 74 | PROC Z_QuickMap9AIC_ NEAR 75 | PUBLIC Z_QuickMap9AIC_ 76 | push si 77 | push cx 78 | push dx 79 | mov si, ax 80 | mov al, dl 81 | 82 | mov dx, HT18_PAGE_SELECT_REGISTER 83 | out dx, al 84 | mov dx, HT18_PAGE_SET_REGISTER 85 | mov cx, 9 86 | rep outsw 87 | pop dx 88 | pop cx 89 | pop si 90 | ret 91 | ENDP 92 | PROC Z_QuickMap8AIC_ NEAR 93 | PUBLIC Z_QuickMap8AIC_ 94 | push si 95 | push cx 96 | push dx 97 | mov si, ax 98 | mov al, dl 99 | mov dx, HT18_PAGE_SELECT_REGISTER 100 | out dx, al 101 | mov dx, HT18_PAGE_SET_REGISTER 102 | mov cx, 8 103 | rep outsw 104 | pop dx 105 | pop cx 106 | pop si 107 | ret 108 | ENDP 109 | 110 | PROC Z_QuickMap6AIC_ NEAR 111 | PUBLIC Z_QuickMap6AIC_ 112 | push si 113 | push cx 114 | push dx 115 | mov si, ax 116 | mov al, dl 117 | mov dx, HT18_PAGE_SELECT_REGISTER 118 | out dx, al 119 | mov dx, HT18_PAGE_SET_REGISTER 120 | mov cx, 6 121 | rep outsw 122 | pop dx 123 | pop cx 124 | pop si 125 | ret 126 | ENDP 127 | 128 | PROC Z_QuickMap5AIC_ NEAR 129 | PUBLIC Z_QuickMap5AIC_ 130 | push si 131 | push cx 132 | push dx 133 | mov si, ax 134 | mov al, dl 135 | mov dx, HT18_PAGE_SELECT_REGISTER 136 | out dx, al 137 | mov dx, HT18_PAGE_SET_REGISTER 138 | mov cx, 5 139 | rep outsw 140 | pop dx 141 | pop cx 142 | pop si 143 | ret 144 | ENDP 145 | PROC Z_QuickMap4AIC_ NEAR 146 | PUBLIC Z_QuickMap4AIC_ 147 | push si 148 | push cx 149 | push dx 150 | mov si, ax 151 | mov al, dl 152 | mov dx, HT18_PAGE_SELECT_REGISTER 153 | out dx, al 154 | mov dx, HT18_PAGE_SET_REGISTER 155 | mov cx, 4 156 | rep outsw 157 | pop dx 158 | pop cx 159 | pop si 160 | ret 161 | ENDP 162 | PROC Z_QuickMap3AIC_ NEAR 163 | PUBLIC Z_QuickMap3AIC_ 164 | push si 165 | push dx 166 | mov si, ax 167 | mov al, dl 168 | mov dx, HT18_PAGE_SELECT_REGISTER 169 | out dx, al 170 | mov dx, HT18_PAGE_SET_REGISTER 171 | lodsw 172 | out dx, ax 173 | lodsw 174 | out dx, ax 175 | lodsw 176 | out dx, ax 177 | pop dx 178 | pop si 179 | ret 180 | ENDP 181 | PROC Z_QuickMap2AIC_ NEAR 182 | PUBLIC Z_QuickMap2AIC_ 183 | push si 184 | push dx 185 | mov si, ax 186 | mov al, dl 187 | mov dx, HT18_PAGE_SELECT_REGISTER 188 | out dx, al 189 | mov dx, HT18_PAGE_SET_REGISTER 190 | lodsw 191 | out dx, ax 192 | lodsw 193 | out dx, ax 194 | pop dx 195 | pop si 196 | ret 197 | ENDP 198 | 199 | 200 | PROC Z_QuickMap1AIC_ NEAR 201 | PUBLIC Z_QuickMap1AIC_ 202 | push si 203 | push dx 204 | mov si, ax 205 | mov al, dl 206 | mov dx, HT18_PAGE_SELECT_REGISTER 207 | out dx, al 208 | mov dx, HT18_PAGE_SET_REGISTER 209 | lodsw 210 | out dx, ax 211 | pop dx 212 | pop si 213 | ret 214 | 215 | 216 | 217 | ENDP 218 | 219 | ;todo test 220 | 221 | PROC Z_QuickMapPageFrame_ FAR 222 | PUBLIC Z_QuickMapPageFrame_ 223 | 224 | push dx 225 | push bx 226 | 227 | mov bx, ax 228 | xor bh, bh 229 | mov ds:[_currentpageframes+bx], dl 230 | 231 | mov bx, dx 232 | mov dx, HT18_PAGE_SELECT_REGISTER 233 | out dx, al 234 | mov dx, HT18_PAGE_SET_REGISTER 235 | xchg ax, bx 236 | add ax, MUS_DATA_PAGES 237 | out dx, ax 238 | 239 | pop bx 240 | pop dx 241 | 242 | ret 243 | 244 | ENDP 245 | 246 | END --------------------------------------------------------------------------------