├── .gitignore ├── AUTHORS.txt ├── COPYING.txt ├── Makefile ├── PRBOOM.CFG ├── README.txt ├── arm7 ├── Makefile └── source │ └── arm7_main.c ├── arm9 ├── Makefile └── source │ ├── SDL_net.h │ ├── SDLnet.c │ ├── SDLnetTCP.c │ ├── SDLnetUDP.c │ ├── SDLnetselect.c │ ├── SDLnetsys.h │ ├── 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_think.h │ ├── d_ticcmd.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 │ ├── hu_lib.c │ ├── hu_lib.h │ ├── hu_stuff.c │ ├── hu_stuff.h │ ├── i_joy.c │ ├── i_joy.h │ ├── i_main.c │ ├── i_main.h │ ├── i_net.h │ ├── i_network.h │ ├── i_sound.c │ ├── i_sound.h │ ├── i_system.c │ ├── i_system.h │ ├── i_udp_sdl.c │ ├── i_video.c │ ├── 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 │ ├── p_ceilng.c │ ├── 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_draw.c │ ├── r_draw.h │ ├── r_main.c │ ├── r_main.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 │ ├── 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 │ ├── v_video.c │ ├── v_video.h │ ├── version.c │ ├── version.h │ ├── w_memcache.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 ├── dsdoom.pnproj ├── dsdoom.pnps ├── dsdoom.prj └── icon.bmp /.gitignore: -------------------------------------------------------------------------------- 1 | # A simulation of Subversion default ignores, generated by reposurgeon. 2 | *.o 3 | *.lo 4 | *.la 5 | *.al 6 | *.libs 7 | *.so 8 | *.so.[0-9]* 9 | *.a 10 | *.pyc 11 | *.pyo 12 | *.rej 13 | *~ 14 | *.#* 15 | .*.swp 16 | .DS_store 17 | # Simulated Subversion default ignores end here 18 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | ifeq ($(strip $(DEVKITARM)),) 5 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM) 6 | endif 7 | 8 | include $(DEVKITARM)/ds_rules 9 | 10 | export TARGET := dsdoom 11 | export TOPDIR := $(CURDIR) 12 | 13 | export DSDOOM_VERSION := 1.2.1 14 | 15 | 16 | .PHONY: arm7/$(TARGET).elf arm9/$(TARGET).elf 17 | 18 | #--------------------------------------------------------------------------------- 19 | #all: $(TARGET).fcsr.nds 20 | 21 | #--------------------------------------------------------------------------------- 22 | # targets for building FCSR images 23 | #--------------------------------------------------------------------------------- 24 | #$(TARGET).fcsr.nds : $(TARGET).nds 25 | # padbin 512 $< 26 | # cat -B $< doom.fcsr > $@ 27 | # dlditool.exe fcsr.dldi $@ 28 | 29 | all : $(TARGET).nds 30 | 31 | #--------------------------------------------------------------------------------- 32 | # standard nds target 33 | #--------------------------------------------------------------------------------- 34 | $(TARGET).nds : arm7/$(TARGET).elf arm9/$(TARGET).elf 35 | ndstool -c $(TARGET).nds -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf -b icon.bmp "DS DOOM;prBoom DS Port v$(DSDOOM_VERSION)" 36 | 37 | #--------------------------------------------------------------------------------- 38 | arm7/$(TARGET).elf: 39 | $(MAKE) -C arm7 40 | 41 | #--------------------------------------------------------------------------------- 42 | arm9/$(TARGET).elf: 43 | $(MAKE) -C arm9 44 | 45 | #--------------------------------------------------------------------------------- 46 | clean: 47 | $(MAKE) -C arm9 clean 48 | $(MAKE) -C arm7 clean 49 | rm -f $(TARGET).nds 50 | -------------------------------------------------------------------------------- /arm7/Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | ifeq ($(strip $(DEVKITARM)),) 5 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 6 | endif 7 | 8 | include $(DEVKITARM)/ds_rules 9 | 10 | #--------------------------------------------------------------------------------- 11 | # BUILD is the directory where object files & intermediate files will be placed 12 | # SOURCES is a list of directories containing source code 13 | # INCLUDES is a list of directories containing extra header files 14 | # DATA is a list of directories containing binary files 15 | # all directories are relative to this makefile 16 | #--------------------------------------------------------------------------------- 17 | BUILD := build 18 | SOURCES := source 19 | INCLUDES := include build 20 | DATA := 21 | 22 | #--------------------------------------------------------------------------------- 23 | # options for code generation 24 | #--------------------------------------------------------------------------------- 25 | ARCH := -mthumb-interwork 26 | 27 | CFLAGS := -g -Wall -O2\ 28 | -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\ 29 | -ffast-math \ 30 | $(ARCH) 31 | 32 | CFLAGS += $(INCLUDE) -DARM7 33 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fno-rtti 34 | 35 | 36 | ASFLAGS := -g $(ARCH) 37 | LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -Wl,-Map,$(notdir $*).map 38 | 39 | LIBS := -ldswifi7 -lmm7 -lnds7 40 | 41 | #--------------------------------------------------------------------------------- 42 | # list of directories containing libraries, this must be the top level containing 43 | # include and lib 44 | #--------------------------------------------------------------------------------- 45 | LIBDIRS := $(LIBNDS) 46 | 47 | 48 | #--------------------------------------------------------------------------------- 49 | # no real need to edit anything past this point unless you need to add additional 50 | # rules for different file extensions 51 | #--------------------------------------------------------------------------------- 52 | ifneq ($(BUILD),$(notdir $(CURDIR))) 53 | #--------------------------------------------------------------------------------- 54 | 55 | export ARM7ELF := $(CURDIR)/$(TARGET).elf 56 | export DEPSDIR := $(CURDIR)/$(BUILD) 57 | 58 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) 59 | 60 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 61 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 62 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 63 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 64 | 65 | export OFILES := $(addsuffix .o,$(BINFILES)) \ 66 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 67 | 68 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 69 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 70 | -I$(CURDIR)/$(BUILD) 71 | 72 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) 73 | 74 | #--------------------------------------------------------------------------------- 75 | # use CXX for linking C++ projects, CC for standard C 76 | #--------------------------------------------------------------------------------- 77 | ifeq ($(strip $(CPPFILES)),) 78 | #--------------------------------------------------------------------------------- 79 | export LD := $(CC) 80 | #--------------------------------------------------------------------------------- 81 | else 82 | #--------------------------------------------------------------------------------- 83 | export LD := $(CXX) 84 | #--------------------------------------------------------------------------------- 85 | endif 86 | #--------------------------------------------------------------------------------- 87 | 88 | .PHONY: $(BUILD) clean 89 | 90 | #--------------------------------------------------------------------------------- 91 | $(BUILD): 92 | @[ -d $@ ] || mkdir -p $@ 93 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 94 | 95 | #--------------------------------------------------------------------------------- 96 | clean: 97 | @echo clean ... 98 | @rm -fr $(BUILD) *.elf 99 | 100 | 101 | #--------------------------------------------------------------------------------- 102 | else 103 | 104 | DEPENDS := $(OFILES:.o=.d) 105 | 106 | #--------------------------------------------------------------------------------- 107 | # main targets 108 | #--------------------------------------------------------------------------------- 109 | $(ARM7ELF) : $(OFILES) 110 | @echo linking $(notdir $@) 111 | @$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ 112 | 113 | #--------------------------------------------------------------------------------- 114 | # you need a rule like this for each extension you use as binary data 115 | #--------------------------------------------------------------------------------- 116 | %.bin.o : %.bin 117 | #--------------------------------------------------------------------------------- 118 | @echo $(notdir $<) 119 | @$(bin2o) 120 | 121 | -include $(DEPENDS) 122 | 123 | #--------------------------------------------------------------------------------------- 124 | endif 125 | #--------------------------------------------------------------------------------------- 126 | -------------------------------------------------------------------------------- /arm7/source/arm7_main.c: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------- 2 | 3 | default ARM7 core 4 | 5 | Copyright (C) 2005 - 2010 6 | Michael Noland (joat) 7 | Jason Rogers (dovoto) 8 | Dave Murphy (WinterMute) 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any 12 | damages arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any 15 | purpose, including commercial applications, and to alter it and 16 | redistribute it freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you 19 | must not claim that you wrote the original software. If you use 20 | this software in a product, an acknowledgment in the product 21 | documentation would be appreciated but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and 24 | must not be misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source 27 | distribution. 28 | 29 | ---------------------------------------------------------------------------------*/ 30 | #include 31 | #include 32 | #include 33 | 34 | //--------------------------------------------------------------------------------- 35 | void VblankHandler(void) { 36 | //--------------------------------------------------------------------------------- 37 | Wifi_Update(); 38 | } 39 | 40 | 41 | //--------------------------------------------------------------------------------- 42 | void VcountHandler() { 43 | //--------------------------------------------------------------------------------- 44 | inputGetAndSend(); 45 | } 46 | 47 | volatile bool exitflag = false; 48 | 49 | //--------------------------------------------------------------------------------- 50 | void powerButtonCB() { 51 | //--------------------------------------------------------------------------------- 52 | exitflag = true; 53 | } 54 | 55 | //--------------------------------------------------------------------------------- 56 | int main() { 57 | //--------------------------------------------------------------------------------- 58 | readUserSettings(); 59 | ledBlink(0); 60 | 61 | irqInit(); 62 | // Start the RTC tracking IRQ 63 | initClockIRQ(); 64 | fifoInit(); 65 | 66 | mmInstall(FIFO_MAXMOD); 67 | 68 | SetYtrigger(80); 69 | 70 | installWifiFIFO(); 71 | installSoundFIFO(); 72 | 73 | installSystemFIFO(); 74 | 75 | irqSet(IRQ_VCOUNT, VcountHandler); 76 | irqSet(IRQ_VBLANK, VblankHandler); 77 | 78 | irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK); 79 | 80 | setPowerButtonCB(powerButtonCB); 81 | 82 | // Keep the ARM7 mostly idle 83 | while (!exitflag) { 84 | if ( 0 == (REG_KEYINPUT & (KEY_SELECT | KEY_START | KEY_L | KEY_R))) { 85 | exitflag = true; 86 | } 87 | swiWaitForVBlank(); 88 | } 89 | return 0; 90 | } 91 | -------------------------------------------------------------------------------- /arm9/source/SDLnet.c: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_net: An example cross-platform network library for use with SDL 3 | Copyright (C) 1997-2004 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* $Id: SDLnet.c 2207 2006-04-20 16:48:25Z slouken $ */ 24 | 25 | #include 26 | #include 27 | 28 | #include "SDLnetsys.h" 29 | #include "SDL_net.h" 30 | 31 | #define DEBUG_NET 32 | 33 | /* Since the UNIX/Win32/BeOS code is so different from MacOS, 34 | we'll just have two completely different sections here. 35 | */ 36 | static int SDLNet_started = 0; 37 | 38 | #include 39 | 40 | static __inline__ u16 SDL_Swap16(u16 x) 41 | { 42 | return((x<<8)|(x>>8)); 43 | } 44 | 45 | static __inline__ u32 SDL_Swap32(u32 x) { 46 | return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24)); 47 | } 48 | 49 | /* Initialize/Cleanup the network API */ 50 | int SDLNet_Init(void) 51 | { 52 | if ( !SDLNet_started ) { 53 | /* SIGPIPE is generated when a remote socket is closed */ 54 | void (*handler)(int); 55 | handler = signal(SIGPIPE, SIG_IGN); 56 | if ( handler != SIG_DFL ) { 57 | signal(SIGPIPE, handler); 58 | } 59 | } 60 | ++SDLNet_started; 61 | return(0); 62 | } 63 | void SDLNet_Quit(void) 64 | { 65 | if ( SDLNet_started == 0 ) { 66 | return; 67 | } 68 | if ( --SDLNet_started == 0 ) { 69 | /* Restore the SIGPIPE handler */ 70 | void (*handler)(int); 71 | handler = signal(SIGPIPE, SIG_DFL); 72 | if ( handler != SIG_IGN ) { 73 | signal(SIGPIPE, handler); 74 | } 75 | } 76 | } 77 | 78 | /* Resolve a host name and port to an IP address in network form */ 79 | int SDLNet_ResolveHost(IPaddress *address, const char *host, u16 port) 80 | { 81 | int retval = 0; 82 | 83 | // Perform the actual host resolution 84 | if ( host == NULL ) { 85 | address->host = INADDR_ANY; 86 | } else { 87 | address->host = inet_addr(host); 88 | if ( address->host == INADDR_NONE ) { 89 | struct hostent *hp; 90 | 91 | hp = gethostbyname(host); 92 | if ( hp ) { 93 | memcpy(&address->host, hp->h_addr_list[0], hp->h_length); 94 | } else { 95 | retval = -1; 96 | } 97 | } 98 | } 99 | address->port = SDL_SwapBE16(port); 100 | //address->port = port; 101 | 102 | /* Return the status */ 103 | return(retval); 104 | } 105 | 106 | /* Resolve an ip address to a host name in canonical form. 107 | If the ip couldn't be resolved, this function returns NULL, 108 | otherwise a pointer to a static buffer containing the hostname 109 | is returned. Note that this function is not thread-safe. 110 | */ 111 | /* Written by Miguel Angel Blanch. 112 | * Main Programmer of Arianne RPG. 113 | * http://come.to/arianne_rpg 114 | */ 115 | const char *SDLNet_ResolveIP(IPaddress *ip) 116 | { 117 | /* struct hostent *hp; 118 | 119 | hp = gethostbyaddr((char *)&ip->host, 4, AF_INET); 120 | if ( hp != NULL ) { 121 | return hp->h_name; 122 | }*/ 123 | return NULL; 124 | } 125 | -------------------------------------------------------------------------------- /arm9/source/SDLnetselect.c: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_net: An example cross-platform network library for use with SDL 3 | Copyright (C) 1997-2004 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* $Id: SDLnetselect.c 1192 2004-01-04 17:41:55Z slouken $ */ 24 | 25 | #include 26 | 27 | #include "SDLnetsys.h" 28 | #include "SDL_net.h" 29 | 30 | #define DEBUG_NET 31 | 32 | /* The select() API for network sockets */ 33 | 34 | struct SDLNet_Socket { 35 | int ready; 36 | SOCKET channel; 37 | }; 38 | 39 | struct _SDLNet_SocketSet { 40 | int numsockets; 41 | int maxsockets; 42 | struct SDLNet_Socket **sockets; 43 | }; 44 | 45 | /* Allocate a socket set for use with SDLNet_CheckSockets() 46 | This returns a socket set for up to 'maxsockets' sockets, or NULL if 47 | the function ran out of memory. 48 | */ 49 | SDLNet_SocketSet SDLNet_AllocSocketSet(int maxsockets) 50 | { 51 | struct _SDLNet_SocketSet *set; 52 | int i; 53 | 54 | set = (struct _SDLNet_SocketSet *)malloc(sizeof(*set)); 55 | if ( set != NULL ) { 56 | set->numsockets = 0; 57 | set->maxsockets = maxsockets; 58 | set->sockets = (struct SDLNet_Socket **)malloc 59 | (maxsockets*sizeof(*set->sockets)); 60 | if ( set->sockets != NULL ) { 61 | for ( i=0; isockets[i] = NULL; 63 | } 64 | } else { 65 | free(set); 66 | set = NULL; 67 | } 68 | } 69 | return(set); 70 | } 71 | 72 | /* Add a socket to a set of sockets to be checked for available data */ 73 | int SDLNet_AddSocket(SDLNet_SocketSet set, SDLNet_GenericSocket sock) 74 | { 75 | if ( sock != NULL ) { 76 | if ( set->numsockets == set->maxsockets ) { 77 | iprintf("SDL_NET: socketset is full"); 78 | return(-1); 79 | } 80 | set->sockets[set->numsockets++] = (struct SDLNet_Socket *)sock; 81 | } 82 | return(set->numsockets); 83 | } 84 | 85 | /* Remove a socket from a set of sockets to be checked for available data */ 86 | int SDLNet_DelSocket(SDLNet_SocketSet set, SDLNet_GenericSocket sock) 87 | { 88 | int i; 89 | 90 | if ( sock != NULL ) { 91 | for ( i=0; inumsockets; ++i ) { 92 | if ( set->sockets[i] == (struct SDLNet_Socket *)sock ) { 93 | break; 94 | } 95 | } 96 | if ( i == set->numsockets ) { 97 | iprintf("SDL_NET: socket not found in socketset"); 98 | return(-1); 99 | } 100 | --set->numsockets; 101 | for ( ; inumsockets; ++i ) { 102 | set->sockets[i] = set->sockets[i+1]; 103 | } 104 | } 105 | return(set->numsockets); 106 | } 107 | 108 | /* This function checks to see if data is available for reading on the 109 | given set of sockets. If 'timeout' is 0, it performs a quick poll, 110 | otherwise the function returns when either data is available for 111 | reading, or the timeout in milliseconds has elapsed, which ever occurs 112 | first. This function returns the number of sockets ready for reading, 113 | or -1 if there was an error with the select() system call. 114 | */ 115 | int SDLNet_CheckSockets(SDLNet_SocketSet set, u32 timeout) 116 | { 117 | int i; 118 | SOCKET maxfd; 119 | int retval; 120 | struct timeval tv; 121 | fd_set mask; 122 | 123 | /* Find the largest file descriptor */ 124 | maxfd = 0; 125 | for ( i=set->numsockets-1; i>=0; --i ) { 126 | if ( set->sockets[i]->channel > maxfd ) { 127 | maxfd = set->sockets[i]->channel; 128 | } 129 | } 130 | 131 | /* Check the file descriptors for available data */ 132 | do { 133 | errno = 0; 134 | 135 | /* Set up the mask of file descriptors */ 136 | FD_ZERO(&mask); 137 | for ( i=set->numsockets-1; i>=0; --i ) { 138 | FD_SET(set->sockets[i]->channel, &mask); 139 | } 140 | 141 | /* Set up the timeout */ 142 | tv.tv_sec = timeout/1000; 143 | tv.tv_usec = (timeout%1000)*1000; 144 | 145 | /* Look! */ 146 | retval = select(maxfd+1, &mask, NULL, NULL, &tv); 147 | } while ( errno == EINTR ); 148 | 149 | /* Mark all file descriptors ready that have data available */ 150 | if ( retval > 0 ) { 151 | for ( i=set->numsockets-1; i>=0; --i ) { 152 | if ( FD_ISSET(set->sockets[i]->channel, &mask) ) { 153 | set->sockets[i]->ready = 1; 154 | } 155 | } 156 | } 157 | return(retval); 158 | } 159 | 160 | /* Free a set of sockets allocated by SDL_NetAllocSocketSet() */ 161 | extern void SDLNet_FreeSocketSet(SDLNet_SocketSet set) 162 | { 163 | if ( set ) { 164 | free(set->sockets); 165 | free(set); 166 | } 167 | } 168 | 169 | -------------------------------------------------------------------------------- /arm9/source/SDLnetsys.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_net: An example cross-platform network library for use with SDL 3 | Copyright (C) 1997-2004 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* $Id: SDLnetsys.h 1720 2005-11-23 07:57:10Z icculus $ */ 24 | 25 | /* Include normal system headers */ 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #define DEBUG_NET 34 | 35 | /* 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | */ 45 | #include 46 | #include 47 | #include 48 | 49 | //#define closesocket close 50 | 51 | #define SOCKET int 52 | #define INVALID_SOCKET -1 53 | #define SOCKET_ERROR -1 54 | 55 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * AutoMap module. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __AMMAP_H__ 33 | #define __AMMAP_H__ 34 | 35 | #include "d_event.h" 36 | 37 | // Used by ST StatusBar stuff. 38 | #define AM_MSGHEADER (('a'<<24)+('m'<<16)) 39 | #define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8)) 40 | #define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8)) 41 | 42 | // Called by main loop. 43 | boolean AM_Responder (event_t* ev); 44 | 45 | // Called by main loop. 46 | void AM_Ticker (void); 47 | 48 | // Called by main loop, 49 | // called instead of view drawer if automap active. 50 | void AM_Drawer (void); 51 | 52 | // Called to force the automap to quit 53 | // if the level is completed while it is up. 54 | void AM_Stop (void); 55 | 56 | // killough 2/22/98: for saving automap information in savegame: 57 | 58 | extern void AM_Start(void); 59 | 60 | //jff 4/16/98 make externally available 61 | 62 | extern void AM_clearMarks(void); 63 | 64 | typedef struct 65 | { 66 | fixed_t x,y; 67 | } mpoint_t; 68 | 69 | extern mpoint_t *markpoints; 70 | extern int markpointnum, markpointnum_max; 71 | 72 | // end changes -- killough 2/22/98 73 | 74 | // killough 5/2/98: moved from m_misc.c 75 | 76 | //jff 1/7/98 automap colors added 77 | extern int mapcolor_back; // map background 78 | extern int mapcolor_grid; // grid lines color 79 | extern int mapcolor_wall; // normal 1s wall color 80 | extern int mapcolor_fchg; // line at floor height change color 81 | extern int mapcolor_cchg; // line at ceiling height change color 82 | extern int mapcolor_clsd; // line at sector with floor=ceiling color 83 | extern int mapcolor_rkey; // red key color 84 | extern int mapcolor_bkey; // blue key color 85 | extern int mapcolor_ykey; // yellow key color 86 | extern int mapcolor_rdor; // red door color (diff from keys to allow option) 87 | extern int mapcolor_bdor; // blue door color (of enabling one not other) 88 | extern int mapcolor_ydor; // yellow door color 89 | extern int mapcolor_tele; // teleporter line color 90 | extern int mapcolor_secr; // secret sector boundary color 91 | //jff 4/23/98 92 | extern int mapcolor_exit; // exit line 93 | extern int mapcolor_unsn; // computer map unseen line color 94 | extern int mapcolor_flat; // line with no floor/ceiling changes 95 | extern int mapcolor_sprt; // general sprite color 96 | extern int mapcolor_item; // item sprite color 97 | extern int mapcolor_frnd; // friendly sprite color 98 | extern int mapcolor_hair; // crosshair color 99 | extern int mapcolor_sngl; // single player arrow color 100 | extern int mapcolor_plyr[4]; // colors for players in multiplayer 101 | extern int mapcolor_me; // consoleplayer's chosen colour 102 | //jff 3/9/98 103 | extern int map_secret_after; // secrets do not appear til after bagged 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /arm9/source/d_deh.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Doom-Utils/dsdoom/2617b30099e2138dcb76e606d1887504381adea5/arm9/source/d_deh.c -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Event information structures. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | 33 | #ifndef __D_EVENT__ 34 | #define __D_EVENT__ 35 | 36 | 37 | #include "doomtype.h" 38 | 39 | 40 | // 41 | // Event handling. 42 | // 43 | 44 | // Input event types. 45 | typedef enum 46 | { 47 | ev_keydown, 48 | ev_keyup, 49 | ev_mouse, 50 | ev_joystick 51 | } evtype_t; 52 | 53 | // Event structure. 54 | typedef struct 55 | { 56 | evtype_t type; 57 | int data1; // keys / mouse/joystick buttons 58 | int data2; // mouse/joystick x move 59 | int data3; // mouse/joystick y move 60 | } event_t; 61 | 62 | 63 | typedef enum 64 | { 65 | ga_nothing, 66 | ga_loadlevel, 67 | ga_newgame, 68 | ga_loadgame, 69 | ga_savegame, 70 | ga_playdemo, 71 | ga_completed, 72 | ga_victory, 73 | ga_worlddone, 74 | } gameaction_t; 75 | 76 | 77 | 78 | // 79 | // Button/action code definitions. 80 | // 81 | typedef enum 82 | { 83 | // Press "Fire". 84 | BT_ATTACK = 1, 85 | 86 | // Use button, to open doors, activate switches. 87 | BT_USE = 2, 88 | 89 | // Flag: game events, not really buttons. 90 | BT_SPECIAL = 128, 91 | BT_SPECIALMASK = 3, 92 | 93 | // Flag, weapon change pending. 94 | // If true, the next 4 bits hold weapon num. 95 | BT_CHANGE = 4, 96 | 97 | // The 4bit weapon mask and shift, convenience. 98 | //BT_WEAPONMASK = (8+16+32), 99 | BT_WEAPONMASK = (8+16+32+64), // extended to pick up SSG // phares 100 | BT_WEAPONSHIFT = 3, 101 | 102 | // Special events 103 | BTS_LOADGAME = 0, // Loads a game 104 | // Pause the game. 105 | BTS_PAUSE = 1, 106 | // Save the game at each console. 107 | BTS_SAVEGAME = 2, 108 | BTS_RESTARTLEVEL= 3, // Restarts the current level 109 | 110 | // Savegame slot numbers occupy the second byte of buttons. 111 | BTS_SAVEMASK = (4+8+16), 112 | BTS_SAVESHIFT = 2, 113 | 114 | } buttoncode_t; 115 | 116 | 117 | // 118 | // GLOBAL VARIABLES 119 | // 120 | #define MAXEVENTS 64 121 | 122 | extern event_t events[MAXEVENTS]; 123 | extern int eventhead; 124 | extern int eventtail; 125 | 126 | extern gameaction_t gameaction; 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Something to do with weapon sprite frames. Don't ask me. 29 | * 30 | *----------------------------------------------------------------------------- 31 | */ 32 | 33 | // We are referring to sprite numbers. 34 | #include "doomtype.h" 35 | #include "info.h" 36 | 37 | #ifdef __GNUG__ 38 | #pragma implementation "d_items.h" 39 | #endif 40 | #include "d_items.h" 41 | 42 | 43 | // 44 | // PSPRITE ACTIONS for waepons. 45 | // This struct controls the weapon animations. 46 | // 47 | // Each entry is: 48 | // ammo/amunition type 49 | // upstate 50 | // downstate 51 | // readystate 52 | // atkstate, i.e. attack/fire/hit frame 53 | // flashstate, muzzle flash 54 | // 55 | weaponinfo_t weaponinfo[NUMWEAPONS] = 56 | { 57 | { 58 | // fist 59 | am_noammo, 60 | S_PUNCHUP, 61 | S_PUNCHDOWN, 62 | S_PUNCH, 63 | S_PUNCH1, 64 | S_NULL 65 | }, 66 | { 67 | // pistol 68 | am_clip, 69 | S_PISTOLUP, 70 | S_PISTOLDOWN, 71 | S_PISTOL, 72 | S_PISTOL1, 73 | S_PISTOLFLASH 74 | }, 75 | { 76 | // shotgun 77 | am_shell, 78 | S_SGUNUP, 79 | S_SGUNDOWN, 80 | S_SGUN, 81 | S_SGUN1, 82 | S_SGUNFLASH1 83 | }, 84 | { 85 | // chaingun 86 | am_clip, 87 | S_CHAINUP, 88 | S_CHAINDOWN, 89 | S_CHAIN, 90 | S_CHAIN1, 91 | S_CHAINFLASH1 92 | }, 93 | { 94 | // missile launcher 95 | am_misl, 96 | S_MISSILEUP, 97 | S_MISSILEDOWN, 98 | S_MISSILE, 99 | S_MISSILE1, 100 | S_MISSILEFLASH1 101 | }, 102 | { 103 | // plasma rifle 104 | am_cell, 105 | S_PLASMAUP, 106 | S_PLASMADOWN, 107 | S_PLASMA, 108 | S_PLASMA1, 109 | S_PLASMAFLASH1 110 | }, 111 | { 112 | // bfg 9000 113 | am_cell, 114 | S_BFGUP, 115 | S_BFGDOWN, 116 | S_BFG, 117 | S_BFG1, 118 | S_BFGFLASH1 119 | }, 120 | { 121 | // chainsaw 122 | am_noammo, 123 | S_SAWUP, 124 | S_SAWDOWN, 125 | S_SAW, 126 | S_SAW1, 127 | S_NULL 128 | }, 129 | { 130 | // super shotgun 131 | am_shell, 132 | S_DSGUNUP, 133 | S_DSGUNDOWN, 134 | S_DSGUN, 135 | S_DSGUN1, 136 | S_DSGUNFLASH1 137 | }, 138 | }; 139 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Items: key cards, artifacts, weapon, ammunition. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | 33 | #ifndef __D_ITEMS__ 34 | #define __D_ITEMS__ 35 | 36 | #include "doomdef.h" 37 | 38 | #ifdef __GNUG__ 39 | #pragma interface 40 | #endif 41 | 42 | 43 | /* Weapon info: sprite frames, ammunition use. */ 44 | typedef struct 45 | { 46 | ammotype_t ammo; 47 | int upstate; 48 | int downstate; 49 | int readystate; 50 | int atkstate; 51 | int flashstate; 52 | 53 | } weaponinfo_t; 54 | 55 | extern weaponinfo_t weaponinfo[NUMWEAPONS]; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Main startup and splash screenstuff. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __D_MAIN__ 33 | #define __D_MAIN__ 34 | 35 | #include "d_event.h" 36 | #include "w_wad.h" 37 | 38 | #ifdef __GNUG__ 39 | #pragma interface 40 | #endif 41 | 42 | /* CPhipps - removed wadfiles[] stuff to w_wad.h */ 43 | 44 | // jff make startskill globally visible 45 | extern skill_t startskill; 46 | 47 | extern char basesavegame[]; // killough 2/16/98: savegame path 48 | 49 | //jff 1/24/98 make command line copies of play modes available 50 | extern boolean clnomonsters; // checkparm of -nomonsters 51 | extern boolean clrespawnparm; // checkparm of -respawn 52 | extern boolean clfastparm; // checkparm of -fast 53 | //jff end of external declaration of command line playmode 54 | 55 | extern boolean nosfxparm; 56 | extern boolean nomusicparm; 57 | extern int ffmap; 58 | 59 | // Called by IO functions when input is detected. 60 | void D_PostEvent(event_t* ev); 61 | 62 | // Demo stuff 63 | extern boolean advancedemo; 64 | void D_AdvanceDemo(void); 65 | void D_DoAdvanceDemo (void); 66 | 67 | // 68 | // BASE LEVEL 69 | // 70 | 71 | void D_PageTicker(void); 72 | void D_PageDrawer(void); 73 | void D_StartTitle(void); 74 | void D_DoomMain(void); 75 | void D_AddFile (const char *file, wad_source_t source); 76 | 77 | /* cph - MBF-like wad/deh/bex autoload code */ 78 | /* proff 2001/7/1 - added prboom.wad as last entry so it's always loaded and 79 | doesn't overlap with the cfg settings */ 80 | #define MAXLOADFILES 3 81 | extern const char *wad_files[MAXLOADFILES], *deh_files[MAXLOADFILES]; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * MapObj data. Map Objects or mobjs are actors, entities, 29 | * thinker, take-your-pick... anything that moves, acts, or 30 | * suffers state changes of more or less violent nature. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __D_THINK__ 35 | #define __D_THINK__ 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | /* 42 | * Experimental stuff. 43 | * To compile this as "ANSI C with classes" 44 | * we will need to handle the various 45 | * action functions cleanly. 46 | */ 47 | // killough 11/98: convert back to C instead of C++ 48 | typedef void (*actionf_t)(); 49 | //typedef void (*actionf_v)(); 50 | //typedef void (*actionf_p1)( void* ); 51 | //typedef void (*actionf_p2)( void*, void* ); 52 | 53 | /* Note: In d_deh.c you will find references to these 54 | * wherever code pointers and function handlers exist 55 | */ 56 | /* 57 | typedef union 58 | { 59 | actionf_p1 acp1; 60 | actionf_v acv; 61 | actionf_p2 acp2; 62 | 63 | } actionf_t; 64 | */ 65 | 66 | /* Historically, "think_t" is yet another 67 | * function pointer to a routine to handle 68 | * an actor. 69 | */ 70 | typedef actionf_t think_t; 71 | 72 | 73 | /* Doubly linked list of actors. */ 74 | typedef struct thinker_s 75 | { 76 | struct thinker_s* prev; 77 | struct thinker_s* next; 78 | think_t function; 79 | 80 | /* killough 8/29/98: we maintain thinkers in several equivalence classes, 81 | * according to various criteria, so as to allow quicker searches. 82 | */ 83 | 84 | struct thinker_s *cnext, *cprev; /* Next, previous thinkers in same class */ 85 | 86 | /* killough 11/98: count of how many other objects reference 87 | * this one using pointers. Used for garbage collection. 88 | */ 89 | unsigned references; 90 | } thinker_t; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * System specific interface stuff. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __D_TICCMD__ 33 | #define __D_TICCMD__ 34 | 35 | #include "doomtype.h" 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | /* The data sampled per tick (single player) 42 | * and transmitted to other peers (multiplayer). 43 | * Mainly movements/button commands per game tick, 44 | * plus a checksum for internal state consistency. 45 | * CPhipps - explicitely signed the elements, since they have to be signed to work right 46 | */ 47 | typedef struct 48 | { 49 | signed char forwardmove; /* *2048 for move */ 50 | signed char sidemove; /* *2048 for move */ 51 | signed short angleturn; /* <<16 for angle delta */ 52 | short consistancy; /* checks for net game */ 53 | byte chatchar; 54 | byte buttons; 55 | } ticcmd_t; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * DoomDef - basic defines for DOOM, e.g. Version, game mode 29 | * and skill level, and display parameters. 30 | * 31 | *----------------------------------------------------------------------------- 32 | */ 33 | 34 | #ifdef __GNUG__ 35 | #pragma implementation "doomdef.h" 36 | #endif 37 | 38 | #include "doomdef.h" 39 | 40 | // Location for any defines turned variables. 41 | // None. 42 | 43 | // proff 08/17/98: Changed for high-res 44 | int SCREENWIDTH=320; 45 | int SCREENHEIGHT=200; 46 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Put all global state variables here. 29 | * 30 | *----------------------------------------------------------------------------- 31 | */ 32 | 33 | #ifdef __GNUG__ 34 | #pragma implementation "doomstat.h" 35 | #endif 36 | #include "doomstat.h" 37 | 38 | // Game Mode - identify IWAD as shareware, retail etc. 39 | GameMode_t gamemode = indetermined; 40 | GameMission_t gamemission = doom; 41 | 42 | // Language. 43 | Language_t language = english; 44 | 45 | // Set if homebrew PWAD stuff has been added. 46 | boolean modifiedgame; 47 | 48 | //----------------------------------------------------------------------------- 49 | 50 | // CPhipps - compatibility vars 51 | complevel_t compatibility_level, default_compatibility_level; 52 | 53 | int comp[COMP_TOTAL], default_comp[COMP_TOTAL]; // killough 10/98 54 | 55 | // v1.1-like pitched sounds 56 | int pitched_sounds; // killough 57 | 58 | int default_translucency; // config file says // phares 59 | boolean general_translucency; // true if translucency is ok // phares 60 | 61 | int demo_insurance, default_demo_insurance; // killough 1/16/98 62 | 63 | int allow_pushers = 1; // MT_PUSH Things // phares 3/10/98 64 | int default_allow_pushers; // killough 3/1/98: make local to each game 65 | 66 | int variable_friction = 1; // ice & mud // phares 3/10/98 67 | int default_variable_friction; // killough 3/1/98: make local to each game 68 | 69 | int weapon_recoil; // weapon recoil // phares 70 | int default_weapon_recoil; // killough 3/1/98: make local to each game 71 | 72 | int player_bobbing; // whether player bobs or not // phares 2/25/98 73 | int default_player_bobbing; // killough 3/1/98: make local to each game 74 | 75 | int monsters_remember; // killough 3/1/98 76 | int default_monsters_remember; 77 | 78 | int monster_infighting=1; // killough 7/19/98: monster<=>monster attacks 79 | int default_monster_infighting=1; 80 | 81 | int monster_friction=1; // killough 10/98: monsters affected by friction 82 | int default_monster_friction=1; 83 | 84 | #ifdef DOGS 85 | int dogs, default_dogs; // killough 7/19/98: Marine's best friend :) 86 | int dog_jumping, default_dog_jumping; // killough 10/98 87 | #endif 88 | 89 | // killough 8/8/98: distance friends tend to move towards players 90 | int distfriend = 128, default_distfriend = 128; 91 | 92 | // killough 9/8/98: whether monsters are allowed to strafe or retreat 93 | int monster_backing, default_monster_backing; 94 | 95 | // killough 9/9/98: whether monsters are able to avoid hazards (e.g. crushers) 96 | int monster_avoid_hazards, default_monster_avoid_hazards; 97 | 98 | // killough 9/9/98: whether monsters help friends 99 | int help_friends, default_help_friends; 100 | 101 | int flashing_hom; // killough 10/98 102 | 103 | int doom_weapon_toggles; // killough 10/98 104 | 105 | int monkeys, default_monkeys; 106 | 107 | -------------------------------------------------------------------------------- /arm9/source/doomtype.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-2006 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Simple basic typedefs, isolated here to make it easier 29 | * separating modules. 30 | * 31 | *-----------------------------------------------------------------------------*/ 32 | 33 | #ifndef __DOOMTYPE__ 34 | #define __DOOMTYPE__ 35 | 36 | #ifndef __BYTEBOOL__ 37 | #define __BYTEBOOL__ 38 | /* Fixed to use builtin bool type with C++. */ 39 | //#ifndef ndsinclude 40 | //typedef unsigned char byte; 41 | //#endif 42 | #include 43 | 44 | //typedef enum { false, true } boolean; 45 | typedef bool qboolean; 46 | typedef int boolean; 47 | #endif 48 | 49 | #ifndef true 50 | #define true 1 51 | #endif 52 | 53 | #ifndef false 54 | #define false 0 55 | #endif 56 | 57 | /* cph - Wrapper for the long long type, as Win32 used a different name. 58 | * Except I don't know what to test as it's compiler specific 59 | * Proff - I fixed it */ 60 | typedef signed long long int int_64_t; 61 | typedef unsigned long long int uint_64_t; 62 | 63 | #undef PATH_MAX 64 | #define PATH_MAX 1024 65 | #undef S_ISDIR 66 | #define S_ISDIR(x) (((sbuf.st_mode & S_IFDIR)==S_IFDIR)?1:0) 67 | 68 | #define CONSTFUNC __attribute__((const)) 69 | #define PUREFUNC __attribute__((pure)) 70 | 71 | /* CPhipps - use limits.h instead of depreciated values.h */ 72 | #include 73 | 74 | /* cph - move compatibility levels here so we can use them in d_server.c */ 75 | typedef enum { 76 | compatibility_null = -1, 77 | doom_12_compatibility, /* Doom v1.2 */ 78 | doom_1666_compatibility, /* Doom v1.666 */ 79 | doom2_19_compatibility, /* Doom & Doom 2 v1.9 */ 80 | ultdoom_compatibility, /* Doom 2 v1.9 */ 81 | finaldoom_compatibility, /* Final & Ultimate Doom v1.9, and Doom95 */ 82 | dosdoom_compatibility, /* Early dosdoom & tasdoom */ 83 | tasdoom_compatibility, /* Early dosdoom & tasdoom */ 84 | boom_compatibility_compatibility, /* Boom's compatibility mode */ 85 | boom_201_compatibility, /* Compatible with Boom v2.01 */ 86 | boom_202_compatibility, /* Compatible with Boom v2.01 */ 87 | lxdoom_1_compatibility, /* LxDoom v1.3.2+ */ 88 | mbf_compatibility, /* MBF */ 89 | prboom_1_compatibility, /* PrBoom 2.03beta? */ 90 | prboom_2_compatibility, /* PrBoom 2.1.0-2.1.1 */ 91 | prboom_3_compatibility, /* PrBoom 2.2.x */ 92 | prboom_4_compatibility, /* PrBoom 2.3.x */ 93 | prboom_5_compatibility, /* PrBoom 2.4.0 */ 94 | prboom_6_compatibility, /* Latest PrBoom */ 95 | MAX_COMPATIBILITY_LEVEL, /* Must be last entry */ 96 | /* Aliases follow */ 97 | boom_compatibility = boom_201_compatibility, /* Alias used by G_Compatibility */ 98 | best_compatibility = prboom_6_compatibility, 99 | } complevel_t; 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Globally defined strings. 29 | * 30 | *----------------------------------------------------------------------------- 31 | */ 32 | 33 | #ifdef __GNUG__ 34 | #pragma implementation "dstrings.h" 35 | #endif 36 | #include "dstrings.h" 37 | 38 | 39 | // killough 1/18/98: remove hardcoded limit, add const: 40 | const char *const endmsg[]= 41 | { 42 | // DOOM1 43 | QUITMSG, 44 | "please don't leave, there's more\ndemons to toast!", 45 | "let's beat it -- this is turning\ninto a bloodbath!", 46 | "i wouldn't leave if i were you.\ndos is much worse.", 47 | "you're trying to say you like dos\nbetter than me, right?", 48 | "don't leave yet -- there's a\ndemon around that corner!", 49 | "ya know, next time you come in here\ni'm gonna toast ya.", 50 | "go ahead and leave. see if i care.", // 1/15/98 killough 51 | 52 | // QuitDOOM II messages 53 | "you want to quit?\nthen, thou hast lost an eighth!", 54 | "don't go now, there's a \ndimensional shambler waiting\nat the dos prompt!", 55 | "get outta here and go back\nto your boring programs.", 56 | "if i were your boss, i'd \n deathmatch ya in a minute!", 57 | "look, bud. you leave now\nand you forfeit your body count!", 58 | "just leave. when you come\nback, i'll be waiting with a bat.", 59 | "you're lucky i don't smack\nyou for thinking about leaving.", // 1/15/98 killough 60 | 61 | // FinalDOOM? 62 | 63 | // Note that these ending "bad taste" strings were commented out 64 | // in the original id code as the #else case of an #if 1 65 | // Obviously they were internal playthings before the release of 66 | // DOOM2 and were not intended for public use. 67 | // 68 | // Following messages commented out for now. Bad taste. // phares 69 | 70 | // "fuck you, pussy!\nget the fuck out!", 71 | // "you quit and i'll jizz\nin your cystholes!", 72 | // "if you leave, i'll make\nthe lord drink my jizz.", 73 | // "hey, ron! can we say\n'fuck' in the game?", 74 | // "i'd leave: this is just\nmore monsters and levels.\nwhat a load.", 75 | // "suck it down, asshole!\nyou're a fucking wimp!", 76 | // "don't quit now! we're \nstill spending your money!", 77 | 78 | // Internal debug. Different style, too. 79 | "THIS IS NO MESSAGE!\nPage intentionally left blank.", // 1/15/98 killough 80 | }; 81 | 82 | // killough 1/18/98: remove hardcoded limit and replace with var (silly hack): 83 | const size_t NUM_QUITMESSAGES = sizeof(endmsg)/sizeof(*endmsg) - 1; 84 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * DOOM strings, by language. 29 | * Note: In BOOM, some new strings hav ebeen defined that are 30 | * not found in the French version. A better approach is 31 | * to create a BEX text-replacement file for other 32 | * languages since any language can be supported that way 33 | * without recompiling the program. 34 | * 35 | *-----------------------------------------------------------------------------*/ 36 | 37 | #ifndef __DSTRINGS__ 38 | #define __DSTRINGS__ 39 | 40 | /* All important printed strings. 41 | * Language selection (message strings). 42 | * Use -DFRENCH etc. 43 | */ 44 | 45 | #ifdef FRENCH 46 | #include "d_french.h" 47 | #else 48 | #include "d_englsh.h" 49 | #endif 50 | 51 | /* Note this is not externally modifiable through DEH/BEX 52 | * Misc. other strings. 53 | * #define SAVEGAMENAME "boomsav" * killough 3/22/98 * 54 | * Ty 05/04/98 - replaced with a modifiable string, see d_deh.c 55 | */ 56 | 57 | /* 58 | * File locations, 59 | * relative to current position. 60 | * Path names are OS-sensitive. 61 | */ 62 | #define DEVMAPS "devmaps" 63 | #define DEVDATA "devdata" 64 | 65 | 66 | /* Not done in french? 67 | * QuitDOOM messages * 68 | * killough 1/18/98: 69 | * replace hardcoded limit with extern var (silly hack, I know) 70 | */ 71 | 72 | #include 73 | 74 | extern const size_t NUM_QUITMESSAGES; /* Calculated in dstrings.c */ 75 | 76 | extern const char* const endmsg[]; /* killough 1/18/98 const added */ 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Related to f_finale.c, which is called at the end of a level 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | 33 | #ifndef __F_FINALE__ 34 | #define __F_FINALE__ 35 | 36 | #include "doomtype.h" 37 | #include "d_event.h" 38 | 39 | /* 40 | * FINALE 41 | */ 42 | 43 | /* Called by main loop. */ 44 | boolean F_Responder (event_t* ev); 45 | 46 | /* Called by main loop. */ 47 | void F_Ticker (void); 48 | 49 | /* Called by main loop. */ 50 | void F_Drawer (void); 51 | 52 | void F_StartFinale (void); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Mission start screen wipe/melt, special effects. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __F_WIPE_H__ 33 | #define __F_WIPE_H__ 34 | 35 | /* 36 | * SCREEN WIPE PACKAGE 37 | */ 38 | 39 | int wipe_ScreenWipe (int x, int y, int width, int height, int ticks); 40 | int wipe_StartScreen(int x, int y, int width, int height); 41 | int wipe_EndScreen (int x, int y, int width, int height); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /arm9/source/i_joy.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Joystick handling for Linux 29 | * 30 | *----------------------------------------------------------------------------- 31 | */ 32 | 33 | #ifndef lint 34 | #endif /* lint */ 35 | 36 | #include 37 | 38 | //#include "SDL.h" 39 | #include "doomdef.h" 40 | #include "doomtype.h" 41 | #include "m_argv.h" 42 | #include "d_event.h" 43 | #include "d_main.h" 44 | #include "i_joy.h" 45 | #include "lprintf.h" 46 | 47 | int joyleft; 48 | int joyright; 49 | int joyup; 50 | int joydown; 51 | 52 | int usejoystick; 53 | 54 | #ifdef HAVE_SDL_JOYSTICKGETAXIS 55 | static SDL_Joystick *joystick; 56 | #endif 57 | 58 | void I_EndJoystick(void) 59 | { 60 | lprintf(LO_DEBUG, "I_EndJoystick : closing joystick\n"); 61 | } 62 | 63 | void I_PollJoystick(void) 64 | { 65 | #ifdef HAVE_SDL_JOYSTICKGETAXIS 66 | event_t ev; 67 | Sint16 axis_value; 68 | 69 | if (!usejoystick || (!joystick)) return; 70 | ev.type = ev_joystick; 71 | ev.data1 = 72 | (SDL_JoystickGetButton(joystick, 0)<<0) | 73 | (SDL_JoystickGetButton(joystick, 1)<<1) | 74 | (SDL_JoystickGetButton(joystick, 2)<<2) | 75 | (SDL_JoystickGetButton(joystick, 3)<<3); 76 | axis_value = SDL_JoystickGetAxis(joystick, 0) / 3000; 77 | if (abs(axis_value)<10) axis_value=0; 78 | ev.data2 = axis_value; 79 | axis_value = SDL_JoystickGetAxis(joystick, 1) / 3000; 80 | if (abs(axis_value)<10) axis_value=0; 81 | ev.data3 = axis_value; 82 | 83 | D_PostEvent(&ev); 84 | #endif 85 | } 86 | 87 | void I_InitJoystick(void) 88 | { 89 | #ifdef HAVE_SDL_JOYSTICKGETAXIS 90 | const char* fname = "I_InitJoystick : "; 91 | int num_joysticks; 92 | 93 | if (!usejoystick) return; 94 | SDL_InitSubSystem(SDL_INIT_JOYSTICK); 95 | num_joysticks=SDL_NumJoysticks(); 96 | if (M_CheckParm("-nojoy") || (usejoystick>num_joysticks) || (usejoystick<0)) { 97 | if ((usejoystick > num_joysticks) || (usejoystick < 0)) 98 | lprintf(LO_WARN, "%sinvalid joystick %d\n", fname, usejoystick); 99 | else 100 | lprintf(LO_INFO, "%suser disabled\n", fname); 101 | return; 102 | } 103 | joystick=SDL_JoystickOpen(usejoystick-1); 104 | if (!joystick) 105 | lprintf(LO_ERROR, "%serror opening joystick %s\n", fname, SDL_JoystickName(usejoystick-1)); 106 | else { 107 | atexit(I_EndJoystick); 108 | lprintf(LO_INFO, "%sopened %s\n", fname, SDL_JoystickName(usejoystick-1)); 109 | joyup = 32767; 110 | joydown = -32768; 111 | joyright = 32767; 112 | joyleft = -32768; 113 | } 114 | #endif 115 | } 116 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Joystick interface. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | extern int joybfire; 33 | extern int joybstrafe; 34 | extern int joybuse; 35 | extern int joybspeed; 36 | 37 | extern int joyleft; 38 | extern int joyright; 39 | extern int joyup; 40 | extern int joydown; 41 | 42 | extern int usejoystick; 43 | 44 | void I_InitJoystick(); 45 | void I_PollJoystick(); 46 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * General system functions. Signal related stuff, exit function 29 | * prototypes, and programmable Doom clock. 30 | * 31 | *----------------------------------------------------------------------------- 32 | */ 33 | 34 | #ifndef __I_MAIN__ 35 | #define __I_MAIN__ 36 | 37 | void I_Init(void); 38 | void I_SafeExit(int rc); 39 | void StartWifi(); 40 | 41 | extern int broken_pipe; 42 | extern int (*I_GetTime)(void); 43 | 44 | // Jefklak 19/11/06 - allow video routines to check console var. 45 | void switchConsole(); 46 | void DStoggleBrightness(); 47 | void DSgetUserName(); 48 | void keyboardStart(); 49 | void keyboardEnd(); 50 | extern int gen_console_enable; 51 | extern int gen_screen_swap; 52 | extern int FG; 53 | extern char *DS_USERNAME; 54 | // END 55 | 56 | #ifdef SECURE_UID 57 | extern uid_t stored_euid; /* UID that the SVGALib I_InitGraphics switches to before vga_init() */ 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /arm9/source/i_net.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Old network interface stuff. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | 33 | #ifndef __I_NET__ 34 | #define __I_NET__ 35 | 36 | #include "config.h" 37 | 38 | 39 | #ifdef __GNUG__ 40 | #pragma interface 41 | #endif 42 | 43 | // Called by D_DoomMain. 44 | 45 | enum netcmdcode_e { 46 | NCMD_EXIT = 0x80000000, 47 | NCMD_RETRANSMIT = 0x40000000, 48 | NCMD_SETUP = 0x20000000, 49 | NCMD_KILL = 0x10000000, /* kill game */ 50 | NCMD_NOSWAP = 0xb0000000, // cph - endianness fixed by d_net.c _not_ i_net.c 51 | NCMD_CHECKSUM = 0x0fffffff 52 | }; 53 | 54 | void I_InitNetwork (void); 55 | void I_NetCmd (enum netcmdcode_e flags); 56 | int ExpandTics(int); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Low level network interface. 29 | *-----------------------------------------------------------------------------*/ 30 | 31 | #include "config.h" 32 | 33 | #ifdef USE_SDL_NET 34 | //#include "SDL.h" 35 | #include "SDL_net.h" 36 | #define UDP_SOCKET UDPsocket 37 | #define UDP_PACKET UDPpacket 38 | #define AF_INET 39 | #define UDP_CHANNEL int 40 | extern UDP_SOCKET udp_socket; 41 | #else 42 | #define UDP_CHANNEL struct sockaddr 43 | #endif 44 | 45 | #ifndef IPPORT_RESERVED 46 | #define IPPORT_RESERVED 1024 47 | #endif 48 | 49 | void I_InitNetwork(void); 50 | size_t I_GetPacket(packet_header_t* buffer, size_t buflen); 51 | void I_SendPacket(packet_header_t* packet, size_t len); 52 | void I_WaitForPacket(int ms); 53 | 54 | #ifdef USE_SDL_NET 55 | UDP_SOCKET I_Socket(u16 port); 56 | int I_ConnectToServer(const char *serv); 57 | UDP_CHANNEL I_RegisterPlayer(IPaddress *ipaddr); 58 | void I_UnRegisterPlayer(UDP_CHANNEL channel); 59 | extern IPaddress sentfrom_addr; 60 | #endif 61 | 62 | #ifdef AF_INET 63 | void I_SendPacketTo(packet_header_t* packet, size_t len, UDP_CHANNEL *to); 64 | void I_SetupSocket(int sock, int port, int family); 65 | void I_PrintAddress(FILE* fp, UDP_CHANNEL *addr); 66 | 67 | extern UDP_CHANNEL sentfrom; 68 | extern int v4socket, v6socket; 69 | #endif 70 | 71 | extern size_t sentbytes, recvdbytes; 72 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * System interface, sound. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __I_SOUND__ 33 | #define __I_SOUND__ 34 | 35 | #include "sounds.h" 36 | #include "doomtype.h" 37 | 38 | #define SNDSERV 39 | #undef SNDINTR 40 | 41 | #ifndef SNDSERV 42 | #include "l_soundgen.h" 43 | #endif 44 | 45 | // Init at program start... 46 | void I_InitSound(void); 47 | 48 | // ... shut down and relase at program termination. 49 | void I_ShutdownSound(void); 50 | 51 | // 52 | // SFX I/O 53 | // 54 | 55 | // Initialize channels? 56 | void I_SetChannels(void); 57 | 58 | // Get raw data lump index for sound descriptor. 59 | int I_GetSfxLumpNum (sfxinfo_t *sfxinfo); 60 | 61 | // Starts a sound in a particular sound channel. 62 | int I_StartSound(int id, int channel, int vol, int sep, int pitch, int priority); 63 | 64 | // Stops a sound channel. 65 | void I_StopSound(int handle); 66 | 67 | // Called by S_*() functions 68 | // to see if a channel is still playing. 69 | // Returns 0 if no longer playing, 1 if playing. 70 | boolean I_SoundIsPlaying(int handle); 71 | 72 | // Updates the volume, separation, 73 | // and pitch of a sound channel. 74 | void I_UpdateSoundParams(int handle, int vol, int sep, int pitch); 75 | 76 | // 77 | // MUSIC I/O 78 | // 79 | void I_InitMusic(void); 80 | void I_ShutdownMusic(void); 81 | 82 | // Volume. 83 | void I_SetMusicVolume(int volume); 84 | 85 | // PAUSE game handling. 86 | void I_PauseSong(int handle); 87 | void I_ResumeSong(int handle); 88 | 89 | // Registers a song handle to song data. 90 | int I_RegisterSong(const void *data, size_t len); 91 | 92 | // cournia - tries to load a music file 93 | int I_RegisterMusic( const char* filename, musicinfo_t *music ); 94 | 95 | // Called by anything that wishes to start music. 96 | // plays a song, and when the song is done, 97 | // starts playing it again in an endless loop. 98 | // Horrible thing to do, considering. 99 | void I_PlaySong(int handle, int looping); 100 | 101 | // Stops a song over 3 seconds. 102 | void I_StopSong(int handle); 103 | 104 | // See above (register), then think backwards 105 | void I_UnRegisterSong(int handle); 106 | 107 | // Allegro card support jff 1/18/98 108 | extern int snd_card; 109 | extern int mus_card; 110 | // CPhipps - put these in config file 111 | extern const char* sndserver_filename; 112 | extern const char* snd_device; 113 | extern const char* musserver_filename; 114 | extern int snd_samplerate; 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * System specific interface stuff. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __I_SYSTEM__ 33 | #define __I_SYSTEM__ 34 | 35 | #ifdef __GNUG__ 36 | #pragma interface 37 | #endif 38 | #include 39 | 40 | extern int ms_to_next_tick; 41 | int I_GetTime_RealTime(void); /* killough */ 42 | 43 | unsigned long I_GetRandomTimeSeed(void); /* cphipps */ 44 | 45 | void I_uSleep(unsigned long usecs); 46 | 47 | /* cphipps - I_GetVersionString 48 | * Returns a version string in the given buffer 49 | */ 50 | const char* I_GetVersionString(char* buf, size_t sz); 51 | 52 | /* cphipps - I_SigString 53 | * Returns a string describing a signal number 54 | */ 55 | const char* I_SigString(char* buf, size_t sz, int signum); 56 | 57 | char *I_DoomExeDir(void); // killough 2/16/98: path to executable's dir 58 | 59 | char* I_FindFile(const char* wfname, const char* ext); 60 | 61 | /* cph 2001/11/18 - wrapper for read(2) which deals with partial reads */ 62 | void I_Read(FILE *fd, void* vbuf, size_t sz); 63 | 64 | /* cph 2001/11/18 - Move W_Filelength to i_system.c */ 65 | int I_Filelength(FILE *handle); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * System specific interface stuff. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __I_VIDEO__ 33 | #define __I_VIDEO__ 34 | 35 | #include "doomtype.h" 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | void I_PreInitGraphics(void); /* CPhipps - do stuff immediately on start */ 42 | void I_SetRes(unsigned int width, unsigned int height); /* CPhipps - set resolution */ 43 | void I_InitGraphics (void); 44 | void I_UpdateVideoMode(void); 45 | void I_ShutdownGraphics(void); 46 | 47 | /* Takes full 8 bit values. */ 48 | void I_SetPalette(int pal); /* CPhipps - pass down palette number */ 49 | 50 | void I_UpdateNoBlit (void); 51 | void I_FinishUpdate (void); 52 | 53 | void I_ReadScreen (byte* scr); 54 | 55 | /* I_StartTic 56 | * Called by D_DoomLoop, 57 | * called before processing each tic in a frame. 58 | * Quick syncronous operations are performed here. 59 | * Can call D_PostEvent. 60 | */ 61 | void I_StartTic (void); 62 | 63 | /* I_StartFrame 64 | * Called by D_DoomLoop, 65 | * called before processing any tics in a frame 66 | * (just after displaying a frame). 67 | * Time consuming syncronous operations 68 | * are performed here (joystick reading). 69 | * Can call D_PostEvent. 70 | */ 71 | 72 | void I_StartFrame (void); 73 | 74 | extern int use_doublebuffer; /* proff 2001-7-4 - controls wether to use doublebuffering*/ 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Provides a logical console output routine that allows what is 29 | * output to console normally and when output is redirected to 30 | * be controlled.. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #include 35 | #include 36 | #include 37 | #include "doomtype.h" 38 | #include "lprintf.h" 39 | #include "i_main.h" 40 | #include "m_argv.h" 41 | 42 | int cons_error_mask = -1-LO_INFO; /* all but LO_INFO when redir'd */ 43 | int cons_output_mask = -1; /* all output enabled */ 44 | 45 | /* cphipps - enlarged message buffer and made non-static 46 | * We still have to be careful here, this function can be called after exit 47 | */ 48 | #define MAX_MESSAGE_SIZE 2048 49 | 50 | int lprintf(OutputLevels pri, const char *s, ...) 51 | { 52 | int r=0; 53 | char msg[MAX_MESSAGE_SIZE]; 54 | int lvl=pri; 55 | 56 | va_list v; 57 | va_start(v,s); 58 | 59 | vsprintf(msg,s,v); 60 | 61 | va_end(v); 62 | 63 | if (lvl&cons_output_mask) /* mask output as specified */ 64 | { 65 | r=fprintf(stdout,"%s",msg); 66 | } 67 | if (!isatty(1) && lvl&cons_error_mask) /* if stdout redirected */ 68 | r=fprintf(stderr,"%s",msg); /* select output at console */ 69 | 70 | return r; 71 | } 72 | 73 | /* 74 | * I_Error 75 | * 76 | * cphipps - moved out of i_* headers, to minimise source files that depend on 77 | * the low-level headers. All this does is print the error, then call the 78 | * low-level safe exit function. 79 | * killough 3/20/98: add const 80 | */ 81 | 82 | void I_Error(const char *error, ...) 83 | { 84 | char errmsg[MAX_MESSAGE_SIZE]; 85 | va_list argptr; 86 | va_start(argptr,error); 87 | 88 | vsprintf(errmsg,error,argptr); 89 | 90 | va_end(argptr); 91 | fprintf(stderr,"%s\n",errmsg); 92 | 93 | I_SafeExit(-1); 94 | } 95 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Declarations etc. for logical console output 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __LPRINTF__ 33 | #define __LPRINTF__ 34 | 35 | typedef enum /* Logical output levels */ 36 | { 37 | LO_INFO=1, /* One of these is used in each physical output */ 38 | LO_CONFIRM=2, /* call. Which are output, or echoed to console */ 39 | LO_WARN=4, /* if output redirected is determined by the */ 40 | LO_ERROR=8, /* global masks: cons_output_mask,cons_error_mask. */ 41 | LO_FATAL=16, 42 | LO_DEBUG=32, 43 | LO_ALWAYS=64, 44 | } OutputLevels; 45 | 46 | #ifndef __GNUC__ 47 | #define __attribute__(x) 48 | #endif 49 | 50 | extern int lprintf(OutputLevels pri, const char *fmt, ...) __attribute__((format(printf,2,3))); 51 | extern int cons_output_mask; 52 | extern int cons_error_mask; 53 | 54 | /* killough 3/20/98: add const 55 | * killough 4/25/98: add gcc attributes 56 | * cphipps 01/11- moved from i_system.h */ 57 | void I_Error(const char *error, ...) __attribute__((format(printf,1,2))); 58 | 59 | #ifdef _WIN32 60 | void I_ConTextAttr(unsigned char a); 61 | void I_UpdateConsole(void); 62 | int Init_ConsoleWin(void); 63 | void Done_ConsoleWin(void); 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Some argument handling. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #include 33 | // CPhipps - include the correct header 34 | #include "doomtype.h" 35 | #include "m_argv.h" 36 | 37 | int myargc; 38 | const char * const * myargv; // CPhipps - not sure if ANSI C allows you to 39 | // modify contents of argv, but I can't imagine it does. 40 | 41 | // 42 | // M_CheckParm 43 | // Checks for the given parameter 44 | // in the program's command line arguments. 45 | // Returns the argument number (1 to argc-1) 46 | // or 0 if not present 47 | // 48 | 49 | int M_CheckParm(const char *check) 50 | { 51 | signed int i = myargc; 52 | while (--i>0) 53 | if (!strcasecmp(check, myargv[i])) 54 | return i; 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Argument handling. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | 33 | #ifndef __M_ARGV__ 34 | #define __M_ARGV__ 35 | 36 | /* 37 | * MISC 38 | */ 39 | extern int myargc; 40 | extern const char * const * myargv; /* CPhipps - const * const * */ 41 | 42 | /* Returns the position of the given parameter in the arg list (0 if not found). */ 43 | int M_CheckParm(const char *check); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Main loop menu stuff. 29 | * Random number LUT. 30 | * Default Config File. 31 | * PCX Screenshots. 32 | * 33 | *-----------------------------------------------------------------------------*/ 34 | 35 | #ifdef __GNUG__ 36 | #pragma implementation "m_bbox.h" 37 | #endif 38 | #include "m_bbox.h" 39 | 40 | void M_ClearBox (fixed_t *box) 41 | { 42 | box[BOXTOP] = box[BOXRIGHT] = INT_MIN; 43 | box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX; 44 | } 45 | 46 | void M_AddToBox(fixed_t* box,fixed_t x,fixed_t y) 47 | { 48 | if (xbox[BOXRIGHT]) 51 | box[BOXRIGHT] = x; 52 | if (ybox[BOXTOP]) 55 | box[BOXTOP] = y; 56 | } 57 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Simple bounding box datatype and functions. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | 33 | #ifndef __M_BBOX__ 34 | #define __M_BBOX__ 35 | 36 | #include 37 | #include "m_fixed.h" 38 | 39 | /* Bounding box coordinate storage. */ 40 | enum 41 | { 42 | BOXTOP, 43 | BOXBOTTOM, 44 | BOXLEFT, 45 | BOXRIGHT 46 | }; /* bbox coordinates */ 47 | 48 | /* Bounding box functions. */ 49 | 50 | void M_ClearBox(fixed_t* box); 51 | 52 | void M_AddToBox(fixed_t* box,fixed_t x,fixed_t y); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Cheat code checking. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __M_CHEAT__ 33 | #define __M_CHEAT__ 34 | 35 | /* killough 4/16/98: Cheat table structure */ 36 | 37 | extern struct cheat_s { 38 | const unsigned char *cheat; 39 | const char *const deh_cheat; 40 | enum { 41 | always = 0, 42 | not_dm = 1, 43 | not_coop = 2, 44 | not_demo = 4, 45 | not_menu = 8, 46 | not_deh = 16, 47 | not_net = not_dm | not_coop 48 | } const when; 49 | void (*const func)(); 50 | const int arg; 51 | uint_64_t code, mask; 52 | } cheat[]; 53 | 54 | boolean M_FindCheats(int key); 55 | 56 | extern int idmusnum; 57 | // Jefklak 21/11/06 58 | extern int gen_cheat_enable; 59 | void gen_cheat(); 60 | // END 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /arm9/source/m_fixed.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Fixed point arithemtics, implementation. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __M_FIXED__ 33 | #define __M_FIXED__ 34 | 35 | #include "config.h" 36 | #include "doomtype.h" 37 | 38 | /* 39 | * Fixed point, 32bit as 16.16. 40 | */ 41 | 42 | #define FRACBITS 16 43 | #define FRACUNIT (1<> (8*sizeof _t-1); (_t^_s)-_s;}) 55 | 56 | /* 57 | * Fixed Point Multiplication 58 | */ 59 | 60 | /* CPhipps - made __inline__ to inline, as specified in the gcc docs 61 | * Also made const */ 62 | 63 | inline static CONSTFUNC fixed_t FixedMul(fixed_t a, fixed_t b) 64 | { 65 | return (fixed_t)((int_64_t) a*b >> FRACBITS); 66 | } 67 | 68 | /* 69 | * Fixed Point Division 70 | */ 71 | 72 | /* CPhipps - made __inline__ to inline, as specified in the gcc docs 73 | * Also made const */ 74 | 75 | inline static CONSTFUNC fixed_t FixedDiv(fixed_t a, fixed_t b) 76 | { 77 | return (D_abs(a)>>14) >= D_abs(b) ? ((a^b)>>31) ^ INT_MAX : 78 | (fixed_t)(((int_64_t) a << FRACBITS) / b); 79 | } 80 | 81 | /* CPhipps - 82 | * FixedMod - returns a % b, guaranteeing 0<=a 61 | #ifdef __arch__swab16 62 | #define doom_swap_s (signed short)__arch__swab16 63 | #endif 64 | #ifdef __arch__swab32 65 | #define doom_swap_l (signed long)__arch__swab32 66 | #endif 67 | #endif // HAVE_ASM_BYTEORDER_H 68 | 69 | #ifdef HAVE_LIBKERN_OSBYTEORDER_H 70 | #include 71 | 72 | #define doom_swap_s (short)OSSwapInt16 73 | #define doom_swap_l (long)OSSwapInt32 74 | #endif */ 75 | 76 | #ifndef doom_swap_l 77 | #define doom_swap_l(x) \ 78 | ((long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ 79 | (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ 80 | (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ 81 | (((unsigned long int)(x) & 0xff000000U) >> 24))) 82 | #endif 83 | 84 | #ifndef doom_swap_s 85 | #define doom_swap_s(x) \ 86 | ((short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ 87 | (((unsigned short int)(x) & 0xff00) >> 8))) 88 | #endif 89 | 90 | /* Macros are named doom_XtoYT, where 91 | * X is thing to convert from, Y is thing to convert to, chosen from 92 | * n for network, h for host (i.e our machine's), w for WAD (Doom data files) 93 | * and T is the type, l or s for long or short 94 | * 95 | * CPhipps - all WADs and network packets will be little endian for now 96 | * Use separate macros so network could be converted to big-endian later. 97 | */ 98 | 99 | #ifdef WORDS_BIGENDIAN 100 | 101 | #define doom_wtohl(x) doom_swap_l(x) 102 | #define doom_htowl(x) doom_swap_l(x) 103 | #define doom_wtohs(x) doom_swap_s(x) 104 | #define doom_htows(x) doom_swap_s(x) 105 | 106 | #define doom_ntohl(x) doom_swap_l(x) 107 | #define doom_htonl(x) doom_swap_l(x) 108 | #define doom_ntohs(x) doom_swap_s(x) 109 | #define doom_htons(x) doom_swap_s(x) 110 | 111 | #else 112 | 113 | #define doom_wtohl(x) (long int)(x) 114 | #define doom_htowl(x) (long int)(x) 115 | #define doom_wtohs(x) (short int)(x) 116 | #define doom_htows(x) (short int)(x) 117 | 118 | #define doom_ntohl(x) (long int)(x) 119 | #define doom_htonl(x) (long int)(x) 120 | #define doom_ntohs(x) (short int)(x) 121 | #define doom_htons(x) (short int)(x) 122 | 123 | #endif 124 | 125 | /* CPhipps - Boom's old LONG and SHORT endianness macros are for WAD stuff */ 126 | 127 | #define LONG(x) doom_wtohl(x) 128 | #define SHORT(x) doom_htows(x) 129 | 130 | #endif 131 | -------------------------------------------------------------------------------- /arm9/source/p_enemy.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Enemy thinking, AI. 29 | * Action Pointer Functions 30 | * that are associated with states/frames. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __P_ENEMY__ 35 | #define __P_ENEMY__ 36 | 37 | #include "p_mobj.h" 38 | 39 | void P_NoiseAlert (mobj_t *target, mobj_t *emmiter); 40 | void P_SpawnBrainTargets(void); /* killough 3/26/98: spawn icon landings */ 41 | /* proff 11/22/98: Andy Baker's stealth monsters */ 42 | void P_BecomeVisible (mobj_t *actor); 43 | void P_IncreaseVisibility (mobj_t *actor); 44 | void P_DecreaseVisibility (mobj_t *actor); 45 | 46 | extern struct brain_s { /* killough 3/26/98: global state of boss brain */ 47 | int easy, targeton; 48 | } brain; 49 | 50 | #endif // __P_ENEMY__ 51 | -------------------------------------------------------------------------------- /arm9/source/p_inter.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Thing events, and dehacked specified numbers controlling them. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __P_INTER__ 33 | #define __P_INTER__ 34 | 35 | #include "d_player.h" 36 | #include "p_mobj.h" 37 | 38 | #ifdef __GNUG__ 39 | #pragma interface 40 | #endif 41 | 42 | /* Ty 03/09/98 Moved to an int in p_inter.c for deh and externalization */ 43 | #define MAXHEALTH maxhealth 44 | 45 | /* follow a player exlusively for 3 seconds */ 46 | #define BASETHRESHOLD (100) 47 | 48 | boolean P_GivePower(player_t *, int); 49 | void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher); 50 | void P_DamageMobj(mobj_t *target,mobj_t *inflictor,mobj_t *source,int damage); 51 | 52 | /* killough 5/2/98: moved from d_deh.c, g_game.c, m_misc.c, others: */ 53 | 54 | extern int god_health; /* Ty 03/09/98 - deh support, see also p_inter.c */ 55 | extern int idfa_armor; 56 | extern int idfa_armor_class; 57 | extern int idkfa_armor; 58 | extern int idkfa_armor_class; /* Ty - end */ 59 | /* Ty 03/13/98 - externalized initial settings for respawned player */ 60 | extern int initial_health; 61 | extern int initial_bullets; 62 | extern int maxhealth; 63 | extern int max_armor; 64 | extern int green_armor_class; 65 | extern int blue_armor_class; 66 | extern int max_soul; 67 | extern int soul_health; 68 | extern int mega_health; 69 | extern int god_health; 70 | extern int idfa_armor; 71 | extern int idfa_armor_class; 72 | extern int idkfa_armor; 73 | extern int idkfa_armor_class; 74 | extern int bfgcells; 75 | extern int monsters_infight; // e6y: Dehacked support - monsters infight 76 | extern int maxammo[], clipammo[]; 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /arm9/source/p_map.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Map functions 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __P_MAP__ 33 | #define __P_MAP__ 34 | 35 | #include "r_defs.h" 36 | #include "d_player.h" 37 | 38 | #define USERANGE (64*FRACUNIT) 39 | #define MELEERANGE (64*FRACUNIT) 40 | #define MISSILERANGE (32*64*FRACUNIT) 41 | 42 | // MAXRADIUS is for precalculated sector block boxes the spider demon 43 | // is larger, but we do not have any moving sectors nearby 44 | #define MAXRADIUS (32*FRACUNIT) 45 | 46 | // killough 3/15/98: add fourth argument to P_TryMove 47 | boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean dropoff); 48 | 49 | // killough 8/9/98: extra argument for telefragging 50 | boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y,boolean boss); 51 | void P_SlideMove(mobj_t *mo); 52 | boolean P_CheckSight(mobj_t *t1, mobj_t *t2); 53 | void P_UseLines(player_t *player); 54 | 55 | // killough 8/2/98: add 'mask' argument to prevent friends autoaiming at others 56 | fixed_t P_AimLineAttack(mobj_t *t1,angle_t angle,fixed_t distance, uint_64_t mask); 57 | 58 | void P_LineAttack(mobj_t *t1, angle_t angle, fixed_t distance, 59 | fixed_t slope, int damage ); 60 | void P_RadiusAttack(mobj_t *spot, mobj_t *source, int damage); 61 | boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y); 62 | 63 | //jff 3/19/98 P_CheckSector(): new routine to replace P_ChangeSector() 64 | boolean P_ChangeSector(sector_t* sector,boolean crunch); 65 | boolean P_CheckSector(sector_t *sector, boolean crunch); 66 | void P_DelSeclist(msecnode_t*); // phares 3/16/98 67 | void P_CreateSecNodeList(mobj_t*,fixed_t,fixed_t); // phares 3/14/98 68 | boolean Check_Sides(mobj_t *, int, int); // phares 69 | 70 | int P_GetMoveFactor(const mobj_t *mo, int *friction); // killough 8/28/98 71 | int P_GetFriction(const mobj_t *mo, int *factor); // killough 8/28/98 72 | void P_ApplyTorque(mobj_t *mo); // killough 9/12/98 73 | 74 | /* cphipps 2004/08/30 */ 75 | void P_MapStart(void); 76 | void P_MapEnd(void); 77 | 78 | // If "floatok" true, move would be ok if within "tmfloorz - tmceilingz". 79 | extern boolean floatok; 80 | extern boolean felldown; // killough 11/98: indicates object pushed off ledge 81 | extern fixed_t tmfloorz; 82 | extern fixed_t tmceilingz; 83 | extern line_t *ceilingline; 84 | extern line_t *floorline; // killough 8/23/98 85 | extern mobj_t *linetarget; // who got hit (or NULL) 86 | extern msecnode_t *sector_list; // phares 3/16/98 87 | extern fixed_t tmbbox[4]; // phares 3/20/98 88 | extern line_t *blockline; // killough 8/11/98 89 | 90 | #endif // __P_MAP__ 91 | -------------------------------------------------------------------------------- /arm9/source/p_maputl.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Map utility functions 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __P_MAPUTL__ 33 | #define __P_MAPUTL__ 34 | 35 | #include "r_defs.h" 36 | 37 | /* mapblocks are used to check movement against lines and things */ 38 | #define MAPBLOCKUNITS 128 39 | #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT) 40 | #define MAPBLOCKSHIFT (FRACBITS+7) 41 | #define MAPBMASK (MAPBLOCKSIZE-1) 42 | #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS) 43 | 44 | #define PT_ADDLINES 1 45 | #define PT_ADDTHINGS 2 46 | #define PT_EARLYOUT 4 47 | 48 | typedef struct { 49 | fixed_t x; 50 | fixed_t y; 51 | fixed_t dx; 52 | fixed_t dy; 53 | } divline_t; 54 | 55 | typedef struct { 56 | fixed_t frac; /* along trace line */ 57 | boolean isaline; 58 | union { 59 | mobj_t* thing; 60 | line_t* line; 61 | } d; 62 | } intercept_t; 63 | 64 | typedef boolean (*traverser_t)(intercept_t *in); 65 | 66 | fixed_t CONSTFUNC P_AproxDistance (fixed_t dx, fixed_t dy); 67 | int PUREFUNC P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line); 68 | int PUREFUNC P_PointOnDivlineSide (fixed_t x, fixed_t y, 69 | const divline_t *line); 70 | int PUREFUNC P_BoxOnLineSide (const fixed_t *tmbox, const line_t *ld); 71 | fixed_t PUREFUNC P_InterceptVector (const divline_t *v2, const divline_t *v1); 72 | /* cph - old compatibility version below */ 73 | fixed_t PUREFUNC P_InterceptVector2(const divline_t *v2, const divline_t *v1); 74 | 75 | void P_MakeDivline (const line_t *li, divline_t *dl); 76 | void P_LineOpening (const line_t *linedef); 77 | void P_UnsetThingPosition(mobj_t *thing); 78 | void P_SetThingPosition(mobj_t *thing); 79 | boolean P_BlockLinesIterator (int x, int y, boolean func(line_t *)); 80 | boolean P_BlockThingsIterator(int x, int y, boolean func(mobj_t *)); 81 | boolean P_PathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, 82 | int flags, boolean trav(intercept_t *)); 83 | 84 | extern fixed_t opentop; 85 | extern fixed_t openbottom; 86 | extern fixed_t openrange; 87 | extern fixed_t lowfloor; 88 | extern divline_t trace; 89 | 90 | #endif /* __P_MAPUTL__ */ 91 | -------------------------------------------------------------------------------- /arm9/source/p_pspr.h: -------------------------------------------------------------------------------- 1 | /* Emacs style mode select -*- C++ -*- 2 | *----------------------------------------------------------------------------- 3 | * 4 | * 5 | * PrBoom a Doom port merged with LxDoom and LSDLDoom 6 | * based on BOOM, a modified and improved DOOM engine 7 | * Copyright (C) 1999 by 8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 | * Copyright (C) 1999-2000 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Sprite animation. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __P_PSPR__ 33 | #define __P_PSPR__ 34 | 35 | /* Basic data types. 36 | * Needs fixed point, and BAM angles. */ 37 | 38 | #include "m_fixed.h" 39 | #include "tables.h" 40 | 41 | /* Needs to include the precompiled sprite animation tables. 42 | * 43 | * Header generated by multigen utility. 44 | * This includes all the data for thing animation, 45 | * i.e. the Thing Atrributes table and the Frame Sequence table. 46 | */ 47 | 48 | #include "info.h" 49 | 50 | #ifdef __GNUG__ 51 | #pragma interface 52 | #endif 53 | 54 | /* 55 | * Frame flags: 56 | * handles maximum brightness (torches, muzzle flare, light sources) 57 | */ 58 | 59 | #define FF_FULLBRIGHT 0x8000 /* flag in thing->frame */ 60 | #define FF_FRAMEMASK 0x7fff 61 | 62 | /* 63 | * Overlay psprites are scaled shapes 64 | * drawn directly on the view screen, 65 | * coordinates are given for a 320*200 view screen. 66 | */ 67 | 68 | typedef enum 69 | { 70 | ps_weapon, 71 | ps_flash, 72 | NUMPSPRITES 73 | } psprnum_t; 74 | 75 | typedef struct 76 | { 77 | state_t *state; /* a NULL state means not active */ 78 | int tics; 79 | fixed_t sx; 80 | fixed_t sy; 81 | } pspdef_t; 82 | 83 | extern int weapon_preferences[2][NUMWEAPONS+1]; /* killough 5/2/98 */ 84 | int P_WeaponPreferred(int w1, int w2); 85 | 86 | struct player_s; 87 | int P_SwitchWeapon(struct player_s *player); 88 | boolean P_CheckAmmo(struct player_s *player); 89 | void P_SetupPsprites(struct player_s *curplayer); 90 | void P_MovePsprites(struct player_s *curplayer); 91 | void P_DropWeapon(struct player_s *player); 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Savegame I/O, archiving, persistence. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __P_SAVEG__ 33 | #define __P_SAVEG__ 34 | 35 | #ifdef __GNUG__ 36 | #pragma interface 37 | #endif 38 | 39 | /* Persistent storage/archiving. 40 | * These are the load / save game routines. */ 41 | void P_ArchivePlayers(void); 42 | void P_UnArchivePlayers(void); 43 | void P_ArchiveWorld(void); 44 | void P_UnArchiveWorld(void); 45 | void P_ArchiveThinkers(void); 46 | void P_UnArchiveThinkers(void); 47 | void P_ArchiveSpecials(void); 48 | void P_UnArchiveSpecials(void); 49 | void P_ThinkerToIndex(void); /* phares 9/13/98: save soundtarget in savegame */ 50 | void P_IndexToThinker(void); /* phares 9/13/98: save soundtarget in savegame */ 51 | 52 | /* 1/18/98 killough: add RNG info to savegame */ 53 | void P_ArchiveRNG(void); 54 | void P_UnArchiveRNG(void); 55 | 56 | /* 2/21/98 killough: add automap info to savegame */ 57 | void P_ArchiveMap(void); 58 | void P_UnArchiveMap(void); 59 | 60 | extern char *save_p; 61 | void CheckSaveGame(size_t); /* killough */ 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Setup a game, startup stuff. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __P_SETUP__ 33 | #define __P_SETUP__ 34 | 35 | #include "p_mobj.h" 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | void P_SetupLevel(int episode, int map, int playermask, skill_t skill); 42 | void P_Init(void); /* Called by startup code. */ 43 | 44 | extern const byte *rejectmatrix; /* for fast sight rejection - cph - const* */ 45 | 46 | /* killough 3/1/98: change blockmap from "short" to "long" offsets: */ 47 | extern long *blockmaplump; /* offsets in blockmap are from here */ 48 | extern long *blockmap; 49 | extern int bmapwidth; 50 | extern int bmapheight; /* in mapblocks */ 51 | extern fixed_t bmaporgx; 52 | extern fixed_t bmaporgy; /* origin of block map */ 53 | extern mobj_t **blocklinks; /* for thing chains */ 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /arm9/source/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 by 10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Core thinker processing prototypes. 29 | *-----------------------------------------------------------------------------*/ 30 | 31 | #ifndef __P_TICK__ 32 | #define __P_TICK__ 33 | 34 | #include "d_think.h" 35 | 36 | #ifdef __GNUG__ 37 | #pragma interface 38 | #endif 39 | 40 | /* Called by C_Ticker, can call G_PlayerExited. 41 | * Carries out all thinking of monsters and players. */ 42 | 43 | void P_Ticker(void); 44 | 45 | extern thinker_t thinkercap; // Both the head and tail of the thinker list 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 | typedef enum { 58 | th_misc, 59 | th_friends, 60 | th_enemies, 61 | NUMTHCLASS 62 | } th_class; 63 | 64 | extern thinker_t thinkerclasscap[]; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Player related stuff. 29 | * Bobbing POV/weapon, movement. 30 | * Pending weapon. 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __P_USER__ 35 | #define __P_USER__ 36 | 37 | #include "d_player.h" 38 | 39 | void P_PlayerThink(player_t *player); 40 | void P_CalcHeight(player_t *player); 41 | void P_DeathThink(player_t *player); 42 | void P_MovePlayer(player_t *player); 43 | void P_Thrust(player_t *player, angle_t angle, fixed_t move); 44 | 45 | #endif /* __P_USER__ */ 46 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Doom Network protocol packet definitions. 29 | *-----------------------------------------------------------------------------*/ 30 | 31 | #include "doomtype.h" 32 | #include "d_ticcmd.h" 33 | #include "m_swap.h" 34 | 35 | enum packet_type_e { 36 | PKT_INIT, // initial packet to server 37 | PKT_SETUP, // game information packet 38 | PKT_GO, // game has started 39 | PKT_TICC, // tics from client 40 | PKT_TICS, // tics from server 41 | PKT_RETRANS, // Request for retransmission 42 | PKT_EXTRA, // Extra info packet 43 | PKT_QUIT, // Player quit game 44 | PKT_DOWN, // Server downed 45 | PKT_WAD, // Wad file request 46 | PKT_BACKOFF, // Request for client back-off 47 | }; 48 | 49 | typedef struct { 50 | byte checksum; // Simple checksum of the entire packet 51 | byte type; /* Type of packet */ 52 | byte reserved[2]; /* Was random in prboom <=2.2.4, now 0 */ 53 | unsigned int tic; // Timestamp 54 | } PACKEDATTR packet_header_t; 55 | 56 | static inline void packet_set(packet_header_t* p, enum packet_type_e t, unsigned long tic) 57 | { p->tic = doom_htonl(tic); p->type = t; p->reserved[0] = 0; p->reserved[1] = 0; } 58 | 59 | #ifndef GAME_OPTIONS_SIZE 60 | // From g_game.h 61 | #define GAME_OPTIONS_SIZE 64 62 | #endif 63 | 64 | struct setup_packet_s { 65 | byte players, yourplayer, skill, episode, level, deathmatch, complevel, ticdup, extratic; 66 | byte game_options[GAME_OPTIONS_SIZE]; 67 | byte numwads; 68 | byte wadnames[1]; // Actually longer 69 | }; 70 | 71 | /* cph - convert network byte stream to usable ticcmd_t and visa-versa 72 | * - the functions are functionally identical apart from parameters 73 | * - the void* param can be unaligned. By using void* as the parameter 74 | * it means gcc won't assume alignment so won't make false assumptions 75 | * when optimising. So I'm told. 76 | */ 77 | inline static void RawToTic(ticcmd_t* dst, const void* src) 78 | { 79 | memcpy(dst,src,sizeof *dst); 80 | dst->angleturn = doom_ntohs(dst->angleturn); 81 | dst->consistancy = doom_ntohs(dst->consistancy); 82 | } 83 | 84 | inline static void TicToRaw(void* dst, const ticcmd_t* src) 85 | { 86 | /* We have to make a copy of the source struct, then do byte swaps, 87 | * and fnially copy to the destination (can't do the swaps in the 88 | * destination, because it might not be aligned). 89 | */ 90 | ticcmd_t tmp = *src; 91 | tmp.angleturn = doom_ntohs(tmp.angleturn); 92 | tmp.consistancy = doom_ntohs(tmp.consistancy); 93 | memcpy(dst,&tmp,sizeof tmp); 94 | } 95 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Refresh module, BSP traversal and handling. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __R_BSP__ 33 | #define __R_BSP__ 34 | 35 | #ifdef __GNUG__ 36 | #pragma interface 37 | #endif 38 | 39 | extern seg_t *curline; 40 | extern side_t *sidedef; 41 | extern line_t *linedef; 42 | extern sector_t *frontsector; 43 | extern sector_t *backsector; 44 | 45 | /* old code -- killough: 46 | * extern drawseg_t drawsegs[MAXDRAWSEGS]; 47 | * new code -- killough: */ 48 | extern drawseg_t *drawsegs; 49 | extern unsigned maxdrawsegs; 50 | 51 | extern drawseg_t *ds_p; 52 | 53 | void R_ClearClipSegs(void); 54 | void R_ClearDrawSegs(void); 55 | void R_RenderBSPNode(int bspnum); 56 | int R_DoorClosed(void); /* killough 1/17/98 */ 57 | 58 | /* killough 4/13/98: fake floors/ceilings for deep water / fake ceilings: */ 59 | sector_t *R_FakeFlat(sector_t *, sector_t *, int *, int *, boolean); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /arm9/source/r_data.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Doom-Utils/dsdoom/2617b30099e2138dcb76e606d1887504381adea5/arm9/source/r_data.c -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Refresh module, data I/O, caching, retrieval of graphics 29 | * by name. 30 | * 31 | *-----------------------------------------------------------------------------*/ 32 | 33 | 34 | #ifndef __R_DATA__ 35 | #define __R_DATA__ 36 | 37 | #include "r_defs.h" 38 | #include "r_state.h" 39 | 40 | #ifdef __GNUG__ 41 | #pragma interface 42 | #endif 43 | 44 | // A single patch from a texture definition, basically 45 | // a rectangular area within the texture rectangle. 46 | typedef struct 47 | { 48 | int originx, originy; // Block origin, which has already accounted 49 | int patch; // for the internal origin of the patch. 50 | } PACKEDATTR texpatch_t; 51 | 52 | // 53 | // Texture definition. 54 | // A DOOM wall texture is a list of patches 55 | // which are to be combined in a predefined order. 56 | // 57 | 58 | typedef struct 59 | { 60 | char name[8]; // Keep name for switch changing, etc. 61 | int next, index; // killough 1/31/98: used in hashing algorithm 62 | // CPhipps - moved arrays with per-texture entries to elements here 63 | unsigned widthmask; 64 | size_t compositesize; 65 | byte *composite; 66 | short *columnlump; 67 | unsigned *columnofs; 68 | // CPhipps - end of additions 69 | short width, height; 70 | short patchcount; // All the patches[patchcount] are drawn 71 | texpatch_t patches[1]; // back-to-front into the cached texture. 72 | } PACKEDATTR texture_t; 73 | 74 | // Retrieve column data for span blitting. 75 | const byte* 76 | R_GetColumn 77 | ( int tex, 78 | int col ); 79 | 80 | 81 | // I/O, setting up the stuff. 82 | void R_InitData (void); 83 | void R_PrecacheLevel (void); 84 | 85 | 86 | // Retrieval. 87 | // Floor/ceiling opaque texture tiles, 88 | // lookup by name. For animation? 89 | int R_FlatNumForName (const char* name); // killough -- const added 90 | 91 | 92 | // Called by P_Ticker for switches and animations, 93 | // returns the texture number for the texture name. 94 | int R_TextureNumForName (const char *name); // killough -- const added 95 | int R_CheckTextureNumForName (const char *name); 96 | 97 | void R_InitTranMap(int); // killough 3/6/98: translucency initialization 98 | int R_ColormapNumForName(const char *name); // killough 4/4/98 99 | /* cph 2001/11/17 - new func to do lighting calcs and get suitable colour map */ 100 | const lighttable_t* R_ColourMap(int lightlevel, fixed_t spryscale); 101 | 102 | extern const byte *main_tranmap, *tranmap; 103 | 104 | /* Proff - Added for OpenGL - cph - const char* param */ 105 | void R_SetPatchNum(patchnum_t *patchnum, const char *name); 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /arm9/source/r_draw.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Doom-Utils/dsdoom/2617b30099e2138dcb76e606d1887504381adea5/arm9/source/r_draw.c -------------------------------------------------------------------------------- /arm9/source/r_draw.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * System specific interface stuff. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __R_DRAW__ 33 | #define __R_DRAW__ 34 | 35 | #include "r_defs.h" 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | extern const lighttable_t *dc_colormap; 42 | extern int dc_x; 43 | extern int dc_yl; 44 | extern int dc_yh; 45 | extern fixed_t dc_iscale; 46 | extern fixed_t dc_texturemid; 47 | extern int dc_texheight; // killough 48 | 49 | // first pixel in a column 50 | extern const byte *dc_source; 51 | 52 | // The span blitting interface. 53 | // Hook in assembler or system specific BLT here. 54 | 55 | void R_DrawColumn(void); 56 | void R_DrawTLColumn(void); // drawing translucent textures // phares 57 | void R_DrawFuzzColumn(void); // The Spectre/Invisibility effect. 58 | 59 | // Draw with color translation tables, for player sprite rendering, 60 | // Green/Red/Blue/Indigo shirts. 61 | 62 | void R_DrawTranslatedColumn(void); 63 | 64 | void R_VideoErase(unsigned ofs, int count); 65 | 66 | extern lighttable_t *ds_colormap; 67 | 68 | extern int ds_y; 69 | extern int ds_x1; 70 | extern int ds_x2; 71 | extern fixed_t ds_xfrac; 72 | extern fixed_t ds_yfrac; 73 | extern fixed_t ds_xstep; 74 | extern fixed_t ds_ystep; 75 | 76 | // start of a 64*64 tile image 77 | extern const byte *ds_source; 78 | extern byte playernumtotrans[MAXPLAYERS]; // CPhipps - what translation table for what player 79 | extern const byte *translationtables; 80 | extern const byte *dc_translation; 81 | 82 | // Span blitting for rows, floor/ceiling. No Spectre effect needed. 83 | #ifndef GL_DOOM 84 | void R_DrawSpan(void); 85 | #endif 86 | 87 | void R_InitBuffer(int width, int height); 88 | 89 | // Initialize color translation tables, for player rendering etc. 90 | void R_InitTranslationTables(void); 91 | 92 | // Rendering function. 93 | void R_FillBackScreen(void); 94 | 95 | // If the view size is not full screen, draws a border around it. 96 | void R_DrawViewBorder(void); 97 | 98 | extern const byte *tranmap; // translucency filter maps 256x256 // phares 99 | extern const byte *main_tranmap; // killough 4/11/98 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Renderer main interface. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __R_MAIN__ 33 | #define __R_MAIN__ 34 | 35 | #include "d_player.h" 36 | #include "r_data.h" 37 | 38 | #ifdef __GNUG__ 39 | #pragma interface 40 | #endif 41 | 42 | // 43 | // POV related. 44 | // 45 | 46 | extern fixed_t viewcos; 47 | extern fixed_t viewsin; 48 | extern int viewwidth; 49 | extern int viewheight; 50 | extern int viewwindowx; 51 | extern int viewwindowy; 52 | extern int centerx; 53 | extern int centery; 54 | extern fixed_t centerxfrac; 55 | extern fixed_t centeryfrac; 56 | extern fixed_t projection; 57 | // proff 11/06/98: Added for high-res 58 | extern fixed_t projectiony; 59 | extern int validcount; 60 | extern int linecount; 61 | extern int loopcount; 62 | 63 | // 64 | // Rendering stats 65 | // 66 | 67 | extern int rendered_visplanes, rendered_segs, rendered_vissprites; 68 | extern boolean rendering_stats; 69 | 70 | // 71 | // Lighting LUT. 72 | // Used for z-depth cuing per column/row, 73 | // and other lighting effects (sector ambient, flash). 74 | // 75 | 76 | // Lighting constants. 77 | 78 | #define LIGHTLEVELS 16 79 | #define LIGHTSEGSHIFT 4 80 | #define MAXLIGHTSCALE 48 81 | #define LIGHTSCALESHIFT 12 82 | #define MAXLIGHTZ 128 83 | #define LIGHTZSHIFT 20 84 | 85 | // killough 3/20/98: Allow colormaps to be dynamic (e.g. underwater) 86 | extern lighttable_t *(*zlight)[MAXLIGHTZ]; 87 | extern lighttable_t *fullcolormap; 88 | extern int numcolormaps; // killough 4/4/98: dynamic number of maps 89 | extern lighttable_t **colormaps; 90 | // killough 3/20/98, 4/4/98: end dynamic colormaps 91 | 92 | extern int extralight; 93 | extern lighttable_t *fixedcolormap; 94 | 95 | // Number of diminishing brightness levels. 96 | // There a 0-31, i.e. 32 LUT in the COLORMAP lump. 97 | 98 | #define NUMCOLORMAPS 32 99 | 100 | // 101 | // Function pointer to switch refresh/drawing functions. 102 | // 103 | 104 | extern void (*colfunc)(void); 105 | 106 | // 107 | // Utility functions. 108 | // 109 | 110 | PUREFUNC int R_PointOnSide(fixed_t x, fixed_t y, const node_t *node); 111 | PUREFUNC int R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line); 112 | angle_t R_PointToAngle(fixed_t x, fixed_t y); 113 | angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2); 114 | subsector_t *R_PointInSubsector(fixed_t x, fixed_t y); 115 | 116 | // 117 | // REFRESH - the actual rendering functions. 118 | // 119 | 120 | void R_RenderPlayerView(player_t *player); // Called by G_Drawer. 121 | void R_Init(void); // Called by startup code. 122 | void R_SetViewSize(int blocks); // Called by M_Responder. 123 | void R_ExecuteSetViewSize(void); // cph - called by D_Display to complete a view resize 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Refresh, visplane stuff (floor, ceilings). 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __R_PLANE__ 33 | #define __R_PLANE__ 34 | 35 | #include "r_data.h" 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | /* killough 10/98: special mask indicates sky flat comes from sidedef */ 42 | #define PL_SKYFLAT (0x80000000) 43 | 44 | /* Visplane related. */ 45 | extern short *lastopening; 46 | 47 | extern short floorclip[], ceilingclip[]; 48 | extern fixed_t yslope[], distscale[]; 49 | 50 | void R_InitPlanes(void); 51 | void R_ClearPlanes(void); 52 | void R_DrawPlanes (void); 53 | 54 | visplane_t *R_FindPlane( 55 | fixed_t height, 56 | int picnum, 57 | int lightlevel, 58 | fixed_t xoffs, /* killough 2/28/98: add x-y offsets */ 59 | fixed_t yoffs 60 | ); 61 | 62 | visplane_t *R_CheckPlane(visplane_t *pl, int start, int stop); 63 | visplane_t *R_DupPlane(const visplane_t *pl, int start, int stop); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Refresh module, drawing LineSegs from BSP. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __R_SEGS__ 33 | #define __R_SEGS__ 34 | 35 | #ifdef __GNUG__ 36 | #pragma interface 37 | #endif 38 | 39 | void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2); 40 | void R_StoreWallRange(int start, int stop); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Sky rendering. The DOOM sky is a texture map like any 29 | * wall, wrapping around. A 1024 columns equal 360 degrees. 30 | * The default sky map is 256 columns and repeats 4 times 31 | * on a 320 screen? 32 | * 33 | *-----------------------------------------------------------------------------*/ 34 | 35 | #ifdef __GNUG__ 36 | #pragma implementation "r_sky.h" 37 | #endif 38 | #include "r_sky.h" 39 | 40 | // 41 | // sky mapping 42 | // 43 | int skyflatnum; 44 | int skytexture; 45 | int skytexturemid; 46 | 47 | // 48 | // R_InitSkyMap 49 | // Called whenever the view size changes. 50 | // 51 | void R_InitSkyMap (void) 52 | { 53 | skytexturemid = 100*FRACUNIT; 54 | } 55 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Sky rendering. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __R_SKY__ 33 | #define __R_SKY__ 34 | 35 | #include "m_fixed.h" 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | /* SKY, store the number for name. */ 42 | #define SKYFLATNAME "F_SKY1" 43 | 44 | /* The sky map is 256*128*4 maps. */ 45 | #define ANGLETOSKYSHIFT 22 46 | 47 | extern int skytexture; 48 | extern int skytexturemid; 49 | 50 | /* Called whenever the view size changes. */ 51 | void R_InitSkyMap(void); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Refresh/render internal state variables (global). 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | 33 | #ifndef __R_STATE__ 34 | #define __R_STATE__ 35 | 36 | // Need data structure definitions. 37 | #include "d_player.h" 38 | #include "r_data.h" 39 | 40 | #ifdef __GNUG__ 41 | #pragma interface 42 | #endif 43 | 44 | 45 | // 46 | // Refresh internal data structures, 47 | // for rendering. 48 | // 49 | 50 | // needed for texture pegging 51 | extern fixed_t *textureheight; 52 | 53 | // needed for pre rendering (fracs) 54 | extern fixed_t *spritewidth; 55 | 56 | extern fixed_t *spriteoffset; 57 | extern fixed_t *spritetopoffset; 58 | 59 | extern lighttable_t **colormaps; // killough 3/20/98, 4/4/98 60 | extern lighttable_t *fullcolormap; // killough 3/20/98 61 | 62 | extern int viewwidth; 63 | extern int scaledviewwidth; 64 | extern int viewheight; 65 | 66 | extern int firstflat; 67 | 68 | // for global animation 69 | extern int *flattranslation; 70 | extern int *texturetranslation; 71 | 72 | // Sprite.... 73 | extern int firstspritelump; 74 | extern int lastspritelump; 75 | extern int numspritelumps; 76 | 77 | // 78 | // Lookup tables for map data. 79 | // 80 | extern int numsprites; 81 | extern spritedef_t *sprites; 82 | 83 | extern int numvertexes; 84 | extern vertex_t *vertexes; 85 | 86 | extern int numsegs; 87 | extern seg_t *segs; 88 | 89 | extern int numsectors; 90 | extern sector_t *sectors; 91 | 92 | extern int numsubsectors; 93 | extern subsector_t *subsectors; 94 | 95 | extern int numnodes; 96 | extern node_t *nodes; 97 | 98 | extern int numlines; 99 | extern line_t *lines; 100 | 101 | extern int numsides; 102 | extern side_t *sides; 103 | 104 | 105 | // 106 | // POV data. 107 | // 108 | extern fixed_t viewx; 109 | extern fixed_t viewy; 110 | extern fixed_t viewz; 111 | extern angle_t viewangle; 112 | extern player_t *viewplayer; 113 | extern angle_t clipangle; 114 | extern int viewangletox[FINEANGLES/2]; 115 | extern angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98 116 | extern fixed_t rw_distance; 117 | extern angle_t rw_normalangle; 118 | 119 | // angle to line origin 120 | extern int rw_angle1; 121 | 122 | // Segs count? 123 | extern int sscount; 124 | 125 | extern visplane_t *floorplane; 126 | extern visplane_t *ceilingplane; 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Rendering of moving objects, sprites. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __R_THINGS__ 33 | #define __R_THINGS__ 34 | 35 | #ifdef __GNUG__ 36 | #pragma interface 37 | #endif 38 | 39 | /* Constant arrays used for psprite clipping and initializing clipping. */ 40 | 41 | extern short negonearray[MAX_SCREENWIDTH]; /* killough 2/8/98: */ 42 | extern short screenheightarray[MAX_SCREENWIDTH]; /* change to MAX_* */ 43 | 44 | /* Vars for R_DrawMaskedColumn */ 45 | 46 | extern short *mfloorclip; 47 | extern short *mceilingclip; 48 | extern fixed_t spryscale; 49 | extern fixed_t sprtopscreen; 50 | extern fixed_t pspritescale; 51 | extern fixed_t pspriteiscale; 52 | /* proff 11/06/98: Added for high-res */ 53 | extern fixed_t pspriteyscale; 54 | 55 | void R_DrawMaskedColumn(const column_t *column); 56 | void R_SortVisSprites(void); 57 | void R_AddSprites(subsector_t* subsec, int lightlevel); 58 | void R_AddPSprites(void); 59 | void R_DrawSprites(void); 60 | void R_InitSprites(const char * const * namelist); 61 | void R_ClearSprites(void); 62 | void R_DrawMasked(void); 63 | 64 | void R_ClipVisSprite(vissprite_t *vis, int xl, int xh); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * The not so system specific sound interface. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __S_SOUND__ 33 | #define __S_SOUND__ 34 | 35 | #ifdef __GNUG__ 36 | #pragma interface 37 | #endif 38 | 39 | // 40 | // Initializes sound stuff, including volume 41 | // Sets channels, SFX and music volume, 42 | // allocates channel buffer, sets S_sfx lookup. 43 | // 44 | void S_Init(int sfxVolume, int musicVolume); 45 | 46 | // Kills all sounds 47 | void S_Stop(void); 48 | 49 | // 50 | // Per level startup code. 51 | // Kills playing sounds at start of level, 52 | // determines music if any, changes music. 53 | // 54 | void S_Start(void); 55 | 56 | // 57 | // Start sound for thing at 58 | // using from sounds.h 59 | // 60 | void S_StartSound(void *origin, int sound_id); 61 | 62 | // Will start a sound at a given volume. 63 | void S_StartSoundAtVolume(void *origin, int sound_id, int volume); 64 | 65 | // killough 4/25/98: mask used to indicate sound origin is player item pickup 66 | #define PICKUP_SOUND (0x8000) 67 | 68 | // Stop sound for thing at 69 | void S_StopSound(void* origin); 70 | 71 | // Start music using from sounds.h 72 | void S_StartMusic(int music_id); 73 | 74 | // Start music using from sounds.h, and set whether looping 75 | void S_ChangeMusic(int music_id, int looping); 76 | 77 | // Stops the music fer sure. 78 | void S_StopMusic(void); 79 | 80 | // Stop and resume music, during game PAUSE. 81 | void S_PauseSound(void); 82 | void S_ResumeSound(void); 83 | 84 | // 85 | // Updates music & sounds 86 | // 87 | void S_UpdateSounds(void* listener); 88 | void S_SetMusicVolume(int volume); 89 | void S_SetSfxVolume(int volume); 90 | 91 | // machine-independent sound params 92 | extern int default_numChannels; 93 | extern int numChannels; 94 | 95 | //jff 3/17/98 holds last IDMUS number, or -1 96 | extern int idmusnum; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /arm9/source/st_lib.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * The status bar widget definitions and prototypes 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __STLIB__ 33 | #define __STLIB__ 34 | 35 | // We are referring to patches. 36 | #include "r_defs.h" 37 | #include "v_video.h" // color ranges 38 | 39 | // 40 | // Background and foreground screen numbers 41 | // Jekflak 19/11/06 - draw everything on lower screen. 42 | // 43 | #define BG 4 44 | //#define FG 1 45 | 46 | // 47 | // Typedefs of widgets 48 | // 49 | 50 | // Number widget 51 | 52 | typedef struct 53 | { 54 | // upper right-hand corner 55 | // of the number (right-justified) 56 | int x; 57 | int y; 58 | 59 | // max # of digits in number 60 | int width; 61 | 62 | // last number value 63 | int oldnum; 64 | 65 | // pointer to current value 66 | int* num; 67 | 68 | // pointer to boolean stating 69 | // whether to update number 70 | boolean* on; 71 | 72 | // list of patches for 0-9 73 | const patchnum_t* p; 74 | 75 | // user data 76 | int data; 77 | } st_number_t; 78 | 79 | // Percent widget ("child" of number widget, 80 | // or, more precisely, contains a number widget.) 81 | typedef struct 82 | { 83 | // number information 84 | st_number_t n; 85 | 86 | // percent sign graphic 87 | const patchnum_t* p; 88 | } st_percent_t; 89 | 90 | // Multiple Icon widget 91 | typedef struct 92 | { 93 | // center-justified location of icons 94 | int x; 95 | int y; 96 | 97 | // last icon number 98 | int oldinum; 99 | 100 | // pointer to current icon 101 | int* inum; 102 | 103 | // pointer to boolean stating 104 | // whether to update icon 105 | boolean* on; 106 | 107 | // list of icons 108 | const patchnum_t* p; 109 | 110 | // user data 111 | int data; 112 | 113 | } st_multicon_t; 114 | 115 | // Binary Icon widget 116 | 117 | typedef struct 118 | { 119 | // center-justified location of icon 120 | int x; 121 | int y; 122 | 123 | // last icon value 124 | int oldval; 125 | 126 | // pointer to current icon status 127 | boolean* val; 128 | 129 | // pointer to boolean 130 | // stating whether to update icon 131 | boolean* on; 132 | 133 | const patchnum_t* p; // icon 134 | int data; // user data 135 | } st_binicon_t; 136 | 137 | // 138 | // Widget creation, access, and update routines 139 | // 140 | 141 | // Initializes widget library. 142 | // More precisely, initialize STMINUS, 143 | // everything else is done somewhere else. 144 | // 145 | void STlib_init(void); 146 | 147 | // Number widget routines 148 | void STlib_initNum 149 | ( st_number_t* n, 150 | int x, 151 | int y, 152 | const patchnum_t* pl, 153 | int* num, 154 | boolean* on, 155 | int width ); 156 | 157 | void STlib_updateNum 158 | ( st_number_t* n, 159 | int cm, 160 | boolean refresh ); 161 | 162 | 163 | // Percent widget routines 164 | void STlib_initPercent 165 | ( st_percent_t* p, 166 | int x, 167 | int y, 168 | const patchnum_t* pl, 169 | int* num, 170 | boolean* on, 171 | const patchnum_t* percent ); 172 | 173 | 174 | void STlib_updatePercent 175 | ( st_percent_t* per, 176 | int cm, 177 | int refresh ); 178 | 179 | 180 | // Multiple Icon widget routines 181 | void STlib_initMultIcon 182 | ( st_multicon_t* mi, 183 | int x, 184 | int y, 185 | const patchnum_t* il, 186 | int* inum, 187 | boolean* on ); 188 | 189 | 190 | void STlib_updateMultIcon 191 | ( st_multicon_t* mi, 192 | boolean refresh ); 193 | 194 | // Binary Icon widget routines 195 | 196 | void STlib_initBinIcon 197 | ( st_binicon_t* b, 198 | int x, 199 | int y, 200 | const patchnum_t* i, 201 | boolean* val, 202 | boolean* on ); 203 | 204 | void STlib_updateBinIcon 205 | ( st_binicon_t* bi, 206 | boolean refresh ); 207 | 208 | #endif 209 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Status bar code. 29 | * Does the face/direction indicator animatin. 30 | * Does palette indicators as well (red pain/berserk, bright pickup) 31 | * 32 | *-----------------------------------------------------------------------------*/ 33 | 34 | #ifndef __STSTUFF_H__ 35 | #define __STSTUFF_H__ 36 | 37 | #include "doomtype.h" 38 | #include "d_event.h" 39 | 40 | // Size of statusbar. 41 | // Now sensitive for scaling. 42 | 43 | // proff 08/18/98: Changed for high-res 44 | #define ST_HEIGHT 32 45 | #define ST_WIDTH 320 46 | #define ST_Y (200 - ST_HEIGHT) 47 | #define ST_SCALED_HEIGHT (ST_HEIGHT*SCREENHEIGHT/200) 48 | #define ST_SCALED_WIDTH SCREENWIDTH 49 | #define ST_SCALED_Y (SCREENHEIGHT - ST_SCALED_HEIGHT) 50 | 51 | // 52 | // STATUS BAR 53 | // 54 | 55 | // Called by main loop. 56 | boolean ST_Responder(event_t* ev); 57 | 58 | // Called by main loop. 59 | void ST_Ticker(void); 60 | 61 | // Called by main loop. 62 | void ST_Drawer(boolean st_statusbaron, boolean refresh); 63 | 64 | // Called when the console player is spawned on each level. 65 | void ST_Start(void); 66 | 67 | // Called by startup code. 68 | void ST_Init(void); 69 | 70 | // States for status bar code. 71 | typedef enum 72 | { 73 | AutomapState, 74 | FirstPersonState 75 | } st_stateenum_t; 76 | 77 | // States for the chat code. 78 | typedef enum 79 | { 80 | StartChatState, 81 | WaitDestState, 82 | GetChatState 83 | } st_chatstateenum_t; 84 | 85 | boolean ST_Responder(event_t* ev); 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 | extern int FG; // Jefklak 20/11/06 - framebuffer console bla 103 | #endif 104 | -------------------------------------------------------------------------------- /arm9/source/tables.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Lookup tables. 29 | * Do not try to look them up :-). 30 | * In the order of appearance: 31 | * 32 | * int finetangent[4096] - Tangens LUT. 33 | * Should work with BAM fairly well (12 of 16bit, 34 | * effectively, by shifting). 35 | * 36 | * int finesine[10240] - Sine lookup. 37 | * Guess what, serves as cosine, too. 38 | * Remarkable thing is, how to use BAMs with this? 39 | * 40 | * int tantoangle[2049] - ArcTan LUT, 41 | * maps tan(angle) to angle fast. Gotta search. 42 | * 43 | *----------------------------------------------------------------------------- 44 | */ 45 | 46 | #include "config.h" 47 | 48 | #include 49 | #include "w_wad.h" 50 | #include "tables.h" 51 | 52 | // killough 5/3/98: reformatted 53 | 54 | int SlopeDiv(unsigned num, unsigned den) 55 | { 56 | unsigned ans; 57 | 58 | if (den < 512) 59 | return SLOPERANGE; 60 | ans = (num<<3)/(den>>8); 61 | return ans <= SLOPERANGE ? ans : SLOPERANGE; 62 | } 63 | 64 | fixed_t finetangent[4096]; 65 | 66 | //const fixed_t *const finecosine = &finesine[FINEANGLES/4]; 67 | 68 | fixed_t finesine[10240]; 69 | 70 | angle_t tantoangle[2049]; 71 | 72 | #include "m_swap.h" 73 | #include "lprintf.h" 74 | 75 | // R_LoadTrigTables 76 | // Load trig tables from a wad file lump 77 | // CPhipps 24/12/98 - fix endianness (!) 78 | // 79 | void R_LoadTrigTables(void) 80 | { 81 | int lump; 82 | { 83 | lump = (W_CheckNumForName)("SINETABL",ns_prboom); 84 | if (lump == -1) I_Error("Failed to locate trig tables"); 85 | if (W_LumpLength(lump) != sizeof(finesine)) 86 | I_Error("R_LoadTrigTables: Invalid SINETABL"); 87 | W_ReadLump(lump,(unsigned char*)finesine); 88 | } 89 | { 90 | lump = (W_CheckNumForName)("TANGTABL",ns_prboom); 91 | if (lump == -1) I_Error("Failed to locate trig tables"); 92 | if (W_LumpLength(lump) != sizeof(finetangent)) 93 | I_Error("R_LoadTrigTables: Invalid TANGTABL"); 94 | W_ReadLump(lump,(unsigned char*)finetangent); 95 | } 96 | { 97 | lump = (W_CheckNumForName)("TANTOANG",ns_prboom); 98 | if (lump == -1) I_Error("Failed to locate trig tables"); 99 | if (W_LumpLength(lump) != sizeof(tantoangle)) 100 | I_Error("R_LoadTrigTables: Invalid TANTOANG"); 101 | W_ReadLump(lump,(unsigned char*)tantoangle); 102 | } 103 | // Endianness correction - might still be non-portable, but is fast where possible 104 | { 105 | size_t n; 106 | lprintf(LO_INFO, "Endianness..."); 107 | 108 | // This test doesn't assume the endianness of the tables, but deduces them from 109 | // en entry. I hope this is portable. 110 | if ((10 < finesine[1]) && (finesine[1] < 100)) { 111 | lprintf(LO_INFO, "ok."); 112 | return; // Endianness is correct 113 | } 114 | 115 | // Must correct endianness of every long loaded (!) 116 | #define CORRECT_TABLE_ENDIAN(tbl) \ 117 | for (n = 0; n= (unsigned)numlumps) 115 | I_Error ("W_CacheLumpNum: %i >= numlumps",lump); 116 | #endif 117 | 118 | if (!cachelump[lump].cache) // read the lump in 119 | W_ReadLump(lump, Z_Malloc(W_LumpLength(lump), PU_CACHE, &cachelump[lump].cache)); 120 | 121 | /* cph - if wasn't locked but now is, tell z_zone to hold it */ 122 | if (!cachelump[lump].locks && locks) { 123 | Z_ChangeTag(cachelump[lump].cache,PU_STATIC); 124 | #ifdef TIMEDIAG 125 | cachelump[lump].locktic = gametic; 126 | #endif 127 | } 128 | cachelump[lump].locks += locks; 129 | 130 | #ifdef SIMPLECHECKS 131 | if (!((cachelump[lump].locks+1) & 0xf)) 132 | lprintf(LO_DEBUG, "W_CacheLumpNum: High lock on %8s (%d)\n", 133 | lumpinfo[lump].name, cachelump[lump].locks); 134 | #endif 135 | 136 | return cachelump[lump].cache; 137 | } 138 | 139 | /* 140 | * W_UnlockLumpNum 141 | * 142 | * CPhipps - this changes (should reduce) the number of locks on a lump 143 | */ 144 | 145 | void W_UnlockLumpNum(int lump) 146 | { 147 | const int unlocks = 1; 148 | #ifdef SIMPLECHECKS 149 | if ((signed short)cachelump[lump].locks < unlocks) 150 | lprintf(LO_DEBUG, "W_UnlockLumpNum: Excess unlocks on %8s (%d-%d)\n", 151 | lumpinfo[lump].name, cachelump[lump].locks, unlocks); 152 | #endif 153 | cachelump[lump].locks -= unlocks; 154 | /* cph - Note: must only tell z_zone to make purgeable if currently locked, 155 | * else it might already have been purged 156 | */ 157 | if (unlocks && !cachelump[lump].locks) 158 | Z_ChangeTag(cachelump[lump].cache, PU_CACHE); 159 | } 160 | 161 | int W_LumpIsCached( int lump) { 162 | 163 | return (int)cachelump[lump].cache; 164 | } 165 | -------------------------------------------------------------------------------- /arm9/source/w_wad.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * WAD I/O functions. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | 33 | #ifndef __W_WAD__ 34 | #define __W_WAD__ 35 | 36 | #ifdef __GNUG__ 37 | #pragma interface 38 | #endif 39 | 40 | // 41 | // TYPES 42 | // 43 | 44 | #include 45 | 46 | typedef struct 47 | { 48 | char identification[4]; // Should be "IWAD" or "PWAD". 49 | int numlumps; 50 | int infotableofs; 51 | } wadinfo_t; 52 | 53 | typedef struct 54 | { 55 | int filepos; 56 | int size; 57 | char name[8]; 58 | } filelump_t; 59 | 60 | // 61 | // WADFILE I/O related stuff. 62 | // 63 | 64 | // CPhipps - defined enum in wider scope 65 | // Ty 08/29/98 - add source field to identify where this lump came from 66 | typedef enum { 67 | // CPhipps - define elements in order of 'how new/unusual' 68 | source_iwad=0, // iwad file load 69 | source_pre, // predefined lump 70 | source_auto_load, // lump auto-loaded by config file 71 | source_pwad, // pwad file load 72 | source_lmp, // lmp file load 73 | source_net // CPhipps 74 | } wad_source_t; 75 | 76 | // CPhipps - changed wad init 77 | // We _must_ have the wadfiles[] the same as those actually loaded, so there 78 | // is no point having these separate entities. This belongs here. 79 | typedef struct { 80 | const char* name; 81 | wad_source_t src; 82 | FILE *handle; 83 | } wadfile_info_t; 84 | 85 | extern wadfile_info_t *wadfiles; 86 | 87 | extern size_t numwadfiles; // CPhipps - size of the wadfiles array 88 | 89 | void W_Init(void); // CPhipps - uses the above array 90 | void W_ReleaseAllWads(void); // Proff - Added for iwad switching 91 | void W_DoneCache(void); 92 | 93 | typedef struct 94 | { 95 | // WARNING: order of some fields important (see info.c). 96 | 97 | char name[9]; 98 | int size; 99 | 100 | // killough 1/31/98: hash table fields, used for ultra-fast hash table lookup 101 | int index, next; 102 | 103 | // killough 4/17/98: namespace tags, to prevent conflicts between resources 104 | enum { 105 | ns_global=0, 106 | ns_sprites, 107 | ns_flats, 108 | ns_colormaps, 109 | ns_prboom 110 | } li_namespace; // haleyjd 05/21/02: renamed from "namespace" 111 | 112 | wadfile_info_t *wadfile; 113 | int position; 114 | wad_source_t source; 115 | void *data; 116 | } lumpinfo_t; 117 | 118 | extern lumpinfo_t *lumpinfo; 119 | extern int numlumps; 120 | 121 | // killough 4/17/98: if W_CheckNumForName() called with only 122 | // one argument, pass ns_global as the default namespace 123 | 124 | #define W_CheckNumForName(name) (W_CheckNumForName)(name, ns_global) 125 | int (W_CheckNumForName)(const char* name, int); // killough 4/17/98 126 | int W_GetNumForName (const char* name); 127 | int W_LumpLength (int lump); 128 | void W_ReadLump (int lump, void *dest); 129 | // CPhipps - modified for 'new' lump locking 130 | const void* W_CacheLumpNum (int lump); 131 | void W_UnlockLumpNum(int lump); 132 | int W_LumpIsCached( int lump); 133 | 134 | // CPhipps - convenience macros 135 | //#define W_CacheLumpNum(num) (W_CacheLumpNum)((num),1) 136 | #define W_CacheLumpName(name) W_CacheLumpNum (W_GetNumForName(name)) 137 | 138 | //#define W_UnlockLumpNum(num) (W_UnlockLumpNum)((num),1) 139 | #define W_UnlockLumpName(name) W_UnlockLumpNum (W_GetNumForName(name)) 140 | 141 | char *AddDefaultExtension(char *, const char *); // killough 1/18/98 142 | void ExtractFileBase(const char *, char *); // killough 143 | unsigned W_LumpNameHash(const char *s); // killough 1/31/98 144 | void W_HashLumps(void); // cph 2001/07/07 - made public 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Intermission screens. 29 | * 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | #ifndef __WI_STUFF__ 33 | #define __WI_STUFF__ 34 | 35 | //#include "v_video.h" 36 | 37 | #include "doomdef.h" 38 | 39 | // States for the intermission 40 | 41 | typedef enum 42 | { 43 | NoState = -1, 44 | StatCount, 45 | ShowNextLoc 46 | 47 | } stateenum_t; 48 | 49 | // Called by main loop, animate the intermission. 50 | void WI_Ticker (void); 51 | 52 | // Called by main loop, 53 | // draws the intermission directly into the screen buffer. 54 | void WI_Drawer (void); 55 | 56 | // Setup for an intermission screen. 57 | void WI_Start(wbstartstruct_t* wbstartstruct); 58 | 59 | // Release intermission screen memory 60 | void WI_End(void); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /arm9/source/z_bmalloc.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * This is designed to be a fast allocator for small, regularly used block sizes 29 | *----------------------------------------------------------------------------- 30 | */ 31 | 32 | #include "config.h" 33 | 34 | #include "doomtype.h" 35 | #include "z_zone.h" 36 | #include "z_bmalloc.h" 37 | #include "lprintf.h" 38 | 39 | typedef struct bmalpool_s { 40 | struct bmalpool_s *nextpool; 41 | size_t blocks; 42 | byte used[0]; 43 | } bmalpool_t; 44 | 45 | inline static void* getelem(bmalpool_t *p, size_t size, size_t n) 46 | { 47 | return (((byte*)p) + sizeof(bmalpool_t) + sizeof(byte)*(p->blocks) + size*n); 48 | } 49 | 50 | inline static const int iselem(const bmalpool_t *pool, size_t size, const void* p) 51 | { 52 | // CPhipps - need portable # of bytes between pointers 53 | int dif = (const char*)p - (const char*)pool; 54 | 55 | dif -= sizeof(bmalpool_t); 56 | dif -= pool->blocks; 57 | if (dif<0) return -1; 58 | dif /= size; 59 | return (((size_t)dif >= pool->blocks) ? -1 : dif); 60 | } 61 | 62 | enum { unused_block = 0, used_block = 1}; 63 | 64 | void* Z_BMalloc(struct block_memory_alloc_s *pzone) 65 | { 66 | register bmalpool_t **pool = (bmalpool_t **)&(pzone->firstpool); 67 | while (*pool != NULL) { 68 | byte *p = memchr((*pool)->used, unused_block, (*pool)->blocks); // Scan for unused marker 69 | if (p) { 70 | int n = p - (*pool)->used; 71 | #ifdef SIMPLECHECKS 72 | if ((n<0) || ((size_t)n>=(*pool)->blocks)) 73 | I_Error("Z_BMalloc: memchr returned pointer outside of array"); 74 | #endif 75 | (*pool)->used[n] = used_block; 76 | return getelem(*pool, pzone->size, n); 77 | } else 78 | pool = &((*pool)->nextpool); 79 | } 80 | { 81 | // Nothing available, must allocate a new pool 82 | bmalpool_t *newpool; 83 | 84 | // CPhipps: Allocate new memory, initialised to 0 85 | 86 | *pool = newpool = Z_Calloc(sizeof(*newpool) + (sizeof(byte) + pzone->size)*(pzone->perpool), 87 | 1, pzone->tag, NULL); 88 | newpool->nextpool = NULL; // NULL = (void*)0 so this is redundant 89 | 90 | // Return element 0 from this pool to satisfy the request 91 | newpool->used[0] = used_block; 92 | newpool->blocks = pzone->perpool; 93 | return getelem(newpool, pzone->size, 0); 94 | } 95 | } 96 | 97 | void Z_BFree(struct block_memory_alloc_s *pzone, void* p) 98 | { 99 | register bmalpool_t **pool = (bmalpool_t**)&(pzone->firstpool); 100 | 101 | while (*pool != NULL) { 102 | int n = iselem(*pool, pzone->size, p); 103 | if (n >= 0) { 104 | #ifdef SIMPLECHECKS 105 | if ((*pool)->used[n] == unused_block) 106 | I_Error("Z_BFree: Refree in zone %s", pzone->desc); 107 | #endif 108 | (*pool)->used[n] = unused_block; 109 | if (memchr(((*pool)->used), used_block, (*pool)->blocks) == NULL) { 110 | // Block is all unused, can be freed 111 | bmalpool_t *oldpool = *pool; 112 | *pool = (*pool)->nextpool; 113 | Z_Free(oldpool); 114 | } 115 | return; 116 | } else pool = &((*pool)->nextpool); 117 | } 118 | I_Error("Z_BFree: Free not in zone %s", pzone->desc); 119 | } 120 | -------------------------------------------------------------------------------- /arm9/source/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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Block memory allocator 29 | * This is designed to be a fast allocator for small, regularly used block sizes 30 | *-----------------------------------------------------------------------------*/ 31 | 32 | struct block_memory_alloc_s { 33 | void *firstpool; 34 | size_t size; 35 | size_t perpool; 36 | int tag; 37 | const char *desc; 38 | }; 39 | 40 | #define DECLARE_BLOCK_MEMORY_ALLOC_ZONE(name) extern struct block_memory_alloc_s name 41 | #define IMPLEMENT_BLOCK_MEMORY_ALLOC_ZONE(name, size, tag, num, desc) \ 42 | struct block_memory_alloc_s name = { NULL, size, num, tag, desc} 43 | #define NULL_BLOCK_MEMORY_ALLOC_ZONE(name) name.firstpool = NULL 44 | 45 | void* Z_BMalloc(struct block_memory_alloc_s *pzone); 46 | 47 | inline static void* Z_BCalloc(struct block_memory_alloc_s *pzone) 48 | { void *p = Z_BMalloc(pzone); memset(p,0,pzone->size); return p; } 49 | 50 | void Z_BFree(struct block_memory_alloc_s *pzone, void* p); 51 | -------------------------------------------------------------------------------- /arm9/source/z_zone.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 | * 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License 14 | * as published by the Free Software Foundation; either version 2 15 | * of the License, or (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 | * 02111-1307, USA. 26 | * 27 | * DESCRIPTION: 28 | * Zone Memory Allocation, perhaps NeXT ObjectiveC inspired. 29 | * Remark: this was the only stuff that, according 30 | * to John Carmack, might have been useful for 31 | * Quake. 32 | * 33 | * Rewritten by Lee Killough, though, since it was not efficient enough. 34 | * 35 | *---------------------------------------------------------------------*/ 36 | 37 | #ifndef __Z_ZONE__ 38 | #define __Z_ZONE__ 39 | 40 | #ifndef __GNUC__ 41 | #define __attribute__(x) 42 | #endif 43 | 44 | // Include system definitions so that prototypes become 45 | // active before macro replacements below are in effect. 46 | 47 | #include "config.h" 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | // ZONE MEMORY 54 | // PU - purge tags. 55 | 56 | enum {PU_FREE, PU_STATIC, PU_SOUND, PU_MUSIC, PU_LEVEL, PU_LEVSPEC, PU_CACHE, 57 | /* Must always be last -- killough */ PU_MAX}; 58 | 59 | #define PU_PURGELEVEL PU_CACHE /* First purgable tag's level */ 60 | 61 | #ifdef INSTRUMENTED 62 | #define DA(x,y) ,x,y 63 | #define DAC(x,y) x,y 64 | #else 65 | #define DA(x,y) 66 | #define DAC(x,y) 67 | #endif 68 | 69 | void *(Z_Malloc)(size_t size, int tag, void **ptr DA(const char *, int)); 70 | void (Z_Free)(void *ptr DA(const char *, int)); 71 | void (Z_FreeTags)(int lowtag, int hightag DA(const char *, int)); 72 | void (Z_ChangeTag)(void *ptr, int tag DA(const char *, int)); 73 | void (Z_Init)(void); 74 | void Z_Close(void); 75 | void *(Z_Calloc)(size_t n, size_t n2, int tag, void **user DA(const char *, int)); 76 | void *(Z_Realloc)(void *p, size_t n, int tag, void **user DA(const char *, int)); 77 | char *(Z_Strdup)(const char *s, int tag, void **user DA(const char *, int)); 78 | void (Z_CheckHeap)(DAC(const char *,int)); // killough 3/22/98: add file/line info 79 | void Z_DumpHistory(char *); 80 | 81 | #ifdef INSTRUMENTED 82 | /* cph - save space if not debugging, don't require file 83 | * and line to memory calls */ 84 | #define Z_Free(a) (Z_Free) (a, __FILE__,__LINE__) 85 | #define Z_FreeTags(a,b) (Z_FreeTags) (a,b, __FILE__,__LINE__) 86 | #define Z_ChangeTag(a,b) (Z_ChangeTag)(a,b, __FILE__,__LINE__) 87 | #define Z_Malloc(a,b,c) (Z_Malloc) (a,b,c, __FILE__,__LINE__) 88 | #define Z_Strdup(a,b,c) (Z_Strdup) (a,b,c, __FILE__,__LINE__) 89 | #define Z_Calloc(a,b,c,d) (Z_Calloc) (a,b,c,d,__FILE__,__LINE__) 90 | #define Z_Realloc(a,b,c,d) (Z_Realloc) (a,b,c,d,__FILE__,__LINE__) 91 | #define Z_CheckHeap() (Z_CheckHeap)(__FILE__,__LINE__) 92 | #endif 93 | 94 | /* cphipps 2001/11/18 - 95 | * If we're using memory mapped file access to WADs, we won't need to maintain 96 | * our own heap. So we *could* let "normal" malloc users use the libc malloc 97 | * directly, for efficiency. Except we do need a wrapper to handle out of memory 98 | * errors... damn, ok, we'll leave it for now. 99 | */ 100 | #ifndef HAVE_LIBDMALLOC 101 | // Remove all definitions before including system definitions 102 | 103 | #undef malloc 104 | #undef free 105 | #undef realloc 106 | #undef calloc 107 | #undef strdup 108 | 109 | #define malloc(n) Z_Malloc(n,PU_STATIC,0) 110 | #define free(p) Z_Free(p) 111 | #define realloc(p,n) Z_Realloc(p,n,PU_STATIC,0) 112 | #define calloc(n1,n2) Z_Calloc(n1,n2,PU_STATIC,0) 113 | #undef strdup 114 | #ifdef _CRTIMP 115 | _CRTIMP char *strdup(const char *s); 116 | #else 117 | char *strdup(const char *s); 118 | #endif 119 | #define strdup(s) Z_Strdup(s,PU_STATIC,0) 120 | 121 | #else 122 | 123 | #ifdef HAVE_LIBDMALLOC 124 | #include 125 | #endif 126 | 127 | #endif 128 | 129 | void Z_ZoneHistory(char *); 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /dsdoom.pnproj: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dsdoom.pnps: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Doom-Utils/dsdoom/2617b30099e2138dcb76e606d1887504381adea5/icon.bmp --------------------------------------------------------------------------------