├── .gitattributes ├── .gitignore ├── CMakeLists.txt ├── README.md ├── builddoom.sh ├── components ├── odroid-go │ ├── CMakeLists.txt │ ├── fonts │ │ ├── DefaultFont.c │ │ ├── DejaVuSans18.c │ │ └── DejaVuSans24.h │ ├── input.c │ ├── input.h │ ├── odroid.c │ ├── odroid.h │ ├── sdcard.c │ ├── sdcard.h │ ├── sound.c │ ├── sound.h │ ├── spi_lcd.c │ └── spi_lcd.h └── prboom │ ├── AUTHORS │ ├── CMakeLists.txt │ ├── COPYING │ ├── am_map.c │ ├── am_map.h │ ├── config.h │ ├── d_client.c │ ├── d_deh.c │ ├── d_deh.h │ ├── d_englsh.h │ ├── d_event.h │ ├── d_items.c │ ├── d_items.h │ ├── d_main.c │ ├── d_main.h │ ├── d_net.h │ ├── d_player.h │ ├── d_server.c │ ├── d_think.h │ ├── d_ticcmd.h │ ├── dbopl.c │ ├── dbopl.h │ ├── doomdata.h │ ├── doomdef.c │ ├── doomdef.h │ ├── doomstat.c │ ├── doomstat.h │ ├── doomtype.h │ ├── dstrings.c │ ├── dstrings.h │ ├── f_finale.c │ ├── f_finale.h │ ├── f_wipe.c │ ├── f_wipe.h │ ├── g_game.c │ ├── g_game.h │ ├── gl_intern.h │ ├── gl_main.c │ ├── gl_struct.h │ ├── gl_texture.c │ ├── hu_lib.c │ ├── hu_lib.h │ ├── hu_stuff.c │ ├── hu_stuff.h │ ├── i_joy.h │ ├── i_main.h │ ├── i_network.h │ ├── i_sound.h │ ├── i_system.h │ ├── i_video.h │ ├── info.c │ ├── info.h │ ├── lprintf.c │ ├── lprintf.h │ ├── m_argv.c │ ├── m_argv.h │ ├── m_bbox.c │ ├── m_bbox.h │ ├── m_cheat.c │ ├── m_cheat.h │ ├── m_fixed.h │ ├── m_menu.c │ ├── m_menu.h │ ├── m_misc.c │ ├── m_misc.h │ ├── m_random.c │ ├── m_random.h │ ├── m_swap.h │ ├── md5.c │ ├── md5.c.x │ ├── md5.h │ ├── midifile.c │ ├── midifile.h │ ├── mmus2mid.c │ ├── mmus2mid.h │ ├── opl.c │ ├── opl.h │ ├── opl_queue.c │ ├── opl_queue.h │ ├── oplplayer.c │ ├── oplplayer.h │ ├── p_ceilng.c │ ├── p_checksum.c │ ├── p_checksum.h │ ├── p_doors.c │ ├── p_enemy.c │ ├── p_enemy.h │ ├── p_floor.c │ ├── p_genlin.c │ ├── p_inter.c │ ├── p_inter.h │ ├── p_lights.c │ ├── p_map.c │ ├── p_map.h │ ├── p_maputl.c │ ├── p_maputl.h │ ├── p_mobj.c │ ├── p_mobj.h │ ├── p_plats.c │ ├── p_pspr.c │ ├── p_pspr.h │ ├── p_saveg.c │ ├── p_saveg.h │ ├── p_setup.c │ ├── p_setup.h │ ├── p_sight.c │ ├── p_spec.c │ ├── p_spec.h │ ├── p_switch.c │ ├── p_telept.c │ ├── p_tick.c │ ├── p_tick.h │ ├── p_user.c │ ├── p_user.h │ ├── protocol.h │ ├── r_bsp.c │ ├── r_bsp.h │ ├── r_data.c │ ├── r_data.h │ ├── r_defs.h │ ├── r_demo.c │ ├── r_demo.h │ ├── r_draw.c │ ├── r_draw.h │ ├── r_drawcolpipeline.inl │ ├── r_drawcolumn.inl │ ├── r_drawflush.inl │ ├── r_drawspan.inl │ ├── r_filter.c │ ├── r_filter.h │ ├── r_fps.c │ ├── r_fps.h │ ├── r_main.c │ ├── r_main.h │ ├── r_patch.c │ ├── r_patch.h │ ├── r_plane.c │ ├── r_plane.h │ ├── r_segs.c │ ├── r_segs.h │ ├── r_sky.c │ ├── r_sky.h │ ├── r_state.h │ ├── r_things.c │ ├── r_things.h │ ├── readme.txt │ ├── s_sound.c │ ├── s_sound.h │ ├── sounds.c │ ├── sounds.h │ ├── st_lib.c │ ├── st_lib.h │ ├── st_stuff.c │ ├── st_stuff.h │ ├── tables.c │ ├── tables.h │ ├── tables │ ├── GAMMATBL.c │ ├── SINETABL.c │ ├── TANGTABL.c │ └── TANTOANG.c │ ├── v_video.c │ ├── v_video.h │ ├── version.c │ ├── version.h │ ├── w_memcache.c.disabled │ ├── w_mmap.c │ ├── w_wad.c │ ├── w_wad.h │ ├── wi_stuff.c │ ├── wi_stuff.h │ ├── z_bmalloc.c │ ├── z_bmalloc.h │ ├── z_zone.c │ └── z_zone.h ├── data ├── doom1.wad ├── prboom.wad └── src-20190922.zip ├── debug.sh ├── main ├── CMakeLists.txt ├── i_main.c ├── i_sound.c ├── i_system.c ├── i_video.c └── main.c ├── sdkconfig ├── tile.raw └── tools └── mkfw.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | *.c linguist-language=C 4 | *.h linguist-language=C 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.gch 3 | sdkconfig.old 4 | .vscode/ 5 | *.fw -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 3 | set(EXTRA_COMPONENT_DIRS "components") 4 | project(doom-esp32) 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This port is now abandoned. 2 | I have made a new port as part of [Retro-Go](https://github.com/ducalex/retro-go/). Memory usage has been greatly improved and stuttering has been eliminated. 3 | Retro-Go can be built with only DOOM enabled so there is no point in also maintaining this standalone port. 4 | 5 | 6 | 7 | # Description 8 | 9 | This is an improvement of [doom-ng-odroid-go](https://github.com/mad-ady/doom-ng-odroid-go/) which itself is an improvement of [doom-odroid-go](https://github.com/OtherCrashOverride/doom-odroid-go/). 10 | 11 | ## New features 12 | 13 | - Full sound support 14 | - Save games 15 | - Brightness controls 16 | - Volume controls 17 | - WAD selector on start 18 | - Mods support (Limited by available memory) 19 | - Cheats menu (Options -> Cheats) 20 | - Levels menu (Options -> Level Select) 21 | 22 | # Usage 23 | 24 | Copy Doom-*.fw to your SD Card folder `odroid/firmware` and PRBOOM.WAD and DOOM.WAD to `roms/doom`. Power up the Odroid GO while holding B. Then flash Doom from the menu. You can add more than one WAD at a time, a prompt will be shown on power up. 25 | 26 | # Controls 27 | 28 | Key | Action 29 | -------|-- 30 | A | Fire 31 | B | Strafe 32 | START | Action/Open doors 33 | SELECT | Change weapon 34 | VOLUME | Map 35 | MENU | Menu 36 | START+UP | Brightness up 37 | START+DOWN | Brightness down 38 | START+LEFT | Sound down 39 | START+RIGHT | Sound up 40 | 41 | 42 | # To do / Known issues 43 | 44 | - Fix the random lags. It might be caused by SD card access on the shared bus. 45 | - Fix the memory allocation failures due to memory fragmentation (especially when switching levels) 46 | - Make it possible to delete savegames. 47 | - Add support for external DAC 48 | 49 | # Compilation 50 | 51 | ## ESP-IDF 4.x 52 | ESP-IDF version 4.0.1 or greater is required to compile the current code. 53 | 54 | - `idf.py app` 55 | - `./tools/mkfw.py doom.fw "Doom" tile.raw 0 0 0 app build/doom-esp32.bin` 56 | 57 | 58 | ## ESP-IDF 3.3 59 | Release 20190922 is the last one that can be built with ESP-IDF 3.3. 60 | There is a zipped snapshot in the `data` folder, in case the git history gets lost. 61 | 62 | - `./builddoom.sh` 63 | -------------------------------------------------------------------------------- /builddoom.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | release=`date +%Y%m%d`; 4 | idf.py app 5 | ./tools/mkfw.py Doom-$release.fw "Doom ($release)" tile.raw 0 16 1572864 app build/doom-esp32.bin 6 | -------------------------------------------------------------------------------- /components/odroid-go/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT_SRCDIRS ".") 2 | set(COMPONENT_ADD_INCLUDEDIRS ".") 3 | set(COMPONENT_REQUIRES "nvs_flash spi_flash fatfs freertos") 4 | 5 | register_component() -------------------------------------------------------------------------------- /components/odroid-go/input.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of odroid-go-std-lib. 3 | * Copyright (c) 2019 ducalex. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | 20 | #define ODROID_GAMEPAD_IO_X ADC1_CHANNEL_6 21 | #define ODROID_GAMEPAD_IO_Y ADC1_CHANNEL_7 22 | #define ODROID_GAMEPAD_IO_SELECT GPIO_NUM_27 23 | #define ODROID_GAMEPAD_IO_START GPIO_NUM_39 24 | #define ODROID_GAMEPAD_IO_A GPIO_NUM_32 25 | #define ODROID_GAMEPAD_IO_B GPIO_NUM_33 26 | #define ODROID_GAMEPAD_IO_MENU GPIO_NUM_13 27 | #define ODROID_GAMEPAD_IO_VOLUME GPIO_NUM_0 28 | 29 | enum 30 | { 31 | ODROID_INPUT_UP = 0, 32 | ODROID_INPUT_RIGHT, 33 | ODROID_INPUT_DOWN, 34 | ODROID_INPUT_LEFT, 35 | ODROID_INPUT_SELECT, 36 | ODROID_INPUT_START, 37 | ODROID_INPUT_A, 38 | ODROID_INPUT_B, 39 | ODROID_INPUT_MENU, 40 | ODROID_INPUT_VOLUME, 41 | 42 | ODROID_INPUT_MAX 43 | }; 44 | 45 | typedef struct 46 | { 47 | uint8_t values[ODROID_INPUT_MAX]; 48 | uint8_t previous[ODROID_INPUT_MAX]; 49 | uint8_t debounce[ODROID_INPUT_MAX]; 50 | uint8_t realtime[ODROID_INPUT_MAX]; 51 | } odroid_input_state; 52 | 53 | odroid_input_state odroid_input_get_state(void); 54 | void odroid_input_set_callback(void (*callback)(odroid_input_state)); 55 | int odroid_input_wait_for_button_press(int ticks); 56 | void odroid_input_init(void); 57 | -------------------------------------------------------------------------------- /components/odroid-go/odroid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of odroid-go-std-lib. 3 | * Copyright (c) 2019 ducalex. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "freertos/FreeRTOS.h" 19 | #include "freertos/task.h" 20 | #include "freertos/semphr.h" 21 | #include "esp_heap_caps.h" 22 | #include "driver/gpio.h" 23 | #include "odroid.h" 24 | #include "nvs_flash.h" 25 | #include "nvs.h" 26 | 27 | static SemaphoreHandle_t spiLock = NULL; 28 | 29 | size_t free_bytes_total() 30 | { 31 | multi_heap_info_t info; 32 | heap_caps_get_info(&info, MALLOC_CAP_DEFAULT); 33 | return info.total_free_bytes; 34 | } 35 | 36 | size_t free_bytes_internal() 37 | { 38 | multi_heap_info_t info; 39 | heap_caps_get_info(&info, MALLOC_CAP_INTERNAL); 40 | return info.total_free_bytes; 41 | } 42 | 43 | size_t free_bytes_spiram() 44 | { 45 | multi_heap_info_t info; 46 | heap_caps_get_info(&info, MALLOC_CAP_SPIRAM); 47 | return info.total_free_bytes; 48 | } 49 | 50 | void odroid_system_init() 51 | { 52 | // NVS Flash 53 | if (nvs_flash_init() != ESP_OK) { 54 | nvs_flash_erase(); 55 | nvs_flash_init(); 56 | } 57 | 58 | // SPI 59 | spiLock = xSemaphoreCreateMutex(); 60 | 61 | // LED 62 | gpio_set_direction(GPIO_NUM_2, GPIO_MODE_OUTPUT); 63 | gpio_set_level(GPIO_NUM_2, 0); 64 | 65 | // SD Card (needs to be before LCD) 66 | odroid_sdcard_init(); 67 | 68 | // LCD 69 | spi_lcd_init(); 70 | 71 | // Input 72 | odroid_input_init(); 73 | 74 | // Sound 75 | odroid_sound_init(); 76 | } 77 | 78 | void odroid_system_led_set(int value) 79 | { 80 | gpio_set_level(GPIO_NUM_2, value); 81 | } 82 | 83 | void odroid_system_sleep() 84 | { 85 | 86 | } 87 | 88 | int odroid_system_battery_level() 89 | { 90 | return 0; 91 | } 92 | 93 | void odroid_fatal_error(const char *error) 94 | { 95 | printf("Error: %s\n", error); 96 | spi_lcd_init(); 97 | spi_lcd_fb_setPalette(NULL); 98 | spi_lcd_fb_clear(); 99 | spi_lcd_fb_printf(0, 0, "A fatal error occurred :("); 100 | spi_lcd_fb_printf(0, 50, "%s", error); 101 | spi_lcd_fb_flush(); 102 | odroid_sound_deinit(); 103 | exit(-1); 104 | } 105 | 106 | void inline odroid_spi_bus_acquire() 107 | { 108 | xSemaphoreTake(spiLock, portMAX_DELAY); 109 | } 110 | 111 | void inline odroid_spi_bus_release() 112 | { 113 | xSemaphoreGive(spiLock); 114 | } 115 | -------------------------------------------------------------------------------- /components/odroid-go/odroid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of odroid-go-std-lib. 3 | * Copyright (c) 2019 ducalex. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "esp_heap_caps.h" 19 | #include "spi_lcd.h" 20 | #include "sdcard.h" 21 | #include "sound.h" 22 | #include "input.h" 23 | 24 | #define PIN_NUM_MISO 19 25 | #define PIN_NUM_MOSI 23 26 | #define PIN_NUM_CLK 18 27 | #define PIN_NUM_DC 21 28 | #define PIN_NUM_LCD_CS 5 29 | #define PIN_NUM_SD_CS 22 30 | #define PIN_NUM_LCD_BCKL 14 31 | #define SPI_DMA_CHANNEL 2 32 | 33 | size_t free_bytes_total(); 34 | size_t free_bytes_internal(); 35 | size_t free_bytes_spiram(); 36 | 37 | void odroid_system_init(); 38 | void odroid_system_led_set(int value); 39 | void odroid_spi_bus_acquire(); 40 | void odroid_spi_bus_release(); 41 | void odroid_fatal_error(const char *error); 42 | -------------------------------------------------------------------------------- /components/odroid-go/sdcard.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of odroid-go-std-lib. 3 | * Copyright (c) 2019 ducalex. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "esp_vfs_fat.h" 24 | #include "driver/sdmmc_host.h" 25 | #include "driver/sdspi_host.h" 26 | #include "sdmmc_cmd.h" 27 | #include "odroid.h" 28 | 29 | static bool sdcard_initialized = false; 30 | 31 | 32 | void odroid_sdcard_init() 33 | { 34 | if (sdcard_initialized) return; 35 | 36 | printf("odroid_sdcard_init: Initializing SD Card.\n"); 37 | 38 | sdmmc_host_t host = SDSPI_HOST_DEFAULT(); 39 | host.slot = HSPI_HOST; // HSPI_HOST; 40 | host.max_freq_khz = SDMMC_FREQ_DEFAULT; 41 | 42 | sdspi_slot_config_t slot_config = SDSPI_SLOT_CONFIG_DEFAULT(); 43 | slot_config.gpio_miso = PIN_NUM_MISO; 44 | slot_config.gpio_mosi = PIN_NUM_MOSI; 45 | slot_config.gpio_sck = PIN_NUM_CLK; 46 | slot_config.gpio_cs = PIN_NUM_SD_CS; 47 | slot_config.dma_channel = SPI_DMA_CHANNEL; 48 | 49 | esp_vfs_fat_sdmmc_mount_config_t mount_config = { 50 | .format_if_mount_failed = false, 51 | .max_files = 8 52 | }; 53 | 54 | sdmmc_card_t* card; 55 | 56 | odroid_spi_bus_acquire(); 57 | esp_err_t ret = esp_vfs_fat_sdmmc_mount("/sdcard", &host, &slot_config, &mount_config, &card); 58 | odroid_spi_bus_release(); 59 | 60 | if (ret != ESP_OK) { 61 | if (ret == ESP_FAIL) { 62 | odroid_fatal_error("odroid_sdcard_init: Failed to mount filesystem."); 63 | } else { 64 | odroid_fatal_error("odroid_sdcard_init: Failed to initialize the card."); 65 | } 66 | } else { 67 | sdcard_initialized = true; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /components/odroid-go/sdcard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of odroid-go-std-lib. 3 | * Copyright (c) 2019 ducalex. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | void odroid_sdcard_init(void); 19 | -------------------------------------------------------------------------------- /components/odroid-go/sound.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of odroid-go-std-lib. 3 | * Copyright (c) 2019 ducalex. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "freertos/FreeRTOS.h" 19 | #include "freertos/queue.h" 20 | #include "freertos/task.h" 21 | #include "driver/i2s.h" 22 | #include "odroid.h" 23 | 24 | #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 2, 0) 25 | #define I2S_COMM_FORMAT_STAND_I2S (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB) 26 | #define I2S_COMM_FORMAT_STAND_MSB (I2S_COMM_FORMAT_I2S |I2S_COMM_FORMAT_I2S_LSB) 27 | #endif 28 | 29 | #define SAMPLESIZE 2 // 16bit 30 | #define SAMPLERATE 22050 31 | 32 | static bool sound_initialized = false; 33 | 34 | 35 | void odroid_sound_init(void) 36 | { 37 | if (sound_initialized) return; 38 | 39 | printf("odroid_sound_init: Initializing sound.\n"); 40 | 41 | static const i2s_config_t i2s_config = { 42 | .mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN, 43 | .sample_rate = SAMPLERATE, 44 | .bits_per_sample = SAMPLESIZE * 8, /* the DAC module will only take the 8bits from MSB */ 45 | .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, 46 | .communication_format = I2S_COMM_FORMAT_STAND_MSB, 47 | .intr_alloc_flags = 0, // default interrupt priority 48 | .dma_buf_count = 2, 49 | .dma_buf_len = 512, // (2) 16bit channels 50 | .use_apll = false 51 | }; 52 | 53 | esp_err_t ret = i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL); //install and start i2s driver 54 | 55 | if (ret != ESP_OK) { 56 | odroid_fatal_error("odroid_sound_init: Failed to initialize I2S."); 57 | } 58 | 59 | i2s_set_pin(I2S_NUM_0, NULL); //for internal DAC, this will enable both of the internal channels 60 | 61 | i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN); 62 | } 63 | 64 | 65 | void odroid_sound_deinit() 66 | { 67 | i2s_driver_uninstall(I2S_NUM_0); 68 | sound_initialized = false; 69 | } 70 | 71 | 72 | size_t odroid_sound_write(void *buffer, size_t length) 73 | { 74 | size_t bytesWritten = 0; 75 | i2s_write(I2S_NUM_0, buffer, length, &bytesWritten, portMAX_DELAY); 76 | return bytesWritten; 77 | } 78 | 79 | 80 | void odroid_sound_set_sample_rate(uint32_t rate) 81 | { 82 | i2s_set_sample_rates(I2S_NUM_0, rate); //set sample rates 83 | } 84 | 85 | 86 | void odroid_sound_set_volume(uint32_t rate) 87 | { 88 | 89 | } 90 | -------------------------------------------------------------------------------- /components/odroid-go/sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of odroid-go-std-lib. 3 | * Copyright (c) 2019 ducalex. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #define ODROID_SAMPLE_RATE 22050 19 | size_t odroid_sound_write(void *buffer, size_t length); 20 | void odroid_sound_set_sample_rate(uint32_t rate); 21 | void odroid_sound_deinit(void); 22 | void odroid_sound_init(void); 23 | -------------------------------------------------------------------------------- /components/odroid-go/spi_lcd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of odroid-go-std-lib. 3 | * Copyright (c) 2019 ducalex. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | typedef struct { 19 | uint8_t charCode; 20 | int adjYOffset; 21 | int width; 22 | int height; 23 | int xOffset; 24 | int xDelta; 25 | uint16_t dataPtr; 26 | } propFont; 27 | 28 | #define MADCTL_MY 0x80 29 | #define MADCTL_MX 0x40 30 | #define MADCTL_MV 0x20 31 | #define MADCTL_ML 0x10 32 | #define MADCTL_MH 0x04 33 | #define TFT_RGB_BGR 0x08 34 | #define TFT_LED_DUTY_MAX 0x1fff 35 | #define LCD_CMD 0 36 | #define LCD_DATA 1 37 | 38 | short backlight_percentage_get(void); 39 | void backlight_percentage_set(short level); 40 | 41 | void spi_lcd_init(); 42 | void spi_lcd_cmd(uint8_t cmd); 43 | void spi_lcd_data(uint8_t *data, int len); 44 | void spi_lcd_wait_finish(); 45 | void spi_lcd_fb_flush(); 46 | void spi_lcd_fb_setPalette(const uint16_t *palette); 47 | void spi_lcd_fb_setptr(uint8_t *buffer); 48 | void spi_lcd_fb_write(uint8_t *buffer); 49 | void spi_lcd_fb_clear(); 50 | void spi_lcd_fb_drawPixel(int x, int y, uint16_t color); 51 | void spi_lcd_fb_setFont(const uint8_t *font); 52 | void spi_lcd_fb_setFontColor(uint16_t color); 53 | void spi_lcd_fb_print(int x, int y, const char *string); 54 | void spi_lcd_fb_printf(int x, int y, const char *string, ...); 55 | -------------------------------------------------------------------------------- /components/prboom/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT_SRCDIRS ". tables") 2 | set(COMPONENT_ADD_INCLUDEDIRS ".") 3 | set(COMPONENT_REQUIRES "odroid-go") 4 | register_component() 5 | component_compile_options(-Wno-error=char-subscripts -Wno-error=unused-value -Wno-error=parentheses -Wno-error=int-to-pointer-cast -Wno-pointer-sign -Wno-error=unused-but-set-parameter -Wno-error=maybe-uninitialized -Wno-missing-field-initializers -O3 -DHAVE_CONFIG_H) 6 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | // Location for any defines turned variables. 43 | // None. 44 | 45 | -------------------------------------------------------------------------------- /components/prboom/doomstat.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 | * Put all global state variables here. 31 | * 32 | *----------------------------------------------------------------------------- 33 | */ 34 | 35 | #ifdef __GNUG__ 36 | #pragma implementation "doomstat.h" 37 | #endif 38 | #include "doomstat.h" 39 | 40 | // Game Mode - identify IWAD as shareware, retail etc. 41 | GameMode_t gamemode = indetermined; 42 | GameMission_t gamemission = doom; 43 | 44 | // Language. 45 | Language_t language = english; 46 | 47 | // Set if homebrew PWAD stuff has been added. 48 | boolean modifiedgame; 49 | 50 | //----------------------------------------------------------------------------- 51 | 52 | // CPhipps - compatibility vars 53 | complevel_t compatibility_level, default_compatibility_level; 54 | 55 | int comp[COMP_TOTAL], default_comp[COMP_TOTAL]; // killough 10/98 56 | 57 | // v1.1-like pitched sounds 58 | int pitched_sounds; // killough 59 | 60 | int default_translucency; // config file says // phares 61 | boolean general_translucency; // true if translucency is ok // phares 62 | 63 | int demo_insurance, default_demo_insurance; // killough 1/16/98 64 | 65 | int allow_pushers = 1; // MT_PUSH Things // phares 3/10/98 66 | int default_allow_pushers; // killough 3/1/98: make local to each game 67 | 68 | int variable_friction = 1; // ice & mud // phares 3/10/98 69 | int default_variable_friction; // killough 3/1/98: make local to each game 70 | 71 | int weapon_recoil; // weapon recoil // phares 72 | int default_weapon_recoil; // killough 3/1/98: make local to each game 73 | 74 | int player_bobbing; // whether player bobs or not // phares 2/25/98 75 | int default_player_bobbing; // killough 3/1/98: make local to each game 76 | 77 | int monsters_remember; // killough 3/1/98 78 | int default_monsters_remember; 79 | 80 | int monster_infighting=1; // killough 7/19/98: monster<=>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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/prboom/dstrings.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 strings, by language. 31 | * Note: In BOOM, some new strings hav ebeen defined that are 32 | * not found in the French version. A better approach is 33 | * to create a BEX text-replacement file for other 34 | * languages since any language can be supported that way 35 | * without recompiling the program. 36 | * 37 | *-----------------------------------------------------------------------------*/ 38 | 39 | #ifndef __DSTRINGS__ 40 | #define __DSTRINGS__ 41 | 42 | /* All important printed strings. 43 | * Language selection (message strings). 44 | * Use -DFRENCH etc. 45 | */ 46 | 47 | #ifdef FRENCH 48 | #include "d_french.h" 49 | #else 50 | #include "d_englsh.h" 51 | #endif 52 | 53 | /* Note this is not externally modifiable through DEH/BEX 54 | * Misc. other strings. 55 | * #define SAVEGAMENAME "boomsav" * killough 3/22/98 * 56 | * Ty 05/04/98 - replaced with a modifiable string, see d_deh.c 57 | */ 58 | 59 | /* 60 | * File locations, 61 | * relative to current position. 62 | * Path names are OS-sensitive. 63 | */ 64 | #define DEVMAPS "devmaps" 65 | #define DEVDATA "devdata" 66 | 67 | 68 | /* Not done in french? 69 | * QuitDOOM messages * 70 | * killough 1/18/98: 71 | * replace hardcoded limit with extern var (silly hack, I know) 72 | */ 73 | 74 | #include 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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | boolean I_SoundIsPlaying(int handle); 73 | 74 | // Called by m_menu.c to let the quit sound play and quit right after it stops 75 | boolean 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 | -------------------------------------------------------------------------------- /components/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 | boolean 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 | const char *I_DoomSaveDir(void); // path to savefile dir 68 | 69 | char* I_FindFile(const char* wfname, const char* ext); 70 | 71 | /* cph 2001/11/18 - wrapper for read(2) which deals with partial reads */ 72 | void I_Read(int fd, void* buf, size_t sz); 73 | 74 | /* cph 2001/11/18 - Move W_Filelength to i_system.c */ 75 | int I_Filelength(int handle); 76 | 77 | void I_SetAffinityMask(void); 78 | 79 | 80 | int doom_main(int argc, char const * const * argv); 81 | 82 | int I_Lseek(int fd, off_t offset, int whence); 83 | int I_Open(const char *wad, int flags); 84 | void I_Close(int fd); 85 | 86 | void I_BeginDiskAccess(void); 87 | void I_EndDiskAccess(void); 88 | 89 | //HACK mmap support, w_mmap.c 90 | #define PROT_READ 1 91 | #define MAP_SHARED 2 92 | #define MAP_FAILED (void*)-1 93 | 94 | void *I_Mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); 95 | int I_Munmap(void *addr, size_t length); 96 | 97 | int isValidPtr(void *ptr); 98 | void freeUnusedMmaps(void); 99 | #endif 100 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 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 | 131 | odroid_fatal_error(errmsg); 132 | 133 | I_SafeExit(-1); 134 | } 135 | -------------------------------------------------------------------------------- /components/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 | extern int cons_output_mask; 54 | extern int cons_error_mask; 55 | 56 | /* killough 3/20/98: add const 57 | * killough 4/25/98: add gcc attributes 58 | * cphipps 01/11- moved from i_system.h */ 59 | void I_Error(const char *error, ...) __attribute__((format(printf,1,2))); 60 | 61 | #ifdef _WIN32 62 | void I_ConTextAttr(unsigned char a); 63 | void I_UpdateConsole(void); 64 | int Init_ConsoleWin(void); 65 | void Done_ConsoleWin(void); 66 | #endif 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 const char * 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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/prboom/m_misc.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 | * External non-system-specific stuff, like storing config settings, 31 | * simple file handling, and saving screnshots. 32 | * 33 | *-----------------------------------------------------------------------------*/ 34 | 35 | 36 | #ifndef __M_MISC__ 37 | #define __M_MISC__ 38 | 39 | 40 | #include "doomtype.h" 41 | // 42 | // MISC 43 | // 44 | 45 | boolean M_WriteFile (char const* name,void* source,int length); 46 | 47 | int M_ReadFile (char const* name,byte** buffer); 48 | 49 | void M_ScreenShot (void); 50 | void M_DoScreenShot (const char*); // cph 51 | 52 | void M_LoadDefaults (void); 53 | 54 | void M_SaveDefaults (void); 55 | 56 | struct default_s *M_LookupDefault(const char *name); /* killough 11/98 */ 57 | 58 | // phares 4/21/98: 59 | // Moved from m_misc.c so m_menu.c could see it. 60 | 61 | // CPhipps - struct to hold a value in a config file 62 | // Cannot be a union, as it must be initialised 63 | typedef struct default_s 64 | { 65 | const char* name; 66 | /* cph - 67 | * The location struct holds the pointer to the variable holding the 68 | * setting. For int's we do nothing special. 69 | * For strings, the string is actually stored on our heap with Z_Strdup() 70 | * BUT we don't want the rest of the program to be able to modify them, 71 | * so we declare it const. It's not really const though, and m_misc.c and 72 | * m_menu.c cast it back when they need to change it. Possibly this is 73 | * more trouble than it's worth. 74 | */ 75 | struct { 76 | int* pi; 77 | const char** ppsz; 78 | } location; 79 | struct { 80 | int i; 81 | const char* psz; 82 | } defaultvalue; // CPhipps - default value 83 | // Limits (for an int) 84 | int minvalue; // jff 3/3/98 minimum allowed value 85 | int maxvalue; // jff 3/3/98 maximum allowed value 86 | enum { 87 | def_none, // Dummy entry 88 | def_str, // A string 89 | def_int, // Integer 90 | def_hex, // Integer (write in hex) 91 | def_bool = def_int, // Boolean 92 | def_key = def_hex, // Key code (byte) 93 | def_mouseb = def_int,// Mouse button 94 | def_colour = def_hex // Colour (256 colour palette entry) 95 | } type; // CPhipps - type of entry 96 | int setupscreen; // phares 4/19/98: setup screen where this appears 97 | int *current; /* cph - MBF-like pointer to current value */ 98 | // cph - removed the help strings from the config file 99 | // const char* help; // jff 3/3/98 description of parameter 100 | // CPhipps - remove unused "lousy hack" code 101 | struct setup_menu_s *setup_menu; /* Xref to setup menu item, if any */ 102 | } default_t; 103 | 104 | #define IS_STRING(dv) ((dv).type == def_str) 105 | // CPhipps - What is the max. key code that X will send us? 106 | #define MAX_KEY 65536 107 | #define MAX_MOUSEB 2 108 | 109 | #define UL (-123456789) /* magic number for no min or max for parameter */ 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/prboom/opl.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2009 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // DESCRIPTION: 22 | // OPL interface. 23 | // 24 | //----------------------------------------------------------------------------- 25 | 26 | 27 | #ifndef OPL_OPL_H 28 | #define OPL_OPL_H 29 | 30 | typedef void (*opl_callback_t)(void *data); 31 | 32 | typedef enum 33 | { 34 | OPL_REGISTER_PORT = 0, 35 | OPL_DATA_PORT = 1 36 | } opl_port_t; 37 | 38 | #define OPL_NUM_OPERATORS 21 39 | #define OPL_NUM_VOICES 9 40 | 41 | #define OPL_REG_WAVEFORM_ENABLE 0x01 42 | #define OPL_REG_TIMER1 0x02 43 | #define OPL_REG_TIMER2 0x03 44 | #define OPL_REG_TIMER_CTRL 0x04 45 | #define OPL_REG_FM_MODE 0x08 46 | 47 | // Operator registers (21 of each): 48 | 49 | #define OPL_REGS_TREMOLO 0x20 50 | #define OPL_REGS_LEVEL 0x40 51 | #define OPL_REGS_ATTACK 0x60 52 | #define OPL_REGS_SUSTAIN 0x80 53 | #define OPL_REGS_WAVEFORM 0xE0 54 | 55 | // Voice registers (9 of each): 56 | 57 | #define OPL_REGS_FREQ_1 0xA0 58 | #define OPL_REGS_FREQ_2 0xB0 59 | #define OPL_REGS_FEEDBACK 0xC0 60 | 61 | // 62 | // Low-level functions. 63 | // 64 | 65 | // Initialize the OPL subsystem. 66 | 67 | int OPL_Init(unsigned int port_base); 68 | 69 | // Shut down the OPL subsystem. 70 | 71 | void OPL_Shutdown(void); 72 | 73 | 74 | // Write to one of the OPL I/O ports: 75 | 76 | void OPL_WritePort(opl_port_t port, unsigned int value); 77 | 78 | // Read from one of the OPL I/O ports: 79 | 80 | unsigned int OPL_ReadPort(opl_port_t port); 81 | 82 | // 83 | // Higher-level functions. 84 | // 85 | 86 | // Read the cuurrent status byte of the OPL chip. 87 | 88 | unsigned int OPL_ReadStatus(void); 89 | 90 | // Write to an OPL register. 91 | 92 | void OPL_WriteRegister(int reg, int value); 93 | 94 | // Perform a detection sequence to determine that an 95 | // OPL chip is present. 96 | 97 | int OPL_Detect(void); 98 | 99 | // Initialize all registers, performed on startup. 100 | 101 | void OPL_InitRegisters(void); 102 | 103 | 104 | // Block until the specified number of milliseconds have elapsed. 105 | 106 | void OPL_Delay(unsigned int ms); 107 | 108 | // Pause the OPL callbacks. 109 | 110 | void OPL_SetPaused(int paused); 111 | 112 | 113 | extern unsigned int opl_sample_rate; 114 | 115 | void OPL_Render_Samples (void *dest, unsigned nsamp); 116 | 117 | 118 | void OPL_SetCallback(unsigned int ms, opl_callback_t callback, void *data); 119 | 120 | void OPL_ClearCallbacks(void); 121 | 122 | #endif 123 | 124 | -------------------------------------------------------------------------------- /components/prboom/opl_queue.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2009 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // DESCRIPTION: 22 | // OPL callback queue. 23 | // 24 | //----------------------------------------------------------------------------- 25 | 26 | #ifndef OPL_QUEUE_H 27 | #define OPL_QUEUE_H 28 | 29 | #include "opl.h" 30 | 31 | typedef struct opl_callback_queue_s opl_callback_queue_t; 32 | 33 | opl_callback_queue_t *OPL_Queue_Create(void); 34 | int OPL_Queue_IsEmpty(opl_callback_queue_t *queue); 35 | void OPL_Queue_Clear(opl_callback_queue_t *queue); 36 | void OPL_Queue_Destroy(opl_callback_queue_t *queue); 37 | void OPL_Queue_Push(opl_callback_queue_t *queue, 38 | opl_callback_t callback, void *data, 39 | unsigned int time); 40 | int OPL_Queue_Pop(opl_callback_queue_t *queue, 41 | opl_callback_t *callback, void **data); 42 | unsigned int OPL_Queue_Peek(opl_callback_queue_t *queue); 43 | 44 | #endif /* #ifndef OPL_QUEUE_H */ 45 | 46 | -------------------------------------------------------------------------------- /components/prboom/oplplayer.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1996 Id Software, Inc. 5 | // Copyright(C) 2005 Simon Howard 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | // DESCRIPTION: 23 | // System interface for music. 24 | // 25 | //----------------------------------------------------------------------------- 26 | 27 | 28 | #ifndef OPLPLAYER_H 29 | #define OPLPLAYER_H 30 | 31 | typedef struct 32 | { 33 | // descriptive name of the player, such as "OPL2 Synth" 34 | const char *(*name)(void); 35 | 36 | // samplerate is in hz. return is 1 for success 37 | int (*init)(int samplerate); 38 | 39 | // deallocate structures, cleanup, ... 40 | void (*shutdown)(void); 41 | 42 | // set volume, 0 = off, 15 = max 43 | void (*setvolume)(int v); 44 | 45 | // pause currently running song. 46 | void (*pause)(void); 47 | 48 | // undo pause 49 | void (*resume)(void); 50 | 51 | // return a player-specific handle, or NULL on failure. 52 | // data does not belong to player, but it will persist as long as unregister is not called 53 | const void *(*registersong)(const void *data, unsigned len); 54 | 55 | // deallocate structures, etc. data is no longer valid 56 | void (*unregistersong)(const void *handle); 57 | 58 | void (*play)(const void *handle, int looping); 59 | 60 | // stop 61 | void (*stop)(void); 62 | 63 | // s16 stereo, with samplerate as specified in init. player needs to be able to handle 64 | // just about anything for nsamp. render can be called even during pause+stop. 65 | void (*render)(void *dest, unsigned nsamp); 66 | } music_player_t; 67 | 68 | 69 | 70 | extern const music_player_t opl_synth_player; 71 | 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /components/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 | if (!outfile) 78 | return; 79 | 80 | fprintf(outfile,"%6d, ", tic); 81 | 82 | /* based on "ArchivePlayers" */ 83 | MD5Init(&md5ctx); 84 | for (i=0 ; iframe */ 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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/prboom/r_data.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, data I/O, caching, retrieval of graphics 31 | * by name. 32 | * 33 | *-----------------------------------------------------------------------------*/ 34 | 35 | 36 | #ifndef __R_DATA__ 37 | #define __R_DATA__ 38 | 39 | #include "r_defs.h" 40 | #include "r_state.h" 41 | #include "r_patch.h" 42 | 43 | #ifdef __GNUG__ 44 | #pragma interface 45 | #endif 46 | 47 | // A single patch from a texture definition, basically 48 | // a rectangular area within the texture rectangle. 49 | typedef struct 50 | { 51 | int originx, originy; // Block origin, which has already accounted 52 | int patch; // for the internal origin of the patch. 53 | } texpatch_t; 54 | 55 | // 56 | // Texture definition. 57 | // A DOOM wall texture is a list of patches 58 | // which are to be combined in a predefined order. 59 | // 60 | 61 | typedef struct 62 | { 63 | char name[8]; // Keep name for switch changing, etc. 64 | int next, index; // killough 1/31/98: used in hashing algorithm 65 | // CPhipps - moved arrays with per-texture entries to elements here 66 | unsigned widthmask; 67 | // CPhipps - end of additions 68 | short width, height; 69 | short patchcount; // All the patches[patchcount] are drawn 70 | texpatch_t patches[1]; // back-to-front into the cached texture. 71 | } texture_t; 72 | 73 | extern int numtextures; 74 | extern texture_t **textures; 75 | 76 | 77 | const byte *R_GetTextureColumn(const rpatch_t *texpatch, int col); 78 | 79 | 80 | // I/O, setting up the stuff. 81 | void R_InitData (void); 82 | void R_PrecacheLevel (void); 83 | 84 | 85 | // Retrieval. 86 | // Floor/ceiling opaque texture tiles, 87 | // lookup by name. For animation? 88 | int R_FlatNumForName (const char* name); // killough -- const added 89 | 90 | 91 | // R_*TextureNumForName returns the texture number for the texture name, or NO_TEXTURE if 92 | // there is no texture (i.e. "-") specified. 93 | /* cph 2006/07/23 - defined value for no-texture marker (texture "-" in the WAD file) */ 94 | #define NO_TEXTURE 0 95 | int PUREFUNC R_TextureNumForName (const char *name); // killough -- const added; cph - now PUREFUNC 96 | int PUREFUNC R_SafeTextureNumForName (const char *name, int snum); 97 | int PUREFUNC R_CheckTextureNumForName (const char *name); 98 | 99 | void R_InitTranMap(int); // killough 3/6/98: translucency initialization 100 | int R_ColormapNumForName(const char *name); // killough 4/4/98 101 | /* cph 2001/11/17 - new func to do lighting calcs and get suitable colour map */ 102 | const lighttable_t* R_ColourMap(int lightlevel, fixed_t spryscale); 103 | 104 | extern const byte *main_tranmap, *tranmap; 105 | 106 | /* Proff - Added for OpenGL - cph - const char* param */ 107 | void R_SetPatchNum(patchnum_t *patchnum, const char *name); 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /components/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 50 | { 51 | if (!player) 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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/prboom/r_draw.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ducalex/doom-ng-odroid-go/29988e5afcff5b1cd2641a674c199ffa64bd892e/components/prboom/r_draw.c -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/prboom/r_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 | * Renderer main interface. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __R_MAIN__ 35 | #define __R_MAIN__ 36 | 37 | #include "d_player.h" 38 | #include "r_data.h" 39 | 40 | #ifdef __GNUG__ 41 | #pragma interface 42 | #endif 43 | 44 | // 45 | // POV related. 46 | // 47 | 48 | extern fixed_t viewcos; 49 | extern fixed_t viewsin; 50 | extern int viewwidth; 51 | extern int viewheight; 52 | extern int viewwindowx; 53 | extern int viewwindowy; 54 | extern int centerx; 55 | extern int centery; 56 | extern fixed_t centerxfrac; 57 | extern fixed_t centeryfrac; 58 | extern fixed_t viewheightfrac; //e6y: for correct clipping of things 59 | extern fixed_t projection; 60 | // proff 11/06/98: Added for high-res 61 | extern fixed_t projectiony; 62 | extern int validcount; 63 | 64 | // 65 | // Rendering stats 66 | // 67 | 68 | extern int rendered_visplanes, rendered_segs, rendered_vissprites; 69 | extern boolean rendering_stats; 70 | 71 | // 72 | // Lighting LUT. 73 | // Used for z-depth cuing per column/row, 74 | // and other lighting effects (sector ambient, flash). 75 | // 76 | 77 | // Lighting constants. 78 | 79 | #define LIGHTLEVELS 16 80 | #define LIGHTSEGSHIFT 4 81 | #define MAXLIGHTSCALE 48 82 | #define LIGHTSCALESHIFT 12 83 | #define MAXLIGHTZ 128 84 | #define LIGHTZSHIFT 20 85 | 86 | // killough 3/20/98: Allow colormaps to be dynamic (e.g. underwater) 87 | extern const lighttable_t *(*zlight)[MAXLIGHTZ]; 88 | extern const lighttable_t *fullcolormap; 89 | extern int numcolormaps; // killough 4/4/98: dynamic number of maps 90 | extern const lighttable_t **colormaps; 91 | // killough 3/20/98, 4/4/98: end dynamic colormaps 92 | 93 | extern int extralight; 94 | extern const lighttable_t *fixedcolormap; 95 | 96 | // Number of diminishing brightness levels. 97 | // There a 0-31, i.e. 32 LUT in the COLORMAP lump. 98 | 99 | #define NUMCOLORMAPS 32 100 | 101 | // 102 | // Utility functions. 103 | // 104 | 105 | PUREFUNC int R_PointOnSide(fixed_t x, fixed_t y, const node_t *node); 106 | PUREFUNC int R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line); 107 | angle_t R_PointToAngle(fixed_t x, fixed_t y); 108 | angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2); 109 | subsector_t *R_PointInSubsector(fixed_t x, fixed_t y); 110 | 111 | // 112 | // REFRESH - the actual rendering functions. 113 | // 114 | 115 | void R_RenderPlayerView(player_t *player); // Called by G_Drawer. 116 | void R_Init(void); // Called by startup code. 117 | void R_SetViewSize(int blocks); // Called by M_Responder. 118 | void R_ExecuteSetViewSize(void); // cph - called by D_Display to complete a view resize 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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_SetMasterVolume(int volume); 91 | void S_SetMusicVolume(int volume); 92 | void S_SetSfxVolume(int volume); 93 | 94 | // machine-independent sound params 95 | extern int default_numChannels; 96 | extern int numChannels; 97 | 98 | //jff 3/17/98 holds last IDMUS number, or -1 99 | extern int idmusnum; 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 "m_fixed.h" 51 | 52 | #define FINEANGLES 8192 53 | #define FINEMASK (FINEANGLES-1) 54 | 55 | // 0x100000000 to 0x2000 56 | #define ANGLETOFINESHIFT 19 57 | 58 | // Binary Angle Measument, BAM. 59 | #define ANG45 0x20000000 60 | #define ANG90 0x40000000 61 | #define ANG180 0x80000000 62 | #define ANG270 0xc0000000 63 | #ifndef M_PI 64 | #define M_PI 3.14159265358979323846 65 | #endif 66 | 67 | #define SLOPERANGE 2048 68 | #define SLOPEBITS 11 69 | #define DBITS (FRACBITS-SLOPEBITS) 70 | 71 | typedef unsigned angle_t; 72 | 73 | // Load trig tables if needed 74 | void R_LoadTrigTables(void); 75 | 76 | // Effective size is 10240. 77 | //extern fixed_t finesine[5*FINEANGLES/4]; 78 | extern fixed_t *finesine; 79 | 80 | // Re-use data, is just PI/2 phase shift. 81 | extern fixed_t *finecosine; 82 | 83 | // Effective size is 4096. 84 | //extern fixed_t finetangent[FINEANGLES/2]; 85 | extern fixed_t *finetangent; 86 | 87 | // Effective size is 2049; 88 | // The +1 size is to handle the case when x==y without additional checking. 89 | 90 | //extern angle_t tantoangle[SLOPERANGE+1]; 91 | extern angle_t *tantoangle; 92 | 93 | // Utility function, called by R_PointToAngle. 94 | int SlopeDiv(unsigned num, unsigned den); 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /components/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 | -------------------------------------------------------------------------------- /data/doom1.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ducalex/doom-ng-odroid-go/29988e5afcff5b1cd2641a674c199ffa64bd892e/data/doom1.wad -------------------------------------------------------------------------------- /data/prboom.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ducalex/doom-ng-odroid-go/29988e5afcff5b1cd2641a674c199ffa64bd892e/data/prboom.wad -------------------------------------------------------------------------------- /data/src-20190922.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ducalex/doom-ng-odroid-go/29988e5afcff5b1cd2641a674c199ffa64bd892e/data/src-20190922.zip -------------------------------------------------------------------------------- /debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . ${IDF_PATH}/add_path.sh 3 | 4 | COMPORT=COM4 5 | BINNAME=doom-esp32 6 | 7 | #make 8 | idf.py app || exit 9 | #make flash 10 | esptool.py --chip esp32 --port $COMPORT --before default_reset --after hard_reset erase_region 0x100000 1048576 || exit 11 | esptool.py --chip esp32 --port $COMPORT --baud 921600 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size detect 0x100000 "build/$BINNAME.bin" || exit 12 | #make monitor 13 | idf_monitor.py --port COM4 build/$BINNAME.elf 14 | -------------------------------------------------------------------------------- /main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT_SRCDIRS ".") 2 | set(COMPONENT_ADD_INCLUDEDIRS ".") 3 | set(COMPONENT_REQUIRES "odroid-go prboom") 4 | register_component() -------------------------------------------------------------------------------- /main/i_video.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PrBoom: a Doom port based on BOOM merged with LxDoom and LSDLDoo 3 | * 4 | * Copyright (C) 1999 by id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 5 | * Copyright (C) 1999-2000 by Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 6 | * Copyright 2005, 2006 by Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License 10 | * as published by the Free Software Foundation; either version 2 11 | * of the License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | * 02111-1307, USA. 22 | */ 23 | 24 | #include "config.h" 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "m_argv.h" 31 | #include "doomstat.h" 32 | #include "doomdef.h" 33 | #include "doomtype.h" 34 | #include "v_video.h" 35 | #include "r_draw.h" 36 | #include "d_main.h" 37 | #include "d_event.h" 38 | #include "i_video.h" 39 | #include "z_zone.h" 40 | #include "s_sound.h" 41 | #include "sounds.h" 42 | #include "w_wad.h" 43 | #include "st_stuff.h" 44 | #include "lprintf.h" 45 | 46 | static uint16_t lcdpal[256]; 47 | int desired_fullscreen = 1; 48 | int use_fullscreen = 0; 49 | int use_doublebuffer = 0; 50 | 51 | void I_ShutdownGraphics(void) 52 | { 53 | } 54 | 55 | void I_UpdateNoBlit(void) 56 | { 57 | } 58 | 59 | void I_StartFrame(void) 60 | { 61 | } 62 | 63 | int I_StartDisplay(void) 64 | { 65 | spi_lcd_wait_finish(); 66 | return true; 67 | } 68 | 69 | void I_EndDisplay(void) 70 | { 71 | } 72 | 73 | void I_FinishUpdate(void) 74 | { 75 | spi_lcd_fb_write(screens[0].data); 76 | //Flip framebuffers 77 | // if (scr==screena) screens[0].data=screenb; else screens[0].data=screena; 78 | } 79 | 80 | void I_SetPalette(int pal) 81 | { 82 | int i, v; 83 | int pplump = W_GetNumForName("PLAYPAL"); 84 | const byte *palette = W_CacheLumpNum(pplump) + (pal * 3 * 256); 85 | for (i = 0; i < 255; i++) 86 | { 87 | v = ((palette[0] >> 3) << 11) + ((palette[1] >> 2) << 5) + (palette[2] >> 3); 88 | lcdpal[i] = (v << 8) | (v >> 8); 89 | palette += 3; 90 | } 91 | spi_lcd_fb_setPalette(lcdpal); 92 | W_UnlockLumpNum(pplump); 93 | } 94 | 95 | void I_PreInitGraphics(void) 96 | { 97 | lprintf(LO_INFO, "preinitgfx"); 98 | } 99 | 100 | void I_SetRes(void) 101 | { 102 | // set first three to standard values 103 | for (int i = 0; i < 3; i++) 104 | { 105 | screens[i].width = SCREENWIDTH; 106 | screens[i].height = SCREENHEIGHT; 107 | screens[i].byte_pitch = SCREENPITCH; 108 | screens[i].short_pitch = SCREENPITCH / V_GetModePixelDepth(VID_MODE16); 109 | screens[i].int_pitch = SCREENPITCH / V_GetModePixelDepth(VID_MODE32); 110 | } 111 | 112 | // statusbar 113 | screens[4].width = SCREENWIDTH; 114 | screens[4].height = (ST_SCALED_HEIGHT + 1); 115 | screens[4].byte_pitch = SCREENPITCH; 116 | screens[4].short_pitch = SCREENPITCH / V_GetModePixelDepth(VID_MODE16); 117 | screens[4].int_pitch = SCREENPITCH / V_GetModePixelDepth(VID_MODE32); 118 | 119 | lprintf(LO_INFO, "I_SetRes: Using resolution %dx%d\n", SCREENWIDTH, SCREENHEIGHT); 120 | } 121 | 122 | void I_InitGraphics(void) 123 | { 124 | atexit(I_ShutdownGraphics); 125 | I_UpdateVideoMode(); 126 | } 127 | 128 | void I_UpdateVideoMode(void) 129 | { 130 | lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d\n", SCREENWIDTH, SCREENHEIGHT); 131 | V_InitMode(VID_MODE8); 132 | V_DestroyUnusedTrueColorPalettes(); 133 | V_FreeScreens(); 134 | I_SetRes(); 135 | V_AllocScreens(); 136 | R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); 137 | } 138 | -------------------------------------------------------------------------------- /tile.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ducalex/doom-ng-odroid-go/29988e5afcff5b1cd2641a674c199ffa64bd892e/tile.raw -------------------------------------------------------------------------------- /tools/mkfw.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys, math, zlib, struct 3 | 4 | def readfile(filepath): 5 | try: 6 | with open(filepath, "rb") as f: 7 | return f.read() 8 | except FileNotFoundError as err: 9 | exit("\nERROR: Unable to open partition file '%s' !\n" % err.filename) 10 | 11 | if len(sys.argv) < 4: 12 | exit("usage: mkfw.py output_file.fw 'description' tile.raw type subtype size label file.bin " 13 | "[type subtype size label file.bin, ...]") 14 | 15 | fw_name = sys.argv[1] 16 | 17 | fw_data = struct.pack( 18 | "<24s40s8256s", b"ODROIDGO_FIRMWARE_V00_01", sys.argv[2].encode(), readfile(sys.argv[3]) 19 | ) 20 | 21 | fw_size = 0 22 | fw_part = 0 23 | pos = 4 24 | 25 | while pos < len(sys.argv): 26 | partype = int(sys.argv[pos + 0], 0) 27 | subtype = int(sys.argv[pos + 1], 0) 28 | size = int(sys.argv[pos + 2], 0) 29 | label = sys.argv[pos + 3] 30 | filename = sys.argv[pos + 4] 31 | pos += 5 32 | 33 | if not subtype: 34 | subtype = 16 + fw_part # OTA starts at 16 35 | 36 | data = readfile(filename) 37 | real_size = max(size, math.ceil(len(data) / 0x10000) * 0x10000) 38 | usage = len(data) / real_size * 100 39 | 40 | print("[%d]: type=%d, subtype=%d, size=%d (%d%% used), label=%s" 41 | % (fw_part, partype, subtype, real_size, usage, label)) 42 | 43 | if real_size > size and size != 0: 44 | print(" > WARNING: Partition smaller than file (+%d bytes), increasing size to %d" 45 | % (len(data) - size, real_size)) 46 | 47 | fw_data += struct.pack("