├── data ├── DOOM1.WAD └── prboom.wad ├── src ├── main.h ├── prboom │ ├── r_draw.c │ ├── p_checksum.h │ ├── CMakeLists.txt │ ├── Makefile │ ├── component.mk │ ├── readme.txt │ ├── version.c │ ├── version.h │ ├── md5.h │ ├── doomdef.c │ ├── f_wipe.h │ ├── i_main.h │ ├── r_segs.h │ ├── i_joy.h │ ├── m_argv.h │ ├── r_demo.h │ ├── p_user.h │ ├── f_finale.h │ ├── m_bbox.h │ ├── r_sky.h │ ├── d_items.h │ ├── r_sky.c │ ├── m_cheat.h │ ├── m_bbox.c │ ├── wi_stuff.h │ ├── m_argv.c │ ├── r_drawcolpipeline.inl │ ├── d_ticcmd.h │ ├── z_bmalloc.h │ ├── p_setup.h │ ├── r_bsp.h │ ├── gl_struct.h │ ├── r_fps.h │ ├── r_plane.h │ ├── p_saveg.h │ ├── lprintf.h │ ├── i_network.h │ ├── p_tick.h │ ├── p_checksum.c │ ├── dstrings.h │ ├── r_things.h │ ├── p_inter.h │ ├── d_main.h │ ├── i_video.h │ ├── mmus2mid.h │ ├── r_demo.c │ ├── gl_intern.h │ ├── d_think.h │ ├── i_system.h │ ├── tables.h │ ├── s_sound.h │ ├── p_maputl.h │ ├── d_event.h │ ├── d_items.c │ ├── r_state.h │ ├── hu_stuff.h │ ├── p_pspr.h │ ├── dstrings.c │ ├── r_patch.h │ ├── st_stuff.h │ ├── protocol.h │ ├── i_sound.h │ ├── p_map.h │ ├── lprintf.c │ ├── p_enemy.h │ ├── r_data.h │ ├── r_main.h │ ├── m_misc.h │ ├── doomstat.c │ └── am_map.h ├── prboom-wad-tables │ ├── GAMMATBL.h │ ├── SINETABL.h │ ├── TANGTABL.h │ ├── TANTOANG.h │ ├── GAMMATBL.dat │ ├── SINETABL.dat │ ├── TANGTABL.dat │ ├── TANTOANG.dat │ ├── CMakeLists.txt │ └── component.mk ├── prboom-esp32-compat │ ├── gamepad.h │ ├── psxcontroller.h │ ├── CMakeLists.txt │ ├── Makefile │ ├── component.mk │ ├── mcp23017.h │ ├── ttgo_c.h │ ├── spi_lcd.h │ ├── ttgo_c.cpp │ ├── gamepad.c │ ├── i_network.c │ ├── Kconfig.projbuild │ └── psxcontroller.c ├── ttgo-config.h └── main.cpp ├── .gitignore ├── partitions.csv ├── flashwad.sh ├── test └── README ├── platformio.ini ├── lib └── README ├── include └── README ├── .travis.yml └── README.md /data/DOOM1.WAD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unlimitedbacon/TTGO-DOOM/HEAD/data/DOOM1.WAD -------------------------------------------------------------------------------- /data/prboom.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unlimitedbacon/TTGO-DOOM/HEAD/data/prboom.wad -------------------------------------------------------------------------------- /src/main.h: -------------------------------------------------------------------------------- 1 | #include "ttgo-config.h" 2 | #include 3 | 4 | extern TTGOClass *ttgo; -------------------------------------------------------------------------------- /src/prboom/r_draw.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unlimitedbacon/TTGO-DOOM/HEAD/src/prboom/r_draw.c -------------------------------------------------------------------------------- /src/prboom-wad-tables/GAMMATBL.h: -------------------------------------------------------------------------------- 1 | extern const unsigned char GAMMATBL_dat[]; 2 | extern unsigned int GAMMATBL_dat_len; 3 | -------------------------------------------------------------------------------- /src/prboom-wad-tables/SINETABL.h: -------------------------------------------------------------------------------- 1 | extern const unsigned char SINETABL_dat[]; 2 | extern unsigned int SINETABL_dat_len; 3 | -------------------------------------------------------------------------------- /src/prboom-wad-tables/TANGTABL.h: -------------------------------------------------------------------------------- 1 | extern const unsigned char TANGTABL_dat[]; 2 | extern unsigned int TANGTABL_dat_len; 3 | -------------------------------------------------------------------------------- /src/prboom-wad-tables/TANTOANG.h: -------------------------------------------------------------------------------- 1 | extern const unsigned char TANTOANG_dat[]; 2 | extern unsigned int TANTOANG_dat_len; 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /src/prboom-wad-tables/GAMMATBL.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unlimitedbacon/TTGO-DOOM/HEAD/src/prboom-wad-tables/GAMMATBL.dat -------------------------------------------------------------------------------- /src/prboom-wad-tables/SINETABL.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unlimitedbacon/TTGO-DOOM/HEAD/src/prboom-wad-tables/SINETABL.dat -------------------------------------------------------------------------------- /src/prboom-wad-tables/TANGTABL.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unlimitedbacon/TTGO-DOOM/HEAD/src/prboom-wad-tables/TANGTABL.dat -------------------------------------------------------------------------------- /src/prboom-wad-tables/TANTOANG.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unlimitedbacon/TTGO-DOOM/HEAD/src/prboom-wad-tables/TANTOANG.dat -------------------------------------------------------------------------------- /src/prboom-wad-tables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT_SRCDIRS .) 2 | set(COMPONENT_ADD_INCLUDEDIRS . include) 3 | 4 | register_component() 5 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/gamepad.h: -------------------------------------------------------------------------------- 1 | #ifndef GAMEPAD_H 2 | #define GAMEPAD_H 3 | 4 | void gamepadInit(void); 5 | void gamepadPoll(void); 6 | 7 | 8 | #endif -------------------------------------------------------------------------------- /src/prboom-esp32-compat/psxcontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef PSXCONTROLLER_H 2 | #define PSXCONTROLLER_H 3 | 4 | //#define PSXJ_ 5 | 6 | int psxReadInput(); 7 | void psxcontrollerInit(); 8 | 9 | #endif -------------------------------------------------------------------------------- /src/prboom/p_checksum.h: -------------------------------------------------------------------------------- 1 | extern void (*P_Checksum)(int); 2 | extern void P_ChecksumFinal(void); 3 | void P_RecordChecksum(const char *file); 4 | //void P_VerifyChecksum(const char *file); 5 | -------------------------------------------------------------------------------- /partitions.csv: -------------------------------------------------------------------------------- 1 | # Espressif ESP32 Partition Table 2 | # Name, Type, SubType, Offset, Size 3 | factory, app, factory, 0x10000, 1024k 4 | wifidata, data, nvs, 0x110000, 16K 5 | prboom, 77, 7, 0x120000, 512k 6 | doom, 66, 6, 0x1A0000, 14720k 7 | -------------------------------------------------------------------------------- /src/ttgo-config.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONFIG_H 2 | #define _CONFIG_H 3 | 4 | #define LILYGO_WATCH_2020_V1 //To use T-Watch2020, please uncomment this line 5 | #define LILYGO_WATCH_LVGL //To use LVGL, you need to enable the macro LVGL 6 | #define TWATCH_USE_PSRAM_ALLOC_LVGL 7 | #include 8 | 9 | #endif // _CONFIG_H -------------------------------------------------------------------------------- /flashwad.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | esptool.py --chip esp32 --port $1 --baud 230400 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x120000 data/prboom.wad 3 | esptool.py --chip esp32 --port $1 --baud 230400 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x1A0000 data/DOOM1.WAD 4 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # set(COMPONENT_REQUIRES spi_flash) 2 | 3 | 4 | idf_component_register(SRCS 5 | gamepad.c 6 | i_main.c 7 | i_network.c 8 | i_sound.c 9 | i_system.c 10 | i_video.c 11 | include 12 | mcp23017.c 13 | psxcontroller.c 14 | spi_lcd.c 15 | INCLUDE_DIRS "." "include" "../prboom/include" "../mcp23x17" 16 | PRIV_REQUIRES spiffs vfs fatfs prboom mcp23x17 prboom-wad-tables) 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the SDK documents if you need to do this. 8 | # 9 | 10 | include $(IDF_PATH)/make/component.mk 11 | 12 | -------------------------------------------------------------------------------- /src/prboom-wad-tables/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the SDK documents if you need to do this. 8 | # 9 | 10 | include $(IDF_PATH)/make/component_common.mk 11 | 12 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the SDK documents if you need to do this. 8 | # 9 | 10 | 11 | 12 | include $(IDF_PATH)/make/component_common.mk 13 | 14 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /src/prboom/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "*.c") 2 | 3 | idf_component_register(SRC_DIRS "." 4 | PRIV_INCLUDE_DIRS "." "include" "../prboom-wad-tables/include") 5 | 6 | 7 | 8 | set(CMAKE_C_FLAGS "-Wno-error -mlongcalls -Wno-pointer-sign -Wno-maybe-uninitialized -Wno-parentheses -Wno-unused-value -Wno-unused-variable -Wno-unused-but-set-parameter -Wno-nonnull -Wno-implicit-function-declaration -Wno-misleading-indentation -Wno-format-overflow -Wno-unused-const-variable -Wno-sizeof-pointer-div -Wno-duplicate-decl-specifier -Wno-dangling-else") 9 | -------------------------------------------------------------------------------- /src/prboom/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the SDK documents if you need to do this. 8 | # 9 | 10 | include $(IDF_PATH)/make/component.mk 11 | 12 | 13 | CFLAGS += -Wno-error=char-subscripts -Wno-error=unused-value -Wno-error=parentheses -Wno-error=int-to-pointer-cast -Wno-pointer-sign \ 14 | -Wno-unused-but-set-variable -Wno-maybe-uninitialized -------------------------------------------------------------------------------- /src/prboom/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | # This Makefile should, at the very least, just include $(SDK_PATH)/make/component.mk. By default, 5 | # this will take the sources in the src/ directory, compile them and link them into 6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, 7 | # please read the SDK documents if you need to do this. 8 | # 9 | 10 | include $(IDF_PATH)/make/component_common.mk 11 | 12 | 13 | CFLAGS += -Wno-error=char-subscripts -Wno-error=unused-value -Wno-error=parentheses -Wno-error=int-to-pointer-cast -Wno-pointer-sign \ 14 | -Wno-error=unused-but-set-parameter -Wno-error=maybe-uninitialized 15 | 16 | CFLAGS += -Wno-dangling-else 17 | 18 | -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:ttgo-t-watch] 12 | platform = espressif32 13 | board = ttgo-t-watch 14 | framework = arduino 15 | monitor_speed = 115200 16 | board_build.partitions = partitions.csv 17 | monitor_filters = 18 | default 19 | esp32_exception_decoder 20 | build_flags = 21 | -DCORE_DEBUG_LEVEL=4 22 | -DBOARD_HAS_PSRAM 23 | -mfix-esp32-psram-cache-issue 24 | 25 | -D CONFIG_SPIRAM_USE_MALLOC=1 26 | 27 | lib_deps = xinyuan-lilygo/TTGO TWatch Library@^1.4.1 28 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/mcp23017.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2017 NoName Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #ifndef MCPCONTROLLER_H 17 | #define MCPCONTROLLER_H 18 | 19 | 20 | int keybReadInput(); 21 | 22 | void keybControllerInit(); 23 | 24 | #endif 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/ttgo_c.h: -------------------------------------------------------------------------------- 1 | #ifndef TTGO_C_H 2 | #define TTGO_C_H 3 | 4 | /* 5 | typedef enum { 6 | FOCALTECH_NO_GESTRUE, 7 | FOCALTECH_MOVE_UP, 8 | FOCALTECH_MOVE_LEFT, 9 | FOCALTECH_MOVE_DOWN, 10 | FOCALTECH_MOVE_RIGHT, 11 | FOCALTECH_ZOOM_IN, 12 | FOCALTECH_ZOOM_OUT, 13 | } GesTrue_t; 14 | */ 15 | 16 | #ifdef __cplusplus 17 | #define EXTERNC extern "C" 18 | #else 19 | #define EXTERNC 20 | #endif 21 | 22 | EXTERNC bool ttgo_touched(); 23 | EXTERNC bool ttgo_touch_get_point(uint16_t* x, uint16_t* y); 24 | //EXTERNC GesTrue_t ttgo_get_gesture(); 25 | //EXTERNC int ttgo_touch_get_vendor_id(); 26 | EXTERNC bool ttgo_power_readirq(); 27 | EXTERNC bool ttgo_power_clearirq(); 28 | EXTERNC bool ttgo_pek_short_press(); 29 | EXTERNC bool ttgo_accel_init(); 30 | EXTERNC bool ttgo_get_accel(int16_t* x, int16_t* y, int16_t* z); 31 | 32 | #undef EXTERNC 33 | 34 | #endif -------------------------------------------------------------------------------- /src/prboom/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link them to executable files. 4 | 5 | The source code of each library should be placed in separate directories, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see the structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- readme.txt --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | Then in `src/main.c` you should use: 31 | 32 | #include 33 | #include 34 | 35 | // rest H/C/CPP code 36 | 37 | PlatformIO will find your libraries automatically, configure preprocessor's 38 | include paths and build them. 39 | 40 | More information about PlatformIO Library Dependency Finder 41 | - https://docs.platformio.org/page/librarymanager/ldf.html 42 | -------------------------------------------------------------------------------- /lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/spi_lcd.h: -------------------------------------------------------------------------------- 1 | #define ST77XX_NOP 0x00 2 | #define ST77XX_SWRESET 0x01 3 | #define ST77XX_RDDID 0x04 4 | #define ST77XX_RDDST 0x09 5 | #define ST77XX_RDDPM 0x0A 6 | #define ST77XX_RDDMADCTL 0x0B 7 | #define ST77XX_RDDCOLMOD 0x0C 8 | #define ST77XX_RDDIM 0x0D 9 | 10 | #define ST77XX_SLPIN 0x10 11 | #define ST77XX_SLPOUT 0x11 12 | #define ST77XX_PTLON 0x12 13 | #define ST77XX_NORON 0x13 14 | 15 | #define ST77XX_INVOFF 0x20 16 | #define ST77XX_INVON 0x21 17 | #define ST77XX_DISPOFF 0x28 18 | #define ST77XX_DISPON 0x29 19 | #define ST77XX_CASET 0x2A 20 | #define ST77XX_RASET 0x2B 21 | #define ST77XX_RAMWR 0x2C 22 | #define ST77XX_RAMRD 0x2E 23 | 24 | #define ST77XX_PTLAR 0x30 25 | #define ST77XX_COLMOD 0x3A 26 | #define ST77XX_MADCTL 0x36 27 | 28 | #define ST77XX_MADCTL_MY 0x80 29 | #define ST77XX_MADCTL_MX 0x40 30 | #define ST77XX_MADCTL_MV 0x20 31 | #define ST77XX_MADCTL_ML 0x10 32 | #define ST77XX_MADCTL_RGB 0x00 33 | 34 | #define ST77XX_RDID1 0xDA 35 | #define ST77XX_RDID2 0xDB 36 | #define ST77XX_RDID3 0xDC 37 | #define ST77XX_RDID4 0xDD 38 | 39 | void spi_lcd_wait_finish(); 40 | void spi_lcd_send(uint16_t *scr); 41 | void spi_lcd_init(); 42 | -------------------------------------------------------------------------------- /include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /src/prboom/version.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Date stamp 31 | * 32 | *----------------------------------------------------------------------------- 33 | */ 34 | 35 | 36 | #include "version.h" 37 | 38 | const char version_date[] = __DATE__; 39 | -------------------------------------------------------------------------------- /src/prboom/version.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Doom version indicators. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __DOOMVERSION__ 36 | #define __DOOMVERSION__ 37 | 38 | extern const char version_date[]; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/prboom/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is the header file for the MD5 message-digest algorithm. 3 | * The algorithm is due to Ron Rivest. This code was 4 | * written by Colin Plumb in 1993, no copyright is claimed. 5 | * This code is in the public domain; do with it what you wish. 6 | * 7 | * Equivalent code is available from RSA Data Security, Inc. 8 | * This code has been tested against that, and is equivalent, 9 | * except that you don't need to include two pages of legalese 10 | * with every copy. 11 | * 12 | * To compute the message digest of a chunk of bytes, declare an 13 | * MD5Context structure, pass it to MD5Init, call MD5Update as 14 | * needed on buffers full of bytes, and then call MD5Final, which 15 | * will fill a supplied 16-byte array with the digest. 16 | * 17 | * Changed so as no longer to depend on Colin Plumb's `usual.h' 18 | * header definitions; now uses stuff from dpkg's config.h 19 | * - Ian Jackson . 20 | * Still in the public domain. 21 | */ 22 | 23 | #ifndef MD5_H 24 | #define MD5_H 25 | 26 | #ifdef _MSC_VER 27 | #define WIN32_LEAN_AND_MEAN 28 | #include 29 | #define UWORD32 DWORD 30 | #else 31 | #include 32 | #define UWORD32 uint32_t 33 | #endif 34 | #define md5byte unsigned char 35 | 36 | struct MD5Context { 37 | UWORD32 buf[4]; 38 | UWORD32 bytes[2]; 39 | UWORD32 in[16]; 40 | }; 41 | 42 | void MD5Init(struct MD5Context *context); 43 | void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len); 44 | void MD5Final(unsigned char digest[16], struct MD5Context *context); 45 | void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]); 46 | 47 | #endif /* !MD5_H */ 48 | -------------------------------------------------------------------------------- /src/prboom/doomdef.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * DoomDef - basic defines for DOOM, e.g. Version, game mode 31 | * and skill level, and display parameters. 32 | * 33 | *----------------------------------------------------------------------------- 34 | */ 35 | 36 | #ifdef __GNUG__ 37 | #pragma implementation "doomdef.h" 38 | #endif 39 | 40 | #include "doomdef.h" 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/prboom/f_wipe.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Mission start screen wipe/melt, special effects. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __F_WIPE_H__ 35 | #define __F_WIPE_H__ 36 | 37 | /* 38 | * SCREEN WIPE PACKAGE 39 | */ 40 | 41 | int wipe_ScreenWipe (int ticks); 42 | int wipe_StartScreen(void); 43 | int wipe_EndScreen (void); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/prboom/i_main.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * General system functions. Signal related stuff, exit function 31 | * prototypes, and programmable Doom clock. 32 | * 33 | *----------------------------------------------------------------------------- 34 | */ 35 | 36 | #ifndef __I_MAIN__ 37 | #define __I_MAIN__ 38 | 39 | void I_Init(void); 40 | void I_SafeExit(int rc); 41 | 42 | extern int (*I_GetTime)(void); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/prboom/r_segs.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Refresh module, drawing LineSegs from BSP. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __R_SEGS__ 35 | #define __R_SEGS__ 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2); 42 | void R_StoreWallRange(const int start, const int stop); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/prboom/i_joy.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Joystick interface. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | extern int joybfire; 35 | extern int joybstrafe; 36 | extern int joybuse; 37 | extern int joybspeed; 38 | 39 | extern int joyleft; 40 | extern int joyright; 41 | extern int joyup; 42 | extern int joydown; 43 | 44 | extern int usejoystick; 45 | 46 | void I_InitJoystick(void); 47 | void I_PollJoystick(void); 48 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/ttgo_c.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /* 4 | * This is a simple wrapper for the C++ library functions 5 | * so they can be used in the DOOM engine, written in C. 6 | */ 7 | 8 | extern "C" bool ttgo_touched() { 9 | return ttgo->touched(); 10 | } 11 | 12 | extern "C" bool ttgo_touch_get_point(uint16_t* x, uint16_t* y) { 13 | //return ttgo->touch->getPoint(*x, *y); 14 | //return ttgo->getTouch(*x,*y); 15 | if (ttgo->touched()) 16 | { 17 | ttgo->touch->getPoint(*x,*y); 18 | return true; 19 | } else { 20 | return false; 21 | } 22 | 23 | } 24 | 25 | /* 26 | extern "C" GesTrue_t ttgo_get_gesture() { 27 | return ttgo->touch->getGesture(); 28 | } 29 | */ 30 | 31 | /* 32 | extern "C" int ttgo_touch_get_vendor_id() { 33 | return ttgo->touch->getVendorID(); 34 | } 35 | */ 36 | 37 | extern "C" void ttgo_power_readirq() 38 | { 39 | ttgo->power->readIRQ(); 40 | } 41 | 42 | extern "C" void ttgo_power_clearirq() 43 | { 44 | ttgo->power->clearIRQ(); 45 | } 46 | 47 | /* 48 | bool ttgo_pek_rising() 49 | { 50 | ttgo->power->rising 51 | } 52 | */ 53 | 54 | extern "C" bool ttgo_pek_short_press() { 55 | return ttgo->power->isPEKShortPressIRQ(); 56 | } 57 | 58 | extern "C" bool ttgo_accel_init() { 59 | Acfg cfg; 60 | cfg.odr = BMA4_OUTPUT_DATA_RATE_100HZ; 61 | cfg.range = BMA4_ACCEL_RANGE_2G; 62 | cfg.bandwidth = BMA4_ACCEL_NORMAL_AVG4; 63 | cfg.perf_mode = BMA4_CONTINUOUS_MODE; 64 | bool r = ttgo->bma->accelConfig(cfg); 65 | bool s = ttgo->bma->enableAccel(); 66 | return (r && s); 67 | } 68 | 69 | extern "C" bool ttgo_get_accel(int16_t* x, int16_t* y, int16_t* z) { 70 | Accel acc; 71 | bool ret = ttgo->bma->getAccel(acc); 72 | *x = acc.x; 73 | *y = acc.y; 74 | *z = acc.z; 75 | return ret; 76 | } 77 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "main.h" 4 | 5 | #include "sdkconfig.h" 6 | 7 | #include "esp_attr.h" 8 | 9 | #include "rom/cache.h" 10 | #include "rom/ets_sys.h" 11 | #include "rom/spi_flash.h" 12 | #include "rom/crc.h" 13 | 14 | #include "soc/soc.h" 15 | #include "soc/dport_reg.h" 16 | #include "soc/io_mux_reg.h" 17 | #include "soc/efuse_reg.h" 18 | #include "soc/rtc_cntl_reg.h" 19 | #include 20 | #include "freertos/FreeRTOS.h" 21 | #include "freertos/task.h" 22 | #include 23 | #include "esp_err.h" 24 | #include "nvs_flash.h" 25 | #include "esp_task_wdt.h" 26 | // #include "esp_partition.h" 27 | 28 | extern "C" { 29 | #include "prboom/i_system.h" 30 | #include "prboom-esp32-compat/spi_lcd.h" 31 | #include "prboom-esp32-compat/gamepad.h" 32 | } 33 | 34 | extern "C" void jsInit(); 35 | 36 | void doomEngineTask(void *pvParameters) 37 | { 38 | char const *argv[]={"doom","-cout","ICWEFDA", NULL}; 39 | doom_main(3, argv); 40 | } 41 | 42 | //#include "ttgo-config.h" 43 | //#include 44 | 45 | TTGOClass *ttgo; 46 | 47 | void setup() { 48 | ttgo = TTGOClass::getWatch(); 49 | ttgo->begin(); 50 | ttgo->openBL(); 51 | ttgo->enableLDO3(); 52 | 53 | ttgo->power->enableIRQ(AXP202_PEK_SHORTPRESS_IRQ, true); 54 | ttgo->power->clearIRQ(); 55 | 56 | // put your setup code here, to run once: 57 | //int i; 58 | //const esp_partition_t* part; 59 | //spi_flash_mmap_handle_t hdoomwad; 60 | //esp_err_t err; 61 | 62 | //part=esp_partition_find_first(66, 6, NULL); 63 | //if (part==0) printf("Couldn't find wad part!\n"); 64 | 65 | spi_lcd_init(); 66 | jsInit(); 67 | TaskHandle_t task; 68 | xTaskCreatePinnedToCore(&doomEngineTask, "doomEngine", 22480, NULL, 5, &task, 0); 69 | //esp_task_wdt_add(task); 70 | } 71 | 72 | void loop() { 73 | // put your main code here, to run repeatedly: 74 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < https://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < https://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < https://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choose one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # - platformio update 39 | # 40 | # script: 41 | # - platformio run 42 | 43 | 44 | # 45 | # Template #2: The project is intended to be used as a library with examples. 46 | # 47 | 48 | # language: python 49 | # python: 50 | # - "2.7" 51 | # 52 | # sudo: false 53 | # cache: 54 | # directories: 55 | # - "~/.platformio" 56 | # 57 | # env: 58 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 59 | # - PLATFORMIO_CI_SRC=examples/file.ino 60 | # - PLATFORMIO_CI_SRC=path/to/test/directory 61 | # 62 | # install: 63 | # - pip install -U platformio 64 | # - platformio update 65 | # 66 | # script: 67 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 68 | -------------------------------------------------------------------------------- /src/prboom/m_argv.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Argument handling. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __M_ARGV__ 36 | #define __M_ARGV__ 37 | 38 | /* 39 | * MISC 40 | */ 41 | extern int myargc; 42 | extern char const * const * myargv; /* CPhipps - const * const * */ 43 | 44 | /* Returns the position of the given parameter in the arg list (0 if not found). */ 45 | int M_CheckParm(const char *check); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/prboom/r_demo.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Demo stuff 31 | * 32 | *--------------------------------------------------------------------- 33 | */ 34 | 35 | #include "doomstat.h" 36 | 37 | #define SMOOTH_PLAYING_MAXFACTOR 16 38 | 39 | extern int demo_smoothturns; 40 | extern int demo_smoothturnsfactor; 41 | 42 | void R_SmoothPlaying_Reset(player_t *player); 43 | void R_SmoothPlaying_Add(int delta); 44 | angle_t R_SmoothPlaying_Get(angle_t defangle); 45 | void R_ResetAfterTeleport(player_t *player); 46 | -------------------------------------------------------------------------------- /src/prboom/p_user.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Player related stuff. 31 | * Bobbing POV/weapon, movement. 32 | * Pending weapon. 33 | * 34 | *-----------------------------------------------------------------------------*/ 35 | 36 | #ifndef __P_USER__ 37 | #define __P_USER__ 38 | 39 | #include "d_player.h" 40 | 41 | void P_PlayerThink(player_t *player); 42 | void P_CalcHeight(player_t *player); 43 | void P_DeathThink(player_t *player); 44 | void P_MovePlayer(player_t *player); 45 | void P_Thrust(player_t *player, angle_t angle, fixed_t move); 46 | 47 | #endif /* __P_USER__ */ 48 | -------------------------------------------------------------------------------- /src/prboom/f_finale.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Related to f_finale.c, which is called at the end of a level 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __F_FINALE__ 36 | #define __F_FINALE__ 37 | 38 | #include "doomtype.h" 39 | #include "d_event.h" 40 | 41 | /* 42 | * FINALE 43 | */ 44 | 45 | /* Called by main loop. */ 46 | boolean F_Responder (event_t* ev); 47 | 48 | /* Called by main loop. */ 49 | void F_Ticker (void); 50 | 51 | /* Called by main loop. */ 52 | void F_Drawer (void); 53 | 54 | void F_StartFinale (void); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/prboom/m_bbox.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Simple bounding box datatype and functions. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __M_BBOX__ 36 | #define __M_BBOX__ 37 | 38 | #include 39 | #include "m_fixed.h" 40 | 41 | /* Bounding box coordinate storage. */ 42 | enum 43 | { 44 | BOXTOP, 45 | BOXBOTTOM, 46 | BOXLEFT, 47 | BOXRIGHT 48 | }; /* bbox coordinates */ 49 | 50 | /* Bounding box functions. */ 51 | 52 | void M_ClearBox(fixed_t* box); 53 | 54 | void M_AddToBox(fixed_t* box,fixed_t x,fixed_t y); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/prboom/r_sky.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Sky rendering. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __R_SKY__ 35 | #define __R_SKY__ 36 | 37 | #include "m_fixed.h" 38 | 39 | #ifdef __GNUG__ 40 | #pragma interface 41 | #endif 42 | 43 | /* SKY, store the number for name. */ 44 | #define SKYFLATNAME "F_SKY1" 45 | 46 | /* The sky map is 256*128*4 maps. */ 47 | #define ANGLETOSKYSHIFT 22 48 | 49 | extern int skytexture; 50 | extern int skytexturemid; 51 | 52 | /* Called whenever the view size changes. */ 53 | void R_InitSkyMap(void); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/prboom/d_items.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Items: key cards, artifacts, weapon, ammunition. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __D_ITEMS__ 36 | #define __D_ITEMS__ 37 | 38 | #include "doomdef.h" 39 | 40 | #ifdef __GNUG__ 41 | #pragma interface 42 | #endif 43 | 44 | 45 | /* Weapon info: sprite frames, ammunition use. */ 46 | typedef struct 47 | { 48 | ammotype_t ammo; 49 | int upstate; 50 | int downstate; 51 | int readystate; 52 | int atkstate; 53 | int flashstate; 54 | 55 | } weaponinfo_t; 56 | 57 | extern weaponinfo_t weaponinfo[NUMWEAPONS]; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/prboom/r_sky.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Sky rendering. The DOOM sky is a texture map like any 31 | * wall, wrapping around. A 1024 columns equal 360 degrees. 32 | * The default sky map is 256 columns and repeats 4 times 33 | * on a 320 screen? 34 | * 35 | *-----------------------------------------------------------------------------*/ 36 | 37 | #ifdef __GNUG__ 38 | #pragma implementation "r_sky.h" 39 | #endif 40 | #include "r_sky.h" 41 | 42 | // 43 | // sky mapping 44 | // 45 | int skyflatnum; 46 | int skytexture; 47 | int skytexturemid; 48 | 49 | // 50 | // R_InitSkyMap 51 | // Called whenever the view size changes. 52 | // 53 | void R_InitSkyMap (void) 54 | { 55 | skytexturemid = 100*FRACUNIT; 56 | } 57 | -------------------------------------------------------------------------------- /src/prboom/m_cheat.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Cheat code checking. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __M_CHEAT__ 35 | #define __M_CHEAT__ 36 | 37 | /* killough 4/16/98: Cheat table structure */ 38 | 39 | extern struct cheat_s { 40 | const char * cheat; 41 | const char *const deh_cheat; 42 | enum { 43 | always = 0, 44 | not_dm = 1, 45 | not_coop = 2, 46 | not_demo = 4, 47 | not_menu = 8, 48 | not_deh = 16, 49 | not_net = not_dm | not_coop 50 | } const when; 51 | void (*const func)(); 52 | const int arg; 53 | uint_64_t code, mask; 54 | } cheat[]; 55 | 56 | boolean M_FindCheats(int key); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/prboom/m_bbox.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Main loop menu stuff. 31 | * Random number LUT. 32 | * Default Config File. 33 | * PCX Screenshots. 34 | * 35 | *-----------------------------------------------------------------------------*/ 36 | 37 | #ifdef __GNUG__ 38 | #pragma implementation "m_bbox.h" 39 | #endif 40 | #include "m_bbox.h" 41 | 42 | void M_ClearBox (fixed_t *box) 43 | { 44 | box[BOXTOP] = box[BOXRIGHT] = INT_MIN; 45 | box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX; 46 | } 47 | 48 | void M_AddToBox(fixed_t* box,fixed_t x,fixed_t y) 49 | { 50 | if (xbox[BOXRIGHT]) 53 | box[BOXRIGHT] = x; 54 | if (ybox[BOXTOP]) 57 | box[BOXTOP] = y; 58 | } 59 | -------------------------------------------------------------------------------- /src/prboom/wi_stuff.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Intermission screens. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __WI_STUFF__ 35 | #define __WI_STUFF__ 36 | 37 | //#include "v_video.h" 38 | 39 | #include "doomdef.h" 40 | 41 | // States for the intermission 42 | 43 | typedef enum 44 | { 45 | NoState = -1, 46 | StatCount, 47 | ShowNextLoc 48 | 49 | } stateenum_t; 50 | 51 | // Called by main loop, animate the intermission. 52 | void WI_Ticker (void); 53 | 54 | // Called by main loop, 55 | // draws the intermission directly into the screen buffer. 56 | void WI_Drawer (void); 57 | 58 | // Setup for an intermission screen. 59 | void WI_Start(wbstartstruct_t* wbstartstruct); 60 | 61 | // Release intermission screen memory 62 | void WI_End(void); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/prboom/m_argv.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Some argument handling. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #include 35 | // CPhipps - include the correct header 36 | #include "doomtype.h" 37 | #include "m_argv.h" 38 | 39 | int myargc; 40 | const char * const * myargv; // CPhipps - not sure if ANSI C allows you to 41 | // modify contents of argv, but I can't imagine it does. 42 | 43 | // 44 | // M_CheckParm 45 | // Checks for the given parameter 46 | // in the program's command line arguments. 47 | // Returns the argument number (1 to argc-1) 48 | // or 0 if not present 49 | // 50 | 51 | int M_CheckParm(const char *check) 52 | { 53 | signed int i = myargc; 54 | while (--i>0) 55 | if (!strcasecmp(check, myargv[i])) 56 | return i; 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /src/prboom/r_drawcolpipeline.inl: -------------------------------------------------------------------------------- 1 | 2 | // no color mapping 3 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_PointUV) 4 | #define R_DRAWCOLUMN_PIPELINE (R_DRAWCOLUMN_PIPELINE_BASE | RDC_NOCOLMAP) 5 | #include "r_drawcolumn.inl" 6 | 7 | // simple depth color mapping 8 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_PointUV_PointZ) 9 | #define R_DRAWCOLUMN_PIPELINE R_DRAWCOLUMN_PIPELINE_BASE 10 | #include "r_drawcolumn.inl" 11 | 12 | // z-dither 13 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_PointUV_LinearZ) 14 | #define R_DRAWCOLUMN_PIPELINE (R_DRAWCOLUMN_PIPELINE_BASE | RDC_DITHERZ) 15 | #include "r_drawcolumn.inl" 16 | 17 | // bilinear with no color mapping 18 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_LinearUV) 19 | #define R_DRAWCOLUMN_PIPELINE (R_DRAWCOLUMN_PIPELINE_BASE | RDC_BILINEAR | RDC_NOCOLMAP) 20 | #include "r_drawcolumn.inl" 21 | 22 | // bilinear with simple depth color mapping 23 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_LinearUV_PointZ) 24 | #define R_DRAWCOLUMN_PIPELINE (R_DRAWCOLUMN_PIPELINE_BASE | RDC_BILINEAR) 25 | #include "r_drawcolumn.inl" 26 | 27 | // bilinear + z-dither 28 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_LinearUV_LinearZ) 29 | #define R_DRAWCOLUMN_PIPELINE (R_DRAWCOLUMN_PIPELINE_BASE | RDC_BILINEAR | RDC_DITHERZ) 30 | #include "r_drawcolumn.inl" 31 | 32 | // rounded with no color mapping 33 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_RoundedUV) 34 | #define R_DRAWCOLUMN_PIPELINE (R_DRAWCOLUMN_PIPELINE_BASE | RDC_ROUNDED | RDC_NOCOLMAP) 35 | #include "r_drawcolumn.inl" 36 | 37 | // rounded with simple depth color mapping 38 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_RoundedUV_PointZ) 39 | #define R_DRAWCOLUMN_PIPELINE (R_DRAWCOLUMN_PIPELINE_BASE | RDC_ROUNDED) 40 | #include "r_drawcolumn.inl" 41 | 42 | // rounded + z-dither 43 | #define R_DRAWCOLUMN_FUNCNAME R_DRAWCOLUMN_FUNCNAME_COMPOSITE(_RoundedUV_LinearZ) 44 | #define R_DRAWCOLUMN_PIPELINE (R_DRAWCOLUMN_PIPELINE_BASE | RDC_ROUNDED | RDC_DITHERZ) 45 | #include "r_drawcolumn.inl" 46 | 47 | #undef R_FLUSHWHOLE_FUNCNAME 48 | #undef R_FLUSHHEADTAIL_FUNCNAME 49 | #undef R_FLUSHQUAD_FUNCNAME 50 | #undef R_DRAWCOLUMN_FUNCNAME_COMPOSITE 51 | #undef R_DRAWCOLUMN_PIPELINE_BITS 52 | -------------------------------------------------------------------------------- /src/prboom/d_ticcmd.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * System specific interface stuff. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __D_TICCMD__ 35 | #define __D_TICCMD__ 36 | 37 | #include "doomtype.h" 38 | 39 | #ifdef __GNUG__ 40 | #pragma interface 41 | #endif 42 | 43 | /* The data sampled per tick (single player) 44 | * and transmitted to other peers (multiplayer). 45 | * Mainly movements/button commands per game tick, 46 | * plus a checksum for internal state consistency. 47 | * CPhipps - explicitely signed the elements, since they have to be signed to work right 48 | */ 49 | typedef struct 50 | { 51 | signed char forwardmove; /* *2048 for move */ 52 | signed char sidemove; /* *2048 for move */ 53 | signed short angleturn; /* <<16 for angle delta */ 54 | short consistancy; /* checks for net game */ 55 | byte chatchar; 56 | byte buttons; 57 | } ticcmd_t; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/prboom/z_bmalloc.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Block memory allocator 31 | * This is designed to be a fast allocator for small, regularly used block sizes 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | struct block_memory_alloc_s { 35 | void *firstpool; 36 | size_t size; 37 | size_t perpool; 38 | int tag; 39 | const char *desc; 40 | }; 41 | 42 | #define DECLARE_BLOCK_MEMORY_ALLOC_ZONE(name) extern struct block_memory_alloc_s name 43 | #define IMPLEMENT_BLOCK_MEMORY_ALLOC_ZONE(name, size, tag, num, desc) \ 44 | struct block_memory_alloc_s name = { NULL, size, num, tag, desc} 45 | #define NULL_BLOCK_MEMORY_ALLOC_ZONE(name) name.firstpool = NULL 46 | 47 | void* Z_BMalloc(struct block_memory_alloc_s *pzone); 48 | 49 | inline static void* Z_BCalloc(struct block_memory_alloc_s *pzone) 50 | { void *p = Z_BMalloc(pzone); memset(p,0,pzone->size); return p; } 51 | 52 | void Z_BFree(struct block_memory_alloc_s *pzone, void* p); 53 | -------------------------------------------------------------------------------- /src/prboom/p_setup.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Setup a game, startup stuff. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __P_SETUP__ 35 | #define __P_SETUP__ 36 | 37 | #include "p_mobj.h" 38 | 39 | #ifdef __GNUG__ 40 | #pragma interface 41 | #endif 42 | 43 | void P_SetupLevel(int episode, int map, int playermask, skill_t skill); 44 | void P_Init(void); /* Called by startup code. */ 45 | 46 | extern const byte *rejectmatrix; /* for fast sight rejection - cph - const* */ 47 | 48 | /* killough 3/1/98: change blockmap from "short" to "long" offsets: */ 49 | extern long *blockmaplump; /* offsets in blockmap are from here */ 50 | extern long *blockmap; 51 | extern int bmapwidth; 52 | extern int bmapheight; /* in mapblocks */ 53 | extern fixed_t bmaporgx; 54 | extern fixed_t bmaporgy; /* origin of block map */ 55 | extern mobj_t **blocklinks; /* for thing chains */ 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/prboom/r_bsp.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Refresh module, BSP traversal and handling. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __R_BSP__ 35 | #define __R_BSP__ 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | extern seg_t *curline; 42 | extern side_t *sidedef; 43 | extern line_t *linedef; 44 | extern sector_t *frontsector; 45 | extern sector_t *backsector; 46 | 47 | /* old code -- killough: 48 | * extern drawseg_t drawsegs[MAXDRAWSEGS]; 49 | * new code -- killough: */ 50 | extern drawseg_t *drawsegs; 51 | extern unsigned maxdrawsegs; 52 | 53 | extern byte solidcol[MAX_SCREENWIDTH]; 54 | 55 | extern drawseg_t *ds_p; 56 | 57 | void R_ClearClipSegs(void); 58 | void R_ClearDrawSegs(void); 59 | void R_RenderBSPNode(int bspnum); 60 | 61 | /* killough 4/13/98: fake floors/ceilings for deep water / fake ceilings: */ 62 | sector_t *R_FakeFlat(sector_t *, sector_t *, int *, int *, boolean); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/prboom/gl_struct.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * 31 | *--------------------------------------------------------------------- 32 | */ 33 | 34 | #ifndef _GL_STRUCT_H 35 | #define _GL_STRUCT_H 36 | 37 | extern int nodesVersion; 38 | 39 | void gld_Init(int width, int height); 40 | void gld_InitCommandLine(); 41 | 42 | void gld_DrawNumPatch(int x, int y, int lump, int cm, enum patch_translation_e flags); 43 | void gld_DrawBackground(const char* name); 44 | void gld_DrawLine(int x0, int y0, int x1, int y1, int BaseColor); 45 | void gld_DrawWeapon(int weaponlump, vissprite_t *vis, int lightlevel); 46 | void gld_FillBlock(int x, int y, int width, int height, int col); 47 | void gld_SetPalette(int palette); 48 | 49 | unsigned char *gld_ReadScreen (void); 50 | 51 | void gld_CleanMemory(void); 52 | void gld_PreprocessLevel(void); 53 | 54 | void gld_Set2DMode(); 55 | void gld_InitDrawScene(void); 56 | void gld_StartDrawScene(void); 57 | void gld_AddPlane(int subsectornum, visplane_t *floor, visplane_t *ceiling); 58 | void gld_AddWall(seg_t *seg); 59 | void gld_AddSprite(vissprite_t *vspr); 60 | void gld_DrawScene(player_t *player); 61 | void gld_EndDrawScene(void); 62 | void gld_Finish(); 63 | 64 | #endif // _GL_STRUCT_H 65 | -------------------------------------------------------------------------------- /src/prboom/r_fps.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Uncapped framerate stuff 31 | * 32 | *--------------------------------------------------------------------- 33 | */ 34 | 35 | #ifndef __R_FPS__ 36 | #define __R_FPS__ 37 | 38 | #include "doomstat.h" 39 | 40 | extern int movement_smooth; 41 | 42 | typedef struct { 43 | fixed_t viewx; 44 | fixed_t viewy; 45 | fixed_t viewz; 46 | angle_t viewangle; 47 | angle_t viewpitch; 48 | } view_vars_t; 49 | 50 | extern view_vars_t original_view_vars; 51 | 52 | typedef struct { 53 | unsigned int start; 54 | unsigned int next; 55 | unsigned int step; 56 | fixed_t frac; 57 | float msec; 58 | } tic_vars_t; 59 | 60 | extern tic_vars_t tic_vars; 61 | 62 | void R_InitInterpolation(void); 63 | void R_InterpolateView (player_t *player, fixed_t frac); 64 | 65 | extern boolean WasRenderedInTryRunTics; 66 | 67 | void R_ResetViewInterpolation (); 68 | void R_UpdateInterpolations(); 69 | void R_StopAllInterpolations(void); 70 | void R_DoInterpolations(fixed_t smoothratio); 71 | void R_RestoreInterpolations(); 72 | void R_ActivateSectorInterpolations(); 73 | void R_ActivateThinkerInterpolations(thinker_t *th); 74 | void R_StopInterpolationIfNeeded(thinker_t *th); 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/prboom/r_plane.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Refresh, visplane stuff (floor, ceilings). 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __R_PLANE__ 35 | #define __R_PLANE__ 36 | 37 | #include "r_data.h" 38 | 39 | #ifdef __GNUG__ 40 | #pragma interface 41 | #endif 42 | 43 | /* killough 10/98: special mask indicates sky flat comes from sidedef */ 44 | #define PL_SKYFLAT (0x80000000) 45 | 46 | /* Visplane related. */ 47 | extern int *lastopening; // dropoff overflow 48 | 49 | extern int *floorclip, *ceilingclip; // dropoff overflow 50 | extern fixed_t *yslope/*[MAX_SCREENHEIGHT]*/, *distscale/*[MAX_SCREENWIDTH]*/; 51 | 52 | void R_InitPlanes(void); 53 | void R_ClearPlanes(void); 54 | void R_DrawPlanes (void); 55 | 56 | visplane_t *R_FindPlane( 57 | fixed_t height, 58 | int picnum, 59 | int lightlevel, 60 | fixed_t xoffs, /* killough 2/28/98: add x-y offsets */ 61 | fixed_t yoffs 62 | ); 63 | 64 | visplane_t *R_CheckPlane(visplane_t *pl, int start, int stop); 65 | visplane_t *R_DupPlane(const visplane_t *pl, int start, int stop); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/prboom/p_saveg.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Savegame I/O, archiving, persistence. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __P_SAVEG__ 35 | #define __P_SAVEG__ 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | /* Persistent storage/archiving. 42 | * These are the load / save game routines. */ 43 | void P_ArchivePlayers(void); 44 | void P_UnArchivePlayers(void); 45 | void P_ArchiveWorld(void); 46 | void P_UnArchiveWorld(void); 47 | void P_ArchiveThinkers(void); 48 | void P_UnArchiveThinkers(void); 49 | void P_ArchiveSpecials(void); 50 | void P_UnArchiveSpecials(void); 51 | void P_ThinkerToIndex(void); /* phares 9/13/98: save soundtarget in savegame */ 52 | void P_IndexToThinker(void); /* phares 9/13/98: save soundtarget in savegame */ 53 | 54 | /* 1/18/98 killough: add RNG info to savegame */ 55 | void P_ArchiveRNG(void); 56 | void P_UnArchiveRNG(void); 57 | 58 | /* 2/21/98 killough: add automap info to savegame */ 59 | void P_ArchiveMap(void); 60 | void P_UnArchiveMap(void); 61 | 62 | extern byte *save_p; 63 | void CheckSaveGame(size_t,const char*, int); /* killough */ 64 | #define CheckSaveGame(a) (CheckSaveGame)(a, __FILE__, __LINE__) 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TTGO-DOOM 2 | ========= 3 | 4 | This is a port of DOOM to the [LilyGO T-Watch](https://www.tindie.com/products/ttgo/lilygor-ttgo-t-watch-2020/), a cheap ESP32 based "smart" watch. I have only tried it on the T-Watch-2020, but it may work on other models. 5 | 6 | ![doomwatch](https://user-images.githubusercontent.com/3131268/92416444-5cfcd400-f112-11ea-84e7-c824d945da85.png) 7 | 8 | Building / Flashing 9 | ------------------- 10 | 11 | This is a [PlatformIO](https://platformio.org/) project. You can build it through the PlatformIO IDE (vscode) or from the command line using 12 | 13 | ``` 14 | pio run -t upload 15 | ``` 16 | 17 | After building and uploading the firmware, you will also need to upload the game data (WAD files). Run the `flashwad.sh` script. This requires [esptool](https://github.com/espressif/esptool) to be installed. You will need to specify the serial port the device is connected to, for instance `/dev/ttyUSB0`. 18 | 19 | ``` 20 | ./flashwad.sh /dev/ttyUSB0 21 | ``` 22 | 23 | I have included the WAD file for the shareware version of DOOM (`data/DOOM1.WAD`), but you can replace it with the WAD for a retail version if you have it. There is 14,720 Kb available for the WAD file. 24 | 25 | Controls 26 | -------- 27 | 28 | 29 | | Menu Controls | | 30 | | ------------------------ | ------------------- | 31 | | Side Button | Open/close the menu | 32 | | Swipe up/down/left/right | Navigate the menu | 33 | | Touch | Make a selection | 34 | 35 | | Game Controls | | 36 | | ----------------- | ------------------------- | 37 | | Tilt left/right | Turn left and right | 38 | | Tilt forward/back | Move forward and backward | 39 | | Tap | Shoot or use | 40 | 41 | TODO 42 | ---- 43 | - [x] Touchscreen gestures 44 | - [x] Accelerometer for movement control 45 | - [ ] Sound 46 | - [ ] Load WAD files from SPIFFS filesystem instead of reading data directly from flash partitions 47 | - [ ] Save / Load games 48 | - [ ] Run vibration motor when you get hit 49 | - [ ] Multiplayer using WiFi 50 | - [ ] Gamepad using bluetooth 51 | - [ ] Maybe show the time? 52 | 53 | Credits 54 | ------- 55 | * DOOM was released by iD software in 1999 under the Gnu GPL. 56 | * [PrBoom](http://prboom.sourceforge.net/) is a modification of this code; its authors are credited in the src/prboom/AUTHORS file. 57 | * [The ESP32 port](https://github.com/espressif/esp32-doom) was done by Espressif and is licensed under the Apache license, version 2.0. 58 | * Also uses code from [App-Z](https://github.com/app-z/esp32-doom) and [jkirsons](https://github.com/jkirsons/doom-espidf). 59 | -------------------------------------------------------------------------------- /src/prboom/lprintf.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Declarations etc. for logical console output 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __LPRINTF__ 35 | #define __LPRINTF__ 36 | 37 | typedef enum /* Logical output levels */ 38 | { 39 | LO_INFO=1, /* One of these is used in each physical output */ 40 | LO_CONFIRM=2, /* call. Which are output, or echoed to console */ 41 | LO_WARN=4, /* if output redirected is determined by the */ 42 | LO_ERROR=8, /* global masks: cons_output_mask,cons_error_mask. */ 43 | LO_FATAL=16, 44 | LO_DEBUG=32, 45 | LO_ALWAYS=64, 46 | } OutputLevels; 47 | 48 | #ifndef __GNUC__ 49 | #define __attribute__(x) 50 | #endif 51 | 52 | extern int lprintf(OutputLevels pri, const char *fmt, ...) __attribute__((format(printf,2,3))); 53 | 54 | extern int cons_output_mask; 55 | extern int cons_error_mask; 56 | 57 | /* killough 3/20/98: add const 58 | * killough 4/25/98: add gcc attributes 59 | * cphipps 01/11- moved from i_system.h */ 60 | void I_Error(const char *error, ...) __attribute__((format(printf,1,2))); 61 | 62 | #ifdef _WIN32 63 | void I_ConTextAttr(unsigned char a); 64 | void I_UpdateConsole(void); 65 | int Init_ConsoleWin(void); 66 | void Done_ConsoleWin(void); 67 | #endif 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/prboom/i_network.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Low level network interface. 31 | *-----------------------------------------------------------------------------*/ 32 | 33 | #ifdef HAVE_CONFIG_H 34 | #include "config.h" 35 | #endif 36 | 37 | #ifdef USE_SDL_NET 38 | #include "SDL_net.h" 39 | #define UDP_SOCKET UDPsocket 40 | #define UDP_PACKET UDPpacket 41 | #define AF_INET 42 | #define UDP_CHANNEL int 43 | extern UDP_SOCKET udp_socket; 44 | #else 45 | #define UDP_CHANNEL struct sockaddr 46 | #endif 47 | 48 | #ifndef IPPORT_RESERVED 49 | #define IPPORT_RESERVED 1024 50 | #endif 51 | 52 | void I_InitNetwork(void); 53 | size_t I_GetPacket(packet_header_t* buffer, size_t buflen); 54 | void I_SendPacket(packet_header_t* packet, size_t len); 55 | void I_WaitForPacket(int ms); 56 | 57 | #ifdef USE_SDL_NET 58 | UDP_SOCKET I_Socket(Uint16 port); 59 | int I_ConnectToServer(const char *serv); 60 | UDP_CHANNEL I_RegisterPlayer(IPaddress *ipaddr); 61 | void I_UnRegisterPlayer(UDP_CHANNEL channel); 62 | extern IPaddress sentfrom_addr; 63 | #endif 64 | 65 | #ifdef AF_INET 66 | void I_SendPacketTo(packet_header_t* packet, size_t len, UDP_CHANNEL *to); 67 | void I_SetupSocket(int sock, int port, int family); 68 | void I_PrintAddress(FILE* fp, UDP_CHANNEL *addr); 69 | 70 | extern UDP_CHANNEL sentfrom; 71 | extern int v4socket, v6socket; 72 | #endif 73 | 74 | extern size_t sentbytes, recvdbytes; 75 | -------------------------------------------------------------------------------- /src/prboom/p_tick.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000,2002 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Core thinker processing prototypes. 31 | *-----------------------------------------------------------------------------*/ 32 | 33 | #ifndef __P_TICK__ 34 | #define __P_TICK__ 35 | 36 | #include "d_think.h" 37 | 38 | #ifdef __GNUG__ 39 | #pragma interface 40 | #endif 41 | 42 | /* Called by C_Ticker, can call G_PlayerExited. 43 | * Carries out all thinking of monsters and players. */ 44 | 45 | void P_Ticker(void); 46 | 47 | void P_InitThinkers(void); 48 | void P_AddThinker(thinker_t *thinker); 49 | void P_RemoveThinker(thinker_t *thinker); 50 | void P_RemoveThinkerDelayed(thinker_t *thinker); // killough 4/25/98 51 | 52 | void P_UpdateThinker(thinker_t *thinker); // killough 8/29/98 53 | 54 | void P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98 55 | 56 | /* killough 8/29/98: threads of thinkers, for more efficient searches 57 | * cph 2002/01/13: for consistency with the main thinker list, keep objects 58 | * pending deletion on a class list too 59 | */ 60 | typedef enum { 61 | th_delete, 62 | th_misc, 63 | th_friends, 64 | th_enemies, 65 | NUMTHCLASS, 66 | th_all = NUMTHCLASS, /* For P_NextThinker, indicates "any class" */ 67 | } th_class; 68 | 69 | extern thinker_t thinkerclasscap[]; 70 | #define thinkercap thinkerclasscap[th_all] 71 | 72 | /* cph 2002/01/13 - iterator for thinker lists */ 73 | thinker_t* P_NextThinker(thinker_t*,th_class); 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/prboom/p_checksum.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include /* exit(), atexit() */ 5 | 6 | #include "p_checksum.h" 7 | #include "md5.h" 8 | #include "doomstat.h" /* players{,ingame} */ 9 | #include "lprintf.h" 10 | 11 | /* forward decls */ 12 | static void p_checksum_cleanup(void); 13 | void checksum_gamestate(int tic); 14 | 15 | /* vars */ 16 | static void p_checksum_nop(int tic){} /* do nothing */ 17 | void (*P_Checksum)(int) = p_checksum_nop; 18 | 19 | /* 20 | * P_RecordChecksum 21 | * sets up the file and function pointers to write out checksum data 22 | */ 23 | static FILE *outfile = NULL; 24 | static struct MD5Context md5global; 25 | 26 | void P_RecordChecksum(const char *file) { 27 | size_t fnsize; 28 | return; 29 | fnsize = strlen(file); 30 | 31 | /* special case: write to stdout */ 32 | if(0 == strncmp("-",file,MIN(1,fnsize))) 33 | outfile = stdout; 34 | else { 35 | outfile = fopen(file,"wb"); 36 | if(NULL == outfile) { 37 | I_Error("cannot open %s for writing checksum:\n%s\n", 38 | file, strerror(errno)); 39 | } 40 | atexit(p_checksum_cleanup); 41 | } 42 | 43 | MD5Init(&md5global); 44 | 45 | P_Checksum = checksum_gamestate; 46 | } 47 | 48 | void P_ChecksumFinal(void) { 49 | int i; 50 | unsigned char digest[16]; 51 | 52 | if (!outfile) 53 | return; 54 | 55 | MD5Final(digest, &md5global); 56 | fprintf(outfile, "final: "); 57 | for (i=0; i<16; i++) 58 | fprintf(outfile,"%x", digest[i]); 59 | fprintf(outfile, "\n"); 60 | MD5Init(&md5global); 61 | } 62 | 63 | static void p_checksum_cleanup(void) { 64 | if (outfile && (outfile != stdout)) 65 | fclose(outfile); 66 | } 67 | 68 | /* 69 | * runs on each tic when recording checksums 70 | */ 71 | void checksum_gamestate(int tic) { 72 | int i; 73 | struct MD5Context md5ctx; 74 | unsigned char digest[16]; 75 | char buffer[2048]; 76 | 77 | fprintf(outfile,"%6d, ", tic); 78 | 79 | /* based on "ArchivePlayers" */ 80 | MD5Init(&md5ctx); 81 | for (i=0 ; i 75 | 76 | extern const size_t NUM_QUITMESSAGES; /* Calculated in dstrings.c */ 77 | 78 | extern const char* const endmsg[]; /* killough 1/18/98 const added */ 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/prboom/r_things.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Rendering of moving objects, sprites. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __R_THINGS__ 35 | #define __R_THINGS__ 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | #include "r_draw.h" 42 | 43 | /* Constant arrays used for psprite clipping and initializing clipping. */ 44 | 45 | extern int negonearray[MAX_SCREENWIDTH]; /* killough 2/8/98: */ // dropoff overflow 46 | extern int screenheightarray[MAX_SCREENWIDTH]; /* change to MAX_* */ // dropoff overflow 47 | 48 | /* Vars for R_DrawMaskedColumn */ 49 | 50 | extern int *mfloorclip; // dropoff overflow 51 | extern int *mceilingclip; // dropoff overflow 52 | extern fixed_t spryscale; 53 | extern fixed_t sprtopscreen; 54 | extern fixed_t pspritescale; 55 | extern fixed_t pspriteiscale; 56 | /* proff 11/06/98: Added for high-res */ 57 | extern fixed_t pspriteyscale; 58 | 59 | void R_DrawMaskedColumn(const rpatch_t *patch, 60 | R_DrawColumn_f colfunc, 61 | draw_column_vars_t *dcvars, 62 | const rcolumn_t *column, 63 | const rcolumn_t *prevcolumn, 64 | const rcolumn_t *nextcolumn); 65 | void R_SortVisSprites(void); 66 | void R_AddSprites(subsector_t* subsec, int lightlevel); 67 | void R_DrawPlayerSprites(void); 68 | void R_InitSprites(const char * const * namelist); 69 | void R_ClearSprites(void); 70 | void R_DrawMasked(void); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/prboom/p_inter.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Thing events, and dehacked specified numbers controlling them. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __P_INTER__ 35 | #define __P_INTER__ 36 | 37 | #include "d_player.h" 38 | #include "p_mobj.h" 39 | 40 | #ifdef __GNUG__ 41 | #pragma interface 42 | #endif 43 | 44 | /* Ty 03/09/98 Moved to an int in p_inter.c for deh and externalization */ 45 | #define MAXHEALTH maxhealth 46 | 47 | /* follow a player exlusively for 3 seconds */ 48 | #define BASETHRESHOLD (100) 49 | 50 | boolean P_GivePower(player_t *, int); 51 | void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher); 52 | void P_DamageMobj(mobj_t *target,mobj_t *inflictor,mobj_t *source,int damage); 53 | 54 | /* killough 5/2/98: moved from d_deh.c, g_game.c, m_misc.c, others: */ 55 | 56 | extern int god_health; /* Ty 03/09/98 - deh support, see also p_inter.c */ 57 | extern int idfa_armor; 58 | extern int idfa_armor_class; 59 | extern int idkfa_armor; 60 | extern int idkfa_armor_class; /* Ty - end */ 61 | /* Ty 03/13/98 - externalized initial settings for respawned player */ 62 | extern int initial_health; 63 | extern int initial_bullets; 64 | extern int maxhealth; 65 | extern int max_armor; 66 | extern int green_armor_class; 67 | extern int blue_armor_class; 68 | extern int max_soul; 69 | extern int soul_health; 70 | extern int mega_health; 71 | extern int bfgcells; 72 | extern int monsters_infight; // e6y: Dehacked support - monsters infight 73 | extern int maxammo[], clipammo[]; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/prboom/d_main.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Main startup and splash screenstuff. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __D_MAIN__ 35 | #define __D_MAIN__ 36 | 37 | #include "d_event.h" 38 | #include "w_wad.h" 39 | 40 | #ifdef __GNUG__ 41 | #pragma interface 42 | #endif 43 | 44 | /* CPhipps - removed wadfiles[] stuff to w_wad.h */ 45 | 46 | extern char basesavegame[]; // killough 2/16/98: savegame path 47 | 48 | //jff 1/24/98 make command line copies of play modes available 49 | extern boolean clnomonsters; // checkparm of -nomonsters 50 | extern boolean clrespawnparm; // checkparm of -respawn 51 | extern boolean clfastparm; // checkparm of -fast 52 | //jff end of external declaration of command line playmode 53 | 54 | extern boolean nosfxparm; 55 | extern boolean nomusicparm; 56 | extern int ffmap; 57 | 58 | // Called by IO functions when input is detected. 59 | void D_PostEvent(event_t* ev); 60 | 61 | // Demo stuff 62 | extern boolean advancedemo; 63 | void D_AdvanceDemo(void); 64 | void D_DoAdvanceDemo (void); 65 | 66 | // 67 | // BASE LEVEL 68 | // 69 | 70 | void D_Display(void); 71 | void D_PageTicker(void); 72 | void D_StartTitle(void); 73 | void D_DoomMain(void); 74 | void D_AddFile (const char *file, wad_source_t source); 75 | 76 | /* cph - MBF-like wad/deh/bex autoload code */ 77 | /* proff 2001/7/1 - added prboom.wad as last entry so it's always loaded and 78 | doesn't overlap with the cfg settings */ 79 | #define MAXLOADFILES 3 80 | extern const char *wad_files[MAXLOADFILES], *deh_files[MAXLOADFILES]; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/prboom/i_video.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * System specific interface stuff. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __I_VIDEO__ 35 | #define __I_VIDEO__ 36 | 37 | #include "doomtype.h" 38 | #include "v_video.h" 39 | 40 | #ifdef __GNUG__ 41 | #pragma interface 42 | #endif 43 | 44 | void I_PreInitGraphics(void); /* CPhipps - do stuff immediately on start */ 45 | void I_CalculateRes(unsigned int width, unsigned int height); /* calculate resolution */ 46 | void I_SetRes(void); /* set resolution */ 47 | void I_InitGraphics (void); 48 | void I_UpdateVideoMode(void); 49 | void I_ShutdownGraphics(void); 50 | 51 | /* Takes full 8 bit values. */ 52 | void I_SetPalette(int pal); /* CPhipps - pass down palette number */ 53 | 54 | void I_UpdateNoBlit (void); 55 | void I_FinishUpdate (void); 56 | 57 | int I_ScreenShot (const char *fname); 58 | 59 | /* I_StartTic 60 | * Called by D_DoomLoop, 61 | * called before processing each tic in a frame. 62 | * Quick syncronous operations are performed here. 63 | * Can call D_PostEvent. 64 | */ 65 | void I_StartTic (void); 66 | 67 | /* I_StartFrame 68 | * Called by D_DoomLoop, 69 | * called before processing any tics in a frame 70 | * (just after displaying a frame). 71 | * Time consuming syncronous operations 72 | * are performed here (joystick reading). 73 | * Can call D_PostEvent. 74 | */ 75 | 76 | void I_StartFrame (void); 77 | 78 | extern int use_doublebuffer; /* proff 2001-7-4 - controls wether to use doublebuffering*/ 79 | extern int use_fullscreen; /* proff 21/05/2000 */ 80 | extern int desired_fullscreen; //e6y 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/prboom/mmus2mid.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * mmus2mid.c supports conversion of MUS format music in memory 31 | * to MIDI format 1 music in memory. 32 | */ 33 | 34 | #if !defined( MMUS2MID_H ) 35 | #define MMUS2MID_H 36 | 37 | // error codes 38 | 39 | typedef enum 40 | { 41 | MUSDATACOR, // MUS data corrupt 42 | TOOMCHAN, // Too many channels 43 | MEMALLOC, // Memory allocation error 44 | MUSDATAMT, // MUS file empty 45 | BADMUSCTL, // MUS event 5 or 7 found 46 | BADSYSEVT, // MUS system event not in 10-14 range 47 | BADCTLCHG, // MUS control change larger than 9 48 | TRACKOVF, // MIDI track exceeds allocation 49 | BADMIDHDR, // bad midi header detected 50 | } error_code_t; 51 | 52 | // some names for integers of various sizes, all unsigned 53 | typedef unsigned char UBYTE; // a one-byte int 54 | typedef unsigned short UWORD; // a two-byte int 55 | // proff: changed from unsigned int to unsigned long to avoid warning 56 | typedef unsigned long ULONG; // a four-byte int (assumes int 4 bytes) 57 | 58 | #ifndef MSDOS /* proff: This is from allegro.h */ 59 | #define MIDI_TRACKS 32 60 | 61 | typedef struct MIDI /* a midi file */ 62 | { 63 | int divisions; /* number of ticks per quarter note */ 64 | struct { 65 | unsigned char *data; /* MIDI message stream */ 66 | int len; /* length of the track data */ 67 | } track[MIDI_TRACKS]; 68 | } MIDI; 69 | #endif /* !MSDOS */ 70 | 71 | extern int mmus2mid(const UBYTE *mus,MIDI *mid, UWORD division, int nocomp); 72 | extern void free_mididata(MIDI *mid); 73 | extern int MIDIToMidi(MIDI *mididata,UBYTE **mid,int *midlen); 74 | extern int MidiToMIDI(UBYTE *mid,MIDI *mididata); 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/prboom/r_demo.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Demo stuff 31 | * 32 | *--------------------------------------------------------------------- 33 | */ 34 | 35 | #include "doomstat.h" 36 | #include "r_demo.h" 37 | #include "r_fps.h" 38 | 39 | int demo_smoothturns = false; 40 | int demo_smoothturnsfactor = 6; 41 | 42 | static int smooth_playing_turns[SMOOTH_PLAYING_MAXFACTOR]; 43 | static int_64_t smooth_playing_sum; 44 | static int smooth_playing_index; 45 | static angle_t smooth_playing_angle; 46 | 47 | void R_SmoothPlaying_Reset(player_t *player) 48 | { 49 | if (demo_smoothturns && demoplayback && players!=NULL) 50 | { 51 | if (player!=NULL) 52 | player = &players[displayplayer]; 53 | 54 | if (player==&players[displayplayer]) 55 | { 56 | smooth_playing_angle = players[displayplayer].mo->angle; 57 | memset(smooth_playing_turns, 0, sizeof(smooth_playing_turns[0]) * SMOOTH_PLAYING_MAXFACTOR); 58 | smooth_playing_sum = 0; 59 | smooth_playing_index = 0; 60 | } 61 | } 62 | } 63 | 64 | void R_SmoothPlaying_Add(int delta) 65 | { 66 | if (demo_smoothturns && demoplayback) 67 | { 68 | smooth_playing_sum -= smooth_playing_turns[smooth_playing_index]; 69 | smooth_playing_turns[smooth_playing_index] = delta; 70 | smooth_playing_index = (smooth_playing_index + 1)%(demo_smoothturnsfactor); 71 | smooth_playing_sum += delta; 72 | smooth_playing_angle += (int)(smooth_playing_sum/(demo_smoothturnsfactor)); 73 | } 74 | } 75 | 76 | angle_t R_SmoothPlaying_Get(angle_t defangle) 77 | { 78 | if (demo_smoothturns && demoplayback) 79 | return smooth_playing_angle; 80 | else 81 | return defangle; 82 | } 83 | 84 | void R_ResetAfterTeleport(player_t *player) 85 | { 86 | R_ResetViewInterpolation(); 87 | R_SmoothPlaying_Reset(player); 88 | } 89 | -------------------------------------------------------------------------------- /src/prboom/gl_intern.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * 31 | *--------------------------------------------------------------------- 32 | */ 33 | 34 | #ifndef _GL_INTERN_H 35 | #define _GL_INTERN_H 36 | 37 | typedef enum 38 | { 39 | GLDT_UNREGISTERED, 40 | GLDT_BROKEN, 41 | GLDT_PATCH, 42 | GLDT_TEXTURE, 43 | GLDT_FLAT 44 | } GLTexType; 45 | 46 | typedef struct 47 | { 48 | int index; 49 | int width,height; 50 | int leftoffset,topoffset; 51 | int tex_width,tex_height; 52 | int realtexwidth, realtexheight; 53 | int buffer_width,buffer_height; 54 | int buffer_size; 55 | int glTexID[CR_LIMIT+MAXPLAYERS]; 56 | GLTexType textype; 57 | boolean mipmap; 58 | } GLTexture; 59 | 60 | extern int gld_max_texturesize; 61 | extern char *gl_tex_format_string; 62 | extern int gl_tex_format; 63 | extern int gl_tex_filter; 64 | extern int gl_mipmap_filter; 65 | extern int gl_texture_filter_anisotropic; 66 | extern int gl_paletted_texture; 67 | extern int gl_shared_texture_palette; 68 | extern boolean use_mipmapping; 69 | extern int transparent_pal_index; 70 | extern unsigned char gld_palmap[256]; 71 | extern GLTexture *last_gltexture; 72 | extern int last_cm; 73 | 74 | //e6y: in some cases textures with a zero index (NO_TEXTURE) should be registered 75 | GLTexture *gld_RegisterTexture(int texture_num, boolean mipmap, boolean force); 76 | void gld_BindTexture(GLTexture *gltexture); 77 | GLTexture *gld_RegisterPatch(int lump, int cm); 78 | void gld_BindPatch(GLTexture *gltexture, int cm); 79 | GLTexture *gld_RegisterFlat(int lump, boolean mipmap); 80 | void gld_BindFlat(GLTexture *gltexture); 81 | void gld_InitPalettedTextures(void); 82 | int gld_GetTexDimension(int value); 83 | void gld_SetTexturePalette(GLenum target); 84 | void gld_Precache(void); 85 | 86 | PFNGLCOLORTABLEEXTPROC gld_ColorTableEXT; 87 | 88 | #endif // _GL_INTERN_H 89 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/gamepad.c: -------------------------------------------------------------------------------- 1 | // Copyright 2016-2017 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #include 17 | 18 | #include "prboom/doomdef.h" 19 | #include "prboom/doomtype.h" 20 | #include "prboom/m_argv.h" 21 | #include "prboom/d_event.h" 22 | #include "prboom/g_game.h" 23 | #include "prboom/d_main.h" 24 | #include "prboom/lprintf.h" 25 | 26 | #include "prboom-esp32-compat/gamepad.h" 27 | #include "prboom-esp32-compat/psxcontroller.h" 28 | #include "freertos/FreeRTOS.h" 29 | #include "freertos/task.h" 30 | 31 | 32 | //The gamepad uses keyboard emulation, but for compilation, these variables need to be placed 33 | //somewhere. THis is as good a place as any. 34 | int usejoystick=0; 35 | int joyleft, joyright, joyup, joydown; 36 | 37 | 38 | //atomic, for communication between joy thread and main game thread 39 | volatile int joyVal=0; 40 | 41 | typedef struct { 42 | int ps2mask; 43 | int *key; 44 | } JsKeyMap; 45 | 46 | //Mappings from PS2 buttons to keys 47 | static const JsKeyMap keymap[]={ 48 | {0x10, &key_up}, 49 | {0x40, &key_down}, 50 | {0x80, &key_left}, 51 | {0x20, &key_right}, 52 | 53 | {0x4000, &key_use}, //cross 54 | {0x2000, &key_fire}, //circle 55 | {0x2000, &key_menu_enter}, //circle 56 | {0x8000, &key_pause}, //square 57 | {0x1000, &key_weapontoggle}, //triangle 58 | 59 | {0x8, &key_escape}, //start 60 | {0x1, &key_map}, //select 61 | 62 | {0x400, &key_strafeleft}, //L1 63 | {0x100, &key_speed}, //L2 64 | {0x800, &key_straferight}, //R1 65 | {0x200, &key_strafe}, //R2 66 | 67 | {0, NULL}, 68 | }; 69 | 70 | 71 | void gamepadPoll(void) 72 | { 73 | static int oldPollJsVal=0xffff; 74 | int newJoyVal=joyVal; 75 | event_t ev; 76 | 77 | for (int i=0; keymap[i].key!=NULL; i++) { 78 | if ((oldPollJsVal^newJoyVal)&keymap[i].ps2mask) { 79 | ev.type=(newJoyVal&keymap[i].ps2mask)?ev_keyup:ev_keydown; 80 | ev.data1=*keymap[i].key; 81 | D_PostEvent(&ev); 82 | } 83 | } 84 | 85 | oldPollJsVal=newJoyVal; 86 | } 87 | 88 | 89 | void jsTask(void *arg) { 90 | int oldJoyVal=0xFFFF; 91 | printf("Joystick task starting.\n"); 92 | while(1) { 93 | vTaskDelay(20/portTICK_PERIOD_MS); 94 | joyVal=psxReadInput(); 95 | // if (joyVal!=oldJoyVal) printf("Joy: %x\n", joyVal^0xffff); 96 | oldJoyVal=joyVal; 97 | } 98 | } 99 | 100 | void gamepadInit(void) 101 | { 102 | lprintf(LO_INFO, "gamepadInit: Initializing game pad.\n"); 103 | } 104 | 105 | void jsInit() { 106 | //Starts the js task 107 | psxcontrollerInit(); 108 | //xTaskCreatePinnedToCore(&jsTask, "js", 5000, NULL, 7, NULL, 0); 109 | } 110 | 111 | -------------------------------------------------------------------------------- /src/prboom/d_think.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * MapObj data. Map Objects or mobjs are actors, entities, 31 | * thinker, take-your-pick... anything that moves, acts, or 32 | * suffers state changes of more or less violent nature. 33 | * 34 | *-----------------------------------------------------------------------------*/ 35 | 36 | #ifndef __D_THINK__ 37 | #define __D_THINK__ 38 | 39 | #ifdef __GNUG__ 40 | #pragma interface 41 | #endif 42 | 43 | /* 44 | * Experimental stuff. 45 | * To compile this as "ANSI C with classes" 46 | * we will need to handle the various 47 | * action functions cleanly. 48 | */ 49 | // killough 11/98: convert back to C instead of C++ 50 | typedef void (*actionf_t)(); 51 | //typedef void (*actionf_v)(); 52 | //typedef void (*actionf_p1)( void* ); 53 | //typedef void (*actionf_p2)( void*, void* ); 54 | 55 | /* Note: In d_deh.c you will find references to these 56 | * wherever code pointers and function handlers exist 57 | */ 58 | /* 59 | typedef union 60 | { 61 | actionf_p1 acp1; 62 | actionf_v acv; 63 | actionf_p2 acp2; 64 | 65 | } actionf_t; 66 | */ 67 | 68 | /* Historically, "think_t" is yet another 69 | * function pointer to a routine to handle 70 | * an actor. 71 | */ 72 | typedef actionf_t think_t; 73 | 74 | 75 | /* Doubly linked list of actors. */ 76 | typedef struct thinker_s 77 | { 78 | struct thinker_s* prev; 79 | struct thinker_s* next; 80 | think_t function; 81 | 82 | /* killough 8/29/98: we maintain thinkers in several equivalence classes, 83 | * according to various criteria, so as to allow quicker searches. 84 | */ 85 | 86 | struct thinker_s *cnext, *cprev; /* Next, previous thinkers in same class */ 87 | 88 | /* killough 11/98: count of how many other objects reference 89 | * this one using pointers. Used for garbage collection. 90 | */ 91 | unsigned references; 92 | } thinker_t; 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /src/prboom/i_system.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * System specific interface stuff. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __I_SYSTEM__ 35 | #define __I_SYSTEM__ 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | #include "m_fixed.h" 42 | 43 | extern int ms_to_next_tick; 44 | int I_StartDisplay(void); 45 | void I_EndDisplay(void); 46 | int I_GetTime_RealTime(void); /* killough */ 47 | #ifndef PRBOOM_SERVER 48 | fixed_t I_GetTimeFrac (void); 49 | #endif 50 | void I_GetTime_SaveMS(void); 51 | 52 | unsigned long I_GetRandomTimeSeed(void); /* cphipps */ 53 | 54 | void I_uSleep(unsigned long usecs); 55 | 56 | /* cphipps - I_GetVersionString 57 | * Returns a version string in the given buffer 58 | */ 59 | const char* I_GetVersionString(char* buf, size_t sz); 60 | 61 | /* cphipps - I_SigString 62 | * Returns a string describing a signal number 63 | */ 64 | const char* I_SigString(char* buf, size_t sz, int signum); 65 | 66 | const char *I_DoomExeDir(void); // killough 2/16/98: path to executable's dir 67 | 68 | char* I_FindFile(const char* wfname, const char* ext); 69 | 70 | /* cph 2001/11/18 - wrapper for read(2) which deals with partial reads */ 71 | void I_Read(int fd, void* buf, size_t sz); 72 | 73 | /* cph 2001/11/18 - Move W_Filelength to i_system.c */ 74 | int I_Filelength(int handle); 75 | 76 | void I_SetAffinityMask(void); 77 | 78 | 79 | int doom_main(int argc, char const * const * argv); 80 | 81 | int I_Lseek(int fd, off_t offset, int whence); 82 | int I_Open(const char *wad, int flags); 83 | void I_Close(int fd); 84 | 85 | 86 | //HACK mmap support, w_mmap.c 87 | #define PROT_READ 1 88 | #define MAP_SHARED 2 89 | #define MAP_FAILED (void*)-1 90 | 91 | void *I_Mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); 92 | int I_Munmap(void *addr, size_t length); 93 | 94 | int isValidPtr(void *ptr); 95 | void freeUnusedMmaps(void); 96 | #endif 97 | -------------------------------------------------------------------------------- /src/prboom/tables.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Lookup tables. 31 | * Do not try to look them up :-). 32 | * In the order of appearance: 33 | * 34 | * int finetangent[4096] - Tangens LUT. 35 | * Should work with BAM fairly well (12 of 16bit, 36 | * effectively, by shifting). 37 | * 38 | * int finesine[10240] - Sine lookup. 39 | * Guess what, serves as cosine, too. 40 | * Remarkable thing is, how to use BAMs with this? 41 | * 42 | * int tantoangle[2049] - ArcTan LUT, 43 | * maps tan(angle) to angle fast. Gotta search. 44 | * 45 | *-----------------------------------------------------------------------------*/ 46 | 47 | #ifndef __TABLES__ 48 | #define __TABLES__ 49 | 50 | #include 51 | #include "m_fixed.h" 52 | 53 | #define FINEANGLES 8192 54 | #define FINEMASK (FINEANGLES-1) 55 | 56 | // 0x100000000 to 0x2000 57 | #define ANGLETOFINESHIFT 19 58 | 59 | // Binary Angle Measument, BAM. 60 | #define ANG45 0x20000000 61 | #define ANG90 0x40000000 62 | #define ANG180 0x80000000 63 | #define ANG270 0xc0000000 64 | #ifndef M_PI 65 | #define M_PI 3.14159265358979323846 66 | #endif 67 | 68 | #define SLOPERANGE 2048 69 | #define SLOPEBITS 11 70 | #define DBITS (FRACBITS-SLOPEBITS) 71 | 72 | typedef uint32_t angle_t; 73 | 74 | // Load trig tables if needed 75 | void R_LoadTrigTables(void); 76 | 77 | // Effective size is 10240. 78 | //extern fixed_t finesine[5*FINEANGLES/4]; 79 | extern fixed_t *finesine; 80 | 81 | // Re-use data, is just PI/2 phase shift. 82 | extern fixed_t *finecosine; 83 | 84 | // Effective size is 4096. 85 | //extern fixed_t finetangent[FINEANGLES/2]; 86 | extern fixed_t *finetangent; 87 | 88 | // Effective size is 2049; 89 | // The +1 size is to handle the case when x==y without additional checking. 90 | 91 | //extern angle_t tantoangle[SLOPERANGE+1]; 92 | extern angle_t *tantoangle; 93 | 94 | // Utility function, called by R_PointToAngle. 95 | int SlopeDiv(unsigned num, unsigned den); 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /src/prboom/s_sound.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * The not so system specific sound interface. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __S_SOUND__ 35 | #define __S_SOUND__ 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | // 42 | // Initializes sound stuff, including volume 43 | // Sets channels, SFX and music volume, 44 | // allocates channel buffer, sets S_sfx lookup. 45 | // 46 | void S_Init(int sfxVolume, int musicVolume); 47 | 48 | // Kills all sounds 49 | void S_Stop(void); 50 | 51 | // 52 | // Per level startup code. 53 | // Kills playing sounds at start of level, 54 | // determines music if any, changes music. 55 | // 56 | void S_Start(void); 57 | 58 | // 59 | // Start sound for thing at 60 | // using from sounds.h 61 | // 62 | void S_StartSound(void *origin, int sound_id); 63 | 64 | // Will start a sound at a given volume. 65 | void S_StartSoundAtVolume(void *origin, int sound_id, int volume); 66 | 67 | // killough 4/25/98: mask used to indicate sound origin is player item pickup 68 | #define PICKUP_SOUND (0x8000) 69 | 70 | // Stop sound for thing at 71 | void S_StopSound(void* origin); 72 | 73 | // Start music using from sounds.h 74 | void S_StartMusic(int music_id); 75 | 76 | // Start music using from sounds.h, and set whether looping 77 | void S_ChangeMusic(int music_id, int looping); 78 | 79 | // Stops the music fer sure. 80 | void S_StopMusic(void); 81 | 82 | // Stop and resume music, during game PAUSE. 83 | void S_PauseSound(void); 84 | void S_ResumeSound(void); 85 | 86 | // 87 | // Updates music & sounds 88 | // 89 | void S_UpdateSounds(void* listener); 90 | void S_SetMusicVolume(int volume); 91 | void S_SetSfxVolume(int volume); 92 | 93 | // machine-independent sound params 94 | extern int default_numChannels; 95 | extern int numChannels; 96 | 97 | //jff 3/17/98 holds last IDMUS number, or -1 98 | extern int idmusnum; 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /src/prboom/p_maputl.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Map utility functions 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __P_MAPUTL__ 35 | #define __P_MAPUTL__ 36 | 37 | #include "r_defs.h" 38 | 39 | /* mapblocks are used to check movement against lines and things */ 40 | #define MAPBLOCKUNITS 128 41 | #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT) 42 | #define MAPBLOCKSHIFT (FRACBITS+7) 43 | #define MAPBMASK (MAPBLOCKSIZE-1) 44 | #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS) 45 | 46 | #define PT_ADDLINES 1 47 | #define PT_ADDTHINGS 2 48 | #define PT_EARLYOUT 4 49 | 50 | typedef struct { 51 | fixed_t x; 52 | fixed_t y; 53 | fixed_t dx; 54 | fixed_t dy; 55 | } divline_t; 56 | 57 | typedef struct { 58 | fixed_t frac; /* along trace line */ 59 | boolean isaline; 60 | union { 61 | mobj_t* thing; 62 | line_t* line; 63 | } d; 64 | } intercept_t; 65 | 66 | typedef boolean (*traverser_t)(intercept_t *in); 67 | 68 | fixed_t CONSTFUNC P_AproxDistance (fixed_t dx, fixed_t dy); 69 | int PUREFUNC P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line); 70 | int PUREFUNC P_BoxOnLineSide (const fixed_t *tmbox, const line_t *ld); 71 | fixed_t PUREFUNC P_InterceptVector (const divline_t *v2, const divline_t *v1); 72 | /* cph - old compatibility version below */ 73 | fixed_t PUREFUNC P_InterceptVector2(const divline_t *v2, const divline_t *v1); 74 | 75 | void P_LineOpening (const line_t *linedef); 76 | void P_UnsetThingPosition(mobj_t *thing); 77 | void P_SetThingPosition(mobj_t *thing); 78 | boolean P_BlockLinesIterator (int x, int y, boolean func(line_t *)); 79 | boolean P_BlockThingsIterator(int x, int y, boolean func(mobj_t *)); 80 | boolean P_PathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, 81 | int flags, boolean trav(intercept_t *)); 82 | 83 | extern fixed_t opentop; 84 | extern fixed_t openbottom; 85 | extern fixed_t openrange; 86 | extern fixed_t lowfloor; 87 | extern divline_t trace; 88 | 89 | #endif /* __P_MAPUTL__ */ 90 | -------------------------------------------------------------------------------- /src/prboom/d_event.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Event information structures. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __D_EVENT__ 36 | #define __D_EVENT__ 37 | 38 | 39 | #include "doomtype.h" 40 | 41 | 42 | // 43 | // Event handling. 44 | // 45 | 46 | // Input event types. 47 | typedef enum 48 | { 49 | ev_keydown, 50 | ev_keyup, 51 | ev_mouse, 52 | ev_joystick 53 | } evtype_t; 54 | 55 | // Event structure. 56 | typedef struct 57 | { 58 | evtype_t type; 59 | int data1; // keys / mouse/joystick buttons 60 | int data2; // mouse/joystick x move 61 | int data3; // mouse/joystick y move 62 | } event_t; 63 | 64 | 65 | typedef enum 66 | { 67 | ga_nothing, 68 | ga_loadlevel, 69 | ga_newgame, 70 | ga_loadgame, 71 | ga_savegame, 72 | ga_playdemo, 73 | ga_completed, 74 | ga_victory, 75 | ga_worlddone, 76 | } gameaction_t; 77 | 78 | 79 | 80 | // 81 | // Button/action code definitions. 82 | // 83 | typedef enum 84 | { 85 | // Press "Fire". 86 | BT_ATTACK = 1, 87 | 88 | // Use button, to open doors, activate switches. 89 | BT_USE = 2, 90 | 91 | // Flag: game events, not really buttons. 92 | BT_SPECIAL = 128, 93 | BT_SPECIALMASK = 3, 94 | 95 | // Flag, weapon change pending. 96 | // If true, the next 4 bits hold weapon num. 97 | BT_CHANGE = 4, 98 | 99 | // The 4bit weapon mask and shift, convenience. 100 | //BT_WEAPONMASK = (8+16+32), 101 | BT_WEAPONMASK = (8+16+32+64), // extended to pick up SSG // phares 102 | BT_WEAPONSHIFT = 3, 103 | 104 | // Special events 105 | BTS_LOADGAME = 0, // Loads a game 106 | // Pause the game. 107 | BTS_PAUSE = 1, 108 | // Save the game at each console. 109 | BTS_SAVEGAME = 2, 110 | BTS_RESTARTLEVEL= 3, // Restarts the current level 111 | 112 | // Savegame slot numbers occupy the second byte of buttons. 113 | BTS_SAVEMASK = (4+8+16), 114 | BTS_SAVESHIFT = 2, 115 | 116 | } buttoncode_t; 117 | 118 | 119 | // 120 | // GLOBAL VARIABLES 121 | // 122 | 123 | extern gameaction_t gameaction; 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/i_network.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Low level UDP network interface. This is shared between the server 31 | * and client, with SERVER defined for the former to select some extra 32 | * functions. Handles socket creation, and packet send and receive. 33 | * 34 | *-----------------------------------------------------------------------------*/ 35 | 36 | # include "config.h" 37 | #ifdef HAVE_NETINET_IN_H 38 | # include 39 | #endif 40 | #include 41 | #include 42 | #ifdef HAVE_UNISTD_H 43 | #include 44 | #endif 45 | #include 46 | #include 47 | #include 48 | 49 | #ifdef HAVE_NET 50 | 51 | 52 | #include "protocol.h" 53 | #include "i_network.h" 54 | #include "lprintf.h" 55 | 56 | void I_ShutdownNetwork(void) 57 | { 58 | } 59 | 60 | void I_InitNetwork(void) 61 | { 62 | } 63 | 64 | UDP_PACKET *I_AllocPacket(int size) 65 | { 66 | } 67 | 68 | void I_FreePacket(UDP_PACKET *packet) 69 | { 70 | } 71 | 72 | void I_WaitForPacket(int ms) 73 | { 74 | } 75 | 76 | int I_ConnectToServer(const char *serv) 77 | { 78 | return 0; 79 | } 80 | 81 | void I_Disconnect(void) 82 | { 83 | } 84 | 85 | UDP_SOCKET I_Socket(Uint16 port) 86 | { 87 | } 88 | 89 | void I_CloseSocket(UDP_SOCKET sock) 90 | { 91 | } 92 | 93 | UDP_CHANNEL I_RegisterPlayer(IPaddress *ipaddr) 94 | { 95 | } 96 | 97 | void I_UnRegisterPlayer(UDP_CHANNEL channel) 98 | { 99 | } 100 | 101 | /* 102 | * ChecksumPacket 103 | * 104 | * Returns the checksum of a given network packet 105 | */ 106 | static byte ChecksumPacket(const packet_header_t* buffer, size_t len) 107 | { 108 | const byte* p = (const void*)buffer; 109 | byte sum = 0; 110 | 111 | if (len==0) 112 | return 0; 113 | 114 | while (p++, --len) 115 | sum += *p; 116 | 117 | return sum; 118 | } 119 | 120 | size_t I_GetPacket(packet_header_t* buffer, size_t buflen) 121 | { 122 | return 0; 123 | } 124 | 125 | void I_SendPacket(packet_header_t* packet, size_t len) 126 | { 127 | } 128 | 129 | void I_SendPacketTo(packet_header_t* packet, size_t len, UDP_CHANNEL *to) 130 | { 131 | } 132 | 133 | void I_PrintAddress(FILE* fp, UDP_CHANNEL *addr) 134 | { 135 | } 136 | 137 | #endif /* HAVE_NET */ 138 | -------------------------------------------------------------------------------- /src/prboom/d_items.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Something to do with weapon sprite frames. Don't ask me. 31 | * 32 | *----------------------------------------------------------------------------- 33 | */ 34 | 35 | // We are referring to sprite numbers. 36 | #include "doomtype.h" 37 | #include "info.h" 38 | 39 | #ifdef __GNUG__ 40 | #pragma implementation "d_items.h" 41 | #endif 42 | #include "d_items.h" 43 | 44 | 45 | // 46 | // PSPRITE ACTIONS for waepons. 47 | // This struct controls the weapon animations. 48 | // 49 | // Each entry is: 50 | // ammo/amunition type 51 | // upstate 52 | // downstate 53 | // readystate 54 | // atkstate, i.e. attack/fire/hit frame 55 | // flashstate, muzzle flash 56 | // 57 | weaponinfo_t weaponinfo[NUMWEAPONS] = 58 | { 59 | { 60 | // fist 61 | am_noammo, 62 | S_PUNCHUP, 63 | S_PUNCHDOWN, 64 | S_PUNCH, 65 | S_PUNCH1, 66 | S_NULL 67 | }, 68 | { 69 | // pistol 70 | am_clip, 71 | S_PISTOLUP, 72 | S_PISTOLDOWN, 73 | S_PISTOL, 74 | S_PISTOL1, 75 | S_PISTOLFLASH 76 | }, 77 | { 78 | // shotgun 79 | am_shell, 80 | S_SGUNUP, 81 | S_SGUNDOWN, 82 | S_SGUN, 83 | S_SGUN1, 84 | S_SGUNFLASH1 85 | }, 86 | { 87 | // chaingun 88 | am_clip, 89 | S_CHAINUP, 90 | S_CHAINDOWN, 91 | S_CHAIN, 92 | S_CHAIN1, 93 | S_CHAINFLASH1 94 | }, 95 | { 96 | // missile launcher 97 | am_misl, 98 | S_MISSILEUP, 99 | S_MISSILEDOWN, 100 | S_MISSILE, 101 | S_MISSILE1, 102 | S_MISSILEFLASH1 103 | }, 104 | { 105 | // plasma rifle 106 | am_cell, 107 | S_PLASMAUP, 108 | S_PLASMADOWN, 109 | S_PLASMA, 110 | S_PLASMA1, 111 | S_PLASMAFLASH1 112 | }, 113 | { 114 | // bfg 9000 115 | am_cell, 116 | S_BFGUP, 117 | S_BFGDOWN, 118 | S_BFG, 119 | S_BFG1, 120 | S_BFGFLASH1 121 | }, 122 | { 123 | // chainsaw 124 | am_noammo, 125 | S_SAWUP, 126 | S_SAWDOWN, 127 | S_SAW, 128 | S_SAW1, 129 | S_NULL 130 | }, 131 | { 132 | // super shotgun 133 | am_shell, 134 | S_DSGUNUP, 135 | S_DSGUNDOWN, 136 | S_DSGUN, 137 | S_DSGUN1, 138 | S_DSGUNFLASH1 139 | }, 140 | }; 141 | -------------------------------------------------------------------------------- /src/prboom/r_state.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Refresh/render internal state variables (global). 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | 35 | #ifndef __R_STATE__ 36 | #define __R_STATE__ 37 | 38 | // Need data structure definitions. 39 | #include "d_player.h" 40 | #include "r_data.h" 41 | 42 | #ifdef __GNUG__ 43 | #pragma interface 44 | #endif 45 | 46 | 47 | // 48 | // Refresh internal data structures, 49 | // for rendering. 50 | // 51 | 52 | // needed for texture pegging 53 | extern fixed_t *textureheight; 54 | 55 | extern int scaledviewwidth; 56 | 57 | extern int firstflat, numflats; 58 | 59 | // for global animation 60 | extern int *flattranslation; 61 | extern int *texturetranslation; 62 | 63 | // Sprite.... 64 | extern int firstspritelump; 65 | extern int lastspritelump; 66 | extern int numspritelumps; 67 | 68 | // 69 | // Lookup tables for map data. 70 | // 71 | extern int numsprites; 72 | extern spritedef_t *sprites; 73 | 74 | extern int numvertexes; 75 | extern vertex_t *vertexes; 76 | 77 | extern int numsegs; 78 | extern seg_t *segs; 79 | 80 | extern int numsectors; 81 | extern sector_t *sectors; 82 | 83 | extern int numsubsectors; 84 | extern subsector_t *subsectors; 85 | 86 | extern int numnodes; 87 | extern node_t *nodes; 88 | 89 | extern int numlines; 90 | extern line_t *lines; 91 | 92 | extern int numsides; 93 | extern side_t *sides; 94 | 95 | 96 | // 97 | // POV data. 98 | // 99 | extern fixed_t viewx; 100 | extern fixed_t viewy; 101 | extern fixed_t viewz; 102 | extern angle_t viewangle; 103 | extern player_t *viewplayer; 104 | extern angle_t clipangle; 105 | extern int *viewangletox; 106 | extern angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98 107 | extern fixed_t rw_distance; 108 | extern angle_t rw_normalangle; 109 | 110 | // angle to line origin 111 | extern int rw_angle1; 112 | 113 | extern visplane_t *floorplane; 114 | extern visplane_t *ceilingplane; 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "ESP32-Doom platform-specific configuration" 2 | 3 | choice DOOM_HARDWARE 4 | prompt "Hardware to run on" 5 | default HW_WROVERKIT_V2 6 | help 7 | This emulator can run on various types of hardware. Select what you have here. Warning: The hardware does need to have 4MiB PSRAM installed 8 | 9 | config HW_WROVERKIT_V1 10 | bool "ESP_Wrover_Kit v1 (red PCB)" 11 | 12 | config HW_WROVERKIT_V2 13 | bool "ESP_Wrover_Kit v2/v3 (shiny/matte black PCB)" 14 | 15 | config HW_CUSTOM 16 | bool "Custom hardware" 17 | 18 | endchoice 19 | 20 | choice HW_LCD_TYPE_SEL 21 | prompt "LCD type" 22 | default HW_LCD_TYPE_ILI 23 | depends on HW_CUSTOM || HW_WROVERKIT_V2 24 | 25 | config HW_LCD_TYPE_ILI 26 | bool "ILI9341 LCD" 27 | 28 | config HW_LCD_TYPE_ST 29 | bool "ST7789V LCD" 30 | 31 | endchoice 32 | 33 | config HW_WROVERKIT 34 | bool 35 | default n if HW_CUSTOM 36 | default y if HW_WROVERKIT_V1 37 | default y if HW_WROVERKIT_V2 38 | 39 | 40 | config HW_LCD_TYPE 41 | int 42 | default 0 if HW_WROVERKIT_V1 43 | default 0 if HW_LCD_TYPE_ILI 44 | default 1 if HW_LCD_TYPE_ST 45 | 46 | 47 | config HW_LCD_MOSI_GPIO_CUST 48 | int "LCD MOSI pin" 49 | depends on HW_CUSTOM 50 | range 1 35 51 | default 25 52 | 53 | 54 | config HW_LCD_CLK_GPIO_CUST 55 | int "LCD CLK pin" 56 | depends on HW_CUSTOM 57 | range 1 35 58 | default 23 59 | 60 | config HW_LCD_CS_GPIO_CUST 61 | int "LCD CS pin" 62 | depends on HW_CUSTOM 63 | range 1 35 64 | default 19 65 | 66 | config HW_LCD_DC_GPIO_CUST 67 | int "LCD DC pin" 68 | depends on HW_CUSTOM 69 | range 1 35 70 | default 22 71 | 72 | config HW_LCD_RESET_GPIO_CUST 73 | int "LCD RESET pin" 74 | depends on HW_CUSTOM 75 | range 1 35 76 | default 21 77 | 78 | config HW_LCD_BL_GPIO_CUST 79 | int "LCD Backlight Enable pin" 80 | depends on HW_CUSTOM 81 | range 1 35 82 | default 5 83 | 84 | config HW_INV_BL_CUST 85 | bool "Invert backlight output" 86 | default n 87 | depends on HW_CUSTOM 88 | 89 | 90 | config HW_INV_BL 91 | bool 92 | default HW_INBV_BL_CUST if HW_CUSTOM 93 | default n if HW_WROVERKIT_V1 94 | default y if HW_WROVERKIT_V2 95 | 96 | config HW_LCD_MOSI_GPIO 97 | int 98 | default HW_LCD_MOSI_GPIO_CUST if HW_CUSTOM 99 | default 23 if HW_WROVERKIT 100 | 101 | config HW_LCD_CLK_GPIO 102 | int 103 | default HW_LCD_CLK_GPIO_CUST if HW_CUSTOM 104 | default 19 if HW_WROVERKIT 105 | 106 | config HW_LCD_CS_GPIO 107 | int 108 | default HW_LCD_CS_GPIO_CUST if HW_CUSTOM 109 | default 22 if HW_WROVERKIT 110 | 111 | config HW_LCD_DC_GPIO 112 | int 113 | default HW_LCD_DC_GPIO_CUST if HW_CUSTOM 114 | default 21 if HW_WROVERKIT 115 | 116 | config HW_LCD_RESET_GPIO 117 | int 118 | default HW_LCD_RESET_GPIO_CUST if HW_CUSTOM 119 | default 18 if HW_WROVERKIT 120 | 121 | config HW_LCD_BL_GPIO 122 | int 123 | default HW_LCD_BL_GPIO_CUST if HW_CUSTOM 124 | default 5 if HW_WROVERKIT 125 | 126 | 127 | config HW_PSX_ENA 128 | bool "Enable PSX controller input" 129 | default y 130 | help 131 | If you connect a PSX/PS2 controller to the following GPIOs, you can control the NES. 132 | 133 | 134 | config HW_PSX_CLK 135 | int "PSX controller CLK GPIO pin" 136 | depends on HW_PSX_ENA 137 | range 1 35 138 | default 14 139 | 140 | config HW_PSX_DAT 141 | int "PSX controller DATa GPIO pin" 142 | depends on HW_PSX_ENA 143 | range 1 35 144 | default 27 145 | 146 | config HW_PSX_ATT 147 | int "PSX controller ATTention GPIO pin" 148 | depends on HW_PSX_ENA 149 | range 1 35 150 | default 4 151 | 152 | config HW_PSX_CMD 153 | int "PSX controller CoMmanD GPIO pin" 154 | depends on HW_PSX_ENA 155 | range 1 35 156 | default 2 157 | 158 | endmenu -------------------------------------------------------------------------------- /src/prboom/hu_stuff.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: Head up display 30 | * 31 | *-----------------------------------------------------------------------------*/ 32 | 33 | #ifndef __HU_STUFF_H__ 34 | #define __HU_STUFF_H__ 35 | 36 | #include "d_event.h" 37 | 38 | /* 39 | * Globally visible constants. 40 | */ 41 | #define HU_FONTSTART '!' /* the first font characters */ 42 | #define HU_FONTEND (0x7f) /*jff 2/16/98 '_' the last font characters */ 43 | 44 | /* Calculate # of glyphs in font. */ 45 | #define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1) 46 | 47 | #define HU_BROADCAST 5 48 | 49 | /*#define HU_MSGREFRESH KEYD_ENTER phares */ 50 | #define HU_MSGX 0 51 | #define HU_MSGY 0 52 | #define HU_MSGWIDTH 64 /* in characters */ 53 | #define HU_MSGHEIGHT 1 /* in lines */ 54 | 55 | #define HU_MSGTIMEOUT (4*TICRATE) 56 | 57 | /* 58 | * Heads up text 59 | */ 60 | void HU_Init(void); 61 | void HU_Start(void); 62 | 63 | boolean HU_Responder(event_t* ev); 64 | 65 | void HU_Ticker(void); 66 | void HU_Drawer(void); 67 | char HU_dequeueChatChar(void); 68 | void HU_Erase(void); 69 | void HU_MoveHud(void); // jff 3/9/98 avoid glitch in HUD display 70 | 71 | /* killough 5/2/98: moved from m_misc.c: */ 72 | 73 | /* jff 2/16/98 hud supported automap colors added */ 74 | extern int hudcolor_titl; /* color range of automap level title */ 75 | extern int hudcolor_xyco; /* color range of new coords on automap */ 76 | /* jff 2/16/98 hud text colors, controls added */ 77 | extern int hudcolor_mesg; /* color range of scrolling messages */ 78 | extern int hudcolor_chat; /* color range of chat lines */ 79 | /* jff 2/26/98 hud message list color and background enable */ 80 | extern int hudcolor_list; /* color of list of past messages */ 81 | extern int hud_list_bgon; /* solid window background for list of messages */ 82 | extern int hud_msg_lines; /* number of message lines in window up to 16 */ 83 | extern int hud_distributed; /* whether hud is all in lower left or distributed */ 84 | /* jff 2/23/98 hud is currently displayed */ 85 | extern int hud_displayed; /* hud is displayed */ 86 | /* jff 2/18/98 hud/status control */ 87 | extern int hud_active; /* hud mode 0=off, 1=small, 2=full */ 88 | extern int hud_nosecrets; /* status does not list secrets/items/kills */ 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /src/prboom/p_pspr.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Sprite animation. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __P_PSPR__ 35 | #define __P_PSPR__ 36 | 37 | /* Basic data types. 38 | * Needs fixed point, and BAM angles. */ 39 | 40 | #include "m_fixed.h" 41 | #include "tables.h" 42 | 43 | /* Needs to include the precompiled sprite animation tables. 44 | * 45 | * Header generated by multigen utility. 46 | * This includes all the data for thing animation, 47 | * i.e. the Thing Atrributes table and the Frame Sequence table. 48 | */ 49 | 50 | #include "info.h" 51 | 52 | #ifdef __GNUG__ 53 | #pragma interface 54 | #endif 55 | 56 | /* 57 | * Frame flags: 58 | * handles maximum brightness (torches, muzzle flare, light sources) 59 | */ 60 | 61 | #define FF_FULLBRIGHT 0x8000 /* flag in thing->frame */ 62 | #define FF_FRAMEMASK 0x7fff 63 | 64 | /* 65 | * Overlay psprites are scaled shapes 66 | * drawn directly on the view screen, 67 | * coordinates are given for a 320*200 view screen. 68 | */ 69 | 70 | typedef enum 71 | { 72 | ps_weapon, 73 | ps_flash, 74 | NUMPSPRITES 75 | } psprnum_t; 76 | 77 | typedef struct 78 | { 79 | state_t *state; /* a NULL state means not active */ 80 | int tics; 81 | fixed_t sx; 82 | fixed_t sy; 83 | } pspdef_t; 84 | 85 | extern int weapon_preferences[2][NUMWEAPONS+1]; /* killough 5/2/98 */ 86 | int P_WeaponPreferred(int w1, int w2); 87 | 88 | struct player_s; 89 | int P_SwitchWeapon(struct player_s *player); 90 | boolean P_CheckAmmo(struct player_s *player); 91 | void P_SetupPsprites(struct player_s *curplayer); 92 | void P_MovePsprites(struct player_s *curplayer); 93 | void P_DropWeapon(struct player_s *player); 94 | 95 | void A_Light0(); 96 | void A_WeaponReady(); 97 | void A_Lower(); 98 | void A_Raise(); 99 | void A_Punch(); 100 | void A_ReFire(); 101 | void A_FirePistol(); 102 | void A_Light1(); 103 | void A_FireShotgun(); 104 | void A_Light2(); 105 | void A_FireShotgun2(); 106 | void A_CheckReload(); 107 | void A_OpenShotgun2(); 108 | void A_LoadShotgun2(); 109 | void A_CloseShotgun2(); 110 | void A_FireCGun(); 111 | void A_GunFlash(); 112 | void A_FireMissile(); 113 | void A_Saw(); 114 | void A_FirePlasma(); 115 | void A_BFGsound(); 116 | void A_FireBFG(); 117 | void A_BFGSpray(); 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /src/prboom/dstrings.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Globally defined strings. 31 | * 32 | *----------------------------------------------------------------------------- 33 | */ 34 | 35 | #ifdef __GNUG__ 36 | #pragma implementation "dstrings.h" 37 | #endif 38 | #include "dstrings.h" 39 | 40 | 41 | // killough 1/18/98: remove hardcoded limit, add const: 42 | const char *const endmsg[]= 43 | { 44 | // DOOM1 45 | QUITMSG, 46 | "please don't leave, there's more\ndemons to toast!", 47 | "let's beat it -- this is turning\ninto a bloodbath!", 48 | "i wouldn't leave if i were you.\ndos is much worse.", 49 | "you're trying to say you like dos\nbetter than me, right?", 50 | "don't leave yet -- there's a\ndemon around that corner!", 51 | "ya know, next time you come in here\ni'm gonna toast ya.", 52 | "go ahead and leave. see if i care.", // 1/15/98 killough 53 | 54 | // QuitDOOM II messages 55 | "you want to quit?\nthen, thou hast lost an eighth!", 56 | "don't go now, there's a \ndimensional shambler waiting\nat the dos prompt!", 57 | "get outta here and go back\nto your boring programs.", 58 | "if i were your boss, i'd \n deathmatch ya in a minute!", 59 | "look, bud. you leave now\nand you forfeit your body count!", 60 | "just leave. when you come\nback, i'll be waiting with a bat.", 61 | "you're lucky i don't smack\nyou for thinking about leaving.", // 1/15/98 killough 62 | 63 | // FinalDOOM? 64 | 65 | // Note that these ending "bad taste" strings were commented out 66 | // in the original id code as the #else case of an #if 1 67 | // Obviously they were internal playthings before the release of 68 | // DOOM2 and were not intended for public use. 69 | // 70 | // Following messages commented out for now. Bad taste. // phares 71 | 72 | // "fuck you, pussy!\nget the fuck out!", 73 | // "you quit and i'll jizz\nin your cystholes!", 74 | // "if you leave, i'll make\nthe lord drink my jizz.", 75 | // "hey, ron! can we say\n'fuck' in the game?", 76 | // "i'd leave: this is just\nmore monsters and levels.\nwhat a load.", 77 | // "suck it down, asshole!\nyou're a fucking wimp!", 78 | // "don't quit now! we're \nstill spending your money!", 79 | 80 | // Internal debug. Different style, too. 81 | "THIS IS NO MESSAGE!\nPage intentionally left blank.", // 1/15/98 killough 82 | }; 83 | 84 | // killough 1/18/98: remove hardcoded limit and replace with var (silly hack): 85 | const size_t NUM_QUITMESSAGES = sizeof(endmsg)/sizeof(*endmsg) - 1; 86 | -------------------------------------------------------------------------------- /src/prboom/r_patch.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | *-----------------------------------------------------------------------------*/ 30 | 31 | 32 | #ifndef R_PATCH_H 33 | #define R_PATCH_H 34 | 35 | // Used to specify the sloping of the top and bottom of a column post 36 | typedef enum { 37 | RDRAW_EDGESLOPE_TOP_UP = (1<<0), 38 | RDRAW_EDGESLOPE_TOP_DOWN = (1<<1), 39 | RDRAW_EDGESLOPE_BOT_UP = (1<<2), 40 | RDRAW_EDGESLOPE_BOT_DOWN = (1<<3), 41 | RDRAW_EDGESLOPE_TOP_MASK = 0x3, 42 | RDRAW_EDGESLOPE_BOT_MASK = 0xc, 43 | } edgeslope_t; 44 | 45 | typedef struct { 46 | int topdelta; 47 | int length; 48 | edgeslope_t slope; 49 | } rpost_t; 50 | 51 | typedef struct { 52 | int numPosts; 53 | rpost_t *posts; 54 | unsigned char *pixels; 55 | } rcolumn_t; 56 | 57 | typedef struct { 58 | int width; 59 | int height; 60 | unsigned widthmask; 61 | 62 | unsigned char isNotTileable; 63 | 64 | int leftoffset; 65 | int topoffset; 66 | 67 | // this is the single malloc'ed/free'd array 68 | // for this patch 69 | unsigned char *data; 70 | 71 | // these are pointers into the data array 72 | unsigned char *pixels; 73 | rcolumn_t *columns; 74 | rpost_t *posts; 75 | 76 | #ifdef TIMEDIAG 77 | int locktic; 78 | #endif 79 | unsigned int locks; 80 | } rpatch_t; 81 | 82 | 83 | const rpatch_t *R_CachePatchNum(int id); 84 | void R_UnlockPatchNum(int id); 85 | #define R_CachePatchName(name) R_CachePatchNum(W_GetNumForName(name)) 86 | #define R_UnlockPatchName(name) R_UnlockPatchNum(W_GetNumForName(name)) 87 | 88 | const rpatch_t *R_CacheTextureCompositePatchNum(int id); 89 | void R_UnlockTextureCompositePatchNum(int id); 90 | 91 | 92 | // Size query funcs 93 | int R_NumPatchWidth(int lump) ; 94 | int R_NumPatchHeight(int lump); 95 | #define R_NamePatchWidth(name) R_NumPatchWidth(W_GetNumForName(name)) 96 | #define R_NamePatchHeight(name) R_NumPatchHeight(W_GetNumForName(name)) 97 | 98 | 99 | const rcolumn_t *R_GetPatchColumnWrapped(const rpatch_t *patch, int columnIndex); 100 | const rcolumn_t *R_GetPatchColumnClamped(const rpatch_t *patch, int columnIndex); 101 | 102 | 103 | // returns R_GetPatchColumnWrapped for square, non-holed textures 104 | // and R_GetPatchColumnClamped otherwise 105 | const rcolumn_t *R_GetPatchColumn(const rpatch_t *patch, int columnIndex); 106 | 107 | 108 | void R_InitPatches(); 109 | void R_FlushAllPatches(); 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /src/prboom/st_stuff.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Status bar code. 31 | * Does the face/direction indicator animatin. 32 | * Does palette indicators as well (red pain/berserk, bright pickup) 33 | * 34 | *-----------------------------------------------------------------------------*/ 35 | 36 | #ifndef __STSTUFF_H__ 37 | #define __STSTUFF_H__ 38 | 39 | #include "doomtype.h" 40 | #include "d_event.h" 41 | 42 | // Size of statusbar. 43 | // Now sensitive for scaling. 44 | 45 | // proff 08/18/98: Changed for high-res 46 | #define ST_HEIGHT 32 47 | #define ST_WIDTH 320 48 | #define ST_Y (200 - ST_HEIGHT) 49 | #define ST_SCALED_HEIGHT (ST_HEIGHT*SCREENHEIGHT/200) 50 | #define ST_SCALED_WIDTH SCREENWIDTH 51 | #define ST_SCALED_Y (SCREENHEIGHT - ST_SCALED_HEIGHT) 52 | 53 | // 54 | // STATUS BAR 55 | // 56 | 57 | // Called by main loop. 58 | boolean ST_Responder(event_t* ev); 59 | 60 | // Called by main loop. 61 | void ST_Ticker(void); 62 | 63 | // Called by main loop. 64 | void ST_Drawer(boolean st_statusbaron, boolean refresh); 65 | 66 | // Called when the console player is spawned on each level. 67 | void ST_Start(void); 68 | 69 | // Called by startup code. 70 | void ST_Init(void); 71 | 72 | // States for status bar code. 73 | typedef enum 74 | { 75 | AutomapState, 76 | FirstPersonState 77 | } st_stateenum_t; 78 | 79 | // States for the chat code. 80 | typedef enum 81 | { 82 | StartChatState, 83 | WaitDestState, 84 | GetChatState 85 | } st_chatstateenum_t; 86 | 87 | // killough 5/2/98: moved from m_misc.c: 88 | 89 | extern int health_red; // health amount less than which status is red 90 | extern int health_yellow; // health amount less than which status is yellow 91 | extern int health_green; // health amount above is blue, below is green 92 | extern int armor_red; // armor amount less than which status is red 93 | extern int armor_yellow; // armor amount less than which status is yellow 94 | extern int armor_green; // armor amount above is blue, below is green 95 | extern int ammo_red; // ammo percent less than which status is red 96 | extern int ammo_yellow; // ammo percent less is yellow more green 97 | extern int sts_always_red;// status numbers do not change colors 98 | extern int sts_pct_always_gray;// status percents do not change colors 99 | extern int sts_traditional_keys; // display keys the traditional way 100 | 101 | extern int st_palette; // cph 2006/04/06 - make palette visible 102 | #endif 103 | -------------------------------------------------------------------------------- /src/prboom/protocol.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Doom Network protocol packet definitions. 31 | *-----------------------------------------------------------------------------*/ 32 | 33 | #include "doomtype.h" 34 | #include "d_ticcmd.h" 35 | #include "m_swap.h" 36 | #include "config.h" 37 | 38 | enum packet_type_e { 39 | PKT_INIT, // initial packet to server 40 | PKT_SETUP, // game information packet 41 | PKT_GO, // game has started 42 | PKT_TICC, // tics from client 43 | PKT_TICS, // tics from server 44 | PKT_RETRANS, // Request for retransmission 45 | PKT_EXTRA, // Extra info packet 46 | PKT_QUIT, // Player quit game 47 | PKT_DOWN, // Server downed 48 | PKT_WAD, // Wad file request 49 | PKT_BACKOFF, // Request for client back-off 50 | }; 51 | 52 | typedef struct { 53 | byte checksum; // Simple checksum of the entire packet 54 | byte type; /* Type of packet */ 55 | byte reserved[2]; /* Was random in prboom <=2.2.4, now 0 */ 56 | unsigned tic; // Timestamp 57 | } PACKEDATTR packet_header_t; 58 | 59 | static inline void packet_set(packet_header_t* p, enum packet_type_e t, unsigned long tic) 60 | { p->tic = doom_htonl(tic); p->type = t; p->reserved[0] = 0; p->reserved[1] = 0; } 61 | 62 | #ifndef GAME_OPTIONS_SIZE 63 | // From g_game.h 64 | #define GAME_OPTIONS_SIZE 64 65 | #endif 66 | 67 | struct setup_packet_s { 68 | byte players, yourplayer, skill, episode, level, deathmatch, complevel, ticdup, extratic; 69 | byte game_options[GAME_OPTIONS_SIZE]; 70 | byte numwads; 71 | byte wadnames[1]; // Actually longer 72 | }; 73 | 74 | /* cph - convert network byte stream to usable ticcmd_t and visa-versa 75 | * - the functions are functionally identical apart from parameters 76 | * - the void* param can be unaligned. By using void* as the parameter 77 | * it means gcc won't assume alignment so won't make false assumptions 78 | * when optimising. So I'm told. 79 | */ 80 | inline static void RawToTic(ticcmd_t* dst, const void* src) 81 | { 82 | memcpy(dst,src,sizeof *dst); 83 | dst->angleturn = doom_ntohs(dst->angleturn); 84 | dst->consistancy = doom_ntohs(dst->consistancy); 85 | } 86 | 87 | inline static void TicToRaw(void* dst, const ticcmd_t* src) 88 | { 89 | /* We have to make a copy of the source struct, then do byte swaps, 90 | * and fnially copy to the destination (can't do the swaps in the 91 | * destination, because it might not be aligned). 92 | */ 93 | ticcmd_t tmp = *src; 94 | tmp.angleturn = doom_ntohs(tmp.angleturn); 95 | tmp.consistancy = doom_ntohs(tmp.consistancy); 96 | memcpy(dst,&tmp,sizeof tmp); 97 | } 98 | -------------------------------------------------------------------------------- /src/prboom/i_sound.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * System interface, sound. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __I_SOUND__ 35 | #define __I_SOUND__ 36 | 37 | #include "sounds.h" 38 | #include "doomtype.h" 39 | 40 | #define SNDSERV 41 | #undef SNDINTR 42 | 43 | #ifndef SNDSERV 44 | #include "l_soundgen.h" 45 | #endif 46 | 47 | // Init at program start... 48 | void I_InitSound(void); 49 | 50 | // ... shut down and relase at program termination. 51 | void I_ShutdownSound(void); 52 | 53 | // 54 | // SFX I/O 55 | // 56 | 57 | // Initialize channels? 58 | void I_SetChannels(void); 59 | 60 | // Get raw data lump index for sound descriptor. 61 | int I_GetSfxLumpNum (sfxinfo_t *sfxinfo); 62 | 63 | // Starts a sound in a particular sound channel. 64 | int I_StartSound(int id, int channel, int vol, int sep, int pitch, int priority); 65 | 66 | // Stops a sound channel. 67 | void I_StopSound(int handle); 68 | 69 | // Called by S_*() functions 70 | // to see if a channel is still playing. 71 | // Returns 0 if no longer playing, 1 if playing. 72 | int I_SoundIsPlaying(int handle); 73 | 74 | // Called by m_menu.c to let the quit sound play and quit right after it stops 75 | int I_AnySoundStillPlaying(void); 76 | 77 | // Updates the volume, separation, 78 | // and pitch of a sound channel. 79 | void I_UpdateSoundParams(int handle, int vol, int sep, int pitch); 80 | 81 | // 82 | // MUSIC I/O 83 | // 84 | void I_InitMusic(void); 85 | void I_ShutdownMusic(void); 86 | 87 | void I_UpdateMusic(void); 88 | 89 | // Volume. 90 | void I_SetMusicVolume(int volume); 91 | 92 | // PAUSE game handling. 93 | void I_PauseSong(int handle); 94 | void I_ResumeSong(int handle); 95 | 96 | // Registers a song handle to song data. 97 | int I_RegisterSong(const void *data, size_t len); 98 | 99 | // cournia - tries to load a music file 100 | int I_RegisterMusic( const char* filename, musicinfo_t *music ); 101 | 102 | // Called by anything that wishes to start music. 103 | // plays a song, and when the song is done, 104 | // starts playing it again in an endless loop. 105 | // Horrible thing to do, considering. 106 | void I_PlaySong(int handle, int looping); 107 | 108 | // Stops a song over 3 seconds. 109 | void I_StopSong(int handle); 110 | 111 | // See above (register), then think backwards 112 | void I_UnRegisterSong(int handle); 113 | 114 | // Allegro card support jff 1/18/98 115 | extern int snd_card; 116 | extern int mus_card; 117 | // CPhipps - put these in config file 118 | extern int snd_samplerate; 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /src/prboom/p_map.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Map functions 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __P_MAP__ 35 | #define __P_MAP__ 36 | 37 | #include "r_defs.h" 38 | #include "d_player.h" 39 | 40 | #define USERANGE (64*FRACUNIT) 41 | #define MELEERANGE (64*FRACUNIT) 42 | #define MISSILERANGE (32*64*FRACUNIT) 43 | 44 | // MAXRADIUS is for precalculated sector block boxes the spider demon 45 | // is larger, but we do not have any moving sectors nearby 46 | #define MAXRADIUS (32*FRACUNIT) 47 | 48 | // killough 3/15/98: add fourth argument to P_TryMove 49 | boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean dropoff); 50 | 51 | // killough 8/9/98: extra argument for telefragging 52 | boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y,boolean boss); 53 | void P_SlideMove(mobj_t *mo); 54 | boolean P_CheckSight(mobj_t *t1, mobj_t *t2); 55 | void P_UseLines(player_t *player); 56 | 57 | // killough 8/2/98: add 'mask' argument to prevent friends autoaiming at others 58 | fixed_t P_AimLineAttack(mobj_t *t1,angle_t angle,fixed_t distance, uint_64_t mask); 59 | 60 | void P_LineAttack(mobj_t *t1, angle_t angle, fixed_t distance, 61 | fixed_t slope, int damage ); 62 | void P_RadiusAttack(mobj_t *spot, mobj_t *source, int damage); 63 | boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y); 64 | 65 | //jff 3/19/98 P_CheckSector(): new routine to replace P_ChangeSector() 66 | boolean P_ChangeSector(sector_t* sector,boolean crunch); 67 | boolean P_CheckSector(sector_t *sector, boolean crunch); 68 | void P_DelSeclist(msecnode_t*); // phares 3/16/98 69 | void P_CreateSecNodeList(mobj_t*,fixed_t,fixed_t); // phares 3/14/98 70 | boolean Check_Sides(mobj_t *, int, int); // phares 71 | 72 | int P_GetMoveFactor(const mobj_t *mo, int *friction); // killough 8/28/98 73 | int P_GetFriction(const mobj_t *mo, int *factor); // killough 8/28/98 74 | void P_ApplyTorque(mobj_t *mo); // killough 9/12/98 75 | 76 | /* cphipps 2004/08/30 */ 77 | void P_MapStart(void); 78 | void P_MapEnd(void); 79 | 80 | // If "floatok" true, move would be ok if within "tmfloorz - tmceilingz". 81 | extern boolean floatok; 82 | extern boolean felldown; // killough 11/98: indicates object pushed off ledge 83 | extern fixed_t tmfloorz; 84 | extern fixed_t tmceilingz; 85 | extern line_t *ceilingline; 86 | extern line_t *floorline; // killough 8/23/98 87 | extern mobj_t *linetarget; // who got hit (or NULL) 88 | extern msecnode_t *sector_list; // phares 3/16/98 89 | extern fixed_t tmbbox[4]; // phares 3/20/98 90 | extern line_t *blockline; // killough 8/11/98 91 | 92 | #endif // __P_MAP__ 93 | -------------------------------------------------------------------------------- /src/prboom/lprintf.c: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * Provides a logical console output routine that allows what is 31 | * output to console normally and when output is redirected to 32 | * be controlled.. 33 | * 34 | *-----------------------------------------------------------------------------*/ 35 | 36 | #ifdef HAVE_CONFIG_H 37 | #include "config.h" 38 | #endif 39 | #ifdef _WIN32 40 | #define WIN32_LEAN_AND_MEAN 41 | #include 42 | #endif 43 | #ifdef _MSC_VER 44 | #include 45 | #endif 46 | #include 47 | #include 48 | #include 49 | #ifdef HAVE_UNISTD_H 50 | #include 51 | #endif 52 | #include "doomtype.h" 53 | #include "lprintf.h" 54 | #include "i_main.h" 55 | #include "m_argv.h" 56 | 57 | #include "rom/ets_sys.h" 58 | 59 | int cons_error_mask = -1-LO_INFO; /* all but LO_INFO when redir'd */ 60 | int cons_output_mask = -1; /* all output enabled */ 61 | 62 | /* cphipps - enlarged message buffer and made non-static 63 | * We still have to be careful here, this function can be called after exit 64 | */ 65 | #define MAX_MESSAGE_SIZE 2048 66 | 67 | 68 | //Esp32 doesn't use the 2K-sized stack-allocated string but directly passes args to vprintf. 69 | #if 1 70 | int lprintf(OutputLevels pri, const char *s, ...) { 71 | va_list v; 72 | va_start(v,s); 73 | vprintf(s,v); 74 | va_end(v); 75 | return 0; 76 | } 77 | #endif 78 | 79 | 80 | #if 0 81 | int lprintf(OutputLevels pri, const char *s, ...) 82 | { 83 | int r=0; 84 | // char msg[MAX_MESSAGE_SIZE]; 85 | int lvl=pri; 86 | 87 | va_list v; 88 | va_start(v,s); 89 | 90 | #ifdef HAVE_VSNPRINTF 91 | vsnprintf(msg,sizeof(msg),s,v); /* print message in buffer */ 92 | #else 93 | vsprintf(msg,s,v); 94 | #endif 95 | va_end(v); 96 | 97 | // r=ets_printf("%s",msg); /* select output at console */ 98 | 99 | return r; 100 | } 101 | #endif 102 | 103 | /* 104 | * I_Error 105 | * 106 | * cphipps - moved out of i_* headers, to minimise source files that depend on 107 | * the low-level headers. All this does is print the error, then call the 108 | * low-level safe exit function. 109 | * killough 3/20/98: add const 110 | */ 111 | 112 | void I_Error(const char *error, ...) 113 | { 114 | char errmsg[MAX_MESSAGE_SIZE]; 115 | va_list argptr; 116 | va_start(argptr,error); 117 | #ifdef HAVE_VSNPRINTF 118 | vsnprintf(errmsg,sizeof(errmsg),error,argptr); 119 | #else 120 | vsprintf(errmsg,error,argptr); 121 | #endif 122 | va_end(argptr); 123 | lprintf(LO_ERROR, "%s\n", errmsg); 124 | #ifdef _MSC_VER 125 | if (!M_CheckParm ("-nodraw")) { 126 | //Init_ConsoleWin(); 127 | MessageBox(con_hWnd,errmsg,"PrBoom",MB_OK | MB_TASKMODAL | MB_TOPMOST); 128 | } 129 | #endif 130 | I_SafeExit(-1); 131 | } 132 | -------------------------------------------------------------------------------- /src/prboom-esp32-compat/psxcontroller.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include "freertos/FreeRTOS.h" 17 | #include "freertos/task.h" 18 | #include "freertos/semphr.h" 19 | #include "freertos/queue.h" 20 | 21 | 22 | #include "driver/gpio.h" 23 | #include "soc/gpio_struct.h" 24 | #include "prboom-esp32-compat/psxcontroller.h" 25 | 26 | #include "sdkconfig.h" 27 | 28 | #define PSX_CLK CONFIG_HW_PSX_CLK 29 | #define PSX_DAT CONFIG_HW_PSX_DAT 30 | #define PSX_ATT CONFIG_HW_PSX_ATT 31 | #define PSX_CMD CONFIG_HW_PSX_CMD 32 | 33 | 34 | #define DELAY() asm("nop; nop; nop; nop;nop; nop; nop; nop;nop; nop; nop; nop;nop; nop; nop; nop;") 35 | 36 | #if CONFIG_HW_PSX_ENA 37 | 38 | 39 | /* Sends and receives a byte from/to the PSX controller using SPI */ 40 | static int psxSendRecv(int send) { 41 | int x; 42 | int ret=0; 43 | volatile int delay; 44 | 45 | #if 0 46 | while(1) { 47 | GPIO.out_w1ts=(1<>=1; 68 | send>>=1; 69 | if (GPIO.in&(1<monster attacks 81 | int default_monster_infighting=1; 82 | 83 | int monster_friction=1; // killough 10/98: monsters affected by friction 84 | int default_monster_friction=1; 85 | 86 | #ifdef DOGS 87 | int dogs, default_dogs; // killough 7/19/98: Marine's best friend :) 88 | int dog_jumping, default_dog_jumping; // killough 10/98 89 | #endif 90 | 91 | // killough 8/8/98: distance friends tend to move towards players 92 | int distfriend = 128, default_distfriend = 128; 93 | 94 | // killough 9/8/98: whether monsters are allowed to strafe or retreat 95 | int monster_backing, default_monster_backing; 96 | 97 | // killough 9/9/98: whether monsters are able to avoid hazards (e.g. crushers) 98 | int monster_avoid_hazards, default_monster_avoid_hazards; 99 | 100 | // killough 9/9/98: whether monsters help friends 101 | int help_friends, default_help_friends; 102 | 103 | int flashing_hom; // killough 10/98 104 | 105 | int doom_weapon_toggles; // killough 10/98 106 | 107 | int monkeys, default_monkeys; 108 | 109 | -------------------------------------------------------------------------------- /src/prboom/am_map.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * Copyright 2005, 2006 by 12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 13 | * 14 | * This program is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation; either version 2 17 | * of the License, or (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program; if not, write to the Free Software 26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 27 | * 02111-1307, USA. 28 | * 29 | * DESCRIPTION: 30 | * AutoMap module. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __AMMAP_H__ 35 | #define __AMMAP_H__ 36 | 37 | #include "d_event.h" 38 | 39 | #define MAPBITS 12 40 | #define FRACTOMAPBITS (FRACBITS-MAPBITS) 41 | 42 | // Used by ST StatusBar stuff. 43 | #define AM_MSGHEADER (('a'<<24)+('m'<<16)) 44 | #define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8)) 45 | #define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8)) 46 | 47 | // Called by main loop. 48 | boolean AM_Responder (event_t* ev); 49 | 50 | // Called by main loop. 51 | void AM_Ticker (void); 52 | 53 | // Called by main loop, 54 | // called instead of view drawer if automap active. 55 | void AM_Drawer (void); 56 | 57 | // Called to force the automap to quit 58 | // if the level is completed while it is up. 59 | void AM_Stop (void); 60 | 61 | // killough 2/22/98: for saving automap information in savegame: 62 | 63 | extern void AM_Start(void); 64 | 65 | //jff 4/16/98 make externally available 66 | 67 | extern void AM_clearMarks(void); 68 | 69 | typedef struct 70 | { 71 | fixed_t x,y; 72 | } mpoint_t; 73 | 74 | extern mpoint_t *markpoints; 75 | extern int markpointnum, markpointnum_max; 76 | 77 | // end changes -- killough 2/22/98 78 | 79 | // killough 5/2/98: moved from m_misc.c 80 | 81 | //jff 1/7/98 automap colors added 82 | extern int mapcolor_back; // map background 83 | extern int mapcolor_grid; // grid lines color 84 | extern int mapcolor_wall; // normal 1s wall color 85 | extern int mapcolor_fchg; // line at floor height change color 86 | extern int mapcolor_cchg; // line at ceiling height change color 87 | extern int mapcolor_clsd; // line at sector with floor=ceiling color 88 | extern int mapcolor_rkey; // red key color 89 | extern int mapcolor_bkey; // blue key color 90 | extern int mapcolor_ykey; // yellow key color 91 | extern int mapcolor_rdor; // red door color (diff from keys to allow option) 92 | extern int mapcolor_bdor; // blue door color (of enabling one not other) 93 | extern int mapcolor_ydor; // yellow door color 94 | extern int mapcolor_tele; // teleporter line color 95 | extern int mapcolor_secr; // secret sector boundary color 96 | //jff 4/23/98 97 | extern int mapcolor_exit; // exit line 98 | extern int mapcolor_unsn; // computer map unseen line color 99 | extern int mapcolor_flat; // line with no floor/ceiling changes 100 | extern int mapcolor_sprt; // general sprite color 101 | extern int mapcolor_item; // item sprite color 102 | extern int mapcolor_enemy; // enemy sprite color 103 | extern int mapcolor_frnd; // friendly sprite color 104 | extern int mapcolor_hair; // crosshair color 105 | extern int mapcolor_sngl; // single player arrow color 106 | extern int mapcolor_plyr[4]; // colors for players in multiplayer 107 | extern int mapcolor_me; // consoleplayer's chosen colour 108 | //jff 3/9/98 109 | extern int map_secret_after; // secrets do not appear til after bagged 110 | 111 | #endif 112 | --------------------------------------------------------------------------------